Answer stability round 1: count an answer the transcript shows written, give worker and judge one finish rule, cite CLAUDE.md by its heading, test a quoted answer that cannot be archived

This commit is contained in:
2026-10-03 21:06:34 +02:00
parent 0d85574a98
commit a43ef188d3
9 changed files with 30 additions and 20 deletions
+4 -4
View File
@@ -29,11 +29,11 @@ def project_key(root: str, code: pathlib.Path) -> str:
return root.removeprefix(f"{code}/").lstrip("/")
def read_checkout_file(root: str, name: str, consequence: str) -> str | Stop:
def read_utf8(folder: str, name: str, consequence: str) -> str | Stop:
try:
return pathlib.Path(root, name).read_text(encoding="utf-8")
return pathlib.Path(folder, name).read_text(encoding="utf-8")
except OSError as failure:
return Stop(1, f"{name} in {root}: {failure.strerror} - {consequence}.")
return Stop(1, f"{name} in {folder}: {failure.strerror} - {consequence}.")
except UnicodeDecodeError as failure:
line = failure.object.count(b"\n", 0, failure.start) + 1
return Stop(1, f"{name} in {root} is not UTF-8 on line {line} - {consequence}.")
return Stop(1, f"{name} in {folder} is not UTF-8 on line {line} - {consequence}.")
+2 -2
View File
@@ -1,10 +1,10 @@
from loop_claude.project.checkout import read_checkout_file
from loop_claude.project.checkout import read_utf8
from markdown_sections import sections
from loop_claude.stop import Stop
def read_premises(root: str) -> str | Stop:
text = read_checkout_file(root, "README.md", "no premises")
text = read_utf8(root, "README.md", "no premises")
if isinstance(text, Stop):
return text
found = sections(text)
+4 -3
View File
@@ -1,6 +1,6 @@
import pathlib
from loop_claude.project.checkout import read_checkout_file
from loop_claude.project.checkout import read_utf8
from loop_claude.stop import Stop
RECORD_FILES = ("AGENTS.md", "docs/decisions.md")
@@ -11,11 +11,12 @@ QUOTE_SOURCES = "README.md's Goals and Audience, " + ", ".join(RECORD_FILES) + "
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."""
sources = [(root, name, name) for name in RECORD_FILES] + [(str(claude_md.parent), claude_md.name, HUMAN_RULES)]
records = []
for folder, name, heading in (*((root, name, name) for name in RECORD_FILES), (str(claude_md.parent), claude_md.name, HUMAN_RULES)):
for folder, name, heading in sources:
if not pathlib.Path(folder, name).exists():
continue
text = read_checkout_file(folder, name, "the judge cannot read the records")
text = read_utf8(folder, name, "the judge cannot read the records")
if isinstance(text, Stop):
return text
records.append(f"From {heading}:\n{text.strip()}")