Files
claude-config/bin/loop_claude/project/records.py
T

22 lines
811 B
Python

import pathlib
from loop_claude.project.checkout import read_checkout_file
from loop_claude.stop import Stop
RECORD_FILES = ("AGENTS.md", "docs/decisions.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)
def read_records(root: str) -> str | Stop:
"""The record files, each headed by its path; a file the project lacks is left out."""
records = []
for name in RECORD_FILES:
if not pathlib.Path(root, name).exists():
continue
text = read_checkout_file(root, name, "the judge cannot read the project's records")
if isinstance(text, Stop):
return text
records.append(f"From {name}:\n{text.strip()}")
return "\n\n".join(records)