Answer principles round 1: 0 🔴, 3 🟡; list the human's rule files once in the finished rule, split the dense paragraphs and the test

This commit is contained in:
2026-10-22 01:25:28 +02:00
parent eb17a4080d
commit 86a4523d9f
2 changed files with 16 additions and 16 deletions
+10 -8
View File
@@ -30,10 +30,11 @@ INTERRUPT_RULES = (
"outside the repo, or a release ready to cut, which only the human may publish\n" "outside the repo, or a release ready to cut, which only the human may publish\n"
"- it flags that the goals, the plan in todo.md or the task itself is unclear, missing or in need of change\n" "- it flags that the goals, the plan in todo.md or the task itself is unclear, missing or in need of change\n"
"- it chose between alternatives that neither README.md nor the records discriminate " "- it chose between alternatives that neither README.md nor the records discriminate "
"between - neither rules the rejected one out - and the choice materially changes the deliverable\n" "between - neither rules the rejected one out - and the choice materially changes the deliverable\n\n"
"interrupt=false otherwise. Bookkeeping the worker settled silently - what to document, wording, " "interrupt=false otherwise. Bookkeeping the worker settled silently - what to document, wording, "
"where a note goes - is not on its own a reason to interrupt. A run that ends asking loop-claude for a higher " "where a note goes - is not on its own a reason to interrupt. A run that ends asking loop-claude for a higher "
"rung is no reason to interrupt either; one that asks the human's yes to a higher rung is. The human may have replied inside the transcript, on a [human] line: judge only what " "rung is no reason to interrupt either; one that asks the human's yes to a higher rung is.\n\n"
"The human may have replied inside the transcript, on a [human] line: judge only what "
"is still open, never a question they already answered there. A [loop] line is what loop-claude told " "is still open, never a question they already answered there. A [loop] line is what loop-claude told "
"the worker, such as an answer quoted from README.md or the records.\n\n" "the worker, such as an answer quoted from README.md or the records.\n\n"
"Where the worker asked or flagged something itself, the question is that one, in the worker's own " "Where the worker asked or flagged something itself, the question is that one, in the worker's own "
@@ -46,13 +47,14 @@ QUOTE_RULES = (
"outranks finished." "outranks finished."
) )
FINISHED_RULES = ( FINISHED_RULES = (
"The chunk is the piece of work the worker is on, shipped as one pull request. " "The chunk is the piece of work the worker is on, shipped as one pull request.\n\n"
"finished=true when the chunk is complete: merged, or nothing remains that the worker could do on " "finished=true when the chunk is complete: merged, or nothing remains that the worker could do on "
f"its own. Even then, it is finished only once {ANSWERS_RECORDED}. An answer counts as recorded " f"its own. Even then, it is finished only once {ANSWERS_RECORDED}.\n\n"
"where README.md or the records above hold it, ~/.claude/CLAUDE.md, ~/.claude/rules/ and " "An answer counts as recorded where README.md or the records above hold it, the human's rules "
"~/.claude/skills/larv-review/standards/ included. It also counts where " "(~/.claude/CLAUDE.md, ~/.claude/rules/, ~/.claude/skills/larv-review/standards/) included. "
f"the transcript shows the worker writing it into {ANSWER_DESTINATIONS}; writing it into " f"It also counts where the transcript shows the worker writing it into {ANSWER_DESTINATIONS}. "
"~/.claude/CLAUDE.md, ~/.claude/rules/ or ~/.claude/skills/larv-review/standards/ does not count. finished=false when work remains that a further run can " "Writing it into one of the human's rules does not count.\n\n"
"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." "continue: an open PR, a review not yet run, CI not yet reported, an answer not yet recorded."
) )
JUDGE_RULES = "\n\n".join((INTERRUPT_RULES, QUOTE_RULES, FINISHED_RULES)) JUDGE_RULES = "\n\n".join((INTERRUPT_RULES, QUOTE_RULES, FINISHED_RULES))
+6 -8
View File
@@ -1242,14 +1242,12 @@ class JudgePrompt(unittest.TestCase):
self.assertEqual(grounds.since_step, "old " + "x" * judge.JUDGE_PROMPT_CHARS + "\n\nnew") self.assertEqual(grounds.since_step, "old " + "x" * judge.JUDGE_PROMPT_CHARS + "\n\nnew")
self.assertEqual(grounds.quotable, "## Goals\n\n") self.assertEqual(grounds.quotable, "## Goals\n\n")
def test_the_judge_prompt_calls_the_worker_the_worker_and_names_where_the_human_writes_rules(self): def test_the_judge_prompt_and_schema_call_the_worker_the_worker(self):
entries = [assistant({"type": "text", "text": "done"})] prompt, _ = judge.judge_prompt("Do it.", "## Goals", "", [assistant({"type": "text", "text": "done"})], 1)
prompt, _ = judge.judge_prompt("Do it.", "## Goals", "", entries, 1) self.assertNotRegex(prompt + json.dumps(judge.JUDGE_SCHEMA), r"\b[Aa]gent")
schema = json.dumps(judge.JUDGE_SCHEMA)
self.assertNotRegex(prompt + schema, r"\b[Aa]gent") def test_the_judge_prompt_names_every_rule_the_judge_reads_from_the_human(self):
self.assertIn("writing it into ~/.claude/CLAUDE.md, ~/.claude/rules/ or ~/.claude/skills/larv-review/standards/ does not count", prompt) self.assertEqual([name for name in records.HUMAN_RULE_NAMES if name not in judge.JUDGE_RULES], [])
for name in records.HUMAN_RULE_NAMES:
self.assertIn(name, judge.JUDGE_RULES)
def test_shows_the_judge_where_the_worker_last_stepped_up_and_checks_an_escalation_only_after_it(self): def test_shows_the_judge_where_the_worker_last_stepped_up_and_checks_an_escalation_only_after_it(self):
entries = [assistant({"type": "text", "text": "round 2: 🔴"}), assistant({"type": "text", "text": "round 3: 🔴"})] entries = [assistant({"type": "text", "text": "round 2: 🔴"}), assistant({"type": "text", "text": "round 3: 🔴"})]