From 86a4523d9feb17b8d10bef7f3402390efc012366 Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Thu, 22 Oct 2026 01:25:28 +0200 Subject: [PATCH] =?UTF-8?q?Answer=20principles=20round=201:=200=20?= =?UTF-8?q?=F0=9F=94=B4,=203=20=F0=9F=9F=A1;=20list=20the=20human's=20rule?= =?UTF-8?q?=20files=20once=20in=20the=20finished=20rule,=20split=20the=20d?= =?UTF-8?q?ense=20paragraphs=20and=20the=20test?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bin/loop_claude/cycle/judge.py | 18 ++++++++++-------- bin/loop_claude/test_loop_claude.py | 14 ++++++-------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/bin/loop_claude/cycle/judge.py b/bin/loop_claude/cycle/judge.py index 078a8eee..23691223 100644 --- a/bin/loop_claude/cycle/judge.py +++ b/bin/loop_claude/cycle/judge.py @@ -30,10 +30,11 @@ INTERRUPT_RULES = ( "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 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, " "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 " "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 " @@ -46,13 +47,14 @@ QUOTE_RULES = ( "outranks finished." ) 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 " - f"its own. Even then, it is finished only once {ANSWERS_RECORDED}. An answer counts as recorded " - "where README.md or the records above hold it, ~/.claude/CLAUDE.md, ~/.claude/rules/ and " - "~/.claude/skills/larv-review/standards/ included. It also counts where " - f"the transcript shows the worker writing it into {ANSWER_DESTINATIONS}; writing it into " - "~/.claude/CLAUDE.md, ~/.claude/rules/ or ~/.claude/skills/larv-review/standards/ does not count. finished=false when work remains that a further run can " + f"its own. Even then, it is finished only once {ANSWERS_RECORDED}.\n\n" + "An answer counts as recorded where README.md or the records above hold it, the human's rules " + "(~/.claude/CLAUDE.md, ~/.claude/rules/, ~/.claude/skills/larv-review/standards/) included. " + f"It also counts where the transcript shows the worker writing it into {ANSWER_DESTINATIONS}. " + "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." ) JUDGE_RULES = "\n\n".join((INTERRUPT_RULES, QUOTE_RULES, FINISHED_RULES)) diff --git a/bin/loop_claude/test_loop_claude.py b/bin/loop_claude/test_loop_claude.py index 51adcedf..8c8bf011 100644 --- a/bin/loop_claude/test_loop_claude.py +++ b/bin/loop_claude/test_loop_claude.py @@ -1242,14 +1242,12 @@ class JudgePrompt(unittest.TestCase): self.assertEqual(grounds.since_step, "old " + "x" * judge.JUDGE_PROMPT_CHARS + "\n\nnew") 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): - entries = [assistant({"type": "text", "text": "done"})] - prompt, _ = judge.judge_prompt("Do it.", "## Goals", "", entries, 1) - schema = json.dumps(judge.JUDGE_SCHEMA) - self.assertNotRegex(prompt + schema, r"\b[Aa]gent") - self.assertIn("writing it into ~/.claude/CLAUDE.md, ~/.claude/rules/ or ~/.claude/skills/larv-review/standards/ does not count", prompt) - for name in records.HUMAN_RULE_NAMES: - self.assertIn(name, judge.JUDGE_RULES) + def test_the_judge_prompt_and_schema_call_the_worker_the_worker(self): + prompt, _ = judge.judge_prompt("Do it.", "## Goals", "", [assistant({"type": "text", "text": "done"})], 1) + self.assertNotRegex(prompt + json.dumps(judge.JUDGE_SCHEMA), r"\b[Aa]gent") + + def test_the_judge_prompt_names_every_rule_the_judge_reads_from_the_human(self): + self.assertEqual([name for name in records.HUMAN_RULE_NAMES if name not in judge.JUDGE_RULES], []) 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: 🔴"})]