Retry the judge under one rule: an unquoted verdict fails like an incomplete one

This commit is contained in:
2026-09-24 23:02:17 +02:00
parent b1098e6e0f
commit 5ee287950a
3 changed files with 16 additions and 19 deletions
+1
View File
@@ -4,6 +4,7 @@
- Track the authored configuration: `CLAUDE.md`, `AGENTS.md`, `settings.json`, `statusline.sh`, agents, skills and principles. Credentials, transcripts and memory files stay untracked.
- `loop-claude <task>` runs a project's next chunk cycle after cycle, interrupting only for a decision that is yours or a release ready to cut.
- `loop-claude` exits 1 when the judge fails three times running; a verdict missing a field or quoting nothing in the transcript is a failure.
- `loop-claude --help` names the Claude Code version its transcript, session and trust handling were observed on; check it first when an upgrade breaks a cycle.
- `loop-claude` runs the model each project's settings pick; `WORKER_MODEL` and `JUDGE_MODEL` override it. This repo runs on Fable 5.1.
- Reviewers share one protocol for verdicts, severities, rounds and declines: `agents/review-protocol.md`.
+13 -18
View File
@@ -10,7 +10,8 @@ unfinished chunk resumes the same session next cycle; a finished one starts a fr
continue until that interrupt or Ctrl-C.
Exit 1: no task, no premises, claude leaves no transcript, or the worker or the judge fails three
times running. Exit 2: the human is needed and no terminal is attached, or the interrupt ended
times running; a verdict missing a field or quoting nothing in the transcript is a judge failure.
Exit 2: the human is needed and no terminal is attached, or the interrupt ended
without them typing anything. Before an interrupt every worktree is marked trusted in ~/.claude.json.
Each project has one session, "A ~/code/<path> auto-mode" (the absolute path outside ~/code),
@@ -285,25 +286,19 @@ def judge(task, premises, transcript):
"--permission-mode", "bypassPermissions",
"--tools", "",
]
for attempt in range(2):
proc = subprocess.run(["claude", *args], capture_output=True, input=judge_prompt(task, premises, transcript), text=True)
prompt = judge_prompt(task, premises, transcript)
for attempt in range(3):
proc = subprocess.run(["claude", *args], capture_output=True, input=prompt, text=True)
verdict = (parse(proc.stdout) or {}).get("structured_output") if proc.returncode == 0 else None
if not complete(verdict):
print(proc.stderr.strip() or "the judge returned no verdict", file=sys.stderr)
return {}
if grounded(verdict, transcript):
return verdict
print("the judge quoted nothing in the transcript twice - interrupting anyway", file=sys.stderr)
return verdict
def verdict_on(task, premises, path):
for attempt in range(3):
if verdict := judge(task, premises, render(entries(path))):
failure = proc.stderr.strip() or "the judge returned no verdict"
elif not grounded(verdict, transcript):
failure = "the judge quoted nothing in the transcript"
else:
return verdict
if attempt == 2:
sys.exit("the judge failed three times running")
print("the judge failed - retrying in a minute", file=sys.stderr)
sys.exit(f"{failure} - the judge failed three times running")
print(f"{failure} - retrying in a minute", file=sys.stderr)
time.sleep(60)
@@ -324,12 +319,12 @@ def run_cycle(task, premises, name, session_id):
path = session_file(session_id)
if not path:
sys.exit(f"claude left no transcript for session {session_id}")
verdict = verdict_on(task, premises, path)
verdict = judge(task, premises, render(entries(path)))
while verdict["ask"]:
archive(path, f"Task: {task}\n\nVerdict: needs input\n\n{verdict['question']}")
if not interrupt(session_id, path, verdict["question"]):
sys.exit(2)
verdict = verdict_on(task, premises, path)
verdict = judge(task, premises, render(entries(path)))
if verdict["finished"]:
archive(path, f"Task: {task}\n\nVerdict: finished")
end_session(path)
+2 -1
View File
@@ -4,7 +4,6 @@
Ordered by how many seats of the 2026-09-24 scoring panel (`docs/decisions.md`) named the place; each is one chunk.
- Give the judge one retry budget: an incomplete verdict and an ungrounded one retry under one rule, stated in `loop-claude`'s docstring, and `judge` drops its unused `attempt`.
- Make the re-exec handoff visible in `main`: the counters `reload_if_edited` carries across `os.execv` are named where they are read, and `SOURCE` says it is the reload baseline.
- State `larv-review`'s re-entry rules once, including whether §6's closing stability round counts against the stability cap.
- Decide resume-or-fresh in `run_cycle` from state it owns, and give `interrupt`'s no-tty and nothing-typed outcomes two distinct results.
@@ -12,5 +11,7 @@ Ordered by how many seats of the 2026-09-24 scoring panel (`docs/decisions.md`)
- Keep `###` sub-headings inside their `##` section in `sections`, pinned by a test; today a sub-heading under `## Goals` silently drops the rest of the goals.
- Merge `project` and `project_path` into one name and one shape for the project's path.
- Name the session, the archive folder and its env var `loop-claude`; today they say `auto-mode`.
- Pin every `CLAUDE.md` heading the agents and skills cite with a test that resolves each citation.
- Define chunk, plan and release inside `JUDGE_RULES`; the judge reads nothing else.
- Name the `set -u` empty-array idiom and the `@sh` eval in `statusline.sh`, one line each.
- Re-run the four-seat scoring panel and record the score in `docs/decisions.md`; the target is every dimension at 7.0 or above.