Answer stability round 1: cite the shortened false-claim heading, keep the API-spec and tagline rules in CLAUDE.md, load the comment rules with any file, and name the judge's two rule sources apart
This commit is contained in:
@@ -7,7 +7,7 @@ from loop_claude.cycle.prompts import ANSWER_DESTINATIONS, ANSWERS_RECORDED
|
||||
from loop_claude.effects import Effects
|
||||
from failure import Failure
|
||||
from claude_code.entries import hit_limit, limit_said, parse_entry, structured_output
|
||||
from loop_claude.project.records import HUMAN_RULES
|
||||
from loop_claude.project.records import HUMAN_RULES, HUMAN_RULES_DIR
|
||||
from loop_claude.cycle.retry import Limited, retried
|
||||
from loop_claude.stop import Stop
|
||||
|
||||
@@ -39,9 +39,9 @@ JUDGE_RULES = (
|
||||
"The chunk is the piece of work the agent is on, shipped as one pull request. "
|
||||
"finished=true when the chunk is complete: merged, or nothing remains that the agent could do on "
|
||||
f"its own. Even then, it is finished only once {ANSWERS_RECORDED}. An answer counts as recorded "
|
||||
f"where README.md or the records above hold it, {' and '.join(HUMAN_RULES)} included. It also counts where "
|
||||
f"where README.md or the records above hold it, {HUMAN_RULES} and {HUMAN_RULES_DIR} included. It also counts where "
|
||||
f"the transcript shows the agent writing it into {ANSWER_DESTINATIONS}; writing it into "
|
||||
f"{' or '.join(HUMAN_RULES)} does not count. finished=false when work remains that a further run can "
|
||||
f"{HUMAN_RULES} or {HUMAN_RULES_DIR} does not count. finished=false when work remains that a further run can "
|
||||
"continue: an open PR, a review not yet run, CI not yet reported, an answer not yet recorded."
|
||||
)
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
from loop_claude.project.records import HUMAN_RULES, RECORD_FILES
|
||||
from loop_claude.project.records import HUMAN_RULES, HUMAN_RULES_DIR, RECORD_FILES
|
||||
from markdown_text import quoted
|
||||
|
||||
# Where the judge may quote an answer 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, " + ", ".join(RECORD_FILES + HUMAN_RULES[:1]) + " or " + HUMAN_RULES[1]
|
||||
QUOTE_SOURCES = "README.md's Goals and Audience, " + ", ".join(RECORD_FILES + (HUMAN_RULES,)) + " or " + HUMAN_RULES_DIR
|
||||
# Where the worker may write an answer the human typed, so it counts as recorded.
|
||||
ANSWER_DESTINATIONS = "README.md's Goals or Audience, " + ", ".join(RECORD_FILES) + ", todo.md or a comment"
|
||||
ANSWERS_RECORDED = f"every answer the human typed in it that a later chunk could need is recorded in {ANSWER_DESTINATIONS} at the one place it governs"
|
||||
|
||||
@@ -5,14 +5,15 @@ from loop_claude.stop import Stop
|
||||
|
||||
# The records: these project files and the human's rules; the judge reads them beside the README's premises.
|
||||
RECORD_FILES = ("AGENTS.md", "docs/decisions.md")
|
||||
HUMAN_RULES = ("~/.claude/CLAUDE.md", "~/.claude/rules/")
|
||||
HUMAN_RULES = "~/.claude/CLAUDE.md"
|
||||
HUMAN_RULES_DIR = "~/.claude/rules/"
|
||||
|
||||
|
||||
def read_records(root: str, claude_md: pathlib.Path) -> str | Stop:
|
||||
"""The project's record files, then the human's rules for every project, CLAUDE.md first, each headed by its name; a file that does not exist is left out."""
|
||||
rules = claude_md.parent / "rules"
|
||||
sources = [(root, name, name) for name in RECORD_FILES] + [(str(claude_md.parent), claude_md.name, HUMAN_RULES[0])]
|
||||
sources += [(str(rules), rule.name, HUMAN_RULES[1] + rule.name) for rule in sorted(rules.glob("*.md"))]
|
||||
sources = [(root, name, name) for name in RECORD_FILES] + [(str(claude_md.parent), claude_md.name, HUMAN_RULES)]
|
||||
sources += [(str(rules), rule.name, HUMAN_RULES_DIR + rule.name) for rule in sorted(rules.glob("*.md"))]
|
||||
records = []
|
||||
for folder, name, heading in sources:
|
||||
if not pathlib.Path(folder, name).exists():
|
||||
|
||||
@@ -513,7 +513,7 @@ class ExitContract(unittest.TestCase):
|
||||
def test_every_exit_1_stop_has_its_clause_in_help(self):
|
||||
read, git, premises_ = "a transcript cannot be read or archived", "git cannot start or finds no checkout", "README.md holds no premises"
|
||||
models_ = "the models file cannot be read or written"
|
||||
unreadable = f"README.md, or {', '.join(records.RECORD_FILES + records.HUMAN_RULES[:1])} or {records.HUMAN_RULES[1]}*.md where they exist, cannot be read or is not UTF-8"
|
||||
unreadable = f"README.md, or {', '.join(records.RECORD_FILES + (records.HUMAN_RULES,))} or {records.HUMAN_RULES_DIR}*.md where they exist, cannot be read or is not UTF-8"
|
||||
# Every Stop whose code is not a literal 0, 2 or 130, in source order: path, function, code, start of reason, its --help clause.
|
||||
clauses = [
|
||||
("cycle/interrupt.py", "interrupt", "1", "entries.reason", read),
|
||||
|
||||
Reference in New Issue
Block a user