From f3af5e23fd3376c1c027b9da64e37fd9b0a314c4 Mon Sep 17 00:00:00 2001 From: Lilleman Date: Fri, 20 Nov 2026 00:45:49 +0100 Subject: [PATCH 01/14] Stop the judge rather than show it under 50,000 characters of the transcript, read a twice-named record once, test the forge timeout and decide the merge stop from the pull requests found --- bin/agent_cycle/judge.py | 13 ++++++++++--- bin/agent_cycle/test_judge.py | 17 +++++++++++++++-- bin/chunk_driver/project/records.py | 9 +++++---- bin/chunk_driver/project/test_records.py | 4 ++++ bin/loop_effects/effects.py | 6 +++--- bin/loop_effects/test_effects.py | 5 +++++ bin/release_plan/next_chunk.py | 19 ++++++++++++------- bin/release_plan/test_release_standing.py | 2 ++ 8 files changed, 56 insertions(+), 19 deletions(-) diff --git a/bin/agent_cycle/judge.py b/bin/agent_cycle/judge.py index a80eae93..a8137108 100644 --- a/bin/agent_cycle/judge.py +++ b/bin/agent_cycle/judge.py @@ -20,6 +20,8 @@ from claude_code.tokens import tokens_of # At 3 to 4 characters a token, 100,000 to 133,000 tokens, which leaves a 200,000-token context room for the reply; the largest session rendered here was 364,000 characters on 2026-10-03. JUDGE_PROMPT_CHARS = 400000 +# The least of the transcript's tail the judge reads, about 15,000 tokens. Where the head leaves less, the judge stops, since a cut record could hide the rule that makes it interrupt. +TRANSCRIPT_FLOOR = 50000 INTERRUPT_RULES = ( """Decide whether the human must now be interrupted. ~/.claude/CLAUDE.md → "Working loop", "Ask, don't guess" says """ "which choices are reserved for the human. interrupt=true when any of these appear:\n" @@ -186,7 +188,10 @@ def judge(root: str, brief: Brief, rung: Rung, effects: Effects, keep: typing.Ca def judge_once(root: str, brief: Brief, rung: Rung, effects: Effects) -> Verdict | Failure | Limited: """One judge run on the brief, as judge retries it; judge-replay replays it.""" - prompt, grounds = judge_prompt(brief) + built = judge_prompt(brief) + if isinstance(built, Failure): + return built + prompt, grounds = built verdict = run_judge(root, judge_args(rung, brief.driver), prompt, grounds, effects) return verdict if isinstance(verdict, Failure | Limited) else escalation_mark.stamped(verdict, len(brief.entries)) @@ -292,8 +297,8 @@ def answer_checked(verdict: Verdict, quotable: str) -> Verdict: return verdict -def judge_prompt(brief: Brief) -> tuple[str, Grounds]: - """The prompt, and what the judge's quotes are checked against.""" +def judge_prompt(brief: Brief) -> tuple[str, Grounds] | Failure: + """The prompt, and what the judge's quotes are checked against; a Failure where the rest leaves less of the transcript's tail than TRANSCRIPT_FLOOR.""" head = ( f"From the goals file, {brief.premises}\n\n" f"The records: {brief.records_named}:\n{brief.records or 'none'}\n\n" @@ -303,6 +308,8 @@ def judge_prompt(brief: Brief) -> tuple[str, Grounds]: rules = judge_rules(brief.answer_destinations, brief.driver) room = max(0, JUDGE_PROMPT_CHARS - len(head) - len(rules) - 2) transcript = escalation_mark.transcript(brief.entries, brief.escalated_at, typed_answer, brief.driver) + if room < min(len(transcript), TRANSCRIPT_FLOOR): + return Failure(f"the premises, the records and the task leave the transcript {room:,} characters of the judge's {JUDGE_PROMPT_CHARS:,}, under the {TRANSCRIPT_FLOOR:,} of its tail it must read; the records take {len(brief.records):,}. Shorten them.") # The tail, where an interrupt or a finish lands; the session's transcript grows cycle over cycle. shown = transcript[max(0, len(transcript) - room):] grounds = Grounds( diff --git a/bin/agent_cycle/test_judge.py b/bin/agent_cycle/test_judge.py index 2239d010..fd67ca4d 100644 --- a/bin/agent_cycle/test_judge.py +++ b/bin/agent_cycle/test_judge.py @@ -135,9 +135,9 @@ class Verdict(unittest.TestCase): class JudgePrompt(unittest.TestCase): - def brief(self, entries, escalated_at, answer_destinations="the plan or a comment"): + def brief(self, entries, escalated_at, answer_destinations="the plan or a comment", records=""): """What the judge of a-driver reads of a transcript holding entries.""" - return judge.Brief("Do it.", "## Goals", "", "the project's decisions", answer_destinations, kinds(*entries), escalated_at, "a-driver") + return judge.Brief("Do it.", "## Goals", records, "the project's decisions", answer_destinations, kinds(*entries), escalated_at, "a-driver") def test_shows_the_transcripts_tail_and_returns_what_it_showed(self): entries = [assistant({"type": "text", "text": "old " + "x" * judge.JUDGE_PROMPT_CHARS}), assistant({"type": "text", "text": "new"})] @@ -149,6 +149,19 @@ class JudgePrompt(unittest.TestCase): self.assertEqual(grounds.after_mark, "old " + "x" * judge.JUDGE_PROMPT_CHARS + "\n\nnew") self.assertEqual(grounds.quotable, "## Goals\n\n") + def test_stops_rather_than_show_less_of_the_transcripts_tail_than_its_floor_whatever_the_size_of_the_records(self): + entries = [assistant({"type": "text", "text": "old " + "x" * judge.TRANSCRIPT_FLOOR}), assistant({"type": "text", "text": "Merged."})] + too_long = self.brief(entries, 0, records="r" * judge.JUDGE_PROMPT_CHARS) + self.assertEqual(judge.judge_prompt(too_long), Failure(f"the premises, the records and the task leave the transcript 0 characters of the judge's 400,000, under the {judge.TRANSCRIPT_FLOOR:,} of its tail it must read; the records take 400,000. Shorten them.")) + self.assertEqual(judge.judge_once("/r", too_long, Rung("judge-model"), FakeEffects(claude=[]).effects()), judge.judge_prompt(too_long)) + prompt, grounds = judge.judge_prompt(self.brief(entries, 0, records="r" * (judge.JUDGE_PROMPT_CHARS - judge.TRANSCRIPT_FLOOR - 10000))) + self.assertTrue(grounds.shown.endswith("\n\nMerged.")) + self.assertGreaterEqual(len(grounds.shown), judge.TRANSCRIPT_FLOOR) + self.assertLessEqual(len(prompt), judge.JUDGE_PROMPT_CHARS) + short = [assistant({"type": "text", "text": "Merged."})] + _, grounds = judge.judge_prompt(self.brief(short, 0, records="r" * (judge.JUDGE_PROMPT_CHARS - 10000))) + self.assertEqual(grounds.shown, "Merged.", "a transcript shorter than the floor needs only its own length") + def test_the_judge_prompt_and_schema_call_the_worker_the_worker(self): prompt, _ = judge.judge_prompt(self.brief([assistant({"type": "text", "text": "done"})], 1)) self.assertNotRegex(prompt + json.dumps(judge.judge_schema("a-driver")), r"\b[Aa]gent") diff --git a/bin/chunk_driver/project/records.py b/bin/chunk_driver/project/records.py index 14769dd6..2947d66a 100644 --- a/bin/chunk_driver/project/records.py +++ b/bin/chunk_driver/project/records.py @@ -22,7 +22,7 @@ CONSEQUENCE = "the judge cannot read the records" def read_records(root: str | None, home: pathlib.Path, claude_dir: pathlib.Path, first: tuple[tuple[str, str], ...] = ()) -> str | Failure: - """The project's `AGENTS.md` and decision log, then the human's rules, CLAUDE.md first, each headed by its name; one that does not exist, or is empty, is left out. + """The project's `AGENTS.md` and decision log, then the human's rules, CLAUDE.md first, each headed by its name; one that does not exist, or is empty, is left out, and one whose text an earlier one holds is read once, under both names. `AGENTS.md` is read where the config under home of root's project puts it, and the decision log from the store that config names. Each is headed by its name in RECORD_FILES wherever it is kept. @@ -37,13 +37,14 @@ def read_records(root: str | None, home: pathlib.Path, claude_dir: pathlib.Path, decisions = store(config, DECISIONS[1]).read() texts += [(WORKING_RULES[0], file_text(config.paths[WORKING_RULES[1]])), (DECISIONS[0], Failure(f"{decisions.reason} - {CONSEQUENCE}.") if isinstance(decisions, Failure) else decisions)] texts += [(named(rule, home, claude_dir), file_text(rule)) for rule in rules] - records = [] + # Each text, with the headings it is read under: a config may put the working rules in the decision log. + records: dict[str, list[str]] = {} for heading, text in texts: if isinstance(text, Failure): return text if text.strip(): - records.append(f"From {heading}:\n{text.strip()}") - return "\n\n".join(records) + records.setdefault(text.strip(), []).append(heading) + return "\n\n".join(f"From {' and '.join(headings)}:\n{text}" for text, headings in records.items()) def file_text(path: pathlib.Path) -> str | Failure: diff --git a/bin/chunk_driver/project/test_records.py b/bin/chunk_driver/project/test_records.py index be0f4590..38f4205f 100644 --- a/bin/chunk_driver/project/test_records.py +++ b/bin/chunk_driver/project/test_records.py @@ -40,6 +40,10 @@ class Records(unittest.TestCase): pathlib.Path(root, "standards", "quality.md").write_text("# Elsewhere\n") self.assertTrue(records.read_records(root, claude_md.parents[1], claude_md.parent).endswith(f"From {root}/standards/quality.md:\n# Elsewhere"), "a folder outside home is named in full") + config.write_text(config.read_text().replace('"checkout:AGENTS.md"', '"checkout:docs/decisions.md"')) + self.assertTrue(records.read_records(root, claude_md.parents[1], claude_md.parent).startswith("From AGENTS.md and docs/decisions.md:\n# Decisions\n\nFrom ~/.claude/CLAUDE.md:\n# Global"), "a record the config names twice is read once") + config.write_text(config.read_text().replace('"checkout:docs/decisions.md"', '"checkout:AGENTS.md"', 1)) + config.write_text(config.read_text().replace('"checkout:AGENTS.md"', '"folder:AGENTS.md"').replace('"checkout:docs/decisions.md"', '"folder:log/decisions.md"')) self.assertTrue(records.read_records(root, claude_md.parents[1], claude_md.parent).startswith("From ~/.claude/CLAUDE.md:\n# Global"), "the checkout's AGENTS.md and docs/decisions.md are its owners'") pathlib.Path(config.parent, "log").mkdir() diff --git a/bin/loop_effects/effects.py b/bin/loop_effects/effects.py index 6d58130c..bc90ba50 100644 --- a/bin/loop_effects/effects.py +++ b/bin/loop_effects/effects.py @@ -114,10 +114,10 @@ class StreamingClaude: return self.proc.wait() -def system_effects(home: pathlib.Path, env: typing.Mapping[str, str], backends: typing.Mapping[Notifier, Backend[typing.Any]] = BACKENDS) -> Effects: +def system_effects(home: pathlib.Path, env: typing.Mapping[str, str], backends: typing.Mapping[Notifier, Backend[typing.Any]] = BACKENDS, forge_timeout: float = FORGE_TIMEOUT) -> Effects: """The effects on this machine: the configs of its DM are under home, and tmux runs in env. - A test hands in `backends`, the notifiers loop-claude's DM can go through, that send nowhere. + A test hands in `backends`, the notifiers loop-claude's DM can go through, that send nowhere, and a `forge_timeout` short enough to wait out. """ return Effects( claude=lambda args, cwd, stdin: subprocess.run(["claude", *args], capture_output=True, cwd=cwd, input=stdin, text=True), @@ -125,7 +125,7 @@ def system_effects(home: pathlib.Path, env: typing.Mapping[str, str], backends: discard_typed=lambda: termios.tcflush(sys.stdin, termios.TCIFLUSH), dm=lambda text, directory: notify(text, directory, home, backends), execv=os.execv, - forge=lambda cwd: runner(cwd, FORGE_TIMEOUT), + forge=lambda cwd: runner(cwd, forge_timeout), git=git_repo.git, input=input, local_time=lambda seconds: time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(seconds)), diff --git a/bin/loop_effects/test_effects.py b/bin/loop_effects/test_effects.py index 38efc268..bf414a15 100644 --- a/bin/loop_effects/test_effects.py +++ b/bin/loop_effects/test_effects.py @@ -13,6 +13,7 @@ import unittest sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[1])) +from failure import Failure from loop_effects import child_shells from loop_effects.effects import run_python, say, start_timer, StreamingClaude, system_effects @@ -104,6 +105,10 @@ class ForgeEffect(unittest.TestCase): with tempfile.TemporaryDirectory() as folder: self.assertEqual(system_effects(pathlib.Path.home(), os.environ).forge(folder)(["pwd", "-P"]), os.path.realpath(folder) + "\n") + def test_stops_a_command_of_the_forges_cli_that_outlasts_its_timeout(self): + with tempfile.TemporaryDirectory() as folder: + self.assertEqual(system_effects(pathlib.Path.home(), os.environ, forge_timeout=0.1).forge(folder)(["sleep", "5"]), Failure("sleep 5: stopped after 0.1 s")) + class TmuxEffect(unittest.TestCase): """Each test runs a fake tmux off its own PATH, without $TMUX, so the human's tmux server is never reached.""" diff --git a/bin/release_plan/next_chunk.py b/bin/release_plan/next_chunk.py index bbed2388..d8622f04 100644 --- a/bin/release_plan/next_chunk.py +++ b/bin/release_plan/next_chunk.py @@ -84,8 +84,8 @@ def planned(read: Plan | Failure, cut: LastCut, default: str, branch: str, outsi return NoItem(f"{where} holds no item for {upcoming}, and no change is unreleased, so that release is to be planned first.") first = pick.item if first is None and pick.release is not None: - merges = awaited_merges(weighed.carried, pick.release) - return NoItem(f"every item of release {version(pick.release)} in {where} waits.{merges}", awaits_merge=bool(merges)) + pulls = awaited_merges(weighed.carried, pick.release) + return NoItem(f"every item of release {version(pick.release)} in {where} waits.{merge_stop(pulls)}", awaits_merge=bool(pulls)) if first is None: return NoItem(f"{where}'s items table holds no item.") held = weighed.carried @@ -100,13 +100,18 @@ def planned(read: Plan | Failure, cut: LastCut, default: str, branch: str, outsi return NextChunk(held, first, f"{first.tagline}\n\n{first.detail}".strip(), branch, over, item_id is not None) -def awaited_merges(found: list[Item], release: Release) -> str: - """The sentences that stop the working loop where items of release await a person's merge, naming each pull request with the items it finishes; empty where none does.""" - pulls: dict[str, list[str]] = {} +def awaited_merges(found: list[Item], release: Release) -> dict[str, list[int]]: + """Each pull request, as `# `, that finishes items of release and awaits a person's merge, with those items' IDs.""" + pulls: dict[str, list[int]] = {} for item in found: if item.release == release and item.awaits_merge: - pulls.setdefault(item.awaits_merge, []).append(str(item.id)) + pulls.setdefault(item.awaits_merge, []).append(item.id) + return pulls + + +def merge_stop(pulls: dict[str, list[int]]) -> str: + """The sentences that stop the working loop where pulls await a person's merge, naming each with the items it finishes; empty where none does.""" if not pulls: return "" - named = "; ".join(f"{pull}, which finishes item{'s' if len(ids) > 1 else ''} {listed(ids, 'and')}" for pull, ids in pulls.items()) + named = "; ".join(f"{pull}, which finishes item{'s' if len(ids) > 1 else ''} {listed([str(item_id) for item_id in ids], 'and')}" for pull, ids in pulls.items()) return f" Under `merge = \"human\"`, these pull requests await a person's merge: {named}. The working loop stops here. Once a person has merged one, or turned one back into a draft, run loop-claude again." diff --git a/bin/release_plan/test_release_standing.py b/bin/release_plan/test_release_standing.py index faefb665..36c52749 100644 --- a/bin/release_plan/test_release_standing.py +++ b/bin/release_plan/test_release_standing.py @@ -475,4 +475,6 @@ class AwaitingMerge(unittest.TestCase): none = next_chunk.planned(Plan(items), held.cut, "main", "item-{id}") self.assertEqual(none.why, "every item of release 0.1.0 in main's todo.md waits. Under `merge = \"human\"`, these pull requests await a person's merge: #7 https://github.com/o/r/pull/7, which finishes item 1; #8 https://github.com/o/r/pull/8, which finishes items 2 and 3. The working loop stops here. Once a person has merged one, or turned one back into a draft, run loop-claude again.") self.assertTrue(none.awaits_merge) + later = dataclasses.replace(items[0], id=9, release=(0, 2, 0), awaits_merge="#10 https://github.com/o/r/pull/10") + self.assertEqual(next_chunk.awaited_merges([*items, later], (0, 1, 0)), {"#7 https://github.com/o/r/pull/7": [1], "#8 https://github.com/o/r/pull/8": [2, 3]}, "a pull request that finishes only a later release's items doesn't count") self.assertFalse(next_chunk.planned(Plan([dataclasses.replace(item, awaits_merge="", exempt="question") for item in items]), held.cut, "main", "item-{id}").awaits_merge) -- 2.52.0 From 9e41a4fc64f22a9898ae5abeacbd861aa1d59f2c Mon Sep 17 00:00:00 2001 From: Lilleman Date: Fri, 20 Nov 2026 00:48:42 +0100 Subject: [PATCH 02/14] Name the judge's transcript floor in loop-claude's help and sort the effects test's imports --- bin/loop_claude/loop/test_usage.py | 1 + bin/loop_claude/loop/usage.py | 9 +++++---- bin/loop_effects/test_effects.py | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/bin/loop_claude/loop/test_usage.py b/bin/loop_claude/loop/test_usage.py index 1bb4148c..a2492699 100644 --- a/bin/loop_claude/loop/test_usage.py +++ b/bin/loop_claude/loop/test_usage.py @@ -101,6 +101,7 @@ class JudgeFailures(unittest.TestCase): ("run_judge", "verdict.reason", field), ("run_judge", "checked.reason", "quotes a passage that neither the task nor the transcript holds"), ("misquoted_evidence", "f'the judge quoted {verdict.evidence!r}, which is not in the task or the transcript", "quotes a passage that neither the task nor the transcript holds"), + ("judge_prompt", "f\"the premises, the records and the task leave the transcript", "leave it room for less than the last 50,000 characters of the transcript"), ("claude_reply", "f'could not start claude:", started), ("claude_reply", "proc.stderr.strip() or f'{who} exited", exited), ("claude_reply", 'f"{who} printed no json reply', unparsed), diff --git a/bin/loop_claude/loop/usage.py b/bin/loop_claude/loop/usage.py index 2b065b50..ab9c6dc6 100644 --- a/bin/loop_claude/loop/usage.py +++ b/bin/loop_claude/loop/usage.py @@ -186,10 +186,11 @@ Exit 1, saying why, when: handover - the worker or the judge fails three times running, retried a minute apart within the cycle. A worker fails when claude cannot start, exits non-zero, is killed, or ends without a result event; - a judge when claude cannot start, exits non-zero or prints no json reply, or its reply misses or - mistypes a field, interrupts or quotes an answer without a question, or quotes a passage that - neither the task nor the transcript holds, where each fragment of an elided quote must appear in - order, in the task then the transcript. + a judge when the premises, the records and the task leave it room for less than the last 50,000 + characters of the transcript, when claude cannot start, exits non-zero or prints no json reply, or + when its reply misses or mistypes a field, interrupts or quotes an answer without a question, or + quotes a passage that neither the task nor the transcript holds, where each fragment of an elided + quote must appear in order, in the task then the transcript. A usage limit is not a failure, and restarts the count of three: the worker or the judge is retried 2 minutes after the limit resets, or every 10 minutes when the reset time is unknown or more than 2 minutes past. The judge's reply gives its reset time only as text, so the judge is diff --git a/bin/loop_effects/test_effects.py b/bin/loop_effects/test_effects.py index bf414a15..009020ae 100644 --- a/bin/loop_effects/test_effects.py +++ b/bin/loop_effects/test_effects.py @@ -13,8 +13,8 @@ import unittest sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[1])) -from failure import Failure from loop_effects import child_shells +from failure import Failure from loop_effects.effects import run_python, say, start_timer, StreamingClaude, system_effects NOW = 1790000000 -- 2.52.0 From 4fe37104aa524e224322bdfe826b5bd14f2b3fa3 Mon Sep 17 00:00:00 2001 From: Lilleman Date: Fri, 20 Nov 2026 00:48:51 +0100 Subject: [PATCH 03/14] Say that a record is read once where its text equals an earlier one's --- bin/chunk_driver/project/records.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/chunk_driver/project/records.py b/bin/chunk_driver/project/records.py index 2947d66a..1665f99d 100644 --- a/bin/chunk_driver/project/records.py +++ b/bin/chunk_driver/project/records.py @@ -22,7 +22,7 @@ CONSEQUENCE = "the judge cannot read the records" def read_records(root: str | None, home: pathlib.Path, claude_dir: pathlib.Path, first: tuple[tuple[str, str], ...] = ()) -> str | Failure: - """The project's `AGENTS.md` and decision log, then the human's rules, CLAUDE.md first, each headed by its name; one that does not exist, or is empty, is left out, and one whose text an earlier one holds is read once, under both names. + """The project's `AGENTS.md` and decision log, then the human's rules, CLAUDE.md first, each headed by its name; one that does not exist, or is empty, is left out, and one with the same text as an earlier one is read once, under both names. `AGENTS.md` is read where the config under home of root's project puts it, and the decision log from the store that config names. Each is headed by its name in RECORD_FILES wherever it is kept. -- 2.52.0 From 105e7236171bad693676cf824ad287fab3a3c543 Mon Sep 17 00:00:00 2001 From: Lilleman Date: Fri, 20 Nov 2026 00:50:04 +0100 Subject: [PATCH 04/14] =?UTF-8?q?Answer=20security=20round=201:=200=20?= =?UTF-8?q?=F0=9F=94=B4,=200=20=F0=9F=9F=A1=20(0=20misread);=20no=20findin?= =?UTF-8?q?gs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit -- 2.52.0 From 32a81b02572c190f916fe2a406b0f55b72f805d7 Mon Sep 17 00:00:00 2001 From: Lilleman Date: Fri, 20 Nov 2026 00:59:11 +0100 Subject: [PATCH 05/14] Test that a head leaving exactly the floor still shows the transcript --- bin/agent_cycle/test_judge.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/bin/agent_cycle/test_judge.py b/bin/agent_cycle/test_judge.py index fd67ca4d..cd12eb15 100644 --- a/bin/agent_cycle/test_judge.py +++ b/bin/agent_cycle/test_judge.py @@ -158,6 +158,10 @@ class JudgePrompt(unittest.TestCase): self.assertTrue(grounds.shown.endswith("\n\nMerged.")) self.assertGreaterEqual(len(grounds.shown), judge.TRANSCRIPT_FLOOR) self.assertLessEqual(len(prompt), judge.JUDGE_PROMPT_CHARS) + room = judge.JUDGE_PROMPT_CHARS - (len(prompt) - len(grounds.shown)) + at_floor = judge.JUDGE_PROMPT_CHARS - 10000 + room - 2 * judge.TRANSCRIPT_FLOOR + self.assertEqual(len(judge.judge_prompt(self.brief(entries, 0, records="r" * at_floor))[1].shown), judge.TRANSCRIPT_FLOOR, "a head that leaves exactly the floor still shows it") + self.assertIsInstance(judge.judge_prompt(self.brief(entries, 0, records="r" * (at_floor + 1))), Failure) short = [assistant({"type": "text", "text": "Merged."})] _, grounds = judge.judge_prompt(self.brief(short, 0, records="r" * (judge.JUDGE_PROMPT_CHARS - 10000))) self.assertEqual(grounds.shown, "Merged.", "a transcript shorter than the floor needs only its own length") -- 2.52.0 From e062f71d4710c05069e403d75a7c1ace445e2c3c Mon Sep 17 00:00:00 2001 From: Lilleman Date: Fri, 20 Nov 2026 01:24:21 +0100 Subject: [PATCH 06/14] =?UTF-8?q?Answer=20stability=20round=201:=200=20?= =?UTF-8?q?=F0=9F=94=B4,=202=20=F0=9F=9F=A1=20(0=20misread);=20tie=20the?= =?UTF-8?q?=20help's=20transcript=20floor=20to=20TRANSCRIPT=5FFLOOR,=20spl?= =?UTF-8?q?it=20the=20floor=20test,=20and=20name=20the=20shortfall=20in=20?= =?UTF-8?q?the=20judge's=20failure,=20with=20the=20prose=20round's=20wordi?= =?UTF-8?q?ng?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bin/agent_cycle/judge.py | 11 +++--- bin/agent_cycle/test_judge.py | 43 +++++++++++++++++------- bin/chunk_driver/project/records.py | 4 +-- bin/chunk_driver/project/test_records.py | 2 +- bin/loop_claude/loop/test_usage.py | 2 +- bin/loop_claude/loop/usage.py | 11 +++--- bin/loop_effects/effects.py | 2 +- bin/release_plan/next_chunk.py | 2 +- 8 files changed, 48 insertions(+), 29 deletions(-) diff --git a/bin/agent_cycle/judge.py b/bin/agent_cycle/judge.py index a8137108..79cd9b8c 100644 --- a/bin/agent_cycle/judge.py +++ b/bin/agent_cycle/judge.py @@ -20,7 +20,7 @@ from claude_code.tokens import tokens_of # At 3 to 4 characters a token, 100,000 to 133,000 tokens, which leaves a 200,000-token context room for the reply; the largest session rendered here was 364,000 characters on 2026-10-03. JUDGE_PROMPT_CHARS = 400000 -# The least of the transcript's tail the judge reads, about 15,000 tokens. Where the head leaves less, the judge stops, since a cut record could hide the rule that makes it interrupt. +# The judge reads the transcript's last 50,000 characters at least, about 15,000 tokens, or all of a shorter one. Where the rest of its prompt leaves less room, the judge doesn't run, since a cut record could hide the rule that makes it interrupt. TRANSCRIPT_FLOOR = 50000 INTERRUPT_RULES = ( """Decide whether the human must now be interrupted. ~/.claude/CLAUDE.md → "Working loop", "Ask, don't guess" says """ @@ -298,7 +298,7 @@ def answer_checked(verdict: Verdict, quotable: str) -> Verdict: def judge_prompt(brief: Brief) -> tuple[str, Grounds] | Failure: - """The prompt, and what the judge's quotes are checked against; a Failure where the rest leaves less of the transcript's tail than TRANSCRIPT_FLOOR.""" + """The prompt, and what the judge's quotes are checked against; a Failure where the premises, the records, the task and the rules leave room for less than the transcript's last TRANSCRIPT_FLOOR characters, or all of a shorter transcript.""" head = ( f"From the goals file, {brief.premises}\n\n" f"The records: {brief.records_named}:\n{brief.records or 'none'}\n\n" @@ -306,10 +306,11 @@ def judge_prompt(brief: Brief) -> tuple[str, Grounds] | Failure: f"{transcript_heading(brief.driver)}" ) rules = judge_rules(brief.answer_destinations, brief.driver) - room = max(0, JUDGE_PROMPT_CHARS - len(head) - len(rules) - 2) + room = JUDGE_PROMPT_CHARS - len(head) - len(rules) - 2 transcript = escalation_mark.transcript(brief.entries, brief.escalated_at, typed_answer, brief.driver) - if room < min(len(transcript), TRANSCRIPT_FLOOR): - return Failure(f"the premises, the records and the task leave the transcript {room:,} characters of the judge's {JUDGE_PROMPT_CHARS:,}, under the {TRANSCRIPT_FLOOR:,} of its tail it must read; the records take {len(brief.records):,}. Shorten them.") + needed = min(len(transcript), TRANSCRIPT_FLOOR) + if room < needed: + return Failure(f"the premises, the records, the task and the judge's rules leave {max(0, room):,} of the judge's {JUDGE_PROMPT_CHARS:,} characters for the transcript, less than the last {needed:,} characters of it that the judge must read. Cut the records, which take {len(brief.records):,}, by at least {needed - room:,}.") # The tail, where an interrupt or a finish lands; the session's transcript grows cycle over cycle. shown = transcript[max(0, len(transcript) - room):] grounds = Grounds( diff --git a/bin/agent_cycle/test_judge.py b/bin/agent_cycle/test_judge.py index cd12eb15..e104de19 100644 --- a/bin/agent_cycle/test_judge.py +++ b/bin/agent_cycle/test_judge.py @@ -149,22 +149,39 @@ class JudgePrompt(unittest.TestCase): self.assertEqual(grounds.after_mark, "old " + "x" * judge.JUDGE_PROMPT_CHARS + "\n\nnew") self.assertEqual(grounds.quotable, "## Goals\n\n") - def test_stops_rather_than_show_less_of_the_transcripts_tail_than_its_floor_whatever_the_size_of_the_records(self): - entries = [assistant({"type": "text", "text": "old " + "x" * judge.TRANSCRIPT_FLOOR}), assistant({"type": "text", "text": "Merged."})] - too_long = self.brief(entries, 0, records="r" * judge.JUDGE_PROMPT_CHARS) - self.assertEqual(judge.judge_prompt(too_long), Failure(f"the premises, the records and the task leave the transcript 0 characters of the judge's 400,000, under the {judge.TRANSCRIPT_FLOOR:,} of its tail it must read; the records take 400,000. Shorten them.")) - self.assertEqual(judge.judge_once("/r", too_long, Rung("judge-model"), FakeEffects(claude=[]).effects()), judge.judge_prompt(too_long)) - prompt, grounds = judge.judge_prompt(self.brief(entries, 0, records="r" * (judge.JUDGE_PROMPT_CHARS - judge.TRANSCRIPT_FLOOR - 10000))) + # A transcript longer than the floor: an old message, then the last one. + LONG = [assistant({"type": "text", "text": "old " + "x" * judge.TRANSCRIPT_FLOOR}), assistant({"type": "text", "text": "Merged."})] + + def overhead(self): + """The characters of the judge's prompt that are neither the records nor the transcript.""" + prompt, grounds = judge.judge_prompt(self.brief(self.LONG, 0, records="r")) + return len(prompt) - len(grounds.shown) - 1 + + def test_fails_naming_the_shortfall_where_the_records_leave_less_than_the_transcripts_floor(self): + failed = judge.judge_prompt(self.brief(self.LONG, 0, records="r" * (judge.JUDGE_PROMPT_CHARS + 1))) + self.assertIsInstance(failed, Failure) + for fact in ("400,000", "400,001", f"{judge.TRANSCRIPT_FLOOR:,}", f"by at least {judge.TRANSCRIPT_FLOOR + self.overhead() + 1:,}"): + self.assertIn(fact, failed.reason) + + def test_judge_once_returns_that_failure_without_starting_claude(self): + failed = judge.judge_once("/r", self.brief(self.LONG, 0, records="r" * judge.JUDGE_PROMPT_CHARS), Rung("judge-model"), FakeEffects(claude=[]).effects()) + self.assertIsInstance(failed, Failure) + self.assertIn(f"{judge.TRANSCRIPT_FLOOR:,}", failed.reason) + + def test_shows_more_than_the_floor_of_the_transcripts_tail_where_the_records_leave_room(self): + prompt, grounds = judge.judge_prompt(self.brief(self.LONG, 0, records="r" * (judge.JUDGE_PROMPT_CHARS - judge.TRANSCRIPT_FLOOR - 10000))) self.assertTrue(grounds.shown.endswith("\n\nMerged.")) self.assertGreaterEqual(len(grounds.shown), judge.TRANSCRIPT_FLOOR) self.assertLessEqual(len(prompt), judge.JUDGE_PROMPT_CHARS) - room = judge.JUDGE_PROMPT_CHARS - (len(prompt) - len(grounds.shown)) - at_floor = judge.JUDGE_PROMPT_CHARS - 10000 + room - 2 * judge.TRANSCRIPT_FLOOR - self.assertEqual(len(judge.judge_prompt(self.brief(entries, 0, records="r" * at_floor))[1].shown), judge.TRANSCRIPT_FLOOR, "a head that leaves exactly the floor still shows it") - self.assertIsInstance(judge.judge_prompt(self.brief(entries, 0, records="r" * (at_floor + 1))), Failure) - short = [assistant({"type": "text", "text": "Merged."})] - _, grounds = judge.judge_prompt(self.brief(short, 0, records="r" * (judge.JUDGE_PROMPT_CHARS - 10000))) - self.assertEqual(grounds.shown, "Merged.", "a transcript shorter than the floor needs only its own length") + + def test_shows_the_floor_where_the_records_leave_exactly_that(self): + at_floor = judge.JUDGE_PROMPT_CHARS - self.overhead() - judge.TRANSCRIPT_FLOOR + self.assertEqual(len(judge.judge_prompt(self.brief(self.LONG, 0, records="r" * at_floor))[1].shown), judge.TRANSCRIPT_FLOOR) + self.assertIsInstance(judge.judge_prompt(self.brief(self.LONG, 0, records="r" * (at_floor + 1))), Failure) + + def test_shows_a_transcript_shorter_than_the_floor_whole(self): + _, grounds = judge.judge_prompt(self.brief([assistant({"type": "text", "text": "Merged."})], 0, records="r" * (judge.JUDGE_PROMPT_CHARS - 10000))) + self.assertEqual(grounds.shown, "Merged.") def test_the_judge_prompt_and_schema_call_the_worker_the_worker(self): prompt, _ = judge.judge_prompt(self.brief([assistant({"type": "text", "text": "done"})], 1)) diff --git a/bin/chunk_driver/project/records.py b/bin/chunk_driver/project/records.py index 1665f99d..352e2d54 100644 --- a/bin/chunk_driver/project/records.py +++ b/bin/chunk_driver/project/records.py @@ -22,7 +22,7 @@ CONSEQUENCE = "the judge cannot read the records" def read_records(root: str | None, home: pathlib.Path, claude_dir: pathlib.Path, first: tuple[tuple[str, str], ...] = ()) -> str | Failure: - """The project's `AGENTS.md` and decision log, then the human's rules, CLAUDE.md first, each headed by its name; one that does not exist, or is empty, is left out, and one with the same text as an earlier one is read once, under both names. + """The project's `AGENTS.md` and decision log, then the human's rules, CLAUDE.md first, each headed by its name. One that does not exist, or is empty, is left out. A text that several of them hold appears once, headed by all their names. `AGENTS.md` is read where the config under home of root's project puts it, and the decision log from the store that config names. Each is headed by its name in RECORD_FILES wherever it is kept. @@ -37,7 +37,7 @@ def read_records(root: str | None, home: pathlib.Path, claude_dir: pathlib.Path, decisions = store(config, DECISIONS[1]).read() texts += [(WORKING_RULES[0], file_text(config.paths[WORKING_RULES[1]])), (DECISIONS[0], Failure(f"{decisions.reason} - {CONSEQUENCE}.") if isinstance(decisions, Failure) else decisions)] texts += [(named(rule, home, claude_dir), file_text(rule)) for rule in rules] - # Each text, with the headings it is read under: a config may put the working rules in the decision log. + # Each text, with the names of the records that hold it: a config may keep the working rules in the decision log. records: dict[str, list[str]] = {} for heading, text in texts: if isinstance(text, Failure): diff --git a/bin/chunk_driver/project/test_records.py b/bin/chunk_driver/project/test_records.py index 38f4205f..4766709f 100644 --- a/bin/chunk_driver/project/test_records.py +++ b/bin/chunk_driver/project/test_records.py @@ -41,7 +41,7 @@ class Records(unittest.TestCase): self.assertTrue(records.read_records(root, claude_md.parents[1], claude_md.parent).endswith(f"From {root}/standards/quality.md:\n# Elsewhere"), "a folder outside home is named in full") config.write_text(config.read_text().replace('"checkout:AGENTS.md"', '"checkout:docs/decisions.md"')) - self.assertTrue(records.read_records(root, claude_md.parents[1], claude_md.parent).startswith("From AGENTS.md and docs/decisions.md:\n# Decisions\n\nFrom ~/.claude/CLAUDE.md:\n# Global"), "a record the config names twice is read once") + self.assertTrue(records.read_records(root, claude_md.parents[1], claude_md.parent).startswith("From AGENTS.md and docs/decisions.md:\n# Decisions\n\nFrom ~/.claude/CLAUDE.md:\n# Global"), "a file the config names for two records appears once") config.write_text(config.read_text().replace('"checkout:docs/decisions.md"', '"checkout:AGENTS.md"', 1)) config.write_text(config.read_text().replace('"checkout:AGENTS.md"', '"folder:AGENTS.md"').replace('"checkout:docs/decisions.md"', '"folder:log/decisions.md"')) diff --git a/bin/loop_claude/loop/test_usage.py b/bin/loop_claude/loop/test_usage.py index a2492699..6248ec56 100644 --- a/bin/loop_claude/loop/test_usage.py +++ b/bin/loop_claude/loop/test_usage.py @@ -101,7 +101,7 @@ class JudgeFailures(unittest.TestCase): ("run_judge", "verdict.reason", field), ("run_judge", "checked.reason", "quotes a passage that neither the task nor the transcript holds"), ("misquoted_evidence", "f'the judge quoted {verdict.evidence!r}, which is not in the task or the transcript", "quotes a passage that neither the task nor the transcript holds"), - ("judge_prompt", "f\"the premises, the records and the task leave the transcript", "leave it room for less than the last 50,000 characters of the transcript"), + ("judge_prompt", "f\"the premises, the records, the task and the judge's rules leave", f"leave room for less than the last {judge.TRANSCRIPT_FLOOR:,} characters of the transcript, or all of a shorter one"), ("claude_reply", "f'could not start claude:", started), ("claude_reply", "proc.stderr.strip() or f'{who} exited", exited), ("claude_reply", 'f"{who} printed no json reply', unparsed), diff --git a/bin/loop_claude/loop/usage.py b/bin/loop_claude/loop/usage.py index ab9c6dc6..7c5e216b 100644 --- a/bin/loop_claude/loop/usage.py +++ b/bin/loop_claude/loop/usage.py @@ -186,11 +186,12 @@ Exit 1, saying why, when: handover - the worker or the judge fails three times running, retried a minute apart within the cycle. A worker fails when claude cannot start, exits non-zero, is killed, or ends without a result event; - a judge when the premises, the records and the task leave it room for less than the last 50,000 - characters of the transcript, when claude cannot start, exits non-zero or prints no json reply, or - when its reply misses or mistypes a field, interrupts or quotes an answer without a question, or - quotes a passage that neither the task nor the transcript holds, where each fragment of an elided - quote must appear in order, in the task then the transcript. + a judge when the premises, the records, the task and the judge's rules leave room for less than + the last 50,000 characters of the transcript, or all of a shorter one, when claude cannot start, + exits non-zero or prints no json reply, or when its reply misses or mistypes a field, interrupts + or quotes an answer without a question, or quotes a passage that neither the task nor the + transcript holds, where each fragment of an elided quote must appear in order, in the task then + the transcript. A usage limit is not a failure, and restarts the count of three: the worker or the judge is retried 2 minutes after the limit resets, or every 10 minutes when the reset time is unknown or more than 2 minutes past. The judge's reply gives its reset time only as text, so the judge is diff --git a/bin/loop_effects/effects.py b/bin/loop_effects/effects.py index bc90ba50..ef827333 100644 --- a/bin/loop_effects/effects.py +++ b/bin/loop_effects/effects.py @@ -117,7 +117,7 @@ class StreamingClaude: def system_effects(home: pathlib.Path, env: typing.Mapping[str, str], backends: typing.Mapping[Notifier, Backend[typing.Any]] = BACKENDS, forge_timeout: float = FORGE_TIMEOUT) -> Effects: """The effects on this machine: the configs of its DM are under home, and tmux runs in env. - A test hands in `backends`, the notifiers loop-claude's DM can go through, that send nowhere, and a `forge_timeout` short enough to wait out. + A test hands in `backends` that don't send anything, in place of the notifiers loop-claude's DM goes through. It hands in a short `forge_timeout`, so a command that outlasts it ends quickly. """ return Effects( claude=lambda args, cwd, stdin: subprocess.run(["claude", *args], capture_output=True, cwd=cwd, input=stdin, text=True), diff --git a/bin/release_plan/next_chunk.py b/bin/release_plan/next_chunk.py index d8622f04..5d932ff6 100644 --- a/bin/release_plan/next_chunk.py +++ b/bin/release_plan/next_chunk.py @@ -110,7 +110,7 @@ def awaited_merges(found: list[Item], release: Release) -> dict[str, list[int]]: def merge_stop(pulls: dict[str, list[int]]) -> str: - """The sentences that stop the working loop where pulls await a person's merge, naming each with the items it finishes; empty where none does.""" + """The sentences that stop the working loop, naming each of pulls, the pull requests that await a person's merge, with the items it finishes; empty where pulls is empty.""" if not pulls: return "" named = "; ".join(f"{pull}, which finishes item{'s' if len(ids) > 1 else ''} {listed([str(item_id) for item_id in ids], 'and')}" for pull, ids in pulls.items()) -- 2.52.0 From b76a3bcf24ea39a65b8545f58130104500d41738 Mon Sep 17 00:00:00 2001 From: Lilleman Date: Fri, 20 Nov 2026 01:24:24 +0100 Subject: [PATCH 07/14] =?UTF-8?q?Answer=20product-owner=20round=201:=200?= =?UTF-8?q?=20=F0=9F=94=B4,=201=20=F0=9F=9F=A1=20(0=20misread);=20the=20fa?= =?UTF-8?q?ilure=20names=20the=20shortfall=20in=20e062f71d,=20and=20item?= =?UTF-8?q?=20298=20records=20claude-config's=20judge=20room?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- todo.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/todo.md b/todo.md index 95c126d9..d4f19825 100644 --- a/todo.md +++ b/todo.md @@ -531,6 +531,8 @@ Found by review of PR #317. The black-box test, `bin/loop_claude/test_black_box. 153 `Judge cost:` entries total $109.76, a median of about $0.76 a verdict at every rung, and the cost follows the size of the records, not the transcript: about 76k characters in log and 188k in claude-config. In 224 of 251 recent verdicts (89%) the evidence sits in the worker's final message. A missed interrupt is the costly error, so the bar is zero changed interrupts and zero new rejections across the replay. The judge is about 4.5% of dollars, so the saving is small; each cycle also gets faster. +On 2026-11-20, with docs/decisions.md read once, claude-config's records take 285,754 characters. With a short task they leave the transcript about 107,500 of the judge's 400,000 characters, some 57,500 above the 50,000 it must read. The decision log grows about 4,000 characters a day, so the judge stops on claude-config, naming the shortfall, in about two weeks unless this item ships first. + Touches: - `bin/agent_cycle/judge.py`: `Brief`, `judge_prompt`, `JUDGE_PROMPT_CHARS` - `bin/chunk_driver/project/records.py`: `read_records` -- 2.52.0 From 840cb21fbce862801670ea05334877885f5ada21 Mon Sep 17 00:00:00 2001 From: Lilleman Date: Fri, 20 Nov 2026 01:24:24 +0100 Subject: [PATCH 08/14] =?UTF-8?q?Answer=20prose=20round=201:=200=20?= =?UTF-8?q?=F0=9F=94=B4,=204=20=F0=9F=9F=A1=20(0=20misread);=20the=20wordi?= =?UTF-8?q?ng=20is=20fixed=20in=20e062f71d?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit -- 2.52.0 From ee44c99f28d6b21cfc7bea9e4259b039176b37d6 Mon Sep 17 00:00:00 2001 From: Lilleman Date: Fri, 20 Nov 2026 01:36:22 +0100 Subject: [PATCH 09/14] Test that the judge's failure names a room of 0 where the records overflow its prompt --- bin/agent_cycle/test_judge.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/agent_cycle/test_judge.py b/bin/agent_cycle/test_judge.py index e104de19..064d8dec 100644 --- a/bin/agent_cycle/test_judge.py +++ b/bin/agent_cycle/test_judge.py @@ -160,7 +160,7 @@ class JudgePrompt(unittest.TestCase): def test_fails_naming_the_shortfall_where_the_records_leave_less_than_the_transcripts_floor(self): failed = judge.judge_prompt(self.brief(self.LONG, 0, records="r" * (judge.JUDGE_PROMPT_CHARS + 1))) self.assertIsInstance(failed, Failure) - for fact in ("400,000", "400,001", f"{judge.TRANSCRIPT_FLOOR:,}", f"by at least {judge.TRANSCRIPT_FLOOR + self.overhead() + 1:,}"): + for fact in ("leave 0 of the judge's 400,000", "400,001", f"{judge.TRANSCRIPT_FLOOR:,}", f"by at least {judge.TRANSCRIPT_FLOOR + self.overhead() + 1:,}"): self.assertIn(fact, failed.reason) def test_judge_once_returns_that_failure_without_starting_claude(self): -- 2.52.0 From 5e54057f9e87e50af451f321294d2936d524d8a1 Mon Sep 17 00:00:00 2001 From: Lilleman Date: Fri, 20 Nov 2026 01:41:21 +0100 Subject: [PATCH 10/14] =?UTF-8?q?Answer=20stability=20round=202:=200=20?= =?UTF-8?q?=F0=9F=94=B4,=202=20=F0=9F=9F=A1=20(0=20misread);=20report=20ea?= =?UTF-8?q?ch=20fact=20of=20the=20shortfall=20in=20a=20subTest,=20and=20ch?= =?UTF-8?q?eck=20that=20a=20transcript=20longer=20than=20the=20floor=20is?= =?UTF-8?q?=20shown=20whole=20where=20the=20records=20leave=20room?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bin/agent_cycle/test_judge.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/bin/agent_cycle/test_judge.py b/bin/agent_cycle/test_judge.py index 064d8dec..fdf8ffb3 100644 --- a/bin/agent_cycle/test_judge.py +++ b/bin/agent_cycle/test_judge.py @@ -161,17 +161,18 @@ class JudgePrompt(unittest.TestCase): failed = judge.judge_prompt(self.brief(self.LONG, 0, records="r" * (judge.JUDGE_PROMPT_CHARS + 1))) self.assertIsInstance(failed, Failure) for fact in ("leave 0 of the judge's 400,000", "400,001", f"{judge.TRANSCRIPT_FLOOR:,}", f"by at least {judge.TRANSCRIPT_FLOOR + self.overhead() + 1:,}"): - self.assertIn(fact, failed.reason) + with self.subTest(fact=fact): + self.assertIn(fact, failed.reason) def test_judge_once_returns_that_failure_without_starting_claude(self): failed = judge.judge_once("/r", self.brief(self.LONG, 0, records="r" * judge.JUDGE_PROMPT_CHARS), Rung("judge-model"), FakeEffects(claude=[]).effects()) self.assertIsInstance(failed, Failure) self.assertIn(f"{judge.TRANSCRIPT_FLOOR:,}", failed.reason) - def test_shows_more_than_the_floor_of_the_transcripts_tail_where_the_records_leave_room(self): - prompt, grounds = judge.judge_prompt(self.brief(self.LONG, 0, records="r" * (judge.JUDGE_PROMPT_CHARS - judge.TRANSCRIPT_FLOOR - 10000))) - self.assertTrue(grounds.shown.endswith("\n\nMerged.")) - self.assertGreaterEqual(len(grounds.shown), judge.TRANSCRIPT_FLOOR) + def test_shows_the_whole_of_a_transcript_longer_than_the_floor_where_the_records_leave_room_for_it(self): + whole = "old " + "x" * judge.TRANSCRIPT_FLOOR + "\n\nMerged." + prompt, grounds = judge.judge_prompt(self.brief(self.LONG, 0, records="r" * (judge.JUDGE_PROMPT_CHARS - self.overhead() - len(whole)))) + self.assertEqual(grounds.shown, whole) self.assertLessEqual(len(prompt), judge.JUDGE_PROMPT_CHARS) def test_shows_the_floor_where_the_records_leave_exactly_that(self): -- 2.52.0 From dbe275e59f004fce8bbbb4fce13428f6e2fc30de Mon Sep 17 00:00:00 2001 From: Lilleman Date: Fri, 20 Nov 2026 01:41:42 +0100 Subject: [PATCH 11/14] =?UTF-8?q?Answer=20product-owner=20round=202:=200?= =?UTF-8?q?=20=F0=9F=94=B4,=200=20=F0=9F=9F=A1=20(0=20misread);=20every=20?= =?UTF-8?q?round=201=20answer=20stands?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit -- 2.52.0 From 1774bb42740ff4bcb62eb799b8ec897344eeefd9 Mon Sep 17 00:00:00 2001 From: Lilleman Date: Fri, 20 Nov 2026 01:51:10 +0100 Subject: [PATCH 12/14] Finish item 463 in the plan --- CHANGELOG.md | 1 + todo.md | 15 --------------- 2 files changed, 1 insertion(+), 15 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 40144548..4be966f0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## Unreleased +- `loop-claude`'s judge stops, naming how much to cut the records by, rather than judge a prompt that leaves it less than the transcript's last 50,000 characters. A file the project's config names for two records is read once. - Under `merge = "human"`, `loop-claude` and `chunk-preflight` pass over an item whose ready pull request awaits a person's merge, and `loop-claude` stops, naming those pull requests, once every item left awaits one. - do-epic reads two new settings from a project's config: `jira-unblocking-statuses` names the statuses at which an issue unblocks the issues it blocks, and `jira-automation-moves-issues` leaves the move out of "In Progress" to the team's own automation. - The prose standard asks that a sentence about several named things holds for each of them. diff --git a/todo.md b/todo.md index d4f19825..4b8b6de5 100644 --- a/todo.md +++ b/todo.md @@ -12,7 +12,6 @@ | ID | Release | Blocked by | Exempt | Item | L | E | I | R | S | Moves | Score | |---|---|---|---|---|---|---|---|---|---|---|---| -| 463 | 0.14.0 | | defect | **Show the judge the transcript's tail whatever the size of the records.** | 2 | 2 | 3 | 5 | 3 | 1.2 by 6, 1.5 by 4, 1.4 by 2 | 4.2 | | 465 | 0.14.0 | | | **Decide loop-claude's awaited-merges stop from the pull requests found, not from whether a sentence is empty.** | 1 | 1 | 2 | 2 | 2 | code health by 2 | 3.5 | | 449 | 0.14.0 | | | **Record do-epic's repo picks and sub-task summaries in the team's own spelling, such as `core-4` and `core-4: Bygg …`, as its config sets them.** | 2 | 2 | 2 | 4 | 3 | 1.6 by 6 | 2.0 | | 453 | 0.14.0 | | | **Make the issue types that do-epic and `todo-item add` file in Jira settings, since a Jira project such as TW has no Task type.** | 2 | 2 | 1 | 3 | 2 | 1.6 by 5 | 1.8 | @@ -78,20 +77,6 @@ ## Details -### 463. Show the judge the transcript's tail whatever the size of the records. - -`judge_prompt` in `bin/agent_cycle/judge.py` gives the transcript only what `JUDGE_PROMPT_CHARS = 400000` leaves after the premises, the records and the rules. In claude-config those now take about 519,000 to 523,000 characters, so `room` clamps to 0 and the judge reads the task above an empty transcript. Every judge prompt archived for claude-config since at least 2026-11-19 17:16 shows none: -- The 0.13.0 chunks of items 448, 455 and 451 each stopped after the judge failed three times. -- The chunk of items 458 and 459 drew four `unfinished` verdicts after it had merged, each quoting only the task. - -The judge sees neither a merge nor a worker's question, so every chunk here loops until a human ends it. Item 460's fix, letting the judge quote the task, treated a symptom of this. - -Keep the transcript's tail a floor of the budget. Where the head leaves less, cut the records or stop with a message that names their size, rather than send a blind prompt. The constant's comment sizes the budget for a 200,000-token context, so raise it only where the judge's model has room. Item 298 cuts the records for cost; this item only guarantees the transcript room. Write first the test that fails today: a brief whose records exceed the budget still shows the transcript's last message. - -Touches: -- `bin/agent_cycle/judge.py`: `JUDGE_PROMPT_CHARS` (small), `judge_prompt` (small) -- `bin/agent_cycle/test_judge.py`: `JudgePrompt` - ### 465. Decide loop-claude's awaited-merges stop from the pull requests found, not from whether a sentence is empty. Both seats of item 457's paired ruling voted Locality worse at this place. `planned` in `bin/release_plan/next_chunk.py` sets `NoItem.awaits_merge` to `bool(merges)`, where `merges` is the sentence `awaited_merges` wrote, so the loop's stop hangs on a string's truthiness, and `chunks_to_start` in `bin/loop_claude/loop/chunk_windows.py` reads it two packages away. Have `awaited_merges` return the pull requests it found, with the items each finishes, and build both the sentence and the flag from them, so a reader sees what stops the loop where it is decided. -- 2.52.0 From 713d559c5b3f87d47916aa81a8446fdf8f9106b4 Mon Sep 17 00:00:00 2001 From: Lilleman Date: Fri, 20 Nov 2026 01:51:10 +0100 Subject: [PATCH 13/14] Finish item 464 in the plan --- todo.md | 9 --------- 1 file changed, 9 deletions(-) diff --git a/todo.md b/todo.md index 4b8b6de5..927bdb61 100644 --- a/todo.md +++ b/todo.md @@ -17,7 +17,6 @@ | 453 | 0.14.0 | | | **Make the issue types that do-epic and `todo-item add` file in Jira settings, since a Jira project such as TW has no Task type.** | 2 | 2 | 1 | 3 | 2 | 1.6 by 5 | 1.8 | | 450 | 0.14.0 | | | **Add `do-epic --dry-run`, which prints every Jira write planning would make and each chunk that would start, and makes none of them.** | 2 | 2 | 2 | 4 | 3 | 1.6 by 5 | 1.6 | | 454 | 0.14.0 | | | **Start a do-epic chunk's issue as the team's board expects, by settings: assigned to the account do-epic works as, moved by a start transition and added to a board's active sprint.** | 3 | 2 | 2 | 5 | 4 | 1.6 by 4 | 1.1 | -| 464 | 0.14.0 | | | **Fail a test where loop-claude's forge effect runs the forge's CLI without its timeout.** | 1 | 1 | 2 | 2 | 1 | 1.1 by 1 | 0.4 | | 446 | 0.15.0 | | question | **Kill the process a stuck check names where its verdict is `stuck`, once the human says the recorded verdicts match what they would have done.** | 2 | 2 | 3 | 5 | 3 | 1.5 by 3 | 1.0 | | 462 | 0.15.0 | | | **Run under `mutate-changes` the tests that today fail in mutmut's copy of the tree, so a mutant of a line only they cover is killed.** | 2 | 1 | 2 | 3 | 3 | code health by 3 | 4.7 | | 77 | 0.15.0 | | | **Teach `bin/metric-bench` Go and TypeScript, rerun it once two projects' comprehension histories name places, and bring into review only a metric that tracks the panel.** | 4 | 2 | 1 | 5 | 6 | 1.1 by 7, 1.4 by 7 | 2.1 | @@ -158,14 +157,6 @@ Touches: - `bin/do_epic/backend/test_jira.py` - `README.md`: `### Set up a project` (small) -### 464. Fail a test where loop-claude's forge effect runs the forge's CLI without its timeout. - -Today no test fails where `system_effects` builds `forge` as `runner(cwd)` instead of `runner(cwd, FORGE_TIMEOUT)`: a mutant of `bin/loop_effects/effects.py:128` that drops the timeout survived item 457's mutation run. A stalled `gh` or `tea` would then hold the loop again, which is what the timeout stops. Let `system_effects` take the timeout as a parameter that defaults to `FORGE_TIMEOUT`, as it takes `backends`, and test that a command outlasting a short one comes back as the `stopped after` Failure. - -Touches: -- `bin/loop_effects/effects.py`: `system_effects` (small) -- `bin/loop_effects/test_effects.py`: `ForgeEffect` (small) - ### 446. Kill the process a stuck check names where its verdict is `stuck`, once the human says the recorded verdicts match what they would have done. Item 422 judges a worker that stalls before its result, but only reports: each verdict goes to the terminal and to `stuck-workers.md` in the project's transcript archive. Question for the human: after a few days of verdicts there, do they match what you would have done? Once you say yes, kill only the process a `stuck` verdict names, and only where the pid is below the worker's claude, never the worker or the loop, and record the call in a decision. -- 2.52.0 From afbaa953e6b4d3b321947f55d3311694dc11ad24 Mon Sep 17 00:00:00 2001 From: Lilleman Date: Fri, 20 Nov 2026 01:51:11 +0100 Subject: [PATCH 14/14] Finish item 465 in the plan --- todo.md | 9 --------- 1 file changed, 9 deletions(-) diff --git a/todo.md b/todo.md index 927bdb61..bc5ce2e3 100644 --- a/todo.md +++ b/todo.md @@ -12,7 +12,6 @@ | ID | Release | Blocked by | Exempt | Item | L | E | I | R | S | Moves | Score | |---|---|---|---|---|---|---|---|---|---|---|---| -| 465 | 0.14.0 | | | **Decide loop-claude's awaited-merges stop from the pull requests found, not from whether a sentence is empty.** | 1 | 1 | 2 | 2 | 2 | code health by 2 | 3.5 | | 449 | 0.14.0 | | | **Record do-epic's repo picks and sub-task summaries in the team's own spelling, such as `core-4` and `core-4: Bygg …`, as its config sets them.** | 2 | 2 | 2 | 4 | 3 | 1.6 by 6 | 2.0 | | 453 | 0.14.0 | | | **Make the issue types that do-epic and `todo-item add` file in Jira settings, since a Jira project such as TW has no Task type.** | 2 | 2 | 1 | 3 | 2 | 1.6 by 5 | 1.8 | | 450 | 0.14.0 | | | **Add `do-epic --dry-run`, which prints every Jira write planning would make and each chunk that would start, and makes none of them.** | 2 | 2 | 2 | 4 | 3 | 1.6 by 5 | 1.6 | @@ -76,14 +75,6 @@ ## Details -### 465. Decide loop-claude's awaited-merges stop from the pull requests found, not from whether a sentence is empty. - -Both seats of item 457's paired ruling voted Locality worse at this place. `planned` in `bin/release_plan/next_chunk.py` sets `NoItem.awaits_merge` to `bool(merges)`, where `merges` is the sentence `awaited_merges` wrote, so the loop's stop hangs on a string's truthiness, and `chunks_to_start` in `bin/loop_claude/loop/chunk_windows.py` reads it two packages away. Have `awaited_merges` return the pull requests it found, with the items each finishes, and build both the sentence and the flag from them, so a reader sees what stops the loop where it is decided. - -Touches: -- `bin/release_plan/next_chunk.py`: `planned` (small), `awaited_merges` -- `bin/release_plan/test_release_standing.py` - ### 449. Record do-epic's repo picks and sub-task summaries in the team's own spelling, such as `core-4` and `core-4: Bygg …`, as its config sets them. do-epic writes its own spelling into a team's Jira: a pick as `repo:core-4` and a sub-task's summary as `[core-4] `. A team with its own convention, such as TW's label `core-4` and summary `core-4: Bygg …` with a capital after the colon, then finds two labels on each issue and summaries in a shape its board doesn't use. Goal 1.6 asks the loop to fit the tracker's conventions, not change them. -- 2.52.0