Move the judge, the interrupt, trust and model resolution into their own modules
This commit is contained in:
+12
-10
@@ -11,12 +11,13 @@ its session next cycle; the next chunk starts a fresh session.
|
||||
Cycles continue until that interrupt or Ctrl-C. Words: ~/.claude/CLAUDE.md → "Vocabulary".
|
||||
|
||||
Exit 1: no task, not inside a checkout, no premises, a models file it cannot read or write, claude
|
||||
leaves no transcript or one it cannot read, a reload with unreadable state, or the worker or the
|
||||
judge fails three times running. A worker fails when claude cannot start, exits non-zero, is killed,
|
||||
or ends without a result event; a judge when its verdict misses a field or quotes nothing in the
|
||||
transcript.
|
||||
leaves no transcript or one it cannot read, claude cannot start for an interrupt, a reload with
|
||||
unreadable state, or the worker or the judge fails three times running. A worker fails when claude
|
||||
cannot start, exits non-zero, is killed, or ends without a result event; a judge when claude cannot
|
||||
start or exits non-zero, or its verdict misses a field or quotes nothing in the transcript.
|
||||
Exit 2: the human is needed, to pick the model or answer an interrupt, and stdin or stdout is not a
|
||||
terminal, or the interrupt ended without them typing anything. Rerunning resumes any open session.
|
||||
terminal, the input ends, or the interrupt ended without them typing anything. Rerunning resumes any
|
||||
open session.
|
||||
|
||||
Each project has one session, "A <path> loop-claude", <path> being the checkout relative to ~/code,
|
||||
or to / outside it, deleted when the chunk finishes. Its transcript is archived under
|
||||
@@ -48,7 +49,8 @@ import dataclasses
|
||||
import sys
|
||||
|
||||
from loop_claude.checkout import checkout_root
|
||||
from loop_claude.cycle import project_model, run_cycle
|
||||
from loop_claude.cycle import run_cycle
|
||||
from loop_claude.models import project_models
|
||||
from loop_claude.outcome import Continue, Retry, Stop
|
||||
from loop_claude.premises import read_premises
|
||||
from loop_claude.reload import RELOAD_FLAG, decode_state, fingerprint, reload_if_edited
|
||||
@@ -84,11 +86,11 @@ def run_loop(argv, env, paths, launcher, cwd):
|
||||
premises = read_premises(state.root)
|
||||
if isinstance(premises, Stop):
|
||||
return premises
|
||||
chosen = project_model(state.root, paths, env)
|
||||
if isinstance(chosen, Stop):
|
||||
return chosen
|
||||
models = project_models(state.root, paths, env)
|
||||
if isinstance(models, Stop):
|
||||
return models
|
||||
print(f"\n=== cycle {state.cycle_number} ===", flush=True)
|
||||
match run_cycle(state.root, state.task, premises, chosen, paths, env):
|
||||
match run_cycle(state.root, state.task, premises, models, paths):
|
||||
case Stop() as stop:
|
||||
return stop
|
||||
case Retry(failure):
|
||||
|
||||
Reference in New Issue
Block a user