File a finding and record a decision in a do-epic epic, and give the judge the epic's records beside the repo's
CI / tests (pull_request) Failing after 4m22s

This commit is contained in:
2026-11-18 23:13:43 +01:00
parent 36dbddfa0b
commit d0ecdd6359
19 changed files with 334 additions and 47 deletions
+16 -9
View File
@@ -13,28 +13,35 @@ RECORD_FILES = (WORKING_RULES[0], DECISIONS[0])
# then each .md file in the review standards folder the project's config sets.
HUMAN_RULES_FILE = "CLAUDE.md"
HUMAN_RULE_DIR = "rules"
# How the judge's prompt names the records above, in the order it reads them.
RECORDS_NAMED = "the project's working rules and decisions, then the human's rules for every project"
HUMAN_RULE_NAMES = (f"~/.claude/{HUMAN_RULES_FILE}", f"~/.claude/{HUMAN_RULE_DIR}/", "the project's review standards")
CONSEQUENCE = "the judge cannot read the records"
def read_records(root: str, home: pathlib.Path, claude_dir: pathlib.Path) -> str | Failure:
def read_records(root: str | None, home: pathlib.Path, claude_dir: pathlib.Path, first: tuple[tuple[str, str], ...] = ()) -> str | Failure:
"""The project's `AGENTS.md` and decision log, then the human's rules, CLAUDE.md first, each headed by its name; one that does not exist, or is empty, is left out.
`AGENTS.md` is read where the config under home of root's project puts it, and the decision log from the store that config names. Each is headed by its name in RECORD_FILES wherever it is kept."""
config = located(root, home)
if isinstance(config, Failure):
return Failure(f"{config.reason} - {CONSEQUENCE}.")
rules = [claude_dir / HUMAN_RULES_FILE, *sorted((claude_dir / HUMAN_RULE_DIR).glob("*.md")), *sorted(config.paths["standards"].glob("*.md"))]
decisions = store(config, DECISIONS[1]).read()
texts = [(WORKING_RULES[0], file_text(config.paths[WORKING_RULES[1]])), (DECISIONS[0], Failure(f"{decisions.reason} - {CONSEQUENCE}.") if isinstance(decisions, Failure) else decisions)]
`AGENTS.md` is read where the config under home of root's project puts it, and the decision log from the store that config names. Each is headed by its name in RECORD_FILES wherever it is kept.
first holds records kept outside the project, such as the sections of a Jira epic's description, each as its heading and text: they come before the project's. A root of None is work without a checkout, which has no project records and no review standards."""
texts: list[tuple[str, str | Failure]] = list(first)
rules = [claude_dir / HUMAN_RULES_FILE, *sorted((claude_dir / HUMAN_RULE_DIR).glob("*.md"))]
if root is not None:
config = located(root, home)
if isinstance(config, Failure):
return Failure(f"{config.reason} - {CONSEQUENCE}.")
rules += sorted(config.paths["standards"].glob("*.md"))
decisions = store(config, DECISIONS[1]).read()
texts += [(WORKING_RULES[0], file_text(config.paths[WORKING_RULES[1]])), (DECISIONS[0], Failure(f"{decisions.reason} - {CONSEQUENCE}.") if isinstance(decisions, Failure) else decisions)]
texts += [(named(rule, home, claude_dir), file_text(rule)) for rule in rules]
records = []
for heading, text in texts:
if isinstance(text, Failure):
return text
if text:
if text.strip():
records.append(f"From {heading}:\n{text.strip()}")
return "\n\n".join(records)