diff --git a/bin/loop_claude/cycle/prompts.py b/bin/loop_claude/cycle/prompts.py index b40bb8ba..87f3574d 100644 --- a/bin/loop_claude/cycle/prompts.py +++ b/bin/loop_claude/cycle/prompts.py @@ -115,11 +115,18 @@ def resumed(unfinished_evidence: str, route: Route, anchor: Rung | None) -> str: """Names the worker's rung, so it learns whether its request for a higher rung went through, and the project's again, since a step-up between cycles may have taken the worker above it.""" on = f" loop-claude runs you on {route.rung}." if anchor else "" ruled = f" A judge ruled the chunk unfinished, quoting this passage of your transcript as the work remaining:\n\n{quoted(unfinished_evidence)}\n\n" if unfinished_evidence else " " - return f"Continue the task; the previous run ended before the chunk was finished.{ruled}The chunk is finished once it is merged, or nothing remains that you could do on your own. Even then, it is finished only once {ANSWERS_RECORDED}.{on}{review_launches(route, anchor)}{escalation(route, anchor)}{reruns(route, anchor)}" + return f"Continue the task; the previous run ended before the chunk was finished.{ruled}The chunk is finished once it is merged, or nothing remains that you could do on your own. Even then, it is finished only once {ANSWERS_RECORDED}.{on}{rungs_held(route, anchor)}" -def answered(question: str, answer: str) -> str: - return f"Your question: {question}\n\n{QUOTE_SOURCES} answers it:\n\n{answer}\n\nContinue the task." +def rungs_held(route: Route, anchor: Rung | None) -> str: + """The sentences that depend on the worker's rung: where its reviews, its subagents and their reruns run.""" + return f"{review_launches(route, anchor)}{escalation(route, anchor)}{reruns(route, anchor)}" + + +def answered(question: str, answer: str, route: Route, anchor: Rung | None, stepped: bool) -> str: + """stepped is whether the answer's ruling stepped the worker up, so the prompt names its new rung, as resumed does.""" + on = f" Your request for a higher rung went through: loop-claude runs you on {route.rung}.{rungs_held(route, anchor)}" if stepped else "" + return f"Your question: {question}\n\n{QUOTE_SOURCES} answers it:\n\n{answer}\n\nContinue the task.{on}" def past_the_cap(question: str, answer: str, cap: int) -> str: diff --git a/bin/loop_claude/cycle/run.py b/bin/loop_claude/cycle/run.py index 8f7ceba7..a8fbf43a 100644 --- a/bin/loop_claude/cycle/run.py +++ b/bin/loop_claude/cycle/run.py @@ -9,7 +9,7 @@ from loop_claude.effects import Effects from failure import Failure from loop_claude.cycle.judge import Finished, Interrupt, judge, QuotedAnswer, Rejected, Unfinished, Verdict from loop_claude.cycle.interrupt import interrupt -from loop_claude.routing import judge_rung, stepped_by_interrupt +from loop_claude.routing import judge_rung, stepped_by_ruling from transcript_archive import outcomes from loop_claude.paths import Paths from loop_claude.cycle import prompts @@ -49,7 +49,7 @@ class Cycle: @dataclasses.dataclass(frozen=True) class Concluded: - """How a cycle ended: its verdict, and the route it ended on, which an interrupt's escalation may have stepped up from the route it began on.""" + """How a cycle ended: its verdict, and the route it ended on, which an interrupt's or a quoted answer's escalation may have stepped up from the route it began on.""" verdict: Finished | Unfinished route: Route @@ -73,7 +73,7 @@ def escalated(cycle: Cycle, event: Event) -> Cycle: cycle = dataclasses.replace(cycle, stepped_from=None) if not (isinstance(event, Ruled) and isinstance(event.verdict, Interrupt | QuotedAnswer) and event.verdict.escalation): return cycle - route = stepped_by_interrupt(cycle.anchor, cycle.route, event.verdict.bundled) if cycle.anchor else cycle.route + route = stepped_by_ruling(cycle.anchor, cycle.route, event.verdict.bundled) if cycle.anchor else cycle.route return dataclasses.replace(cycle, route=route, stepped_from=cycle.route if route != cycle.route else None, escalation_spent=True) @@ -122,7 +122,7 @@ def worker_environment(cycle: Cycle) -> dict[str, str]: def worker_start(cycle: Cycle, answered: QuotedAnswer | None) -> list[str]: if answered is not None: - return worker_args(cycle.session, cycle.route.rung, prompts.answered(answered.question, answered.answer), resume=True) + return worker_args(cycle.session, cycle.route.rung, prompts.answered(answered.question, answered.answer, cycle.route, cycle.anchor, cycle.stepped_from is not None), resume=True) if session_open(cycle.session): return worker_args(cycle.session, cycle.route.rung, prompts.resumed(cycle.unfinished_evidence, cycle.route, cycle.anchor), resume=True) return worker_args(cycle.session, cycle.route.rung, prompts.fresh(cycle.task, cycle.premises, cycle.route, cycle.anchor, cycle.facts), resume=False) diff --git a/bin/loop_claude/loop/main.py b/bin/loop_claude/loop/main.py index 07201188..6398f278 100644 --- a/bin/loop_claude/loop/main.py +++ b/bin/loop_claude/loop/main.py @@ -37,7 +37,7 @@ copied to $LOOP_CLAUDE_TRANSCRIPTS///.jsonl (default line with a timestamp, the same for every cycle of a chunk. Beside the copy, .outcomes.md holds the verdict, with the transcript passage the judge rested it on, any passage it quoted to show an escalation trigger fired, and the judge's rung; each answer the judge quoted, with the -question it answers; each judge reply the loop rejected, with the reason and the reply as json; +question it answers and any such passage; each judge reply the loop rejected, with the reason and the reply as json; and why the loop stopped. Each of these opens with its UTC time. Claude Code keeps a folder per session beside its transcript, holding the subagents' transcripts among other files; that folder, and every other file named after the session except the transcript, are copied into @@ -83,9 +83,9 @@ scale counts as none. Every second unfinished verdict on a chunk steps it up one higher rung, once the judge quotes the transcript showing that the escalation trigger it named fired (~/.claude/CLAUDE.md → "Working with the codebase" lists them). An interrupt or a quoted answer with such a quote steps the rung as it comes in, before the human is asked or the worker resumes -(routing.stepped_by_interrupt), and no later ruling of that cycle carries a second escalation. Either step stops two rungs +(routing.stepped_by_ruling), and no later ruling of that cycle carries a second escalation. Either step stops two rungs above the rung the chunk's item picks, and the worker's prompts offer it only while the worker is -below that limit. Each finished or unfinished verdict, interrupt, stop and step-up in the archive names the +below that limit. Each finished or unfinished verdict, interrupt, quoted answer, stop and step-up in the archive names the worker's rung, with the item, L and E + I that routed the chunk, and any taken-in E + I that picks a higher review rung, which is archived as a step-up too. A rerun resumes an open chunk on the latest route named there, and counts its unfinished verdicts afresh. A rung no longer on the ladder, or @@ -226,7 +226,7 @@ def run_loop(argv: list[str], env: typing.Mapping[str, str], paths: Paths, launc concluded = run_cycle(Cycle(anchor=anchor, effects=effects, facts=facts, judge_model=models.judge, paths=paths, premises=premises, project_archive=archive_folder, records=records, root=loop_run.root, route=route, session=session, task=loop_run.task, unfinished_evidence=loop_run.unfinished_evidence)) if isinstance(concluded, Stop): return concluded - # The route the cycle ended on, which a step-up at an interrupt may have raised and archived, is the one the verdict steps from. + # The route the cycle ended on, which a step-up at an interrupt or a quoted answer may have raised and archived, is the one the verdict steps from. ended = dataclasses.replace(loop_run, route=concluded.route if anchor else None) before, loop_run = ended.route, after_verdict(ended, anchor, concluded.verdict) if stop := archive_step(archive_folder, session, loop_run, before, effects): diff --git a/bin/loop_claude/routing.py b/bin/loop_claude/routing.py index 2eb463c3..419d469f 100644 --- a/bin/loop_claude/routing.py +++ b/bin/loop_claude/routing.py @@ -71,8 +71,8 @@ def stepped(anchor: Rung, route: Route, bundled: int, escalated: bool) -> Route: return dataclasses.replace(route, rung=rung, unfinished=unfinished) -def stepped_by_interrupt(anchor: Rung, route: Route, bundled: int) -> Route: - """The route after the judge's interrupt carried an escalation: taken_in's rung, one rung up while that is below escalation_cap. An interrupt is no unfinished verdict, so the count of those restarts only with a step.""" +def stepped_by_ruling(anchor: Rung, route: Route, bundled: int) -> Route: + """The route after the judge's interrupt or quoted answer carried an escalation: taken_in's rung, one rung up while that is below escalation_cap. Neither is an unfinished verdict, so the count of those restarts only with a step.""" rung = taken_in(anchor, route, bundled) return stepped_from(route, rung) if below_cap(anchor, route, rung) else dataclasses.replace(route, rung=rung) diff --git a/bin/loop_claude/test_loop_claude.py b/bin/loop_claude/test_loop_claude.py index caea0c14..7aaf77bb 100644 --- a/bin/loop_claude/test_loop_claude.py +++ b/bin/loop_claude/test_loop_claude.py @@ -345,12 +345,32 @@ class Cycles(unittest.TestCase): self.assertEqual(concluded.route, Route(Routing.OPUS, 179, 2, 5)) first, resumed = fake.made("stream_claude") self.assertEqual([args[args.index("--effort") + 1] for args in (first, resumed)], ["high", "medium"]) + self.assertTrue(resumed[resumed.index("-p") + 1].endswith(f"Continue the task. Your request for a higher rung went through: loop-claude runs you on {Routing.OPUS}.{prompts.rungs_held(concluded.route, Routing.OPUS)}")) + self.assertNotIn("went through", first[first.index("-p") + 1]) answered = f"Verdict: quoted answer\n\nWhich one?\n\n{prompts.QUOTE_SOURCES} says:\n> Use A.\n\nEvidence:\n> working\n\nEscalation:\n> working\n\nJudge: judge-model\nWorker: {Route(Routing.SONNET, 179, 2, 5)}\n" stepped = f"Stepped up\n\nWorker: {Route(Routing.OPUS, 179, 2, 5)}\n" kept = "".join(self.archived_outcomes()) self.assertIn(f"Z {answered}\n20", kept) self.assertIn(f"Z {stepped}", kept) + def test_a_quoted_answer_past_the_cap_archives_the_escalation_it_carried_with_the_interrupt_and_steps_up(self): + steps = [judged("quoted", answer="Use A.")] * 3 + [judged("quoted", answer="Use A.", escalation="working")] + fake = FakeEffects(streams=[Worker(self.paths.claude_code_transcripts.parent)] * 4, claude=steps, on_terminal_claude=[0], git=[ran()]) + cycle = dataclasses.replace(self.cycle(fake, records="From AGENTS.md:\nUse A."), anchor=Routing.OPUS, route=Route(Routing.SONNET, 179, 2, 5)) + with contextlib.redirect_stdout(io.StringIO()), contextlib.redirect_stderr(io.StringIO()): + self.assertEqual(run.run_cycle(cycle), Stop(2, "the human is needed to answer the question above, but the interrupt ended with nothing typed")) + kept = "".join(self.archived_outcomes()) + self.assertIn(f"Evidence:\n> working\n\nEscalation:\n> working\n\nJudge: judge-model\nWorker: {Route(Routing.SONNET, 179, 2, 5)}\n", kept) + self.assertIn(f"Stepped up\n\nWorker: {Route(Routing.OPUS, 179, 2, 5)}\n", kept) + + def test_stops_when_an_interrupt_cannot_be_archived(self): + self.archive.parent.mkdir(parents=True) + self.archive.write_text("") + fake = FakeEffects(streams=[Worker(self.paths.claude_code_transcripts.parent)], claude=[judged("interrupt")], on_terminal_claude=[0]) + stop = run.run_cycle(self.cycle(fake)) + self.assertRegex(stop.reason, f"^could not archive the transcript: {self.archive}/[0-9a-f]{{64}}: Not a directory$") + self.assertEqual(fake.made("claude_on_terminal"), []) + def test_stops_when_a_quoted_answer_cannot_be_archived(self): self.archive.parent.mkdir(parents=True) self.archive.write_text("") @@ -660,15 +680,15 @@ class Routing(unittest.TestCase): self.assertEqual(routing.stepped(self.OPUS, Route(self.SONNET, 3, 2, 4), 4, True), Route(self.HIGH, 3, 2, 4, unfinished=1)) def test_steps_up_a_rung_as_the_judge_interrupts_up_to_two_above_the_items_rung_without_counting_an_unfinished_verdict(self): - self.assertEqual(routing.stepped_by_interrupt(self.OPUS, Route(self.HIGH, 3, 4, 5, unfinished=1), 0), Route(self.XHIGH, 3, 4, 5)) - self.assertEqual(routing.stepped_by_interrupt(self.OPUS, Route(self.XHIGH, 3, 4, 5), 0), Route(self.MAX, 3, 4, 5)) - self.assertEqual(routing.stepped_by_interrupt(self.OPUS, Route(self.MAX, 3, 4, 5, unfinished=1), 0), Route(self.MAX, 3, 4, 5, unfinished=1)) - self.assertEqual(routing.stepped_by_interrupt(self.OPUS, Route(self.SONNET, 3, 2, 4), 0), Route(self.OPUS, 3, 2, 4)) + self.assertEqual(routing.stepped_by_ruling(self.OPUS, Route(self.HIGH, 3, 4, 5, unfinished=1), 0), Route(self.XHIGH, 3, 4, 5)) + self.assertEqual(routing.stepped_by_ruling(self.OPUS, Route(self.XHIGH, 3, 4, 5), 0), Route(self.MAX, 3, 4, 5)) + self.assertEqual(routing.stepped_by_ruling(self.OPUS, Route(self.MAX, 3, 4, 5, unfinished=1), 0), Route(self.MAX, 3, 4, 5, unfinished=1)) + self.assertEqual(routing.stepped_by_ruling(self.OPUS, Route(self.SONNET, 3, 2, 4), 0), Route(self.OPUS, 3, 2, 4)) def test_steps_up_from_the_rung_a_taken_in_item_picks_as_the_judge_interrupts(self): - self.assertEqual(routing.stepped_by_interrupt(self.OPUS, Route(self.OPUS, 3, 3, 4), 4), Route(self.XHIGH, 3, 3, 4)) - self.assertEqual(routing.stepped_by_interrupt(self.OPUS, Route(self.XHIGH, 3, 4, 5), 4), Route(self.MAX, 3, 4, 5)) - self.assertEqual(routing.stepped_by_interrupt(self.OPUS, Route(self.MAX, 3, 4, 5, unfinished=1), 4), Route(self.MAX, 3, 4, 5, unfinished=1)) + self.assertEqual(routing.stepped_by_ruling(self.OPUS, Route(self.OPUS, 3, 3, 4), 4), Route(self.XHIGH, 3, 3, 4)) + self.assertEqual(routing.stepped_by_ruling(self.OPUS, Route(self.XHIGH, 3, 4, 5), 4), Route(self.MAX, 3, 4, 5)) + self.assertEqual(routing.stepped_by_ruling(self.OPUS, Route(self.MAX, 3, 4, 5, unfinished=1), 4), Route(self.MAX, 3, 4, 5, unfinished=1)) def test_keeps_an_e_plus_i_taken_in_only_where_it_picks_a_higher_review_rung(self): taken = Route(self.OPUS, 3, 3, 4).taking_in(6) @@ -1120,7 +1140,9 @@ class Verdict(unittest.TestCase): shown = "The agent: round 2: 🔴. Which one?" self.assertEqual(judge.quotes_checked(QuotedAnswer("e", "q", "A.", "round 2: 🔴"), shown, "A."), QuotedAnswer("e", "q", "A.", "round 2: 🔴")) self.assertEqual(judge.quotes_checked(QuotedAnswer("e", "q", "A.", "round 2: … 🔴"), shown, "A."), QuotedAnswer("e", "q", "A.")) - self.assertEqual(judge.quotes_checked(QuotedAnswer("e", "q", "not there", "round 2: 🔴", 4), shown, "A."), Interrupt("e", "q", "round 2: 🔴", 4)) + + def test_puts_a_quoted_answer_the_records_do_not_hold_to_the_human_with_the_escalation_it_carried(self): + self.assertEqual(judge.quotes_checked(QuotedAnswer("e", "q", "not there", "round 2: 🔴", 4), "The agent: round 2: 🔴.", "A."), Interrupt("e", "q", "round 2: 🔴", 4)) def test_puts_a_quoted_answer_the_records_do_not_hold_word_for_word_to_the_human(self): self.assertEqual(judge.quotes_checked(QuotedAnswer("e", "q", "not there"), "shown", "the records"), Interrupt("e", "q")) diff --git a/bin/transcript_archive/outcomes.py b/bin/transcript_archive/outcomes.py index fa1abcbf..7ca18946 100644 --- a/bin/transcript_archive/outcomes.py +++ b/bin/transcript_archive/outcomes.py @@ -18,31 +18,35 @@ UNFINISHED_AT = re.compile(rf"^{STAMPED} {re.escape(UNFINISHED)}$", re.MULTILINE VERDICT_AT = re.compile(rf"^{STAMPED} (?:{re.escape(FINISHED)}|{re.escape(UNFINISHED)})$", re.MULTILINE) # An outcome opens with its UTC stamp; a verdict that closes a cycle, an interrupt, a quoted answer, a stop, or a step up ends with the worker line. OUTCOME_AT = re.compile(rf"^({STAMPED}) ", re.MULTILINE) -NAMES_A_WORKER = ("Verdict: finished\n", "Verdict: unfinished\n", "Verdict: interrupt\n", "Verdict: quoted answer\n", "Stopped: ", "Stepped up\n") +NAMES_A_WORKER = (*(f"{verdict}\n" for verdict in (FINISHED, UNFINISHED, INTERRUPTED, ANSWERED)), "Stopped: ", "Stepped up\n") WORKER = "Worker: " # The rung that judged a verdict. JUDGE = "Judge: " +def escalation_block(escalation: str) -> str: + return f"Escalation:\n{quoted(escalation)}\n\n" if escalation else "" + + def finished(worker: str, evidence: str, judge: str) -> str: return f"{FINISHED}\n\nEvidence:\n{quoted(evidence)}\n\n{JUDGE}{judge}\n{WORKER}{worker}" def unfinished(worker: str, evidence: str, judge: str, escalation: str) -> str: """escalation is the judge's quote showing that the worker's cited escalation trigger fired; empty for none.""" - escalated = f"Escalation:\n{quoted(escalation)}\n\n" if escalation else "" + escalated = escalation_block(escalation) return f"{UNFINISHED}\n\nEvidence:\n{quoted(evidence)}\n\n{escalated}{JUDGE}{judge}\n{WORKER}{worker}" def interrupted(question: str, evidence: str, judge: str, escalation: str, worker: str) -> str: """escalation is the judge's quote showing that the worker's cited escalation trigger fired; empty for none. worker is the rung the worker ran on until the interrupt.""" - escalated = f"Escalation:\n{quoted(escalation)}\n\n" if escalation else "" + escalated = escalation_block(escalation) return f"{INTERRUPTED}\n\n{question}\n\nEvidence:\n{quoted(evidence)}\n\n{escalated}{JUDGE}{judge}\n{WORKER}{worker}" def answered(question: str, sources: str, answer: str, evidence: str, escalation: str, judge: str, worker: str) -> str: """escalation and worker are as on interrupted.""" - escalated = f"Escalation:\n{quoted(escalation)}\n\n" if escalation else "" + escalated = escalation_block(escalation) return f"{ANSWERED}\n\n{question}\n\n{sources} says:\n{quoted(answer)}\n\nEvidence:\n{quoted(evidence)}\n\n{escalated}{JUDGE}{judge}\n{WORKER}{worker}" diff --git a/docs/decisions.md b/docs/decisions.md index f0cdbfc5..8bc93a44 100644 --- a/docs/decisions.md +++ b/docs/decisions.md @@ -288,7 +288,7 @@ Valid while the ladder orders its rungs by competence. 2026-10-15, lilleman asked for it. Serves goals 1.1 and 1.4: when the hard part is the rest of the chunk, handing it to subagents piece by piece leaves the worker, which reads and checks each of their diffs, on a rung that proved too low. The worker climbs only once its run records a trigger. -loop-claude's prompt offers the step beside the escalated subagent of `routing: a worker hands a task one rung up`, as long as the limit leaves a rung that subagent may take without the human's yes. The worker then ends its run asking loop-claude for a higher rung and naming the trigger. The judge quotes an earlier passage that shows the trigger fired, such as a review round's commit title or the worker's report of the failing test, never the request itself. The trigger must have fired since any earlier such request, so one trigger buys one step. The judge sees the worker's text and tool calls but no tool results, so the quote shows that the run recorded the trigger, not that a tool's output bears it out. loop-claude checks the quote word for word, as it checks a quoted answer, since stitched fragments can make up a trigger. Without such a quote, the rung holds. A misquote is no failure, since holding the rung is safe and three failures stop an unattended loop. The next prompt names the worker's rung, so the worker learns whether the step went through. +loop-claude's prompt offers the step beside the escalated subagent of `routing: a worker hands a task one rung up`, as long as the limit leaves a rung that subagent may take without the human's yes. The worker then ends its run asking loop-claude for a higher rung and naming the trigger. The judge quotes an earlier passage that shows the trigger fired, such as a review round's commit title or the worker's report of the failing test, never the request itself. The trigger must have fired since any earlier such request, so one trigger buys one step. The judge sees the worker's text and tool calls but no tool results, so the quote shows that the run recorded the trigger, not that a tool's output bears it out. loop-claude checks the quote word for word, as it checks a quoted answer, since stitched fragments can make up a trigger. Without such a quote, the rung holds. A misquote is no failure, since holding the rung is safe and three failures stop an unattended loop. The next prompt names the worker's rung, so the worker learns whether the step went through. So does the prompt that resumes a worker with a quoted answer whose ruling stepped it up. A run that asks for a higher rung may also ask a question that only the human, or only README.md or the records, can answer. The judge then interrupts or quotes the answer, and either ruling carries the quote too, checked the same way. loop-claude steps the rung as the ruling comes in, before the human is asked or the worker resumes with the quoted answer, since the work after the answer is work the stepped rung should do. An interrupt or a quoted answer is no unfinished verdict, so it adds to no count. The judge may quote a different passage for the trigger that already stepped the rung, and loop-claude cannot tell that from a new trigger. So once an interrupt or a quoted answer has taken an escalation, no later ruling of that cycle carries one. A trigger that fires after the human's answer waits for the next cycle. diff --git a/todo.md b/todo.md index 82972764..d8828c72 100644 --- a/todo.md +++ b/todo.md @@ -6,12 +6,13 @@ `Bar = 0.1` -`Next ID = 180` +`Next ID = 181` ## Items | ID | Release | Blocked by | Exempt | Item | L | E | I | R | S | Moves | Score | |---|---|---|---|---|---|---|---|---|---|---|---| +| 180 | 0.2.0 | | question | **Settle whether a trigger that fires after a quoted answer's or an interrupt's step-up may still step the worker in the same cycle.** | 2 | 2 | 2 | 4 | 3 | 1.1 by 3 | 4.1 | | 168 | 0.2.0 | | | **Have the human answer an interrupt on loop-claude's terminal and resume the worker headless with the answer, opening the interactive session only when they ask for it.** | 4 | 2 | 3 | 7 | 5 | 1.5 by 8 | 1.8 | | 73 | 0.2.0 | | | **Have each reviewer write its full report to a file and return the worker only its findings' one-line summaries.** | 3 | 2 | 3 | 6 | 5 | 1.4 by 4 | 1.1 | | 159 | 0.2.0 | | decision | **Run each review pass on the lowest rung that a replay of its archived rounds shows finding every 🔴 and 🟡 the project's rung finds, even below the worker's rung.** | 4 | 2 | 3 | 7 | 6 | 1.4 by 7 | 1.1 | @@ -83,11 +84,22 @@ ## Details +### 180. Settle whether a trigger that fires after a quoted answer's or an interrupt's step-up may still step the worker in the same cycle. + +`docs/decisions.md` → `routing: a worker whose run ends asking for a higher rung…` says a trigger that fires after the human's answer waits for the next cycle. But once an interrupt or a quoted answer has taken an escalation, `unspent` in `bin/loop_claude/cycle/run.py` drops the escalation of every later ruling of the cycle. The dropped request stays in the transcript, so in the next cycle the judge finds no trigger that fired since the worker's last request, and the worker cannot be stepped for it. Since a quoted answer resumes the worker headless up to three times a cycle, the loss is now reachable unattended. + +Options: + +- Clear `escalation_spent` when a worker run ends. Risk: the judge may quote a different passage for the trigger that already stepped the rung, and loop-claude cannot tell, so one trigger could buy two steps. +- Tell the worker in its next prompt that its request was dropped, and why. + +Only the human can choose, and the answer revises that decision. Found by the stability review of PR #307. + ### 168. Have the human answer an interrupt on loop-claude's terminal and resume the worker headless with the answer, opening the interactive session only when they ask for it. Today an interrupt runs `claude --resume` on the terminal and waits for it to exit (`bin/loop_claude/cycle/interrupt.py`). Once the human answers, the worker carries on in that interactive session, so the loop waits until the human exits it, often for the rest of the chunk. Instead, the loop prints the question and reads the answer on its own terminal. The next cycle resumes the worker headless with a prompt like `prompts.answered`'s, saying the human gave the answer. A word typed in place of an answer, such as `/talk`, opens today's interactive session, for when the human wants to read the diff or discuss first. An empty answer stops the loop, as an interrupt with nothing typed does today. A release ready to cut still opens the interactive session. Bench the word, and the line that asks for the answer, as `CLAUDE.md` says. -The judge must treat an answer typed at the loop's terminal as the human's. `bin/claude_code/transcript.py`'s `render` labels every `-p` prompt `[loop]`, so an answer passed on headless would read as one quoted from the records. The judge would then never hold the chunk open until that answer is recorded. The change touches two places the comprehension seats found hard: `bin/loop_claude/cycle/judge.py`'s `run_judge` and `bin/loop_claude/loop/main.py`'s help. Leave each easier to read. +The judge must treat an answer typed at the loop's terminal as the human's. `bin/claude_code/transcript.py`'s `render` labels every `-p` prompt `[loop]`, so an answer passed on headless would read as one quoted from the records. The judge would then never hold the chunk open until that answer is recorded. The change touches two places the comprehension seats found hard: `bin/loop_claude/cycle/judge.py`'s `run_judge` and `bin/loop_claude/loop/main.py`'s help. Leave each easier to read. When the interrupt has stepped the worker's rung up (`Cycle.stepped_from`), the headless resume prompt names the worker's new rung and repeats the rung-dependent sentences, as `prompts.answered` does after a quoted answer's step (`prompts.rungs_held`), since the worker otherwise never learns the step went through, and `docs/decisions.md` says the next prompt names it. ### 73. Have each reviewer write its full report to a file and return the worker only its findings' one-line summaries.