Gather every Claude Code format loop-claude reads into claude_code.py, verified on 2.1.284

This commit is contained in:
2026-09-28 20:17:39 +02:00
parent b7538bd21d
commit 80629fc6d9
9 changed files with 158 additions and 114 deletions
+3 -4
View File
@@ -2,9 +2,9 @@ import itertools
import json
import subprocess
from loop_claude.claude_code import structured_output
from loop_claude.outcome import Failure
from loop_claude.strike import strike
from loop_claude.transcript import parse
JUDGE_RULES = (
"Decide whether the human must now be interrupted. interrupt=true when any of these appear:\n"
@@ -40,7 +40,7 @@ JUDGE_SCHEMA = {
def judge(root, task, premises, transcript, model):
# No tools, so the verdict rests on the transcript grounded() checks it against; no persistence, so its runs stay out of the session picker.
# Without --bare, Claude Code 2.1.282's claude -p loads the project's and ~/.claude's CLAUDE.md.
# Without --bare, claude -p loads the project's and ~/.claude's CLAUDE.md.
args = [
"-p",
"--json-schema", json.dumps(JUDGE_SCHEMA),
@@ -72,8 +72,7 @@ def run_judge(root, args, prompt):
return Failure(f"could not start claude: {failure.strerror}")
if proc.returncode != 0:
return Failure(proc.stderr.strip() or f"the judge exited {proc.returncode}")
# Where Claude Code 2.1.282 puts the --json-schema output.
return (parse(proc.stdout) or {}).get("structured_output")
return structured_output(proc.stdout)
def judge_prompt(task, premises, transcript):