Answer stability round 1: 1 🔴, 11 🟡 (0 misread); drop keys typed ahead on leaving an answer, wrap every line to the drawn width, list the routing calls, test the paths mutants survived

This commit is contained in:
2026-10-29 01:27:23 +01:00
parent 192b36fada
commit e3cd8ae0cf
15 changed files with 413 additions and 151 deletions
+12 -11
View File
@@ -22,12 +22,12 @@ is shown the passage the judge quoted as the work remaining. The next chunk star
Cycles continue until an exit below or Ctrl-C. Words: ~/.claude/CLAUDE.md → "Vocabulary".
A question only the human can answer is an interrupt (bin/loop_claude/cycle/interrupt.py).
loop-claude prints the question on its terminal and lists it in loop-inbox, which shows every
loop on the machine that waits for the human. The first answer counts, from either place:
loop-claude prints the question on its terminal and lists it in loop-inbox, which shows the
interrupts of every loop on the machine. The first answer counts, from either place:
- A line of text: the worker resumes headless with it. The judge reads it as the human's, so the
chunk stays unfinished until the answer is recorded.
- /talk: opens the worker's session with `claude --resume`, to read the diff or discuss first. Once
that claude exits, the judge rules on what was typed there.
- /talk: opens the worker's session with `claude --resume` where it was typed, to read the diff or
discuss first. Once that claude exits, the judge rules on what was typed there.
- Enter alone, on loop-claude's terminal: stops the loop.
A release ready to cut opens that session on the terminal at once, since only the human may cut it;
loop-inbox lists it too. Before claude opens, the checkout and each of its worktrees are marked
@@ -57,9 +57,9 @@ compacts its context at about 170k tokens.
Every claude loop-claude starts runs the project's model, saved per <key> in
~/.claude/loop-claude-models.json and read each cycle, unless routing, below, puts the worker,
the session /talk opens and the judge on another rung, a model at an effort. A project without an
entry, as on its first run, is asked for one. LOOP_CLAUDE_JUDGE_MODEL overrides the model for the
judge, LOOP_CLAUDE_WORKER_MODEL for the worker and the session /talk opens; with both set, nothing
is asked.
entry, as on its first run, is asked for one on the terminal; loop-inbox doesn't list that
question. LOOP_CLAUDE_JUDGE_MODEL overrides the model for the judge, LOOP_CLAUDE_WORKER_MODEL for
the worker and the session /talk opens; with both set, nothing is asked.
Where the project's model is on the routing ladder (bin/model_routing/ladder.py), the worker and the
session /talk opens run on the rung that the chunk's todo.md item picks, and the judge of some
@@ -78,9 +78,10 @@ Once 20 cycles have closed across all projects in the archive since the last mea
loop to close one measures every finished chunk there, with no model run, and writes
routing-figures.md at the archive's root (bin/routing_figures/measure.py). Each call the figures
make for a routing change, unless raised before, is an interrupt: claude, on the project's model,
on the terminal in ~/.claude, asked to put the calls to the human. Once that claude ends, the calls
are listed in routing-calls-raised.md beside the figures, and not raised again. Off a terminal, the
calls are said on stderr, the loop goes on, and they are raised again at the next measurement.
on the terminal in ~/.claude, asked to put the calls to the human; loop-inbox lists it too. Once
that claude ends, the calls are listed in routing-calls-raised.md beside the figures, and not
raised again. Off a terminal, the calls are said on stderr, the loop goes on, and they are raised
again at the next measurement.
A change to bin/loop-claude or any bin/**/*.py takes effect at the next cycle boundary, once
loop-claude --help succeeds: the loop reloads into the edited script.
@@ -199,7 +200,7 @@ def run_loop(argv: list[str], env: typing.Mapping[str, str], paths: Paths, launc
if isinstance(closed, Stop):
return closed
loop_run = closed
if stop := check_routing(archive_root(paths.home, env), project or Rung(models.worker), paths, effects):
if stop := check_routing(archive_root(paths.home, env), loop_run.root, project or Rung(models.worker), paths, effects):
return stop
+18 -9
View File
@@ -2,9 +2,9 @@
import pathlib
from routing_figures import archive
from loop_claude.waiting import Ask, ClaudeCommand, OpenOnTerminal
from routing_figures.measure import calls, due, render, totals
from loop_claude.cycle.interrupt import claude_args, hand_over
from loop_claude.waiting import ClaudeCommand
from loop_claude.cycle.interrupt import claude_args, hand_over, shown, withdrawn
from loop_claude.effects import Effects, say
from failure import Failure
from loop_claude.paths import Paths
@@ -13,14 +13,14 @@ from loop_claude.stop import Stop
from utc_stamp import utc
def check_routing(root: pathlib.Path, rung: Rung, paths: Paths, effects: Effects) -> Stop | None:
"""Stops only when claude cannot start for the calls; a figure it cannot measure or keep is said on stderr, and the loop goes on. rung is the rung of the claude that puts the calls to the human."""
def check_routing(root: pathlib.Path, checkout: str, rung: Rung, paths: Paths, effects: Effects) -> Stop | None:
"""Stops only when claude cannot start for the calls; a figure it cannot measure or keep is said on stderr, and the loop goes on. checkout is the loop's, and rung is the rung of the claude that puts the calls to the human."""
with archive.locked(root) as held:
new = new_calls(root, paths, effects) if held else []
if isinstance(new, Failure):
say(f"routing figures: {new.reason}", effects)
return None
return raise_calls(root, new, rung, paths, effects) if new else None
return raise_calls(root, checkout, new, rung, paths, effects) if new else None
def new_calls(root: pathlib.Path, paths: Paths, effects: Effects) -> list[str] | Failure:
@@ -43,15 +43,24 @@ def new_calls(root: pathlib.Path, paths: Paths, effects: Effects) -> list[str] |
return [call for call in found if call not in kept.calls]
def raise_calls(root: pathlib.Path, new: list[str], rung: Rung, paths: Paths, effects: Effects) -> Stop | None:
"""Puts the calls to the human through a claude in this setup's checkout, where the routing decision lives. Off a terminal they are only said, and stay in the figures, raised at the next measurement on a terminal."""
def raise_calls(root: pathlib.Path, checkout: str, new: list[str], rung: Rung, paths: Paths, effects: Effects) -> Stop | None:
"""Puts the calls to the human through a claude in this setup's checkout, where the routing decision lives; loop-inbox lists them under the loop's checkout while that claude is open. Off a terminal they are only said, and stay in the figures, raised at the next measurement on a terminal."""
listed = "".join(f"- {call}\n" for call in new)
say(f"\nloop-claude's routing figures call for a routing change:\n{listed}The figures: {root / archive.FIGURES}", effects)
question = f"loop-claude's routing figures call for a routing change:\n{listed}The figures: {root / archive.FIGURES}"
say(f"\n{question}", effects)
if not effects.on_terminal():
say("Not on a terminal: the calls are raised again at the next measurement.", effects)
return None
prompt = f"Put these calls for a routing change from loop-claude's figures to the human, and change nothing until they answer:\n{listed}The figures are in {root / archive.FIGURES}. The ladder, its steps and the delegation rule are docs/decisions.md → `routing:`, and a change to them is the human's. Record what they decide as ~/.claude/CLAUDE.md says; the next chunk of this repo files the plan item for these calls."
if unstarted := hand_over(ClaudeCommand(claude_args(rung, [prompt]), str(paths.claude_dir), {}), paths, effects):
# No worker session answers the calls, so the ask is filed under its own id.
ask_id = effects.new_id()
ask = Ask(ask_id, ask_id, checkout, question, effects.now(), effects.pid(), OpenOnTerminal())
shown(paths, ask, effects)
try:
unstarted = hand_over(ClaudeCommand(claude_args(rung, [prompt]), str(paths.claude_dir), {}), paths, effects)
finally:
withdrawn(paths, ask, effects)
if unstarted:
return Stop(1, f"could not start claude for the routing calls: {unstarted.reason}")
# Raised once the human has seen them, answered or not: an unanswered call reaches the plan through AGENTS.md, so it is not asked twice.
if unmarked := archive.mark_raised(root, new, utc(effects.now())):