Move loop-claude's cycle, judge, interrupt, tmux and routing into agent_cycle
CI / tests (pull_request) Failing after 3m50s
CI / tests (pull_request) Failing after 3m50s
This commit is contained in:
@@ -6,7 +6,8 @@ from git_cli.git_repo import default_ref
|
||||
from release_plan.release_standing import DefaultPlan, project_plan, UNSEEN_RELEASES
|
||||
from loop_effects.effects import Effects, say
|
||||
from failure import Failure
|
||||
from loop_claude.routing import first_route, kept, routed_item
|
||||
from agent_cycle.routing import first_route, kept
|
||||
from loop_claude.routed_item import routed_item
|
||||
from loop_claude.loop.chunk_windows import held_beside, item_of
|
||||
from chunk_preflight.main import ITEM
|
||||
from plan.todo_table import Item
|
||||
|
||||
@@ -20,7 +20,7 @@ from transcript_archive.project_key import project_key
|
||||
from release_plan.release_standing import project_plan
|
||||
from claude_code.transcript import read_transcript
|
||||
from claude_code.session import Session, session_named, transcript_file
|
||||
from loop_claude import tmux
|
||||
from agent_cycle import tmux
|
||||
|
||||
# Under the home folder, a folder per project key holds LOCK.
|
||||
STATE = ".local/state/loop-claude"
|
||||
|
||||
@@ -2,12 +2,12 @@
|
||||
import dataclasses
|
||||
import pathlib
|
||||
|
||||
from loop_claude.cycle.run import archived_step, archived_stop, Concluded
|
||||
from loop_claude.verdicts import Finished
|
||||
from agent_cycle.run import archived_step, archived_stop, Concluded
|
||||
from agent_cycle.verdicts import Finished
|
||||
from loop_claude.loop.this_loop import Loop
|
||||
from loop_claude.loop.reload import LoopRun
|
||||
from loop_claude.stop import needs_human, Stop
|
||||
from loop_claude.routing import next_route, step_up
|
||||
from agent_cycle.stop import needs_human, Stop
|
||||
from agent_cycle.routing import next_route, step_up
|
||||
from model_routing.ladder import ProjectRung
|
||||
from claude_code.session import transcript_file
|
||||
|
||||
|
||||
@@ -3,29 +3,30 @@ import pathlib
|
||||
import typing
|
||||
|
||||
from transcript_archive.location import archive_root, project_archive
|
||||
from loop_claude.cycle import chunk_items, prompts
|
||||
from loop_claude.loop.chunk_start import archived_route, chunk_start, plan_item, routed, scored_plan
|
||||
from loop_claude.loop.routing_check import check_routing
|
||||
from loop_claude.project.checkout import checkout_root
|
||||
from loop_claude.loop.chunk_windows import CHUNK_FLAG, chunk_session, item_of, start_chunks
|
||||
from loop_claude.loop.close import closed_cycle
|
||||
from loop_claude.cycle.run import Cycle, run_cycle
|
||||
from agent_cycle.run import Cycle, run_cycle
|
||||
from loop_claude.loop.reload import decode_handed, exec_if_edited, fingerprint, LoopRun, RELOAD_FLAG
|
||||
from loop_effects.effects import Effects, say
|
||||
from failure import Failure
|
||||
from loop_claude.verdicts import Finished
|
||||
from agent_cycle.verdicts import Finished
|
||||
from loop_claude.project.model_choice import get_or_ask_models
|
||||
from git_cli.git_repo import Git
|
||||
from loop_claude.loop.usage import HELP
|
||||
from loop_claude.routing import judge_rung
|
||||
from agent_cycle.routing import judge_rung
|
||||
from loop_claude.loop.this_loop import Loop
|
||||
from loop_state.paths import Paths
|
||||
from transcript_archive.project_key import project_key
|
||||
from model_routing.ladder_file import project_ladder_file, read_ladder, SHIPPED
|
||||
from loop_claude.project.premises import read_premises
|
||||
from loop_claude.project.records import read_records
|
||||
from loop_claude.stop import Stop
|
||||
from loop_claude.direct_message import tell
|
||||
from loop_claude import tmux
|
||||
from agent_cycle.stop import Stop
|
||||
from agent_cycle.direct_message import tell
|
||||
from agent_cycle import tmux
|
||||
|
||||
|
||||
def main(argv: list[str], env: typing.Mapping[str, str], paths: Paths, launcher: pathlib.Path, cwd: pathlib.Path, effects: Effects) -> int:
|
||||
@@ -129,7 +130,8 @@ def next_cycle(loop_run: LoopRun, loop: Loop) -> Cycle | Stop:
|
||||
say(f"\n=== cycle {loop_run.cycle_number}, worker on {route.rung} ===", loop.effects, stdout=True)
|
||||
if ladder_file != SHIPPED:
|
||||
say(own_ladder(ladder_file, models.worker, project is None), loop.effects)
|
||||
return Cycle(config=setup_version(loop.paths.claude_dir, loop.effects.git), effects=loop.effects, facts=facts, judge=judge_rung(ladder, models.judge), premises=premises, project=project, project_archive=archive_folder, records=records, root=loop.root, route=route, session=loop.session, task=loop_run.task, plan=scored_plan(default, loop.effects), unfinished_evidence=loop_run.unfinished_evidence, window=loop.window)
|
||||
plan = scored_plan(default, loop.effects)
|
||||
return Cycle(config=setup_version(loop.paths.claude_dir, loop.effects.git), effects=loop.effects, facts=facts, judge=judge_rung(ladder, models.judge), premises=premises, project=project, project_archive=archive_folder, records=records, root=loop.root, route=route, session=loop.session, task=loop_run.task, prompts=prompts.WORKER, taken_in=lambda entries: chunk_items.taken_in(entries, plan), unfinished_evidence=loop_run.unfinished_evidence, window=loop.window)
|
||||
|
||||
|
||||
def own_ladder(file: pathlib.Path, model: str, unrouted: bool) -> str:
|
||||
|
||||
@@ -8,7 +8,7 @@ import typing
|
||||
from loop_claude.loop.this_loop import Loop
|
||||
from model_routing.route import Route, route_of
|
||||
from loop_effects.effects import say
|
||||
from loop_claude.stop import Stop
|
||||
from agent_cycle.stop import Stop
|
||||
|
||||
RELOAD_FLAG = "--reloaded"
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ import pathlib
|
||||
|
||||
from routing_figures import archive
|
||||
from routing_figures.calls import Call, calls, totals
|
||||
from loop_claude.hand_over import claude_args, ClaudeCommand, hand_over
|
||||
from agent_cycle.hand_over import claude_args, ClaudeCommand, hand_over
|
||||
from loop_effects.effects import Effects, say
|
||||
from failure import Failure
|
||||
from loop_claude.loop.this_loop import Loop
|
||||
@@ -12,8 +12,8 @@ from model_routing.ladder_file import read_ladder, SHIPPED
|
||||
from routing_figures.render import render
|
||||
from model_routing.ladder import Rung
|
||||
from routing_figures import state
|
||||
from loop_claude.stop import Stop
|
||||
from loop_claude.direct_message import tell
|
||||
from agent_cycle.stop import Stop
|
||||
from agent_cycle.direct_message import tell
|
||||
from text_files.utc_stamp import utc
|
||||
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ import typing
|
||||
from loop_effects.effects import Effects
|
||||
from loop_state.paths import Paths
|
||||
from claude_code.session import Session
|
||||
from loop_claude.tmux import Window
|
||||
from agent_cycle.tmux import Window
|
||||
|
||||
|
||||
@dataclasses.dataclass(frozen=True)
|
||||
|
||||
@@ -49,7 +49,7 @@ claude session is named "A <key> loop-claude <window>", so a rerun resumes a chu
|
||||
deleted when the chunk finishes. A fresh worker is told the items the project's other chunks hold,
|
||||
running or stopped: each one's own and those on its latest `Chunk items:` line, and leaves them out.
|
||||
|
||||
A question only the human can answer is an interrupt (bin/loop_claude/cycle/interrupt.py).
|
||||
A question only the human can answer is an interrupt (bin/agent_cycle/interrupt.py).
|
||||
loop-claude prints the question in the chunk's window and rings its bell. Until it is answered the
|
||||
window's name ends in " ?", as in "item-372 ?", which tmux's status bar shows. The human answers it
|
||||
there:
|
||||
@@ -82,7 +82,7 @@ Before each worker starts, loop-claude waits until at least a quarter of the mac
|
||||
available (bin/machine_load/memory.py).
|
||||
|
||||
Each worker's claude, the session /talk opens and the subagents either launches run with a 200k
|
||||
auto-compact window (CLAUDE_CODE_AUTO_COMPACT_WINDOW, bin/loop_claude/cycle/worker.py), so each
|
||||
auto-compact window (CLAUDE_CODE_AUTO_COMPACT_WINDOW, bin/agent_cycle/worker.py), so each
|
||||
compacts its context at about 170k tokens. They also save a Bash result of more than 6,000
|
||||
characters to a file and see its path and the first 2,000 characters (BASH_MAX_OUTPUT_LENGTH,
|
||||
bin/claude_code/output_limits.py).
|
||||
@@ -101,7 +101,7 @@ models on another; a chunk no item routes runs on the project's model. The worke
|
||||
rungs it launches its reviews on. The worker's rung steps up as a chunk stays unfinished, when the
|
||||
worker names on its `Chunk items:` line an item that picks a higher rung, or when the judge finds
|
||||
in the transcript an escalation trigger that fired and the worker asked for a higher rung. The
|
||||
rules are in bin/loop_claude/routing.py and bin/model_routing/ladder.py, the choice of
|
||||
rules are in bin/agent_cycle/routing.py and bin/model_routing/ladder.py, the choice of
|
||||
each review's rung in bin/model_routing/review_choice.py, and the prompts' wording in
|
||||
bin/loop_claude/cycle/prompts.py. Each verdict, interrupt, quoted answer, stop and
|
||||
step-up in the archive ends with a Worker: line, the route as JSON (Route.worker_line in
|
||||
|
||||
Reference in New Issue
Block a user