18 lines
587 B
Python
18 lines
587 B
Python
import pathlib
|
|
|
|
from loop_claude.project.checkout import read_checkout_file
|
|
from loop_claude.stop import Stop
|
|
|
|
|
|
def read_records(root: str) -> str | Stop:
|
|
"""AGENTS.md and docs/decisions.md, each headed by its path; a file the project lacks is left out."""
|
|
records = []
|
|
for name in ("AGENTS.md", "docs/decisions.md"):
|
|
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)
|