Keep every answer on record: the judge reads CLAUDE.md, holds a chunk open for an unrecorded answer, and archives each answer it quotes

This commit is contained in:
2026-10-03 20:57:24 +02:00
parent c28f4ecf6b
commit a48ac5c16a
13 changed files with 85 additions and 66 deletions
+8 -7
View File
@@ -4,18 +4,19 @@ from loop_claude.project.checkout import read_checkout_file
from loop_claude.stop import Stop
RECORD_FILES = ("AGENTS.md", "docs/decisions.md")
HUMAN_RULES = "~/.claude/CLAUDE.md"
# The files a quoted answer comes from, named as the human and the worker see them; of README.md the judge sees only the premises.
QUOTE_SOURCES = "README.md's Goals and Audience, " + " or ".join(RECORD_FILES)
QUOTE_SOURCES = "README.md's Goals and Audience, " + ", ".join(RECORD_FILES) + " or " + HUMAN_RULES
def read_records(root: str) -> str | Stop:
"""The record files, each headed by its path; a file the project lacks is left out."""
def read_records(root: str, claude_md: pathlib.Path) -> str | Stop:
"""The project's record files, then the human's rules for every project, each headed by its name; a file that does not exist is left out."""
records = []
for name in RECORD_FILES:
if not pathlib.Path(root, name).exists():
for folder, name, heading in (*((root, name, name) for name in RECORD_FILES), (str(claude_md.parent), claude_md.name, HUMAN_RULES)):
if not pathlib.Path(folder, name).exists():
continue
text = read_checkout_file(root, name, "the judge cannot read the project's records")
text = read_checkout_file(folder, name, "the judge cannot read the records")
if isinstance(text, Stop):
return text
records.append(f"From {name}:\n{text.strip()}")
records.append(f"From {heading}:\n{text.strip()}")
return "\n\n".join(records)