From 969190064eacd45cca251d5b82dd65c8ce8fe183 Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Thu, 3 Dec 2026 15:22:11 +0100 Subject: [PATCH] Rename loop-claude to build-release, with no alias --- .gitignore | 8 +- CLAUDE.md | 20 +- README.md | 72 +++---- bin/agent_cycle/__init__.py | 2 +- bin/agent_cycle/escalation_mark.py | 2 +- bin/agent_cycle/hand_over.py | 2 +- bin/agent_cycle/judge.py | 6 +- bin/agent_cycle/routing.py | 4 +- bin/agent_cycle/run.py | 2 +- bin/agent_cycle/spend.py | 2 +- bin/agent_cycle/states.py | 2 +- bin/agent_cycle/test_interrupt.py | 10 +- bin/agent_cycle/test_judge.py | 10 +- bin/agent_cycle/test_run.py | 4 +- bin/agent_cycle/test_tmux.py | 16 +- bin/agent_cycle/test_worker.py | 2 +- bin/agent_cycle/tmux.py | 8 +- bin/agent_cycle/worker.py | 4 +- bin/agent_cycle/worker_prompts.py | 2 +- bin/{loop-claude => build-release} | 2 +- bin/build_release/__init__.py | 4 + .../chunk/__init__.py | 0 .../chunk/chunk_items.py | 4 +- .../chunk/fresh_prompt.py | 16 +- .../chunk/test_chunk_items.py | 4 +- .../chunk/test_fresh_prompt.py | 10 +- bin/{loop_claude => build_release}/doubles.py | 2 +- .../loop/__init__.py | 0 .../loop/checkout.py | 0 .../loop/chunk_start.py | 10 +- .../loop/chunk_windows.py | 14 +- .../loop/main.py | 26 +-- .../loop/reload.py | 6 +- .../loop/routing_check.py | 10 +- .../loop/test_chunk_start.py | 14 +- .../loop/test_chunk_windows.py | 22 +-- .../loop/test_main.py | 50 ++--- .../loop/test_routing_check.py | 6 +- .../loop/test_usage.py | 28 +-- .../loop/usage.py | 56 +++--- .../routed_item.py | 2 +- .../test_black_box.py | 102 +++++----- .../test_routed_item.py | 8 +- bin/chunk_driver/__init__.py | 2 +- bin/chunk_driver/chunk_run.py | 2 +- bin/chunk_driver/claims.py | 14 +- bin/chunk_driver/drivers.py | 2 +- bin/chunk_driver/project/model_choice.py | 6 +- bin/chunk_driver/project/test_model_choice.py | 28 +-- bin/chunk_driver/prompts.py | 8 +- bin/chunk_driver/test_cycle_start.py | 2 +- bin/chunk_driver/this_loop.py | 6 +- bin/chunk_preflight/main.py | 8 +- bin/chunk_preflight/test_chunk_preflight.py | 4 +- bin/claude_code/entries.py | 2 +- bin/claude_code/output_limits.py | 2 +- bin/claude_code/reply.py | 2 +- bin/claude_code/transcript.py | 4 +- bin/command_patterns/main.py | 2 +- bin/compress_archives/main.py | 8 +- .../test_compress_archives.py | 4 +- bin/deploy_release/main.py | 2 +- bin/do_epic/chunk_prompt.py | 2 +- bin/do_epic/epic_run.py | 2 +- bin/do_epic/main.py | 10 +- bin/do_epic/scheduler.py | 10 +- bin/do_epic/test_main.py | 20 +- bin/do_epic/test_scheduler.py | 26 +-- bin/judge_replay/archived_prompt.py | 6 +- bin/judge_replay/main.py | 20 +- bin/judge_replay/test_judge_replay.py | 24 +-- bin/loop_claude/__init__.py | 4 - bin/loop_effects/effects.py | 4 +- bin/loop_state/__init__.py | 4 +- bin/metric_bench/bench.py | 2 +- bin/model_routing/ladder.py | 2 +- bin/model_routing/prices.py | 2 +- bin/model_routing/route.py | 4 +- bin/model_routing/test_worker_rungs.py | 16 +- bin/model_routing/worker_rungs.py | 14 +- bin/notifier/mattermost.py | 2 +- bin/notifier/notify.py | 2 +- bin/notifier/slack.py | 2 +- bin/notifier/test_notifier.py | 4 +- bin/plan/goals_file.py | 2 +- bin/project_config/main.py | 4 +- bin/project_config/settings.py | 2 +- bin/rank_todo.py | 2 +- bin/reading_cost/main.py | 6 +- bin/release_plan/next_chunk.py | 4 +- bin/release_plan/release_standing.py | 2 +- bin/release_plan/test_release_standing.py | 2 +- bin/repo_checks/test_import_order.py | 4 +- bin/repo_checks/test_package_cycles.py | 2 +- bin/repo_checks/test_tools_named_bare.py | 4 +- bin/review_replay/main.py | 6 +- bin/routing_figures/archive.py | 2 +- bin/routing_figures/calls.py | 2 +- bin/routing_figures/render.py | 2 +- bin/routing_figures/state.py | 4 +- bin/routing_figures/test_routing_figures.py | 2 +- bin/rule_hook/reviewer_rung.py | 8 +- bin/rule_hook/rules.py | 6 +- bin/rule_hook/test_rule_hook.py | 38 ++-- bin/rung_replay/archive.py | 4 +- bin/rung_replay/command.py | 2 +- bin/rung_replay/search.py | 2 +- bin/score_outcomes/main.py | 10 +- bin/score_outcomes/reversals.py | 4 +- bin/score_outcomes/test_score_outcomes.py | 12 +- bin/subagent_rung/main.py | 2 +- bin/task_bench/figures/gather.py | 4 +- bin/task_bench/figures/test_gather.py | 2 +- bin/task_bench/main.py | 4 +- bin/test_env.py | 6 +- bin/text_files/compressed.py | 2 +- bin/todo_item/doubles.py | 2 +- bin/todo_item/test_todo_item.py | 2 +- bin/transcript_archive/__init__.py | 4 +- bin/transcript_archive/location.py | 4 +- bin/transcript_archive/outcomes.py | 6 +- bin/transcript_archive/project_key.py | 2 +- .../test_transcript_archive.py | 2 +- docs/decisions.md | 184 +++++++++--------- docs/reading-cost.md | 46 +++++ judge-field-trials/README.md | 8 +- judge-field-trials/cases.py | 2 +- presentation/README.md | 8 +- presentation/build-pdf.py | 6 +- presentation/index.html | 16 +- reviewer-merge-trials/README.md | 2 +- rules/todo-items.md | 4 +- skills/comprehension-panel/seat-prompts.md | 4 +- skills/larv-review/SKILL.md | 6 +- stability-skip-count/README.md | 2 +- stability-skip-count/count.py | 2 +- todo.md | 50 ++--- workflow-bench/advisor_bench.py | 2 +- workflow-bench/handoff_bench.py | 2 +- 139 files changed, 717 insertions(+), 671 deletions(-) rename bin/{loop-claude => build-release} (91%) create mode 100644 bin/build_release/__init__.py rename bin/{loop_claude => build_release}/chunk/__init__.py (100%) rename bin/{loop_claude => build_release}/chunk/chunk_items.py (91%) rename bin/{loop_claude => build_release}/chunk/fresh_prompt.py (75%) rename bin/{loop_claude => build_release}/chunk/test_chunk_items.py (96%) rename bin/{loop_claude => build_release}/chunk/test_fresh_prompt.py (91%) rename bin/{loop_claude => build_release}/doubles.py (86%) rename bin/{loop_claude => build_release}/loop/__init__.py (100%) rename bin/{loop_claude => build_release}/loop/checkout.py (100%) rename bin/{loop_claude => build_release}/loop/chunk_start.py (88%) rename bin/{loop_claude => build_release}/loop/chunk_windows.py (90%) rename bin/{loop_claude => build_release}/loop/main.py (87%) rename bin/{loop_claude => build_release}/loop/reload.py (90%) rename bin/{loop_claude => build_release}/loop/routing_check.py (80%) rename bin/{loop_claude => build_release}/loop/test_chunk_start.py (96%) rename bin/{loop_claude => build_release}/loop/test_chunk_windows.py (94%) rename bin/{loop_claude => build_release}/loop/test_main.py (88%) rename bin/{loop_claude => build_release}/loop/test_routing_check.py (96%) rename bin/{loop_claude => build_release}/loop/test_usage.py (82%) rename bin/{loop_claude => build_release}/loop/usage.py (85%) rename bin/{loop_claude => build_release}/routed_item.py (85%) rename bin/{loop_claude => build_release}/test_black_box.py (93%) rename bin/{loop_claude => build_release}/test_routed_item.py (93%) delete mode 100644 bin/loop_claude/__init__.py diff --git a/.gitignore b/.gitignore index ca350af0..1cb59ec1 100644 --- a/.gitignore +++ b/.gitignore @@ -37,6 +37,10 @@ !bin/atlassian/*.py !bin/branch_chunks/ !bin/branch_chunks/*.py +!bin/build-release +!bin/build_release/ +!bin/build_release/**/ +!bin/build_release/**/*.py !bin/chunk-pr !bin/chunk-preflight !bin/chunk_driver/ @@ -79,10 +83,6 @@ !bin/larv-review !bin/larv_review/ !bin/larv_review/*.py -!bin/loop-claude -!bin/loop_claude/ -!bin/loop_claude/**/ -!bin/loop_claude/**/*.py !bin/loop_effects/ !bin/loop_effects/*.py !bin/loop_state/ diff --git a/CLAUDE.md b/CLAUDE.md index e79ac0cd..26f7f6d8 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -16,7 +16,7 @@ How work proceeds in any repo, unless the repo's `AGENTS.md` says otherwise. The - **Read the plan and the decisions only as far as the chunk needs.** Where your prompt quotes `chunk-preflight`'s facts, they hold the next item's L, E + I, tagline and detail, and each item that may join it with its L, E + I, S, tagline and detail; run `todo-item` only for what they leave out. Otherwise run `todo-item list`, which prints every item's row in the plan's order, without details. Then read the details of only the items the chunk takes, with `todo-item show `, which prints an item's row and detail. `AGENTS.md` lists the project principles and the title of each decision no project principle covers. Read an entry in `docs/decisions.md` only where the project principle or the title leaves open what the chunk or the review needs. Print one entry with `markdown-section `, where `` is what `project-record open decisions` prints. - **Where a line of `chunk-preflight`'s facts says to have one subagent write `Touches:` lists, launch it before the chunk's own work.** `rank_todo.py --check`'s warning of items with no list, which the facts also quote, doesn't call for it: only the next item's chunk gets the line that says to launch one, so the lists are written once. An item without a list starts no chunk beside another's. Launch the subagent on the rung "Working with the codebase" gives a subagent that files or scores plan items. It reads the code and adds a list to each named item's detail with `todo-item edit --detail`, as `~/.claude/rules/todo-items.md` says, and doesn't change anything else in the detail. Where it cannot tell which part of a file the item changes, it lists the whole file and says in the detail that the change is not predictable. It leaves alone a list an item already holds, even one a later edit of the item made stale. Where the plan is a file in the repo, it works in a worktree of its own off the default branch, and ships the plan as a pull request of its own with `chunk-pr`. - **Work one chunk at a time, and put every item that can share its review into it.** Every review has a fixed cost, so a chunk takes the next plan item plus every other item for which three things hold: they name one release; they fire the same review passes (`larv-review` Β§3); and no item outside the chunk blocks one of them. The items need not share a purpose. An item whose risk R, in the plan, is above 5 ships alone: it joins no chunk, and none joins it. The next plan item is the first that does not wait: an item waits while it is marked `question`, until the human answers, or while an item that blocks it is still in the plan. Tiny items, a few lines of change each, need not fire the same passes: bundle up to ten that name one release, and that no item outside the chunk blocks, into one chunk. Split a milestone into items in the plan before starting it. Fix a finding in the chunk's own change within the chunk. File a finding about anything else in `todo.md`. -- **Ask, don't guess.** Three choices are always the human's: a goal; a release, meaning the items planned into it and when it is cut; and a change to loop-claude's routing ladder, its rungs included. Any other rule that asks the human's approval reserves that choice too. Ask about a reserved choice. For any other choice, first check whether the goals already answer it. If they nearly do, propose a change to the goals and show how it answers this case: an answer settles one question, a goal settles every question like it. Otherwise take the option you would recommend, and record it with its reason: in the item's detail, or, where it governs later work, as the next sentence says. A recommendation you can give a reason for is not a guess. Ask only where you have no recommendation. Write every answer once, where it belongs, never only in chat: a goal in the goals file, a working rule in `AGENTS.md`, a standing choice in a comment at the one place it governs, or in `docs/decisions.md` once made in more than one place. When an answer holds a goal and a choice, write the goal in the goals file, and record as a choice only what the goal leaves open. +- **Ask, don't guess.** Three choices are always the human's: a goal; a release, meaning the items planned into it and when it is cut; and a change to build-release's routing ladder, its rungs included. Any other rule that asks the human's approval reserves that choice too. Ask about a reserved choice. For any other choice, first check whether the goals already answer it. If they nearly do, propose a change to the goals and show how it answers this case: an answer settles one question, a goal settles every question like it. Otherwise take the option you would recommend, and record it with its reason: in the item's detail, or, where it governs later work, as the next sentence says. A recommendation you can give a reason for is not a guess. Ask only where you have no recommendation. Write every answer once, where it belongs, never only in chat: a goal in the goals file, a working rule in `AGENTS.md`, a standing choice in a comment at the one place it governs, or in `docs/decisions.md` once made in more than one place. When an answer holds a goal and a choice, write the goal in the goals file, and record as a choice only what the goal leaves open. - **Bench a syntax with the people who write it.** Before a new or changed spelling of something users read or write ships β€” markdown, HTML, a config key, a CLI flag β€” a panel of fresh-context readers, seated as those users from the goals file's `## Audience`, picks it. - **Implement the simplest change that solves the item, and ship it with `/larv-review`.** Whenever a test can check the change, write that test first and see it fail. Take its expected values from the item, never from the code. larv-review's reviewers hold the change to the technical principles, and a finding against one names it. Read a file in the principles folder the project's config sets (`project-config principles` prints it) only when the item changes it, a finding or a record you write names it, or you decline a finding. - **Change the setup for each finding an outside reviewer raises on a PR, deterministic tools first.** An outside reviewer is a forge's auto-reviewer or a human, not one of larv-review's reviewer agents. For each finding of theirs, whether you fix it or decline it, ask why our review didn't raise it first, and change the setup so it would; a fix that only answers the comment leaves the same gap open for the next chunk. Put the change in the first place that fits: @@ -77,9 +77,9 @@ The rules only reviewers apply, for quality, comments, READMEs and prose, are th - Tear down test containers after a run. - Give every container you start a memory limit and a swap limit, as large as its work needs: `--memory 4g --memory-swap 4g` on `docker run`, or `mem_limit` and `memswap_limit` in a compose file, scripts included. rule-hook checks only the `docker run` and `docker create` in your Bash commands. - A heavy command loads the machine for minutes: a full gate, mutation tests, an e2e run, a `docker build`. Run each one under `run-heavy`, as in `run-heavy ./ci.sh`. run-heavy waits for one of the heavy slots that every session on the machine shares. It also caps each container the command makes at the slot's share of memory, where the container sets no limits; give a container that needs more its own. Run the command in the background, since run-heavy's wait can outlast the Bash tool's timeout; `wait-for []` waits for a line in a log the command writes. -- Delegate a task to a subagent only when you need just its conclusion: a search or read across many files, or work independent enough to run in parallel. Keep edits, and whatever you must check line by line, in your own thread: you would read a delegated diff again to check it. Score the task's L as for a plan item; a task that changes no file, such as a search, is L 1. `` below is the project's model id, such as `claude-opus-5-5`: the one loop-claude's prompt names as the project's, or else your own. Launch the subagent with the model and effort of the first case that fits: - 1. A reviewer, a comprehension seat or the security pass: those loop-claude's prompt gives it. Given none, pass no model or effort, so it runs on your model. - 2. An escalated task, below: the rung loop-claude's prompt names for escalation, or case 3's rung where the subagent files or scores plan items and that rung is higher. +- Delegate a task to a subagent only when you need just its conclusion: a search or read across many files, or work independent enough to run in parallel. Keep edits, and whatever you must check line by line, in your own thread: you would read a delegated diff again to check it. Score the task's L as for a plan item; a task that changes no file, such as a search, is L 1. `` below is the project's model id, such as `claude-opus-5-5`: the one build-release's prompt names as the project's, or else your own. Launch the subagent with the model and effort of the first case that fits: + 1. A reviewer, a comprehension seat or the security pass: those build-release's prompt gives it. Given none, pass no model or effort, so it runs on your model. + 2. An escalated task, below: the rung build-release's prompt names for escalation, or case 3's rung where the subagent files or scores plan items and that rung is higher. 3. A subagent that files or scores plan items: what `subagent-rung --plan ` prints, which is never below the project's rung. 4. Any other: what `subagent-rung ` prints. - Escalate a task that proves too hard for your rung. Four escalation triggers say so: @@ -88,7 +88,7 @@ The rules only reviewers apply, for quality, comments, READMEs and prose, are th 3. A pass reports a πŸ”΄ in round 2. 4. A review rules the work below standard: systems-architect's BLOCK, a finding against the review standards' `quality.md`, or a vote `record-ruling` counts as worse, in the report that stands after any relaunch one rung up (`larv-review` Β§3 β†’ "Rung up"). It doesn't fire where the fix changes only prose (`larv-review` Β§3 says what is prose): fix that on your own rung. - When one fires, hand the hard part, edits included, to a subagent on the rung loop-claude's prompt names, one above yours. Open the subagent's prompt with the marker loop-claude's prompt gives, then the trigger's evidence. Each later subagent on that task runs on that rung or higher, and each further escalation trigger moves the task one rung higher, up to the highest rung loop-claude's prompt names. Ask the human before going higher. Where loop-claude's prompt names no escalation, as on the ladder's top rung or off it, keep the task in your own thread. + When one fires, hand the hard part, edits included, to a subagent on the rung build-release's prompt names, one above yours. Open the subagent's prompt with the marker build-release's prompt gives, then the trigger's evidence. Each later subagent on that task runs on that rung or higher, and each further escalation trigger moves the task one rung higher, up to the highest rung build-release's prompt names. Ask the human before going higher. Where build-release's prompt names no escalation, as on the ladder's top rung or off it, keep the task in your own thread. - Give a subagent only the access its job needs, and state the limits in its prompt. One that only reads, such as a prose review, gets no shell and no edits. A reviewer under `~/.claude/agents/` writes only its report, under `~/.local/state/larv-review/`, and rule-hook refuses it every other Write, every Edit and every MultiEdit. One that probes a build tags the image as throwaway and removes it afterwards, writes only to a folder it makes under the chunk's review folder (`larv-review review-folder` prints it), and removes no image or file it did not create. - Check `README.md` first for build, test, install, and codegen commands, and fix one that misbehaves in the same change. Refresh `README.md` whenever you change what it describes, keeping it true, not longer. - Where `rule-hook` does not check it, such as an image named in test code, a Kubernetes manifest or a `docker run` line, pin a container image to its full patch version and a GitHub Action to a semver tag. @@ -122,9 +122,9 @@ The rules only reviewers apply, for quality, comments, READMEs and prose, are th Claude Code reads this section by its heading when it compacts a conversation. Keep in the summary: - what remains before the chunk is finished; -- the task loop-claude gave, and each plan item the chunk takes with its L and E + I; +- the task build-release gave, and each plan item the chunk takes with its L and E + I; - the worktree, branch and PR; -- the rung loop-claude named for each review launch, rerun and escalated subagent; +- the rung build-release named for each review launch, rerun and escalated subagent; - each review pass's rounds so far, each open πŸ”΄ and 🟑, and how the answered ones were answered; - every question the human answered, with the answer; - each escalation trigger that fired; @@ -133,10 +133,10 @@ Claude Code reads this section by its heading when it compacts a conversation. K ## Vocabulary - **chunk** β€” the unit of work, shipped as one PR; "Working loop" says what it holds. -- **cycle** β€” in `loop-claude`, worker runs and the judge's verdict on each, until the chunk closes or is left for the next cycle. In between, the human answers any interrupt, or the worker resumes with an answer the judge quoted from the premises or the judge's records. +- **cycle** β€” in `build-release`, worker runs and the judge's verdict on each, until the chunk closes or is left for the next cycle. In between, the human answers any interrupt, or the worker resumes with an answer the judge quoted from the premises or the judge's records. - **gate** β€” the merge gate: the checks a PR passes before it merges. - **goals file** β€” the file holding a project's `## Goals` and `## Audience`: the one its config names as `goals-and-audience`. Read it in the file `project-record open goals-and-audience` prints. It is `README.md`, unless a client's project keeps it in the config's folder, or in a Jira epic's description, whose `## Goals` and `## Audience` the loop only reads. -- **interrupt** β€” `loop-claude` asking the human, on its terminal, for a decision that is theirs. They type a one-line answer there, or `/talk` to open the worker's session there with `claude --resume`. A release ready to cut opens that session at once. A routing call opens claude on that terminal too, in `~/code/claude-config`, the checkout where this setup is developed. +- **interrupt** β€” `build-release` asking the human, on its terminal, for a decision that is theirs. They type a one-line answer there, or `/talk` to open the worker's session there with `claude --resume`. A release ready to cut opens that session at once. A routing call opens claude on that terminal too, in `~/code/claude-config`, the checkout where this setup is developed. - **judge** β€” the headless claude that reads a worker's transcript each cycle and decides whether to interrupt and whether the chunk is finished. - **judge's records** β€” the files the judge reads beside the premises: the project's `AGENTS.md` and `docs/decisions.md`, then the human's `~/.claude/CLAUDE.md` and the `.md` files in `~/.claude/rules/`, then those in the project's review standards. - **paired ruling** β€” the seats vote whether the project reads better, the same or worse at the branch's head than at the base, the commit `larv-review ruling-base` prints; `larv-review --help` says how the votes make the ruling. @@ -144,7 +144,7 @@ Claude Code reads this section by its heading when it compacts a conversation. K - **place** β€” the smallest addressable unit, such as a function or a section heading, that a seat names with its `path:line` when it judges how hard the project is to read there. - **plan** β€” where the project keeps its items, as the `plan` setting of its config names it: a `todo.md` at a path, or a Jira epic. - **premises** β€” the goals and audience under `## Goals` and `## Audience` in the project's goals file, with code health ("Shared goal") first among the goals unless the goals file voids it. -- **project's rung** β€” the cheapest rung on loop-claude's routing ladder of the project's model, which is the model loop-claude's prompt names as the project's, or else your own. +- **project's rung** β€” the cheapest rung on build-release's routing ladder of the project's model, which is the model build-release's prompt names as the project's, or else your own. - **project record** β€” one of five documents a project keeps beside its plan, each where its config names it: `decisions`, `score-anchors`, `comprehension-history`, `reading-cost` and `changelog`. - **release** β€” a semver version the human cuts, or in a client's project someone on its team. - **release review** β€” a release's last chunk: the architecture and principles passes over the whole project, before the release is ready to cut; `larv-review` Β§3 β†’ "Release review". diff --git a/README.md b/README.md index 6acbe1ff..62d38692 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Claude Code configuration -My personal `~/.claude`, version controlled: `CLAUDE.md` and `rules/` for instructions, the words under `CLAUDE.md` β†’ "Vocabulary"; `.claude/rules/` for the rules that load in this repo alone; `agents/` and `skills/`; `principles/` and `skills/larv-review/standards/` for what the reviewer agents hold projects to, which a project's config names as `principles` and `standards`; `docs/` for decisions and the comprehension history; `settings.json` for the harness and `.claude/settings.json` for the harness inside this repo; `CHANGELOG.md` and `todo.md`; the tools in `bin/`, with the routing ladder they ship, `bin/model_routing/routing-ladder.json`; `workflow-bench/`, the scripts and prompts of the 2026-09-30 bench of larv-review and of the 2026-11-12 bench of the advisor tool; `reviewer-merge-trials/`, the 2026-11-09 trials of merging reviewers, with their method, results and scripts; `judge-field-trials/`, the 2026-11-11 trials of which facts code could read in place of loop-claude's judge, with their results and scripts; `stability-skip-count/`, the 2026-11-12 count of archived stability rounds, with its script, from which larv-review took when to skip a stability round 2; and `presentation/`, a page that explains this setup to newcomers, with the script that prints it to PDF. +My personal `~/.claude`, version controlled: `CLAUDE.md` and `rules/` for instructions, the words under `CLAUDE.md` β†’ "Vocabulary"; `.claude/rules/` for the rules that load in this repo alone; `agents/` and `skills/`; `principles/` and `skills/larv-review/standards/` for what the reviewer agents hold projects to, which a project's config names as `principles` and `standards`; `docs/` for decisions and the comprehension history; `settings.json` for the harness and `.claude/settings.json` for the harness inside this repo; `CHANGELOG.md` and `todo.md`; the tools in `bin/`, with the routing ladder they ship, `bin/model_routing/routing-ladder.json`; `workflow-bench/`, the scripts and prompts of the 2026-09-30 bench of larv-review and of the 2026-11-12 bench of the advisor tool; `reviewer-merge-trials/`, the 2026-11-09 trials of merging reviewers, with their method, results and scripts; `judge-field-trials/`, the 2026-11-11 trials of which facts code could read in place of build-release's judge, with their results and scripts; `stability-skip-count/`, the 2026-11-12 count of archived stability rounds, with its script, from which larv-review took when to skip a stability round 2; and `presentation/`, a page that explains this setup to newcomers, with the script that prints it to PDF. ## Goals @@ -51,7 +51,7 @@ Take this checkout only onto a machine that is a sandbox with no direct access t This release still installs into `~/.claude`, which goals 2 and 3 work to end. -Each machine holds two checkouts. `~/.claude` is the one Claude Code reads, and it holds only a release: `deploy-release` moves it from tag to tag. Develop in a clone under `~/code`, where loop-claude runs this repo's chunks like any project's. +Each machine holds two checkouts. `~/.claude` is the one Claude Code reads, and it holds only a release: `deploy-release` moves it from tag to tag. Develop in a clone under `~/code`, where build-release runs this repo's chunks like any project's. Claude Code may already have created `~/.claude`, where `git clone` refuses to run, so make the repository in place, then clone it for development: @@ -81,27 +81,27 @@ git config filter.settings.clean bin/settings_filter.py Then pick a model with `/model`. -Link `loop-claude` onto `PATH`: `ln -s ~/.claude/bin/loop-claude ~/.local/bin/loop-claude`. Every claude it starts, the interactive ones included, skips every permission prompt. loop-claude runs each chunk in its own window of a tmux session per project, so it needs tmux 3.2 or later. +Link `build-release` onto `PATH`: `ln -s ~/.claude/bin/build-release ~/.local/bin/build-release`. Every claude it starts, the interactive ones included, skips every permission prompt. build-release runs each chunk in its own window of a tmux session per project, so it needs tmux 3.2 or later. Back up these four folders and one file: - `~/.claude-projects/`: each project's config, and a client project's plan and records. A project's `env-file`, if you keep it here as below, puts credentials in the backup, so keep the backup private. -- `~/.claude/loop-claude-models.json`: the model of each project, which loop-claude and do-epic write. -- `~/.claude/loop-claude-transcripts`: every transcript loop-claude keeps. Where you set `LOOP_CLAUDE_TRANSCRIPTS`, back up the folder it names instead. +- `~/.claude/loop-claude-models.json`: the model of each project, which build-release and do-epic write. +- `~/.claude/loop-claude-transcripts`: every transcript build-release keeps. Where you set `BUILD_RELEASE_TRANSCRIPTS`, back up the folder it names instead. - `~/.claude/do-epic-transcripts`: the transcripts of do-epic's chunks. - `~/.local/state/larv-review`: each chunk's review reports. Leave out Claude Code's memory files in `~/.claude/projects//memory/`: Claude Code writes them, so they aren't part of this setup. -To keep loop-claude's transcripts and the reports small, add a crontab line that gzips each transcript and review file 30 days after it last changed, and logs each run with its date: +To keep build-release's transcripts and the reports small, add a crontab line that gzips each transcript and review file 30 days after it last changed, and logs each run with its date: ```sh 17 4 * * * { date; $HOME/.claude/bin/compress-archives; } >> $HOME/.local/state/compress-archives.log 2>&1 ``` -Cron runs it with its own `PATH` and environment. Where the `python3` on cron's `PATH` is older than 3.14, or you set `LOOP_CLAUDE_TRANSCRIPTS`, set `PATH` or that variable in the crontab too. +Cron runs it with its own `PATH` and environment. Where the `python3` on cron's `PATH` is older than 3.14, or you set `BUILD_RELEASE_TRANSCRIPTS`, set `PATH` or that variable in the crontab too. -To get loop-claude's questions and stops as DMs from a bot, write the bot's token, your username or member ID and, for Mattermost, the server into `~/.claude-projects/.env`, in the keys `~/.claude/bin/notify --help` names, run `chmod 600` on it, and add `env-file = "~/.claude-projects/.env"` and `notifier = "mattermost"` (or `"slack"`) to the project's config, as Install β†’ "Set up a project" describes. +To get build-release's questions and stops as DMs from a bot, write the bot's token, your username or member ID and, for Mattermost, the server into `~/.claude-projects/.env`, in the keys `~/.claude/bin/notify --help` names, run `chmod 600` on it, and add `env-file = "~/.claude-projects/.env"` and `notifier = "mattermost"` (or `"slack"`) to the project's config, as Install β†’ "Set up a project" describes. ### Set up a project @@ -133,7 +133,7 @@ A project may also set `bench-tasks`, a path spelt the same way, such as `bench- A project whose team wrote its own coding conventions lists the files in `coding-conventions`, each spelt as `principles` is, such as `coding-conventions = ["checkout:CONVENTIONS.md"]`. Each reviewer agent larv-review launches reads them beside the principles and the standards, and the team's rule wins where they conflict. -A project may also set `notifier` to `"mattermost"` or `"slack"`, the service that sends loop-claude's DMs. The `env-file` then holds that service's keys. A project that sets none gets no DMs, whatever its env file holds. `project-config notifier` prints the setting. +A project may also set `notifier` to `"mattermost"` or `"slack"`, the service that sends build-release's DMs. The `env-file` then holds that service's keys. A project that sets none gets no DMs, whatever its env file holds. `project-config notifier` prints the setting. A project's config may set four more things, each optional, as `project-config --help` describes. `language` names the language its owners write in, where that isn't English: the worker writes the project's prose in it, and the prose reviewer judges the prose in it. `commit-title`, `pull-request-title` and `branch` are templates for a project that titles and names these in another way than `CLAUDE.md` β†’ "Git, commits, and PRs" says. `chunk-preflight` names the branch and the worktree by the `branch` template. On a branch that fits it, rule-hook refuses a commit, and `chunk-pr` a pull request, whose title doesn't fit its template; on any other branch, such as a release review's, a title is the summary alone. A tool that reads a commit title, such as a round's `Answer round :`, reads the template's `{summary}`: it tries `commit-title`, then `pull-request-title`, since a squash merge titles the commit as the pull request, then takes the title whole. While a project's config holds a fault, rule-hook refuses every commit there, and the tools that read its titles fail naming the fault. @@ -141,11 +141,11 @@ A legacy project with no container setup sets `tooling-on-host = true`, so the l A project whose pull requests need a human's approval sets `wait-for-approval = true` in its config. `chunk-pr merge` then waits, once the checks have passed, until GitHub reports the pull request approved as its branch protection requires, and merges it. It refuses on Gitea, where a reviewer requested changes and where the protection requires no review. While it waits, other chunks merge. It stops where a reviewer's comment waits for an answer, on an approved pull request too; answer it and run it again. It gives up after 90 minutes without an approval; run it again once the pull request is approved. Left out, the setting is false. -A project whose team merges its pull requests itself sets `merge = "human"`. `chunk-pr merge` then brings the branch level with origin's default branch, finishes the chunk's plan items, waits for the checks and marks the pull request ready, but leaves the merge to a person. A plan or changelog kept in the checkout is finished on the branch, so it lands with that merge; one kept in Jira, or in the config's folder, is finished at once; where you close the pull request unmerged, file the item again. A do-epic chunk parks until the pull request is merged, and its window's name says `awaits your merge`. The chunk resumes and brings the branch level again once the pull request conflicts with the default branch. It does so too once the branch is behind a default branch whose protection, on GitHub, requires an up-to-date branch. loop-claude doesn't start a chunk for an item that a ready pull request finishes. Once no item left in the release can start and one awaits a merge, loop-claude stops and names the pull requests to merge; run it again after you merge one. The first chunk after a merge runs `chunk-pr clean` in the worktree the merged pull request left, where nobody pushed to the pull request after the chunk did. Nobody works on a pull request that awaits your merge. To have a reviewer's comment answered, turn the pull request back into a draft: a chunk then takes its item up again. Left out, the setting is `"chunk"`: the chunk merges. +A project whose team merges its pull requests itself sets `merge = "human"`. `chunk-pr merge` then brings the branch level with origin's default branch, finishes the chunk's plan items, waits for the checks and marks the pull request ready, but leaves the merge to a person. A plan or changelog kept in the checkout is finished on the branch, so it lands with that merge; one kept in Jira, or in the config's folder, is finished at once; where you close the pull request unmerged, file the item again. A do-epic chunk parks until the pull request is merged, and its window's name says `awaits your merge`. The chunk resumes and brings the branch level again once the pull request conflicts with the default branch. It does so too once the branch is behind a default branch whose protection, on GitHub, requires an up-to-date branch. build-release doesn't start a chunk for an item that a ready pull request finishes. Once no item left in the release can start and one awaits a merge, build-release stops and names the pull requests to merge; run it again after you merge one. The first chunk after a merge runs `chunk-pr clean` in the worktree the merged pull request left, where nobody pushed to the pull request after the chunk did. Nobody works on a pull request that awaits your merge. To have a reviewer's comment answered, turn the pull request back into a draft: a chunk then takes its item up again. Left out, the setting is `"chunk"`: the chunk merges. -A project whose team wants an epic's work in one pull request sets `epic-branch`, a template with `{epic}` for the epic's key, such as `epic-branch = "{epic}"`. Under loop-claude the epic is the Jira epic the config's `plan` names, so a plan kept in a file gets no working branch. Under do-epic it is the epic do-epic drives. Each chunk then branches off the epic's working branch, here `ABC-123` for the epic ABC-123, and `chunk-pr` opens its pull request into that branch and merges it there without a person, also under `merge = "human"` and `wait-for-approval`: those two keep guarding the default branch. A pull request that was open into the default branch when you set `epic-branch` stays yours to settle: `chunk-pr ready` and `merge` fail on it, naming both branches, until you change its base on the forge to the working branch, or merge it yourself. `chunk-preflight`, and do-epic as a chunk starts, make the branch on origin off the default branch, or merge the default branch into it with a merge commit, which needs git 2.38 or later. Where that merge conflicts, they stop, and a person merges it. Once the epic's last issue has landed, do-epic's finishing chunk runs `chunk-pr open-epic `, which brings the branch level once more and opens the pull request from it into the default branch. Under loop-claude, run it yourself. A person merges that pull request, and its checks and reviews are theirs to answer. An auto-reviewer that reviews only pull requests into the default branch is asked by a comment: set `review-request-comment` to the comment's text, such as `"@reviewbot review"`. `chunk-pr ready` then posts it on a pull request into the working branch, and `chunk-pr push` pushes later commits and posts it again. +A project whose team wants an epic's work in one pull request sets `epic-branch`, a template with `{epic}` for the epic's key, such as `epic-branch = "{epic}"`. Under build-release the epic is the Jira epic the config's `plan` names, so a plan kept in a file gets no working branch. Under do-epic it is the epic do-epic drives. Each chunk then branches off the epic's working branch, here `ABC-123` for the epic ABC-123, and `chunk-pr` opens its pull request into that branch and merges it there without a person, also under `merge = "human"` and `wait-for-approval`: those two keep guarding the default branch. A pull request that was open into the default branch when you set `epic-branch` stays yours to settle: `chunk-pr ready` and `merge` fail on it, naming both branches, until you change its base on the forge to the working branch, or merge it yourself. `chunk-preflight`, and do-epic as a chunk starts, make the branch on origin off the default branch, or merge the default branch into it with a merge commit, which needs git 2.38 or later. Where that merge conflicts, they stop, and a person merges it. Once the epic's last issue has landed, do-epic's finishing chunk runs `chunk-pr open-epic <epic's key> <title>`, which brings the branch level once more and opens the pull request from it into the default branch. Under build-release, run it yourself. A person merges that pull request, and its checks and reviews are theirs to answer. An auto-reviewer that reviews only pull requests into the default branch is asked by a comment: set `review-request-comment` to the comment's text, such as `"@reviewbot review"`. `chunk-pr ready` then posts it on a pull request into the working branch, and `chunk-pr push` pushes later commits and posts it again. -For a client's project, use one sandbox VM per client, so that one client's code, transcripts and credentials never share a machine with another's. What the client's repo should not hold lives in the config's folder, at paths written as `folder:<path>`, as `project-config --help` shows: the plan, the working rules in an `AGENTS.md` I write for the agents, the records, and the goals and audience, as `goals-and-audience = "folder:goals.md"`. Name that file `goals.md`, so the rules for goals and audience load when an agent writes it. A file outside the checkout has no commits in the checkout's history, so four things are not supported for it yet. `score-outcomes` and loop-claude's routing figures count a project's chunks only where `todo.md`, `docs/comprehension-history.md` and `docs/reading-cost.md` are at those paths in the checkout; otherwise each says so, and the loop goes on. For a plan or a comprehension history outside the checkout, `larv-review` says it cannot tell whether a scoring run is owed, and for such a history it cannot find a paired ruling's base. For a plan outside the checkout, chunk-preflight and loop-claude don't see a release whose last item has shipped, and say that its release review and its cut are yours to call. And rule-hook checks a plan outside the checkout on every call, not only when it changed. +For a client's project, use one sandbox VM per client, so that one client's code, transcripts and credentials never share a machine with another's. What the client's repo should not hold lives in the config's folder, at paths written as `folder:<path>`, as `project-config --help` shows: the plan, the working rules in an `AGENTS.md` I write for the agents, the records, and the goals and audience, as `goals-and-audience = "folder:goals.md"`. Name that file `goals.md`, so the rules for goals and audience load when an agent writes it. A file outside the checkout has no commits in the checkout's history, so four things are not supported for it yet. `score-outcomes` and build-release's routing figures count a project's chunks only where `todo.md`, `docs/comprehension-history.md` and `docs/reading-cost.md` are at those paths in the checkout; otherwise each says so, and the loop goes on. For a plan or a comprehension history outside the checkout, `larv-review` says it cannot tell whether a scoring run is owed, and for such a history it cannot find a paired ruling's base. For a plan outside the checkout, chunk-preflight and build-release don't see a release whose last item has shipped, and say that its release review and its cut are yours to call. And rule-hook checks a plan outside the checkout on every call, not only when it changed. A client that plans in Jira Cloud names an epic as its project's plan: `plan = "jira:https://acme.atlassian.net/browse/ABC-12"`, which is `jira:` and the epic's address as the browser shows it. The plan is then the epic's open child issues, in Jira's backlog order, which the team sets, apart from the rank `todo-item add` gives an issue it files. An issue in a done status is a finished item. Each part of an item comes from one part of its issue: @@ -194,7 +194,7 @@ An epic's description states the formula that puts its issues in order: once und Each repo an epic changes has a project config of its own, as in the rest of this section. `do-epic` fails and names each setting or file that is missing or invalid. -A project runs on the routing ladder this setup ships, `bin/model_routing/routing-ladder.json`: the rungs, least competent first, each a model at an effort, that loop-claude routes workers, subagents and reviews to. To run one project on other rungs, as when an outage or a client's account leaves it fewer models, copy that file to `~/.claude-projects/<key>/routing-ladder.json` and cut or change its rungs. Keep one model for each family, such as opus: Claude Code launches a subagent by its family's name. The project's file replaces the shipped ladder whole. loop-claude reads it as each cycle starts, and `subagent-rung` and rule-hook each time they run. The loop never commits it, so commit it in the folder's repo yourself only where it should last. Set the project's models to ones its ladder holds, for example with `LOOP_CLAUDE_WORKER_MODEL` and `LOOP_CLAUDE_JUDGE_MODEL`. A model off the ladder is not routed: every worker runs on that model, at the effort Claude Code's `settings.json` gives. Each cycle of a project on a ladder of its own says so on stderr, naming the file, and says where the worker's model is off it. `loop-claude --help` shows the file's shape. +A project runs on the routing ladder this setup ships, `bin/model_routing/routing-ladder.json`: the rungs, least competent first, each a model at an effort, that build-release routes workers, subagents and reviews to. To run one project on other rungs, as when an outage or a client's account leaves it fewer models, copy that file to `~/.claude-projects/<key>/routing-ladder.json` and cut or change its rungs. Keep one model for each family, such as opus: Claude Code launches a subagent by its family's name. The project's file replaces the shipped ladder whole. build-release reads it as each cycle starts, and `subagent-rung` and rule-hook each time they run. The loop never commits it, so commit it in the folder's repo yourself only where it should last. Set the project's models to ones its ladder holds, for example with `BUILD_RELEASE_WORKER_MODEL` and `BUILD_RELEASE_JUDGE_MODEL`. A model off the ladder is not routed: every worker runs on that model, at the effort Claude Code's `settings.json` gives. Each cycle of a project on a ladder of its own says so on stderr, naming the file, and says where the worker's model is off it. `build-release --help` shows the file's shape. ## Update @@ -224,31 +224,31 @@ A fix that must ship before `main`'s other unreleased work goes out as a patch r bin/deploy-release --cut-patch 794ce37..1aa2367 ``` -It applies only those commits on the newest tag, tests them with `ci.sh`, tags and pushes the release, then merges the tag back into `main` through a pull request and moves `~/.claude` to it. A patch skips the release review. Until it is cut, `chunk-preflight` calls the patch's release review due, and loop-claude would run it. `deploy-release --help` lists the steps. +It applies only those commits on the newest tag, tests them with `ci.sh`, tags and pushes the release, then merges the tag back into `main` through a pull request and moves `~/.claude` to it. A patch skips the release review. Until it is cut, `chunk-preflight` calls the patch's release review due, and build-release would run it. `deploy-release --help` lists the steps. ## Tools -loop-claude, do-epic and `task-bench gather` put the release's tools first on the `PATH` of every claude they start, so this README and the rules name each tool bare, as in `metric-bench`. Install puts only `loop-claude` on your shell's `PATH`: there, and in a claude you start from it yourself, call another by its path, `~/.claude/bin/<tool>`, from the project's checkout. The tools under `~/.claude` are the release's; test a change to one from `~/code/claude-config/bin`. The tools are listed in alphabetical order, and the packages under `bin/` follow under their own heading. +build-release, do-epic and `task-bench gather` put the release's tools first on the `PATH` of every claude they start, so this README and the rules name each tool bare, as in `metric-bench`. Install puts only `build-release` on your shell's `PATH`: there, and in a claude you start from it yourself, call another by its path, `~/.claude/bin/<tool>`, from the project's checkout. The tools under `~/.claude` are the release's; test a change to one from `~/code/claude-config/bin`. The tools are listed in alphabetical order, and the packages under `bin/` follow under their own heading. - `chunk-pr open|sync|ready|push|merge|clean|open-epic` opens a chunk's pull request as a draft, brings its branch level with origin's default branch, marks it ready and merges it once its checks pass, with `gh` on a GitHub origin and `tea` elsewhere. Where the project's config sets `epic-branch`, the pull request goes into the epic's working branch instead, `push` pushes later commits and asks the auto-reviewer for a review, and `open-epic` opens the pull request from that branch into the default branch. The chunks of one project merge one at a time: in its turn, `merge` brings the branch level again, finishes the plan items its `--finish` flags name, and waits for the checks. Under `merge = "human"` it then marks the pull request ready and leaves the merge to a person. Once the pull request is merged, `clean` removes the chunk's worktree and branch and fast-forwards the main checkout. `chunk-pr --help` states the steps. -- `chunk-preflight` finds the mechanical facts a chunk starts from, and with `--worktree` makes its worktree; `loop-claude` runs it with `--worktree` before it routes each chunk, and `chunk-preflight --help` lists the facts. +- `chunk-preflight` finds the mechanical facts a chunk starts from, and with `--worktree` makes its worktree; `build-release` runs it with `--worktree` before it routes each chunk, and `chunk-preflight --help` lists the facts. - `command-patterns [<version>] [--calls <file>]` prints a table of the shell command patterns a release's archived chunks ran, such as `tea pr create`, for an audit of the release, and with `--calls <file>` saves each call as a JSON line; `command-patterns --help` states the columns and the line's keys. -- `compress-archives` gzips each transcript in loop-claude's archive and each file in the review folders 30 days after it last changed, keeping all of them; Install's crontab line runs it daily. +- `compress-archives` gzips each transcript in build-release's archive and each file in the review folders 30 days after it last changed, keeping all of them; Install's crontab line runs it daily. - `deploy-release [--cut | --cut-patch <commits>] [<checkout>]` moves `~/.claude`, or the checkout named, to the newest release, as Update says; with `--cut`, run in the development clone, it first cuts the next release, and with `--cut-patch`, a patch release of only the commits named, as Release says. -- `do-epic <EPIC-KEY>` runs the chunks of one Jira epic whose items span repos, or have none, each in its own window of the tmux session `epic-<EPIC-KEY>`, on the same cycle, judge and interrupt as loop-claude. The epic's description is its record: goals, audience, scoring and decisions. Before it starts chunks, do-epic plans each open issue that no label places yet, as "Set up a project" says. It files a sub-task per repo where the issue changes several repos. Otherwise it labels the issue with where it is worked, and asks you where that is unclear. It plans no issue your team filed a sub-task under: those sub-tasks run instead, each under a label of its own, and your team closes the issue. Then, where two or more issues may start, it scores each of them that holds no scores, and moves the issues that do-epic itself filed into order of score on the board. An open issue runs once a label names its repo or marks it as Claude's, in order of score, as many at once as a line such as `**Max parallel chunks:** 2` in the epic's description allows, 1 without it, and as each repo's `parallel-chunks` allows. A chunk whose pull request waits on a gate parks. An open task of yours that blocks another issue gets a window that DMs you once and reads the epic every minute; once you close the task, the issues it blocked may start. `do-epic <EPIC-KEY> --dry-run` prints what `do-epic <EPIC-KEY>` would write to Jira and which chunks it would start, and does neither; run it before the first real run on a team's epic. `--help` lists what it prints and leaves out. do-epic closes the epic only once you confirm every goal. Install β†’ "Set up a project" says how to set it up; `do-epic --help` states the flags and the contract. +- `do-epic <EPIC-KEY>` runs the chunks of one Jira epic whose items span repos, or have none, each in its own window of the tmux session `epic-<EPIC-KEY>`, on the same cycle, judge and interrupt as build-release. The epic's description is its record: goals, audience, scoring and decisions. Before it starts chunks, do-epic plans each open issue that no label places yet, as "Set up a project" says. It files a sub-task per repo where the issue changes several repos. Otherwise it labels the issue with where it is worked, and asks you where that is unclear. It plans no issue your team filed a sub-task under: those sub-tasks run instead, each under a label of its own, and your team closes the issue. Then, where two or more issues may start, it scores each of them that holds no scores, and moves the issues that do-epic itself filed into order of score on the board. An open issue runs once a label names its repo or marks it as Claude's, in order of score, as many at once as a line such as `**Max parallel chunks:** 2` in the epic's description allows, 1 without it, and as each repo's `parallel-chunks` allows. A chunk whose pull request waits on a gate parks. An open task of yours that blocks another issue gets a window that DMs you once and reads the epic every minute; once you close the task, the issues it blocked may start. `do-epic <EPIC-KEY> --dry-run` prints what `do-epic <EPIC-KEY>` would write to Jira and which chunks it would start, and does neither; run it before the first real run on a team's epic. `--help` lists what it prints and leaves out. do-epic closes the epic only once you confirm every goal. Install β†’ "Set up a project" says how to set it up; `do-epic --help` states the flags and the contract. - `do-epic-e2e` runs `do-epic` against a sandbox epic on a real Jira site, as Test says. -- `judge-replay <model> [--offline]` replays loop-claude's judge on archived verdicts of the projects run on the model. It prints what each rung a review climbs to misses, and the lowest rung below those that returns every verdict, as each candidate above it does. With `--offline` it doesn't call a judge: it counts what a "?" rule, a decision table and a classifier trained on the archive decide of each verdict's kind from the worker's final message, and how many interrupts each misses. `judge-replay --help` states both replays. +- `judge-replay <model> [--offline]` replays build-release's judge on archived verdicts of the projects run on the model. It prints what each rung a review climbs to misses, and the lowest rung below those that returns every verdict, as each candidate above it does. With `--offline` it doesn't call a judge: it counts what a "?" rule, a decision table and a classifier trained on the archive decide of each verdict's kind from the worker's final message, and how many interrupts each misses. `judge-replay --help` states both replays. - `larv-review <command>` holds larv-review's mechanical rules: the chunk's review folder, the paired ruling's base and vote count, each pass's round count and the opening of its round commit's title, the scoring run's trigger and setup; the comprehension history's format, its latest places and its count of how often seats agree; and each reviewer's prompt header. `larv-review --help` states them. `settings.json` β†’ `hooks` runs `larv-review reviewer-context` as each subagent starts. A reviewer under `agents/` whose frontmatter has `omitClaudeMd: true` starts without `CLAUDE.md`, and the command hands it that file's "Shared goal", "Prose" and "Vocabulary" sections. -- `loop-claude <task>` runs a project's next chunks, each in its own tmux window, cycle after cycle; `loop-claude --help` states its contract. +- `build-release <task>` runs a project's next chunks, each in its own tmux window, cycle after cycle; `build-release --help` states its contract. - `markdown-section <file> <fragment>` prints the section of a markdown file under the first heading that holds the fragment, to the next heading of its level or a higher one, instead of a `grep -n` and a guessed `sed -n` range; `markdown-section --help` says what it does where several headings match. - `metric-bench [history]` benches cheap static metrics of a project's Python against the places its comprehension history names as hardest; `metric-bench --help` states the metrics and the scores. - `mutate-changes [--base <ref>] [--prefix <shell text>] [--jobs <n>]` mutation-tests the lines a branch changes and prints each mutant its tests don't kill; `mutate-changes --help` says which tool it runs for each language. -- `notify [<message>]` sends a message, or else stdin, as a DM from the bot of the project's `notifier`, Mattermost or Slack, to the human; the project's `env-file` holds the bot's token, the recipient and, for Mattermost, the server, and `notify --help` names its keys. `loop-claude --help` says when loop-claude sends one. +- `notify [<message>]` sends a message, or else stdin, as a DM from the bot of the project's `notifier`, Mattermost or Slack, to the human; the project's `env-file` holds the bot's token, the recipient and, for Mattermost, the server, and `notify --help` names its keys. `build-release --help` says when build-release sends one. - `project-config [<setting>]` prints the paths a project's config sets, or the one asked for, and fails naming each setting the config leaves out; Install β†’ "Set up a project" shows a config. - `project-record open <record>` prints the path of a file holding one of a project's records, for an agent to read and edit, and `project-record save <record>` stores the edit; for a record kept as a file, that file is the record. `goals-and-audience` opens the goals file the same way. - `rank_todo.py [--check] [todo.md]` scores and ranks a project's `todo.md`, by default the one its config names; `rank_todo.py --help` states the format. -- `reading-cost [--reset] [record]` appends a figure for each chunk `loop-claude` finished to a project's `docs/reading-cost.md`, and says whether the figures rise; `reading-cost --help` states the measure. -- `review-replay <pass> <model>` replays a review pass's archived rounds from the projects run on the model, on the code each reviewed, and prints the lowest rung below the project's that, like each rung above it, qualifies: it finds no less of the πŸ”΄ and 🟑 findings than two replays on the project's rung find, within a margin, and misses no πŸ”΄ that both found. `review-replay --help` states the replay. With `--omit-claude-md`, `--bash-ceiling` or `--read-limit` it tests instead whether the pass's reviewer may start without `CLAUDE.md`, or under the Bash output ceiling loop-claude hands the worker, or a Read limit it doesn't hand yet: it replays each round three times as archived and once with the change, and prints whether the reviewer passes: whether the last replay missed no more findings than the most an unchanged replay missed, with each count and each finding it missed. Each replayed reviewer skips every permission prompt, stability-reviewer has Bash, and an archived prompt may name paths on the host. +- `reading-cost [--reset] [record]` appends a figure for each chunk `build-release` finished to a project's `docs/reading-cost.md`, and says whether the figures rise; `reading-cost --help` states the measure. +- `review-replay <pass> <model>` replays a review pass's archived rounds from the projects run on the model, on the code each reviewed, and prints the lowest rung below the project's that, like each rung above it, qualifies: it finds no less of the πŸ”΄ and 🟑 findings than two replays on the project's rung find, within a margin, and misses no πŸ”΄ that both found. `review-replay --help` states the replay. With `--omit-claude-md`, `--bash-ceiling` or `--read-limit` it tests instead whether the pass's reviewer may start without `CLAUDE.md`, or under the Bash output ceiling build-release hands the worker, or a Read limit it doesn't hand yet: it replays each round three times as archived and once with the change, and prints whether the reviewer passes: whether the last replay missed no more findings than the most an unchanged replay missed, with each count and each finding it missed. Each replayed reviewer skips every permission prompt, stability-reviewer has Bash, and an archived prompt may name paths on the host. - `rule-hook [overrides]` blocks a tool call that breaks a rule a program can check, unless the call overrides the rule; `settings.json` β†’ `hooks` runs it before each Agent, Bash, Edit, Grep, Monitor, MultiEdit, Read, Skill and Write call, and `rule-hook --help` states the rules and the override. - `run-heavy <command>` runs a heavy command once it holds one of the machine's heavy slots, one per 4 CPUs, which every session shares; `run-heavy --help` states the slots, and the memory cap it gives a container that sets no limit. - `run-tests [<pytest args>...]` runs this repo's test suite, as Test says. @@ -267,12 +267,12 @@ loop-claude, do-epic and `task-bench gather` put the release's tools first on th #### Driving chunks -- `agent_cycle/` runs one cycle (`run.py`): a headless claude worker, then the judge of its transcript. It also holds the interrupt, the tmux window and the routing of the worker's rung. The entry point that runs the cycles supplies the prompts and file names of its own workflow (`worker_prompts.py`), and reads which items a worker took in. `loop_claude` and `do_epic` drive it; `agent_cycle` doesn't import either. -- `chunk_driver/` holds what the entry points share. An entry point is a tool that drives chunks through `agent_cycle`: `loop_claude` and `do_epic` are the two. They share how a cycle starts (`cycle_start.py`) and closes (`chunk_run.py`), the claim on a checkout before a chunk starts in it (`claims.py`), the prompts every worker gets (`prompts.py`), and a checkout's premises, records and saved models (`project/`). It imports neither entry point, and `repo_checks` fails any package that imports one of the two. `agent_cycle` is the layer below it, and `repo_checks` fails `agent_cycle` where it imports `chunk_driver`, tests included. +- `agent_cycle/` runs one cycle (`run.py`): a headless claude worker, then the judge of its transcript. It also holds the interrupt, the tmux window and the routing of the worker's rung. The entry point that runs the cycles supplies the prompts and file names of its own workflow (`worker_prompts.py`), and reads which items a worker took in. `build_release` and `do_epic` drive it; `agent_cycle` doesn't import either. +- `chunk_driver/` holds what the entry points share. An entry point is a tool that drives chunks through `agent_cycle`: `build_release` and `do_epic` are the two. They share how a cycle starts (`cycle_start.py`) and closes (`chunk_run.py`), the claim on a checkout before a chunk starts in it (`claims.py`), the prompts every worker gets (`prompts.py`), and a checkout's premises, records and saved models (`project/`). It imports neither entry point, and `repo_checks` fails any package that imports one of the two. `agent_cycle` is the layer below it, and `repo_checks` fails `agent_cycle` where it imports `chunk_driver`, tests included. - `do_epic/` holds `do-epic`, the tool that drives one Jira epic: - `main.py` starts the epic's chunks and runs one chunk's cycles in its window, through `agent_cycle`. `epic_run.py` holds what stays the same through one run of do-epic, such as its config, its Jira store and its paths, and starts the chunks that may start now. - `planning.py` settles, before the chunks start, where each open issue is worked, its scores and the order the issues start in, through `split.py`, `repo_pick.py`, `issue_scores.py` and `ranking.py`. - - `scheduler.py` says which issues run now: as many as the epic's cap and each repo's `parallel-chunks` allow, and none in a repo where loop-claude runs chunks. + - `scheduler.py` says which issues run now: as many as the epic's cap and each repo's `parallel-chunks` allow, and none in a repo where build-release runs chunks. - `gates.py` reads once whether a chunk's pull request waits on its checks, an approval or a new review, and `parked.py` keeps each chunk that does in a state file, so it takes no running slot while it waits and goes on waiting after a reboot. `parking.py` parks such a chunk after a cycle and polls the gate until its worker has something to do, or until its pull request merged, when it removes the worktree with `chunk-pr clean` and finishes the chunk itself. - `chunk_prompt.py` words what a chunk's worker reads. Through `findings.py` that worker files a finding as an issue of the epic, with `--file`, and appends a decision to its description, with `--record-decision`. - `finish.py` ends an epic that holds no open issue: its finishing chunk files a release review of each repo the epic changed, has the human confirm each goal, and with `--close-epic` posts the summary on the epic and closes it. @@ -284,20 +284,20 @@ loop-claude, do-epic and `task-bench gather` put the release's tools first on th - `ranking.py` orders an epic's items by score over one chain of goals, the epic's, then code health, then the item's repo's, through `plan`'s ranking, and re-ranks the tracker's backlog to that order through `backend/`. - `backend/` reads, files and ranks the epic's issues, adds the labels `repo_pick.py` and `split.py` record, posts comments, moves a finished chunk's issue to done, and closes the epic. - `e2e/` holds `do-epic-e2e`. -- `loop_claude` runs `chunk-preflight` as a process of its own. -- `loop_effects/` holds `Effects`: the processes, terminal, clock and git a tool reaches, injected so its tests can script them. loop-claude, do-epic, both replay tools and `reviewer-merge-trials`' driver use it. +- `build_release` runs `chunk-preflight` as a process of its own. +- `loop_effects/` holds `Effects`: the processes, terminal, clock and git a tool reaches, injected so its tests can script them. build-release, do-epic, both replay tools and `reviewer-merge-trials`' driver use it. - `loop_state/` holds `paths.py`, the one module under `bin/` that resolves the setup's folders: the release root, which is the folder the running code ships in, the Claude home, the config folder and the state folder. `repo_checks` fails another module under `bin/`, tests aside, that names one as a quoted path part, such as `".claude"`, or finds the release root from `__file__`. -- `model_routing/` holds the shipped routing ladder (`routing-ladder.json`) and its steps (`ladder.py`), and reads a ladder from that file or a project's own (`ladder_file.py`), for loop-claude, `rule_hook`, `do_epic`, both replay tools and `subagent-rung`. It finds a project's config folder through `project_config`. It also holds the list prices, which `routing_figures` and `transcript_archive` read. -- `notifier/` sends the human a DM through the notifier a project's config names, for `notify` and for loop-claude through `loop_effects`. Its backends are `mattermost.py` and `slack.py`. -- `transcript_archive/` stores loop-claude's transcripts. Its `project_key.py` names each project's archive folder, loop-claude session and models-file entry. +- `model_routing/` holds the shipped routing ladder (`routing-ladder.json`) and its steps (`ladder.py`), and reads a ladder from that file or a project's own (`ladder_file.py`), for build-release, `rule_hook`, `do_epic`, both replay tools and `subagent-rung`. It finds a project's config folder through `project_config`. It also holds the list prices, which `routing_figures` and `transcript_archive` read. +- `notifier/` sends the human a DM through the notifier a project's config names, for `notify` and for build-release through `loop_effects`. Its backends are `mattermost.py` and `slack.py`. +- `transcript_archive/` stores build-release's transcripts. Its `project_key.py` names each project's archive folder, build-release session and models-file entry. #### The plan, the records and releases - `deploy_release` imports `release_plan`'s `release_standing`. -- `plan/` is the plan's core, and imports neither `plan_store` nor `release_plan`. It holds an item and the items table's format (`todo_table.py`), releases (`release.py`), the ranking (`ranking.py`, with its score formula in `formula.py` and its blocker order in `blockers.py`), the paths an item's text names (`named_paths.py`), an item's `Touches:` prediction and where two overlap (`touches.py`), and `citations.py`, which holds `todo.md` and `docs/decisions.md` to each other. `goals_file.py` reads the goals file's sections, goals and goal weights, for the ranking and for `loop_claude`'s premises. +- `plan/` is the plan's core, and imports neither `plan_store` nor `release_plan`. It holds an item and the items table's format (`todo_table.py`), releases (`release.py`), the ranking (`ranking.py`, with its score formula in `formula.py` and its blocker order in `blockers.py`), the paths an item's text names (`named_paths.py`), an item's `Touches:` prediction and where two overlap (`touches.py`), and `citations.py`, which holds `todo.md` and `docs/decisions.md` to each other. `goals_file.py` reads the goals file's sections, goals and goal weights, for the ranking and for `build_release`'s premises. - `plan_store/` reads and writes a project's plan through the store the project's config names (`stores.py`). Every backend meets `plans.py`'s `PlanStore`: a markdown file (`todo_md.py`, which also ranks and checks the file in place, with its text edits in `markdown_edits.py`) or a Jira epic (`jira_epic.py`). `scoring.py` reads the goal weights that both backends rank by. `contract.py` holds the tests every backend that writes must pass; `jira_epic.py` doesn't yet, and its own tests stand in for Jira. `fakes.py` holds a plan in memory. - `record_store/` reads and writes a project's records, each through the store the project's config names (`stores.py`): a markdown file, a Confluence Cloud page (`confluence_page.py`), or, for the goals, a Jira epic's description (`jira_description.py`). `contract.py` holds the tests every backend must pass, and `fakes.py` a store in memory that the tests of other tools use. -- `release_plan/` says which release is next and whether it is ready to cut (`release_standing.py`), from the plan, the changelog and the tags, picks the item the next chunk takes first (`next_chunk.py`), and marks each item that a ready pull request finishes (`awaiting_merge.py`), for `chunk_preflight` and `loop_claude`. +- `release_plan/` says which release is next and whether it is ready to cut (`release_standing.py`), from the plan, the changelog and the tags, picks the item the next chunk takes first (`next_chunk.py`), and marks each item that a ready pull request finishes (`awaiting_merge.py`), for `chunk_preflight` and `build_release`. - `review_rules/` holds the larv-review rules that several tools apply: its passes, its review folder, its round commit titles and the comprehension history's format. #### Git, forges and Atlassian @@ -312,14 +312,14 @@ loop-claude, do-epic and `task-bench gather` put the release's tools first on th - `branch_chunks/` cuts a default branch into chunks and finds, for each, the items it shipped and the later chunks that fixed its code, for `score_outcomes`, `routing_figures` and `task_bench`. It imports `reading_cost`'s record path. - `judge_replay` imports `agent_cycle`'s judge and verdicts, and `chunk_driver`'s premises, records and `ANSWER_DESTINATIONS`. -- `routing_figures/` measures loop-claude's archive, and each of its projects' default branches, for loop-claude's routing calls. -- `rung_replay/` holds what `judge_replay` and `review_replay` share: the parallel replay runner, the argument reader, the candidate rungs and the exits, and `judge_replay`'s rung search. It reads `agent_cycle`'s retry count and `chunk_driver`'s models file, and finds that file through `loop_state`'s paths. Its `archive.py` keeps each replay's runs and its report in a `replays/` folder of loop-claude's archive. +- `routing_figures/` measures build-release's archive, and each of its projects' default branches, for build-release's routing calls. +- `rung_replay/` holds what `judge_replay` and `review_replay` share: the parallel replay runner, the argument reader, the candidate rungs and the exits, and `judge_replay`'s rung search. It reads `agent_cycle`'s retry count and `chunk_driver`'s models file, and finds that file through `loop_state`'s paths. Its `archive.py` keeps each replay's runs and its report in a `replays/` folder of build-release's archive. - `task_bench/` holds `task-bench`, which has Haiku fix, build or add a task in containers: a bug planted in a project's Go, PHP, Python, Rust, TypeScript and JavaScript files (`bugs/`), or one of the project's bench features, its data sources or the features its history shipped (`features/`). `figures/` measures the runs and holds `task-bench gather`. `task_bench` imports three things from `mutate_changes`: the rule for which files are tests (`changed_lines.is_test`), the runners of the mutation tools, and the process runner (`tool_process`). #### The shell, the machine and text - `command_lines/` reads a shell command: its simple commands, and a docker call's subcommand and memory limits, for `command_patterns`, `reading_cost`, `routing_figures`, `rule_hook` and `run_heavy`. -- `machine_load/` takes the machine's heavy slots, its shared lock files, for `run_heavy` and `adf_codec`, and reads the memory share that loop-claude waits for. It also gives `mutate_changes` a slot's CPU count. +- `machine_load/` takes the machine's heavy slots, its shared lock files, for `run_heavy` and `adf_codec`, and reads the memory share that build-release waits for. It also gives `mutate_changes` a slot's CPU count. - `text_files/` reads a Markdown file's `##` sections, quotes a passage and joins names into a list, reads the text piped into a command, stamps times in UTC, replaces a file in one step, private where it is new, and gzips a file beside its plain name, by which it reads it afterwards. #### Tests and tools of one file diff --git a/bin/agent_cycle/__init__.py b/bin/agent_cycle/__init__.py index 72819dd8..c4de3f59 100644 --- a/bin/agent_cycle/__init__.py +++ b/bin/agent_cycle/__init__.py @@ -1,4 +1,4 @@ -"""One cycle of a headless claude worker and the judge of its transcript, for every entry point that drives such cycles: loop-claude and do-epic (docs/decisions.md β†’ `do-epic: drives one Jira epic …`). +"""One cycle of a headless claude worker and the judge of its transcript, for every entry point that drives such cycles: build-release and do-epic (docs/decisions.md β†’ `do-epic: drives one Jira epic …`). run.py runs a cycle through the states in states.py: worker.py runs the worker, judge.py rules on its transcript, interrupt.py puts a question to the human in the tmux window tmux.py names, and routing.py picks the rung the worker runs on next. An entry point hands the cycle what is its own: its prompts and file names (worker_prompts.py) and how it reads the plan items a worker took in (run.py's Cycle.taken_in). What two entry points share beyond the cycle lives in bin/chunk_driver/. No module here imports an entry point's package, and bin/repo_checks/test_package_cycles.py fails on such an import. A reader finds a module by its name, so the modules stay at one level. docs/decisions.md β†’ `principles: about seven things per level, …` allows that. """ diff --git a/bin/agent_cycle/escalation_mark.py b/bin/agent_cycle/escalation_mark.py index 2e82e48b..74e2560b 100644 --- a/bin/agent_cycle/escalation_mark.py +++ b/bin/agent_cycle/escalation_mark.py @@ -1,6 +1,6 @@ """The escalation mark makes one escalation trigger step the worker up one rung, never two (docs/decisions.md β†’ `routing: a worker whose run ends asking for a higher rung`). -A worker whose run ends asking its driver, such as loop-claude, for a higher rung cites the trigger that fired, and the judge quotes the passage where it fired as the verdict's escalation. The mark, Route.escalated_at, is how many transcript entries the session held when an escalation last stepped the worker up, 0 before any. The session's transcript only grows, so the mark holds across cycles, and the archive's Worker: lines keep it for a rerun. +A worker whose run ends asking its driver, such as build-release, for a higher rung cites the trigger that fired, and the judge quotes the passage where it fired as the verdict's escalation. The mark, Route.escalated_at, is how many transcript entries the session held when an escalation last stepped the worker up, 0 before any. The session's transcript only grows, so the mark holds across cycles, and the archive's Worker: lines keep it for a rerun. - Stamp. stamped() writes on the judge's verdict how many entries the judge read. - Step. routing.next_route() steps the worker up on an escalation and moves the mark to moved_to(verdict). diff --git a/bin/agent_cycle/hand_over.py b/bin/agent_cycle/hand_over.py index a62c64d4..be295a77 100644 --- a/bin/agent_cycle/hand_over.py +++ b/bin/agent_cycle/hand_over.py @@ -19,7 +19,7 @@ def claude_args(rung: Rung, args: list[str]) -> list[str]: # CLAUDE_CODE_SANDBOXED, which Claude Code doesn't document, skips its trust dialog without writing ~/.claude.json: -# docs/decisions.md β†’ `loop-claude: every claude it opens on a terminal has CLAUDE_CODE_SANDBOXED set`. +# docs/decisions.md β†’ `build-release: every claude it opens on a terminal has CLAUDE_CODE_SANDBOXED set`. def hand_over(command: ClaudeCommand, effects: Effects) -> Failure | None: """Runs claude on the terminal as command says, with CLAUDE_CODE_SANDBOXED=1 added to its environment; the failure is why claude could not start.""" try: diff --git a/bin/agent_cycle/judge.py b/bin/agent_cycle/judge.py index aee45ad6..8e57e4ed 100644 --- a/bin/agent_cycle/judge.py +++ b/bin/agent_cycle/judge.py @@ -96,9 +96,9 @@ class Reply: answered_before: str = dataclasses.field(metadata={"description": "With interrupt true, a [human] line from earlier in the chunk that answered the question the worker asks now, quoted verbatim, without elisions. Empty otherwise."}) left_open: str = dataclasses.field(metadata={"description": "With answered_before set, the words of that line that leave open what the question asks, quoted verbatim; the question ends with them. Empty otherwise."}) question: str = dataclasses.field(metadata={"description": "With interrupt true, the single question to put to the human. With a quoted answer, the worker's question that the answer field answers. Empty otherwise."}) - # True opens claude's session at once, in place of the one-line answer (run.ask). The judge decides it, since loop-claude computes the plan's standing (release_standing.chunk_item) only when it routes a chunk on the ladder afresh: it would miss a release ready to cut in a resumed chunk or off the ladder. A wrong ruling costs the human one typed /talk, or answering in claude, which stops the loop if they leave it without typing anything. + # True opens claude's session at once, in place of the one-line answer (run.ask). The judge decides it, since build-release computes the plan's standing (release_standing.chunk_item) only when it routes a chunk on the ladder afresh: it would miss a release ready to cut in a resumed chunk or off the ladder. A wrong ruling costs the human one typed /talk, or answering in claude, which stops the loop if they leave it without typing anything. release_ready: bool = dataclasses.field(metadata={"description": "With interrupt true, whether the question is about a release ready to cut, which only the human may publish. False otherwise."}) - # Finds the answer that reverses a choice the worker took on its own recommendation. score-outcomes counts these answers per chunk: they are the counter-signal the 2026-11-08 entry of docs/decisions.md β†’ `loop-claude: a judge decides each interrupt and each quoted answer…` stays valid by. + # Finds the answer that reverses a choice the worker took on its own recommendation. score-outcomes counts these answers per chunk: they are the counter-signal the 2026-11-08 entry of docs/decisions.md β†’ `build-release: a judge decides each interrupt and each quoted answer…` stays valid by. reversed: str = dataclasses.field(metadata={"description": "The latest [human] line that overrides a choice the worker took on its own recommendation and recorded with its reason, quoted verbatim, without elisions. Empty where none does; a line that answers a question the worker left open doesn't override anything."}) @@ -119,7 +119,7 @@ def judge_schema(driver: str) -> dict[str, typing.Any]: @dataclasses.dataclass(frozen=True) class Rejected(Failure): - """A judge reply loop-claude rejected: reason says why, run holds the prompt and the reply, and cost is what the run cost in dollars, 0 where its reply records none.""" + """A judge reply build-release rejected: reason says why, run holds the prompt and the reply, and cost is what the run cost in dollars, 0 where its reply records none.""" run: JudgeRun cost: float = 0.0 diff --git a/bin/agent_cycle/routing.py b/bin/agent_cycle/routing.py index 95a15a6a..ec630b83 100644 --- a/bin/agent_cycle/routing.py +++ b/bin/agent_cycle/routing.py @@ -2,7 +2,7 @@ The worker, and the session /talk opens, run on a Route (model_routing/route.py). A model off the ladder gets a route without an item, and it is never stepped. -- Start. The entry point finds the plan item that routes a fresh chunk, as loop_claude/routed_item.py does; first_route picks the worker's rung from its L, or the project's rung without an item. +- Start. The entry point finds the plan item that routes a fresh chunk, as build_release/routed_item.py does; first_route picks the worker's rung from its L, or the project's rung without an item. - Rerun. kept decides whether a rerun resumes the route its archive last names. - Step-up. next_route raises the route after an unfinished verdict (unfinished_route), or an interrupt or a quoted answer that carries an escalation (escalated_route); escalation_cap bounds an escalation, and agent_cycle/escalation_mark.py states the escalation mark's rule. step_up names the change where it changes the worker line, which the archive records. - Judge. judge_rung picks the rung of the judge of a JUDGE_REPLAYED model. @@ -43,7 +43,7 @@ JUDGE_REPLAYED = ("claude-opus-5-5",) class Scored(typing.Protocol): - """What routes a chunk: a plan item under loop-claude, an epic's issue under do-epic.""" + """What routes a chunk: a plan item under build-release, an epic's issue under do-epic.""" @property def id(self) -> int: """The number a Route keeps as its item.""" diff --git a/bin/agent_cycle/run.py b/bin/agent_cycle/run.py index 037ffb58..e275459a 100644 --- a/bin/agent_cycle/run.py +++ b/bin/agent_cycle/run.py @@ -208,7 +208,7 @@ def ruling_outcome(cycle: Cycle, ruling: Interrupt | QuotedAnswer, quoted_answer def keep_rejection(cycle: Cycle, transcript_path: str, rejected: Rejected) -> Stop | None: - """Archives a judge reply loop-claude rejected, so the archive shows what the judge returned before a retry or an exit 1.""" + """Archives a judge reply build-release rejected, so the archive shows what the judge returned before a retry or an exit 1.""" if unkept := archived(cycle.project_archive, transcript_path, cycle.task, outcomes.rejected(rejected.reason, rejected.reply, str(cycle.judge), judge_cost=rejected.cost, judge_run=rejected.run), cycle.effects, rejected.run): return Stop(1, unkept.reason) return None diff --git a/bin/agent_cycle/spend.py b/bin/agent_cycle/spend.py index 805d2546..ee811c22 100644 --- a/bin/agent_cycle/spend.py +++ b/bin/agent_cycle/spend.py @@ -1,4 +1,4 @@ -"""What a stretch of the chunk's work spent, in raw tokens by model and kind, which the archive records beside each verdict, interrupt and quoted answer: docs/decisions.md β†’ `loop-claude: each verdict records the claude-config release and commit that ran it…`. +"""What a stretch of the chunk's work spent, in raw tokens by model and kind, which the archive records beside each verdict, interrupt and quoted answer: docs/decisions.md β†’ `build-release: each verdict records the claude-config release and commit that ran it…`. A stretch runs from the previous outcome that recorded a spend, or from the chunk's start, to the ruling. It counts the worker's main thread, each subagent and the judge run that ruled, each message once. Dollars are left to be derived from the model and the tokens, at the prices recorded beside them. """ diff --git a/bin/agent_cycle/states.py b/bin/agent_cycle/states.py index 4979c933..a6104b8c 100644 --- a/bin/agent_cycle/states.py +++ b/bin/agent_cycle/states.py @@ -10,7 +10,7 @@ QUOTED_ANSWERS_PER_CYCLE = 3 @dataclasses.dataclass(frozen=True) class TypedAnswer: - """The human's answer to an interrupt, typed at loop-claude's terminal.""" + """The human's answer to an interrupt, typed at build-release's terminal.""" question: str answer: str diff --git a/bin/agent_cycle/test_interrupt.py b/bin/agent_cycle/test_interrupt.py index ebc42344..5c7393c9 100644 --- a/bin/agent_cycle/test_interrupt.py +++ b/bin/agent_cycle/test_interrupt.py @@ -30,12 +30,12 @@ class Interrupts(unittest.TestCase): self.paths = paths.paths_from(self.home) self.transcript = self.home / "t.jsonl" self.transcript.write_text(json.dumps(human("a")) + "\n") - self.session = interrupt.WorkerSession(str(self.home), uuid.uuid7(), Rung("m", "high"), Rung("m", "high"), str(self.transcript), {"LOOP_CLAUDE_WORKER_RUNG": "m at high effort"}) + self.session = interrupt.WorkerSession(str(self.home), uuid.uuid7(), Rung("m", "high"), Rung("m", "high"), str(self.transcript), {"BUILD_RELEASE_WORKER_RUNG": "m at high effort"}) def put(self, fake, answer_here=True, effects=None, question="Which one?"): """interrupt's answer and what it said, without the bell it rang, which self.bells counts.""" with contextlib.redirect_stderr(io.StringIO()) as said: - answer = interrupt.interrupt(question, answer_here, self.session, WINDOW, "loop-claude", effects or fake.effects()) + answer = interrupt.interrupt(question, answer_here, self.session, WINDOW, "build-release", effects or fake.effects()) self.bells = said.getvalue().count(tmux.BELL) return answer, said.getvalue().replace(tmux.BELL, "") @@ -162,7 +162,7 @@ class Interrupts(unittest.TestCase): def test_stops_off_a_terminal_before_asking(self): fake = FakeEffects(on_terminal=False) - self.assertEqual(self.put(fake), (Stop(2, "the human is needed to answer the question above, but stdin or stdout is not a terminal; rerun loop-claude on a terminal"), f"\n{STAMP} Which one?\n")) + self.assertEqual(self.put(fake), (Stop(2, "the human is needed to answer the question above, but stdin or stdout is not a terminal; rerun build-release on a terminal"), f"\n{STAMP} Which one?\n")) self.assertEqual(fake.calls, []) def test_dms_the_question_naming_the_project_on_a_terminal_or_off_one(self): @@ -170,7 +170,7 @@ class Interrupts(unittest.TestCase): with self.subTest(on_terminal=on_terminal): fake = FakeEffects(inputs=["Use B."], on_terminal=on_terminal) self.put(fake) - self.assertEqual(fake.dms, [f"loop-claude in {self.home} asks, in the tmux window loop-proj:item-7:\n\nWhich one?"]) + self.assertEqual(fake.dms, [f"build-release in {self.home} asks, in the tmux window loop-proj:item-7:\n\nWhich one?"]) def test_marks_its_window_and_rings_the_bell_while_it_waits_and_clears_the_mark_once_answered(self): fake = FakeEffects(inputs=["Use B."]) @@ -222,7 +222,7 @@ class Interrupts(unittest.TestCase): def test_hands_the_claude_that_takes_the_terminal_the_workers_environment(self): fake = FakeEffects(inputs=["/talk"], on_terminal_claude=[0]) self.put(fake) - self.assertEqual(fake.terminal_environments, [{"LOOP_CLAUDE_WORKER_RUNG": "m at high effort", "CLAUDE_CODE_SANDBOXED": "1"}]) + self.assertEqual(fake.terminal_environments, [{"BUILD_RELEASE_WORKER_RUNG": "m at high effort", "CLAUDE_CODE_SANDBOXED": "1"}]) if __name__ == "__main__": diff --git a/bin/agent_cycle/test_judge.py b/bin/agent_cycle/test_judge.py index e49d8e24..7c3a093f 100644 --- a/bin/agent_cycle/test_judge.py +++ b/bin/agent_cycle/test_judge.py @@ -107,27 +107,27 @@ class Verdict(unittest.TestCase): def test_drops_an_escalation_quote_found_only_in_the_transcript_entries_before_the_workers_last_step_up(self): entries = [assistant({"type": "text", "text": "round 2: πŸ”΄"}), assistant({"type": "text", "text": "round 3: πŸ”΄"}), assistant({"type": "text", "text": "working"})] def judged_on(mark, escalation): - return judge.judge_once("/r", judge.Brief("Do it.", "## Goals", "", "the project's decisions", "the plan or a comment", kinds(*entries), mark, "loop-claude"), Rung("judge-model"), FakeEffects(claude=[judged("unfinished", escalation=escalation)]).effects()) + return judge.judge_once("/r", judge.Brief("Do it.", "## Goals", "", "the project's decisions", "the plan or a comment", kinds(*entries), mark, "build-release"), Rung("judge-model"), FakeEffects(claude=[judged("unfinished", escalation=escalation)]).effects()) self.assertEqual(judged_on(0, "round 2: πŸ”΄"), Unfinished("working", "round 2: πŸ”΄", entries_read=3)) self.assertEqual(judged_on(1, "round 2: πŸ”΄"), Unfinished("working", entries_read=3)) self.assertEqual(judged_on(1, "round 3: πŸ”΄"), Unfinished("working", "round 3: πŸ”΄", entries_read=3)) self.assertEqual(judged_on(1, "round 2: πŸ”΄\n\nround 3: πŸ”΄"), Unfinished("working", entries_read=3)) self.assertEqual(judged_on(3, "round 3: πŸ”΄"), Unfinished("working", entries_read=3)) - def test_drops_an_escalation_quote_that_only_loop_claudes_prompts_or_the_humans_lines_repeat_after_the_step_up(self): + def test_drops_an_escalation_quote_that_only_build_releases_prompts_or_the_humans_lines_repeat_after_the_step_up(self): entries = [assistant({"type": "text", "text": "round 2: πŸ”΄"}), {**human("as the work remaining: round 2: πŸ”΄"), "promptSource": "sdk"}, human("round 2: πŸ”΄ again"), assistant({"type": "text", "text": "working"})] - verdict = judge.judge_once("/r", judge.Brief("Do it.", "## Goals", "", "the project's decisions", "the plan or a comment", kinds(*entries), 1, "loop-claude"), Rung("judge-model"), FakeEffects(claude=[judged("unfinished", escalation="round 2: πŸ”΄")]).effects()) + verdict = judge.judge_once("/r", judge.Brief("Do it.", "## Goals", "", "the project's decisions", "the plan or a comment", kinds(*entries), 1, "build-release"), Rung("judge-model"), FakeEffects(claude=[judged("unfinished", escalation="round 2: πŸ”΄")]).effects()) self.assertEqual(verdict, Unfinished("working", entries_read=4)) def test_takes_evidence_from_before_the_workers_last_step_up(self): entries = [assistant({"type": "text", "text": "round 2: πŸ”΄"}), assistant({"type": "text", "text": "working"})] - verdict = judge.judge_once("/r", judge.Brief("Do it.", "## Goals", "", "the project's decisions", "the plan or a comment", kinds(*entries), 1, "loop-claude"), Rung("judge-model"), FakeEffects(claude=[judged("unfinished", evidence="round 2: πŸ”΄")]).effects()) + verdict = judge.judge_once("/r", judge.Brief("Do it.", "## Goals", "", "the project's decisions", "the plan or a comment", kinds(*entries), 1, "build-release"), Rung("judge-model"), FakeEffects(claude=[judged("unfinished", evidence="round 2: πŸ”΄")]).effects()) self.assertEqual(verdict, Unfinished("round 2: πŸ”΄", entries_read=2)) def test_takes_the_task_as_evidence_where_the_tail_it_shows_cuts_off_the_workers_first_prompt_but_no_quote_across_the_join(self): entries = [human("Do the next chunk. " + "x" * judge.JUDGE_PROMPT_CHARS), assistant({"type": "text", "text": "Merged."})] def judged_on(evidence): - return judge.judge_once("/r", judge.Brief("Do the next chunk.", "## Goals", "", "the project's decisions", "the plan or a comment", kinds(*entries), 0, "loop-claude"), Rung("judge-model"), FakeEffects(claude=[judged("unfinished", evidence=evidence)] * 3).effects()) + return judge.judge_once("/r", judge.Brief("Do the next chunk.", "## Goals", "", "the project's decisions", "the plan or a comment", kinds(*entries), 0, "build-release"), Rung("judge-model"), FakeEffects(claude=[judged("unfinished", evidence=evidence)] * 3).effects()) self.assertEqual(judged_on("Do the next chunk."), Unfinished("Do the next chunk.", entries_read=2)) self.assertEqual(judged_on("Do the next chunk. ... Merged."), Unfinished("Do the next chunk. ... Merged.", entries_read=2)) self.assertIsInstance(judged_on("Do the next release."), Failure) diff --git a/bin/agent_cycle/test_run.py b/bin/agent_cycle/test_run.py index 1c5267b2..f16c578d 100644 --- a/bin/agent_cycle/test_run.py +++ b/bin/agent_cycle/test_run.py @@ -130,7 +130,7 @@ Worker: {OFF_LADDER} fake = FakeEffects(streams=[Worker(self.paths.claude_code_transcripts.parent)], claude=[judged("finished")]) cycle = dataclasses.replace(self.cycle(fake), project=OPUS_PROJECT, route=Route(Rung("claude-haiku-5-5", "max"), 163, 1, 5)) self.assertEqual(run.run_cycle(cycle).verdict, Finished("working")) - self.assertEqual(fake.worker_environments, [{"LOOP_CLAUDE_PROJECT_RUNG": "claude-opus-5-5 at medium effort", "LOOP_CLAUDE_WORKER_RUNG": "claude-haiku-5-5 at max effort", "LOOP_CLAUDE_ESCAPE_AND_IMPACT": "5", "CLAUDE_CODE_AUTO_COMPACT_WINDOW": "200000", "BASH_MAX_OUTPUT_LENGTH": "6000"}]) + self.assertEqual(fake.worker_environments, [{"BUILD_RELEASE_PROJECT_RUNG": "claude-opus-5-5 at medium effort", "BUILD_RELEASE_WORKER_RUNG": "claude-haiku-5-5 at max effort", "BUILD_RELEASE_ESCAPE_AND_IMPACT": "5", "CLAUDE_CODE_AUTO_COMPACT_WINDOW": "200000", "BASH_MAX_OUTPUT_LENGTH": "6000"}]) def test_a_stuck_check_of_the_worker_runs_on_the_projects_rung_and_off_the_ladder_on_the_workers_own(self): for project, model in ((OPUS_PROJECT, "claude-opus-5-5"), (None, "claude-haiku-5-5")): @@ -159,7 +159,7 @@ Worker: {OFF_LADDER} with contextlib.redirect_stderr(io.StringIO()): self.assertEqual(run.run_cycle(cycle).verdict, Finished("working")) self.assertEqual(fake.terminal_environments, [{**environment, "CLAUDE_CODE_SANDBOXED": "1"} for environment in fake.worker_environments]) - self.assertEqual(fake.terminal_environments[0]["LOOP_CLAUDE_WORKER_RUNG"], "claude-haiku-5-5 at max effort") + self.assertEqual(fake.terminal_environments[0]["BUILD_RELEASE_WORKER_RUNG"], "claude-haiku-5-5 at max effort") def test_an_unfinished_chunks_transcript_is_archived_and_the_next_cycle_resumes_its_session_with_the_judges_evidence(self): fake = FakeEffects(streams=[Worker(self.paths.claude_code_transcripts.parent)] * 2, claude=[judged("unfinished")] * 2) diff --git a/bin/agent_cycle/test_tmux.py b/bin/agent_cycle/test_tmux.py index 23fea0ef..66ec2ac0 100644 --- a/bin/agent_cycle/test_tmux.py +++ b/bin/agent_cycle/test_tmux.py @@ -14,12 +14,12 @@ from agent_cycle.doubles import WINDOW class TmuxCommands(unittest.TestCase): def test_refuses_a_tmux_older_than_needed_naming_both_versions(self): for found, reason in (("tmux 3.2", None), ("tmux 3.8", None), ("tmux next-3.4", None), ("tmux 10.0", None), - ("tmux 3.1c", "loop-claude runs each chunk in a tmux window, and needs tmux 3.2 or later; it found tmux 3.1c"), - ("tmux 2.9a", "loop-claude runs each chunk in a tmux window, and needs tmux 3.2 or later; it found tmux 2.9a"), - ("", "loop-claude runs each chunk in a tmux window, and needs tmux 3.2 or later; it found no tmux")): + ("tmux 3.1c", "build-release runs each chunk in a tmux window, and needs tmux 3.2 or later; it found tmux 3.1c"), + ("tmux 2.9a", "build-release runs each chunk in a tmux window, and needs tmux 3.2 or later; it found tmux 2.9a"), + ("", "build-release runs each chunk in a tmux window, and needs tmux 3.2 or later; it found no tmux")): with self.subTest(found=found): fake = FakeEffects(tmux_version=found) - self.assertEqual(tmux.unusable(fake.tmux, "loop-claude"), reason) + self.assertEqual(tmux.unusable(fake.tmux, "build-release"), reason) self.assertEqual(fake.tmux_calls, [["-V"]]) def test_names_the_session_for_the_project(self): @@ -39,14 +39,14 @@ class TmuxCommands(unittest.TestCase): def test_the_first_window_makes_the_session_and_each_later_one_joins_it(self): fake = FakeEffects() window = tmux.Window("loop-proj", "item-7", "") - self.assertIsNone(tmux.start_window(window, "/r", {"LOOP_CLAUDE_X": "1"}, ["/b/loop-claude", "--chunk", "item-7", "ship it;"], True, True, fake.tmux)) - self.assertIsNone(tmux.start_window(window, "/r", {}, ["/b/loop-claude"], False, True, fake.tmux)) + self.assertIsNone(tmux.start_window(window, "/r", {"BUILD_RELEASE_X": "1"}, ["/b/build-release", "--chunk", "item-7", "ship it;"], True, True, fake.tmux)) + self.assertIsNone(tmux.start_window(window, "/r", {}, ["/b/build-release"], False, True, fake.tmux)) self.assertEqual(fake.tmux_calls, [ - ["new-session", "-d", "-s", "loop-proj", "-n", "item-7", "-c", "/r", "-e", "LOOP_CLAUDE_X=1", "-P", "-F", "#{window_id}", "--", "/b/loop-claude", "--chunk", "item-7", "ship it\;"], + ["new-session", "-d", "-s", "loop-proj", "-n", "item-7", "-c", "/r", "-e", "BUILD_RELEASE_X=1", "-P", "-F", "#{window_id}", "--", "/b/build-release", "--chunk", "item-7", "ship it\;"], ["set-option", "-t", "=loop-proj:", "@loop-root", "/r"], ["set-option", "-w", "-t", "@9", "@chunk-root", "/r"], ["set-option", "-w", "-t", "@9", "remain-on-exit", "failed"], - ["new-window", "-d", "-t", "=loop-proj:", "-n", "item-7", "-c", "/r", "-P", "-F", "#{window_id}", "--", "/b/loop-claude"], + ["new-window", "-d", "-t", "=loop-proj:", "-n", "item-7", "-c", "/r", "-P", "-F", "#{window_id}", "--", "/b/build-release"], ["set-option", "-w", "-t", "@9", "@chunk-root", "/r"], ["set-option", "-w", "-t", "@9", "remain-on-exit", "failed"], ]) diff --git a/bin/agent_cycle/test_worker.py b/bin/agent_cycle/test_worker.py index c5d3cbc9..dd14895d 100644 --- a/bin/agent_cycle/test_worker.py +++ b/bin/agent_cycle/test_worker.py @@ -52,7 +52,7 @@ class LingeringWorkers(unittest.TestCase): RESULT = {"type": "result"} def worker_with(self, *events, held=()): - """Runs a worker whose claude prints events and holds shells `held`; returns the claude, what loop-claude said and the record's text.""" + """Runs a worker whose claude prints events and holds shells `held`; returns the claude, what build-release said and the record's text.""" clock = [NOW] streamed = Streamed(0, *events, clock=clock, held=held) fake = FakeEffects(streams=[streamed]) diff --git a/bin/agent_cycle/tmux.py b/bin/agent_cycle/tmux.py index 0af21917..d0360281 100644 --- a/bin/agent_cycle/tmux.py +++ b/bin/agent_cycle/tmux.py @@ -1,4 +1,4 @@ -"""The tmux commands an entry point runs: each chunk's loop runs in its own window of one tmux session, which loop-claude names for the project and do-epic for the epic (docs/decisions.md β†’ `loop-claude: each chunk runs in its own tmux window`).""" +"""The tmux commands an entry point runs: each chunk's loop runs in its own window of one tmux session, which build-release names for the project and do-epic for the epic (docs/decisions.md β†’ `build-release: each chunk runs in its own tmux window`).""" import dataclasses import re import subprocess @@ -16,12 +16,12 @@ WAITS = " ?" BELL = "\a" # What follows a window's name while its chunk is parked, before what its pull request waits on, as in `ABC-34 awaits an approval`. A parked chunk takes no running slot (docs/decisions.md β†’ `do-epic: drives one Jira epic …`, "Long gates"). PARKED = " awaits " -# What a session's name opens with: LOOP for a project's chunks under loop-claude, EPIC for an epic's chunks under do-epic. +# What a session's name opens with: LOOP for a project's chunks under build-release, EPIC for an epic's chunks under do-epic. LOOP = "loop" EPIC = "epic" # The session option that names the checkout whose chunks the session runs, since two checkouts' keys may map to one session name. OWNER = "@loop-root" -# The window option that names the folder a window's chunk works in, so that loop-claude and every do-epic see the chunks a do-epic runs in a checkout. +# The window option that names the folder a window's chunk works in, so that build-release and every do-epic see the chunks a do-epic runs in a checkout. ROOT = "@chunk-root" @@ -113,7 +113,7 @@ def start_window(window: Window, cwd: str, env: typing.Mapping[str, str], comman return Failure(f"tmux could not start the window {window.target}: {done.stderr.strip() or f'it exited {done.returncode}'}") # set-option and show-options read a target as a pane's, so `=session` alone names no session. marked = run(["set-option", "-t", f"={window.session}:", OWNER, cwd]) if first and owned else None - # A failure leaves the window unseen by loop-claude and by another epic's do-epic, which then may start a chunk beside it; the window still runs. + # A failure leaves the window unseen by build-release and by another epic's do-epic, which then may start a chunk beside it; the window still runs. run(["set-option", "-w", "-t", done.stdout.strip(), ROOT, cwd]) # By the ID, since a window of the same name may still be closing. A failed remain-on-exit doesn't matter: a loop that fails before it is set closes its window, and its stop is still sent as a DM. run(["set-option", "-w", "-t", done.stdout.strip(), "remain-on-exit", "failed"]) diff --git a/bin/agent_cycle/worker.py b/bin/agent_cycle/worker.py index 75527df8..80ed451e 100644 --- a/bin/agent_cycle/worker.py +++ b/bin/agent_cycle/worker.py @@ -14,7 +14,7 @@ from agent_cycle.stuck_workers import Watch PRINTED_TOOL_INPUT = 160 # Seconds between reads of the machine's memory while too little of it is available to start a worker. MEMORY_POLL = 60 -# The auto-compact window, in tokens, handed to the worker's claude in the environment variable AUTO_COMPACT_WINDOW names. Claude Code compacts before the window fills, at about 170k: docs/decisions.md β†’ `loop-claude: the worker's claude compacts its context before it fills a 200k window`. +# The auto-compact window, in tokens, handed to the worker's claude in the environment variable AUTO_COMPACT_WINDOW names. Claude Code compacts before the window fills, at about 170k: docs/decisions.md β†’ `build-release: the worker's claude compacts its context before it fills a 200k window`. AUTO_COMPACT_WINDOW = "CLAUDE_CODE_AUTO_COMPACT_WINDOW" COMPACT_WINDOW = 200_000 @@ -76,7 +76,7 @@ def worker_outcome(code: int, result: dict | None, resets: list[int]) -> Failure def worker_args(session: Session, worker: Rung, prompt: str, resume: bool) -> list[str]: - # --session-id creates the session under the id loop-claude keeps; --resume continues that session. + # --session-id creates the session under the id build-release keeps; --resume continues that session. start = ["--resume", str(session.id)] if resume else ["--name", session.name, "--session-id", str(session.id)] # -p fails without --verbose under stream-json. return [ diff --git a/bin/agent_cycle/worker_prompts.py b/bin/agent_cycle/worker_prompts.py index 9c070afb..9fd8d8eb 100644 --- a/bin/agent_cycle/worker_prompts.py +++ b/bin/agent_cycle/worker_prompts.py @@ -1,6 +1,6 @@ """A worker's prompts: those the entry point driving the cycle words, and those that resume a worker with an answer to its question. -An entry point is a tool that drives cycles, such as loop-claude. It words the prompts of its own workflow and names the files of its project. WorkerPrompts holds those, so the cycle doesn't import an entry point to word a prompt. +An entry point is a tool that drives cycles, such as build-release. It words the prompts of its own workflow and names the files of its project. WorkerPrompts holds those, so the cycle doesn't import an entry point to word a prompt. """ import dataclasses import re diff --git a/bin/loop-claude b/bin/build-release similarity index 91% rename from bin/loop-claude rename to bin/build-release index c9580a0f..7551c6b8 100755 --- a/bin/loop-claude +++ b/bin/build-release @@ -7,7 +7,7 @@ LAUNCHER = pathlib.Path(__file__).resolve() sys.path.insert(0, str(LAUNCHER.parent)) from loop_effects import effects -from loop_claude.loop import main +from build_release.loop import main from loop_state import paths sys.exit(main.main(sys.argv[1:], os.environ, paths.paths_from(pathlib.Path.home()), LAUNCHER, pathlib.Path.cwd(), effects.system_effects(pathlib.Path.home(), os.environ))) diff --git a/bin/build_release/__init__.py b/bin/build_release/__init__.py new file mode 100644 index 00000000..bf333883 --- /dev/null +++ b/bin/build_release/__init__.py @@ -0,0 +1,4 @@ +"""build-release: headless claude cycles, judged, that interrupt the human only for a decision that is theirs (loop/usage.py's help). + +Its packages hold one concern each: chunk/ words a fresh chunk's first prompt and reads the items a worker names, and loop/ runs the cycles. What it shares with do-epic lives in bin/chunk_driver/. build-release's paths live in bin/loop_state/, and its effects in bin/loop_effects/. The cycle itself, its judge, interrupts and routing live in bin/agent_cycle/, which doesn't import this package, so that a second entry point can drive it. routed_item.py, at this level, reads the plan for the item a chunk starts on. +""" diff --git a/bin/loop_claude/chunk/__init__.py b/bin/build_release/chunk/__init__.py similarity index 100% rename from bin/loop_claude/chunk/__init__.py rename to bin/build_release/chunk/__init__.py diff --git a/bin/loop_claude/chunk/chunk_items.py b/bin/build_release/chunk/chunk_items.py similarity index 91% rename from bin/loop_claude/chunk/chunk_items.py rename to bin/build_release/chunk/chunk_items.py index eb7520aa..cacfb357 100644 --- a/bin/loop_claude/chunk/chunk_items.py +++ b/bin/build_release/chunk/chunk_items.py @@ -1,4 +1,4 @@ -"""The plan items a chunk takes: those the worker names on its latest `Chunk items:` line, scored as the plan scores them (docs/decisions.md β†’ `routing: loop-claude reads the items a chunk takes`).""" +"""The plan items a chunk takes: those the worker names on its latest `Chunk items:` line, scored as the plan scores them (docs/decisions.md β†’ `routing: build-release reads the items a chunk takes`).""" import re from claude_code.entries import AssistantTurn, Entry, Text @@ -25,7 +25,7 @@ def taken_in(entries: list[Entry], plan: Plan | Failure) -> TakenIn: def named(entries: list[Entry]) -> tuple[int, ...]: - """The IDs on the worker's latest Chunk items: line, each once, in its order; empty where it wrote none. Only the worker's own text counts: a loop-claude prompt quotes the line's example, and a tool call may write the label into a file.""" + """The IDs on the worker's latest Chunk items: line, each once, in its order; empty where it wrote none. Only the worker's own text counts: a build-release prompt quotes the line's example, and a tool call may write the label into a file.""" lines = [line for entry in entries if isinstance(entry, AssistantTurn) for part in entry.parts if isinstance(part, Text) for line in part.text.splitlines()] for line in reversed(lines): if found := LINE.match(plain(line)): diff --git a/bin/loop_claude/chunk/fresh_prompt.py b/bin/build_release/chunk/fresh_prompt.py similarity index 75% rename from bin/loop_claude/chunk/fresh_prompt.py rename to bin/build_release/chunk/fresh_prompt.py index 5dd8b5d7..7807bfe5 100644 --- a/bin/loop_claude/chunk/fresh_prompt.py +++ b/bin/build_release/chunk/fresh_prompt.py @@ -1,15 +1,15 @@ -"""What loop-claude alone says to its worker: the first prompt of a chunk, with what chunk-preflight found. The resumed prompt and the rung sentences are chunk_driver.prompts', which do-epic's cycles use too.""" +"""What build-release alone says to its worker: the first prompt of a chunk, with what chunk-preflight found. The resumed prompt and the rung sentences are chunk_driver.prompts', which do-epic's cycles use too.""" import functools -from loop_claude.chunk.chunk_items import CHUNK_ITEMS -from chunk_driver.drivers import LOOP_CLAUDE +from build_release.chunk.chunk_items import CHUNK_ITEMS +from chunk_driver.drivers import BUILD_RELEASE from model_routing.ladder import ProjectRung from chunk_driver.prompts import READING_RULE, rung_sentences, worker_prompts from model_routing.route import Route -# loop-claude's name as its workers, its judge and the human read it. A function below that takes a driver words a sentence for any entry point, such as do-epic. -DRIVER = LOOP_CLAUDE -# chunk_items reads the latest such line; three fresh readers picked the label (docs/decisions.md β†’ `routing: loop-claude reads the items a chunk takes`). +# build-release's name as its workers, its judge and the human read it. A function below that takes a driver words a sentence for any entry point, such as do-epic. +DRIVER = BUILD_RELEASE +# chunk_items reads the latest such line; three fresh readers picked the label (docs/decisions.md β†’ `routing: build-release reads the items a chunk takes`). NAME_THE_ITEMS = f"Name every plan item this chunk takes on one line, as in `{CHUNK_ITEMS} 297 (L 3, E + I 5), 298 (L 3, E + I 7)`, and write the whole line again whenever the set changes." AFTER_CODE_HEALTH = 'which rank after code health (the setup\'s CLAUDE.md β†’ "Shared goal") unless the goals file voids it' @@ -36,7 +36,7 @@ def recount(route: Route) -> str: def preflight_facts(printed: str) -> str: """What chunk-preflight printed, for the worker to take as found.""" - return f"loop-claude ran `chunk-preflight` at the checkout root just before this run. Take what it printed as found rather than finding it again:\n\n{printed}" + return f"build-release ran `chunk-preflight` at the checkout root just before this run. Take what it printed as found rather than finding it again:\n\n{printed}" def held_by_others(items: list[int]) -> str: @@ -46,7 +46,7 @@ def held_by_others(items: list[int]) -> str: def preflight_failed(reason: str) -> str: """Has the worker find the facts chunk-preflight would have, its worktree among them.""" - return f"loop-claude could not run `chunk-preflight`, so find the chunk's facts yourself. Why it could not run: {reason}" + return f"build-release could not run `chunk-preflight`, so find the chunk's facts yourself. Why it could not run: {reason}" WORKER = worker_prompts(DRIVER, functools.partial(fresh, DRIVER), NAME_THE_ITEMS) diff --git a/bin/loop_claude/chunk/test_chunk_items.py b/bin/build_release/chunk/test_chunk_items.py similarity index 96% rename from bin/loop_claude/chunk/test_chunk_items.py rename to bin/build_release/chunk/test_chunk_items.py index a5619e2d..5b490df3 100644 --- a/bin/loop_claude/chunk/test_chunk_items.py +++ b/bin/build_release/chunk/test_chunk_items.py @@ -5,10 +5,10 @@ import unittest sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[2])) -from loop_claude.chunk import chunk_items +from build_release.chunk import chunk_items from claude_code import entries from failure import Failure -from loop_claude.chunk import fresh_prompt +from build_release.chunk import fresh_prompt from plan_store.todo_md import plan_of from model_routing.route import Route from model_routing.ladder import Rung diff --git a/bin/loop_claude/chunk/test_fresh_prompt.py b/bin/build_release/chunk/test_fresh_prompt.py similarity index 91% rename from bin/loop_claude/chunk/test_fresh_prompt.py rename to bin/build_release/chunk/test_fresh_prompt.py index 0f6df9bc..4c2c12ec 100644 --- a/bin/loop_claude/chunk/test_fresh_prompt.py +++ b/bin/build_release/chunk/test_fresh_prompt.py @@ -4,24 +4,24 @@ import unittest sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[2])) -from loop_claude.chunk import fresh_prompt -from loop_claude.doubles import OPUS_PROJECT +from build_release.chunk import fresh_prompt +from build_release.doubles import OPUS_PROJECT from chunk_driver import prompts from model_routing.route import Route from model_routing.ladder import Rung class FreshPrompt(unittest.TestCase): - """loop-claude's first prompt of a chunk.""" + """build-release's first prompt of a chunk.""" # What the preflight found, as the fresh prompt quotes it. FACTS = "- A preflight fact." def test_names_the_route_in_a_fresh_prompt_only_where_an_item_routed_it(self): routed = fresh_prompt.WORKER.fresh("Do it.", "## Goals", Route(Rung("m", "high"), 3, 4, 5), None, self.FACTS) - self.assertIn(f"Continue any open draft PR or worktree for the chunk before creating a new one. {prompts.READING_RULE} {fresh_prompt.NAME_THE_ITEMS}\n\nloop-claude runs you on m at high effort, routed by item 3's L of 4.", routed) + self.assertIn(f"Continue any open draft PR or worktree for the chunk before creating a new one. {prompts.READING_RULE} {fresh_prompt.NAME_THE_ITEMS}\n\nbuild-release runs you on m at high effort, routed by item 3's L of 4.", routed) unrouted = fresh_prompt.WORKER.fresh("Do it.", "## Goals", Route(Rung("m")), None, self.FACTS) self.assertIn(f"before creating a new one. {prompts.READING_RULE} {fresh_prompt.NAME_THE_ITEMS}\n\n{self.FACTS}\n\nThe chunk's", unrouted) - self.assertNotIn("loop-claude runs you on", unrouted) + self.assertNotIn("build-release runs you on", unrouted) def test_has_the_routed_worker_count_its_items_size_again_and_puts_the_facts_before_the_scope(self): routed = fresh_prompt.WORKER.fresh("Do it.", "## Goals", Route(Rung("m", "high"), 3, 4, 5), None, self.FACTS) diff --git a/bin/loop_claude/doubles.py b/bin/build_release/doubles.py similarity index 86% rename from bin/loop_claude/doubles.py rename to bin/build_release/doubles.py index 74f6651a..55b2879e 100644 --- a/bin/loop_claude/doubles.py +++ b/bin/build_release/doubles.py @@ -1,4 +1,4 @@ -"""Test doubles for loop-claude's suites: the shipped ladder's opus project, a plan and its release standing.""" +"""Test doubles for build-release's suites: the shipped ladder's opus project, a plan and its release standing.""" from model_routing.ladder import Ladder, ProjectRung, Rung from release_plan.release_standing import LastCut from model_routing.ladder_file import read_ladder, SHIPPED diff --git a/bin/loop_claude/loop/__init__.py b/bin/build_release/loop/__init__.py similarity index 100% rename from bin/loop_claude/loop/__init__.py rename to bin/build_release/loop/__init__.py diff --git a/bin/loop_claude/loop/checkout.py b/bin/build_release/loop/checkout.py similarity index 100% rename from bin/loop_claude/loop/checkout.py rename to bin/build_release/loop/checkout.py diff --git a/bin/loop_claude/loop/chunk_start.py b/bin/build_release/loop/chunk_start.py similarity index 88% rename from bin/loop_claude/loop/chunk_start.py rename to bin/build_release/loop/chunk_start.py index d2aff2bc..a27ebff1 100644 --- a/bin/loop_claude/loop/chunk_start.py +++ b/bin/build_release/loop/chunk_start.py @@ -1,17 +1,17 @@ -"""How loop-claude's cycle starts: the plan it fetches, the item it takes, and the facts chunk-preflight finds for a fresh chunk. The route is `chunk_driver.cycle_start`'s.""" +"""How build-release's cycle starts: the plan it fetches, the item it takes, and the facts chunk-preflight finds for a fresh chunk. The route is `chunk_driver.cycle_start`'s.""" 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.chunk import fresh_prompt -from loop_claude.loop.chunk_windows import held_beside, item_of +from build_release.chunk import fresh_prompt +from build_release.loop.chunk_windows import held_beside, item_of from chunk_preflight.main import ITEM from plan.todo_table import Item from project_config.main import located from chunk_driver.this_loop import Loop from plan_store.plans import Plan -from loop_claude.routed_item import routed_item +from build_release.routed_item import routed_item from claude_code.session import session_open # Seconds routing waits for origin to name its default branch, asked only where the checkout records none; past them, the chunk runs on the project's rung. @@ -54,7 +54,7 @@ def fetched_plan(loop: Loop, announce: bool = True) -> DefaultPlan | Failure: def plan_item(plan: DefaultPlan | Failure, window_item: int | None, effects: Effects) -> Item | None: """The item that routes a chunk: the one its window is named for, or else release_standing.chunk_item's pick from the default branch; None without one, so the chunk runs on the project's rung.""" - # It prints the reason itself, through effects, like the other loop-claude functions that print. todo.md item 51 moves them all to one injected effect, so changing this one alone would be undone. + # It prints the reason itself, through effects, like the other build-release functions that print. todo.md item 51 moves them all to one injected effect, so changing this one alone would be undone. if isinstance(plan, Failure): item: Item | Failure | None = plan else: diff --git a/bin/loop_claude/loop/chunk_windows.py b/bin/build_release/loop/chunk_windows.py similarity index 90% rename from bin/loop_claude/loop/chunk_windows.py rename to bin/build_release/loop/chunk_windows.py index 83f181b7..dabcbabb 100644 --- a/bin/loop_claude/loop/chunk_windows.py +++ b/bin/build_release/loop/chunk_windows.py @@ -1,4 +1,4 @@ -"""The chunks of one project that run at once, each in its own tmux window: which may start now, and how each starts (docs/decisions.md β†’ `loop-claude: each chunk runs in its own tmux window`).""" +"""The chunks of one project that run at once, each in its own tmux window: which may start now, and how each starts (docs/decisions.md β†’ `build-release: each chunk runs in its own tmux window`).""" import dataclasses import pathlib import re @@ -6,12 +6,12 @@ import typing from touch_predictions.beside import Beside, chunks_beside from chunk_driver.claims import CHUNK_FLAG, epic_chunks, HANDED, loop_session, project_lock, starting -from loop_claude.chunk import chunk_items +from build_release.chunk import chunk_items from git_cli.git_repo import default_ref from loop_effects.effects import Effects, say from failure import Failure from project_config.main import located -from loop_claude.loop.reload import LoopRun +from build_release.loop.reload import LoopRun from release_plan.next_chunk import NextChunk, NoItem, planned from plan.touches import overlaps, predicted, Touches from loop_state.paths import Paths @@ -39,7 +39,7 @@ def item_of(chunk: str) -> int | None: def chunk_session(key: str, chunk: str, claude_code_transcripts: pathlib.Path) -> Session: """The worker's session for a chunk. A rerun finds a chunk left open by this name. "A " is the human's cue in the session picker that the session is the loop's.""" - return session_named(f"A {key} loop-claude {chunk}", claude_code_transcripts) + return session_named(f"A {key} build-release {chunk}", claude_code_transcripts) def held_items(chunks: typing.Iterable[str], key: str, claude_code_transcripts: pathlib.Path) -> set[int]: @@ -67,7 +67,7 @@ class Room: def room_of(windows: list[tmux.Listed], own: str | None, leaving: bool, limit: int) -> Room: - """The room windows leave under limit. own is the chunk of the loop that asks, None for the human's loop-claude <task>. leaving is True where own's chunk finished: its window no longer counts as running, and no stopped chunk starts again, since only a loop that isn't leaving, such as the human's loop-claude <task>, restarts one.""" + """The room windows leave under limit. own is the chunk of the loop that asks, None for the human's build-release <task>. leaving is True where own's chunk finished: its window no longer counts as running, and no stopped chunk starts again, since only a loop that isn't leaving, such as the human's build-release <task>, restarts one.""" running = [window.name for window in windows if not window.dead and not (leaving and window.name == own)] # Below 0 where the config lowered parallel-chunks while more chunks ran. room = max(limit - len(running), 0) @@ -115,7 +115,7 @@ def next_plan(root: str, home: pathlib.Path, effects: Effects) -> NextChunk | No def start_chunks(loop_run: LoopRun, leaving: bool, paths: Paths, env: typing.Mapping[str, str], launcher: pathlib.Path, effects: Effects) -> list[str] | AwaitedMerges | Failure: - """Starts a loop-claude in a new window for each chunk of loop_run's project that may start now, and returns the chunks started. leaving says that loop_run's own chunk finished, so its window no longer counts as running; without it, the human started loop-claude. AwaitedMerges where chunks_to_start returns it. A Failure says why no chunk may start, or why one could not; those before it run.""" + """Starts a build-release in a new window for each chunk of loop_run's project that may start now, and returns the chunks started. leaving says that loop_run's own chunk finished, so its window no longer counts as running; without it, the human started build-release. AwaitedMerges where chunks_to_start returns it. A Failure says why no chunk may start, or why one could not; those before it run.""" config = located(loop_run.root, paths.home) if isinstance(config, Failure): return config @@ -143,7 +143,7 @@ def refusal(session: str, windows: list[tmux.Listed], root: str, run: tmux.Tmux) if windows and (owned := tmux.owner(session, run)) != root: return Failure(f"the tmux session {session} runs the chunks of {owned or 'another checkout'}, whose key maps to the same session name; rename one of the two checkouts' folders") if theirs := epic_chunks(root, run): - return Failure(f"do-epic runs chunks in {root}: {', '.join(f'{placed.window.name} of {placed.session}' for placed in theirs)}; loop-claude doesn't start a chunk there until those chunks finish") + return Failure(f"do-epic runs chunks in {root}: {', '.join(f'{placed.window.name} of {placed.session}' for placed in theirs)}; build-release doesn't start a chunk there until those chunks finish") return None diff --git a/bin/loop_claude/loop/main.py b/bin/build_release/loop/main.py similarity index 87% rename from bin/loop_claude/loop/main.py rename to bin/build_release/loop/main.py index d85ef18b..5663ff31 100644 --- a/bin/loop_claude/loop/main.py +++ b/bin/build_release/loop/main.py @@ -4,19 +4,19 @@ import typing from chunk_driver.cycle_start import announced_route, cycle_of, project_routing from transcript_archive.location import archive_root, project_archive -from loop_claude.loop.chunk_windows import AwaitedMerges, chunk_session, item_of, start_chunks -from loop_claude.loop.routing_check import check_routing -from loop_claude.loop.checkout import checkout_root +from build_release.loop.chunk_windows import AwaitedMerges, chunk_session, item_of, start_chunks +from build_release.loop.routing_check import check_routing +from build_release.loop.checkout import checkout_root from chunk_driver.claims import CHUNK_FLAG, loop_session -from loop_claude.chunk import chunk_items, fresh_prompt -from loop_claude.loop.chunk_start import chunk_start, plan_item, scored_plan +from build_release.chunk import chunk_items, fresh_prompt +from build_release.loop.chunk_start import chunk_start, plan_item, scored_plan from chunk_driver.chunk_run import closed_cycle from agent_cycle.run import Concluded, Cycle, run_cycle -from loop_claude.loop.reload import decode_handed, exec_if_edited, fingerprint, LoopRun, RELOAD_FLAG +from build_release.loop.reload import decode_handed, exec_if_edited, fingerprint, LoopRun, RELOAD_FLAG from loop_effects.effects import Effects, say from failure import Failure from agent_cycle.verdicts import Finished -from loop_claude.loop.usage import HELP +from build_release.loop.usage import HELP from chunk_driver.this_loop import Loop from loop_state.paths import Paths from transcript_archive.project_key import project_key @@ -57,13 +57,13 @@ def exit_code(run: typing.Callable[[], Stop], cwd: pathlib.Path, effects: Effect except KeyboardInterrupt: stop = Stop(130, "") except Exception as crash: - tell(f"loop-claude in {cwd} crashed: {crash!r}", effects) + tell(f"build-release in {cwd} crashed: {crash!r}", effects) raise if stop.reason: say(stop.reason, effects, stdout=not stop.code) # Every stop with a reason, but the help, is DMed where the project's config can be read and sets `env-file`, so a loop left overnight never ends unseen. A loop given no task prints the help. Ctrl-C stops without a reason. So does the loop that started the project's windows once it attaches or prints how to, and a loop whose chunk finished once it started the next chunks, since the project's chunks go on. if stop.reason not in ("", HELP): - tell(f"loop-claude in {cwd} stopped: {stop.reason}", effects) + tell(f"build-release in {cwd} stopped: {stop.reason}", effects) return stop.code @@ -78,7 +78,7 @@ def run_loop(argv: list[str], env: typing.Mapping[str, str], paths: Paths, launc return windows_opened(loop_run, env, paths, launcher, effects, steps.start_chunks) pane = env.get("TMUX_PANE") if not pane: - return Stop(1, f"{CHUNK_FLAG} is how loop-claude starts itself in a tmux window; run loop-claude <task>") + return Stop(1, f"{CHUNK_FLAG} is how build-release starts itself in a tmux window; run build-release <task>") baseline = steps.fingerprint(launcher) key = project_key(loop_run.root, paths.home) window = tmux.Window(loop_session(loop_run.root, paths.home), loop_run.chunk, pane) @@ -105,7 +105,7 @@ def run_loop(argv: list[str], env: typing.Mapping[str, str], paths: Paths, launc def windows_opened(loop_run: LoopRun, env: typing.Mapping[str, str], paths: Paths, launcher: pathlib.Path, effects: Effects, start: StartChunks) -> Stop: - """What the loop-claude the human runs does: starts, through start, each chunk that may start now in a window of the project's tmux session, then puts that session on the terminal until the human detaches.""" + """What the build-release the human runs does: starts, through start, each chunk that may start now in a window of the project's tmux session, then puts that session on the terminal until the human detaches.""" started = start(loop_run, False, paths, env, launcher, effects) if isinstance(started, AwaitedMerges): return Stop(0, started.why) @@ -154,7 +154,7 @@ def next_cycle(loop_run: LoopRun, loop: Loop) -> Cycle | Stop: def own_ladder(file: pathlib.Path, model: str, unrouted: bool) -> str: """What a cycle says of a project that runs on a ladder of its own, so that a file left in place after its reason passed doesn't go unseen, nor one that leaves out the project's model, whose work the ladder then doesn't route.""" - routes = f" {model} is not on it, so the worker runs on {model} unrouted; LOOP_CLAUDE_WORKER_MODEL and LOOP_CLAUDE_JUDGE_MODEL name other models for a run." if unrouted else "" + routes = f" {model} is not on it, so the worker runs on {model} unrouted; BUILD_RELEASE_WORKER_MODEL and BUILD_RELEASE_JUDGE_MODEL name other models for a run." if unrouted else "" return f"routing on the project's own ladder, {file}.{routes}" @@ -168,5 +168,5 @@ def loop_run_from(argv: list[str], cwd: pathlib.Path, effects: Effects) -> LoopR return root if isinstance(root, Stop) else LoopRun(0, root, task, "", chunk=chunk) loop_run = decode_handed(argv[1]) if len(argv) == 2 else None if not (loop_run and loop_run.root and loop_run.task): - return Stop(1, f"the edited loop-claude cannot read the state the running one handed it, likely because the edit changed that handover; rerun loop-claude <task>. Handed: {' '.join(argv[1:])}") + return Stop(1, f"the edited build-release cannot read the state the running one handed it, likely because the edit changed that handover; rerun build-release <task>. Handed: {' '.join(argv[1:])}") return loop_run diff --git a/bin/loop_claude/loop/reload.py b/bin/build_release/loop/reload.py similarity index 90% rename from bin/loop_claude/loop/reload.py rename to bin/build_release/loop/reload.py index 2be138c8..5e1f6656 100644 --- a/bin/loop_claude/loop/reload.py +++ b/bin/build_release/loop/reload.py @@ -25,7 +25,7 @@ class LoopRun: route: Route | None = None # How many unfinished verdicts the chunk has had running; a finished chunk and a rerun each set it to 0. It stays apart from route and unfinished_evidence, though all three change together at each verdict: merging or renaming a field stops a running loop at its next reload. unfinished_run: int = 0 - # The chunk this loop runs in its tmux window, as chunk_windows names it: `item-372`, or `no-item`. None for the loop-claude the human started, which starts the windows; a loop started before chunks ran in windows reloads with None too, and so starts the project's windows; its open claude session, named for its slot, is left in the session picker (docs/decisions.md β†’ `loop-claude: each chunk runs in its own tmux window, …`). + # The chunk this loop runs in its tmux window, as chunk_windows names it: `item-372`, or `no-item`. None for the build-release the human started, which starts the windows; a loop started before chunks ran in windows reloads with None too, and so starts the project's windows; its open claude session, named for its slot, is left in the session picker (docs/decisions.md β†’ `build-release: each chunk runs in its own tmux window, …`). chunk: str | None = None @@ -93,7 +93,7 @@ def fingerprint(launcher: pathlib.Path) -> str: return digest.hexdigest() -# A loop runs unattended for hours, often on its own checkout: reloading puts each edit to loop-claude to use without the human rerunning it. +# A loop runs unattended for hours, often on its own checkout: reloading puts each edit to build-release to use without the human rerunning it. def exec_if_edited(loop: Loop, baseline: str, loop_run: LoopRun) -> Stop | None: if fingerprint(loop.launcher) == baseline: return None @@ -104,5 +104,5 @@ def exec_if_edited(loop: Loop, baseline: str, loop_run: LoopRun) -> Stop | None: try: loop.effects.execv(sys.executable, [sys.executable, str(loop.launcher), RELOAD_FLAG, json.dumps(dataclasses.asdict(loop_run))]) except OSError as failure: - return Stop(1, f"could not reload loop-claude: {failure.strerror}; rerun loop-claude <task>") + return Stop(1, f"could not reload build-release: {failure.strerror}; rerun build-release <task>") return None diff --git a/bin/loop_claude/loop/routing_check.py b/bin/build_release/loop/routing_check.py similarity index 80% rename from bin/loop_claude/loop/routing_check.py rename to bin/build_release/loop/routing_check.py index 1d3a83f5..1e4172e3 100644 --- a/bin/loop_claude/loop/routing_check.py +++ b/bin/build_release/loop/routing_check.py @@ -1,4 +1,4 @@ -"""Every state.CYCLES_PER_CHECK cycles across all projects, measure the archive's routing figures, keep them at its root, and interrupt the human with each call for a routing change not raised before: docs/decisions.md β†’ `routing: loop-claude measures review rounds…`.""" +"""Every state.CYCLES_PER_CHECK cycles across all projects, measure the archive's routing figures, keep them at its root, and interrupt the human with each call for a routing change not raised before: docs/decisions.md β†’ `routing: build-release measures review rounds…`.""" import pathlib from routing_figures import archive @@ -38,7 +38,7 @@ def new_calls(root: pathlib.Path, paths: Paths, effects: Effects) -> list[Call] raised = state.raised(root) if isinstance(raised, Failure): return raised - say(f"\n=== cycle {cycle} across loop-claude's archive: measuring the routing figures ===", effects, stdout=True) + say(f"\n=== cycle {cycle} across build-release's archive: measuring the routing figures ===", effects, stdout=True) measured = archive.measure_archive(root, str(paths.home), raised.since, effects.git) if isinstance(measured, Failure): return measured @@ -56,13 +56,13 @@ def new_calls(root: pathlib.Path, paths: Paths, effects: Effects) -> list[Call] def raise_calls(root: pathlib.Path, new: list[Call], rung: Rung, loop: Loop) -> Stop | None: """Puts the calls to the human through a claude in this setup's development clone, where the routing decision is changed. Off a terminal they are only said, and stay in the figures, raised at the next measurement on a terminal.""" bullets = "".join(f"- {call.sentence()}\n" for call in new) - question = f"loop-claude's routing figures call for a routing change:\n{bullets}The figures: {root / archive.FIGURES}" + question = f"build-release's routing figures call for a routing change:\n{bullets}The figures: {root / archive.FIGURES}" say(f"\n{question}", loop.effects) - tell(f"loop-claude in {loop.root} asks:\n\n{question}", loop.effects) + tell(f"build-release in {loop.root} asks:\n\n{question}", loop.effects) if not loop.effects.on_terminal(): say("Not on a terminal: the calls are raised again at the next measurement.", loop.effects) return None - prompt = f"Put these calls for a routing change from loop-claude's figures to the human, and don't change anything until they answer:\n{bullets}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 in this checkout, the development clone, as the setup's CLAUDE.md says; the next chunk of this repo files the plan item for these calls." + prompt = f"Put these calls for a routing change from build-release's figures to the human, and don't change anything until they answer:\n{bullets}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 in this checkout, the development clone, as the setup's CLAUDE.md says; the next chunk of this repo files the plan item for these calls." unstarted = hand_over(ClaudeCommand(claude_args(rung, [prompt]), str(loop.paths.config_clone), {}), loop.effects) if unstarted: return Stop(1, f"could not start claude for the routing calls in {loop.paths.config_clone}, the setup's development clone: {unstarted.reason}") diff --git a/bin/loop_claude/loop/test_chunk_start.py b/bin/build_release/loop/test_chunk_start.py similarity index 96% rename from bin/loop_claude/loop/test_chunk_start.py rename to bin/build_release/loop/test_chunk_start.py index f103e9d6..076331de 100644 --- a/bin/loop_claude/loop/test_chunk_start.py +++ b/bin/build_release/loop/test_chunk_start.py @@ -9,13 +9,13 @@ import unittest sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[2])) from chunk_driver.doubles import a_loop -from loop_claude.loop import chunk_start, chunk_windows, reload +from build_release.loop import chunk_start, chunk_windows, reload from project_config.doubles import configured from release_plan.release_standing import DefaultPlan, LastCut, UNSEEN_RELEASES from failure import Failure from loop_effects.doubles import FakeEffects, ran, STAMP -from loop_claude.chunk import fresh_prompt -from loop_claude.doubles import NO_CUT, TODO +from build_release.chunk import fresh_prompt +from build_release.doubles import NO_CUT, TODO from loop_state import paths from plan_store.todo_md import plan_of from claude_code import session @@ -43,7 +43,7 @@ class RouteSources(unittest.TestCase): config = folder / "config.toml" config.write_text(config.read_text().replace('"checkout:todo.md"', '"folder:todo.md"')) (folder / "todo.md").write_text(TODO) - opened = session.session_named("A proj loop-claude", pathlib.Path(root, "projects")) + opened = session.session_named("A proj build-release", pathlib.Path(root, "projects")) transcript = pathlib.Path(root, "projects", "-fake", f"{opened.id}.jsonl") transcript.parent.mkdir(parents=True) transcript.write_text("{}\n") @@ -121,7 +121,7 @@ class RouteSources(unittest.TestCase): with contextlib.redirect_stderr(io.StringIO()) as stderr: held = chunk_start.fetched_plan(standing) self.assertEqual((held.plan, held.cut.todos_since, held.cut.changelog), (plan_of(TODO), [], ""), "the plan as it stands, whatever git answers") - self.assertEqual(stderr.getvalue(), f"{STAMP} {UNSEEN_RELEASES}\n", "a release review loop-claude cannot call due is never skipped silently") + self.assertEqual(stderr.getvalue(), f"{STAMP} {UNSEEN_RELEASES}\n", "a release review build-release cannot call due is never skipped silently") quiet = a_loop(FakeEffects(git=[*ON_MAIN, unread, unread, unread, unread]).effects(), root=root, paths=paths.paths_from(folder.parents[1])) with contextlib.redirect_stderr(io.StringIO()) as stderr: chunk_start.fetched_plan(quiet, announce=False) @@ -135,7 +135,7 @@ class RouteSources(unittest.TestCase): class ChunkFacts(unittest.TestCase): # The launcher beside which chunk_start finds /b/chunk-preflight. - LAUNCHER = pathlib.Path("/b/loop-claude") + LAUNCHER = pathlib.Path("/b/build-release") def test_runs_the_preflight_at_the_checkout_root_and_quotes_what_it_printed(self): fake = FakeEffects(python=[ran("- A fact.\n")]) @@ -170,7 +170,7 @@ class ChunkFacts(unittest.TestCase): def test_runs_the_preflight_only_where_the_session_is_not_open(self): with tempfile.TemporaryDirectory() as home: - opened = session.session_named("A proj loop-claude", pathlib.Path(home, "projects")) + opened = session.session_named("A proj build-release", pathlib.Path(home, "projects")) fresh = FakeEffects(python=[ran("- A fact.\n")]) facts, _ = chunk_start.chunk_start(a_loop(fresh.effects(), session=opened, launcher=self.LAUNCHER)) self.assertEqual((fresh.made("python"), "- A fact." in facts), ([(["/b/chunk-preflight", "--worktree", "--item", "7"], "/r")], True)) diff --git a/bin/loop_claude/loop/test_chunk_windows.py b/bin/build_release/loop/test_chunk_windows.py similarity index 94% rename from bin/loop_claude/loop/test_chunk_windows.py rename to bin/build_release/loop/test_chunk_windows.py index 71099dfa..7ff61a14 100644 --- a/bin/loop_claude/loop/test_chunk_windows.py +++ b/bin/build_release/loop/test_chunk_windows.py @@ -11,12 +11,12 @@ import unittest sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[2])) from loop_effects.doubles import assistant, FakeEffects -from loop_claude.loop import chunk_windows +from build_release.loop import chunk_windows from project_config.doubles import configured from failure import Failure from git_cli import git_repo from test_env import isolated_env -from loop_claude.loop import main +from build_release.loop import main from release_plan import next_chunk from loop_state import paths from agent_cycle import tmux @@ -112,7 +112,7 @@ class ChunkWindows(unittest.TestCase): class StartChunks(unittest.TestCase): """start_chunks: the windows a loop opens for the chunks that may start now.""" - LAUNCHER = pathlib.Path("/b/loop-claude") + LAUNCHER = pathlib.Path("/b/build-release") def setUp(self): made = tempfile.TemporaryDirectory() @@ -163,12 +163,12 @@ class StartChunks(unittest.TestCase): def test_opens_a_window_for_each_chunk_that_may_start_the_first_making_the_session(self): self.limit(2) fake = FakeEffects() - self.assertEqual(self.start(fake, env={"LOOP_CLAUDE_WORKER_MODEL": "m", "PATH": "/bin"}), ["item-1", "item-3"]) + self.assertEqual(self.start(fake, env={"BUILD_RELEASE_WORKER_MODEL": "m", "PATH": "/bin"}), ["item-1", "item-3"]) self.assertEqual(self.starts(fake), [("new-session", "item-1", [str(self.LAUNCHER), "--chunk", "item-1", "ship it"]), ("new-window", "item-3", [str(self.LAUNCHER), "--chunk", "item-3", "ship it"])]) first = next(call for call in fake.tmux_calls if call[0] == "new-session") self.assertEqual((first[first.index("-s") + 1], first[first.index("-c") + 1]), (self.session, str(self.root))) - # Only loop-claude's own variables are handed on, since a window gets the tmux server's environment. - self.assertEqual([word for word in first if "=" in word], ["LOOP_CLAUDE_WORKER_MODEL=m"]) + # Only build-release's own variables are handed on, since a window gets the tmux server's environment. + self.assertEqual([word for word in first if "=" in word], ["BUILD_RELEASE_WORKER_MODEL=m"]) self.assertEqual(fake.tmux_calls[0], ["list-windows", "-t", f"={self.session}", "-F", "#{window_name}\t#{pane_dead}\t#{window_id}"]) # The session names the checkout whose chunks it runs. self.assertIn(["set-option", "-t", f"={self.session}:", "@loop-root", str(self.root)], fake.tmux_calls) @@ -183,7 +183,7 @@ class StartChunks(unittest.TestCase): def test_refuses_a_checkout_do_epic_runs_chunks_in(self): fake = FakeEffects(windows=f"epic-ABC-12\tABC-34 ?\t0\t@4\t{self.root}\nepic-ABC-12\tABC-35\t0\t@5\t/c/other\nepic-ABC-12\tABC-36\t1\t@6\t{self.root}\nloop-x\titem-1\t0\t@7\t{self.root}\n") - self.assertEqual(self.start(fake), Failure(f"do-epic runs chunks in {self.root}: ABC-34 of epic-ABC-12; loop-claude doesn't start a chunk there until those chunks finish")) + self.assertEqual(self.start(fake), Failure(f"do-epic runs chunks in {self.root}: ABC-34 of epic-ABC-12; build-release doesn't start a chunk there until those chunks finish")) self.assertEqual(self.starts(fake), []) def test_leaves_out_the_items_a_running_chunk_names_on_its_chunk_items_line(self): @@ -215,7 +215,7 @@ class StartChunks(unittest.TestCase): # The session exists, since the finishing loop's window is still in it. self.assertEqual(self.starts(fake)[0][0], "new-window") - def test_the_humans_loop_claude_starts_a_stopped_chunk_again_first_closing_its_dead_window(self): + def test_the_humans_build_release_starts_a_stopped_chunk_again_first_closing_its_dead_window(self): fake = FakeEffects(windows="item-5\t1\t@3\n") self.assertEqual((self.start(fake), self.planned), (["item-5"], 0)) self.assertIn(["kill-window", "-t", "@3"], fake.tmux_calls) @@ -256,7 +256,7 @@ class StartChunks(unittest.TestCase): def test_says_why_it_cannot_take_the_lock_on_starting_windows(self): (self.home / ".local" / "state").mkdir(parents=True) - (self.home / ".local" / "state" / "loop-claude").write_text("") + (self.home / ".local" / "state" / "build-release").write_text("") started = self.start(FakeEffects()) self.assertIsInstance(started, Failure) self.assertTrue(started.reason.startswith(f"cannot lock {self.home}/.local/state/loop-claude/"), started.reason) @@ -267,7 +267,7 @@ class StartChunks(unittest.TestCase): def test_a_chunk_reads_the_other_windows_where_it_cannot_take_the_lock(self): (self.home / ".local" / "state").mkdir(parents=True) - (self.home / ".local" / "state" / "loop-claude").write_text("") + (self.home / ".local" / "state" / "build-release").write_text("") fake = FakeEffects(windows="item-7\t0\t@1\nitem-9\t1\t@3\n") self.assertEqual(chunk_windows.held_beside("item-7", str(self.root), paths.paths_from(self.home), fake.effects()), [9]) @@ -275,7 +275,7 @@ class StartChunks(unittest.TestCase): with tempfile.TemporaryDirectory() as temp: transcripts = pathlib.Path(temp) opened = chunk_windows.chunk_session("proj", "item-7", transcripts) - self.assertEqual(opened.name, "A proj loop-claude item-7") + self.assertEqual(opened.name, "A proj build-release item-7") folder = transcripts / "-r" folder.mkdir() lines = [assistant({"type": "text", "text": "Chunk items: 7 (L 1, E + I 2)"}), assistant({"type": "text", "text": "Chunk items: 7 (L 1, E + I 2), 9 (L 2, E + I 3)"})] diff --git a/bin/loop_claude/loop/test_main.py b/bin/build_release/loop/test_main.py similarity index 88% rename from bin/loop_claude/loop/test_main.py rename to bin/build_release/loop/test_main.py index a0bf48db..c9fb2030 100644 --- a/bin/loop_claude/loop/test_main.py +++ b/bin/build_release/loop/test_main.py @@ -11,11 +11,11 @@ import unittest.mock sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[2])) from chunk_driver.doubles import a_loop -from loop_claude.loop import chunk_windows, main, reload, usage +from build_release.loop import chunk_windows, main, reload, usage from loop_effects.doubles import CWD, FakeEffects, ran, STAMP from failure import Failure from agent_cycle.verdicts import Finished, Unfinished -from loop_claude.doubles import OPUS_PROJECT +from build_release.doubles import OPUS_PROJECT from loop_state import paths from model_routing.route import Route from model_routing.ladder import Rung @@ -29,7 +29,7 @@ class LoopRuns(unittest.TestCase): def test_stops_naming_the_reload_when_it_hands_over_anything_but_the_state_with_a_task(self): for handed in (["3", "2", "/r", "do it"], ["3"], ["[1]"], [json.dumps({"cycle_number": 3, "root": "/r", "unfinished_evidence": ""})], [json.dumps({"cycle_number": 3, "root": "/r", "task": "", "unfinished_evidence": ""})], [json.dumps({"cycle_number": "3", "root": "/r", "task": "do it", "unfinished_evidence": ""})], [json.dumps({"cycle_number": 3, "root": "", "task": "do it", "unfinished_evidence": ""})], [json.dumps({"cycle_number": 3, "root": "/r", "task": "do it", "turns": 1, "unfinished_evidence": ""})], [json.dumps({"cycle_number": 3, "failures": 0, "root": "/r", "task": "do it", "unfinished_evidence": ""})]): with self.subTest(handed=handed): - self.assertEqual(main.loop_run_from([main.RELOAD_FLAG, *handed], CWD, FakeEffects().effects()), Stop(1, f"the edited loop-claude cannot read the state the running one handed it, likely because the edit changed that handover; rerun loop-claude <task>. Handed: {' '.join(handed)}")) + self.assertEqual(main.loop_run_from([main.RELOAD_FLAG, *handed], CWD, FakeEffects().effects()), Stop(1, f"the edited build-release cannot read the state the running one handed it, likely because the edit changed that handover; rerun build-release <task>. Handed: {' '.join(handed)}")) def test_decodes_every_field_of_the_state_and_its_route(self): state = main.LoopRun(cycle_number=2, root="/r", task="do it", unfinished_evidence="old", route=Route(Rung("claude-fable-5-2", "low"), 3, 4, 5, 1, 7, 9), unfinished_run=2) @@ -102,10 +102,10 @@ class LoopRuns(unittest.TestCase): def test_stops_when_the_reload_cannot_start_python(self): with tempfile.TemporaryDirectory() as root: - launcher = pathlib.Path(root, "loop-claude") + launcher = pathlib.Path(root, "build-release") launcher.write_text("") fake = FakeEffects(python=[ran()]) - self.assertEqual(reload.exec_if_edited(a_loop(fake.effects(), launcher=launcher), "stale", main.LoopRun(cycle_number=1, root="/r", task="do it", unfinished_evidence="")), Stop(1, "could not reload loop-claude: No such file or directory; rerun loop-claude <task>")) + self.assertEqual(reload.exec_if_edited(a_loop(fake.effects(), launcher=launcher), "stale", main.LoopRun(cycle_number=1, root="/r", task="do it", unfinished_evidence="")), Stop(1, "could not reload build-release: No such file or directory; rerun build-release <task>")) def steps(start_chunks, **others): @@ -117,7 +117,7 @@ def steps(start_chunks, **others): class WindowStarts(unittest.TestCase): - """The loop-claude the human runs, which starts the windows, and the stop of a window's loop whose chunk finished.""" + """The build-release the human runs, which starts the windows, and the stop of a window's loop whose chunk finished.""" HOME = pathlib.Path("/h") def run_loop(self, argv, fake, env=None, started=("item-3", "item-4")): @@ -129,12 +129,12 @@ class WindowStarts(unittest.TestCase): return list(started) if isinstance(started, tuple) else started with contextlib.redirect_stdout(io.StringIO()) as said: - stop = main.run_loop(argv, env or {}, paths.paths_from(self.HOME), pathlib.Path("/b/loop-claude"), CWD, fake.effects(), steps(start)) + stop = main.run_loop(argv, env or {}, paths.paths_from(self.HOME), pathlib.Path("/b/build-release"), CWD, fake.effects(), steps(start)) return stop, said.getvalue() def test_refuses_to_start_anything_on_a_tmux_older_than_needed(self): fake = FakeEffects(git=["/r\n"], tmux_version="tmux 3.1c") - self.assertEqual(self.run_loop(["do it"], fake), (Stop(1, "loop-claude runs each chunk in a tmux window, and needs tmux 3.2 or later; it found tmux 3.1c"), "")) + self.assertEqual(self.run_loop(["do it"], fake), (Stop(1, "build-release runs each chunk in a tmux window, and needs tmux 3.2 or later; it found tmux 3.1c"), "")) self.assertEqual((fake.tmux_calls, self.asked), ([["-V"]], [])) def test_prints_the_help_without_tmux(self): @@ -153,7 +153,7 @@ class WindowStarts(unittest.TestCase): def test_hands_the_window_starts_its_paths_environment_launcher_and_effects(self): fake = FakeEffects(git=["/r\n"], on_terminal=False) - effects, env, launcher = fake.effects(), {"LOOP_CLAUDE_X": "1"}, pathlib.Path("/b/loop-claude") + effects, env, launcher = fake.effects(), {"BUILD_RELEASE_X": "1"}, pathlib.Path("/b/build-release") asked = [] with contextlib.redirect_stdout(io.StringIO()): main.run_loop(["do it"], env, paths.paths_from(self.HOME), launcher, CWD, effects, steps(lambda *args: asked.append(args) or ["item-3"])) @@ -162,7 +162,7 @@ class WindowStarts(unittest.TestCase): def test_a_window_loop_runs_its_chunk_in_its_own_session_and_window_and_hands_on_once_it_finished(self): fake = FakeEffects(git=["/r\n"]) effects, env = fake.effects(), {"TMUX_PANE": "%4"} - launcher = pathlib.Path("/b/loop-claude") + launcher = pathlib.Path("/b/build-release") cycle = unittest.mock.Mock(project=OPUS_PROJECT) unfinished = unittest.mock.Mock(verdict=unittest.mock.Mock(spec=Unfinished)) finished = unittest.mock.Mock(verdict=unittest.mock.Mock(spec=Finished)) @@ -172,7 +172,7 @@ class WindowStarts(unittest.TestCase): run_cycle=lambda cycle: concluded.pop(0), closed_cycle=lambda *args: closed.pop(0), check_routing=lambda *args: None) with contextlib.redirect_stdout(io.StringIO()): stop = main.run_loop(["--chunk", "item-3", "do it"], env, paths.paths_from(self.HOME), launcher, CWD, effects, taken) - loop = this_loop.Loop(root="/r", session=session.session_named("A r loop-claude item-3", self.HOME / ".claude" / "projects"), window=tmux.Window("loop-r", "item-3", "%4"), paths=paths.paths_from(self.HOME), env=env, launcher=launcher, effects=effects) + loop = this_loop.Loop(root="/r", session=session.session_named("A r build-release item-3", self.HOME / ".claude" / "projects"), window=tmux.Window("loop-r", "item-3", "%4"), paths=paths.paths_from(self.HOME), env=env, launcher=launcher, effects=effects) self.assertEqual(stop, Stop(0, "")) self.assertEqual(cycles, [(main.LoopRun(1, "/r", "do it", "", chunk="item-3"), loop), (main.LoopRun(2, "/r", "do it", "", chunk="item-3"), loop)]) self.assertEqual(started, [(main.LoopRun(2, "/r", "do it", "", chunk="item-3"), True, loop.paths, env, launcher, effects)]) @@ -180,7 +180,7 @@ class WindowStarts(unittest.TestCase): def window_loop(self, cycles, env, **doubles): """run_loop's stop for item-3's window loop, and each step it took with what it handed that step. Each step answers as its double in `doubles` does, else as a cycle without a stop: next_cycle answers the next of `cycles`, run_cycle an unfinished verdict, and closed_cycle the run with one more unfinished verdict.""" fake, calls, cycles = FakeEffects(git=["/r\n"]), [], list(cycles) - effects, launcher, home = fake.effects(), pathlib.Path("/b/loop-claude"), paths.paths_from(self.HOME) + effects, launcher, home = fake.effects(), pathlib.Path("/b/build-release"), paths.paths_from(self.HOME) self.unfinished = unittest.mock.Mock(verdict=unittest.mock.Mock(spec=Unfinished)) answers = {"fingerprint": lambda *args: "print-1", "exec_if_edited": lambda *args: None, "next_cycle": lambda *args: cycles.pop(0), "run_cycle": lambda *args: self.unfinished, "closed_cycle": lambda run, *args: dataclasses.replace(run, unfinished_run=run.unfinished_run + 1), "check_routing": lambda *args: None, **doubles} @@ -189,27 +189,27 @@ class WindowStarts(unittest.TestCase): return lambda *args: calls.append((name, *args)) or answers[name](*args) stop = main.run_loop(["--chunk", "item-3", "do it"], env, home, launcher, CWD, effects, steps(lambda *args: self.fail(args), **{name: step(name) for name in answers})) - self.loop = this_loop.Loop(root="/r", session=session.session_named("A r loop-claude item-3", self.HOME / ".claude" / "projects"), window=tmux.Window("loop-r", "item-3", "%4"), paths=home, env=env, launcher=launcher, effects=effects) + self.loop = this_loop.Loop(root="/r", session=session.session_named("A r build-release item-3", self.HOME / ".claude" / "projects"), window=tmux.Window("loop-r", "item-3", "%4"), paths=home, env=env, launcher=launcher, effects=effects) return stop, calls def test_a_window_loop_hands_each_step_of_a_cycle_what_the_steps_before_it_made(self): - env = {"TMUX_PANE": "%4", "LOOP_CLAUDE_TRANSCRIPTS": "/t"} + env = {"TMUX_PANE": "%4", "BUILD_RELEASE_TRANSCRIPTS": "/t"} on_ladder = unittest.mock.Mock(task="the cycle's task", project=OPUS_PROJECT, project_archive=pathlib.Path("/t/r")) off_ladder = unittest.mock.Mock(task="the cycle's task", project=None, project_archive=pathlib.Path("/t/r"), route=unittest.mock.Mock(rung=Rung("my-model"))) stop, calls = self.window_loop([on_ladder, off_ladder, Stop(2, "the human is needed")], env) self.assertEqual(stop, Stop(2, "the human is needed")) before, first, second, third = (main.LoopRun(number, "/r", "do it", "", unfinished_run=max(number - 1, 0), chunk="item-3") for number in range(4)) self.assertEqual(calls, [ - ("fingerprint", pathlib.Path("/b/loop-claude")), + ("fingerprint", pathlib.Path("/b/build-release")), ("exec_if_edited", self.loop, "print-1", before), ("next_cycle", first, self.loop), ("run_cycle", on_ladder), - ("closed_cycle", first, "the cycle's task", OPUS_PROJECT, self.unfinished, pathlib.Path("/t/r"), "loop-claude", self.loop), + ("closed_cycle", first, "the cycle's task", OPUS_PROJECT, self.unfinished, pathlib.Path("/t/r"), "build-release", self.loop), ("check_routing", pathlib.Path("/t"), Rung("claude-opus-5-5", "medium"), self.loop), ("exec_if_edited", self.loop, "print-1", dataclasses.replace(first, unfinished_run=1)), ("next_cycle", second, self.loop), ("run_cycle", off_ladder), - ("closed_cycle", second, "the cycle's task", None, self.unfinished, pathlib.Path("/t/r"), "loop-claude", self.loop), + ("closed_cycle", second, "the cycle's task", None, self.unfinished, pathlib.Path("/t/r"), "build-release", self.loop), ("check_routing", pathlib.Path("/t"), Rung("my-model"), self.loop), ("exec_if_edited", self.loop, "print-1", dataclasses.replace(second, unfinished_run=2)), ("next_cycle", third, self.loop), @@ -246,12 +246,12 @@ class WindowStarts(unittest.TestCase): fake = FakeEffects(git=["/r\n"]) effects = dataclasses.replace(fake.effects(), tmux_on_terminal=lambda args: 1) with contextlib.redirect_stdout(io.StringIO()): - stop = main.run_loop(["do it"], {}, paths.paths_from(self.HOME), pathlib.Path("/b/loop-claude"), CWD, effects, steps(lambda *args: ["item-3"])) + stop = main.run_loop(["do it"], {}, paths.paths_from(self.HOME), pathlib.Path("/b/build-release"), CWD, effects, steps(lambda *args: ["item-3"])) self.assertEqual(stop, Stop(1, "`tmux attach-session -t =loop-r` failed; the chunks go on in the tmux session")) def test_a_window_loop_outside_tmux_stops(self): fake = FakeEffects(git=["/r\n"]) - self.assertEqual(self.run_loop(["--chunk", "item-3", "do it"], fake)[0], Stop(1, "--chunk is how loop-claude starts itself in a tmux window; run loop-claude <task>")) + self.assertEqual(self.run_loop(["--chunk", "item-3", "do it"], fake)[0], Stop(1, "--chunk is how build-release starts itself in a tmux window; run build-release <task>")) self.assertEqual(self.asked, []) def test_reads_the_chunk_a_window_loop_is_started_with(self): @@ -264,7 +264,7 @@ class WindowStarts(unittest.TestCase): (Failure("no plan"), "", Stop(1, "the chunk finished, but the next could not start: no plan")), (chunk_windows.AwaitedMerges("#7 awaits a merge."), "", Stop(0, "the chunk finished; #7 awaits a merge."))): with self.subTest(started=started), contextlib.redirect_stdout(io.StringIO()) as printed: - loop, asked = a_loop(FakeEffects().effects(), env={"LOOP_CLAUDE_X": "1"}), [] + loop, asked = a_loop(FakeEffects().effects(), env={"BUILD_RELEASE_X": "1"}), [] self.assertEqual(main.handed_on(loop_run, loop, lambda *args: asked.append(args) or started), stop) self.assertEqual(printed.getvalue(), f"{STAMP} {said}\n" if said else "") self.assertEqual(asked, [(loop_run, True, loop.paths, loop.env, loop.launcher, loop.effects)]) @@ -273,7 +273,7 @@ class WindowStarts(unittest.TestCase): class StopDms(unittest.TestCase): def run_main(self, argv, fake): with tempfile.TemporaryDirectory() as home, contextlib.redirect_stderr(io.StringIO()) as said, contextlib.redirect_stdout(io.StringIO()): - code = main.main(argv, {}, paths.paths_from(pathlib.Path(home)), pathlib.Path(home, "loop-claude"), CWD, fake.effects()) + code = main.main(argv, {}, paths.paths_from(pathlib.Path(home)), pathlib.Path(home, "build-release"), CWD, fake.effects()) return code, said.getvalue() def exit_code(self, run, fake): @@ -287,7 +287,7 @@ class StopDms(unittest.TestCase): def test_dms_the_reason_of_a_stop_with_exit_2_such_as_a_chunk_left_unfinished_too_often(self): fake = FakeEffects() self.assertEqual(self.exit_code(lambda: Stop(2, "the human is needed to look at the chunk, but it stayed unfinished"), fake)[0], 2) - self.assertEqual(fake.dms, [f"loop-claude in {CWD} stopped: the human is needed to look at the chunk, but it stayed unfinished"]) + self.assertEqual(fake.dms, [f"build-release in {CWD} stopped: the human is needed to look at the chunk, but it stayed unfinished"]) def test_skips_the_dm_of_a_stop_without_a_reason_as_once_the_windows_started(self): fake = FakeEffects() @@ -303,13 +303,13 @@ class StopDms(unittest.TestCase): fake = FakeEffects() with self.assertRaises(RuntimeError): self.exit_code(lambda: self.raising(RuntimeError("boom")), fake) - self.assertEqual(fake.dms, [f"loop-claude in {CWD} crashed: RuntimeError('boom')"]) + self.assertEqual(fake.dms, [f"build-release in {CWD} crashed: RuntimeError('boom')"]) def test_dms_the_reason_where_a_loop_given_a_task_stops_with_exit_1(self): fake = FakeEffects() code, said = self.run_main([main.RELOAD_FLAG, "3"], fake) self.assertEqual(code, 1) - self.assertEqual(fake.dms, [f"loop-claude in {CWD} stopped: the edited loop-claude cannot read the state the running one handed it, likely because the edit changed that handover; rerun loop-claude <task>. Handed: 3"]) + self.assertEqual(fake.dms, [f"build-release in {CWD} stopped: the edited build-release cannot read the state the running one handed it, likely because the edit changed that handover; rerun build-release <task>. Handed: 3"]) def test_says_why_the_dm_of_a_stop_failed_after_the_reason(self): fake = FakeEffects(dm_failures=[Failure("cannot reach https://chat.example: timed out")]) @@ -327,7 +327,7 @@ class OwnLadder(unittest.TestCase): def test_a_cycle_on_a_projects_own_ladder_names_its_file_and_says_where_the_workers_model_is_off_it(self): file = pathlib.Path("/h/.claude-projects/acme/routing-ladder.json") self.assertEqual(main.own_ladder(file, "claude-fable-5-2", False), f"routing on the project's own ladder, {file}.") - self.assertEqual(main.own_ladder(file, "claude-opus-5-5", True), f"routing on the project's own ladder, {file}. claude-opus-5-5 is not on it, so the worker runs on claude-opus-5-5 unrouted; LOOP_CLAUDE_WORKER_MODEL and LOOP_CLAUDE_JUDGE_MODEL name other models for a run.") + self.assertEqual(main.own_ladder(file, "claude-opus-5-5", True), f"routing on the project's own ladder, {file}. claude-opus-5-5 is not on it, so the worker runs on claude-opus-5-5 unrouted; BUILD_RELEASE_WORKER_MODEL and BUILD_RELEASE_JUDGE_MODEL name other models for a run.") if __name__ == "__main__": diff --git a/bin/loop_claude/loop/test_routing_check.py b/bin/build_release/loop/test_routing_check.py similarity index 96% rename from bin/loop_claude/loop/test_routing_check.py rename to bin/build_release/loop/test_routing_check.py index 6a925611..f9ceb901 100644 --- a/bin/loop_claude/loop/test_routing_check.py +++ b/bin/build_release/loop/test_routing_check.py @@ -17,7 +17,7 @@ from failure import Failure from loop_effects.doubles import FakeEffects, NOW from transcript_archive import outcomes from loop_state import paths -from loop_claude.loop import routing_check +from build_release.loop import routing_check from model_routing.ladder import Rung from claude_code import session from agent_cycle.stop import Stop @@ -34,7 +34,7 @@ class RoutingCheck(unittest.TestCase): self.addCleanup(shutil.rmtree, self.home) self.root = self.home / "archive" self.paths = paths.paths_from(self.home) - self.session = session.session_named("A log loop-claude", self.paths.claude_code_transcripts) + self.session = session.session_named("A log build-release", self.paths.claude_code_transcripts) def loop(self, fake): """The loop in /code/log.""" @@ -148,7 +148,7 @@ class RoutingCheck(unittest.TestCase): self.assertIn(f"call for a routing change:\n- {new[0].sentence()}\n- {new[1].sentence()}\n", said.getvalue()) self.assertIn(f"routing figures: could not write {self.root / state.RAISED}: full", said.getvalue()) [sent] = fake.dms - self.assertTrue(sent.startswith(f"loop-claude in {self.loop(fake).root} asks:\n\nloop-claude's routing figures call for a routing change:\n- {new[0].sentence()}\n"), sent) + self.assertTrue(sent.startswith(f"build-release in {self.loop(fake).root} asks:\n\nbuild-release's routing figures call for a routing change:\n- {new[0].sentence()}\n"), sent) if __name__ == "__main__": diff --git a/bin/loop_claude/loop/test_usage.py b/bin/build_release/loop/test_usage.py similarity index 82% rename from bin/loop_claude/loop/test_usage.py rename to bin/build_release/loop/test_usage.py index 6248ec56..f26ea048 100644 --- a/bin/loop_claude/loop/test_usage.py +++ b/bin/build_release/loop/test_usage.py @@ -8,7 +8,7 @@ sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[2])) from claude_code.output_limits import BASH_CEILING_CHARACTERS from chunk_driver import chunk_run from agent_cycle import judge, retry, states, worker -from loop_claude.loop import main, usage +from build_release.loop import main, usage from loop_effects.effects import PYTHON_TIMEOUT from chunk_driver.project import records from claude_code import reply @@ -60,22 +60,22 @@ class ExitContract(unittest.TestCase): ("chunk_driver/cycle_start.py", "routing_on", "1", "ladder.reason", "the project's routing ladder cannot be read or holds a fault"), ("chunk_driver/project/model_choice.py", "get_or_ask_model", "1", "models.reason", models_), ("chunk_driver/project/model_choice.py", "get_or_ask_model", "1", "failure.reason", models_), - ("loop_claude/loop/checkout.py", "checkout_root", "1", "found.reason", git), - ("loop_claude/loop/main.py", "run_loop", "1", "reason", "tmux is missing or older than 3.2"), - ("loop_claude/loop/main.py", "run_loop", "1", "f'{CHUNK_FLAG} is how loop-claude starts itself", "--chunk is given outside a tmux window"), - ("loop_claude/loop/main.py", "windows_opened", "1", "started.reason", "a chunk's window cannot be started"), - ("loop_claude/loop/main.py", "windows_opened", "1", "f\"`tmux {' '.join(shown)}` failed", "the tmux session cannot be put on the terminal"), - ("loop_claude/loop/main.py", "handed_on", "1", "f'the chunk finished, but the next could not start", "a chunk's window cannot be started"), - ("loop_claude/loop/main.py", "next_cycle", "1", "premises.reason", premises_), - ("loop_claude/loop/main.py", "next_cycle", "1", "records.reason", unreadable), - ("loop_claude/loop/main.py", "loop_run_from", "0 if task else 1", "HELP", "no task is given"), - ("loop_claude/loop/main.py", "loop_run_from", "1", 'f"the edited loop-claude cannot read the state', "a reload cannot read the state the running script handed it"), - ("loop_claude/loop/reload.py", "exec_if_edited", "1", "f'could not reload loop-claude:", "python cannot start for a reload"), - ("loop_claude/loop/routing_check.py", "raise_calls", "1", "f\"could not start claude for the routing calls in {loop.paths.config_clone}", "claude cannot start for an interrupt"), + ("build_release/loop/checkout.py", "checkout_root", "1", "found.reason", git), + ("build_release/loop/main.py", "run_loop", "1", "reason", "tmux is missing or older than 3.2"), + ("build_release/loop/main.py", "run_loop", "1", "f'{CHUNK_FLAG} is how build-release starts itself", "--chunk is given outside a tmux window"), + ("build_release/loop/main.py", "windows_opened", "1", "started.reason", "a chunk's window cannot be started"), + ("build_release/loop/main.py", "windows_opened", "1", "f\"`tmux {' '.join(shown)}` failed", "the tmux session cannot be put on the terminal"), + ("build_release/loop/main.py", "handed_on", "1", "f'the chunk finished, but the next could not start", "a chunk's window cannot be started"), + ("build_release/loop/main.py", "next_cycle", "1", "premises.reason", premises_), + ("build_release/loop/main.py", "next_cycle", "1", "records.reason", unreadable), + ("build_release/loop/main.py", "loop_run_from", "0 if task else 1", "HELP", "no task is given"), + ("build_release/loop/main.py", "loop_run_from", "1", 'f"the edited build-release cannot read the state', "a reload cannot read the state the running script handed it"), + ("build_release/loop/reload.py", "exec_if_edited", "1", "f'could not reload build-release:", "python cannot start for a reload"), + ("build_release/loop/routing_check.py", "raise_calls", "1", "f\"could not start claude for the routing calls in {loop.paths.config_clone}", "claude cannot start for an interrupt"), ] root = pathlib.Path(main.__file__).parents[2] found = [] - for path in sorted(path for package in ("agent_cycle", "chunk_driver", "loop_claude") for path in (root / package).rglob("*.py") if not path.name.startswith("test_")): + for path in sorted(path for package in ("agent_cycle", "chunk_driver", "build_release") for path in (root / package).rglob("*.py") if not path.name.startswith("test_")): functions = [node for node in ast.walk(ast.parse(path.read_text())) if isinstance(node, ast.FunctionDef)] stops = [(call.lineno, function.name, ast.unparse(call.args[0]), ast.unparse(call.args[1])) for function in functions for call in ast.walk(function) if isinstance(call, ast.Call) and getattr(call.func, "id", None) == "Stop" and not (isinstance(call.args[0], ast.Constant) and call.args[0].value in (0, 2, 130))] found += [(str(path.relative_to(root)), function, code, reason) for _, function, code, reason in sorted(stops)] diff --git a/bin/loop_claude/loop/usage.py b/bin/build_release/loop/usage.py similarity index 85% rename from bin/loop_claude/loop/usage.py rename to bin/build_release/loop/usage.py index 655b066b..6721bdb1 100644 --- a/bin/loop_claude/loop/usage.py +++ b/bin/build_release/loop/usage.py @@ -1,6 +1,6 @@ HELP = """Run a task as headless claude cycles; a judge interrupts only when a decision is the human's. -usage: loop-claude <task> +usage: build-release <task> Run it anywhere inside a project checkout whose goals file has ## Goals and ## Audience, the premises. The goals file is the one the project's config, ~/.claude-projects/<key>/config.toml, sets @@ -16,7 +16,7 @@ finished. A chunk stays unfinished until each answer the human typed in it that need is recorded: the premises or the records hold it, or the transcript shows the worker writing it into the premises, AGENTS.md, docs/decisions.md, the plan or a comment. A choice the worker made that the premises or the records settle is not asked about. When the worker asks a question they -answer, the judge quotes the answer, loop-claude prints it, and the worker resumes with it. A quote +answer, the judge quotes the answer, build-release prints it, and the worker resumes with it. A quote they do not hold word for word is dropped, and the question goes to the human. So does a question asked again after its answer. A question the human answered earlier in the chunk goes back to the worker with that answer, unless the question quotes the words of the answer that leave it open. The @@ -26,11 +26,11 @@ remaining. The next chunk starts a fresh session. Cycles continue until an exit either of which stops that one chunk. Words: the setup's CLAUDE.md β†’ "Vocabulary". -loop-claude needs tmux 3.2 or later, and checks it before it starts anything. Each chunk runs in its +build-release needs tmux 3.2 or later, and checks it before it starts anything. Each chunk runs in its own window of one tmux session per project, named loop-<key>, such as loop-claude-config. <key> is the checkout's path relative to ~/code, or to / outside it, with a dash for each character other than a letter, a digit, _ or -. The tmux session's @loop-root option names its checkout, and a -checkout whose key maps to a tmux session another checkout runs is refused. loop-claude <task> +checkout whose key maps to a tmux session another checkout runs is refused. build-release <task> starts the chunks that may start now, then attaches to the tmux session, or switches to it inside tmux; detaching leaves the chunks running. Off a terminal it prints the command that attaches. Where no chunk may start, it says so, and the task starts in no new window. At most parallel-chunks chunks @@ -40,17 +40,17 @@ before it nor an item another chunk holds (touch-predictions --help). A window i its chunk starts from, as item-372; a chunk without a plan item, such as planning a release or its release review, runs alone in the window no-item. -Each window runs a loop-claude for that one chunk, started with --chunk <window>, which nobody +Each window runs a build-release for that one chunk, started with --chunk <window>, which nobody types. As a chunk finishes, its loop starts each chunk that may start then, with the task it ran itself, and exits, which closes its window. A loop that stops, by Ctrl-C, an exit below or a -failure, keeps its window, with its last lines, and its chunk keeps its items; the next loop-claude +failure, keeps its window, with its last lines, and its chunk keeps its items; the next build-release <task> starts it again before any other. To stop every chunk, press Ctrl-C in each window. A chunk's -claude session is named "A <key> loop-claude <window>", so a rerun resumes a chunk left open, and is +claude session is named "A <key> build-release <window>", so a rerun resumes a chunk left open, and is 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/agent_cycle/interrupt.py). -loop-claude prints the question in the chunk's window and rings its bell. Until it is answered the +build-release 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: - A line of text: the worker resumes headless with it. The judge reads it as the human's, so the @@ -60,46 +60,46 @@ there: - Enter alone: stops the loop. A release ready to cut opens that claude session on the terminal at once, since only the human may cut it. While claude is open, Ctrl-C reaches it alone, and the loop goes on. Where the project's -config sets notifier, loop-claude also sends the human each question, naming its tmux window as +config sets notifier, build-release also sends the human each question, naming its tmux window as <session>:<window>, each release ready to cut and each stop as a DM, as bin/notify sends it. Four -stops are left out: Ctrl-C, printing this help, the loop-claude that started the windows once it +stops are left out: Ctrl-C, printing this help, the build-release that started the windows once it attaches or prints how to, and a loop whose chunk finished once it started the next chunks. A DM that fails is said on stderr, and the loop goes on. Where no answer has come 10 minutes before the worker's hour-long prompt cache expires, and the worker's context holds at least 60k tokens, -loop-claude compacts the worker's session with `claude -p /compact` and keeps waiting, so the resume +build-release compacts the worker's session with `claude -p /compact` and keeps waiting, so the resume doesn't write the whole context again. -As a chunk starts, before it is routed, loop-claude runs bin/chunk-preflight --worktree, adding +As a chunk starts, before it is routed, build-release runs bin/chunk-preflight --worktree, adding --item <ID> in a window named for an item, and quotes what it prints in the first prompt -(preflight_facts in bin/loop_claude/chunk/fresh_prompt.py); chunk-preflight --help says what it +(preflight_facts in bin/build_release/chunk/fresh_prompt.py); chunk-preflight --help says what it finds and makes. A preflight that fails, or is still running after 600 s and is stopped, leaves the worker to find the facts itself. At every interrupt, and as every cycle ends, Ctrl-C and a failure included, the claude session's -transcript is copied into a folder per chunk under $LOOP_CLAUDE_TRANSCRIPTS/<key> (default root +transcript is copied into a folder per chunk under $BUILD_RELEASE_TRANSCRIPTS/<key> (default root ~/.claude/loop-claude-transcripts), named by its hash, with an outcomes file beside it: the task, then each verdict, quoted answer, rejected judge reply, step-up and stop, each opened by its UTC time. The layout, and when a copy is replaced, are in bin/transcript_archive/__init__.py. A worker's claude can print its final result and then keep waiting on a background shell that -never ends. Every 5 minutes without output from that claude after its final result, loop-claude +never ends. Every 5 minutes without output from that claude after its final result, build-release stops each of its shells and what runs below them, unless a shell has written output in the last 3 minutes, runs chunk-pr or run-heavy, or holds a heavy slot. It prints each stop and appends it, with the UTC time, to lingering-workers.md at the project's folder in that archive (bin/agent_cycle/lingering_workers.py). A worker can also stall before its result, on a command that hangs. Every 5 minutes without output -from its claude, loop-claude looks for a shell that may be stuck: one that used no CPU since the +from its claude, build-release looks for a shell that may be stuck: one that used no CPU since the last check and wrote no output for 3 minutes, or one that has run over 4 hours. A shell that runs chunk-pr or run-heavy doesn't count, but one that holds a heavy slot can. Where such a shell is found, a headless claude on the project's rung reads every shell's command, processes and output. The headless claude judges the worker working, waiting on a person or stuck, and names the process the worker waits on. It judges a shell again only after the shell used CPU and went idle once more. -loop-claude prints the verdict and the shells that showed a sign, and appends them to +build-release prints the verdict and the shells that showed a sign, and appends them to stuck-workers.md beside lingering-workers.md. It doesn't kill anything yet (bin/agent_cycle/stuck_workers.py). -Before each worker starts, loop-claude waits until at least a quarter of the machine's memory is +Before each worker starts, build-release waits until at least a quarter of the machine's memory is available (bin/machine_load/memory.py). Each worker's claude, the session /talk opens and the subagents either launches run with a 200k @@ -108,11 +108,11 @@ compacts its context at about 170k tokens. They also save a Bash result of more characters to a file and see its path and the first 2,000 characters (BASH_MAX_OUTPUT_LENGTH, bin/claude_code/output_limits.py). -Every claude loop-claude starts runs the project's model, saved per <key> in +Every claude build-release 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 on the terminal. LOOP_CLAUDE_JUDGE_MODEL overrides -the model for the judge, LOOP_CLAUDE_WORKER_MODEL for the worker and the session /talk opens; with +entry, as on its first run, is asked for one on the terminal. BUILD_RELEASE_JUDGE_MODEL overrides +the model for the judge, BUILD_RELEASE_WORKER_MODEL for the worker and the session /talk opens; with both set, nothing is asked. The routing ladder is a list of rungs, least competent first, each a model at an effort. Where the @@ -124,7 +124,7 @@ worker names on its `Chunk items:` line an item that picks a higher rung, or whe in the transcript an escalation trigger that fired and the worker asked for a higher rung. The 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/chunk/fresh_prompt.py, bin/chunk_driver/prompts.py and +bin/build_release/chunk/fresh_prompt.py, bin/chunk_driver/prompts.py and bin/agent_cycle/worker_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 bin/model_routing/route.py); a rerun resumes an open chunk on the latest @@ -142,7 +142,7 @@ or max: It holds one model of each family, such as opus, since the Agent tool launches a subagent or a review by its family's name. This setup ships one, bin/model_routing/routing-ladder.json. A project that keeps a routing-ladder.json in its config's folder, ~/.claude-projects/<key>/, runs on that -ladder instead, whole: write there every rung the project may run on. loop-claude reads the +ladder instead, whole: write there every rung the project may run on. build-release reads the project's ladder as each cycle starts, says on stderr where the project runs on its own, and never commits the file. subagent-rung and rule-hook read the same ladder; the routing figures, judge-replay and review-replay, which span every project, read the shipped one. @@ -157,12 +157,12 @@ routing-calls-raised.md beside the figures, kept in routing-state.json, and not 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. +A change to bin/build-release or any bin/**/*.py takes effect at the next cycle boundary, once +build-release --help succeeds: the loop reloads into the edited script. -Under merge = "human", where no chunk runs and every item left awaits a person's merge, loop-claude +Under merge = "human", where no chunk runs and every item left awaits a person's merge, build-release doesn't start a chunk: it names those pull requests, in a DM too, and exits 0. Its window closes, -so the next loop-claude <task> reads the plan again. +so the next build-release <task> reads the plan again. Exit 1, saying why, when: - no task is given @@ -204,5 +204,5 @@ Exit 2, when the human is needed to go on: - the claude opened for /talk, or for a release ready to cut, ends without anything typed - the judge rules a chunk unfinished 6 cycles running; rerun to give it 6 more -Rerunning loop-claude <task> starts the chunks that may start, a stopped one first, and each +Rerunning build-release <task> starts the chunks that may start, a stopped one first, and each resumes its claude session where it is open.""" diff --git a/bin/loop_claude/routed_item.py b/bin/build_release/routed_item.py similarity index 85% rename from bin/loop_claude/routed_item.py rename to bin/build_release/routed_item.py index 66e0c8af..264e144d 100644 --- a/bin/loop_claude/routed_item.py +++ b/bin/build_release/routed_item.py @@ -1,4 +1,4 @@ -"""The plan item that routes a fresh chunk of loop-claude's: agent_cycle/routing.py's first_route picks the worker's rung from its L.""" +"""The plan item that routes a fresh chunk of build-release's: agent_cycle/routing.py's first_route picks the worker's rung from its L.""" from release_plan.release_standing import chunk_item, LastCut, Next from failure import Failure from plan.todo_table import Item, NoItemsTable diff --git a/bin/loop_claude/test_black_box.py b/bin/build_release/test_black_box.py similarity index 93% rename from bin/loop_claude/test_black_box.py rename to bin/build_release/test_black_box.py index b48e3066..39619b51 100644 --- a/bin/loop_claude/test_black_box.py +++ b/bin/build_release/test_black_box.py @@ -49,7 +49,7 @@ else: """ # Plays claude from FAKE_CLAUDE_SCENARIO, one step per call, logging each call; a step for another role, -# or none left, is Ctrl-C to loop-claude, which otherwise loops forever. +# or none left, is Ctrl-C to build-release, which otherwise loops forever. FAKE_CLAUDE = """#!{python} import json, os, pathlib, signal, sys, time @@ -120,7 +120,7 @@ elif role == "judge": print(step.get("stderr", ""), file=sys.stderr) else: if step.get("ctrl_c"): - # A Ctrl-C on the terminal reaches every process in its foreground, loop-claude too. kill returns once the signal is pending in loop-claude, before this process exits and loop-claude stops waiting for it. + # A Ctrl-C on the terminal reaches every process in its foreground, build-release too. kill returns once the signal is pending in build-release, before this process exits and build-release stops waiting for it. os.kill(os.getppid(), signal.SIGINT) if "type" in step: append({{"type": "user", "message": {{"content": step["type"]}}}}) @@ -131,10 +131,10 @@ if step.get("vanish"): sys.exit(step.get("exit", 0)) """ -# Records every start of loop-claude and turns its retry waits into log lines. +# Records every start of build-release and turns its retry waits into log lines. SITECUSTOMIZE = """import json, os, sys, time -if os.path.basename(sys.argv[0]) == "loop-claude": +if os.path.basename(sys.argv[0]) == "build-release": def record(event): with open(os.environ["LOOP_TEST_LOG"], "a") as log: log.write(json.dumps(event) + "\\n") @@ -161,7 +161,7 @@ TAKEN_IN_AT_L_4 = CHEAP + "| 9 | 0.1.0 | | **Do more.** | 4 | 1 | 2 | 5 | 2 | 1 TAKEN_IN_AT_E_PLUS_I_6 = CHEAP + "| 9 | 0.1.0 | | **Do more.** | 2 | 3 | 3 | 6 | 2 | 1 by 9 | 20 |\n" -# Waits for the interrupt's prompt before typing the answer, since loop-claude drops what was typed before it. +# Waits for the interrupt's prompt before typing the answer, since build-release drops what was typed before it. ANSWERING = ("Answer (", lambda: None) @@ -188,7 +188,7 @@ class Run: code: int sleeps: list starts: list - # stderr and stdout are without the local time that opens each message loop-claude prints, and stderr without the bell an interrupt rings; raw_stderr and raw_stdout keep them. + # stderr and stdout are without the local time that opens each message build-release prints, and stderr without the bell an interrupt rings; raw_stderr and raw_stdout keep them. stderr: str stdout: str # Each tmux command run, as its arguments. @@ -201,7 +201,7 @@ class Run: class Checkout: - """A temporary HOME with a git checkout at ~/code/proj, where loop-claude runs against the fake claude.""" + """A temporary HOME with a git checkout at ~/code/proj, where build-release runs against the fake claude.""" def __init__(self, test): self.test = test @@ -213,7 +213,7 @@ class Checkout: self.root.mkdir(parents=True) (self.root / "README.md").write_text(PREMISES) write_config(self.home, self.root) - self.script = BIN / "loop-claude" + self.script = BIN / "build-release" self.env = isolated_env() fake = self.temp / "fake-bin" fake.mkdir() @@ -238,8 +238,8 @@ class Checkout: "GIT_CONFIG_GLOBAL": os.devnull, "GIT_CONFIG_NOSYSTEM": "1", "HOME": str(self.home), - "LOOP_CLAUDE_JUDGE_MODEL": "judge-model", - "LOOP_CLAUDE_WORKER_MODEL": "worker-model", + "BUILD_RELEASE_JUDGE_MODEL": "judge-model", + "BUILD_RELEASE_WORKER_MODEL": "worker-model", "LOOP_TEST_LOG": str(self.temp / "starts.jsonl"), "PATH": str(fake), "PYTHONPATH": str(site), @@ -256,7 +256,7 @@ class Checkout: self.git("commit", "--quiet", "-m", "plan") def run(self, steps, argv=None, cwd=None, terminal_input=None, stdout_on_terminal=True, before_typing=None, typed_early="", chunk="no-item"): - """Runs loop-claude with argv, or without one as the loop of the window `chunk`, on TASK. Off a terminal, a window's loop whose chunk finished is run again while steps remain, as the window it starts for the next chunk would.""" + """Runs build-release with argv, or without one as the loop of the window `chunk`, on TASK. Off a terminal, a window's loop whose chunk finished is run again while steps remain, as the window it starts for the next chunk would.""" for name in ("FAKE_CLAUDE_LOG", "LOOP_TEST_LOG", "FAKE_TMUX_LOG"): pathlib.Path(self.env[name]).unlink(missing_ok=True) pathlib.Path(self.env["FAKE_CLAUDE_SCENARIO"]).write_text(json.dumps(steps)) @@ -331,7 +331,7 @@ class Checkout: return sorted((self.home / ".claude" / "projects").glob("*/*.jsonl")) def archive(self): - return pathlib.Path(self.env.get("LOOP_CLAUDE_TRANSCRIPTS", self.home / ".claude" / "loop-claude-transcripts")) + return pathlib.Path(self.env.get("BUILD_RELEASE_TRANSCRIPTS", self.home / ".claude" / "loop-claude-transcripts")) def archived(self): """Each archived transcript's outcomes, with every UTC stamp replaced by <UTC> and every setup version by <config>, after checking the copy is named by its content hash.""" @@ -364,7 +364,7 @@ def argument(call, flag): class Premises(unittest.TestCase): def test_refuses_to_start_without_a_task_a_checkout_or_premises(self): checkout = Checkout(self) - for argv, code, said in (([], 1, "usage: loop-claude <task>"), (["--help"], 0, "usage: loop-claude <task>"), (["-h"], 0, "usage: loop-claude <task>")): + for argv, code, said in (([], 1, "usage: build-release <task>"), (["--help"], 0, "usage: build-release <task>"), (["-h"], 0, "usage: build-release <task>")): with self.subTest(argv=argv): run = checkout.run([], argv=argv) self.assertEqual(run.code, code) @@ -433,7 +433,7 @@ class Premises(unittest.TestCase): write_config(checkout.home, root) checkout.git("init", "--quiet", str(root)) run = checkout.run([worker()], cwd=root) - self.assertEqual(argument(run.calls[0], "--name"), f"A {str(root).lstrip('/')} loop-claude no-item") + self.assertEqual(argument(run.calls[0], "--name"), f"A {str(root).lstrip('/')} build-release no-item") class Cycles(unittest.TestCase): @@ -453,7 +453,7 @@ class Cycles(unittest.TestCase): self.assertEqual(run.roles(), ["worker", "judge", "worker", "judge", "worker", "judge"]) workers = [call for call in run.calls if call["role"] == "worker"] session = argument(workers[0], "--session-id") - self.assertEqual(argument(workers[0], "--name"), "A proj loop-claude no-item") + self.assertEqual(argument(workers[0], "--name"), "A proj build-release no-item") self.assertEqual(argument(workers[1], "--resume"), session) self.assertIsNone(argument(workers[1], "--session-id")) self.assertIsNone(argument(workers[1], "--name")) @@ -484,7 +484,7 @@ class Cycles(unittest.TestCase): def test_routes_the_worker_by_its_items_l_and_steps_it_up_within_the_chunk(self): checkout = Checkout(self) - checkout.env["LOOP_CLAUDE_WORKER_MODEL"] = "claude-opus-5-5" + checkout.env["BUILD_RELEASE_WORKER_MODEL"] = "claude-opus-5-5" checkout.commit_plan(TAKEN_IN_AT_L_4) run = checkout.run([ worker(say="one"), judge(evidence="one"), @@ -503,7 +503,7 @@ class Cycles(unittest.TestCase): ("claude-sonnet-5-5", "high"), ]) self.assertEqual({(argument(call, "--model"), argument(call, "--effort")) for call in run.calls if call["role"] == "judge"}, {("judge-model", None)}) - self.assertIn("loop-claude runs you on claude-sonnet-5-5 at high effort, routed by item 4's L of 2.", argument(workers[0], "-p")) + self.assertIn("build-release runs you on claude-sonnet-5-5 at high effort, routed by item 4's L of 2.", argument(workers[0], "-p")) self.assertIn("on one line, as in `Chunk items: ", argument(workers[0], "-p")) outcomes = sorted(verdict.removeprefix(f"Task: {TASK}\n\n") for verdict in checkout.archived().values()) self.assertIn('<UTC> Verdict: unfinished\n\nEvidence:\n> three\n\nConfig: <config>\nJudge: judge-model\nWorker: {"model": "claude-opus-5-5", "effort": "medium", "item": 4, "likelihood": 2, "escape_and_impact": 3}\n\n<UTC> Stepped up\n\nWorker: {"model": "claude-fable-5-2", "effort": "medium", "item": 4, "likelihood": 2, "escape_and_impact": 3}\n', outcomes) @@ -511,7 +511,7 @@ class Cycles(unittest.TestCase): def test_routes_on_the_ladder_the_projects_config_folder_holds_in_place_of_the_shipped_one(self): checkout = Checkout(self) - checkout.env["LOOP_CLAUDE_WORKER_MODEL"] = "claude-fable-5-2" + checkout.env["BUILD_RELEASE_WORKER_MODEL"] = "claude-fable-5-2" ladder = checkout.home / ".claude-projects" / "proj" / "routing-ladder.json" ladder.write_text('[{"model": "claude-fable-5-2", "effort": "low"}, {"model": "claude-fable-5-2", "effort": "max"}]') checkout.commit_plan(CHEAP) @@ -527,12 +527,12 @@ class Cycles(unittest.TestCase): ladder = checkout.home / ".claude-projects" / "proj" / "routing-ladder.json" ladder.write_text('[{"model": "claude-fable-5-2", "effort": "low"}]') run = checkout.run([worker()]) - self.assertIn(f"routing on the project's own ladder, {ladder}. worker-model is not on it, so the worker runs on worker-model unrouted; LOOP_CLAUDE_WORKER_MODEL and LOOP_CLAUDE_JUDGE_MODEL name other models for a run.\n", run.stderr) + self.assertIn(f"routing on the project's own ladder, {ladder}. worker-model is not on it, so the worker runs on worker-model unrouted; BUILD_RELEASE_WORKER_MODEL and BUILD_RELEASE_JUDGE_MODEL name other models for a run.\n", run.stderr) self.assertEqual((argument(run.calls[0], "--model"), argument(run.calls[0], "--effort")), ("worker-model", None)) def test_reads_the_projects_ladder_afresh_each_cycle_and_exits_1_once_it_holds_a_fault(self): checkout = Checkout(self) - checkout.env["LOOP_CLAUDE_WORKER_MODEL"] = "claude-fable-5-2" + checkout.env["BUILD_RELEASE_WORKER_MODEL"] = "claude-fable-5-2" ladder = checkout.home / ".claude-projects" / "proj" / "routing-ladder.json" ladder.write_text('[{"model": "claude-fable-5-2", "effort": "high"}]') checkout.env["FAKE_CLAUDE_EDIT"] = str(ladder.parent) @@ -543,7 +543,7 @@ class Cycles(unittest.TestCase): def test_routes_on_and_states_the_same_item_from_the_fetched_default_branch_whatever_the_checkout_holds(self): checkout = Checkout(self) - checkout.env["LOOP_CLAUDE_WORKER_MODEL"] = "claude-opus-5-5" + checkout.env["BUILD_RELEASE_WORKER_MODEL"] = "claude-opus-5-5" origin = checkout.temp / "origin.git" checkout.git("init", "--quiet", "--bare", "--initial-branch=main", str(origin)) checkout.git("symbolic-ref", "HEAD", "refs/heads/main") @@ -567,7 +567,7 @@ class Cycles(unittest.TestCase): def test_steps_the_worker_up_a_rung_when_the_judge_finds_in_the_transcript_the_escalation_trigger_it_cites(self): checkout = Checkout(self) - checkout.env["LOOP_CLAUDE_WORKER_MODEL"] = "claude-opus-5-5" + checkout.env["BUILD_RELEASE_WORKER_MODEL"] = "claude-opus-5-5" checkout.commit_plan(TODO) run = checkout.run([ worker(say="Stability round 2: a πŸ”΄. Trigger 3 fired; I ask for a higher rung."), judge(evidence="I ask for a higher rung.", escalation="Stability round 2: a πŸ”΄."), @@ -589,7 +589,7 @@ class Cycles(unittest.TestCase): def test_steps_the_worker_up_once_as_the_judge_interrupts_when_the_run_also_cites_an_escalation_trigger(self): checkout = Checkout(self) - checkout.env["LOOP_CLAUDE_WORKER_MODEL"] = "claude-opus-5-5" + checkout.env["BUILD_RELEASE_WORKER_MODEL"] = "claude-opus-5-5" checkout.commit_plan(TODO) cited = "Stability round 2: a πŸ”΄." run = checkout.run([ @@ -607,7 +607,7 @@ class Cycles(unittest.TestCase): def test_runs_a_cheap_items_worker_below_the_projects_rung_with_its_reviewers_on_it_and_its_judge_on_the_models_highest(self): checkout = Checkout(self) - checkout.env["LOOP_CLAUDE_WORKER_MODEL"] = checkout.env["LOOP_CLAUDE_JUDGE_MODEL"] = "claude-opus-5-5" + checkout.env["BUILD_RELEASE_WORKER_MODEL"] = checkout.env["BUILD_RELEASE_JUDGE_MODEL"] = "claude-opus-5-5" checkout.commit_plan(CHEAP) run = checkout.run([worker(say="one"), judge(finished=True, evidence="one"), worker(say="next chunk")]) self.assertEqual(run.code, 130) @@ -620,7 +620,7 @@ class Cycles(unittest.TestCase): def test_routes_the_reviewers_on_the_highest_e_plus_i_the_worker_takes_in_and_keeps_the_judge_on_the_models_highest(self): checkout = Checkout(self) - checkout.env["LOOP_CLAUDE_WORKER_MODEL"] = checkout.env["LOOP_CLAUDE_JUDGE_MODEL"] = "claude-opus-5-5" + checkout.env["BUILD_RELEASE_WORKER_MODEL"] = checkout.env["BUILD_RELEASE_JUDGE_MODEL"] = "claude-opus-5-5" checkout.commit_plan(TAKEN_IN_AT_E_PLUS_I_6) run = checkout.run([ worker(say="one\nChunk items: 4, 9"), judge(evidence="one"), @@ -638,7 +638,7 @@ class Cycles(unittest.TestCase): def test_a_rerun_resumes_an_open_chunk_on_the_rung_it_last_ran(self): checkout = Checkout(self) - checkout.env["LOOP_CLAUDE_WORKER_MODEL"] = "claude-opus-5-5" + checkout.env["BUILD_RELEASE_WORKER_MODEL"] = "claude-opus-5-5" checkout.commit_plan(TODO) run = checkout.run([worker(), judge(), worker(), judge()]) self.assertEqual(run.code, 130) @@ -655,9 +655,9 @@ class Cycles(unittest.TestCase): session = argument(first.calls[0], "--session-id") transcript = checkout.transcripts()[0] kept, archived = transcript.read_bytes(), checkout.archived() - self.assertEqual(argument(first.calls[0], "--name"), "A proj loop-claude no-item") + self.assertEqual(argument(first.calls[0], "--name"), "A proj build-release no-item") second = checkout.run([worker(say="second chunk"), judge(evidence="second chunk")], chunk="item-2") - self.assertEqual(argument(second.calls[0], "--name"), "A proj loop-claude item-2") + self.assertEqual(argument(second.calls[0], "--name"), "A proj build-release item-2") self.assertNotIn(session, [argument(call, "--session-id") or argument(call, "--resume") for call in second.calls if call["role"] == "worker"]) self.assertNotIn("first chunk", second.calls[1]["stdin"]) self.assertEqual(transcript.read_bytes(), kept) @@ -785,7 +785,7 @@ class Cycles(unittest.TestCase): run = checkout.run(six + [worker()]) self.assertEqual((run.code, run.roles()), (2, ["worker", "judge"] * 6)) self.assertIn("the judge ruled it unfinished 6 cycles running", run.stderr.strip().splitlines()[-1]) - self.assertIn("rerun loop-claude to give it 6 more cycles", run.stderr.strip().splitlines()[-1]) + self.assertIn("rerun build-release to give it 6 more cycles", run.stderr.strip().splitlines()[-1]) stops = [outcome for outcome in checkout.archived().values() if "Stopped: " in outcome] self.assertEqual(len(stops), 1) self.assertIn(f"\n\nWorker: {OFF_LADDER}\n", stops[0]) @@ -794,7 +794,7 @@ class Cycles(unittest.TestCase): def test_archives_the_stop_on_the_route_the_sixth_verdict_stepped_to_and_a_rerun_resumes_there(self): checkout = Checkout(self) - checkout.env["LOOP_CLAUDE_WORKER_MODEL"] = "claude-opus-5-5" + checkout.env["BUILD_RELEASE_WORKER_MODEL"] = "claude-opus-5-5" checkout.commit_plan(CHEAP) run = checkout.run([step for _ in range(6) for step in (worker(), judge())] + [worker()]) self.assertEqual(run.code, 2) @@ -836,7 +836,7 @@ class Windows(unittest.TestCase): ["-V"], ["list-windows", "-t", "=loop-proj", "-F", "#{window_name}\t#{pane_dead}\t#{window_id}"], ["list-windows", "-a", "-F", "#{session_name}\t#{window_name}\t#{pane_dead}\t#{window_id}\t#{@chunk-root}"], - ["new-session", "-d", "-s", "loop-proj", "-n", "item-4", "-c", str(checkout.root), "-e", "LOOP_CLAUDE_JUDGE_MODEL=judge-model", "-e", "LOOP_CLAUDE_WORKER_MODEL=worker-model", "-P", "-F", "#{window_id}", "--", str(checkout.script), "--chunk", "item-4", "ship it"], + ["new-session", "-d", "-s", "loop-proj", "-n", "item-4", "-c", str(checkout.root), "-e", "BUILD_RELEASE_JUDGE_MODEL=judge-model", "-e", "BUILD_RELEASE_WORKER_MODEL=worker-model", "-P", "-F", "#{window_id}", "--", str(checkout.script), "--chunk", "item-4", "ship it"], ["set-option", "-t", "=loop-proj:", "@loop-root", str(checkout.root)], ["set-option", "-w", "-t", "@7", "@chunk-root", str(checkout.root)], ["set-option", "-w", "-t", "@7", "remain-on-exit", "failed"], @@ -890,7 +890,7 @@ class Windows(unittest.TestCase): def test_tells_a_fresh_worker_the_items_the_other_running_chunks_hold_and_starts_from_its_windows_item(self): checkout = self.checkout(parallel=2) - checkout.env["LOOP_CLAUDE_WORKER_MODEL"] = "claude-opus-5-5" + checkout.env["BUILD_RELEASE_WORKER_MODEL"] = "claude-opus-5-5" pathlib.Path(checkout.env["FAKE_TMUX_WINDOWS"]).write_text("item-4\t0\t@1\nitem-9\t0\t@2\n") run = checkout.run([worker()], chunk="item-9") prompt = argument(run.calls[0], "-p") @@ -902,10 +902,10 @@ class Windows(unittest.TestCase): checkout = self.checkout() checkout.env["FAKE_TMUX_VERSION"] = "tmux 3.1c" run = checkout.run([], argv=[TASK]) - self.assertEqual((run.code, run.stderr, run.tmux), (1, "loop-claude runs each chunk in a tmux window, and needs tmux 3.2 or later; it found tmux 3.1c\n", [["-V"]])) + self.assertEqual((run.code, run.stderr, run.tmux), (1, "build-release runs each chunk in a tmux window, and needs tmux 3.2 or later; it found tmux 3.1c\n", [["-V"]])) (pathlib.Path(checkout.env["PATH"]) / "tmux").unlink() run = checkout.run([], argv=[TASK]) - self.assertEqual((run.code, run.stderr), (1, "loop-claude runs each chunk in a tmux window, and needs tmux 3.2 or later; it found no tmux\n")) + self.assertEqual((run.code, run.stderr), (1, "build-release runs each chunk in a tmux window, and needs tmux 3.2 or later; it found no tmux\n")) def test_marks_the_window_while_an_interrupt_waits_and_rings_its_bell(self): checkout = self.checkout() @@ -920,14 +920,14 @@ class Windows(unittest.TestCase): class Interrupt(unittest.TestCase): def test_exits_2_off_a_terminal_and_resumes_on_the_next_run(self): checkout = Checkout(self) - checkout.env["LOOP_CLAUDE_TRANSCRIPTS"] = str(checkout.temp / "deep" / "archive") + checkout.env["BUILD_RELEASE_TRANSCRIPTS"] = str(checkout.temp / "deep" / "archive") steps = [worker(say="Shall I use A or B?"), judge(interrupt=True, evidence="Shall I use A or B?", question="A or B?")] run = checkout.run(steps) self.assertEqual((run.code, run.roles()), (2, ["worker", "judge"])) - self.assertEqual(run.stderr.strip().splitlines()[-2:], ["A or B?", "the human is needed to answer the question above, but stdin or stdout is not a terminal; rerun loop-claude on a terminal"]) + self.assertEqual(run.stderr.strip().splitlines()[-2:], ["A or B?", "the human is needed to answer the question above, but stdin or stdout is not a terminal; rerun build-release on a terminal"]) [(copy, verdict)] = checkout.archived().items() self.assertEqual(copy, (checkout.transcripts()[0]).read_text()) - self.assertEqual(verdict, f"Task: {TASK}\n\n<UTC> Verdict: interrupt\n\nA or B?\n\nEvidence:\n> Shall I use A or B?\n\nConfig: <config>\nJudge: judge-model\nWorker: {OFF_LADDER}\n\n<UTC> Stopped: the human is needed to answer the question above, but stdin or stdout is not a terminal; rerun loop-claude on a terminal\n\nWorker: {OFF_LADDER}\n") + self.assertEqual(verdict, f"Task: {TASK}\n\n<UTC> Verdict: interrupt\n\nA or B?\n\nEvidence:\n> Shall I use A or B?\n\nConfig: <config>\nJudge: judge-model\nWorker: {OFF_LADDER}\n\n<UTC> Stopped: the human is needed to answer the question above, but stdin or stdout is not a terminal; rerun build-release on a terminal\n\nWorker: {OFF_LADDER}\n") self.assertEqual(stat.S_IMODE((checkout.temp / "deep").stat().st_mode), 0o700) self.assertIn(f"transcript: {checkout.archive() / 'proj'}/", run.stderr) self.assertRegex(run.raw_stderr, rf"(?m)^{STAMP} transcript: ") @@ -936,7 +936,7 @@ class Interrupt(unittest.TestCase): self.assertEqual((run.code, run.roles()), (2, ["worker", "judge"])) self.assertEqual(argument(run.calls[0], "--resume"), session) self.assertEqual(len(checkout.archived()), 2) - self.assertEqual(run.stderr.strip().splitlines()[-1], "the human is needed to answer the question above, but stdin or stdout is not a terminal; rerun loop-claude on a terminal") + self.assertEqual(run.stderr.strip().splitlines()[-1], "the human is needed to answer the question above, but stdin or stdout is not a terminal; rerun build-release on a terminal") run = checkout.run([worker(transcript=False), steps[1]]) self.assertEqual(run.code, 2) self.assertEqual(len(checkout.archived()), 2) @@ -1023,20 +1023,20 @@ class Models(unittest.TestCase): def test_asks_a_project_without_a_model_on_the_terminal_and_saves_the_answer(self): checkout = Checkout(self) - del checkout.env["LOOP_CLAUDE_JUDGE_MODEL"], checkout.env["LOOP_CLAUDE_WORKER_MODEL"] + del checkout.env["BUILD_RELEASE_JUDGE_MODEL"], checkout.env["BUILD_RELEASE_WORKER_MODEL"] self.catalog(checkout) run = checkout.run([worker()]) self.assertEqual((run.code, run.calls), (2, [])) - self.assertEqual(run.stderr.strip(), f'the human is needed to pick proj\'s model, or merge {{"proj": "<model>"}} into {checkout.models_file()}, but stdin or stdout is not a terminal; rerun loop-claude on a terminal') + self.assertEqual(run.stderr.strip(), f'the human is needed to pick proj\'s model, or merge {{"proj": "<model>"}} into {checkout.models_file()}, but stdin or stdout is not a terminal; rerun build-release on a terminal') run = checkout.run([worker()], terminal_input="\x04") self.assertEqual((run.code, run.calls), (2, [])) self.assertEqual(run.stderr.strip().splitlines()[-1], "the human is needed to pick proj's model, but the input ended") - checkout.env["LOOP_CLAUDE_JUDGE_MODEL"] = "judge-model" + checkout.env["BUILD_RELEASE_JUDGE_MODEL"] = "judge-model" run = checkout.run([worker()]) self.assertEqual((run.code, run.calls), (2, [])) - del checkout.env["LOOP_CLAUDE_JUDGE_MODEL"] + del checkout.env["BUILD_RELEASE_JUDGE_MODEL"] run = checkout.run([worker(), judge()], terminal_input="\n9\n2\n") self.assertEqual(run.code, 130) self.assertIn("proj runs on model-b", run.stderr) @@ -1047,13 +1047,13 @@ class Models(unittest.TestCase): self.assertEqual(json.loads(checkout.models_file().read_text()), {"proj": "model-b"}) self.assertEqual(stat.S_IMODE(checkout.models_file().stat().st_mode), 0o600) - checkout.env["LOOP_CLAUDE_JUDGE_MODEL"] = "judge-model" + checkout.env["BUILD_RELEASE_JUDGE_MODEL"] = "judge-model" run = checkout.run([worker(), judge()]) self.assertEqual([argument(call, "--model") for call in run.calls], ["model-b", "judge-model", "model-b"]) def test_keeps_the_models_file_mode_and_other_projects_when_saving(self): checkout = Checkout(self) - del checkout.env["LOOP_CLAUDE_JUDGE_MODEL"], checkout.env["LOOP_CLAUDE_WORKER_MODEL"] + del checkout.env["BUILD_RELEASE_JUDGE_MODEL"], checkout.env["BUILD_RELEASE_WORKER_MODEL"] checkout.models_file().parent.mkdir(parents=True) checkout.models_file().write_text(json.dumps({"other": "model-x"})) checkout.models_file().chmod(0o640) @@ -1077,7 +1077,7 @@ class Models(unittest.TestCase): def test_offers_no_catalog_whose_models_are_not_a_list(self): checkout = Checkout(self) - del checkout.env["LOOP_CLAUDE_JUDGE_MODEL"], checkout.env["LOOP_CLAUDE_WORKER_MODEL"] + del checkout.env["BUILD_RELEASE_JUDGE_MODEL"], checkout.env["BUILD_RELEASE_WORKER_MODEL"] self.catalog(checkout) catalog = checkout.home / ".claude" / "cache" / "model-catalog" / "new.json" for shape in ({"catalog": {"config": {"models": []}}}, {"catalog": None}, {"catalog": {"config": []}}, {"catalog": {"config": {"models": "x"}}}): @@ -1091,7 +1091,7 @@ class Models(unittest.TestCase): def test_exits_1_when_the_models_file_cannot_be_written(self): assert_not_root(self) checkout = Checkout(self) - del checkout.env["LOOP_CLAUDE_JUDGE_MODEL"], checkout.env["LOOP_CLAUDE_WORKER_MODEL"] + del checkout.env["BUILD_RELEASE_JUDGE_MODEL"], checkout.env["BUILD_RELEASE_WORKER_MODEL"] checkout.models_file().parent.mkdir(parents=True, mode=0o500) self.addCleanup(checkout.models_file().parent.chmod, 0o700) run = checkout.run([worker()], terminal_input="custom-model\n") @@ -1104,12 +1104,12 @@ class Reload(unittest.TestCase): checkout = Checkout(self) copy = checkout.temp / "bin" shutil.copytree(BIN, copy, ignore=shutil.ignore_patterns("__pycache__", "test_*")) - checkout.script = copy / "loop-claude" + checkout.script = copy / "build-release" checkout.env["FAKE_CLAUDE_EDIT"] = str(copy) run = checkout.run([ - worker(append=["loop-claude", "\ndef\n"]), judge(), - worker(replace=["loop-claude", "\ndef\n", "\n# edited\n"]), judge(), - worker(append=["loop_claude/nested/edited.py", "# edited\n"]), judge(), + worker(append=["build-release", "\ndef\n"]), judge(), + worker(replace=["build-release", "\ndef\n", "\n# edited\n"]), judge(), + worker(append=["build_release/nested/edited.py", "# edited\n"]), judge(), worker(append=["records/file_writes.py", "# edited\n"]), judge(), worker(), ]) @@ -1141,7 +1141,7 @@ class Reload(unittest.TestCase): run = checkout.run([], argv=["--reloaded", "{}"]) self.assertEqual((run.code, run.calls), (1, [])) - self.assertIn("rerun loop-claude <task>", run.stderr) + self.assertIn("rerun build-release <task>", run.stderr) if __name__ == "__main__": diff --git a/bin/loop_claude/test_routed_item.py b/bin/build_release/test_routed_item.py similarity index 93% rename from bin/loop_claude/test_routed_item.py rename to bin/build_release/test_routed_item.py index 25458df4..56a07bcd 100644 --- a/bin/loop_claude/test_routed_item.py +++ b/bin/build_release/test_routed_item.py @@ -7,14 +7,14 @@ sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[1])) from failure import Failure from release_plan.release_standing import LastCut -import loop_claude.routed_item -from loop_claude.doubles import NO_CUT, TODO +import build_release.routed_item +from build_release.doubles import NO_CUT, TODO from plan_store.todo_md import plan_of def routed_item(todo, cut): - """loop_claude.routed_item.routed_item for the plan a todo.md's text holds.""" - return loop_claude.routed_item.routed_item(plan_of(todo), cut) + """build_release.routed_item.routed_item for the plan a todo.md's text holds.""" + return build_release.routed_item.routed_item(plan_of(todo), cut) class RoutedItem(unittest.TestCase): diff --git a/bin/chunk_driver/__init__.py b/bin/chunk_driver/__init__.py index 0fe82b4d..14b2f668 100644 --- a/bin/chunk_driver/__init__.py +++ b/bin/chunk_driver/__init__.py @@ -1,4 +1,4 @@ -"""What the entry points that drive chunks share: loop-claude and do-epic. +"""What the entry points that drive chunks share: build-release and do-epic. Each runs a chunk as cycles of bin/agent_cycle/. cycle_start.py starts a cycle and chunk_run.py closes it, on the Loop this_loop.py holds, once claims.py has claimed the checkout. prompts.py words what every worker is told, project/ reads a checkout's premises, records and saved models, and drivers.py names the entry points. No module here imports an entry point's package, and bin/repo_checks/test_package_cycles.py fails on such an import. """ diff --git a/bin/chunk_driver/chunk_run.py b/bin/chunk_driver/chunk_run.py index a4c24313..4c67f208 100644 --- a/bin/chunk_driver/chunk_run.py +++ b/bin/chunk_driver/chunk_run.py @@ -17,7 +17,7 @@ UNFINISHED_LIMIT = 6 class Run(typing.Protocol): - """What closing a cycle reads and replaces in an entry point's run of one chunk. ChunkRun below is one; loop-claude's LoopRun is another, since it hands the same fields on at a reload.""" + """What closing a cycle reads and replaces in an entry point's run of one chunk. ChunkRun below is one; build-release's LoopRun is another, since it hands the same fields on at a reload.""" # Every run is a dataclass, which is what lets closing a cycle replace its fields. __dataclass_fields__: typing.ClassVar[dict[str, typing.Any]] diff --git a/bin/chunk_driver/claims.py b/bin/chunk_driver/claims.py index 54cd196a..bd60b62e 100644 --- a/bin/chunk_driver/claims.py +++ b/bin/chunk_driver/claims.py @@ -1,4 +1,4 @@ -"""How entry points claim a checkout before they start a chunk in it, so that two never start the same chunk and do-epic never starts one where loop-claude runs. +"""How entry points claim a checkout before they start a chunk in it, so that two never start the same chunk and do-epic never starts one where build-release runs. An entry point holds `starting` on `project_lock` while it lists the windows of the checkout's chunks and starts new ones. Where the lock cannot be taken, `starting` yields a Failure, and the entry point doesn't start any chunk. It starts each chunk in a tmux window with CHUNK_FLAG, and hands that window the variables named with HANDED. """ @@ -13,13 +13,13 @@ from loop_state.paths import STATE_FOLDER from agent_cycle import tmux # Under the home folder, a folder per project key holds LOCK. -CLAIMS = f"{STATE_FOLDER}/loop-claude" -# The file an entry point keeps locked with flock while it lists the windows of a project's chunks and starts new ones. Two loops whose chunks finish together then don't start a chunk twice, and do-epic, which holds the same lock, never starts a chunk in a checkout while loop-claude does. +CLAIMS = f"{STATE_FOLDER}/build-release" +# The file an entry point keeps locked with flock while it lists the windows of a project's chunks and starts new ones. Two loops whose chunks finish together then don't start a chunk twice, and do-epic, which holds the same lock, never starts a chunk in a checkout while build-release does. LOCK = "starting" -# The flag that tells the entry point in a window its chunk, as `--chunk item-372` for loop-claude and `--chunk ABC-34 ABC-12` for do-epic. Nobody types it, so no panel picked it. +# The flag that tells the entry point in a window its chunk, as `--chunk item-372` for build-release and `--chunk ABC-34 ABC-12` for do-epic. Nobody types it, so no panel picked it. CHUNK_FLAG = "--chunk" # The prefix of the variables both entry points read. A window gets the tmux server's environment, not the starting terminal's, so they are handed to each window by name. -HANDED = "LOOP_CLAUDE_" +HANDED = "BUILD_RELEASE_" @contextlib.contextmanager @@ -53,12 +53,12 @@ def project_lock(root: str, home: pathlib.Path) -> pathlib.Path: def loop_session(root: str, home: pathlib.Path) -> str: - """The tmux session that holds the windows of loop-claude's chunks of the checkout root.""" + """The tmux session that holds the windows of build-release's chunks of the checkout root.""" return tmux.session_name(tmux.LOOP, project_key(root, home)) def loop_chunks(root: str, home: pathlib.Path, run: tmux.Tmux) -> list[tmux.Listed]: - """The windows of loop-claude's chunks that run in the checkout root. A session that runs another checkout's chunks under the same name doesn't hold any.""" + """The windows of build-release's chunks that run in the checkout root. A session that runs another checkout's chunks under the same name doesn't hold any.""" session = loop_session(root, home) running = [window for window in tmux.listed(session, run) if not window.dead] return running if running and tmux.owner(session, run) == root else [] diff --git a/bin/chunk_driver/drivers.py b/bin/chunk_driver/drivers.py index 07898a02..084b2af1 100644 --- a/bin/chunk_driver/drivers.py +++ b/bin/chunk_driver/drivers.py @@ -1,3 +1,3 @@ """The entry points that drive chunks, each by its name as its workers, its judge and the human read it. A prompt function that takes a driver takes one of these.""" -LOOP_CLAUDE = "loop-claude" +BUILD_RELEASE = "build-release" DO_EPIC = "do-epic" diff --git a/bin/chunk_driver/project/model_choice.py b/bin/chunk_driver/project/model_choice.py index 3f7ea701..a30c62a4 100644 --- a/bin/chunk_driver/project/model_choice.py +++ b/bin/chunk_driver/project/model_choice.py @@ -19,8 +19,8 @@ class Models: # The environment variables that name the judge's and the worker's model for one run, over the model saved or configured. -JUDGE_MODEL = "LOOP_CLAUDE_JUDGE_MODEL" -WORKER_MODEL = "LOOP_CLAUDE_WORKER_MODEL" +JUDGE_MODEL = "BUILD_RELEASE_JUDGE_MODEL" +WORKER_MODEL = "BUILD_RELEASE_WORKER_MODEL" # The file, in CLAIMS under the home folder, that save_model keeps locked with flock while it rereads and replaces the models file. The models file's own folder is a checkout of this setup, which takes no lock file. MODELS_LOCK = "models.lock" @@ -72,7 +72,7 @@ def save_model(project_key: str, chosen: str, paths: Paths, replace: typing.Call def read_models_file(saved: pathlib.Path) -> dict[str, str] | Failure: - """Each project's model, as the models file at saved maps them; none where there is no such file. The entry points, loop-claude and do-epic, and the replay tools read it.""" + """Each project's model, as the models file at saved maps them; none where there is no such file. The entry points, build-release and do-epic, and the replay tools read it.""" try: with open(saved, encoding="utf-8") as handle: models = json.load(handle) diff --git a/bin/chunk_driver/project/test_model_choice.py b/bin/chunk_driver/project/test_model_choice.py index 54562e26..d4b0e31e 100644 --- a/bin/chunk_driver/project/test_model_choice.py +++ b/bin/chunk_driver/project/test_model_choice.py @@ -12,7 +12,7 @@ sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[2])) from failure import Failure from loop_effects.doubles import FakeEffects -from chunk_driver.drivers import LOOP_CLAUDE +from chunk_driver.drivers import BUILD_RELEASE from chunk_driver.project import model_choice from loop_state.paths import paths_from from text_files.file_writes import replace_file @@ -22,8 +22,8 @@ from agent_cycle.stop import Stop class Overridden(unittest.TestCase): def test_the_environment_names_the_judges_or_the_workers_model_over_the_default(self): self.assertEqual(model_choice.overridden({}, "saved"), model_choice.Models("saved", "saved")) - self.assertEqual(model_choice.overridden({"LOOP_CLAUDE_JUDGE_MODEL": "j", "LOOP_CLAUDE_WORKER_MODEL": ""}, "saved"), model_choice.Models("j", "saved")) - self.assertEqual(model_choice.overridden({"LOOP_CLAUDE_JUDGE_MODEL": "j", "LOOP_CLAUDE_WORKER_MODEL": "w"}, "saved"), model_choice.Models("j", "w")) + self.assertEqual(model_choice.overridden({"BUILD_RELEASE_JUDGE_MODEL": "j", "BUILD_RELEASE_WORKER_MODEL": ""}, "saved"), model_choice.Models("j", "saved")) + self.assertEqual(model_choice.overridden({"BUILD_RELEASE_JUDGE_MODEL": "j", "BUILD_RELEASE_WORKER_MODEL": "w"}, "saved"), model_choice.Models("j", "w")) class ModelsOfARun(unittest.TestCase): @@ -36,39 +36,39 @@ class ModelsOfARun(unittest.TestCase): def test_a_run_that_names_both_models_reads_no_models_file_and_asks_nothing(self): self.paths.models_file.write_text("not json") fake = FakeEffects() - env = {"LOOP_CLAUDE_JUDGE_MODEL": "j", "LOOP_CLAUDE_WORKER_MODEL": "w"} - self.assertEqual(model_choice.get_or_ask_models("proj", self.paths, env, LOOP_CLAUDE, fake.effects()), model_choice.Models("j", "w")) + env = {"BUILD_RELEASE_JUDGE_MODEL": "j", "BUILD_RELEASE_WORKER_MODEL": "w"} + self.assertEqual(model_choice.get_or_ask_models("proj", self.paths, env, BUILD_RELEASE, fake.effects()), model_choice.Models("j", "w")) self.assertEqual(fake.calls, []) def test_a_run_that_names_one_model_takes_the_other_from_the_models_file(self): self.paths.models_file.write_text(json.dumps({"proj": "saved"})) fake = FakeEffects() - self.assertEqual(model_choice.get_or_ask_models("proj", self.paths, {"LOOP_CLAUDE_JUDGE_MODEL": "j"}, LOOP_CLAUDE, fake.effects()), model_choice.Models("j", "saved")) - self.assertEqual(model_choice.get_or_ask_models("proj", self.paths, {"LOOP_CLAUDE_WORKER_MODEL": "w"}, LOOP_CLAUDE, fake.effects()), model_choice.Models("saved", "w")) + self.assertEqual(model_choice.get_or_ask_models("proj", self.paths, {"BUILD_RELEASE_JUDGE_MODEL": "j"}, BUILD_RELEASE, fake.effects()), model_choice.Models("j", "saved")) + self.assertEqual(model_choice.get_or_ask_models("proj", self.paths, {"BUILD_RELEASE_WORKER_MODEL": "w"}, BUILD_RELEASE, fake.effects()), model_choice.Models("saved", "w")) self.assertEqual(fake.calls, []) def test_a_run_that_names_one_model_asks_for_the_projects_where_none_is_saved_and_saves_the_pick(self): fake, said = FakeEffects(inputs=["my-model"]), io.StringIO() with contextlib.redirect_stderr(said): - models = model_choice.get_or_ask_models("proj", self.paths, {"LOOP_CLAUDE_JUDGE_MODEL": "j"}, LOOP_CLAUDE, fake.effects()) + models = model_choice.get_or_ask_models("proj", self.paths, {"BUILD_RELEASE_JUDGE_MODEL": "j"}, BUILD_RELEASE, fake.effects()) self.assertEqual(models, model_choice.Models("j", "my-model")) self.assertEqual(json.loads(self.paths.models_file.read_text()), {"proj": "my-model"}) self.assertIn(" proj runs on my-model\n", said.getvalue()) def test_off_a_terminal_it_stops_naming_the_driver_to_rerun_and_the_file_to_merge_the_model_into(self): fake = FakeEffects(on_terminal=False) - stop = model_choice.get_or_ask_models("proj", self.paths, {}, LOOP_CLAUDE, fake.effects()) + stop = model_choice.get_or_ask_models("proj", self.paths, {}, BUILD_RELEASE, fake.effects()) assert isinstance(stop, Stop) self.assertEqual(stop.code, 2) self.assertIn(f"pick proj's model, or merge {{\"proj\": \"<model>\"}} into {self.paths.models_file}", stop.reason) - self.assertIn(LOOP_CLAUDE, stop.reason) + self.assertIn(BUILD_RELEASE, stop.reason) self.assertFalse(self.paths.models_file.exists()) def test_stops_with_exit_1_where_the_models_file_maps_no_projects_to_model_names(self): for held in ("[]", '{"proj": 5}', '{"proj": ""}'): with self.subTest(held=held): self.paths.models_file.write_text(held) - stop = model_choice.get_or_ask_models("proj", self.paths, {}, LOOP_CLAUDE, FakeEffects().effects()) + stop = model_choice.get_or_ask_models("proj", self.paths, {}, BUILD_RELEASE, FakeEffects().effects()) self.assertEqual(stop, Stop(1, f"could not read {self.paths.models_file}: not an object mapping projects to model names")) @@ -136,7 +136,7 @@ class SavingAModel(unittest.TestCase): return Failure("could not save") fake.replace_file = replace - self.assertEqual(model_choice.get_or_ask_model("proj", self.paths, LOOP_CLAUDE, fake.effects()), Stop(1, f"could not save the model in {self.paths.models_file}: could not save")) + self.assertEqual(model_choice.get_or_ask_model("proj", self.paths, BUILD_RELEASE, fake.effects()), Stop(1, f"could not save the model in {self.paths.models_file}: could not save")) self.assertEqual(held, [True]) @@ -155,10 +155,10 @@ class ModelPrompt(unittest.TestCase): def test_asks_again_until_an_answer_picks_a_model(self): with tempfile.TemporaryDirectory() as empty: fake = FakeEffects(inputs=["", "my-model"]) - self.assertEqual(model_choice.ask_for_model("proj", pathlib.Path("/m.json"), pathlib.Path(empty), LOOP_CLAUDE, fake.effects()), "my-model") + self.assertEqual(model_choice.ask_for_model("proj", pathlib.Path("/m.json"), pathlib.Path(empty), BUILD_RELEASE, fake.effects()), "my-model") self.assertEqual(len(fake.made("input")), 2) fake = FakeEffects(inputs=[EOFError()]) - self.assertEqual(model_choice.ask_for_model("proj", pathlib.Path("/m.json"), pathlib.Path(empty), LOOP_CLAUDE, fake.effects()), Stop(2, "the human is needed to pick proj's model, but the input ended")) + self.assertEqual(model_choice.ask_for_model("proj", pathlib.Path("/m.json"), pathlib.Path(empty), BUILD_RELEASE, fake.effects()), Stop(2, "the human is needed to pick proj's model, but the input ended")) if __name__ == "__main__": diff --git a/bin/chunk_driver/prompts.py b/bin/chunk_driver/prompts.py index 5718631c..04d4d2f4 100644 --- a/bin/chunk_driver/prompts.py +++ b/bin/chunk_driver/prompts.py @@ -1,4 +1,4 @@ -"""What every entry point says to the worker each cycle. model_routing.review_choice chooses where the reviews run. review_launches and reruns put that choice into sentences, and escalation says where escalated subagents run; rung_sentences returns the sentences of all three. An entry point places them in a chunk's first prompt, as loop-claude does in bin/loop_claude/chunk/fresh_prompt.py. rungs_held repeats them at the end of a prompt after a step-up or an unfinished verdict.""" +"""What every entry point says to the worker each cycle. model_routing.review_choice chooses where the reviews run. review_launches and reruns put that choice into sentences, and escalation says where escalated subagents run; rung_sentences returns the sentences of all three. An entry point places them in a chunk's first prompt, as build-release does in bin/build_release/chunk/fresh_prompt.py. rungs_held repeats them at the end of a prompt after a step-up or an unfinished verdict.""" import functools import typing @@ -70,7 +70,7 @@ def shared_launches(choice: ReviewChoice, route: Route, project: ProjectRung) -> def taken_in_launches(choice: ReviewChoice) -> list[str]: - """The sentence naming the reviewers' rung each higher E + I picks, so the worker reviews an item it takes in on that rung in the same run, since loop-claude reads a taken-in item's E + I only as the cycle ends, and routes on it from the next cycle. None where no higher E + I picks a higher rung. + """The sentence naming the reviewers' rung each higher E + I picks, so the worker reviews an item it takes in on that rung in the same run, since build-release reads a taken-in item's E + I only as the cycle ends, and routes on it from the next cycle. None where no higher E + I picks a higher rung. For a worker on the project's rung, routed by an item of E + I 6, it reads: `Where an item you take into the chunk has an E + I of 7 or more, launch each reviewer with the Agent tool set to `<rung>` from 7 and `<rung>` from 8.` """ @@ -93,7 +93,7 @@ def escalation(driver: str, route: Route, project: ProjectRung | None) -> list[s """The prompt's escalation sentences, the marker's among them. None off the ladder or on its top rung. Where escalation_rungs opens none, the worker escalates only with the human's yes. Else they name the rungs escalation_rungs opens to a subagent, and offer to resume the worker one rung up for the rest of the chunk, up to the highest of those rungs. - For a worker one rung above the project's, routed by item 3 of L 3, they read: `When an escalation trigger in the setup's `CLAUDE.md` fires, hand the hard part of the task to a subagent with the Agent tool set to `<rung>`, one rung above yours, and on each further trigger one rung higher, up to `<rung>`; above that, ask the human first.`, `Open the subagent's prompt with `Escalation trigger <n>:`, n the trigger's number.` and `Where the hard part is the rest of the chunk, end your run instead, asking loop-claude for a higher rung and naming a trigger that fired since your last step-up, if any: once the judge finds it in your transcript, the next cycle resumes you one rung up, up to `<rung>`.` + For a worker one rung above the project's, routed by item 3 of L 3, they read: `When an escalation trigger in the setup's `CLAUDE.md` fires, hand the hard part of the task to a subagent with the Agent tool set to `<rung>`, one rung above yours, and on each further trigger one rung higher, up to `<rung>`; above that, ask the human first.`, `Open the subagent's prompt with `Escalation trigger <n>:`, n the trigger's number.` and `Where the hard part is the rest of the chunk, end your run instead, asking build-release for a higher rung and naming a trigger that fired since your last step-up, if any: once the judge finds it in your transcript, the next cycle resumes you one rung up, up to `<rung>`.` """ if project is None or route.rung not in project.ladder.rungs[:-1]: return [] @@ -154,5 +154,5 @@ class RecordNames(typing.NamedTuple): def worker_prompts(driver: str, fresh: typing.Callable[[str, str, Route, ProjectRung | None, str], str], naming: str, names: RecordNames = RecordNames()) -> WorkerPrompts: - """The prompts of an entry point's cycles: its own fresh prompt, and the resumed prompt and rung sentences every entry point shares, each naming driver. resumed says what naming is. names is loop-claude's unless the entry point keeps records elsewhere, as do-epic does.""" + """The prompts of an entry point's cycles: its own fresh prompt, and the resumed prompt and rung sentences every entry point shares, each naming driver. resumed says what naming is. names is build-release's unless the entry point keeps records elsewhere, as do-epic does.""" return WorkerPrompts(driver, fresh, functools.partial(resumed, driver, naming), functools.partial(rungs_held, driver), *names) diff --git a/bin/chunk_driver/test_cycle_start.py b/bin/chunk_driver/test_cycle_start.py index 182f87f3..f27b2a4f 100644 --- a/bin/chunk_driver/test_cycle_start.py +++ b/bin/chunk_driver/test_cycle_start.py @@ -75,7 +75,7 @@ class ProjectRouting(unittest.TestCase): self.paths.models_file.write_text(json.dumps({"acme": "claude-opus-5-5"})) shipped = read_ladder(SHIPPED) self.assertEqual(self.routing(), cycle_start.Routing(Models("claude-opus-5-5", "claude-opus-5-5"), shipped, SHIPPED)) - self.assertEqual(self.routing(env={"LOOP_CLAUDE_JUDGE_MODEL": "j"}), cycle_start.Routing(Models("j", "claude-opus-5-5"), shipped, SHIPPED)) + self.assertEqual(self.routing(env={"BUILD_RELEASE_JUDGE_MODEL": "j"}), cycle_start.Routing(Models("j", "claude-opus-5-5"), shipped, SHIPPED)) own = self.config / "routing-ladder.json" own.write_text('[{"model": "claude-fable-5-2", "effort": "low"}]', encoding="utf-8") routing = self.routing() diff --git a/bin/chunk_driver/this_loop.py b/bin/chunk_driver/this_loop.py index ea62dff3..c42a0d10 100644 --- a/bin/chunk_driver/this_loop.py +++ b/bin/chunk_driver/this_loop.py @@ -10,8 +10,8 @@ from agent_cycle.tmux import Window @dataclasses.dataclass(frozen=True) class Loop: - """What stays the same while an entry point drives one chunk in one process. loop-claude builds it once per process, so a reload builds it afresh; do-epic builds one per chunk.""" - # The checkout the loop runs in. loop-claude's LoopRun.root names it too, since a reload hands it on there. + """What stays the same while an entry point drives one chunk in one process. build-release builds it once per process, so a reload builds it afresh; do-epic builds one per chunk.""" + # The checkout the loop runs in. build-release's LoopRun.root names it too, since a reload hands it on there. root: str # The worker's session. session: Session @@ -19,6 +19,6 @@ class Loop: window: Window paths: Paths env: typing.Mapping[str, str] - # The entry point's script, beside which chunk-preflight lies; an edit of loop-claude's reloads its loop. + # The entry point's script, beside which chunk-preflight lies; an edit of build-release's reloads its loop. launcher: pathlib.Path effects: Effects diff --git a/bin/chunk_preflight/main.py b/bin/chunk_preflight/main.py index 16314e6d..e5b798d1 100644 --- a/bin/chunk_preflight/main.py +++ b/bin/chunk_preflight/main.py @@ -4,10 +4,10 @@ usage: chunk-preflight [--worktree] [--item <ID>] Run it inside a project checkout. It fetches origin, when the checkout has that remote, and takes origin's default branch, or else the local main or master. Without --worktree, it still fetches, -but it doesn't make a worktree or a branch, and doesn't run any tool in one. loop-claude runs it +but it doesn't make a worktree or a branch, and doesn't run any tool in one. build-release runs it with --worktree at the checkout root before each chunk's first worker, before it routes the chunk, and quotes what it prints in the worker's prompt. It leaves the checkout as it is, and reads -todo.md as the default branch holds it, the plan loop-claude routes on. Where the project's config +todo.md as the default branch holds it, the plan build-release routes on. Where the project's config puts todo.md or CHANGELOG.md outside the checkout, it reads that file as it stands. Such a plan no longer names a release whose last item has shipped, so chunk-preflight doesn't see that release, and prints that the release reviews and the cuts are the human's to call. It prints: @@ -27,8 +27,8 @@ and prints that the release reviews and the cuts are the human's to call. It pri formatter setting (`rustfmt.toml` `hard_tabs`, Prettier `useTabs`, Biome `indentStyle`) sets the indent, one line naming the technical principles' hard-tabs default and the two ways out. It reports only, and never fails the run; -- the next release and its first item that does not wait, the item loop-claude routes on, with its L - and E + I; with --item <ID>, the plan item of that ID instead, which loop-claude names in a window +- the next release and its first item that does not wait, the item build-release routes on, with its L + and E + I; with --item <ID>, the plan item of that ID instead, which build-release names in a window named for an item. An item waits while it is marked question, while an item still in todo.md blocks it, or while it awaits such a merge. Where the last cut is a version x.y.z, the next release is the earliest after x.y.z that todo.md has named at that cut or since, less a release its ## Renamed section marks renamed. diff --git a/bin/chunk_preflight/test_chunk_preflight.py b/bin/chunk_preflight/test_chunk_preflight.py index ca8cd5fd..8df35c79 100644 --- a/bin/chunk_preflight/test_chunk_preflight.py +++ b/bin/chunk_preflight/test_chunk_preflight.py @@ -96,7 +96,7 @@ class Repo: (self.fake / name).write_text(script) (self.fake / name).chmod(0o755) (self.fake / "git").symlink_to(shutil.which("git")) - self.env = {**isolated_env(), "GIT_CONFIG_GLOBAL": os.devnull, "GIT_CONFIG_NOSYSTEM": "1", "HOME": str(self.temp / "home"), "PATH": str(self.fake), "LOOP_CLAUDE_TRANSCRIPTS": str(self.temp / "archive")} + self.env = {**isolated_env(), "GIT_CONFIG_GLOBAL": os.devnull, "GIT_CONFIG_NOSYSTEM": "1", "HOME": str(self.temp / "home"), "PATH": str(self.fake), "BUILD_RELEASE_TRANSCRIPTS": str(self.temp / "archive")} self.git(self.temp, "init", "--quiet", "--bare", "--initial-branch=main", str(self.origin)) self.git(self.temp, "clone", "--quiet", str(self.origin), str(self.root)) write_config(self.temp / "home", self.root) @@ -163,7 +163,7 @@ elif args[:6] == ["pr", "list", "--head", "item-2", "--state", "merged"]: self.assertEqual(done.returncode, 0, done.stderr) self.assertIn(f"- The worktree {repo.temp}/proj-item-2, on the branch item-2, is left from pull request #11, which has merged: run `chunk-pr clean` in it as this chunk's first step.\n", done.stdout) self.assertNotIn("proj-item-3, on the branch", done.stdout, "an open pull request leaves no worktree to clean") - self.assertIn("No plan item: every item of release 0.2.0 in origin/main's todo.md waits. Under `merge = \"human\"`, these pull requests await a person's merge: #12 https://github.com/o/r/pull/12, which finishes item 3. The working loop stops here. Once a person has merged one, or turned one back into a draft, run loop-claude again.", done.stdout) + self.assertIn("No plan item: every item of release 0.2.0 in origin/main's todo.md waits. Under `merge = \"human\"`, these pull requests await a person's merge: #12 https://github.com/o/r/pull/12, which finishes item 3. The working loop stops here. Once a person has merged one, or turned one back into a draft, run build-release again.", done.stdout) (repo.fake / "gh").write_text("#!/bin/sh\necho 'not logged in' >&2\nexit 1\n") unread = repo.preflight() self.assertIn("- The pull requests that await a person's merge cannot be read, so no item is passed over for one: gh pr list: not logged in\n", unread.stdout) diff --git a/bin/claude_code/entries.py b/bin/claude_code/entries.py index 1d5aced4..62749f52 100644 --- a/bin/claude_code/entries.py +++ b/bin/claude_code/entries.py @@ -34,7 +34,7 @@ class HumanTurn(UserText): class LoopPrompt(UserText): - """What loop-claude told the worker in a -p prompt.""" + """What build-release told the worker in a -p prompt.""" class InjectedText(UserText): diff --git a/bin/claude_code/output_limits.py b/bin/claude_code/output_limits.py index 0d683b06..a283adbf 100644 --- a/bin/claude_code/output_limits.py +++ b/bin/claude_code/output_limits.py @@ -1,4 +1,4 @@ -"""The environment variables that cut what one tool result adds to a claude's context: the Bash ceiling loop-claude hands the worker's claude, and the Read limit that review-replay tests for it. Their values: docs/decisions.md β†’ `loop-claude: the worker's claude saves a Bash result of more than 6,000 characters to a file, and rule-hook refuses a Read of a session transcript`. +"""The environment variables that cut what one tool result adds to a claude's context: the Bash ceiling build-release hands the worker's claude, and the Read limit that review-replay tests for it. Their values: docs/decisions.md β†’ `build-release: the worker's claude saves a Bash result of more than 6,000 characters to a file, and rule-hook refuses a Read of a session transcript`. A subagent inherits both variables, so the ceiling reaches every reviewer the worker launches.""" diff --git a/bin/claude_code/reply.py b/bin/claude_code/reply.py index 3250478d..704951de 100644 --- a/bin/claude_code/reply.py +++ b/bin/claude_code/reply.py @@ -1,4 +1,4 @@ -"""One `claude -p --output-format stream-json` run, as loop-claude's judge and the replays start it.""" +"""One `claude -p --output-format stream-json` run, as build-release's judge and the replays start it.""" import dataclasses import subprocess import typing diff --git a/bin/claude_code/transcript.py b/bin/claude_code/transcript.py index 423e492f..13c4336c 100644 --- a/bin/claude_code/transcript.py +++ b/bin/claude_code/transcript.py @@ -11,7 +11,7 @@ JUDGED_TOOL_INPUT = 400 class Typed(typing.NamedTuple): - """A -p prompt of loop-claude's that carries an answer the human typed: loop-claude's words, and that answer.""" + """A -p prompt of build-release's that carries an answer the human typed: build-release's words, and that answer.""" loop_words: str answer: str @@ -50,7 +50,7 @@ def human_turns(entries: list[Entry]) -> int: def render(entries: list[Entry], typed_answer: typing.Callable[[str], Typed | None]) -> str: - """The transcript as the judge reads it. typed_answer splits the answer the human typed out of a -p prompt of loop-claude's, so that answer reads as the human's, like one typed in claude.""" + """The transcript as the judge reads it. typed_answer splits the answer the human typed out of a -p prompt of build-release's, so that answer reads as the human's, like one typed in claude.""" lines = [] for entry in entries: if isinstance(entry, AssistantTurn): diff --git a/bin/command_patterns/main.py b/bin/command_patterns/main.py index e7f29d69..79c2f2ee 100644 --- a/bin/command_patterns/main.py +++ b/bin/command_patterns/main.py @@ -2,7 +2,7 @@ usage: command-patterns [<version>] [--calls <file>] -Run it inside a project checkout or one of its worktrees. It reads loop-claude's archive of the +Run it inside a project checkout or one of its worktrees. It reads build-release's archive of the project, as reading-cost does, and takes each chunk that finished in the release's window: after the tag before v<version> and up to v<version>'s own tag, by their tag dates. Without <version>, it takes the chunks finished since the highest v* tag, the release not yet cut. It reads the worker's diff --git a/bin/compress_archives/main.py b/bin/compress_archives/main.py index 0c6fa748..8cdc6bdc 100644 --- a/bin/compress_archives/main.py +++ b/bin/compress_archives/main.py @@ -1,9 +1,9 @@ -"""Gzip each file of loop-claude's archive and the review folders that no tool changes any more, keeping all of them. +"""Gzip each file of build-release's archive and the review folders that no tool changes any more, keeping all of them. usage: compress-archives -It gzips each file that last changed over 30 days ago: in loop-claude's archive, -$LOOP_CLAUDE_TRANSCRIPTS (default ~/.claude/loop-claude-transcripts), each transcript, *.jsonl; +It gzips each file that last changed over 30 days ago: in build-release's archive, +$BUILD_RELEASE_TRANSCRIPTS (default ~/.claude/loop-claude-transcripts), each transcript, *.jsonl; in the review folders, ~/.local/state/larv-review, every file but a lock, *.lock. A file's last change is the later of its mtime and ctime, so a copied or unpacked file counts from when it landed. @@ -24,7 +24,7 @@ from failure import Failure from review_rules.review_folder import REPORTS from text_files.compressed import SUFFIX -# Why 30 days: docs/decisions.md β†’ `archives: gzip each transcript in loop-claude's archive and each file in the review folders 30 days after it last changed, keeping all of them`. +# Why 30 days: docs/decisions.md β†’ `archives: gzip each transcript in build-release's archive and each file in the review folders 30 days after it last changed, keeping all of them`. AGE_DAYS = 30 diff --git a/bin/compress_archives/test_compress_archives.py b/bin/compress_archives/test_compress_archives.py index 91dd22a2..74f3e80e 100644 --- a/bin/compress_archives/test_compress_archives.py +++ b/bin/compress_archives/test_compress_archives.py @@ -101,10 +101,10 @@ class Main(unittest.TestCase): root = mock.Mock(**{"rglob.return_value": [packed, link, gone, kept]}) self.assertEqual(main.old_files(root, "*.jsonl", NOW), [kept]) - def test_reads_the_archive_where_loop_claude_transcripts_puts_it(self): + def test_reads_the_archive_where_build_release_transcripts_puts_it(self): moved = self.home / "elsewhere" (self.home / ".claude" / "loop-claude-transcripts").rename(moved) - code, _, err = self.run_main(env={"LOOP_CLAUDE_TRANSCRIPTS": str(moved)}) + code, _, err = self.run_main(env={"BUILD_RELEASE_TRANSCRIPTS": str(moved)}) self.assertEqual((code, err), (0, "")) self.assertTrue((moved / "proj" / "c1" / "a.jsonl.gz").is_file()) diff --git a/bin/deploy_release/main.py b/bin/deploy_release/main.py index ed173dc0..d449c604 100644 --- a/bin/deploy_release/main.py +++ b/bin/deploy_release/main.py @@ -48,7 +48,7 @@ alone. Name the commits the fix's chunk merged, including the one that finished under ## Unreleased in CHANGELOG.md become the release's. Each commit must be on origin's main and not in the tag. Merge commits are left out, and so are the commits a merge of main brought into the range. todo.md must name the release and file no item under it; a patch skips the release review. Cut it as soon as the fix merges: until then chunk-preflight calls -the patch's release review due, and loop-claude would run it. It refuses without changing anything where any of that +the patch's release review due, and build-release would run it. It refuses without changing anything where any of that doesn't hold, and on a GitHub origin, whose rebase merge would drop the tag from main's history. 1. It says on stderr which commits the release ships. 2. In a worktree of its own at the tag, it applies each commit's changes, except to CHANGELOG.md, todo.md, diff --git a/bin/do_epic/chunk_prompt.py b/bin/do_epic/chunk_prompt.py index 887400e5..f160236e 100644 --- a/bin/do_epic/chunk_prompt.py +++ b/bin/do_epic/chunk_prompt.py @@ -1,4 +1,4 @@ -"""What a do-epic cycle's worker is told: its task, from the issue, and its first prompt. The resumed prompt and the rung sentences are the ones loop-claude's cycles use, naming do-epic; a chunk that was parked is first told why it resumes, and one whose task follows the epic's state is told that task as it resumes.""" +"""What a do-epic cycle's worker is told: its task, from the issue, and its first prompt. The resumed prompt and the rung sentences are the ones build-release's cycles use, naming do-epic; a chunk that was parked is first told why it resumes, and one whose task follows the epic's state is told that task as it resumes.""" import dataclasses from chunk_driver.drivers import DO_EPIC diff --git a/bin/do_epic/epic_run.py b/bin/do_epic/epic_run.py index 191b7d56..fd05e869 100644 --- a/bin/do_epic/epic_run.py +++ b/bin/do_epic/epic_run.py @@ -79,5 +79,5 @@ def scheduled_epic(epic: EpicRun, order: tuple[str, ...]) -> scheduler.Epic | Fa def real(checkout: pathlib.Path) -> pathlib.Path: - """The checkout as loop-claude names it, which is as git does: through no symlink or `..`. Each keys the checkout's lock and its chunks by that path, so a project config that spells it another way hides neither from the other.""" + """The checkout as build-release names it, which is as git does: through no symlink or `..`. Each keys the checkout's lock and its chunks by that path, so a project config that spells it another way hides neither from the other.""" return checkout.resolve() diff --git a/bin/do_epic/main.py b/bin/do_epic/main.py index ab1ba1a7..015f60d7 100644 --- a/bin/do_epic/main.py +++ b/bin/do_epic/main.py @@ -1,6 +1,6 @@ """The do-epic command (docs/decisions.md β†’ `do-epic: drives one Jira epic …`). -`do-epic <EPIC-KEY>` first plans the epic's open issues (`planning`): each that no label places is split by repo or gets its pick, and the scored issues do-epic filed are re-ranked. Then it moves each parent whose sub-tasks a person filed, where those sub-tasks have landed or are done (`parent_moves`). Then it starts each of the epic's chunks that may start now, each in a window of the epic's tmux session, as `scheduler` picks them, and puts that session on the terminal. Each window runs `do-epic --chunk <ISSUE-KEY> <EPIC-KEY>`: the cycles of one issue's chunk, run by the code that runs loop-claude's (`agent_cycle`), until the judge rules it finished. Then it starts the chunks that may start now, and its window closes. The window of a human's task runs no cycle: it waits until the task no longer holds up an issue (`human_tasks`), then does the same. +`do-epic <EPIC-KEY>` first plans the epic's open issues (`planning`): each that no label places is split by repo or gets its pick, and the scored issues do-epic filed are re-ranked. Then it moves each parent whose sub-tasks a person filed, where those sub-tasks have landed or are done (`parent_moves`). Then it starts each of the epic's chunks that may start now, each in a window of the epic's tmux session, as `scheduler` picks them, and puts that session on the terminal. Each window runs `do-epic --chunk <ISSUE-KEY> <EPIC-KEY>`: the cycles of one issue's chunk, run by the code that runs build-release's (`agent_cycle`), until the judge rules it finished. Then it starts the chunks that may start now, and its window closes. The window of a human's task runs no cycle: it waits until the task no longer holds up an issue (`human_tasks`), then does the same. After each cycle of a chunk in a repo, the window reads what the chunk's pull request waits on (`gates`). While that is a gate only time or a person passes, the chunk is parked (`parked`): the window frees its running slot and polls the forge, and the chunk's next cycle starts once the worker has something to do and a slot is free. `do-epic <EPIC-KEY> --status` prints what each open issue does.""" import dataclasses @@ -62,7 +62,7 @@ An open issue labelled `repo:<name>` or `do-epic-claude` runs as a chunk once no The issues start in order of score, highest first, whatever their order on the board. An issue it could not score starts after the others. As its chunk starts, an issue is assigned in Jira to the account do-epic works as, unless someone else holds it. Where config.toml names a start transition or a sprint board, the issue is also moved by that transition and joins that board's active sprint. A `do-epic-human` issue that blocks another gets a window too. The window DMs you once, then waits without taking a place until you close the issue in Jira. As many run at once as the epic's description allows with a line such as `**Max parallel chunks:** 2`, one where it has none. -A repo takes as many chunks as its `parallel-chunks`, and none while loop-claude runs chunks in it. +A repo takes as many chunks as its `parallel-chunks`, and none while build-release runs chunks in it. A chunk whose worker ends its run while its pull request waits on its checks, an approval or a new review is parked: it frees its place for the next chunk, and its window's name says what it awaits. Its worker goes on once the checks pass, the approval comes or a reviewer comments, and a place is free; until one is, the @@ -74,7 +74,7 @@ A repo that is missing isn't cloned. Planning then stops there, so its writes ar {findings.HELP} {finish.HELP} The Jira site and its credentials are set in ~/.claude-projects/do-epic/config.toml.""" -# Under the home folder, where a chunk's cycles are archived, a folder per epic. It is not loop-claude's archive, since that archive's readers, such as judge-replay and the routing figures, read loop-claude's prompts. +# Under the home folder, where a chunk's cycles are archived, a folder per epic. It is not build-release's archive, since that archive's readers, such as judge-replay and the routing figures, read build-release's prompts. ARCHIVE = f"{CLAUDE_HOME}/do-epic-transcripts" # The flag that prints what each open issue does. STATUS_FLAG = "--status" @@ -102,7 +102,7 @@ def main(argv: list[str], env: typing.Mapping[str, str], paths: Paths, launcher: raise if stop.reason: say(stop.reason, effects, stdout=not stop.code) - # A chunk's stop is DMed, as loop-claude's is, so a chunk left overnight never ends unseen. + # A chunk's stop is DMed, as build-release's is, so a chunk left overnight never ends unseen. if stop.reason and argv[:1] == [CHUNK_FLAG]: tell(f"do-epic {' '.join(argv)} stopped: {stop.reason}", effects) return stop.code @@ -538,7 +538,7 @@ def chunk_work(key: str, checkout: str | None, language: str, epic: EpicRun) -> def repoless_models(epic: EpicRun) -> Models: - """The models of a chunk without a repo: `repoless-model`, unless the environment names another for the run, as it may for loop-claude.""" + """The models of a chunk without a repo: `repoless-model`, unless the environment names another for the run, as it may for build-release.""" return overridden(epic.env, epic.config.repoless_model) diff --git a/bin/do_epic/scheduler.py b/bin/do_epic/scheduler.py index 0e3db9c4..ebcbc093 100644 --- a/bin/do_epic/scheduler.py +++ b/bin/do_epic/scheduler.py @@ -1,6 +1,6 @@ """Which of an epic's issues run as chunks now, each in its own window of the epic's tmux session (docs/decisions.md β†’ `do-epic: drives one Jira epic …`). -Three limits hold a chunk back: the epic's cap of chunks at once, its repo's `parallel-chunks`, counted across every epic, and a loop-claude that runs chunks in its repo. A parked chunk (`parked`) counts toward none of them: its window only polls the forge, and `resume` gives it a running slot under the same limits once its worker has something to do. do-epic checks a repo and starts a chunk in it while holding the lock loop-claude holds when it starts one (`chunk_driver.claims.starting`), so the two never start chunks in one checkout together.""" +Three limits hold a chunk back: the epic's cap of chunks at once, its repo's `parallel-chunks`, counted across every epic, and a build-release that runs chunks in its repo. A parked chunk (`parked`) counts toward none of them: its window only polls the forge, and `resume` gives it a running slot under the same limits once its worker has something to do. do-epic checks a repo and starts a chunk in it while holding the lock build-release holds when it starts one (`chunk_driver.claims.starting`), so the two never start chunks in one checkout together.""" import dataclasses import pathlib import typing @@ -57,8 +57,8 @@ class RepoRoom: limit: int # How many chunks of any epic run there. running: int - # Whether a loop-claude runs chunks there. - loop_claude: bool + # Whether a build-release runs chunks there. + build_release: bool @dataclasses.dataclass(frozen=True) @@ -163,8 +163,8 @@ def turn_of(issue: EpicIssue, pick: Pick | None | Failure, blocking: list[str], def refusal(repo: str, room: RepoRoom) -> str | None: """Why the repo takes no further chunk; None where it takes one.""" - if room.loop_claude: - return f"loop-claude runs chunks in {repo}" + if room.build_release: + return f"build-release runs chunks in {repo}" if room.running >= room.limit: return f"{repo} runs as many chunks as its `{PARALLEL_CHUNKS}` allows: {room.limit}" return None diff --git a/bin/do_epic/test_main.py b/bin/do_epic/test_main.py index 0c13cb5f..c461eaf7 100644 --- a/bin/do_epic/test_main.py +++ b/bin/do_epic/test_main.py @@ -141,12 +141,12 @@ class TheCommand(DoEpicTest): def test_starts_the_chunks_and_says_why_each_other_issue_waits(self) -> None: fake = FakeEffects(on_terminal=False) - code, out, _ = self.run_main(["ABC-12"], fake, {"LOOP_CLAUDE_WORKER_MODEL": "m"}) + code, out, _ = self.run_main(["ABC-12"], fake, {"BUILD_RELEASE_WORKER_MODEL": "m"}) self.assertEqual(code, 0) self.assertIn("started ABC-21 in the tmux session epic-ABC-12\n", out) self.assertIn("ABC-20 waits: it is a human's task\n", out) started = [args for args in fake.tmux_calls if args[0] == "new-session"] - self.assertEqual(started, [["new-session", "-d", "-s", "epic-ABC-12", "-n", "ABC-21", "-c", str(self.home / ".local/state/do-epic/ABC-12"), "-e", "LOOP_CLAUDE_WORKER_MODEL=m", "-e", "CHUNK_PR_PARKS=1", "-P", "-F", "#{window_id}", "--", "/b/do-epic", "--chunk", "ABC-21", "ABC-12"]]) + self.assertEqual(started, [["new-session", "-d", "-s", "epic-ABC-12", "-n", "ABC-21", "-c", str(self.home / ".local/state/do-epic/ABC-12"), "-e", "BUILD_RELEASE_WORKER_MODEL=m", "-e", "CHUNK_PR_PARKS=1", "-P", "-F", "#{window_id}", "--", "/b/do-epic", "--chunk", "ABC-21", "ABC-12"]]) # The session is no checkout's, so nothing marks it as one's. self.assertNotIn(tmux.OWNER, [args[3] for args in fake.tmux_calls if args[0] == "set-option"]) @@ -228,8 +228,8 @@ class ACycleOfAChunkWithoutARepo(DoEpicTest): self.assertEqual(cycle.project.rung.model, "claude-opus-5-5") self.assertEqual(cycle.route, Route(cycle.project.worker_rung(3), 21, 3, 5)) self.assertEqual(cycle.judge.model, "claude-opus-5-5") - self.assertEqual(self.cycle({"LOOP_CLAUDE_WORKER_MODEL": "off-the-ladder"}).route, Route(Rung("off-the-ladder"))) - self.assertEqual(self.cycle({"LOOP_CLAUDE_JUDGE_MODEL": "claude-fable-5-2"}).judge.model, "claude-fable-5-2") + self.assertEqual(self.cycle({"BUILD_RELEASE_WORKER_MODEL": "off-the-ladder"}).route, Route(Rung("off-the-ladder"))) + self.assertEqual(self.cycle({"BUILD_RELEASE_JUDGE_MODEL": "claude-fable-5-2"}).judge.model, "claude-fable-5-2") def test_keeps_the_route_and_the_evidence_its_run_holds(self) -> None: kept = Route(Rung("claude-opus-5-5", "xhigh"), 21, 3, 5) @@ -241,7 +241,7 @@ class ACycleOfAChunkWithoutARepo(DoEpicTest): self.assertIs(cycle.prompts, chunk_prompt.WORKER) self.assertEqual(cycle.facts, "") - def test_works_in_the_epics_folder_and_archives_apart_from_loop_claude(self) -> None: + def test_works_in_the_epics_folder_and_archives_apart_from_build_release(self) -> None: cycle = self.cycle() self.assertEqual((cycle.root, cycle.project_archive, cycle.records), (str(self.home / ".local/state/do-epic/ABC-12"), self.home / ".claude/do-epic-transcripts/ABC-12", "")) @@ -275,7 +275,7 @@ class ACycleOfAChunkWithoutARepo(DoEpicTest): UNREAD = [Failure("no git")] * 20 -MODELS = {"LOOP_CLAUDE_JUDGE_MODEL": "claude-opus-5-5", "LOOP_CLAUDE_WORKER_MODEL": "claude-opus-5-5", "TMUX_PANE": "%1"} +MODELS = {"BUILD_RELEASE_JUDGE_MODEL": "claude-opus-5-5", "BUILD_RELEASE_WORKER_MODEL": "claude-opus-5-5", "TMUX_PANE": "%1"} class TheHumansRun(DoEpicTest): @@ -351,7 +351,7 @@ class TheHumansRun(DoEpicTest): clones = [what for seam, what in fake.calls if seam == "git" and "clone" in what] self.assertEqual([what[what.index("--") + 1:] for what in clones], [["git@host.example:team/web", str(self.home / "code/web")]]) - def test_names_a_checkout_as_loop_claude_does_whatever_way_its_config_spells_it(self) -> None: + def test_names_a_checkout_as_build_release_does_whatever_way_its_config_spells_it(self) -> None: real = self.home / "code" / "api" real.mkdir(parents=True) (self.home / "work").mkdir() @@ -428,7 +428,7 @@ class AChunksRun(DoEpicTest): judged_with = [" ".join(what[0]) + (what[1] or "") for seam, what in fake.calls if seam == "claude"] self.assertEqual((len(prompts), len(judged_with)), (3, 3)) for text in (*prompts, *judged_with, *fake.dms, *[str(what) for seam, what in fake.calls if seam == "input"]): - self.assertNotIn("loop-claude", text) + self.assertNotIn("build-release", text) self.assertNotIn("None", text) self.assertIn(" do-epic runs you on claude-", prompts[1]) self.assertIn("The human answered your question at do-epic's terminal:\nUse B.", prompts[2]) @@ -699,7 +699,7 @@ class AChunksRun(DoEpicTest): class WhatAWorkerJudgeAndHumanRead(DoEpicTest): - def test_every_prompt_names_do_epic_and_never_loop_claude(self) -> None: + def test_every_prompt_names_do_epic_and_never_build_release(self) -> None: cycle = ACycleOfAChunkWithoutARepo.cycle(self) # type: ignore[arg-type] prompts = cycle.prompts texts = [ @@ -710,7 +710,7 @@ class WhatAWorkerJudgeAndHumanRead(DoEpicTest): str(judge.judge_schema(prompts.driver)), ] for text in texts: - self.assertNotIn("loop-claude", text) + self.assertNotIn("build-release", text) self.assertIn(f"do-epic runs you on {cycle.route.rung}, routed by the issue's L of 3. Where a sentence below names item 21, it means the issue.", texts[0]) self.assertRegex(texts[0], r"it means the issue\.( \S|\n\n)") self.assertNotIn("Chunk items:", texts[1]) diff --git a/bin/do_epic/test_scheduler.py b/bin/do_epic/test_scheduler.py index fdd68c0a..a7bc8e34 100644 --- a/bin/do_epic/test_scheduler.py +++ b/bin/do_epic/test_scheduler.py @@ -155,14 +155,14 @@ class WhichIssuesAreChunks(unittest.TestCase): class RoomInARepo(unittest.TestCase): - def test_a_repo_with_room_and_no_loop_claude_takes_a_chunk(self) -> None: - self.assertIsNone(refusal("api", RepoRoom(limit=2, running=1, loop_claude=False))) + def test_a_repo_with_room_and_no_build_release_takes_a_chunk(self) -> None: + self.assertIsNone(refusal("api", RepoRoom(limit=2, running=1, build_release=False))) def test_a_full_repo_takes_none(self) -> None: - self.assertEqual(refusal("api", RepoRoom(limit=2, running=2, loop_claude=False)), "api runs as many chunks as its `parallel-chunks` allows: 2") + self.assertEqual(refusal("api", RepoRoom(limit=2, running=2, build_release=False)), "api runs as many chunks as its `parallel-chunks` allows: 2") - def test_a_repo_loop_claude_runs_chunks_in_takes_none(self) -> None: - self.assertEqual(refusal("api", RepoRoom(limit=2, running=0, loop_claude=True)), "loop-claude runs chunks in api") + def test_a_repo_build_release_runs_chunks_in_takes_none(self) -> None: + self.assertEqual(refusal("api", RepoRoom(limit=2, running=0, build_release=True)), "build-release runs chunks in api") class Tmux: @@ -210,7 +210,7 @@ class StartingAnEpicsChunks(unittest.TestCase): """An epic whose repos are checked out under the home folder, each with its `parallel-chunks`.""" def locate(name: str) -> tuple[pathlib.Path, int] | Failure: return (self.home / "code" / name, limits[name]) if name in limits else Failure(f"no project config names {name}") - return Epic("ABC-12", cap, locate, self.home, pathlib.Path("/bin/do-epic"), {"LOOP_CLAUDE_X": "1", "OTHER": "2"}, {}, self.order) + return Epic("ABC-12", cap, locate, self.home, pathlib.Path("/bin/do-epic"), {"BUILD_RELEASE_X": "1", "OTHER": "2"}, {}, self.order) def start(self, epic: Epic, issues: list[EpicIssue], run: Tmux, own: str | None = None) -> Started: found = start_chunks(epic, issues, False, own, run) @@ -223,7 +223,7 @@ class StartingAnEpicsChunks(unittest.TestCase): self.assertEqual(found, Started(["ABC-20", "ABC-21"], [Waits("ABC-22", "the epic runs as many chunks as its `**Max parallel chunks:**` line allows: 2")])) self.assertEqual(run.started(), [("epic-ABC-12", "ABC-20", f"{CHUNK_FLAG} ABC-20 ABC-12"), ("epic-ABC-12", "ABC-21", f"{CHUNK_FLAG} ABC-21 ABC-12")]) self.assertEqual([args[args.index("-c") + 1] for args in run.calls if args[0] in ("new-session", "new-window")], [str(self.home / "code/api"), str(self.home / ".local/state/do-epic/ABC-12")]) - self.assertIn("LOOP_CLAUDE_X=1", run.calls[[args[0] for args in run.calls].index("new-session")]) + self.assertIn("BUILD_RELEASE_X=1", run.calls[[args[0] for args in run.calls].index("new-session")]) self.assertNotIn("OTHER=2", run.calls[[args[0] for args in run.calls].index("new-session")]) def parked(self, issue_key: str, on: str = "an approval") -> None: @@ -325,7 +325,7 @@ class StartingAnEpicsChunks(unittest.TestCase): cases = { "the epic runs as many chunks as its `**Max parallel chunks:**` line allows: 1": (self.epic(1, api=2), Tmux(parked, ("epic-ABC-12", "ABC-21", False, str(self.home / "code/web")))), "api runs as many chunks as its `parallel-chunks` allows: 1": (self.epic(2, api=1), Tmux(parked, ("epic-XYZ-1", "XYZ-5", False, str(self.home / "code/api")))), - "loop-claude runs chunks in api": (self.epic(2, api=1), Tmux(parked, ("loop-api", "item-3", False, str(self.home / "code/api")), owners={"loop-api": str(self.home / "code/api")})), + "build-release runs chunks in api": (self.epic(2, api=1), Tmux(parked, ("loop-api", "item-3", False, str(self.home / "code/api")), owners={"loop-api": str(self.home / "code/api")})), "no project config names api": (self.epic(2), Tmux(parked)), } for reason, (epic, run) in cases.items(): @@ -346,14 +346,14 @@ class StartingAnEpicsChunks(unittest.TestCase): def test_a_chunk_its_repo_refuses_takes_no_slot_of_the_epics_cap(self) -> None: run = Tmux(("loop-api", "item-3", False, str(self.home / "code/api")), owners={"loop-api": str(self.home / "code/api")}) found = self.start(self.epic(1, api=1, web=1), [issue("ABC-20", "repo:api"), issue("ABC-21", "repo:web")], run) - self.assertEqual(found, Started(["ABC-21"], [Waits("ABC-20", "loop-claude runs chunks in api")])) + self.assertEqual(found, Started(["ABC-21"], [Waits("ABC-20", "build-release runs chunks in api")])) - def test_never_starts_in_a_repo_loop_claude_runs_chunks_in(self) -> None: + def test_never_starts_in_a_repo_build_release_runs_chunks_in(self) -> None: run = Tmux(("loop-api", "item-3", False, str(self.home / "code/api")), owners={"loop-api": str(self.home / "code/api")}) found = self.start(self.epic(3, api=2), [issue("ABC-20", "repo:api")], run) - self.assertEqual(found, Started([], [Waits("ABC-20", "loop-claude runs chunks in api")])) + self.assertEqual(found, Started([], [Waits("ABC-20", "build-release runs chunks in api")])) - def test_a_stopped_loop_claude_window_keeps_no_repo(self) -> None: + def test_a_stopped_build_release_window_keeps_no_repo(self) -> None: run = Tmux(("loop-api", "item-3", True, str(self.home / "code/api")), owners={"loop-api": str(self.home / "code/api")}) self.assertEqual(self.start(self.epic(3, api=2), [issue("ABC-20", "repo:api")], run).started, ["ABC-20"]) @@ -371,7 +371,7 @@ class StartingAnEpicsChunks(unittest.TestCase): found = self.start(self.epic(1, api=1), [issue("ABC-20", "repo:api"), issue("ABC-21", "repo:api"), issue("ABC-22", "repo:api")], run, own="ABC-20") self.assertEqual(found, Started(["ABC-22"], [Waits("ABC-21", "its window stopped; run `do-epic ABC-12` to start it again")])) - def test_holds_each_repos_starting_lock_that_loop_claude_holds(self) -> None: + def test_holds_each_repos_starting_lock_that_build_release_holds(self) -> None: self.start(self.epic(1, api=1), [issue("ABC-20", "repo:api")], Tmux()) self.assertTrue((self.home / ".local/state/loop-claude/api/starting").is_file()) self.assertTrue((self.home / ".local/state/do-epic/ABC-12/starting").is_file()) diff --git a/bin/judge_replay/archived_prompt.py b/bin/judge_replay/archived_prompt.py index af1fccf4..f0e6d6fa 100644 --- a/bin/judge_replay/archived_prompt.py +++ b/bin/judge_replay/archived_prompt.py @@ -4,15 +4,15 @@ from agent_cycle import escalation_mark from failure import Failure from agent_cycle.judge import Grounds, judge_rules, TASK_HEADING, transcript_heading from claude_code.transcript import human_answers -from chunk_driver.drivers import LOOP_CLAUDE +from chunk_driver.drivers import BUILD_RELEASE from agent_cycle.worker_prompts import typed_answer def grounds_of(prompt: str, entries: list[Entry]) -> Grounds | Failure: """What the quotes of a judge run on prompt are checked against, as judge_prompt would have made it for the transcript's entries: the premises and the records before the task are quotable, the task is quotable as the evidence, and the transcript the judge was shown comes before the rules. The prompt is split on the headings judge_prompt writes, at the first of each; a Failure where it lacks one. Rules of an earlier wording stay part of the transcript, a slack that lets an evidence quote them pass.""" before_task, task_heading, after_task = prompt.partition(f"\n\n{TASK_HEADING}") - heading = transcript_heading(LOOP_CLAUDE) + heading = transcript_heading(BUILD_RELEASE) task, found_heading, shown = after_task.partition(heading) if not (task_heading and found_heading): return Failure(f"the archived prompt lacks the heading {TASK_HEADING.strip()!r} or {heading.strip()!r}, which judge_prompt writes") - return Grounds(shown.removesuffix(f"\n\n{judge_rules(ANSWER_DESTINATIONS, LOOP_CLAUDE)}"), escalation_mark.after_mark(entries, 0), before_task, tuple(human_answers(entries, typed_answer)), task.removesuffix("\n\n")) + return Grounds(shown.removesuffix(f"\n\n{judge_rules(ANSWER_DESTINATIONS, BUILD_RELEASE)}"), escalation_mark.after_mark(entries, 0), before_task, tuple(human_answers(entries, typed_answer)), task.removesuffix("\n\n")) diff --git a/bin/judge_replay/main.py b/bin/judge_replay/main.py index 33ecb2e5..fcfb6e96 100644 --- a/bin/judge_replay/main.py +++ b/bin/judge_replay/main.py @@ -1,17 +1,17 @@ -"""Replay loop-claude's judge on archived verdicts, to find the lowest rung that returns them: docs/decisions.md β†’ `routing: on a model judge-replay covered`. +"""Replay build-release's judge on archived verdicts, to find the lowest rung that returns them: docs/decisions.md β†’ `routing: on a model judge-replay covered`. usage: judge-replay <model> [--offline] <model> is a project model on the routing ladder this setup ships, such as claude-opus-5-5. The tool replays the verdicts archived for the projects that ~/.claude/loop-claude-models.json runs on it: the latest 15 of each kind, finished, unfinished, interrupt and quoted answer. Where the archive kept the judge's own -prompt (docs/decisions.md β†’ `loop-claude: the archive keeps the raw transcript and each judge run, …`), the +prompt (docs/decisions.md β†’ `build-release: the archive keeps the raw transcript and each judge run, …`), the replay hands the judge that prompt, which holds what the judge read then. For a verdict from before the archive kept it, the replay builds the prompt from the transcript copy beside the verdict, with the task, premises and records each project holds now. It first replays every verdict on the reference judge: the model at xhigh effort, the rung the -judge ran on before loop-claude routed it. A verdict the reference judge returns another kind on +judge ran on before build-release routed it. A verdict the reference judge returns another kind on may rest, where its prompt was rebuilt, on records or judge rules that have changed since; where the archived prompt was replayed, the judge's own variance is the cause. Either way no rung is held to it. It then replays the rest on each rung above the model's cheapest that a chunk's E + I raises a @@ -27,8 +27,8 @@ JUDGE_REPLAYED in bin/agent_cycle/routing.py, which routes that model's judge. j keeps the judge to its own model's rungs; a rung above them that misses no interrupt is the evidence to let the judge climb onto it. -It keeps each run and the report it prints in loop-claude's archive, in -replays/judge-replay-<model>-<UTC stamp>/ under ~/.claude/loop-claude-transcripts or $LOOP_CLAUDE_TRANSCRIPTS. +It keeps each run and the report it prints in build-release's archive, in +replays/judge-replay-<model>-<UTC stamp>/ under ~/.claude/loop-claude-transcripts or $BUILD_RELEASE_TRANSCRIPTS. A run's .jsonl file starts with a line holding claude's arguments, working directory, prompt, exit code and stderr, then holds claude's stream-json output; result.md holds the report. @@ -70,7 +70,7 @@ from judge_replay.archived_prompt import grounds_of from transcript_archive.judge_run import JudgeRun from model_routing.ladder import Ladder, ProjectRung, REVIEW_STEPS, Rung from claude_code.reply import Limited -from chunk_driver.drivers import LOOP_CLAUDE +from chunk_driver.drivers import BUILD_RELEASE from model_routing.ladder_file import read_ladder, SHIPPED from chunk_driver.project.premises import read_premises from chunk_driver.project.records import read_records, RECORDS_NAMED @@ -81,7 +81,7 @@ TOOL = "judge-replay" USAGE = f"{TOOL} <model> [--offline]; <model> is a model on the routing ladder" OFFLINE = "--offline" PER_KIND = 15 -# The effort settings.json gave every judge before loop-claude routed it; the archived verdicts came from it. +# The effort settings.json gave every judge before build-release routed it; the archived verdicts came from it. REFERENCE_EFFORT = "xhigh" @@ -97,7 +97,7 @@ def main(argv: list[str], env: typing.Mapping[str, str], home: pathlib.Path, eff if isinstance(cases, Failure): return failed(TOOL, cases.reason) if not cases: - return failed(TOOL, f"no archived verdicts of projects on {project.rung.model} in {archive_root(home, env)}; run loop-claude on a project on that model first") + return failed(TOOL, f"no archived verdicts of projects on {project.rung.model} in {archive_root(home, env)}; run build-release on a project on that model first") if OFFLINE in argv: return offline(project.rung.model, cases, archive_root(home, env), effects) cases = sample(cases, PER_KIND) @@ -166,7 +166,7 @@ def rule(case: Case, rung: Rung, home: pathlib.Path, effects: Effects) -> Kind | grounds = grounds_of(kept.prompt, entries) if isinstance(grounds, Failure): return verdict_kind(grounds) - verdict: Verdict | Failure | Limited = first_reply(lambda: judge_archived(case.root, kept.prompt, grounds, len(entries), rung, LOOP_CLAUDE, effects)) + verdict: Verdict | Failure | Limited = first_reply(lambda: judge_archived(case.root, kept.prompt, grounds, len(entries), rung, BUILD_RELEASE, effects)) return verdict if isinstance(verdict, Limited) else verdict_kind(verdict) premises, records = read_premises(case.root, home), read_records(case.root, home, home / CLAUDE_HOME) if isinstance(premises, Failure): @@ -174,5 +174,5 @@ def rule(case: Case, rung: Rung, home: pathlib.Path, effects: Effects) -> Kind | if isinstance(records, Failure): return verdict_kind(records) # 0 for the route's mark, as before any step-up: the replay compares verdict kinds, and a mark changes only which escalation quotes count. - verdict = first_reply(lambda: judge_once(case.root, Brief(task=case.task, premises=premises, records=records, records_named=RECORDS_NAMED, answer_destinations=ANSWER_DESTINATIONS, entries=entries, escalated_at=0, driver=LOOP_CLAUDE), rung, effects)) + verdict = first_reply(lambda: judge_once(case.root, Brief(task=case.task, premises=premises, records=records, records_named=RECORDS_NAMED, answer_destinations=ANSWER_DESTINATIONS, entries=entries, escalated_at=0, driver=BUILD_RELEASE), rung, effects)) return verdict if isinstance(verdict, Limited) else verdict_kind(verdict) diff --git a/bin/judge_replay/test_judge_replay.py b/bin/judge_replay/test_judge_replay.py index a31f189e..bb412c5e 100644 --- a/bin/judge_replay/test_judge_replay.py +++ b/bin/judge_replay/test_judge_replay.py @@ -20,7 +20,7 @@ from failure import Failure from agent_cycle.verdicts import Finished, Interrupt, QuotedAnswer, Unfinished from judge_replay.archived_prompt import grounds_of from agent_cycle.judge import judge_archived, judge_rules, Rejected, TASK_HEADING, transcript_heading -from chunk_driver.drivers import LOOP_CLAUDE +from chunk_driver.drivers import BUILD_RELEASE from judge_replay import main from rung_replay.search import Miss, Replay, Tried from model_routing.ladder import Rung @@ -256,19 +256,19 @@ class Main(unittest.TestCase): self.assertIn("replaying 8 verdicts on ", err) self.assertEqual(set(together.most.values()), {4}) - def test_the_prompt_and_the_reply_schema_of_a_rebuilt_run_name_loop_claude_and_the_records_and_show_the_transcript_once(self): + def test_the_prompt_and_the_reply_schema_of_a_rebuilt_run_name_build_release_and_the_records_and_show_the_transcript_once(self): code, _, err = self.run_main(["claude-opus-5-5"], lambda rung, interrupted: self.verdict(interrupted, f"said {INTERRUPTED if interrupted else FINISHED}")) self.assertEqual(code, 0, err) for prompt, schema in zip(self.prompts, self.schemas, strict=True): self.assertIn("\n\nThe records: the project's working rules and decisions, then the human's rules for every project:\n", prompt) - self.assertIn("what loop-claude told it on [loop] lines, latest last:\n", prompt) + self.assertIn("what build-release told it on [loop] lines, latest last:\n", prompt) self.assertEqual(prompt.count("said Verdict: "), 1) - self.assertIn("loop-claude", schema) + self.assertIn("build-release", schema) self.assertNotIn("None", schema) def test_hands_the_judge_the_prompt_the_archive_kept_and_rebuilds_the_prompt_of_a_verdict_with_none(self): kept = self.home / ".claude" / "loop-claude-transcripts" / "proj" / "c1" - prompt = "From the goals file, OLD premises\n\nThe records: none\n\nThe task the worker was given:\nDo it.\n\nWhat the worker did and said, what the human typed on [human] lines and what loop-claude told it on [loop] lines, latest last:\nsaid Verdict: finished\n\nOLD rules" + prompt = "From the goals file, OLD premises\n\nThe records: none\n\nThe task the worker was given:\nDo it.\n\nWhat the worker did and said, what the human typed on [human] lines and what build-release told it on [loop] lines, latest last:\nsaid Verdict: finished\n\nOLD rules" (kept / "judge").mkdir() (kept / "judge" / "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.json").write_text(json.dumps({"prompt": prompt, "reply": {"type": "result"}})) (kept / "t0.outcomes.md").write_text("Task: Do it.\n\n2026-10-14T10:00:00Z Verdict: finished\n\nJudge: j\nJudge run: judge/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.json\nWorker: x\n") @@ -277,8 +277,8 @@ class Main(unittest.TestCase): self.assertIn("The reference judge, claude-opus-5-5 at xhigh effort, reproduced 2.", out) # The first replay, on the finished verdict, reads the archived prompt; the second, on the interrupt, is rebuilt from the records of today. self.assertEqual(self.prompts[0], prompt) - # The reply's schema names loop-claude to the judge of either prompt. - self.assertEqual([schema for schema in self.schemas if "loop-claude" not in schema or "None" in schema], []) + # The reply's schema names build-release to the judge of either prompt. + self.assertEqual([schema for schema in self.schemas if "build-release" not in schema or "None" in schema], []) self.assertEqual(self.calls[0][2], self.calls[1][2]) self.assertTrue(self.calls[0][2].endswith("/code/proj")) self.assertIn("The task the worker was given:\nDo it.", self.prompts[1]) @@ -375,7 +375,7 @@ class Main(unittest.TestCase): class JudgeArchivedRuns(unittest.TestCase): """judge_archived on a prompt as judge_prompt writes it: the premises, the task, the transcript the judge was shown, and the rules.""" - PROMPT = f"HEAD: Ship fast.\n\n{TASK_HEADING}Do it.\n\n{transcript_heading(LOOP_CLAUDE)}Worker chose option B.\n[human] Use Postgres.\n\n{judge_rules(ANSWER_DESTINATIONS, LOOP_CLAUDE)}" + PROMPT = f"HEAD: Ship fast.\n\n{TASK_HEADING}Do it.\n\n{transcript_heading(BUILD_RELEASE)}Worker chose option B.\n[human] Use Postgres.\n\n{judge_rules(ANSWER_DESTINATIONS, BUILD_RELEASE)}" ENTRIES = [AssistantTurn(parts=(Text("Worker chose option B."),)), HumanTurn(text="Use Postgres."), LoopPrompt(text="Keep going.")] def judged(self, prompt=PROMPT, **fields): @@ -389,7 +389,7 @@ class JudgeArchivedRuns(unittest.TestCase): effects = Effects(claude=claude, claude_on_terminal=unused, discard_typed=unused, dm=unused, execv=unused, forge=unused, git=unused, input=unused, local_time=unused, memory=unused, now=lambda: 1790000000.0, on_terminal=unused, python=unused, replace_file=unused, sleep=unused, stream_claude=unused, timer=unused, tmux=unused, tmux_on_terminal=unused) grounds = grounds_of(prompt, self.ENTRIES) - return (grounds if isinstance(grounds, Failure) else judge_archived("/code/p", prompt, grounds, len(self.ENTRIES), REFERENCE, LOOP_CLAUDE, effects)), cwds + return (grounds if isinstance(grounds, Failure) else judge_archived("/code/p", prompt, grounds, len(self.ENTRIES), REFERENCE, BUILD_RELEASE, effects)), cwds def test_runs_in_the_projects_folder_and_stamps_the_verdict_with_the_entries_read(self): verdict, cwds = self.judged() @@ -404,7 +404,7 @@ class JudgeArchivedRuns(unittest.TestCase): self.assertIsInstance(self.judged(evidence="Do it. ... Use Postgres.")[0], Unfinished) def test_splits_the_prompt_into_the_premises_the_task_and_the_transcript_at_the_first_heading_of_each(self): - heading = transcript_heading(LOOP_CLAUDE) + heading = transcript_heading(BUILD_RELEASE) again = self.PROMPT.replace("Worker chose option B.", f"Worker chose option B. {heading}Again.", 1) for prompt in (self.PROMPT, again): grounds = grounds_of(prompt, self.ENTRIES) @@ -420,11 +420,11 @@ class JudgeArchivedRuns(unittest.TestCase): self.assertEqual((type(rejected), rejected.cost), (Rejected, 0.25)) def test_checks_neither_the_task_nor_the_rules_as_the_transcript_or_the_premises(self): - self.assertIsInstance(self.judged(evidence=judge_rules(ANSWER_DESTINATIONS, LOOP_CLAUDE))[0], Rejected) + self.assertIsInstance(self.judged(evidence=judge_rules(ANSWER_DESTINATIONS, BUILD_RELEASE))[0], Rejected) self.assertIsInstance(self.judged(answer="Do it.", question="Which?")[0], Interrupt) def test_splits_the_prompt_at_the_first_transcript_heading(self): - quoting = self.PROMPT.replace("Worker chose", f"Quoted: {transcript_heading(LOOP_CLAUDE)}Worker chose", 1) + quoting = self.PROMPT.replace("Worker chose", f"Quoted: {transcript_heading(BUILD_RELEASE)}Worker chose", 1) self.assertIsInstance(self.judged(quoting, evidence="Quoted:")[0], Unfinished) def test_splits_the_prompt_at_the_first_task_heading(self): diff --git a/bin/loop_claude/__init__.py b/bin/loop_claude/__init__.py deleted file mode 100644 index 2ddfc24e..00000000 --- a/bin/loop_claude/__init__.py +++ /dev/null @@ -1,4 +0,0 @@ -"""loop-claude: headless claude cycles, judged, that interrupt the human only for a decision that is theirs (loop/usage.py's help). - -Its packages hold one concern each: chunk/ words a fresh chunk's first prompt and reads the items a worker names, and loop/ runs the cycles. What it shares with do-epic lives in bin/chunk_driver/. loop-claude's paths live in bin/loop_state/, and its effects in bin/loop_effects/. The cycle itself, its judge, interrupts and routing live in bin/agent_cycle/, which doesn't import this package, so that a second entry point can drive it. routed_item.py, at this level, reads the plan for the item a chunk starts on. -""" diff --git a/bin/loop_effects/effects.py b/bin/loop_effects/effects.py index 119e22e9..1a2cff55 100644 --- a/bin/loop_effects/effects.py +++ b/bin/loop_effects/effects.py @@ -25,7 +25,7 @@ from forge.commands import Run, runner from machine_load.slots import slot_folder from loop_state.paths import with_release_tools -# Seconds before a Python script loop-claude runs is stopped, so a hung one, such as chunk-preflight, cannot hold the loop. +# Seconds before a Python script build-release runs is stopped, so a hung one, such as chunk-preflight, cannot hold the loop. PYTHON_TIMEOUT = 600 # Seconds a command of the forge's CLI may take, so a stalled one cannot hold the loop. FORGE_TIMEOUT = 60 @@ -118,7 +118,7 @@ class StreamingClaude: def system_effects(home: pathlib.Path, env: typing.Mapping[str, str], backends: typing.Mapping[Notifier, Backend[typing.Any]] = BACKENDS, forge_timeout: float = FORGE_TIMEOUT) -> Effects: """The effects on this machine: the configs of its DM are under home, and tmux and the one-shot headless claude run in env, while a streaming claude and one on a terminal run in this process's environment plus what their caller adds. Every claude starts with the release's tools first on its `PATH`. - A test hands in `backends` that don't send anything, in place of the notifiers loop-claude's DM goes through. It hands in a short `forge_timeout`, so a command that outlasts it ends quickly. + A test hands in `backends` that don't send anything, in place of the notifiers build-release's DM goes through. It hands in a short `forge_timeout`, so a command that outlasts it ends quickly. """ return Effects( claude=lambda args, cwd, stdin: subprocess.run(["claude", *args], capture_output=True, cwd=cwd, env=with_release_tools(env), input=stdin, text=True), diff --git a/bin/loop_state/__init__.py b/bin/loop_state/__init__.py index 3c4386b6..476b3437 100644 --- a/bin/loop_state/__init__.py +++ b/bin/loop_state/__init__.py @@ -1,4 +1,4 @@ -"""Where loop-claude keeps its files (paths.py), which the tools that replay its runs read too. +"""Where build-release keeps its files (paths.py), which the tools that replay its runs read too. -It doesn't import anything from loop_claude/. +It doesn't import anything from build_release/. """ diff --git a/bin/metric_bench/bench.py b/bin/metric_bench/bench.py index f3244a2b..7adeaa42 100644 --- a/bin/metric_bench/bench.py +++ b/bin/metric_bench/bench.py @@ -85,7 +85,7 @@ def medians(runs: list[RunScores]) -> dict[str, Score]: def tracked_places(places: list[Place], tracked: list[str]) -> tuple[list[Place], list[Place]]: - """Entries written before paths were written from the repository's root shorten a path once they have named its folder: `cycle/run.py` after `bin/loop_claude/cycle/states.py`. Each place resolves to the one tracked file it names, or, where several match, the one in the folder of the place resolved before it; a place naming no file, or several, is dropped. Returns the resolved places and the dropped ones.""" + """Entries written before paths were written from the repository's root shorten a path once they have named its folder: `cycle/run.py` after `bin/build_release/cycle/states.py`. Each place resolves to the one tracked file it names, or, where several match, the one in the folder of the place resolved before it; a place naming no file, or several, is dropped. Returns the resolved places and the dropped ones.""" found = [] dropped = [] before = "" diff --git a/bin/model_routing/ladder.py b/bin/model_routing/ladder.py index 7744b3ca..cec241ec 100644 --- a/bin/model_routing/ladder.py +++ b/bin/model_routing/ladder.py @@ -30,7 +30,7 @@ class Rung: """The rung in the Agent tool's words. The tool takes a family name, such as opus, and runs that family's latest model, which is the model each rung names.""" return f"model {self.family()}, effort {self.effort}" - # loop-claude hands a rung to rule-hook in environment variables in this spelling, so parse must keep reading it. + # build-release hands a rung to rule-hook in environment variables in this spelling, so parse must keep reading it. def __str__(self) -> str: return f"{self.model} at {self.effort} effort" if self.effort else self.model diff --git a/bin/model_routing/prices.py b/bin/model_routing/prices.py index e073d29c..8d517f5f 100644 --- a/bin/model_routing/prices.py +++ b/bin/model_routing/prices.py @@ -20,7 +20,7 @@ class Price: return self.input * 2 -# Anthropic's list prices as the claude-api skill lists them (cached 2026-10-06, and Fable 5.2's on 2026-11-03), with Opus 5.5's cache prices from `docs/decisions.md` β†’ `loop-claude: the worker's claude compacts…`. Haiku 5.5's cache read is assumed at a tenth of its input, and its dearer prompts above 200k tokens are left out. Keep each price current with that list: the prices are archived as the ones in force. +# Anthropic's list prices as the claude-api skill lists them (cached 2026-10-06, and Fable 5.2's on 2026-11-03), with Opus 5.5's cache prices from `docs/decisions.md` β†’ `build-release: the worker's claude compacts…`. Haiku 5.5's cache read is assumed at a tenth of its input, and its dearer prompts above 200k tokens are left out. Keep each price current with that list: the prices are archived as the ones in force. PRICES = { # Archived chunks that ran on Fable 5.1 are still priced from here. "claude-fable-5-1": Price(10, 0.25, 50), diff --git a/bin/model_routing/route.py b/bin/model_routing/route.py index 04c371fe..94712b05 100644 --- a/bin/model_routing/route.py +++ b/bin/model_routing/route.py @@ -79,7 +79,7 @@ class Route: return WorkerLine(json.dumps({name: value for name, value in fields.items() if value})) -# The Route fields a worker line holds beside the rung's model and effort. A human reads the line in the archive, so it is flatter than the JSON a reload hands over (loop_claude/loop/reload.py) and leaves out zeros. It leaves out unfinished, so a rerun restarts that count. +# The Route fields a worker line holds beside the rung's model and effort. A human reads the line in the archive, so it is flatter than the JSON a reload hands over (build_release/loop/reload.py) and leaves out zeros. It leaves out unfinished, so a rerun restarts that count. WORKER_LINE_FIELDS = tuple(field.name for field in dataclasses.fields(Route) if field.name not in ("rung", "unfinished")) @@ -93,7 +93,7 @@ def route_from(worker: str) -> Route | None: def route_of(fields: object) -> Route | None: - """The route these fields of a worker line name, with an unfinished count of 0; None for fields Route.worker_line could not have written. A reload decodes its route through it too (loop_claude/loop/reload.py), so Route has one decoder.""" + """The route these fields of a worker line name, with an unfinished count of 0; None for fields Route.worker_line could not have written. A reload decodes its route through it too (build_release/loop/reload.py), so Route has one decoder.""" if not isinstance(fields, dict) or not fields.keys() <= {"model", "effort", *WORKER_LINE_FIELDS}: return None if not isinstance(fields.get("model"), str) or not isinstance(fields.get("effort", ""), str): diff --git a/bin/model_routing/test_worker_rungs.py b/bin/model_routing/test_worker_rungs.py index 5f133d95..867ffbe7 100644 --- a/bin/model_routing/test_worker_rungs.py +++ b/bin/model_routing/test_worker_rungs.py @@ -14,12 +14,12 @@ class Environment(unittest.TestCase): WORKER = Rung("claude-sonnet-5-5", "high") def test_the_project_and_the_workers_rungs_and_the_e_plus_i_reviews_take_are_named_in_the_environment(self): - self.assertEqual(environment(self.PROJECT, Route(self.WORKER, 3, 1, 5)), {"LOOP_CLAUDE_PROJECT_RUNG": "claude-opus-5-5 at medium effort", "LOOP_CLAUDE_WORKER_RUNG": "claude-sonnet-5-5 at high effort", "LOOP_CLAUDE_ESCAPE_AND_IMPACT": "5"}) - self.assertEqual(environment(self.PROJECT, Route(self.WORKER))["LOOP_CLAUDE_ESCAPE_AND_IMPACT"], "0") - self.assertEqual(environment(self.PROJECT, Route(self.WORKER, 3, 1, 5, escape_and_impact_taken_in=6))["LOOP_CLAUDE_ESCAPE_AND_IMPACT"], "6") + self.assertEqual(environment(self.PROJECT, Route(self.WORKER, 3, 1, 5)), {"BUILD_RELEASE_PROJECT_RUNG": "claude-opus-5-5 at medium effort", "BUILD_RELEASE_WORKER_RUNG": "claude-sonnet-5-5 at high effort", "BUILD_RELEASE_ESCAPE_AND_IMPACT": "5"}) + self.assertEqual(environment(self.PROJECT, Route(self.WORKER))["BUILD_RELEASE_ESCAPE_AND_IMPACT"], "0") + self.assertEqual(environment(self.PROJECT, Route(self.WORKER, 3, 1, 5, escape_and_impact_taken_in=6))["BUILD_RELEASE_ESCAPE_AND_IMPACT"], "6") def test_a_project_off_the_ladder_is_handed_an_empty_rung_so_none_is_inherited(self): - self.assertEqual(environment(None, Route(self.WORKER)), {"LOOP_CLAUDE_PROJECT_RUNG": "", "LOOP_CLAUDE_WORKER_RUNG": "claude-sonnet-5-5 at high effort", "LOOP_CLAUDE_ESCAPE_AND_IMPACT": "0"}) + self.assertEqual(environment(None, Route(self.WORKER)), {"BUILD_RELEASE_PROJECT_RUNG": "", "BUILD_RELEASE_WORKER_RUNG": "claude-sonnet-5-5 at high effort", "BUILD_RELEASE_ESCAPE_AND_IMPACT": "0"}) def test_handed_reads_back_what_environment_named(self): self.assertEqual(handed(environment(self.PROJECT, Route(self.WORKER, 3, 1, 5)), LADDER), (self.PROJECT, self.WORKER, 5)) @@ -32,13 +32,13 @@ class Environment(unittest.TestCase): def test_tells_whether_both_rungs_are_named_before_any_ladder_is_read(self): self.assertTrue(hands_rungs(environment(self.PROJECT, Route(self.WORKER)))) self.assertFalse(hands_rungs(environment(None, Route(self.WORKER)))) - self.assertFalse(hands_rungs({"LOOP_CLAUDE_PROJECT_RUNG": "claude-opus-5-5 at medium effort"})) + self.assertFalse(hands_rungs({"BUILD_RELEASE_PROJECT_RUNG": "claude-opus-5-5 at medium effort"})) self.assertFalse(hands_rungs({})) def test_a_missing_or_unknown_rung_reads_as_none_and_a_missing_or_unknown_e_plus_i_as_0(self): self.assertEqual(handed({}, LADDER), (None, None, 0)) - self.assertEqual(handed({"LOOP_CLAUDE_WORKER_RUNG": "claude-haiku-5-5 bogus"}, LADDER), (None, None, 0)) - self.assertEqual(handed({"LOOP_CLAUDE_WORKER_RUNG": "claude-haiku-5-5 at bogus effort"}, LADDER), (None, None, 0)) + self.assertEqual(handed({"BUILD_RELEASE_WORKER_RUNG": "claude-haiku-5-5 bogus"}, LADDER), (None, None, 0)) + self.assertEqual(handed({"BUILD_RELEASE_WORKER_RUNG": "claude-haiku-5-5 at bogus effort"}, LADDER), (None, None, 0)) for bogus in ("", "five", "-1", "5.0", "Β²"): with self.subTest(bogus=bogus): - self.assertEqual(handed({"LOOP_CLAUDE_ESCAPE_AND_IMPACT": bogus}, LADDER)[2], 0) + self.assertEqual(handed({"BUILD_RELEASE_ESCAPE_AND_IMPACT": bogus}, LADDER)[2], 0) diff --git a/bin/model_routing/worker_rungs.py b/bin/model_routing/worker_rungs.py index 3c520025..c4ccf2bf 100644 --- a/bin/model_routing/worker_rungs.py +++ b/bin/model_routing/worker_rungs.py @@ -1,15 +1,15 @@ -"""The rungs and the E + I loop-claude hands a worker's claude in its environment, from which rule-hook works out the rung of each review launch: docs/decisions.md β†’ `routing:`. +"""The rungs and the E + I build-release hands a worker's claude in its environment, from which rule-hook works out the rung of each review launch: docs/decisions.md β†’ `routing:`. -loop-claude sets these variables for its worker and for the claude an interrupt resumes; a human's shell does not, and rule-hook then checks no review launch.""" +build-release sets these variables for its worker and for the claude an interrupt resumes; a human's shell does not, and rule-hook then checks no review launch.""" import typing from model_routing.ladder import Ladder, ProjectRung, Rung from model_routing.route import Route -PROJECT_RUNG = "LOOP_CLAUDE_PROJECT_RUNG" -WORKER_RUNG = "LOOP_CLAUDE_WORKER_RUNG" +PROJECT_RUNG = "BUILD_RELEASE_PROJECT_RUNG" +WORKER_RUNG = "BUILD_RELEASE_WORKER_RUNG" # The E + I the chunk's reviews are routed on, from which review_rung works out each review's rung. -ESCAPE_AND_IMPACT = "LOOP_CLAUDE_ESCAPE_AND_IMPACT" +ESCAPE_AND_IMPACT = "BUILD_RELEASE_ESCAPE_AND_IMPACT" def environment(project: ProjectRung | None, route: Route) -> dict[str, str]: @@ -18,12 +18,12 @@ def environment(project: ProjectRung | None, route: Route) -> dict[str, str]: def hands_rungs(environ: typing.Mapping[str, str]) -> bool: - """Whether the environment names a project's and a worker's rung, as loop-claude sets them for a project on its ladder. Where it names neither, no review launch is checked, so the caller skips reading the project's ladder.""" + """Whether the environment names a project's and a worker's rung, as build-release sets them for a project on its ladder. Where it names neither, no review launch is checked, so the caller skips reading the project's ladder.""" return bool(environ.get(PROJECT_RUNG) and environ.get(WORKER_RUNG)) def handed(environ: typing.Mapping[str, str], ladder: Ladder) -> tuple[ProjectRung | None, Rung | None, int]: - """The project's rung and the worker's rung, each None when unset or not on ladder, and the reviews' E + I, 0 when unset or not a whole number. ladder is the project's. An older loop-claude hands no E + I, and 0 steps no review up.""" + """The project's rung and the worker's rung, each None when unset or not on ladder, and the reviews' E + I, 0 when unset or not a whole number. ladder is the project's. An older build-release hands no E + I, and 0 steps no review up.""" escape_and_impact = environ.get(ESCAPE_AND_IMPACT, "") project = on_the_ladder(environ.get(PROJECT_RUNG), ladder) return ProjectRung(ladder, project) if project else None, on_the_ladder(environ.get(WORKER_RUNG), ladder), int(escape_and_impact) if escape_and_impact.isdecimal() else 0 diff --git a/bin/notifier/mattermost.py b/bin/notifier/mattermost.py index f172b02a..d53d44cd 100644 --- a/bin/notifier/mattermost.py +++ b/bin/notifier/mattermost.py @@ -10,7 +10,7 @@ from rest_client import json_request from rest_client.env_file import read_env KEYS = ("MATTERMOST_URL", "MATTERMOST_TOKEN", "MATTERMOST_RECIPIENT") -# Seconds each connect and each read may wait, so an unreachable server holds loop-claude's interrupt only briefly. +# Seconds each connect and each read may wait, so an unreachable server holds build-release's interrupt only briefly. TIMEOUT = 10 diff --git a/bin/notifier/notify.py b/bin/notifier/notify.py index 7c8af0bc..37413764 100644 --- a/bin/notifier/notify.py +++ b/bin/notifier/notify.py @@ -46,7 +46,7 @@ def sender_of(project: ProjectConfig, backends: typing.Mapping[Notifier, Backend def notify(text: str, directory: str | None, home: pathlib.Path, backends: typing.Mapping[Notifier, Backend[typing.Any]]) -> Failure | None: """Sends text through the notifier of the project whose checkout holds directory. - The DM is skipped where the config names no notifier, since the project hasn't asked for DMs. It is skipped too where no config can be read: loop-claude has stopped with that reason, and without a config there is no notifier to ask.""" + The DM is skipped where the config names no notifier, since the project hasn't asked for DMs. It is skipped too where no config can be read: build-release has stopped with that reason, and without a config there is no notifier to ask.""" project = located(directory, home) if isinstance(project, Failure) or project.notifier is None: return None diff --git a/bin/notifier/slack.py b/bin/notifier/slack.py index 3ce3a3d1..10735541 100644 --- a/bin/notifier/slack.py +++ b/bin/notifier/slack.py @@ -12,7 +12,7 @@ from rest_client.env_file import read_env KEYS = ("SLACK_TOKEN", "SLACK_RECIPIENT") # Slack's one host for every workspace. API = "https://slack.com/api" -# Seconds each connect and each read may wait, so an unreachable server holds loop-claude's interrupt only briefly. +# Seconds each connect and each read may wait, so an unreachable server holds build-release's interrupt only briefly. TIMEOUT = 10 diff --git a/bin/notifier/test_notifier.py b/bin/notifier/test_notifier.py index df3c9aa6..a92cd46e 100644 --- a/bin/notifier/test_notifier.py +++ b/bin/notifier/test_notifier.py @@ -70,7 +70,7 @@ class Notify(Project): self.assertIsNone(notify.notify("Which one?", str(self.checkout), self.home, through("slack", slack))) self.assertEqual(slack.requests, [SLACK_POST]) - def test_loop_claudes_dm_goes_through_the_notifier_for_the_project_holding_the_current_directory(self): + def test_build_releases_dm_goes_through_the_notifier_for_the_project_holding_the_current_directory(self): self.name_notifier("slack", SLACK_KEYS) slack = Slack({"ok": True}) with contextlib.chdir(self.checkout): @@ -90,7 +90,7 @@ class Notify(Project): self.assertIsNone(notify.notify("Which one?", str(self.checkout), self.home, through("mattermost", server))) self.assertEqual(server.requests, []) - def test_skips_the_notice_where_no_config_names_the_checkout_since_loop_claude_stops_on_that_itself(self): + def test_skips_the_notice_where_no_config_names_the_checkout_since_build_release_stops_on_that_itself(self): other = self.home / "code" / "other" other.mkdir() subprocess.run(["git", "init", "--quiet", str(other)], check=True, env=isolated_env()) diff --git a/bin/plan/goals_file.py b/bin/plan/goals_file.py index ca658316..c79231db 100644 --- a/bin/plan/goals_file.py +++ b/bin/plan/goals_file.py @@ -1,4 +1,4 @@ -"""Reads the goals file, for the ranking and for loop-claude's premises: its ## Goals and ## Audience sections, each goal's number and mark, and what each goal weighs.""" +"""Reads the goals file, for the ranking and for build-release's premises: its ## Goals and ## Audience sections, each goal's number and mark, and what each goal weighs.""" import decimal import re diff --git a/bin/project_config/main.py b/bin/project_config/main.py index d6c94d71..f536f777 100644 --- a/bin/project_config/main.py +++ b/bin/project_config/main.py @@ -94,7 +94,7 @@ them beside the principles and the standards, and the team's rule wins where the prints one path a line. Left out, the reviewers read no such file. It is printed with the others only where it is set. -`notifier` is an optional setting, "mattermost" or "slack": the service that sends loop-claude's DMs and +`notifier` is an optional setting, "mattermost" or "slack": the service that sends build-release's DMs and `notify`'s messages to the human. Setting it requires `env-file`, which holds that service's keys; `notify --help` names them. Left out, the project gets no DMs. It is printed with the others only where it is set. @@ -134,7 +134,7 @@ ranking, and a scoring run with a mean under it asks for a floor item. A legacy scores low, may lower it. Left out, it is 7.0. `parallel-chunks` is an optional setting, a whole number of 1 or more: the most chunks of the project -loop-claude runs at once, each in its own tmux window. Left out, it is 1. +build-release runs at once, each in its own tmux window. Left out, it is 1. `project-config tooling-on-host`, `project-config readability-floor` and `project-config parallel-chunks` print their values; the full listing shows each only where the config changes it from what it is when diff --git a/bin/project_config/settings.py b/bin/project_config/settings.py index fa552ced..9dc96fcf 100644 --- a/bin/project_config/settings.py +++ b/bin/project_config/settings.py @@ -44,7 +44,7 @@ TOOLING_ON_HOST = "tooling-on-host" READABILITY_FLOOR = "readability-floor" # The floor where the config leaves it out, which every dimension and the overall should reach; docs/decisions.md β†’ "comprehension floor" says it doesn't block anything. DEFAULT_FLOOR = decimal.Decimal("7.0") -# The most chunks of the project loop-claude runs at once, each in its own tmux window; 1 where left out. Three readers seated as the README's audience picked the spelling 2-1 over concurrent-chunks. +# The most chunks of the project build-release runs at once, each in its own tmux window; 1 where left out. Three readers seated as the README's audience picked the spelling 2-1 over concurrent-chunks. PARALLEL_CHUNKS = "parallel-chunks" # The optional text settings. `language` is the language the project's prose is written in, by its English name. The others are templates, as `templates` says. LANGUAGE = "language" diff --git a/bin/rank_todo.py b/bin/rank_todo.py index 59686fca..fbe3f961 100755 --- a/bin/rank_todo.py +++ b/bin/rank_todo.py @@ -81,7 +81,7 @@ A valid todo.md; ## Details and each item's detail are optional: ranks, by a formula over R, S, A, G and W and a | Goal | W | table that weighs every goal, W being the heaviest cited goal's weight; ranking it says to reshape it. - ## Renamed is optional: one line `- 0.2.1 renamed to 0.3.0` per renamed release. chunk-preflight, - loop-claude and larv-review skip the line's first release, and ignore the second, which is for the + build-release and larv-review skip the line's first release, and ignore the second, which is for the reader. No item may sit under a marked release, and a line goes once a tag at or past its first release is cut. A release whose items all moved elsewhere without a line reads as finished. diff --git a/bin/reading_cost/main.py b/bin/reading_cost/main.py index bed9a5d0..35627705 100644 --- a/bin/reading_cost/main.py +++ b/bin/reading_cost/main.py @@ -1,10 +1,10 @@ -"""Measure each chunk loop-claude finished, append the figures to a project's record, and say whether they rise. +"""Measure each chunk build-release finished, append the figures to a project's record, and say whether they rise. usage: reading-cost [--reset] [record] Run it inside a project checkout or one of its worktrees. record defaults to the -docs/reading-cost.md the project's config names, created when missing. It reads loop-claude's archive of the project, -$LOOP_CLAUDE_TRANSCRIPTS/<key> (default ~/.claude/loop-claude-transcripts), <key> being the +docs/reading-cost.md the project's config names, created when missing. It reads build-release's archive of the project, +$BUILD_RELEASE_TRANSCRIPTS/<key> (default ~/.claude/loop-claude-transcripts), <key> being the checkout's path relative to ~/code, or to / outside it. For each finished chunk the record does not yet hold, it measures what the worker and its subagents read before the worker's first commit: their new input tokens (uncached and cache-written; cache reads excluded), and how often they opened or diff --git a/bin/release_plan/next_chunk.py b/bin/release_plan/next_chunk.py index f26d55ab..ca1921bc 100644 --- a/bin/release_plan/next_chunk.py +++ b/bin/release_plan/next_chunk.py @@ -1,4 +1,4 @@ -"""The next chunk's pick: the plan's items weighed against the last cut, with the item the next chunk takes first, or why there is none, as chunk-preflight states it and loop-claude starts chunks by it.""" +"""The next chunk's pick: the plan's items weighed against the last cut, with the item the next chunk takes first, or why there is none, as chunk-preflight states it and build-release starts chunks by it.""" import dataclasses from release_plan.release_standing import Cut, dated_cut, LastCut, picked, ReadyToCut, ReviewDue, standing_of, Unknown, Unplanned @@ -115,4 +115,4 @@ def merge_stop(pulls: dict[str, list[int]]) -> str: if not pulls: return "" named = "; ".join(f"{pull}, which finishes item{'s' if len(ids) > 1 else ''} {listed([str(item_id) for item_id in ids], 'and')}" for pull, ids in pulls.items()) - return f" Under `merge = \"human\"`, these pull requests await a person's merge: {named}. The working loop stops here. Once a person has merged one, or turned one back into a draft, run loop-claude again." + return f" Under `merge = \"human\"`, these pull requests await a person's merge: {named}. The working loop stops here. Once a person has merged one, or turned one back into a draft, run build-release again." diff --git a/bin/release_plan/release_standing.py b/bin/release_plan/release_standing.py index da9c3b1d..f3fb3821 100644 --- a/bin/release_plan/release_standing.py +++ b/bin/release_plan/release_standing.py @@ -16,7 +16,7 @@ from project_config import templates # The version a branch with no v* tag and no dated CHANGELOG.md heading counts as cut: below every release, 0.0.0 included, so that every release todo.md names comes after it. BEFORE_FIRST_RELEASE = (-1, 0, 0) -# What chunk-preflight and loop-claude say where the plan is outside the checkout, since no commit holds an earlier plan: `docs/decisions.md` β†’ "project config: a tool that reads a file's commits …". +# What chunk-preflight and build-release say where the plan is outside the checkout, since no commit holds an earlier plan: `docs/decisions.md` β†’ "project config: a tool that reads a file's commits …". UNSEEN_RELEASES = "The plan is outside the checkout, where no commit holds it, so a release whose last item has shipped is not seen: the plan no longer names it, and the release after it reads as next. Until the last release of all, no release review is called due and no release is called ready to cut: both are the human's to call." diff --git a/bin/release_plan/test_release_standing.py b/bin/release_plan/test_release_standing.py index 6fca40f4..3276c622 100644 --- a/bin/release_plan/test_release_standing.py +++ b/bin/release_plan/test_release_standing.py @@ -543,7 +543,7 @@ class AwaitingMerge(unittest.TestCase): items = [dataclasses.replace(item, awaits_merge="#8 https://github.com/o/r/pull/8" if item.id in (2, 3) else item.awaits_merge) for item in held.plan.items] items[3] = dataclasses.replace(items[3], exempt="question") none = next_chunk.planned(Plan(items), held.cut, "main", "item-{id}") - self.assertEqual(none.why, "every item of release 0.1.0 in main's todo.md waits. Under `merge = \"human\"`, these pull requests await a person's merge: #7 https://github.com/o/r/pull/7, which finishes item 1; #8 https://github.com/o/r/pull/8, which finishes items 2 and 3. The working loop stops here. Once a person has merged one, or turned one back into a draft, run loop-claude again.") + self.assertEqual(none.why, "every item of release 0.1.0 in main's todo.md waits. Under `merge = \"human\"`, these pull requests await a person's merge: #7 https://github.com/o/r/pull/7, which finishes item 1; #8 https://github.com/o/r/pull/8, which finishes items 2 and 3. The working loop stops here. Once a person has merged one, or turned one back into a draft, run build-release again.") self.assertTrue(none.awaits_merge) later = dataclasses.replace(items[0], id=9, release=(0, 2, 0), awaits_merge="#10 https://github.com/o/r/pull/10") self.assertEqual(next_chunk.awaited_merges([*items, later], (0, 1, 0)), {"#7 https://github.com/o/r/pull/7": [1], "#8 https://github.com/o/r/pull/8": [2, 3]}, "a pull request that finishes only a later release's items doesn't count") diff --git a/bin/repo_checks/test_import_order.py b/bin/repo_checks/test_import_order.py index c8e43d42..e206ad75 100644 --- a/bin/repo_checks/test_import_order.py +++ b/bin/repo_checks/test_import_order.py @@ -23,8 +23,8 @@ def unsorted_imports(source: str) -> list[int]: class ImportOrder(unittest.TestCase): def test_each_python_file_sorts_its_imports_by_their_first_binding(self): - listed = subprocess.run(["git", "ls-files", "*.py", "bin/loop-claude"], capture_output=True, check=True, cwd=ROOT, text=True).stdout.split() - self.assertIn("bin/loop-claude", listed) + listed = subprocess.run(["git", "ls-files", "*.py", "bin/build-release"], capture_output=True, check=True, cwd=ROOT, text=True).stdout.split() + self.assertIn("bin/build-release", listed) for name in listed: with self.subTest(name): self.assertEqual(unsorted_imports((ROOT / name).read_text(encoding="utf-8")), []) diff --git a/bin/repo_checks/test_package_cycles.py b/bin/repo_checks/test_package_cycles.py index e51c032e..d855857e 100644 --- a/bin/repo_checks/test_package_cycles.py +++ b/bin/repo_checks/test_package_cycles.py @@ -62,7 +62,7 @@ def part_cycles(bin_folder: pathlib.Path) -> dict[str, list[str]]: # The entry points that drive chunks. What two of them need lives in bin/chunk_driver/, so no other package imports one, its tests included. -DRIVERS = ("do_epic", "loop_claude") +DRIVERS = ("do_epic", "build_release") def driver_imports(bin_folder: pathlib.Path, drivers: tuple[str, ...]) -> list[str]: diff --git a/bin/repo_checks/test_tools_named_bare.py b/bin/repo_checks/test_tools_named_bare.py index 4c03b9b5..ed1eb28e 100644 --- a/bin/repo_checks/test_tools_named_bare.py +++ b/bin/repo_checks/test_tools_named_bare.py @@ -8,9 +8,9 @@ from repo_checks import ROOT BY_ITS_FOLDER = re.compile(r"(?:~|\$HOME)/\.claude/bin/[\w.<>-]+(?![\w.<>/-])") # The plan, the changelog and the records: their text names a tool as it was spelled when the line was written, and nobody rewrites it. HISTORY = ("CHANGELOG.md", "docs/", "todo.md") -# The lines a person runs in their own shell or a crontab, which lack the tools: only `loop-claude` is linked onto their `PATH`. +# The lines a person runs in their own shell or a crontab, which lack the tools: only `build-release` is linked onto their `PATH`. BY_HAND = { - "README.md": {"$HOME/.claude/bin/compress-archives", "~/.claude/bin/<tool>", "~/.claude/bin/loop-claude", "~/.claude/bin/notify", "~/.claude/bin/project-config"}, + "README.md": {"$HOME/.claude/bin/compress-archives", "~/.claude/bin/<tool>", "~/.claude/bin/build-release", "~/.claude/bin/notify", "~/.claude/bin/project-config"}, "presentation/README.md": {"~/.claude/bin/run-heavy"}, "presentation/build-pdf.py": {"~/.claude/bin/run-heavy"}, } diff --git a/bin/review_replay/main.py b/bin/review_replay/main.py index 8d9d4b40..85ff874c 100644 --- a/bin/review_replay/main.py +++ b/bin/review_replay/main.py @@ -46,7 +46,7 @@ instruction files off in its settings and opens the prompt with what the hook ha closes it with the header's line on the project principles. --bash-ceiling and --read-limit run the same comparison for two limits on what one tool result adds to a -claude's context, which a subagent inherits (bin/claude_code/output_limits.py). loop-claude hands the worker's +claude's context, which a subagent inherits (bin/claude_code/output_limits.py). build-release hands the worker's claude the Bash ceiling, and doesn't hand it the Read limit yet. The replay with --bash-ceiling starts under BASH_MAX_OUTPUT_LENGTH=6000, which saves a Bash result of more than 6,000 characters to a file and hands the reviewer its path and the first 2,000 characters. The replay with --read-limit starts under @@ -56,9 +56,9 @@ unchanged replay missed. The tool doesn't count what the replays read: each run' result, is in the archive. It refuses to run where its own environment already holds the variable, since the replays as archived would inherit it. -It keeps each run, a reviewer's tool calls included, and the report it prints in loop-claude's archive, in +It keeps each run, a reviewer's tool calls included, and the report it prints in build-release's archive, in replays/review-replay-<pass>-<model>[-<flag without its leading dashes>]-<UTC stamp>/ under ~/.claude/loop-claude-transcripts -or $LOOP_CLAUDE_TRANSCRIPTS. A run's .jsonl file starts with a line holding claude's arguments, working +or $BUILD_RELEASE_TRANSCRIPTS. A run's .jsonl file starts with a line holding claude's arguments, working directory, prompt, exit code and stderr, then holds claude's stream-json output; result.md holds the report. Like the loop, it tries claude three times running before it counts a reply as failed. A failed diff --git a/bin/routing_figures/archive.py b/bin/routing_figures/archive.py index e79f962d..4748774b 100644 --- a/bin/routing_figures/archive.py +++ b/bin/routing_figures/archive.py @@ -1,4 +1,4 @@ -"""Reads the chunks of every project in loop-claude's archive, and keeps the routing figures at the archive's root for the human to read.""" +"""Reads the chunks of every project in build-release's archive, and keeps the routing figures at the archive's root for the human to read.""" import contextlib import dataclasses import fcntl diff --git a/bin/routing_figures/calls.py b/bin/routing_figures/calls.py index e807b63c..3467307f 100644 --- a/bin/routing_figures/calls.py +++ b/bin/routing_figures/calls.py @@ -1,4 +1,4 @@ -"""The routing figures summed over every chunk, and the routing changes they call for: docs/decisions.md β†’ `routing: loop-claude measures review rounds…`.""" +"""The routing figures summed over every chunk, and the routing changes they call for: docs/decisions.md β†’ `routing: build-release measures review rounds…`.""" import collections import dataclasses import statistics diff --git a/bin/routing_figures/render.py b/bin/routing_figures/render.py index 038bf706..cd0cb132 100644 --- a/bin/routing_figures/render.py +++ b/bin/routing_figures/render.py @@ -13,7 +13,7 @@ def render(ladder: Ladder, figures: Figures, found: list[Call], at: str, cycle: """The figures as markdown, for the human to read. ladder orders the rungs, and since is the latest reset's stamp, empty for none.""" sections = [ "# Routing figures", - f"Measured {at}, at cycle {cycle} across loop-claude's archive, from {figures.chunks} finished chunk{'' if figures.chunks == 1 else 's'}{f' that finished after the reset of {since}' if since else ''}. {basis(figures)}", + f"Measured {at}, at cycle {cycle} across build-release's archive, from {figures.chunks} finished chunk{'' if figures.chunks == 1 else 's'}{f' that finished after the reset of {since}' if since else ''}. {basis(figures)}", "## Calls for a routing change", bullets([call.sentence() for call in found]) or "None.", *[part for dimension in DIMENSIONS for part in (f"## Dollars by {dimension}", dollars_table(figures, dimension))], diff --git a/bin/routing_figures/state.py b/bin/routing_figures/state.py index 19054022..cd33dd32 100644 --- a/bin/routing_figures/state.py +++ b/bin/routing_figures/state.py @@ -1,6 +1,6 @@ -"""What loop-claude keeps at the archive's root between measurements: docs/decisions.md β†’ `routing: loop-claude measures review rounds…`. +"""What build-release keeps at the archive's root between measurements: docs/decisions.md β†’ `routing: build-release measures review rounds…`. -STATE holds, as fields loop-claude reads back, the cycle it last measured at and each call it raised. RAISED lists the raised calls for the human to read. A chunk appends a reset to RAISED by hand, as docs/decisions.md β†’ "Working rules" says, and loop-claude reads the resets from there.""" +STATE holds, as fields build-release reads back, the cycle it last measured at and each call it raised. RAISED lists the raised calls for the human to read. A chunk appends a reset to RAISED by hand, as docs/decisions.md β†’ "Working rules" says, and build-release reads the resets from there.""" import dataclasses import json import pathlib diff --git a/bin/routing_figures/test_routing_figures.py b/bin/routing_figures/test_routing_figures.py index fd29f34c..61f251f6 100644 --- a/bin/routing_figures/test_routing_figures.py +++ b/bin/routing_figures/test_routing_figures.py @@ -274,7 +274,7 @@ class Calls(unittest.TestCase): def test_renders_each_dimension_largest_first_and_the_calls(self): chunk = ChunkFigures({"project": collections.Counter({"a": 2.5, "b": 1234.5})}, LOW, 1, 0, collections.Counter({str(HIGH): 2}), {"Explore": Reports(2, 3, 4)}, collections.Counter(), 0.0) text = render(LADDER, totals([chunk]), [Call("reports", ("Explore",))], "2026-10-15T00:00:00Z", 40, "") - self.assertIn("Measured 2026-10-15T00:00:00Z, at cycle 40 across loop-claude's archive, from 1 finished chunk.", text) + self.assertIn("Measured 2026-10-15T00:00:00Z, at cycle 40 across build-release's archive, from 1 finished chunk.", text) self.assertIn("## Calls for a routing change\n\n- Explore subagents' reports took more of the worker's context than their searches would have.\n", text) self.assertIn("## Dollars by project", text) self.assertIn("| b | $1,234.50 |\n| a | $2.50 |", text) diff --git a/bin/rule_hook/reviewer_rung.py b/bin/rule_hook/reviewer_rung.py index 0f4859de..83ebdc13 100644 --- a/bin/rule_hook/reviewer_rung.py +++ b/bin/rule_hook/reviewer_rung.py @@ -1,4 +1,4 @@ -"""Refuse an Agent or Skill call that launches a review below the rung it needs, worked out on the project's ladder from the rungs and the E + I loop-claude hands its worker: docs/decisions.md β†’ `routing:`.""" +"""Refuse an Agent or Skill call that launches a review below the rung it needs, worked out on the project's ladder from the rungs and the E + I build-release hands its worker: docs/decisions.md β†’ `routing:`.""" import pathlib import typing @@ -26,7 +26,7 @@ SECURITY_SKILLS = {"claude-security", "security-review"} def reviewer_breaches(call: Call, environ: typing.Mapping[str, str], home: str) -> list[Breach]: - """The breach of an Agent call that launches a review below its rung; none where loop-claude handed no rungs.""" + """The breach of an Agent call that launches a review below its rung; none where build-release handed no rungs.""" kind = review_kind(call.given) if kind is None or not hands_rungs(environ): return [] @@ -45,12 +45,12 @@ def reviewer_breaches(call: Call, environ: typing.Mapping[str, str], home: str) def unread(ladder: Failure, cwd: str) -> Breach: - """The breach of a review launched where loop-claude handed rungs and the project's ladder cannot be read, so nothing tells which rung the review needs.""" + """The breach of a review launched where build-release handed rungs and the project's ladder cannot be read, so nothing tells which rung the review needs.""" return Breach("reviewer-rung", f"the rung this review needs cannot be worked out: {ladder.reason}", cwd) def skill_breaches(call: Call, environ: typing.Mapping[str, str], home: str) -> list[Breach]: - """The breach of a Skill call that runs the security pass below the project's rung; none where loop-claude handed no rungs. + """The breach of a Skill call that runs the security pass below the project's rung; none where build-release handed no rungs. The skill runs on its caller's rung. A subagent launched as the security pass was held to the project's rung by reviewer_breaches. The worker's own rung is known, so its call is refused only below the project's rung. Any other subagent's rung is unknown, so its call is refused.""" skill = text(call.given, "skill").lstrip("/").rsplit(":", 1)[-1] diff --git a/bin/rule_hook/rules.py b/bin/rule_hook/rules.py index c79e7d6a..ce355168 100644 --- a/bin/rule_hook/rules.py +++ b/bin/rule_hook/rules.py @@ -47,7 +47,7 @@ RULES: dict[RuleName, Rule] = { ), # A marker would let the credentials into the transcript all the same, so no marker waives it. "env-file-read": Rule( - "an agent never reads ~/.claude/.env or a project's env-file, the file of credentials the project's config names, since a value the agent reads lands in its transcript, which loop-claude archives and the backups copy; it leaves a tool that needs a credential to read the file itself, gets the file's path from `project-config env-file`, and spells the path another way, such as \"the .env in ~/.claude\", in a command that must mention it without reading it, such as a commit's title, and searches only a folder without it", + "an agent never reads ~/.claude/.env or a project's env-file, the file of credentials the project's config names, since a value the agent reads lands in its transcript, which build-release archives and the backups copy; it leaves a tool that needs a credential to read the file itself, gets the file's path from `project-config env-file`, and spells the path another way, such as \"the .env in ~/.claude\", in a command that must mention it without reading it, such as a commit's title, and searches only a folder without it", "against ~/.claude/.env and the env-file of every config under ~/.claude-projects: a Read of one; a Grep of one, or of a folder holding one, unless a checkout ignores the file and the Grep's glob cannot match it; and a Bash command that spells one's path, or names it in a word or a redirect's target from the directory `cd` left the command in, whether or not the command reads it; and a Bash command that runs `ag`, `grep -r` or `rg` over a folder holding one, or over the directory `cd` left the command in where it names no folder, unless the tool skips the file: `ag` and `rg` skip a hidden file, one below a hidden folder of the search and one a checkout ignores, and `rg` one that none of its globs matches", overridable=False, ), @@ -77,8 +77,8 @@ RULES: dict[RuleName, Rule] = { ), # A rung is not a judgment call, and the refusal names the arguments to pass, so no marker waives it. "reviewer-rung": Rule( - "a reviewer, a comprehension seat or the security pass runs on the rung loop-claude names for it: for a seat or the security pass the project's rung, and for a reviewer the highest of the project's rung, the worker's and the one the chunk's item's E + I picks, or the project's rung where the branch changes only Markdown no agent follows, so a worker below the project's rung cannot hand a review to its own cheaper model. The rungs rank as on the project's routing ladder, and the review is refused while that ladder cannot be read", - "an Agent call, in a claude loop-claude started, whose subagent type is an agent under agents/, or whose prompt opens with seat-prompts.md's opening sentence or the one larv-review's Security section sets; and a `security-review` or `claude-security` Skill call in such a claude, which runs on its caller's rung, unless the caller is a subagent whose prompt opens with that sentence", + "a reviewer, a comprehension seat or the security pass runs on the rung build-release names for it: for a seat or the security pass the project's rung, and for a reviewer the highest of the project's rung, the worker's and the one the chunk's item's E + I picks, or the project's rung where the branch changes only Markdown no agent follows, so a worker below the project's rung cannot hand a review to its own cheaper model. The rungs rank as on the project's routing ladder, and the review is refused while that ladder cannot be read", + "an Agent call, in a claude build-release started, whose subagent type is an agent under agents/, or whose prompt opens with seat-prompts.md's opening sentence or the one larv-review's Security section sets; and a `security-review` or `claude-security` Skill call in such a claude, which runs on its caller's rung, unless the caller is a subagent whose prompt opens with that sentence", overridable=False, ), # The cap holds with no ask, so no marker waives it. diff --git a/bin/rule_hook/test_rule_hook.py b/bin/rule_hook/test_rule_hook.py index fc059234..d9def82f 100644 --- a/bin/rule_hook/test_rule_hook.py +++ b/bin/rule_hook/test_rule_hook.py @@ -158,7 +158,7 @@ class CommandBreaches(unittest.TestCase): self.assertEqual(checked(command), []) def test_a_pgrep_or_pkill_f_whose_pattern_the_command_contains_breaks_endless_wait(self): - for command in ["pgrep -f chunk-pr", "pkill -f 'loop-claude'", "pgrep -fa chunk-pr", "pgrep -u me -f chunk-pr", "pgrep --full chunk-pr", "pkill -9 -f loop-claude", "pkill -KILL -f loop-claude", "pgrep -f chunk-pr -u", "pkill --full chunk-pr --signal", "pgrep -f -", "if pgrep -f loop-claude; then echo up; fi", "until ! pgrep -f \"chunk-pr merg\" || [ $SECONDS -gt 600 ]; do sleep 15; done", "pgrep -U me -f chunk-pr", "pgrep -fUME chunk-pr", "pgrep -f9 chunk-pr", "pgrep --signal TERM --full chunk-pr", "pgrep -f 'chunk[pr'", "pgrep -f 'chunk-pr .*merg'", "nice pgrep -f chunk-pr", "bash -c 'pgrep -f chunk-pr'"]: + for command in ["pgrep -f chunk-pr", "pkill -f 'build-release'", "pgrep -fa chunk-pr", "pgrep -u me -f chunk-pr", "pgrep --full chunk-pr", "pkill -9 -f build-release", "pkill -KILL -f build-release", "pgrep -f chunk-pr -u", "pkill --full chunk-pr --signal", "pgrep -f -", "if pgrep -f build-release; then echo up; fi", "until ! pgrep -f \"chunk-pr merg\" || [ $SECONDS -gt 600 ]; do sleep 15; done", "pgrep -U me -f chunk-pr", "pgrep -fUME chunk-pr", "pgrep -f9 chunk-pr", "pgrep --signal TERM --full chunk-pr", "pgrep -f 'chunk[pr'", "pgrep -f 'chunk-pr .*merg'", "nice pgrep -f chunk-pr", "bash -c 'pgrep -f chunk-pr'"]: with self.subTest(command): self.assertEqual(checked(command), ["endless-wait"]) ending = ", or a pattern the command doesn't contain, such as `[c]hunk` for `chunk`" @@ -180,7 +180,7 @@ class CommandBreaches(unittest.TestCase): self.assertEqual(checked(command.replace("-f ", "-x ")), ["endless-wait"]) def test_a_pgrep_f_on_a_pattern_the_command_lacks_or_a_pgrep_without_f_passes_endless_wait(self): - for command in ["pgrep -f '[c]hunk-pr merg'", "pgrep -f \"$name\"", "pgrep -f '^python3 .*loop-claude$'", "pgrep -x chunk-pr", "pgrep chunk-pr", "pgrep -u me -x chunk-pr", "pkill -f -u me '[l]oop-claude'", "pkill --signal TERM --full '[c]hunk'", "pkill -KILL -f '[l]oop-claude'", "pkill -9 -f '[l]oop-claude'", "pkill --signal=TERM --full '[c]hunk'", "pgrep -f -U me '[c]hunk' -u", "echo pgrep -f chunk-pr", "git commit -m 'Refuse pgrep -f chunk-pr'", "pgrep -f"]: + for command in ["pgrep -f '[c]hunk-pr merg'", "pgrep -f \"$name\"", "pgrep -f '^python3 .*build-release$'", "pgrep -x chunk-pr", "pgrep chunk-pr", "pgrep -u me -x chunk-pr", "pkill -f -u me '[l]oop-claude'", "pkill --signal TERM --full '[c]hunk'", "pkill -KILL -f '[l]oop-claude'", "pkill -9 -f '[l]oop-claude'", "pkill --signal=TERM --full '[c]hunk'", "pgrep -f -U me '[c]hunk' -u", "echo pgrep -f chunk-pr", "git commit -m 'Refuse pgrep -f chunk-pr'", "pgrep -f"]: with self.subTest(command): self.assertEqual(checked(command), []) @@ -282,9 +282,9 @@ HOME = "/h" class ReviewerRung(unittest.TestCase): # A worker routed to Sonnet 5.5 at high, on a project whose rung is Opus 5.5 at medium, with its reviewers on the project's rung. - ENVIRON = {"LOOP_CLAUDE_PROJECT_RUNG": "claude-opus-5-5 at medium effort", "LOOP_CLAUDE_WORKER_RUNG": "claude-sonnet-5-5 at high effort", "LOOP_CLAUDE_ESCAPE_AND_IMPACT": "4"} + ENVIRON = {"BUILD_RELEASE_PROJECT_RUNG": "claude-opus-5-5 at medium effort", "BUILD_RELEASE_WORKER_RUNG": "claude-sonnet-5-5 at high effort", "BUILD_RELEASE_ESCAPE_AND_IMPACT": "4"} # The same project, with a worker, and so its reviewers, routed above it to Fable 5.2 at max. - ABOVE = {"LOOP_CLAUDE_PROJECT_RUNG": "claude-opus-5-5 at medium effort", "LOOP_CLAUDE_WORKER_RUNG": "claude-fable-5-2 at max effort", "LOOP_CLAUDE_ESCAPE_AND_IMPACT": "4"} + ABOVE = {"BUILD_RELEASE_PROJECT_RUNG": "claude-opus-5-5 at medium effort", "BUILD_RELEASE_WORKER_RUNG": "claude-fable-5-2 at max effort", "BUILD_RELEASE_ESCAPE_AND_IMPACT": "4"} def refused(self, given: dict, environ: dict[str, str] = ENVIRON) -> list[str]: return rules(reviewer_breaches(Call("Agent", given, "/r"), environ, HOME)) @@ -300,7 +300,7 @@ class ReviewerRung(unittest.TestCase): pathlib.Path(repo, "docs", "decisions.md").write_text("Decided.\n") git(repo, "add", ".") git(repo, "commit", "-q", "-m", "prose") - high = self.ENVIRON | {"LOOP_CLAUDE_ESCAPE_AND_IMPACT": "7"} + high = self.ENVIRON | {"BUILD_RELEASE_ESCAPE_AND_IMPACT": "7"} on_project = {"subagent_type": "stability-reviewer", "model": "opus", "effort": "medium"} self.assertEqual(rules(reviewer_breaches(Call("Agent", on_project, repo), high, HOME)), []) self.assertEqual(rules(reviewer_breaches(Call("Agent", {**on_project, "model": "sonnet", "effort": "high"}, repo), high, HOME)), ["reviewer-rung"]) @@ -347,14 +347,14 @@ class ReviewerRung(unittest.TestCase): def test_a_reviewer_is_held_to_the_rung_its_e_plus_i_picks_where_that_is_higher(self): self.assertEqual(self.refused({"subagent_type": "stability-reviewer", "model": "opus", "effort": "medium"}, self.ABOVE), ["reviewer-rung"]) self.assertEqual(self.refused({"subagent_type": "stability-reviewer", "model": "fable", "effort": "max"}, self.ABOVE), []) - lifted = self.ENVIRON | {"LOOP_CLAUDE_ESCAPE_AND_IMPACT": "5"} + lifted = self.ENVIRON | {"BUILD_RELEASE_ESCAPE_AND_IMPACT": "5"} self.assertEqual(self.refused({"subagent_type": "stability-reviewer", "model": "opus", "effort": "medium"}, lifted), ["reviewer-rung"]) self.assertEqual(self.refused({"subagent_type": "comprehension-seat", "prompt": "Score the project.", "model": "opus", "effort": "medium"}, lifted), []) - def test_holds_a_reviewer_to_the_higher_of_the_workers_and_the_projects_rung_where_loop_claude_handed_no_e_plus_i(self): - without = {name: rung for name, rung in self.ABOVE.items() if name != "LOOP_CLAUDE_ESCAPE_AND_IMPACT"} + def test_holds_a_reviewer_to_the_higher_of_the_workers_and_the_projects_rung_where_build_release_handed_no_e_plus_i(self): + without = {name: rung for name, rung in self.ABOVE.items() if name != "BUILD_RELEASE_ESCAPE_AND_IMPACT"} self.assertEqual(self.refused({"subagent_type": "stability-reviewer", "model": "opus", "effort": "medium"}, without), ["reviewer-rung"]) - below = {name: rung for name, rung in self.ENVIRON.items() if name != "LOOP_CLAUDE_ESCAPE_AND_IMPACT"} + below = {name: rung for name, rung in self.ENVIRON.items() if name != "BUILD_RELEASE_ESCAPE_AND_IMPACT"} self.assertEqual(self.refused({"subagent_type": "stability-reviewer", "model": "sonnet", "effort": "high"}, below), ["reviewer-rung"]) self.assertEqual(self.refused({"subagent_type": "comprehension-seat", "prompt": "Score the project.", "model": "sonnet", "effort": "high"}, without), ["reviewer-rung"]) @@ -377,7 +377,7 @@ class ReviewerRung(unittest.TestCase): self.assertEqual(self.refused({"prompt": "Find where /security-review is named.", "model": "haiku", "effort": "low"}), [], "a mention without the opening sentence is no launch") self.assertEqual(self.refused({"prompt": "Quote the rule: 'You are the security pass for this chunk.' Then stop.", "model": "haiku", "effort": "low"}), [], "a quote midway is no launch") - def test_a_claude_loop_claude_did_not_start_is_not_checked(self): + def test_a_claude_build_release_did_not_start_is_not_checked(self): self.assertEqual(self.refused({"subagent_type": "stability-reviewer", "model": "haiku", "effort": "low"}, {}), []) def project(self, ladder: str) -> tuple[str, str]: @@ -391,7 +391,7 @@ class ReviewerRung(unittest.TestCase): # A project that runs on Fable 5.2 at low and at high alone, with a worker on its rung and an E + I of 5, which picks the rung one up. TWO_RUNGS = '[{"model": "claude-fable-5-2", "effort": "low"}, {"model": "claude-fable-5-2", "effort": "high"}]' - ON_TWO_RUNGS = {"LOOP_CLAUDE_PROJECT_RUNG": "claude-fable-5-2 at low effort", "LOOP_CLAUDE_WORKER_RUNG": "claude-fable-5-2 at low effort", "LOOP_CLAUDE_ESCAPE_AND_IMPACT": "5"} + ON_TWO_RUNGS = {"BUILD_RELEASE_PROJECT_RUNG": "claude-fable-5-2 at low effort", "BUILD_RELEASE_WORKER_RUNG": "claude-fable-5-2 at low effort", "BUILD_RELEASE_ESCAPE_AND_IMPACT": "5"} def test_a_review_is_held_to_the_rung_picked_on_the_projects_own_ladder(self): checkout, home = self.project(self.TWO_RUNGS) @@ -403,11 +403,11 @@ class ReviewerRung(unittest.TestCase): self.assertEqual(rules(reviewer_breaches(Call("Agent", {**reviewer, "effort": "medium"}, "/r"), self.ON_TWO_RUNGS, HOME)), []) self.assertEqual(rules(breaches_of(Call("Agent", {**reviewer, "effort": "medium"}, checkout), home, self.ON_TWO_RUNGS)[2]), ["reviewer-rung"], "the hook reads the ladder under the home it is given") - def test_a_rung_loop_claude_handed_that_the_projects_ladder_does_not_hold_is_not_checked(self): - # As when the ladder's file changed after loop-claude started the worker: the next cycle routes on the new ladder. + def test_a_rung_build_release_handed_that_the_projects_ladder_does_not_hold_is_not_checked(self): + # As when the ladder's file changed after build-release started the worker: the next cycle routes on the new ladder. checkout, home = self.project(self.TWO_RUNGS) reviewer = Call("Agent", {"subagent_type": "stability-reviewer", "model": "haiku", "effort": "low"}, checkout) - for name in ("LOOP_CLAUDE_PROJECT_RUNG", "LOOP_CLAUDE_WORKER_RUNG"): + for name in ("BUILD_RELEASE_PROJECT_RUNG", "BUILD_RELEASE_WORKER_RUNG"): with self.subTest(name=name): environ = self.ON_TWO_RUNGS | {name: "claude-opus-5-5 at medium effort"} self.assertEqual(reviewer_breaches(reviewer, environ, home), []) @@ -416,15 +416,15 @@ class ReviewerRung(unittest.TestCase): def test_a_security_skill_is_held_to_the_projects_rung_on_the_projects_own_ladder(self): checkout, home = self.project('[{"model": "claude-fable-5-2", "effort": "high"}, {"model": "claude-fable-5-2", "effort": "low"}]') # On this ladder the worker's low effort ranks above the project's high one; on the shipped ladder it ranks below. - environ = {"LOOP_CLAUDE_PROJECT_RUNG": "claude-fable-5-2 at high effort", "LOOP_CLAUDE_WORKER_RUNG": "claude-fable-5-2 at low effort"} + environ = {"BUILD_RELEASE_PROJECT_RUNG": "claude-fable-5-2 at high effort", "BUILD_RELEASE_WORKER_RUNG": "claude-fable-5-2 at low effort"} self.assertEqual(skill_breaches(Call("Skill", {"skill": "security-review"}, checkout), environ, home), []) self.assertEqual(rules(skill_breaches(Call("Skill", {"skill": "security-review"}, "/r"), environ, HOME)), ["reviewer-rung"]) self.assertEqual(rules(breaches_of(Call("Skill", {"skill": "security-review"}, "/r"), home, environ)[2]), ["reviewer-rung"]) self.assertEqual(breaches_of(Call("Skill", {"skill": "security-review"}, checkout), home, environ)[2], []) - on_the_projects = environ | {"LOOP_CLAUDE_WORKER_RUNG": "claude-fable-5-2 at high effort"} + on_the_projects = environ | {"BUILD_RELEASE_WORKER_RUNG": "claude-fable-5-2 at high effort"} self.assertEqual(skill_breaches(Call("Skill", {"skill": "security-review"}, checkout), on_the_projects, home), [], "a worker on the project's rung runs the skill itself") - def test_a_review_is_refused_where_the_projects_ladder_cannot_be_read_and_loop_claude_handed_rungs(self): + def test_a_review_is_refused_where_the_projects_ladder_cannot_be_read_and_build_release_handed_rungs(self): checkout, home = self.project("[]") own = pathlib.Path(home, ".claude-projects", "acme", "routing-ladder.json") reviewer = Call("Agent", {"subagent_type": "stability-reviewer", "model": "fable", "effort": "max"}, checkout) @@ -432,7 +432,7 @@ class ReviewerRung(unittest.TestCase): self.assertEqual(rules(breaches), ["reviewer-rung"]) self.assertTrue(breaches[0].detail.startswith(f"the rung this review needs cannot be worked out: {own}: it holds no list of rungs. "), breaches[0].detail) self.assertEqual(breaches[0].directory, checkout) - self.assertEqual(reviewer_breaches(reviewer, {}, home), [], "a claude loop-claude did not start is not checked") + self.assertEqual(reviewer_breaches(reviewer, {}, home), [], "a claude build-release did not start is not checked") self.assertEqual(reviewer_breaches(Call("Agent", {"subagent_type": "Explore"}, checkout), self.ON_TWO_RUNGS, home), [], "nor is a subagent that reviews nothing") self.assertEqual(skill_breaches(Call("Skill", {"skill": "simplify"}, checkout), self.ON_TWO_RUNGS, home), []) @@ -465,7 +465,7 @@ class ReviewerRung(unittest.TestCase): unreadable = skill_breaches(Call("Skill", {"skill": "security-review"}, "/r", "general-purpose", "/nonexistent/agent-a1.jsonl", True), self.ENVIRON, HOME) self.assertEqual(rules(unreadable), ["reviewer-rung"]) - def test_any_other_skill_or_a_claude_loop_claude_did_not_start_is_not_checked(self): + def test_any_other_skill_or_a_claude_build_release_did_not_start_is_not_checked(self): self.assertEqual(rules(self.skill_refused({"skill": "simplify"})), []) self.assertEqual(rules(self.skill_refused({"skill": "security-review"}, {})), []) diff --git a/bin/rung_replay/archive.py b/bin/rung_replay/archive.py index ff02578a..e7061a31 100644 --- a/bin/rung_replay/archive.py +++ b/bin/rung_replay/archive.py @@ -1,4 +1,4 @@ -"""Keeps each run of judge-replay and review-replay, and the report each prints, in loop-claude's archive: docs/decisions.md β†’ `loop-claude: the archive keeps the raw transcript and each judge run, …`.""" +"""Keeps each run of judge-replay and review-replay, and the report each prints, in build-release's archive: docs/decisions.md β†’ `build-release: the archive keeps the raw transcript and each judge run, …`.""" import dataclasses import hashlib import json @@ -17,7 +17,7 @@ RESULT = "result.md" def replay_folder(root: pathlib.Path, tool: str, argv: list[str], now: float) -> pathlib.Path: - """The folder a replay of tool, run with argv at now, keeps its runs and its result in, under the archive at root. It holds no outcomes file, so no reader of loop-claude's archive takes it for a chunk's.""" + """The folder a replay of tool, run with argv at now, keeps its runs and its result in, under the archive at root. It holds no outcomes file, so no reader of build-release's archive takes it for a chunk's.""" name = "-".join([tool, *(arg.lstrip("-") for arg in argv), time.strftime("%Y%m%dT%H%M%SZ", time.gmtime(now))]) return root / "replays" / re.sub(r"[^A-Za-z0-9._-]", "_", name) diff --git a/bin/rung_replay/command.py b/bin/rung_replay/command.py index 89467082..4c137bda 100644 --- a/bin/rung_replay/command.py +++ b/bin/rung_replay/command.py @@ -26,7 +26,7 @@ def arguments_or_exit(tool: str, argv: list[str], help_text: str, usage: str, re def projects_on(model: str, home: pathlib.Path) -> list[str] | Failure: - """The keys of the projects loop-claude's models file, under home, runs on model, sorted.""" + """The keys of the projects build-release's models file, under home, runs on model, sorted.""" models = read_models_file(paths_from(home).models_file) if isinstance(models, Failure): return models diff --git a/bin/rung_replay/search.py b/bin/rung_replay/search.py index 84416bbb..bf6c5a6a 100644 --- a/bin/rung_replay/search.py +++ b/bin/rung_replay/search.py @@ -122,7 +122,7 @@ def replayed_on(cases: list[Case], rung: Rung, replay_one: typing.Callable[[Case def first_reply(attempt: typing.Callable[[], T | Failure | Limited]) -> T | Failure | Limited: """The first reply that is no Failure, or the last of FAILURES_RUNNING failures. - It counts failures as loop-claude's retried does, but neither waits between attempts nor waits out a usage limit, which ends a replay. + It counts failures as build-release's retried does, but neither waits between attempts nor waits out a usage limit, which ends a replay. """ for _ in range(FAILURES_RUNNING - 1): if not isinstance(reply := attempt(), Failure): diff --git a/bin/score_outcomes/main.py b/bin/score_outcomes/main.py index 44c100a5..527c7b0b 100644 --- a/bin/score_outcomes/main.py +++ b/bin/score_outcomes/main.py @@ -78,14 +78,14 @@ that has any, then how many have none: the defects that reappear in what already other half of that counter-signal. Then, newest first, how many of the human's typed answers each finished chunk's judge quoted as -reversing a choice the worker took on its own recommendation, for every chunk loop-claude finished +reversing a choice the worker took on its own recommendation, for every chunk build-release finished that has any, then how many have none: how often a choice the worker took on its own recommendation -fails to hold. It reads loop-claude's archive, and counts only chunks whose verdicts record a +fails to hold. It reads build-release's archive, and counts only chunks whose verdicts record a Config line, since earlier judges didn't look for reversals. Exit 1, saying why, on bad arguments, when git cannot start, finds no checkout or reads a shallow clone, or the default branch cannot be read; or, after the rest of the report, when the anchors or -loop-claude's archive cannot be read. +build-release's archive cannot be read. """ import functools import os @@ -156,7 +156,7 @@ def report_text(results: list[Result], anchored: Anchors | Failure, given: dict[ sections.append(["Median outcome at each guessed score, among chunks that shipped one item, never-replayed ones left out:", "", *report(results)]) sections.append(["πŸ”΄ and 🟑 findings, with how many a reviewer marked `[misread]`, per finished chunk whose round titles count them, newest first:", "", *misreads(results)]) sections.append(["Later fixes: the chunks that fixed code each finished chunk shipped, newest first:", "", *fixed_later(results)]) - sections.append(["Reversals: the human's typed answers that reversed a choice the worker took on its own recommendation, per chunk loop-claude finished, newest first:", "", *([f"- None: {reversal.reason}"] if isinstance(reversal, Failure) else reversal)]) + sections.append(["Reversals: the human's typed answers that reversed a choice the worker took on its own recommendation, per chunk build-release finished, newest first:", "", *([f"- None: {reversal.reason}"] if isinstance(reversal, Failure) else reversal)]) if any(result.landing != "merge" for result in results): sections.append(UNMERGED) return "\n\n".join("\n".join(section) for section in sections) @@ -177,7 +177,7 @@ def read_anchors(home: pathlib.Path) -> Anchors | Failure: def read_reversals(home: pathlib.Path) -> list[str] | Failure: - """The reversals in loop-claude's archive of this project, which the main checkout's path keys, whichever worktree this runs in.""" + """The reversals in build-release's archive of this project, which the main checkout's path keys, whichever worktree this runs in.""" common = git("rev-parse", "--path-format=absolute", "--git-common-dir") if isinstance(common, Failure): return common diff --git a/bin/score_outcomes/reversals.py b/bin/score_outcomes/reversals.py index 923b1e67..928a95ff 100644 --- a/bin/score_outcomes/reversals.py +++ b/bin/score_outcomes/reversals.py @@ -1,4 +1,4 @@ -"""The human's reversals of choices workers took on their own recommendation, per finished chunk in loop-claude's archive. docs/decisions.md β†’ `loop-claude: a judge decides each interrupt and each quoted answer…`, in its entry of 2026-11-08, is valid while they stay few.""" +"""The human's reversals of choices workers took on their own recommendation, per finished chunk in build-release's archive. docs/decisions.md β†’ `build-release: a judge decides each interrupt and each quoted answer…`, in its entry of 2026-11-08, is valid while they stay few.""" import json import pathlib @@ -26,7 +26,7 @@ def reversal_lines(project_archive: pathlib.Path) -> list[str] | Failure: found = dict.fromkeys(quote for text in texts for quote in reversals(text)) counted.append((f"{chunk.finished}{item_of(texts)}", len(found))) if not counted: - return ["- None: loop-claude's archive holds no finished chunk whose verdicts record a Config line."] + return ["- None: build-release's archive holds no finished chunk whose verdicts record a Config line."] lines = [f"- {chunk}: {count} reversed" for chunk, count in counted if count] others = len(counted) - len(lines) return lines + ([f"- {'The other' if lines else 'All'} {plural(others, 'finished chunk')}: none."] if others else []) diff --git a/bin/score_outcomes/test_score_outcomes.py b/bin/score_outcomes/test_score_outcomes.py index 219d9444..d2438307 100644 --- a/bin/score_outcomes/test_score_outcomes.py +++ b/bin/score_outcomes/test_score_outcomes.py @@ -198,7 +198,7 @@ class ReportText(unittest.TestCase): def test_lists_the_nearest_by_r_then_the_anchors_then_the_medians(self): found = [result(1, 5, 3, None, merged="2026-10-13T10:00:00Z"), result(2, 1, 3, None, merged="2026-10-12T10:00:00Z")] too_few = "such chunks record" - self.assertEqual(report_text(found, [("L 1", (2,))], {"L": 1, "E": 1, "I": 1, "S": 3}, ["- None: loop-claude's archive holds no finished chunk whose verdicts record a Config line."]), f"""Finished items nearest L 1, E 1, I 1, so R 1, and S 3, closest first: + self.assertEqual(report_text(found, [("L 1", (2,))], {"L": 1, "E": 1, "I": 1, "S": 3}, ["- None: build-release's archive holds no finished chunk whose verdicts record a Config line."]), f"""Finished items nearest L 1, E 1, I 1, so R 1, and S 3, closest first: - Item 2, R 1, S 3: 10 lines in 1 file, 1 round past each pass's first, 0 πŸ”΄, 0 🟑, 0 later fixes; merged 2026-10-12T10:00:00Z in aaaaaaa. **Item 2.** - Item 1, R 5, S 3: 10 lines in 1 file, 1 round past each pass's first, 0 πŸ”΄, 0 🟑, 0 later fixes; merged 2026-10-13T10:00:00Z in aaaaaaa. **Item 1.** @@ -224,9 +224,9 @@ Later fixes: the chunks that fixed code each finished chunk shipped, newest firs - None: no later chunk fixed code a finished chunk shipped. -Reversals: the human's typed answers that reversed a choice the worker took on its own recommendation, per chunk loop-claude finished, newest first: +Reversals: the human's typed answers that reversed a choice the worker took on its own recommendation, per chunk build-release finished, newest first: -- None: loop-claude's archive holds no finished chunk whose verdicts record a Config line.""") +- None: build-release's archive holds no finished chunk whose verdicts record a Config line.""") def test_lists_each_chunks_findings_with_their_misread_count_newest_first_once_per_chunk(self): found = [result(1, 5, 3, None, findings=(1, 2), misread=1, merge="bbbbbbb", merged="2026-10-12T10:00:00Z", shipped_with=(2,)), result(2, 5, 3, None, findings=(1, 2), misread=1, merge="bbbbbbb", merged="2026-10-12T10:00:00Z", shipped_with=(1,)), result(3, 5, 3, None, findings=(0, 4), misread=0, merge="ccccccc", merged="2026-10-14T10:00:00Z", landing="rebase"), result(4, 5, 3, None)] @@ -327,9 +327,9 @@ class ScoreOutcomesTool(unittest.TestCase): self.assertEqual((ran.returncode, ran.stdout), (1, "")) self.assertEqual(ran.stderr, f"score-outcomes: this project is not supported yet: the project's config puts {config.parent}/todo.md elsewhere than todo.md, docs/comprehension-history.md, docs/reading-cost.md in the checkout, the only paths whose commits are read so far\n") - def test_counts_the_reversals_in_loop_claudes_archive_of_the_main_checkout_run_from_a_worktree(self): + def test_counts_the_reversals_in_build_releases_archive_of_the_main_checkout_run_from_a_worktree(self): archive = pathlib.Path(self.env["HOME"], "archive") - self.env["LOOP_CLAUDE_TRANSCRIPTS"] = str(archive) + self.env["BUILD_RELEASE_TRANSCRIPTS"] = str(archive) chunk_file(project_archive(str(self.checkout), pathlib.Path(self.env["HOME"]), self.env), "a", ("2026-11-02T10:00:00Z", outcomes.finished('{"model": "m", "item": 4}', "e", "j", annotation=outcomes.Annotation("c", reversed="No.")))) worktree = pathlib.Path(self.env["HOME"], "proj-item-4") self.git("worktree", "add", "-q", str(worktree)) @@ -534,7 +534,7 @@ class Reversals(unittest.TestCase): worker = '{"model": "m", "item": 7}' with tempfile.TemporaryDirectory() as root: archive = pathlib.Path(root) - self.assertEqual(reversal_lines(archive), ["- None: loop-claude's archive holds no finished chunk whose verdicts record a Config line."]) + self.assertEqual(reversal_lines(archive), ["- None: build-release's archive holds no finished chunk whose verdicts record a Config line."]) chunk_file(archive, "old", ("2026-11-01T10:00:00Z", outcomes.finished(worker, "e", "j", annotation=outcomes.Annotation(reversed="No.")))) chunk_file(archive, "reversed", ("2026-11-02T10:00:00Z", outcomes.unfinished(worker, "e", "j", "", annotation=outcomes.Annotation("c", reversed="No."))), ("2026-11-02T11:00:00Z", outcomes.unfinished(worker, "e", "j", "", annotation=outcomes.Annotation("c", reversed="No."))), ("2026-11-02T12:00:00Z", outcomes.finished(worker, "e", "j", annotation=outcomes.Annotation("c", reversed="Use X.")))) chunk_file(archive, "kept", ("2026-11-03T10:00:00Z", outcomes.finished('{"model": "m"}', "e", "j", annotation=outcomes.Annotation("c")))) diff --git a/bin/subagent_rung/main.py b/bin/subagent_rung/main.py index 5748eb38..9090101c 100644 --- a/bin/subagent_rung/main.py +++ b/bin/subagent_rung/main.py @@ -12,7 +12,7 @@ naming the ladder's file, and exits 0; launch the subagent with no model or effo It reads the routing ladder of the project whose checkout it runs in: routing-ladder.json in the folder of the project's config, ~/.claude-projects/<key>/, or else the one this setup ships, as in -a checkout no config names. loop-claude --help shows the file's shape. +a checkout no config names. build-release --help shows the file's shape. Exit 1, saying why, on bad arguments, or where the project's config or its routing ladder is faulty or cannot be read. diff --git a/bin/task_bench/figures/gather.py b/bin/task_bench/figures/gather.py index 3d3ebb94..ca00aec8 100644 --- a/bin/task_bench/figures/gather.py +++ b/bin/task_bench/figures/gather.py @@ -62,7 +62,7 @@ def run_claude(args: list[str], cwd: str, prompt: str) -> subprocess.CompletedPr def project_rung(home: pathlib.Path, git: Git) -> Rung | Failure: - """The cheapest rung for the model loop-claude runs the project on. The routing ladder is that of the project the process runs in.""" + """The cheapest rung for the model build-release runs the project on. The routing ladder is that of the project the process runs in.""" common = git("rev-parse", "--path-format=absolute", "--git-common-dir") if isinstance(common, Failure): return common @@ -73,7 +73,7 @@ def project_rung(home: pathlib.Path, git: Git) -> Rung | Failure: if isinstance(models, Failure): return models if key not in models: - return Failure(f"{saved} names no model for {key}: run loop-claude in the project once, which asks for it.") + return Failure(f"{saved} names no model for {key}: run build-release in the project once, which asks for it.") ladder = project_ladder(None, home) if isinstance(ladder, Failure): return ladder diff --git a/bin/task_bench/figures/test_gather.py b/bin/task_bench/figures/test_gather.py index a9d73b3f..265a34fd 100644 --- a/bin/task_bench/figures/test_gather.py +++ b/bin/task_bench/figures/test_gather.py @@ -99,7 +99,7 @@ class GatherTest(unittest.TestCase): self.assertEqual(gather(self.env, self.home, self.claude)[0], "The gathering claude didn't say anything.") def test_refuses_where_the_project_has_no_model_on_its_ladder(self): - for saved, said in (({}, f"{self.models} names no model for calc: run loop-claude in the project once, which asks for it."), ({"calc": "claude-haiku-5-5"}, "calc runs on claude-haiku-5-5, which is not on its routing ladder.")): + for saved, said in (({}, f"{self.models} names no model for calc: run build-release in the project once, which asks for it."), ({"calc": "claude-haiku-5-5"}, "calc runs on claude-haiku-5-5, which is not on its routing ladder.")): self.models.write_text(json.dumps(saved)) found = gather(self.env, self.home, self.claude) self.assertEqual((found.reason if isinstance(found, Failure) else found, self.calls), (said, [])) diff --git a/bin/task_bench/main.py b/bin/task_bench/main.py index 4b252624..e70f5276 100644 --- a/bin/task_bench/main.py +++ b/bin/task_bench/main.py @@ -163,7 +163,7 @@ features the heading reads `task-bench features of <branch>: ...` instead, for o of <branch>: ...`, and for one of shipped features `task-bench shipped-features of <branch>: ...`. No tool reads the entry as a ruling or a scoring run. The bench's last line says where the entry went. A bench that fails or stops doesn't record anything. `task-bench gather`, run in the same checkout, turns the digest into plan items. It starts a claude on the project's rung, the -cheapest rung of the model loop-claude runs the project on, with the digest and the prompt in bin/task_bench/figures/gather-prompt.md. +cheapest rung of the model build-release runs the project on, with the digest and the prompt in bin/task_bench/figures/gather-prompt.md. That claude files an item with `todo-item add` for each place the runs show to be hard, and leaves the plan's file uncommitted. gather prints that claude's answer and removes the bench's folder. Where claude fails, the folder stays, for another try. @@ -184,7 +184,7 @@ Where the API refuses a run, the bench stops there and exits 1 too, after the ta With --record-figures it also exits 1, saying why: before it plants a bug, where no config names the checkout or the history cannot be read; and after the bench, where the history already holds that branch's bench of those two commits or cannot be written. The folder then still holds the bench's results. -gather exits 1, saying why, outside a checkout, without a digest, where loop-claude has saved no model for the project or the +gather exits 1, saying why, outside a checkout, without a digest, where build-release has saved no model for the project or the model is not on its routing ladder, and where its claude fails or hits a usage limit. """ import dataclasses diff --git a/bin/test_env.py b/bin/test_env.py index 09106e0d..50b978de 100644 --- a/bin/test_env.py +++ b/bin/test_env.py @@ -2,10 +2,10 @@ import os import unittest -# A git hook's GIT_DIR, the host's LOOP_CLAUDE_* or PYTHONPATH would point the program under test at the host's own state, -# and the host's CLAUDE_CODE_SANDBOXED would hide whether loop-claude sets it. +# A git hook's GIT_DIR, the host's BUILD_RELEASE_* or PYTHONPATH would point the program under test at the host's own state, +# and the host's CLAUDE_CODE_SANDBOXED would hide whether build-release sets it. def isolated_env() -> dict[str, str]: - return {name: value for name, value in os.environ.items() if not name.startswith(("GIT_", "LOOP_CLAUDE_", "PYTHON")) and name != "CLAUDE_CODE_SANDBOXED"} + return {name: value for name, value in os.environ.items() if not name.startswith(("GIT_", "BUILD_RELEASE_", "PYTHON")) and name != "CLAUDE_CODE_SANDBOXED"} # Call it first in a test that takes a file's or a folder's permissions away. diff --git a/bin/text_files/compressed.py b/bin/text_files/compressed.py index 37b31c45..03653b50 100644 --- a/bin/text_files/compressed.py +++ b/bin/text_files/compressed.py @@ -1,6 +1,6 @@ """A file kept plain, or gzipped beside its plain name as <name>.gz: reading it by its plain name, and compressing it. -Why gzip and when a file is compressed: docs/decisions.md β†’ `archives: gzip each transcript in loop-claude's archive and each file in the review folders 30 days after it last changed, keeping all of them`. +Why gzip and when a file is compressed: docs/decisions.md β†’ `archives: gzip each transcript in build-release's archive and each file in the review folders 30 days after it last changed, keeping all of them`. """ import errno import gzip diff --git a/bin/todo_item/doubles.py b/bin/todo_item/doubles.py index 0131e48d..bc6a03bf 100644 --- a/bin/todo_item/doubles.py +++ b/bin/todo_item/doubles.py @@ -5,7 +5,7 @@ UNREADABLE_BULLETS = ( "- `bin/judge_replay/main.py` (small)", "- `bin/do_epic/main.py` (small)", "- `principles/technical-principles.md`: the tests bullet group, `A valuable test checks behaviour` (small)", - "- `README.md`: loop-claude's section (small)", + "- `README.md`: build-release's section (small)", "- `bin/rule_hook/rules.py`: the rule table (small)", "- `settings.json`: the PreToolUse matcher (small)", ) diff --git a/bin/todo_item/test_todo_item.py b/bin/todo_item/test_todo_item.py index 1e88b82d..f3e4a16c 100644 --- a/bin/todo_item/test_todo_item.py +++ b/bin/todo_item/test_todo_item.py @@ -490,7 +490,7 @@ class Edit(TodoItem): class UnreadableTouches(TodoItem): - """A `Touches:` list touch-predictions cannot read is refused when written, since loop-claude doesn't start any chunk beside an item whose list it cannot read.""" + """A `Touches:` list touch-predictions cannot read is refused when written, since build-release doesn't start any chunk beside an item whose list it cannot read.""" def test_add_and_edit_refuse_each_bullet_that_stalled_the_loop(self): for bullet in UNREADABLE_BULLETS: diff --git a/bin/transcript_archive/__init__.py b/bin/transcript_archive/__init__.py index 84d3d245..ce333f9f 100644 --- a/bin/transcript_archive/__init__.py +++ b/bin/transcript_archive/__init__.py @@ -1,11 +1,11 @@ -"""The archive of loop-claude's transcripts: where each file lives, what it holds, and when a copy is replaced. +"""The archive of build-release's transcripts: where each file lives, what it holds, and when a copy is replaced. <archive root>/<project key>/<chunk>/<sha256>.jsonl <archive root>/<project key>/<chunk>/<sha256>.outcomes.md <archive root>/<project key>/<chunk>/session/... <archive root>/<project key>/<chunk>/judge/<sha256>.json -- The archive root is $LOOP_CLAUDE_TRANSCRIPTS, or ~/.claude/loop-claude-transcripts (location.archive_root). +- The archive root is $BUILD_RELEASE_TRANSCRIPTS, or ~/.claude/loop-claude-transcripts (location.archive_root). - The project key is the checkout's path relative to ~/code, or to / outside it (project_key.project_key). - <chunk> is the hash of the transcript's first line with a timestamp (location.chunk_folder). It is the same for every cycle of a chunk, and differs between chunks, since a finished chunk's session is deleted diff --git a/bin/transcript_archive/location.py b/bin/transcript_archive/location.py index b9867c6f..9f62f2eb 100644 --- a/bin/transcript_archive/location.py +++ b/bin/transcript_archive/location.py @@ -11,8 +11,8 @@ FILE_SUFFIX = ".outcomes.md" def archive_root(home: pathlib.Path, env: typing.Mapping[str, str]) -> pathlib.Path: - """Where loop-claude archives every project's chunks.""" - return pathlib.Path(env["LOOP_CLAUDE_TRANSCRIPTS"]).expanduser() if env.get("LOOP_CLAUDE_TRANSCRIPTS") else home / CLAUDE_HOME / "loop-claude-transcripts" + """Where build-release archives every project's chunks.""" + return pathlib.Path(env["BUILD_RELEASE_TRANSCRIPTS"]).expanduser() if env.get("BUILD_RELEASE_TRANSCRIPTS") else home / CLAUDE_HOME / "loop-claude-transcripts" def project_archive(checkout_root: str, home: pathlib.Path, env: typing.Mapping[str, str]) -> pathlib.Path: diff --git a/bin/transcript_archive/outcomes.py b/bin/transcript_archive/outcomes.py index 68db026f..52d91e48 100644 --- a/bin/transcript_archive/outcomes.py +++ b/bin/transcript_archive/outcomes.py @@ -48,11 +48,11 @@ REVERSED_AT = re.compile(rf"^{re.escape(REVERSED)}\n((?:> .*\n)*> .*)", re.MULTI class Annotation(typing.NamedTuple): - """What a verdict, an interrupt or a quoted answer records beside its judge lines, so a change to the setup can be judged before and after: docs/decisions.md β†’ `loop-claude: each verdict records the claude-config release and commit that ran it…`. Each part is left out where empty; the cycle always gives config.""" + """What a verdict, an interrupt or a quoted answer records beside its judge lines, so a change to the setup can be judged before and after: docs/decisions.md β†’ `build-release: each verdict records the claude-config release and commit that ran it…`. Each part is left out where empty; the cycle always gives config.""" config: str = "" # The block spent_block renders. spent: str = "" - # The human's whole typed answer that holds the judge's quote of the reversal, as loop-claude checked it. + # The human's whole typed answer that holds the judge's quote of the reversal, as build-release checked it. reversed: str = "" @@ -134,7 +134,7 @@ def answered(*, question: str, sources: str, answer: str, evidence: str, escalat def rejected(why: str, reply: str, judge: str, *, judge_cost: float = 0.0, judge_run: JudgeRun | None = None) -> str: - """A judge reply loop-claude rejected, with the reason and the reply as json.""" + """A judge reply build-release rejected, with the reason and the reply as json.""" return f"{REJECTED}: {why}\n\nReply:\n{quoted(reply)}\n\n{judge_lines(judge, judge_cost, judge_run)}" diff --git a/bin/transcript_archive/project_key.py b/bin/transcript_archive/project_key.py index d62298b1..5d52db12 100644 --- a/bin/transcript_archive/project_key.py +++ b/bin/transcript_archive/project_key.py @@ -2,7 +2,7 @@ import pathlib def project_key(checkout_root: str, home: pathlib.Path) -> str: - """The checkout's path relative to ~/code, or to / outside it: what names a project's loop-claude session, its entry in the models file and its archive folder.""" + """The checkout's path relative to ~/code, or to / outside it: what names a project's build-release session, its entry in the models file and its archive folder.""" return checkout_root.removeprefix(f"{home / 'code'}/").lstrip("/") diff --git a/bin/transcript_archive/test_transcript_archive.py b/bin/transcript_archive/test_transcript_archive.py index 438291d0..5dbe8cec 100644 --- a/bin/transcript_archive/test_transcript_archive.py +++ b/bin/transcript_archive/test_transcript_archive.py @@ -263,7 +263,7 @@ class Location(unittest.TestCase): self.assertEqual(project_key("/h/code", home), "h/code") self.assertEqual(project_key("/srv/log", home), "srv/log") self.assertEqual(project_archive("/h/code/log", home, {}), pathlib.Path("/h/.claude/loop-claude-transcripts/log")) - self.assertEqual(project_archive("/h/code/log", home, {"LOOP_CLAUDE_TRANSCRIPTS": "/a"}), pathlib.Path("/a/log")) + self.assertEqual(project_archive("/h/code/log", home, {"BUILD_RELEASE_TRANSCRIPTS": "/a"}), pathlib.Path("/a/log")) def test_finds_the_checkout_a_key_names_under_code_or_else_under_the_root(self): with tempfile.TemporaryDirectory() as home: diff --git a/docs/decisions.md b/docs/decisions.md index b5e254cb..22ed2d3e 100644 --- a/docs/decisions.md +++ b/docs/decisions.md @@ -4,28 +4,28 @@ Each project principle states one rule that the decisions below apply; their ent 1. **Cut cost only where a measurement of archived chunks shows quality holds.** Chunk bundling, the round cap, which fixes rerun a pass, a reviewer of its own for each pass, the review a branch changing only Markdown no agent follows gets, the passes kept for the release review, review opt-outs, the security pass, compaction and the routing ladder all apply it. 2. **A measurement files or ranks work, and never blocks a merge.** The comprehension floor and check, and a reading-cost rise, apply it. A merge waits on a scoring run the plan calls for only until the run is recorded, whatever it scores. -3. **Each file has one writer.** `~/.claude/loop-claude-models.json` is written only by `save_model`, which the entry points, loop-claude and do-epic, both call. `~/.claude.json` is Claude Code's, and `~/.claude` moves only through `deploy-release`. The exception is `~/.claude/settings.json`, which Claude Code writes from any session. Git's clean filter `bin/settings_filter.py` keeps each machine's model and Claude Code's key order out of every commit, and `README.md` β†’ "Update" carries its other changes into this repo. +3. **Each file has one writer.** `~/.claude/loop-claude-models.json` is written only by `save_model`, which the entry points, build-release and do-epic, both call. `~/.claude.json` is Claude Code's, and `~/.claude` moves only through `deploy-release`. The exception is `~/.claude/settings.json`, which Claude Code writes from any session. Git's clean filter `bin/settings_filter.py` keeps each machine's model and Claude Code's key order out of every commit, and `README.md` β†’ "Update" carries its other changes into this repo. 4. **A rule a program can check is enforced by a program, and reviewers rule on the rest.** rule-hook and its overrides, `docker-run-memory`, the refused writes of reviewers under `agents/`, and CI with `main`'s branch protection apply it. 5. **A chunk can't vouch for itself.** What a chunk writes is approved by a review pass, by the human, or by a precedent the repo held before the chunk began. So an unanswered ask leaves the PR unmerged, the human approves the premises chunk and runs `deploy-release --cut`, and the judge holds a chunk open while an answer the human typed isn't recorded anywhere. -6. **An unattended run never waits on a prompt, and a lasting failure stops it.** Every claude loop-claude starts bypasses permissions inside its sandbox, each claude it opens on a terminal has `CLAUDE_CODE_SANDBOXED` set, and interactive sessions run in auto mode with the dangerous-mode prompt skipped. A failed archive stops the loop, while a `claude` that cannot start, as during an update, is retried. -7. **One word names one thing, and one rule has one home.** In `bin/`, an outcome is an entry of a `.outcomes.md` file in loop-claude's archive, a record is a document tools or people keep entries in, and a place is what a comprehension seat names. `CLAUDE.md` holds only the rules no path can scope, and each `rules/` file loads by its `paths:`. +6. **An unattended run never waits on a prompt, and a lasting failure stops it.** Every claude build-release starts bypasses permissions inside its sandbox, each claude it opens on a terminal has `CLAUDE_CODE_SANDBOXED` set, and interactive sessions run in auto mode with the dangerous-mode prompt skipped. A failed archive stops the loop, while a `claude` that cannot start, as during an update, is retried. +7. **One word names one thing, and one rule has one home.** In `bin/`, an outcome is an entry of a `.outcomes.md` file in build-release's archive, a record is a document tools or people keep entries in, and a place is what a comprehension seat names. `CLAUDE.md` holds only the rules no path can scope, and each `rules/` file loads by its `paths:`. # Decisions no project principle covers -- archives: gzip each transcript in loop-claude's archive and each file in the review folders 30 days after it last changed, keeping all of them +- archives: gzip each transcript in build-release's archive and each file in the review folders 30 days after it last changed, keeping all of them - bin/: a test parametrizes its cases with `subTest`, since pytest's `parametrize` doesn't reach a unittest `TestCase` - bin/: the tools run on the host's Python, with no container, and so do their tests outside CI -- bin/: the tools send no OTLP traces, logs or metrics, and loop-claude's archive holds the trace of each cycle +- bin/: the tools send no OTLP traces, logs or metrics, and build-release's archive holds the trace of each cycle - bin/: the tools support only the latest stable Python, and the tests, written in plain unittest, run on it in four pytest-xdist workers - chunk-pr: the chunks of a project merge one at a time on a machine, each finishing its plan items in its turn, and a pull request that waits for an approval leaves the queue while it waits - Claude Code in a home of its own: a `CLAUDE_CONFIG_DIR` home loads `CLAUDE.md`, rules, agents, skills, hooks and plugins, and `CLAUDE_CODE_OAUTH_TOKEN` signs in there, but never under `--bare` - deploy: this repo keeps no `AGENTS.md`, since `~/.claude` is its checkout; its principles and decision titles head `docs/decisions.md`, its working rules follow them there, and its `.claude/settings.json` excludes every `.claude/CLAUDE.md`, so a session in the clone loads only the clone's `CLAUDE.md` - do-epic: drives one Jira epic whose items span repos, or have none, ranked by the epic's goals, then code health, then each repo's goals, and closes the epic only once the human confirms every goal - epic-branch: an epic's chunks branch off and merge into a working branch its project's config names, without a person, and a person merges that branch into the default branch in one pull request -- loop-claude: each verdict records the claude-config release and commit that ran it, the raw tokens each thread spent by model and kind since the previous outcome that recorded a spend, and the human's typed answer the judge quotes as reversing a choice the worker took on its own recommendation -- loop-claude: each chunk runs in its own tmux window, of one tmux session per project, up to `parallel-chunks` at once, and needs tmux 3.2; its claude session is named after its window, its id derived from that name; a chunk's commit in the config's folder takes only the file it changed -- machine load: a heavy command waits for one of the machine's heavy slots, one for every 4 CPUs, which every session shares, and loop-claude starts a worker only while at least a quarter of the machine's memory is available -- names: the plan calls the project and its repo `dev-factory`, loop-claude `build-release` and do-epic `build-epic`, and the code keeps today's names until its planned items ship +- build-release: each verdict records the claude-config release and commit that ran it, the raw tokens each thread spent by model and kind since the previous outcome that recorded a spend, and the human's typed answer the judge quotes as reversing a choice the worker took on its own recommendation +- build-release: each chunk runs in its own tmux window, of one tmux session per project, up to `parallel-chunks` at once, and needs tmux 3.2; its claude session is named after its window, its id derived from that name; a chunk's commit in the config's folder takes only the file it changed +- machine load: a heavy command waits for one of the machine's heavy slots, one for every 4 CPUs, which every session shares, and build-release starts a worker only while at least a quarter of the machine's memory is available +- names: the plan calls the project and its repo `dev-factory`, build-release `build-release` and do-epic `build-epic`, and the code keeps today's names until its planned items ship - principles: about seven things per level, four or five where they act on each other, more where a reader finds them by name; crossing a limit asks for a grouping or a recorded reason - project config: a record may name a Confluence Cloud page as `confluence:` and its address, the loop reads and writes it as markdown, and a write never overwrites a save made since the loop's read - project config: a tool that reads a file's commits says where it does not support that file, and the work goes on @@ -43,7 +43,7 @@ Each project principle states one rule that the decisions below apply; their ent - routing: a worker delegates a task only where it needs just the task's conclusion, and each subagent runs on the rung its task's L picks from the project's rung, never below the project's rung when it files or scores todo.md items - routing: a worker hands a task one rung up on each escalation trigger, up to two rungs above the rung its item picks unless the human agrees, and opens the subagent's prompt with the trigger so the routing figures count it - routing: a worker whose run ends asking for a higher rung, citing an escalation trigger the judge finds in the transcript, steps one rung up as the judge interrupts or quotes an answer, or next cycle, up to two rungs above the rung its item picks -- routing: loop-claude reads the items a chunk takes from the worker's latest `Chunk items:` line and scores them by `todo.md` as the default branch held it when the cycle started; the judge reports the escalation and whether a release is ready to cut +- routing: build-release reads the items a chunk takes from the worker's latest `Chunk items:` line and scores them by `todo.md` as the default branch held it when the cycle started; the judge reports the escalation and whether a release is ready to cut - routing: the worker changes rung only as a chunk starts, after every second unfinished verdict, when it names a chunk item that picks a higher rung, or when it cites an escalation trigger the judge finds - task-bench: a bench takes 5 bugs and 5 runs per side, after a 2 Γ— 2 pilot on a new setup, and at no affordable count does a chunk-sized change rise above the noise - task-bench: where a project's README documents a bench command, a scoring run runs it beside the seats with `--record-figures`, which records its figures in the comprehension history, as a report that doesn't block a merge or file an item until the human rules on about 10 recorded benches @@ -58,7 +58,7 @@ Each project principle states one rule that the decisions below apply; their ent # Working rules -**Routing calls: file them in the plan.** A routing call is a change to the routing ladder, its steps or the delegation rule that loop-claude's figures call for. loop-claude puts each call to the human once, and appends it to `routing-calls-raised.md`, at the root of its archive (`$LOOP_CLAUDE_TRANSCRIPTS`, default `~/.claude/loop-claude-transcripts`). Each line of that file is a call or a `Reset`, with a stamp. A call is new when it is stamped after the latest `Reset` and after the latest stamp that `todo.md` or `docs/decisions.md` β†’ `routing:` cites. +**Routing calls: file them in the plan.** A routing call is a change to the routing ladder, its steps or the delegation rule that build-release's figures call for. build-release puts each call to the human once, and appends it to `routing-calls-raised.md`, at the root of its archive (`$BUILD_RELEASE_TRANSCRIPTS`, default `~/.claude/loop-claude-transcripts`). Each line of that file is a call or a `Reset`, with a stamp. A call is new when it is stamped after the latest `Reset` and after the latest stamp that `todo.md` or `docs/decisions.md` β†’ `routing:` cites. When there are new calls, file one `todo.md` item to settle them, or refresh the item already filed. Its detail quotes the new calls with their stamps. It also quotes the routed-chunks table of `routing-figures.md`, which sits in the same folder, and none of that file's other tables, since they name other projects. @@ -66,13 +66,13 @@ Settling a call is the human's. The chunk that settles the calls cites, in `docs # Decisions -## archives: gzip each transcript in loop-claude's archive and each file in the review folders 30 days after it last changed, keeping all of them +## archives: gzip each transcript in build-release's archive and each file in the review folders 30 days after it last changed, keeping all of them 2026-11-17, the worker of todo item 306. Serves goal 4, backing up the transcripts, and goal 1, whose measures read them: the routing figures, `reading-cost`, `score-outcomes` and both replays rest on the whole archive, so nothing is pruned. On 2026-11-17 the archive held 7.9 GB and `~/.local/state/larv-review` 1.1 GB, both growing with every chunk. -- **What.** `compress-archives`, run daily from the crontab line in `README.md` β†’ "Install", gzips each file that last changed over 30 days ago, but for a lock, `*.lock`: a lock is held by its name and never written, so its age doesn't say that it is out of use. The gzip is `<name>.gz`, beside the plain name, with the same times. In the archive it takes only the transcripts, `*.jsonl`, which held 7.8 GB of the 7.9 GB; the outcomes files stay plain, since loop-claude appends to them every cycle. In the review folders it takes every file, since the probes' build output fills most of them. +- **What.** `compress-archives`, run daily from the crontab line in `README.md` β†’ "Install", gzips each file that last changed over 30 days ago, but for a lock, `*.lock`: a lock is held by its name and never written, so its age doesn't say that it is out of use. The gzip is `<name>.gz`, beside the plain name, with the same times. In the archive it takes only the transcripts, `*.jsonl`, which held 7.8 GB of the 7.9 GB; the outcomes files stay plain, since build-release appends to them every cycle. In the review folders it takes every file, since the probes' build output fills most of them. - **Last changed.** A file's age is the later of its mtime and its ctime. A copy or an unpacked archive keeps old mtimes, but its ctime is when it landed, so a tree a chunk or a replay unpacks today stays plain while they use it. -- **Safely.** It writes the gzip, reads it back, syncs it to disk, and only then removes the plain file. It removes it only where the gzip read back the same bytes and the plain file didn't change while it was compressed. At the first failure it stops and exits 1, keeping that file plain, as a failed archive stops loop-claude. +- **Safely.** It writes the gzip, reads it back, syncs it to disk, and only then removes the plain file. It removes it only where the gzip read back the same bytes and the plain file didn't change while it was compressed. At the first failure it stops and exits 1, keeping that file plain, as a failed archive stops build-release. - **Readers.** The tools that read old files in either folder, the archive's readers and `review-replay`, read a file by its plain name through `bin/text_files/compressed.py`. A plain file beside its gzip wins, since it was written later. A session file that grows after its copy was compressed lands plain beside the gzip, which holds a prefix of it, so the next run's gzip doesn't lose anything. A report rewritten whole after it was gzipped also lands plain beside its gzip, and the next run's gzip replaces the older one, as rewriting the plain file replaced the older bytes before. - **Why gzip.** Python 3.14's `compression.zstd` needs a Python built with libzstd, and this machine's lacks `_zstd`; gzip is in every build (goal 2). On 400 archived transcripts older than 30 days, gzip shrank their 609 MB to 23%, at about 29 MB a second. - **Why 30 days.** A chunk's files stop changing once it merges, and chunks run for hours or days. Since every reader reads both forms, the threshold sets only how long a file stays plain. @@ -85,7 +85,7 @@ Valid while every tool that reads old files in the two folders reads through `te 2026-11-12, lilleman, from the release review of 0.9.0. Applies `principles/technical-principles.md` β†’ "Most code should have automated tests", whose "parametrize the cases" asks for one reported result per case. The tests are plain unittest, run by pytest, and pytest's `parametrize` doesn't work on a `TestCase` method; `subTest` is the unittest mechanism that does: each case reports and fails on its own, with its parameters named. A test that loops over its cases itself, outside `subTest`, or holds a branch, is still a breach. Valid while the tests stay in plain unittest. -## bin/: an outcome is an entry of a `.outcomes.md` file in loop-claude's archive, a record is a document tools or people keep entries in, and a place is what a comprehension seat names +## bin/: an outcome is an entry of a `.outcomes.md` file in build-release's archive, a record is a document tools or people keep entries in, and a place is what a comprehension seat names 2026-10-23, larv-review, through PR #367. Serves code health: a reader can trust that one word names one thing in every tool. Before, "record" and "outcome" each named different things in three modules, and "place" in two. Each word kept the meaning it already had where renaming costs most: @@ -99,9 +99,9 @@ Valid while the archive's file names, the Vocabulary and the panel keep these wo 2026-09-24, larv-review. Serves goals 1 and 2. The tools drive the host's claude CLI and read the host's session files, which a container cannot see; the tests run on the same host Python the tools meet. The tests also run in a container through `ci.sh`, on CI and to reproduce a CI failure, since they drive no claude (the entry `tests: CI runs the suite through ci.sh`). Valid while claude runs on the host. -## bin/: the tools send no OTLP traces, logs or metrics, and loop-claude's archive holds the trace of each cycle +## bin/: the tools send no OTLP traces, logs or metrics, and build-release's archive holds the trace of each cycle -2026-11-16, lilleman, from the release review of 0.11.0. The tools send no traces, logs or metrics over OTLP, the OpenTelemetry protocol, to any collector. That applies the last sub-bullet of `principles/technical-principles.md` β†’ "All critical flows should have good traces": a tool that runs only on its user's own machine keeps its trace there. lilleman ruled that the tools never send to a collector, and the release review of 0.12.0 wrote the sub-bullet from that ruling. Serves goal 5: the tools run on the human's own machines, beside client code and transcripts, and whatever goes to a collector leaves the machine. loop-claude's archive holds the trace of each cycle instead: its transcripts and its `.outcomes.md` entry, from the worker's first run to the judge's verdict. Valid while goal 5 holds. +2026-11-16, lilleman, from the release review of 0.11.0. The tools send no traces, logs or metrics over OTLP, the OpenTelemetry protocol, to any collector. That applies the last sub-bullet of `principles/technical-principles.md` β†’ "All critical flows should have good traces": a tool that runs only on its user's own machine keeps its trace there. lilleman ruled that the tools never send to a collector, and the release review of 0.12.0 wrote the sub-bullet from that ruling. Serves goal 5: the tools run on the human's own machines, beside client code and transcripts, and whatever goes to a collector leaves the machine. build-release's archive holds the trace of each cycle instead: its transcripts and its `.outcomes.md` entry, from the worker's first run to the judge's verdict. Valid while goal 5 holds. ## bin/: the tools support only the latest stable Python, and the tests, written in plain unittest, run on it in four pytest-xdist workers @@ -123,7 +123,7 @@ Valid while a chunk's worker runs `chunk-pr merge` itself, and one machine runs ## chunks: a chunk takes every unblocked item of its release that fires the same review passes, whatever its purpose, and an item above R 5 ships alone -2026-10-22, lilleman, through todo item 217. Serves goal 1.4: each review has a fixed cost, so more items per chunk cost less per item. Across the 165 finished chunks loop-claude archived up to that day, a chunk took a median of 1.30M tokens with one item and 1.33M with two, and three in four chunks shipped one item. The old rule also asked one PR title to state what the items achieve together; lilleman dropped it, since unrelated items that fire the same passes cost one review. +2026-10-22, lilleman, through todo item 217. Serves goal 1.4: each review has a fixed cost, so more items per chunk cost less per item. Across the 165 finished chunks build-release archived up to that day, a chunk took a median of 1.30M tokens with one item and 1.33M with two, and three in four chunks shipped one item. The old rule also asked one PR title to state what the items achieve together; lilleman dropped it, since unrelated items that fire the same passes cost one review. The cap is 5, `bin/plan/todo_table.py`'s `BUNDLE_MAX_R`, from the same chunks: by the highest R among a chunk's items, the median was 0.9M to 1.5M tokens at R 1 to 5, and 2.7M at R 6, where the 90th percentile was 8.8M. A risky item that runs long re-runs review over every item bundled with it. R 5 is also the least R an I 4 item gets, so an item that could take everything down shares a chunk only where its L + E is 3 or less, and an irreversible I 5 item, at R 7 or more, never does. Valid while a review's cost is mostly fixed per chunk; revisit once 30 chunks have shipped bundles under it. @@ -142,13 +142,13 @@ The cap is 5, `bin/plan/todo_table.py`'s `BUNDLE_MAX_R`, from the same chunks: b 2026-09-27, lilleman, restating the 2026-09-24 target and extending it to the overall. Serves goal 1. 2026-10-13, lilleman: the floor doesn't block anything, and `review: the comprehension check records …` says why. Valid while the scoring run keeps its four seats. 2026-11-12, lilleman, through todo item 358: a project's config sets this floor as `readability-floor`, its readability floor, since legacy code scores low. It is 7.0 where left out, and the signal stays that the score rises. Readers seated as the person who writes the config picked the key, 2 of 3. -## deploy: `~/.claude` holds only a release, which `deploy-release` moves it to; this repo is developed in `~/code/claude-config`, where loop-claude runs its chunks like any project's +## deploy: `~/.claude` holds only a release, which `deploy-release` moves it to; this repo is developed in `~/code/claude-config`, where build-release runs its chunks like any project's 2026-10-29, lilleman. Serves goal 1.3 and goal 2. `~/.claude` was this repo's development checkout, so every merge reached every session on the machine at once, its unfinished work included, while other machines took only tags. Now each machine takes only releases: what a release holds is what every session runs, and cutting one is the human's step that ships it. `deploy-release` automates README β†’ Update. It refuses an uncommitted change to a tracked file that the new tag doesn't hold, such as a hook Claude Code wrote into `settings.json`, and a move that would drop commits no release holds; a model pick, which the clean filter drops, is no change. Valid while Claude Code reads its configuration from one directory per machine. ## deploy: this repo keeps no `AGENTS.md`, since `~/.claude` is its checkout; its principles and decision titles head `docs/decisions.md`, its working rules follow them there, and its `.claude/settings.json` excludes every `.claude/CLAUDE.md`, so a session in the clone loads only the clone's `CLAUDE.md` -2026-11-11, lilleman through item 314. Serves goal 1.4. Claude Code loaded `~/.claude/AGENTS.md` into every other project's sessions, and each 1,000 tokens every thread starts with cost $68.60 of the $9,154 spent from 2026-09-30 to 2026-11-11: the 14.4 KB file cost about 2.1% of spend, and put this repo's rules in front of other projects. Other projects keep the name `AGENTS.md`, so the setup stays portable to other harnesses. The working rules sit there too, rather than in `.claude/rules/`, since loop-claude's judge reads the decision log and no project's `.claude/rules/`. In the clone, the release's `~/.claude/CLAUDE.md` and the clone's both loaded, about 0.9% of spend; the exclude drops the release's, so a chunk runs under the rules it is changing. A session working in `~/.claude` itself loads no `CLAUDE.md`, since there both are the same file; none works there, as the entry above says. +2026-11-11, lilleman through item 314. Serves goal 1.4. Claude Code loaded `~/.claude/AGENTS.md` into every other project's sessions, and each 1,000 tokens every thread starts with cost $68.60 of the $9,154 spent from 2026-09-30 to 2026-11-11: the 14.4 KB file cost about 2.1% of spend, and put this repo's rules in front of other projects. Other projects keep the name `AGENTS.md`, so the setup stays portable to other harnesses. The working rules sit there too, rather than in `.claude/rules/`, since build-release's judge reads the decision log and no project's `.claude/rules/`. In the clone, the release's `~/.claude/CLAUDE.md` and the clone's both loaded, about 0.9% of spend; the exclude drops the release's, so a chunk runs under the rules it is changing. A session working in `~/.claude` itself loads no `CLAUDE.md`, since there both are the same file; none works there, as the entry above says. Valid while `~/.claude` is a checkout of this repo. @@ -164,7 +164,7 @@ Valid while `~/.claude` is a checkout of this repo. 2026-11-18, lilleman's answers to claude's questions while planning release 0.12.0. Serves goal 1, so development scales past one repo, and goal 1.6, since the epic stays in the client's Jira. Valid while Jira is the only backend; another backend goes behind the same interface. -- **What it is.** `do-epic <EPIC-KEY>` is a sibling of loop-claude, built on the same cycle, judge, interrupt, tmux and routing packages, not a copy (goal 1.3). It runs one tmux session per epic. +- **What it is.** `do-epic <EPIC-KEY>` is a sibling of build-release, built on the same cycle, judge, interrupt, tmux and routing packages, not a copy (goal 1.3). It runs one tmux session per epic. - **Machine settings.** `~/.claude-projects/do-epic/` holds `config.toml` (the Jira site, env-file, the folder repos are cloned into, the default language, and the model for a no-repo item) and `repo-rule.md`. `repo-rule.md` is a prose instruction that says how to tell an item's repo. It is the same for every epic on the machine. On the first machine, an item's label that equals a repo's name names that repo. A `[label-repos]` table in `config.toml` maps a team's own label to a repo, so do-epic reads that label as a pick without a claude call. - **The epic's description is its record.** It holds `## Goals`, `## Audience`, `## Scoring` (formula and bar), `## Decisions` and a language line. do-epic writes all of it, but it changes Goals or Audience only after the human approves in an interrupt. - **Items live only in the epic.** A repo's own plan never mirrors them. Where `repo-rule.md` leaves an item's repo unclear, do-epic asks. An item without a repo is either Claude's work, done without a PR, or a human task; where the item doesn't say which, do-epic asks. @@ -172,7 +172,7 @@ Valid while `~/.claude` is a checkout of this repo. - **Ranking.** Score, then Blocked by, in one weight chain: the epic's achieve goals, then code health, then the repo's goals. Where the epic and a repo disagree, the epic wins. do-epic re-ranks the issues it filed in Jira's backlog to match. A person's issue keeps its rank there: goal 1.6 has the loop plug in without changing what the owners keep. On 2026-11-20 the human chose that the order the issues start in is do-epic's, while the board's order stays the team's: do-epic starts the open issues by score. Where two or more may start, it scores each of them that holds no scores, a person's included but not a human's task, and tells the team the scores in a comment. It never overwrites scores an issue holds. An issue that cannot be scored starts after those that can, in the backlog's order; where no order of score can be made at all, such as without the epic's formula, every issue starts in the backlog's order and do-epic says why. - **Releases.** An epic item has no release. It ships into its repo's unreleased work: where the repo publishes something others consume, a bullet under `CHANGELOG.md` β†’ `## Unreleased`, or nothing where the repo's plan is in Jira. The issue is no item of the repo's plan, so the chunk's worker writes the bullet in its branch and runs `chunk-pr merge` without `--finish`. - **Repos.** A repo's name is its main checkout's folder name, and a project config names that checkout. A missing checkout is cloned from the host of the epic's other repos; where unsure, do-epic asks. Unsure means the other repos don't all sit under one host and owner (the same host spelt as https and as ssh counts as two), an origin can't be read or isn't an https, ssh or scp-style address, the folder to clone into holds something else, or the clone fails. A repo no config names is cloned into the clone folder, and the human is asked to write its config. Each chunk uses its repo's model, routing, and language for commits and PRs. Jira text is in the epic's language, or else the machine's default. -- **Running.** The epic caps the chunks running at once, and each repo's `parallel-chunks` still applies. do-epic and loop-claude never run chunks in the same repo at once. The cap is a line of the epic's description, `**Max parallel chunks:** 2`, and 1 without it, as `parallel-chunks` is. A repo's `parallel-chunks` counts the chunks of every epic in its checkout. Each window is named for its issue's key, and a tmux window option, `@chunk-root`, names the folder its chunk works in, which is how loop-claude sees do-epic's chunks in a checkout. do-epic and loop-claude each hold the checkout's `starting` lock from checking the checkout's chunks to starting a window there. A chunk without a repo works in `~/.local/state/do-epic/<EPIC-KEY>/`. do-epic archives its cycles under `~/.claude/do-epic-transcripts/`, not in loop-claude's archive, whose readers parse loop-claude's prompts. An open issue runs once a label records its repo; until do-epic picks repos itself, an issue without one waits, and `do-epic <EPIC-KEY>` says so. +- **Running.** The epic caps the chunks running at once, and each repo's `parallel-chunks` still applies. do-epic and build-release never run chunks in the same repo at once. The cap is a line of the epic's description, `**Max parallel chunks:** 2`, and 1 without it, as `parallel-chunks` is. A repo's `parallel-chunks` counts the chunks of every epic in its checkout. Each window is named for its issue's key, and a tmux window option, `@chunk-root`, names the folder its chunk works in, which is how build-release sees do-epic's chunks in a checkout. do-epic and build-release each hold the checkout's `starting` lock from checking the checkout's chunks to starting a window there. A chunk without a repo works in `~/.local/state/do-epic/<EPIC-KEY>/`. do-epic archives its cycles under `~/.claude/do-epic-transcripts/`, not in build-release's archive, whose readers parse build-release's prompts. An open issue runs once a label records its repo; until do-epic picks repos itself, an issue without one waits, and `do-epic <EPIC-KEY>` says so. - **Long gates.** A chunk whose PR waits on a gate, such as a human approval, parks. It keeps its worktree, PR and session, and its state is in a file that survives a reboot. A parked chunk takes no running slot, and the items it blocks wait. do-epic polls the forge and resumes the chunk's session when the gate passes or a reviewer comments. It fixes reasonable feedback, replies to the rest, and changes the setup so review would have caught it. `do-epic <key> --status` and the tmux window names show what each chunk waits on. A gate is a pull request's pending checks or, on GitHub, the approval its branch protection requires; a draft waits on neither, since its worker has yet to mark it ready. On Gitea a draft is a pull request whose title opens with `WIP:` or `[WIP]`, Gitea's default `WORK_IN_PROGRESS_PREFIXES`. Changes a reviewer requested resume the chunk only while that review was made on the pull request's head commit and the pull request's author has not commented or replied after it; once the worker pushed or replied, the chunk parks on a new review, since GitHub keeps the decision until the reviewer reviews again. The chunk's window reads the forge once a minute, which no forge's rate limit notices. A chunk resumes only into a free slot, under the limits a starting chunk meets, and stays parked until then. `do-epic <key>` starts a parked chunk's window again whatever the limits, since the chunk stays parked. do-epic sets `CHUNK_PR_PARKS=1` for each worker, so `chunk-pr merge` fails at once where the pull request awaits an approval, and the worker's run doesn't hold a slot while the pull request waits. In a repo whose config sets `merge = "human"`, the merge itself is a gate: `chunk-pr merge` leaves the pull request ready, the chunk parks on `your merge` once nothing else holds the pull request, and it gets its gate read again when the forge no longer reports the pull request open, so that its worktree is removed and the chunk finishes. It resumes too once the pull request conflicts with its base branch, or is behind it where GitHub's branch protection requires an up-to-date branch, so the person finds a pull request they can merge. The worker then runs `chunk-pr merge` again, which levels the branch, waits for the checks and leaves the pull request ready. A chunk whose cycle ends on such a pull request is not handed on: its worker is told after each cycle until the pull request merges into its base. While GitHub still computes whether the pull request merges, the chunk stays parked until the next read. Gitea also reports a pull request as not mergeable for the seconds it checks for conflicts. A read in those seconds resumes the chunk for a run that doesn't change anything, which costs less than reading every gate twice to tell the two apart. The judge may rule such a chunk finished while its pull request is open, since its worker ends each run there. So do-epic reads a gate it could not read again before it hands the chunk on, and does the removal itself where it can. For a chunk whose pull request is no longer open, do-epic runs `chunk-pr clean` in the chunk's worktree. That command acts only on a pull request the forge reports merged at the worktree's head, and refuses a worktree with uncommitted or untracked files. Where it removed the worktree, the chunk finishes without a worker and, where it was parked, without a running slot, even if the command then failed on the main checkout, whose reason do-epic says. Where it left the worktree, as for a pull request closed unmerged, do-epic tells the worker once to remove it, and a parked chunk waits for a slot as for any other news. - **Human tasks.** do-epic leaves a human task's issue as the team filed it. The task gets a window of its own while it is open, no issue blocks it, and it blocks another open issue. The window DMs the human once, through the notifier of the first repo whose project config names one (the repos of the issues it holds up come first, then those of the epic's other issues; where none does, the window says so), shows as parked (`awaits a human's task`) so that it doesn't take a running slot, and polls the epic every minute until the task no longer holds up an open issue. Then the issues it held up may start. A window that starts again, as after a reboot, DMs again. - **Findings.** A finding about the epic's goals is filed in the epic. A finding about a repo's goals follows that repo's rules. Where unsure which, do-epic asks. A set of new items toward an epic goal needs the human's approval before work starts; a finding filed during a chunk doesn't. @@ -186,7 +186,7 @@ Valid while `~/.claude` is a checkout of this repo. - **The setting.** `epic-branch` in a project's config is a template with `{epic}` for the epic's key, such as `"{epic}"`. Left out, everything works as before. Under chunk-preflight the key is that of the Jira epic `plan` names, so a plan kept in a file has no working branch. Under do-epic it is the key of the epic do-epic drives. - **A chunk's base is recorded in git.** `git config branch.<chunk's branch>.chunk-base <epic's working branch>`, in the checkout's shared config (`git_repo.CHUNK_BASE`). `git_repo.default_ref` answers `origin/<epic's working branch>` on such a branch, so each tool that measures a chunk against its base reads the chunk's own commits. Deleting the branch removes the record. - **The branch stays level by a merge commit, made without a checkout.** `epic_branch.levelled` makes the branch on origin off the default branch, or merges the default branch into it with `git merge-tree --write-tree`, which needs git 2.38 or later, and `git commit-tree`, and pushes without force. It asks origin itself whether it has the branch, with `git ls-remote`, since a fetch keeps a checkout's `origin/<branch>` after origin deleted the branch. So a chunk that starts after the epic's branch merged and was deleted gets a fresh branch off the default branch, never the commits the deleted one held. chunk-preflight runs it before it makes a chunk's worktree, do-epic as a chunk's window starts, and `chunk-pr open-epic` before it opens the epic's pull request. `open-epic` refuses where origin has no such branch, since a branch made there would be a stray one. A conflict stops the chunk and asks a person to merge by hand: a resolution picks between two teams' changes, which is theirs to pick. -- **The chunk merges without a person.** `chunk-pr merge` into an epic's working branch ignores `merge = "human"` and `wait-for-approval`, and do-epic parks no such chunk on a person's merge. lilleman's call: the team's rule against merging without a go-ahead covers the default branch and protected branches. The pull request from the epic's working branch into the default branch is opened ready and never merged by the loop. do-epic's finishing chunk opens it with `chunk-pr open-epic`; under loop-claude the human runs that command. +- **The chunk merges without a person.** `chunk-pr merge` into an epic's working branch ignores `merge = "human"` and `wait-for-approval`, and do-epic parks no such chunk on a person's merge. lilleman's call: the team's rule against merging without a go-ahead covers the default branch and protected branches. The pull request from the epic's working branch into the default branch is opened ready and never merged by the loop. do-epic's finishing chunk opens it with `chunk-pr open-epic`; under build-release the human runs that command. - **The forge's base must agree with the recorded one.** The record says whether a person merges, and the forge says where the pull request lands, so the two must not differ. `chunk-pr ready` and `merge`, and do-epic's gate, read the pull request's base from the forge (`forge.pulls.other_base`). They fail, naming both branches, where it differs from the recorded base, or from the default branch where the checkout records none. A person then changes the pull request's base on the forge, or the record. chunk-preflight and do-epic record the base for a chunk they continue too, since the setting sends every chunk of the epic into the working branch. So a pull request that was open into the default branch when the setting was turned on fails this check until a person changes its base or merges it. do-epic parks a chunk, and moves its issue, by the base it recorded as the chunk's window started, never by the config alone. - **A review is asked for by a comment.** An auto-reviewer may review on its own only pull requests into the default branch. `review-request-comment` holds the comment that asks it, which `chunk-pr ready` and `chunk-pr push` post on a pull request into an epic's working branch. The worker waits for the review as for any auto-reviewer. - **do-epic moves the issue itself.** A team's automation fires only for pull requests into the default branch. `jira-pull-request-open-status` names the status of an issue whose chunk parks with its pull request open, and `jira-pull-request-merged-status` the one once it has merged. The first move is made as the chunk parks, since that is where do-epic learns of the pull request; one that opens and merges within a single run of the worker skips it. Where the workflow then offers no way straight to the merged status, do-epic moves the issue through the open status first. Each setting names a status, and do-epic takes whichever transition leads there. @@ -201,11 +201,11 @@ Valid while `~/.claude` is a checkout of this repo. 2026-11-08, claude, item 230: the floor item that larv-review files (`skills/larv-review/SKILL.md` β†’ "Floor item") keeps the move by 9 and competes like any item, though its R, likely above 5, makes it ship alone. -## loop-claude: a `claude` that cannot start is a failed worker run, retried +## build-release: a `claude` that cannot start is a failed worker run, retried 2026-09-28, larv-review, declining a product-owner nit to exit at once when `claude` is missing. Serves goal 1. Claude Code's updater repoints `~/.local/bin/claude` at each new version under running loops, and a start that meets it mid-update fails with the same error as a broken install; the retry costs two minutes on the second and saves an unattended loop on the first. Valid while Claude Code updates by repointing its link. -## loop-claude: a judge decides each interrupt and each quoted answer from the transcript, the premises, `AGENTS.md`, `docs/decisions.md`, `~/.claude/CLAUDE.md`, `~/.claude/rules/` and larv-review's standards, and holds a chunk open while an answer the human typed in it is recorded nowhere; it interrupts for a reserved choice those don't settle, or an ask that carries no recommendation +## build-release: a judge decides each interrupt and each quoted answer from the transcript, the premises, `AGENTS.md`, `docs/decisions.md`, `~/.claude/CLAUDE.md`, `~/.claude/rules/` and larv-review's standards, and holds a chunk open while an answer the human typed in it is recorded nowhere; it interrupts for a reserved choice those don't settle, or an ask that carries no recommendation 2026-09-21, lilleman. Serves goal 1. Asked to name the goal behind each choice, the worker cites a real goal for a choice that goal does not settle, and under-reports its own decisions; the judge's bar is whether the README's premises or the files in the title discriminate between the alternatives. Valid while the worker's self-report stays unreliable. Since 2026-11-08, below, that bar holds only for a reserved choice and an ask without a recommendation. @@ -215,47 +215,47 @@ Valid while `~/.claude` is a checkout of this repo. 2026-10-03, lilleman. Serves goal 1.2. The judge rules a chunk finished only once every answer the human typed in it is recorded. A finished chunk's session is deleted, and its answers with it, so an answer recorded nowhere would be asked again in a later chunk. Claude settled two choices lilleman's ruling left open. First, an answer counts as recorded where the files the judge reads hold it, `~/.claude/CLAUDE.md` included, or where the transcript shows the worker writing it into `README.md`'s premises, `AGENTS.md`, `docs/decisions.md`, `todo.md` or a code comment. A worker's write to `~/.claude/CLAUDE.md`, `~/.claude/rules/` or the project's review standards does not count: the judge reads those files where they are kept, not in the chunk's worktree, so they hold the write only once it merges and reaches there. The judge cannot read a code comment or `todo.md`. Yet `CLAUDE.md` β†’ "Working loop", "Ask, don't guess" puts a standing choice made in one place in a comment there. And the human's approval of a release's items, which "Working loop" requires, is the set of rows `todo.md` names for that release. The judge also reads the records once a cycle from the main checkout. That checkout may not yet hold an answer the worker wrote and merged. A judge that refused any of these would hold the chunk open every cycle. Second, only an answer a later chunk could need must be recorded, so an approval such as "merge it" doesn't hold anything open. The worker's resume prompt states the rule, so a worker whose chunk is held open knows it. -2026-10-17, lilleman, todo item 168. The human answers an interrupt on loop-claude's terminal, and the worker resumes headless with the answer in a `-p` prompt. The judge reads that answer as a `[human]` line, not a `[loop]` one, so it holds the chunk open until the answer is recorded, as it does for an answer typed in claude. +2026-10-17, lilleman, todo item 168. The human answers an interrupt on build-release's terminal, and the worker resumes headless with the answer in a `-p` prompt. The judge reads that answer as a `[human]` line, not a `[loop]` one, so it holds the chunk open until the answer is recorded, as it does for an answer typed in claude. -2026-11-08, lilleman, todo item 262. Serves goals 1 and 1.5. A worker takes its own recommendation on a choice no rule reserves for the human, and records it. `CLAUDE.md` β†’ "Working loop", "Ask, don't guess" names the three choices always reserved, and keeps any other rule's ask for approval. The worker's account of which goal settles a choice still doesn't decide a reserved one. The judge no longer interrupts for an unreserved choice the worker took, or asked about with a recommendation; it answers such an ask by quoting that rule, which it may quote again for each new ask. 92 of the 255 interrupts in loop-claude's archive on 2026-11-08 carried the worker's recommendation, and a finished chunk with an interrupt took a median 7.1 h, against 0.44 h without one. Valid while the human reverses few of the choices workers take this way, goal 1.2's counter-signal. +2026-11-08, lilleman, todo item 262. Serves goals 1 and 1.5. A worker takes its own recommendation on a choice no rule reserves for the human, and records it. `CLAUDE.md` β†’ "Working loop", "Ask, don't guess" names the three choices always reserved, and keeps any other rule's ask for approval. The worker's account of which goal settles a choice still doesn't decide a reserved one. The judge no longer interrupts for an unreserved choice the worker took, or asked about with a recommendation; it answers such an ask by quoting that rule, which it may quote again for each new ask. 92 of the 255 interrupts in build-release's archive on 2026-11-08 carried the worker's recommendation, and a finished chunk with an interrupt took a median 7.1 h, against 0.44 h without one. Valid while the human reverses few of the choices workers take this way, goal 1.2's counter-signal. -## loop-claude: every claude it opens on a terminal has `CLAUDE_CODE_SANDBOXED` set, so Claude Code skips its trust dialog and doesn't write `~/.claude.json` +## build-release: every claude it opens on a terminal has `CLAUDE_CODE_SANDBOXED` set, so Claude Code skips its trust dialog and doesn't write `~/.claude.json` 2026-09-21, lilleman. Serves goal 1. `claude --resume` re-enters the worktree the worker last entered, recorded in the transcript's `worktree-state` entry, and Claude Code asks trust per path, so trusting the checkout alone would still land the human in the trust dialog. -2026-10-30, lilleman, todo item 6. Serves goal 1. Until then loop-claude marked each worktree trusted in `~/.claude.json`, reading the file, changing it and writing it back. Claude Code owns and writes that file, so a write it made in between could be lost. Claude Code 2.1.314 treats every folder as trusted while `CLAUDE_CODE_SANDBOXED` is set, and doesn't persist that trust. A claude started in a new folder with the variable set showed no dialog, and Claude Code recorded the folder untrusted. `hand_over` sets the variable for every claude it opens on a terminal: for `/talk`, a release ready to cut and the routing calls. The variable tells Claude Code it runs inside a sandbox, which holds here: loop-claude runs only in the sandbox README β†’ Install names (`loop-claude: every claude it starts bypasses permissions inside its sandbox`). Claude Code doesn't document the variable. Where a later version drops it, the trust dialog comes back on those claudes, and nothing is lost. Valid while Claude Code honours `CLAUDE_CODE_SANDBOXED`. +2026-10-30, lilleman, todo item 6. Serves goal 1. Until then build-release marked each worktree trusted in `~/.claude.json`, reading the file, changing it and writing it back. Claude Code owns and writes that file, so a write it made in between could be lost. Claude Code 2.1.314 treats every folder as trusted while `CLAUDE_CODE_SANDBOXED` is set, and doesn't persist that trust. A claude started in a new folder with the variable set showed no dialog, and Claude Code recorded the folder untrusted. `hand_over` sets the variable for every claude it opens on a terminal: for `/talk`, a release ready to cut and the routing calls. The variable tells Claude Code it runs inside a sandbox, which holds here: build-release runs only in the sandbox README β†’ Install names (`build-release: every claude it starts bypasses permissions inside its sandbox`). Claude Code doesn't document the variable. Where a later version drops it, the trust dialog comes back on those claudes, and nothing is lost. Valid while Claude Code honours `CLAUDE_CODE_SANDBOXED`. -## loop-claude: each project's model lives in `~/.claude/loop-claude-models.json`, which only loop-claude and do-epic write, through one locked function +## build-release: each project's model lives in `~/.claude/loop-claude-models.json`, which only build-release and do-epic write, through one locked function -2026-09-26, lilleman. Serves goal 1. Claude Code rewrites the user settings' `model` whenever one is picked inside a session, so a loop reading settings runs whatever was picked last. `~/.claude/loop-claude-models.json` has one writer: `save_model` in `bin/chunk_driver/project/model_choice.py`. The entry points, loop-claude and do-epic, both call it, and it holds a lock from its read to its write. Every claude they start gets that model as `--model`. The file is per machine, outside the synced allowlist, since a tracked file the loop writes would dirty the checkout. 2026-10-02, lilleman: goal 2 has others run the setup on their own machines, and a project's model is each machine's own choice, so a new machine asks once per project, which is not asking the same thing twice (goal 1.2). Valid while Claude Code keeps rewriting the settings' model from inside a session. +2026-09-26, lilleman. Serves goal 1. Claude Code rewrites the user settings' `model` whenever one is picked inside a session, so a loop reading settings runs whatever was picked last. `~/.claude/loop-claude-models.json` has one writer: `save_model` in `bin/chunk_driver/project/model_choice.py`. The entry points, build-release and do-epic, both call it, and it holds a lock from its read to its write. Every claude they start gets that model as `--model`. The file is per machine, outside the synced allowlist, since a tracked file the loop writes would dirty the checkout. 2026-10-02, lilleman: goal 2 has others run the setup on their own machines, and a project's model is each machine's own choice, so a new machine asks once per project, which is not asking the same thing twice (goal 1.2). Valid while Claude Code keeps rewriting the settings' model from inside a session. -## loop-claude: every claude it starts bypasses permissions inside its sandbox +## build-release: every claude it starts bypasses permissions inside its sandbox -2026-09-30, lilleman. Applies "Always grant explicit access to data": the sandbox `loop-claude` runs in is where access is granted, so the worker and the claude an interrupt opens run with `bypassPermissions`. The worker may read `~/.claude/.credentials.json`: it holds Claude Code's own credentials, which claude reads to run anyway. Its one seam to production is the forge: what it pushes or merges can publish through CI. Valid while `loop-claude` runs only in the sandbox README β†’ Install names. +2026-09-30, lilleman. Applies "Always grant explicit access to data": the sandbox `build-release` runs in is where access is granted, so the worker and the claude an interrupt opens run with `bypassPermissions`. The worker may read `~/.claude/.credentials.json`: it holds Claude Code's own credentials, which claude reads to run anyway. Its one seam to production is the forge: what it pushes or merges can publish through CI. Valid while `build-release` runs only in the sandbox README β†’ Install names. -## loop-claude: each chunk runs in its own tmux window, of one tmux session per project, up to `parallel-chunks` at once, and needs tmux 3.2; its claude session is named after its window, its id derived from that name; a chunk's commit in the config's folder takes only the file it changed +## build-release: each chunk runs in its own tmux window, of one tmux session per project, up to `parallel-chunks` at once, and needs tmux 3.2; its claude session is named after its window, its id derived from that name; a chunk's commit in the config's folder takes only the file it changed -2026-09-21, lilleman; revised 2026-09-30 by lilleman. Serves goal 1. Ids derived from names keep the session picker at one entry per running loop and make any transcript under those ids loop-claude's own to delete. A checkout outside `~/code` mirroring a path inside it shares that id, and a second loop on it is not refused. Once `todo.md` item 5 lands, the id comes from the full path, so no two checkouts share one, and `loop-claude` refuses to start while another session on that id is active. Moving the checkout orphans its open sessions, archive folder and models entry: sessions stay in the picker until the human deletes them, migration code not being worth a one-human audience. +2026-09-21, lilleman; revised 2026-09-30 by lilleman. Serves goal 1. Ids derived from names keep the session picker at one entry per running loop and make any transcript under those ids build-release's own to delete. A checkout outside `~/code` mirroring a path inside it shares that id, and a second loop on it is not refused. Once `todo.md` item 5 lands, the id comes from the full path, so no two checkouts share one, and `build-release` refuses to start while another session on that id is active. Moving the checkout orphans its open sessions, archive folder and models entry: sessions stay in the picker until the human deletes them, migration code not being worth a one-human audience. 2026-11-15, lilleman's call of 2026-11-13 in item 372, which split item 361: loops of one project, each on its own chunk, run side by side without touching each other's state. The worker's choices, for what the call left open: - **The archive and the route needed no change.** The archive keys each chunk by its own transcript's first line, and a rerun's route comes from the latest verdict on that transcript, so both follow the session. The routing figures are measured across all projects, under their own lock. - **git's own lock serializes the config folder's commits, in place of the file lock the item asked for.** `git commit` holds `.git/index.lock`, so of two commits at once the second fails, and the worker tries again. A wrapper lock would only make it wait, and a command spelled `flock … git commit` would pass rule-hook unchecked, since it reads only a command that starts with `git`. What two chunks could still break is one committing the file the other staged, so each commits only its own file, as `git commit -m <title> -- <file>` (`CLAUDE.md` β†’ "Git, commits, and PRs"). -2026-11-16, lilleman's second call of 2026-11-13 splitting item 361: lilleman knows tmux and prefers it. Each chunk runs in its own window of one tmux session per project, `loop-<key>`, up to the number the config's `parallel-chunks` sets, 1 by default. tmux runs even at 1, so every project runs the same workflow (goal 1.3). A window waiting for the human ends its name in ` ?` and rings the bell, and the DM names `<session>:<window>`. The worker's choices, for what the call left open (`bin/agent_cycle/tmux.py`, `bin/loop_claude/loop/chunk_windows.py`): +2026-11-16, lilleman's second call of 2026-11-13 splitting item 361: lilleman knows tmux and prefers it. Each chunk runs in its own window of one tmux session per project, `loop-<key>`, up to the number the config's `parallel-chunks` sets, 1 by default. tmux runs even at 1, so every project runs the same workflow (goal 1.3). A window waiting for the human ends its name in ` ?` and rings the bell, and the DM names `<session>:<window>`. The worker's choices, for what the call left open (`bin/agent_cycle/tmux.py`, `bin/build_release/loop/chunk_windows.py`): -- **The window, in place of item 372's lock-file slot, names the claude session**, as `A <key> loop-claude item-372`. The loop-claude the human runs starts the windows and attaches; each window runs `loop-claude --chunk <window>`, so a loop knows its chunk before it names its claude session, and a rerun still resumes the chunk left open. -- **A finishing chunk starts the next; only the human restarts a stopped one.** As its chunk finishes, a window's loop starts each chunk that may start then and exits, so its window closes. `remain-on-exit failed` keeps the window of a loop that stopped any other way, Ctrl-C included, with its last lines, and its chunk keeps its items. A finishing chunk never restarts it, since the human may have stopped it on purpose; the next `loop-claude <task>` starts it again before any other chunk. One flock under `~/.local/state/loop-claude/<key>/` serializes the starts, so two chunks finishing together don't start one chunk twice. +- **The window, in place of item 372's lock-file slot, names the claude session**, as `A <key> build-release item-372`. The build-release the human runs starts the windows and attaches; each window runs `build-release --chunk <window>`, so a loop knows its chunk before it names its claude session, and a rerun still resumes the chunk left open. +- **A finishing chunk starts the next; only the human restarts a stopped one.** As its chunk finishes, a window's loop starts each chunk that may start then and exits, so its window closes. `remain-on-exit failed` keeps the window of a loop that stopped any other way, Ctrl-C included, with its last lines, and its chunk keeps its items. A finishing chunk never restarts it, since the human may have stopped it on purpose; the next `build-release <task>` starts it again before any other chunk. One flock under `~/.local/state/loop-claude/<key>/` serializes the starts, so two chunks finishing together don't start one chunk twice. - **The other chunks' items are told, not locked.** A fresh worker is told the items each other chunk holds, running or stopped: its window's item and those on its latest `Chunk items:` line. A chunk starts beside the others only where its item's `Touches:` prediction overlaps none of those items' predictions, since the plan's next item, which chunk-preflight's pick checks against, may already have merged. -- **The tmux session names its checkout.** Two checkouts whose keys differ only in a character other than a letter, a digit, `_` or `-` map to one session name, so the session's `@loop-root` option names the checkout that made it, and another checkout's loop-claude refuses it. +- **The tmux session names its checkout.** Two checkouts whose keys differ only in a character other than a letter, a digit, `_` or `-` map to one session name, so the session's `@loop-root` option names the checkout that made it, and another checkout's build-release refuses it. - **tmux 3.2 is the oldest that has every command and option used.** tmux's `CHANGES` dates the newest two to "CHANGES FROM 3.1c TO 3.2": `new-session -e`, and the `remain-on-exit` value that keeps only a failed program's pane. - **A loop started before this release isn't moved into a window.** One that reloads into this release starts its project's windows afresh, and leaves its chunk's open claude session, named for its slot, in the session picker. Carrying a slot's session into a window is not worth the code for a one-human audience, so the changelog asks the human to finish or stop every running loop before taking the release. -Valid while claude takes `--session-id` and resumes by it, and the human runs loop-claude where tmux is installed. +Valid while claude takes `--session-id` and resumes by it, and the human runs build-release where tmux is installed. -## loop-claude: the archive keeps the raw transcript and each judge run, a failed archive stops the loop, and a replay keeps its runs and report in a replays/ folder of the archive +## build-release: the archive keeps the raw transcript and each judge run, a failed archive stops the loop, and a replay keeps its runs and report in a replays/ folder of the archive -2026-09-28, lilleman. Serves goals 1 and 4: saving each transcript locally is the first step of backing it up, and it shows afterwards what an unattended run did. A copy of the `.jsonl`, deduplicated by content hash, with its outcomes beside it; a rendering drops tool results, and a second-resolution stamp names two states within one second as one file. A failed archive exits 1, since a loop that loses its record silently fails the backup goal. The judge's runs are archived too, as `judge/<sha256>.json` in the chunk's folder: the prompt it read and its json reply. Together they are its whole transcript, since it runs with no tools and one turn. A run is kept whole and deduplicated by hash, and the outcome of the verdict, interrupt or rejected reply it produced names it on a `Judge run:` line. Keeping it whole costs little: a prompt is at most `JUDGE_PROMPT_CHARS`, 400,000 characters. Measured 2026-11-17, the archive's 911 judge lines come to at most 0.36 GB of prompts, against 3.5 GB in its 1,211 transcript copies, the largest 23.4 MB. The judge is still priced from its `Judge cost:` line, which is claude's own total for the run, and the Spent block counts the live reply's tokens; the archived reply keeps its `usage` for a later reader, and nothing reads it back. `judge-replay` replays a verdict on its archived prompt where there is one. Valid while transcripts, and the judge's prompts, stay small enough to copy whole; `archives: gzip each transcript in loop-claude's archive and each file in the review folders 30 days after it last changed, keeping all of them` keeps the copies small on disk. +2026-09-28, lilleman. Serves goals 1 and 4: saving each transcript locally is the first step of backing it up, and it shows afterwards what an unattended run did. A copy of the `.jsonl`, deduplicated by content hash, with its outcomes beside it; a rendering drops tool results, and a second-resolution stamp names two states within one second as one file. A failed archive exits 1, since a loop that loses its record silently fails the backup goal. The judge's runs are archived too, as `judge/<sha256>.json` in the chunk's folder: the prompt it read and its json reply. Together they are its whole transcript, since it runs with no tools and one turn. A run is kept whole and deduplicated by hash, and the outcome of the verdict, interrupt or rejected reply it produced names it on a `Judge run:` line. Keeping it whole costs little: a prompt is at most `JUDGE_PROMPT_CHARS`, 400,000 characters. Measured 2026-11-17, the archive's 911 judge lines come to at most 0.36 GB of prompts, against 3.5 GB in its 1,211 transcript copies, the largest 23.4 MB. The judge is still priced from its `Judge cost:` line, which is claude's own total for the run, and the Spent block counts the live reply's tokens; the archived reply keeps its `usage` for a later reader, and nothing reads it back. `judge-replay` replays a verdict on its archived prompt where there is one. Valid while transcripts, and the judge's prompts, stay small enough to copy whole; `archives: gzip each transcript in build-release's archive and each file in the review folders 30 days after it last changed, keeping all of them` keeps the copies small on disk. 2026-11-17, lilleman, todo item 304. Serves goals 1.4 and 4. `judge-replay` and `review-replay` each decide which rung a review pass or the judge may run on, so their runs stay checkable and re-priceable once a decision is questioned. They keep their runs in `replays/<tool>-<arguments>-<UTC stamp>/` in the archive's root: @@ -265,30 +265,30 @@ Valid while claude takes `--session-id` and resumes by it, and the human runs lo `claude_reply` reads stream-json for every caller, so the judge's runs are streams too; the archive's `JudgeRun` stays as it was, since a judge has no tools and one turn. Valid while transcripts stay small enough to copy whole. -## loop-claude: each verdict records the claude-config release and commit that ran it, the raw tokens each thread spent by model and kind since the previous outcome that recorded a spend, and the human's typed answer the judge quotes as reversing a choice the worker took on its own recommendation +## build-release: each verdict records the claude-config release and commit that ran it, the raw tokens each thread spent by model and kind since the previous outcome that recorded a spend, and the human's typed answer the judge quotes as reversing a choice the worker took on its own recommendation -2026-11-12, lilleman, todo item 305. Serves goals 1, 1.2 and 1.4. A change to the setup can be judged only by comparing chunks run before it with chunks run after, so each verdict, interrupt and quoted answer in loop-claude's archive records three things beside its judge lines. +2026-11-12, lilleman, todo item 305. Serves goals 1, 1.2 and 1.4. A change to the setup can be judged only by comparing chunks run before it with chunks run after, so each verdict, interrupt and quoted answer in build-release's archive records three things beside its judge lines. - `Config: <release> (<commit>)`: `git describe` and the commit of `~/.claude`, so outcomes group by the setup that produced them. Where git can't tell, it records `unknown` and why, on one line. - A `Spent since` block: the raw tokens each thread spent, by model and by kind (input, cache write 5m, cache write 1h, cache read, output), then the list prices in force, from `bin/model_routing/prices.py`. The threads are the worker's main thread, each subagent by its agent type and description, and the judge run that ruled. Each message counts once, by its id. The stretch runs from the previous outcome that recorded a spend, so what a `/talk` or a stopped run spent between rulings is counted once. It keeps tokens, since prices change. The prices recorded beside them give what the stretch cost when it ran. Claude Code doesn't report thinking apart from output, so it is left in output. The judge's tokens come from its json reply's `usage`, which the archived judge run holds too. -- A `Reversed:` quote: the human's typed answer that overrides a choice the worker took on its own recommendation and recorded. The judge quotes the latest such `[human]` line; loop-claude keeps the whole typed answer that holds the quote verbatim, and drops a quote no typed answer holds. `score-outcomes` counts the distinct answers per finished chunk. That count is goal 1.2's counter-signal, and the 2026-11-08 entry of `loop-claude: a judge decides each interrupt…` is valid only while it stays low. It counts only chunks that record a Config line, since earlier judges didn't look for reversals. +- A `Reversed:` quote: the human's typed answer that overrides a choice the worker took on its own recommendation and recorded. The judge quotes the latest such `[human]` line; build-release keeps the whole typed answer that holds the quote verbatim, and drops a quote no typed answer holds. `score-outcomes` counts the distinct answers per finished chunk. That count is goal 1.2's counter-signal, and the 2026-11-08 entry of `build-release: a judge decides each interrupt…` is valid only while it stays low. It counts only chunks that record a Config line, since earlier judges didn't look for reversals. Valid while score-outcomes reads the reversals from the archive. -## loop-claude: the worker's claude compacts its context before it fills a 200k window, at about 170k tokens, and `CLAUDE.md` β†’ "Compact instructions" says what the summary keeps +## build-release: the worker's claude compacts its context before it fills a 200k window, at about 170k tokens, and `CLAUDE.md` β†’ "Compact instructions" says what the summary keeps 2026-10-27, lilleman's yes to claude's evaluation through todo todo item 231. Serves goal 1.4; its counter-signal, review rounds and unfinished verdicts per chunk, is the check. -loop-claude hands each worker's claude `CLAUDE_CODE_AUTO_COMPACT_WINDOW=200000` (`bin/agent_cycle/worker.py`), and the session /talk opens gets it too. Claude Code compacts before a window fills: a 1M window at about 967k tokens, and in a probe on 2026-10-27 a 100k window at 65k and 80k, so a 200k window compacts at about 170k. The window is not set in `settings.json`, since the archive measured loop-claude's workers and interactive sessions are lilleman's. Subagents inherit the variable, which reaches every process of the session: 68 of the 994 subagent runs since 2026-10-21, 7%, passed 170k, 24 of them principles auditors, so about one in fourteen compacts once. Compacting subagents by choice would cost more than it saves, as below, but the variable cannot leave them out, and `CLAUDE.md` β†’ "Compact instructions" has a reviewer keep the findings it has drafted. That section shapes the summary: in another probe that day, a session whose CLAUDE.md asked for its summary to end with a secret word got a summary ending with that word. Path-scoped rules leave the context at a compaction and return at the next matching read, and rule-hook holds each review launch to its rung whatever the summary keeps. `CLAUDE_CODE_DISABLE_1M_CONTEXT=1`, handed the same way, would compact at the same point but also cap the window at 200k, so a run that Claude Code stops compacting, as it does when one tool result refills the context each time, would hit the limit instead of going on. +build-release hands each worker's claude `CLAUDE_CODE_AUTO_COMPACT_WINDOW=200000` (`bin/agent_cycle/worker.py`), and the session /talk opens gets it too. Claude Code compacts before a window fills: a 1M window at about 967k tokens, and in a probe on 2026-10-27 a 100k window at 65k and 80k, so a 200k window compacts at about 170k. The window is not set in `settings.json`, since the archive measured build-release's workers and interactive sessions are lilleman's. Subagents inherit the variable, which reaches every process of the session: 68 of the 994 subagent runs since 2026-10-21, 7%, passed 170k, 24 of them principles auditors, so about one in fourteen compacts once. Compacting subagents by choice would cost more than it saves, as below, but the variable cannot leave them out, and `CLAUDE.md` β†’ "Compact instructions" has a reviewer keep the findings it has drafted. That section shapes the summary: in another probe that day, a session whose CLAUDE.md asked for its summary to end with a secret word got a summary ending with that word. Path-scoped rules leave the context at a compaction and return at the next matching read, and rule-hook holds each review launch to its rung whatever the summary keeps. `CLAUDE_CODE_DISABLE_1M_CONTEXT=1`, handed the same way, would compact at the same point but also cap the window at 200k, so a run that Claude Code stops compacting, as it does when one tool result refills the context each time, would hit the limit instead of going on. -Why 200k. Item 231 asked for the best means to lower what a chunk spends on context, in dollars, then hours, with no loss of quality. Measured from loop-claude's archive, the 90 chunks with messages after the routing figures' reset of 2026-10-21 cost $1,215 at the list prices read on 2026-10-26 (Opus 5.5: $4 per million input tokens, $5 and $8 for 5-minute and 1-hour cache writes, $0.20 for cache reads, $20 for output; no model but Haiku 5.5 charges more above 200k). That is 0.86 of what the chunks' `cost-state` entries sum to, since some chunks' subagent transcripts are not in the archive. Worker main threads cost $375 (31%): 1-hour cache writes $149, cache reads $153, output $74. Subagents cost $840: 5-minute cache writes $379, output $274, cache reads $187, with the principles auditors at $274 over 342 runs, the stability reviewers $179 and general-purpose subagents $192. A worker starts at 41k tokens of context and peaks at a median 167k, one in ten past 358k, the largest at 848k. The worker's messages above 200k were 32% of its messages and 55% of its cost. +Why 200k. Item 231 asked for the best means to lower what a chunk spends on context, in dollars, then hours, with no loss of quality. Measured from build-release's archive, the 90 chunks with messages after the routing figures' reset of 2026-10-21 cost $1,215 at the list prices read on 2026-10-26 (Opus 5.5: $4 per million input tokens, $5 and $8 for 5-minute and 1-hour cache writes, $0.20 for cache reads, $20 for output; no model but Haiku 5.5 charges more above 200k). That is 0.86 of what the chunks' `cost-state` entries sum to, since some chunks' subagent transcripts are not in the archive. Worker main threads cost $375 (31%): 1-hour cache writes $149, cache reads $153, output $74. Subagents cost $840: 5-minute cache writes $379, output $274, cache reads $187, with the principles auditors at $274 over 342 runs, the stability reviewers $179 and general-purpose subagents $192. A worker starts at 41k tokens of context and peaks at a median 167k, one in ten past 358k, the largest at 848k. The worker's messages above 200k were 32% of its messages and 55% of its cost. What reads cost, and whether a tool cuts them, measured at lilleman's ask after those figures: no tool cut a reviewer's reading without losing a finding, except a scout, which kept the stability reviewers' findings but lost the auditors' πŸ”΄ and slowed every round; so none of them ships here. lilleman chose on 2026-10-27: workers trial a reading rule, reviewers get no scout, and the principles audit keeps reading the project whole. Every fresh worker prompt now holds that rule (`READING_RULE` in `bin/chunk_driver/prompts.py`), and `todo.md` item 260 keeps or drops it. Two measures of reading: the characters a thread read, 93M in all, about 27M tokens; and the new input tokens of the messages that took results in, charged to those results, which also count what arrives beside a result, such as the agent's own previous reply. By the second measure tool results caused $620 of the $1,215, and reads (Read, Bash reads, Grep, Glob and git's diff, show and log) $537 of that: the worker's reads $140 (Bash reads $115, Read $12) of its $190 of results, the principles auditors' $133 (Read $109, Grep $22) of $139, the stability reviewers' $97 (Bash reads $79) of $106, general-purpose subagents' $84 of $97, the prose reviewers' $32, the architects' $30 and the product-owner reviewers' $21. By the first measure the worker's reads are about $45. Precision is low everywhere: of the characters a principles auditor read, 13% were in a file its report names; a stability reviewer 8%; a prose reviewer 18%; an architect 11%; the worker 4% in a file it later edited. Reading is mostly to find things and to learn what a project holds. The worker's `sed` ranges are small, median 25 lines, one in ten over 80. Of the worker's read characters, 49% were of a file it had read earlier in the thread: 36% within three messages, paging through it, and 13% later, with the file unchanged, about $6 of the $45; a reviewer's later reads of an unchanged file it had read are 1 to 2%. rule-hook's `repeat-read` now blocks a read of lines already in context. The trials: four stability rounds and five principles rounds archived on 2026-10-23, each holding πŸ”΄ or 🟑 findings, replayed on the project's rung as `review-replay` replays them, with the reviewer's definition changed through `--agents`; and three worker-like tasks, a search, a rename and an explanation, run on fresh clones at the project's rung. The baseline, the reviewer as it is, found 4 of its own 6 archived findings in each pass, so a variant that finds 4 or 5 of 6 does what the same reviewer does twice. The options todo item 231 named, each simulated on the 90 chunks and, where lilleman asked, tried: - Compaction of the worker. The saving and the compactions per chunk, by the point it compacts at: 150k saves $75 at 1.0 compactions; 167k to 180k, where a 200k window compacts, $77 to $78 at 0.8 to 0.7; 200k $78 at 0.5; 300k $54 at 0.2. $78 is 21% of the workers' $375 and 6% of all spend. Compaction also caps the 36 re-writes of a whole context after a gap longer than the cache's hour or a change of rung: they cost $61, up to 785k tokens each, and would cost about $34. Compacting subagents at 150k costs more than it saves, since a compaction reads the context once more and writes a summary, and subagents are short. -- A fresh context for the review phase, handed 60k tokens of facts, saves $39. A compaction at 170k saves that too, and loop-claude would need a second session per chunk. +- A fresh context for the review phase, handed 60k tokens of facts, saves $39. A compaction at 170k saves that too, and build-release would need a second session per chunk. - Read with an offset and a limit, or Grep, in place of `cat`, `sed` and `head`. Steering the tool would not change how much is read: the worker's `sed` ranges are small already, and only 13% of its Bash-read characters came from whole files. A rule on how much to read did change it: under "never read more than 80 lines of a file at once, nor take a tool output over 3,000 characters into your context", the three worker tasks read 45% to 60% fewer characters at the same or lower cost, every task done as well, and the rename was the one run of four that also kept the import names sorted. A stability reviewer under the same rule with an `outline` script on PATH, which prints a file's symbols with their line ranges, read 4% less and found 2 of 6 findings, and the workers never ran the script. - Code-intelligence tooling: the `LSP` tool, through a pyright plugin built from the marketplace manifest with `pyright-langserver` on PATH, answers a file's symbols, a definition or the references in a few hundred characters. Under a rule telling them to use it, the stability reviewers and the workers never called it; the auditors did, read as much or more, and missed the one πŸ”΄, 0 of 1 against the baseline's 1 of 1. Each machine would also need a server per language (goal 2). Not worth an item. - A cap on tool results. Claude Code caps a Bash result at about 30k characters already. A PostToolUse hook capping it at 12k, which `updatedToolOutput` allows, left the stability reviewers 3 of 6 findings, two lost in one round. Read results, 59.9M characters in subagents' threads with 58% of their characters in results over 12k, are out of such a hook's reach. Not worth an item. @@ -302,11 +302,11 @@ Hours. A chunk ran a median 0.7 hours from its first message to its last, one in Valid while cache reads cost a twentieth of input and Claude Code's compaction keeps the worker's task. -## loop-claude: the worker's claude saves a Bash result of more than 6,000 characters to a file, and rule-hook refuses a Read of a session transcript +## build-release: the worker's claude saves a Bash result of more than 6,000 characters to a file, and rule-hook refuses a Read of a session transcript 2026-11-18, claude, as the plan item that asked for the ceiling set out. Applies project principle 1; serves goal 1.4. -loop-claude hands each worker's claude `BASH_MAX_OUTPUT_LENGTH=6000` (`worker_environment` in `bin/agent_cycle/run.py`, the value in `bin/claude_code/output_limits.py`). Claude Code then saves a longer Bash result to a file under `~/.claude/projects/<project>/<session>/tool-results/` and hands the model the path and the first 2,000 characters, which a probe on 2026-11-17 confirmed. A subagent inherits the variable, so every reviewer the worker launches gets it too. The archive held 7,870 Bash results over 3,000 characters in workers (about $305 of carried context) and about $145 more in stability reviewers; a ceiling of 6,000 characters would have removed $228 of the workers', 10,000 characters $122. +build-release hands each worker's claude `BASH_MAX_OUTPUT_LENGTH=6000` (`worker_environment` in `bin/agent_cycle/run.py`, the value in `bin/claude_code/output_limits.py`). Claude Code then saves a longer Bash result to a file under `~/.claude/projects/<project>/<session>/tool-results/` and hands the model the path and the first 2,000 characters, which a probe on 2026-11-17 confirmed. A subagent inherits the variable, so every reviewer the worker launches gets it too. The archive held 7,870 Bash results over 3,000 characters in workers (about $305 of carried context) and about $145 more in stability reviewers; a ceiling of 6,000 characters would have removed $228 of the workers', 10,000 characters $122. rule-hook's `transcript-read` rule refuses a Read of a `.jsonl` file under `~/.claude/projects`: a session transcript holds every tool result of its session, and the archive's Reads of old ones cost $46. It doesn't refuse a Read of `tool-results/*.txt`, which the ceiling hands the model, and it checks no Grep or Bash command. It can't be overridden, since a Read carries no text for a marker. @@ -322,9 +322,9 @@ Valid while Claude Code saves a Bash result over the ceiling to a file and hands Valid while tokens, πŸ”΄ and 🟑 findings and interrupts per chunk don't rise against the chunks before the change; `todo.md` item 497 measures it. -## machine load: a heavy command waits for one of the machine's heavy slots, one for every 4 CPUs, which every session shares, and loop-claude starts a worker only while at least a quarter of the machine's memory is available +## machine load: a heavy command waits for one of the machine's heavy slots, one for every 4 CPUs, which every session shares, and build-release starts a worker only while at least a quarter of the machine's memory is available -2026-10-23, lilleman. Serves goal 1.5. On 2026-10-22 ai-sandbox, with 8 CPUs and 16 GiB, thrashed for hours: four to six loops ran mutation tests, full gates, `docker build`s and QEMU-booting e2e tests at once, and nothing told one loop how busy the machine was. lilleman chose both limits; no standard sets either, and GNU parallel's `--memfree`, which does the memory wait's job, has no default. A slot is a file lock, so a session that dies frees its slot. The memory wait reads `/proc/meminfo` only, and off Linux a worker starts at once. `bin/machine_load/` holds the slots and the memory share, `bin/run-heavy` takes a slot, `CLAUDE.md` β†’ "Working with the codebase" has every session use it, and loop-claude's worker waits for the share. rule-hook's rule `run-heavy` blocks a `docker build`, and a run of a mutation tool stability-reviewer names, outside run-heavy, in the forms its `checked` text in `bin/rule_hook/rules.py` lists. 2026-11-16, lilleman: rule-hook checks a run through `uv run`, `poetry run`, `sudo` and `doas` too, such as `uv run mutmut run` and `sudo docker build`, since project principle 4 has a program enforce a rule it can check. The 2026-11-04 note had let such forms pass until one became a problem. No program can tell a gate script from a light one, so only `CLAUDE.md` asks a session to run a gate under run-heavy. Valid while one machine runs several loops at once. +2026-10-23, lilleman. Serves goal 1.5. On 2026-10-22 ai-sandbox, with 8 CPUs and 16 GiB, thrashed for hours: four to six loops ran mutation tests, full gates, `docker build`s and QEMU-booting e2e tests at once, and nothing told one loop how busy the machine was. lilleman chose both limits; no standard sets either, and GNU parallel's `--memfree`, which does the memory wait's job, has no default. A slot is a file lock, so a session that dies frees its slot. The memory wait reads `/proc/meminfo` only, and off Linux a worker starts at once. `bin/machine_load/` holds the slots and the memory share, `bin/run-heavy` takes a slot, `CLAUDE.md` β†’ "Working with the codebase" has every session use it, and build-release's worker waits for the share. rule-hook's rule `run-heavy` blocks a `docker build`, and a run of a mutation tool stability-reviewer names, outside run-heavy, in the forms its `checked` text in `bin/rule_hook/rules.py` lists. 2026-11-16, lilleman: rule-hook checks a run through `uv run`, `poetry run`, `sudo` and `doas` too, such as `uv run mutmut run` and `sudo docker build`, since project principle 4 has a program enforce a rule it can check. The 2026-11-04 note had let such forms pass until one became a problem. No program can tell a gate script from a light one, so only `CLAUDE.md` asks a session to run a gate under run-heavy. Valid while one machine runs several loops at once. ## machine load: every container a session starts has a memory limit and a swap limit as large as its work needs; rule-hook's `docker-run-memory` blocks a `docker run` or `docker create` without them outside run-heavy, under which a container that lacks them gets the slot's share of three quarters of the memory; and no daemon-wide cap limits all containers together @@ -334,7 +334,7 @@ The heavy command in that hang started its container from the project's own scri A daemon-wide cap would see every container: dockerd's `cgroup-parent`, given a memory limit. lilleman turned it down, since it is host config and would cap a project's heavy work too. Valid while sessions start their work in containers on a machine they share. -## names: the plan calls the project and its repo `dev-factory`, loop-claude `build-release` and do-epic `build-epic`, and the code keeps today's names until its planned items ship +## names: the plan calls the project and its repo `dev-factory`, build-release `build-release` and do-epic `build-epic`, and the code keeps today's names until its planned items ship 2026-11-28, lilleman, part of the standalone-install plan approved on 2026-11-20. Serves goal 2: a person who clones a release meets commands named for what they make. The names set the install folders, such as `~/.config/build-release/`. lilleman chose `build-release` over the proposed `do-release` because "do" reads as if the command cuts the release, which stays the human's. "Build" says it makes what the release holds, and `build-epic` follows it for an epic. Neither name has "claude" in it, which fits goal 6, a setup that doesn't depend on Claude Code. The code keeps today's names until the plan items that rename them ship: items 485, 575 and 576, all in 0.18.0. On 2026-12-03 lilleman chose a hard break for those three renames: no old name stays as an alias. Renaming the repo on the forge is the human's. Valid while the install folders are named for `build-release`. @@ -362,9 +362,9 @@ Valid while no published standard sets either number, the reading-cost window st 2026-10-08, lilleman. Serves code health and goal 1.4, whose counter-signal is a rising reading cost: any rise counts. Per-chunk figures are noisy: a flat trend rises about every other chunk. So a rise refreshes the item and never refiles it, and a chunk that sees no rise leaves the item as it is. The chunk that ships the item resets the trend, so later figures do not refile it for work that chunk already did (goal 1.4). A median, because one chunk that ran a panel of readers before its first commit measured 2.99M tokens against a typical 80k–370k, and a mean let it decide the trend alone. No published standard sets this threshold. Valid while figures arrive once per chunk. -## reading cost: larv-review measures each finished chunk from loop-claude's archive and appends the figure to `docs/reading-cost.md` in the next chunk's PR +## reading cost: larv-review measures each finished chunk from build-release's archive and appends the figure to `docs/reading-cost.md` in the next chunk's PR -2026-10-08, lilleman. Serves code health and goal 1.4, whose counter-signal is reading cost: measured from real work, at no model cost. loop-claude archives from the main checkout, outside any PR, so a tracked file it wrote there would dirty that checkout. So `bin/reading-cost` measures each finished chunk `docs/reading-cost.md` lacks from the archive, in the next chunk's worktree. A PR that never merges then loses no figure, and loop-claude needs no change. The figures keep a file of their own, so `docs/comprehension-history.md` keeps one writer, the comprehension check. Serves goal 5 by naming only files git tracks, and token counts. Rejected: loop-claude opening a PR of its own, one more PR per chunk and a tie to the forge; the worker measuring its own transcript before merging, which misses the chunk's tail. The figure counts new input tokens, uncached and cache-written, because workers read mostly through Bash and subagents, where parsed paths alone miss what they read. Valid while loop-claude archives every finished chunk with its subagents' transcripts. +2026-10-08, lilleman. Serves code health and goal 1.4, whose counter-signal is reading cost: measured from real work, at no model cost. build-release archives from the main checkout, outside any PR, so a tracked file it wrote there would dirty that checkout. So `bin/reading-cost` measures each finished chunk `docs/reading-cost.md` lacks from the archive, in the next chunk's worktree. A PR that never merges then loses no figure, and build-release needs no change. The figures keep a file of their own, so `docs/comprehension-history.md` keeps one writer, the comprehension check. Serves goal 5 by naming only files git tracks, and token counts. Rejected: build-release opening a PR of its own, one more PR per chunk and a tie to the forge; the worker measuring its own transcript before merging, which misses the chunk's tail. The figure counts new input tokens, uncached and cache-written, because workers read mostly through Bash and subagents, where parsed paths alone miss what they read. Valid while build-release archives every finished chunk with its subagents' transcripts. ## review: `/security-review` is the security pass of record, except where the full scan runs on the same change and replaces it @@ -416,7 +416,7 @@ Valid while the later fixes per finished chunk, which `score-outcomes` and the r ## project config: a record may name a Confluence Cloud page as `confluence:` and its address, the loop reads and writes it as markdown, and a write never overwrites a save made since the loop's read -2026-11-15, larv-review, on lilleman's calls of 2026-11-12. Serves goal 1.6: a client's team keeps its records in its own wiki. Valid while one record fits one page, and while each worktree opens its own copy of a record, as loop-claude's side-by-side chunks need. +2026-11-15, larv-review, on lilleman's calls of 2026-11-12. Serves goal 1.6: a client's team keeps its records in its own wiki. Valid while one record fits one page, and while each worktree opens its own copy of a record, as build-release's side-by-side chunks need. - **A bench of readers picked the spelling.** Three fresh readers, seated as the person who writes a client's `config.toml`, each picked `decisions = "confluence:https://<site>/wiki/spaces/<space>/pages/<page ID>"`, pasted from the browser with or without the title at its end, over the bare address, a page ID beside a `confluence-site` key, and a table. Each named the match with `jira:`. Any of the five records may name a page; the goals file, the plan, the working rules and the principles may not. - **`decisions` and `comprehension-history` may name a page only where `plan` names a Jira epic.** rule-hook ranks a plan kept as a file before tool calls, inside its 30-second limit, and ranking reads those two records. A Confluence read and two adf-codec container runs would hold up every guarded tool call, and fail it while Confluence is down. `load` refuses goals in Jira beside a plan in a file for the same reason. @@ -428,11 +428,11 @@ Valid while the later fixes per finished chunk, which `score-outcomes` and the r 2026-11-13, larv-review. Serves goal 1.6: a client's plan and records live in the config's folder, and the loop still runs there. A file the config puts outside the checkout has no commit in the project's history, so a tool that needs the file's commits cannot do its job for it. No such tool blocks the loop or a merge, and each says what it leaves undone: -- `score-outcomes` and loop-claude's routing figures read what each chunk shipped from the commits of `todo.md`, and leave `docs/comprehension-history.md` and `docs/reading-cost.md` out of a chunk's work. They count a project only where the three are at those paths in the checkout (`bin/branch_chunks/read.py`, `unsupported`). `score-outcomes` exits 1 with the reason; the routing figures list the project under "Default branches unread". +- `score-outcomes` and build-release's routing figures read what each chunk shipped from the commits of `todo.md`, and leave `docs/comprehension-history.md` and `docs/reading-cost.md` out of a chunk's work. They count a project only where the three are at those paths in the checkout (`bin/branch_chunks/read.py`, `unsupported`). `score-outcomes` exits 1 with the reason; the routing figures list the project under "Default branches unread". - `larv-review` cannot count the scoring runs a branch recorded, or find a paired ruling's base, in a comprehension history outside the checkout. Nor can it read a plan outside the checkout as the chunk found it, so it cannot tell which items the chunk shipped. In each case `scoring-run-owed` says so, and the merge goes on; `needs-scoring-run` and `record-scoring` say so for an item such a plan no longer holds. - rule-hook cannot tell whether a plan outside the checkout changed, so it checks that plan's ranking on every call. -- A file outside the checkout is read as it stands, never as the default branch held it: release standing, chunk-preflight and loop-claude's routing read such a plan or changelog from disk. -- chunk-preflight and loop-claude's routing learn that a release's items are all done from the plan's commits. A plan outside the checkout no longer names such a release, so the release after it reads as next, and only the last release of all gets a release review called due and is called ready to cut. Both tools say so on every run, and that the release reviews and the cuts are the human's to call (`bin/release_plan/release_standing.py`, `UNSEEN_RELEASES`). +- A file outside the checkout is read as it stands, never as the default branch held it: release standing, chunk-preflight and build-release's routing read such a plan or changelog from disk. +- chunk-preflight and build-release's routing learn that a release's items are all done from the plan's commits. A plan outside the checkout no longer names such a release, so the release after it reads as next, and only the last release of all gets a release review called due and is called ready to cut. Both tools say so on every run, and that the release reviews and the cuts are the human's to call (`bin/release_plan/release_standing.py`, `UNSEEN_RELEASES`). Messages keep each file's usual name, such as `todo.md`, as its label, since the config keeps the names. Revisit at 0.23.0, which plans the support for `score-outcomes`, the routing figures, the release standing and the owed scoring run. @@ -483,7 +483,7 @@ Messages keep each file's usual name, such as `todo.md`, as its label, since the 2026-10-15, lilleman asked for it through todo item 144, implemented by claude. Serves goal 1.1: a cheap reviewer that finds the work below standard can have a more capable one check that ruling, and work below standard gets a more capable rung to fix it, unless the fix changes only prose. -The work is below standard where systems-architect returns BLOCK, a reviewer reports a finding against the review standards' `quality.md`, or `record-ruling` counts a comprehension seat's vote in a paired ruling as worse. That reviewer or seat may ask, and the worker then relaunches it on the rung loop-claude's prompt names, one above the rung it ran on. `bin/chunk_driver/prompts.py`'s `reruns` names it: the seats run on the project's rung, and the reviewers on the highest of the worker's rung and the one their item's E + I picks. Off the ladder, or for a reviewer or seat already on the top rung, the prompt names none, and its report stands. +The work is below standard where systems-architect returns BLOCK, a reviewer reports a finding against the review standards' `quality.md`, or `record-ruling` counts a comprehension seat's vote in a paired ruling as worse. That reviewer or seat may ask, and the worker then relaunches it on the rung build-release's prompt names, one above the rung it ran on. `bin/chunk_driver/prompts.py`'s `reruns` names it: the seats run on the project's rung, and the reviewers on the highest of the worker's rung and the one their item's E + I picks. Off the ladder, or for a reviewer or seat already on the top rung, the prompt names none, and its report stands. A reviewer's relaunch gets the report that asked and confirms or dismisses each of its findings with a reason, so no finding goes unanswered; a seat's relaunch reads afresh, since a seat reports no findings. The relaunch's report stands in place of the one that asked, in the same round, so it adds no round, and a relaunch cannot ask again. So the round cap still bounds a pass, and one round launches a reviewer at most twice. The ruling that stands is the fourth escalation trigger in `CLAUDE.md`, except where the fix changes only prose: the worker fixes that on its own rung. lilleman ruled that on 2026-11-08 through todo item 276, after PR #432's two quality findings were false claims, one in a docstring and one in a sentence of this file. lilleman also ruled that no ruling raises the judge's rung, which `routing: on a model judge-replay covered` sets. @@ -507,7 +507,7 @@ Valid while the ladder orders its rungs by competence. Each reviewer holds Write for its report. Claude Code passes a subagent's type to a PreToolUse hook as `agent_type`. So `bin/rule_hook/reviewer_report.py` refuses a reviewer's Edit and MultiEdit, and any Write outside `~/.local/state/larv-review/`; no marker overrides it. A reviewer's Bash, as stability-reviewer holds, is not confined. -The folder is fixed, since loop-claude's headless sessions have no scratchpad, and it also holds any other file a session parks outside its checkout, such as the comprehension panel's base worktree or a build probe's output. It sits outside every checkout, so no project sees a report. It survives a reboot, unlike `/tmp`, so a resumed chunk still reads its earlier rounds. It is in the user's home, so no other local user plants a symlink that widens it. A report may quote a secret, so `larv-review review-folder`, which makes the chunk's folder, leaves `~/.local/state/larv-review` readable by the user alone. +The folder is fixed, since build-release's headless sessions have no scratchpad, and it also holds any other file a session parks outside its checkout, such as the comprehension panel's base worktree or a build probe's output. It sits outside every checkout, so no project sees a report. It survives a reboot, unlike `/tmp`, so a resumed chunk still reads its earlier rounds. It is in the user's home, so no other local user plants a symlink that widens it. A report may quote a secret, so `larv-review review-folder`, which makes the chunk's folder, leaves `~/.local/state/larv-review` readable by the user alone. A chunk keeps its folder after the merge. `review-replay` hands a replayed reviewer a copy holding only the reports written after the chunk began and before the round did. So the replay reads the earlier rounds its prompt names, never the findings it is to find. The chunk's own reports stay as they were. @@ -587,11 +587,11 @@ Valid while a foreground Agent call returns only when its agent has finished. 2026-10-14, lilleman. Serves goals 1.1 and 1.4. -Only chunks run below the project's rung can prove that a cheaper worker holds quality (goal 1.1). So on 2026-10-14 lilleman chose a trial on real chunks: a replay of past chunks would spend on work that never ships (goal 1.4). Review holds quality meanwhile. While the worker runs below the project's rung, loop-claude's prompt has it launch each comprehension seat and the security pass's subagent on the project's rung, and each reviewer there too unless the highest E + I among its items picks a higher rung or a replay lowered its pass, through the Agent tool's model and effort. The worker runs a full scan only from such a subagent, because the `claude-security` plugin's researchers and verifiers inherit the model that starts them. A subagent that cannot run the scan leaves it unavailable, so larv-review runs `/security-review` in its place. lilleman chose the project's rung, medium, knowing `settings.json` then ran every interactive session on Opus 5.5 at xhigh, so a routed worker ran below the effort an interactive session took. +Only chunks run below the project's rung can prove that a cheaper worker holds quality (goal 1.1). So on 2026-10-14 lilleman chose a trial on real chunks: a replay of past chunks would spend on work that never ships (goal 1.4). Review holds quality meanwhile. While the worker runs below the project's rung, build-release's prompt has it launch each comprehension seat and the security pass's subagent on the project's rung, and each reviewer there too unless the highest E + I among its items picks a higher rung or a replay lowered its pass, through the Agent tool's model and effort. The worker runs a full scan only from such a subagent, because the `claude-security` plugin's researchers and verifiers inherit the model that starts them. A subagent that cannot run the scan leaves it unavailable, so larv-review runs `/security-review` in its place. lilleman chose the project's rung, medium, knowing `settings.json` then ran every interactive session on Opus 5.5 at xhigh, so a routed worker ran below the effort an interactive session took. -While the worker runs above the project's rung, loop-claude's prompt has it launch the comprehension seats and the security pass's subagent on the project's rung too. So the seats score every chunk on one rung, and the security pass spends no more than the project chose. The prompt after each unfinished verdict repeats this, since a step-up may have taken the worker above the project's rung. The other reviewers never run below the worker's rung while it runs above the project's: a worker climbs because its chunk proved harder than its score said, which is when a cheaper reviewer is the bigger risk. A reviewer or seat that rules the work below standard may rerun one rung up: `review: a reviewer or comprehension seat that rules the work below standard`. +While the worker runs above the project's rung, build-release's prompt has it launch the comprehension seats and the security pass's subagent on the project's rung too. So the seats score every chunk on one rung, and the security pass spends no more than the project chose. The prompt after each unfinished verdict repeats this, since a step-up may have taken the worker above the project's rung. The other reviewers never run below the worker's rung while it runs above the project's: a worker climbs because its chunk proved harder than its score said, which is when a cheaper reviewer is the bigger risk. A reviewer or seat that rules the work below standard may rerun one rung up: `review: a reviewer or comprehension seat that rules the work below standard`. -On 2026-10-16 lilleman routed the reviewers on their item's E + I as well, on either side of the project's rung, which may lift them above both the worker's rung and the project's: how far a defect would escape, and what it would break, set how hard review must look (goal 1.1). loop-claude names that rung in the worker's prompt. It hands the E + I to the worker's claude beside the project's rung and the worker's, so rule-hook works out each review's rung as the prompt does and holds each launch to it. A low E + I never steps a reviewer below the project's rung: only a replay lowers a pass, as `routing: a review pass runs below the project's rung only on a rung whose replay of its rounds finds a share of their πŸ”΄ and 🟑 findings no more than a margin below the project's rung's own replay…` records. An item the worker takes in beyond the routed one counts too, since its E + I scores its defects as the routed item's scores theirs. The worker's prompt names the reviewers' rung each higher E + I picks, so the worker reviews a taken-in item on it in the same run. loop-claude scores each item the worker names on its `Chunk items:` line by `todo.md` (`routing: loop-claude reads the items a chunk takes`), routes on their highest E + I from the next cycle, and archives it with the route so a rerun keeps it. +On 2026-10-16 lilleman routed the reviewers on their item's E + I as well, on either side of the project's rung, which may lift them above both the worker's rung and the project's: how far a defect would escape, and what it would break, set how hard review must look (goal 1.1). build-release names that rung in the worker's prompt. It hands the E + I to the worker's claude beside the project's rung and the worker's, so rule-hook works out each review's rung as the prompt does and holds each launch to it. A low E + I never steps a reviewer below the project's rung: only a replay lowers a pass, as `routing: a review pass runs below the project's rung only on a rung whose replay of its rounds finds a share of their πŸ”΄ and 🟑 findings no more than a margin below the project's rung's own replay…` records. An item the worker takes in beyond the routed one counts too, since its E + I scores its defects as the routed item's scores theirs. The worker's prompt names the reviewers' rung each higher E + I picks, so the worker reviews a taken-in item on it in the same run. build-release scores each item the worker names on its `Chunk items:` line by `todo.md` (`routing: build-release reads the items a chunk takes`), routes on their highest E + I from the next cycle, and archives it with the route so a rerun keeps it. Valid until the trial on real chunks shows whether a worker below the project's rung holds quality. @@ -632,7 +632,7 @@ Valid while delegated searches save more context than their reports cost. Four escalation triggers in `CLAUDE.md` β†’ "Working with the codebase" mark a task too hard: a re-score of the item on the project's rung or above picks a higher rung, the same failing test or finding survives two fix attempts, a pass reports a πŸ”΄ in round 2 or later, or a reviewer or seat rules the work below standard, unless the fix changes only prose. When one fires, the worker hands the hard part to a subagent one rung above its own, edits included, though the delegation rule keeps edits in the worker's thread: the escalation exists because the worker could not get them right. Each further trigger on that task climbs one more rung. Without lilleman's yes the climb stops two rungs above the rung the chunk started on: the rung its item picks, or the project's rung when no item routed it. A step-up between cycles raises the worker but not that limit: lilleman set the limit from the rung the chunk started on, so a worker that has stepped up may need a yes for its first escalation. -loop-claude's prompt names the rungs a trigger opens, so the worker computes no rung positions, and tells the worker to open each escalated subagent's prompt with `Escalation trigger <n>:`. `bin/agent_cycle/routing.py` holds the limit and `bin/model_routing/route.py` the marker. The archive keeps the raw transcript, which holds the marked prompt, and `bin/routing_figures/` counts the escalations by trigger in `routing-figures.md`, per starting rung for routed chunks and in total for every chunk. +build-release's prompt names the rungs a trigger opens, so the worker computes no rung positions, and tells the worker to open each escalated subagent's prompt with `Escalation trigger <n>:`. `bin/agent_cycle/routing.py` holds the limit and `bin/model_routing/route.py` the marker. The archive keeps the raw transcript, which holds the marked prompt, and `bin/routing_figures/` counts the escalations by trigger in `routing-figures.md`, per starting rung for routed chunks and in total for every chunk. Valid while the ladder orders its rungs by competence. @@ -654,13 +654,13 @@ Every arm passed every case, so the bench found no quality gap for an advisor to 2026-10-15, lilleman asked for it. Serves goals 1.1 and 1.4: when the hard part is the rest of the chunk, handing it to subagents piece by piece leaves the worker, which reads and checks each of their diffs, on a rung that proved too low. The worker climbs only once its run records a trigger. -loop-claude's prompt offers the step beside the escalated subagent of `routing: a worker hands a task one rung up`, as long as the limit leaves a rung that subagent may take without the human's yes. The worker then ends its run asking loop-claude for a higher rung and naming the trigger. The judge quotes the earlier passage where the trigger fired, such as a review round's commit title or the worker's report of the failing test, never a later mention of it and never the request itself. The quoted passage must sit after the worker's last step-up, which loop-claude checks, so one passage buys one step. The judge sees the worker's text and tool calls but no tool results, so the quote shows that the run recorded the trigger, not that a tool's output bears it out. loop-claude checks the quote word for word, as it checks a quoted answer, since stitched fragments can make up a trigger. Without such a quote, the rung holds. A misquote is no failure, since holding the rung is safe and three failures stop an unattended loop. The next cycle's prompt names the worker's rung, so the worker learns whether the step went through. When a quoted answer, or an interrupt the human answers on loop-claude's terminal, steps the worker up, the prompt that resumes it with the answer names the new rung, so the worker learns of the step sooner. +build-release's prompt offers the step beside the escalated subagent of `routing: a worker hands a task one rung up`, as long as the limit leaves a rung that subagent may take without the human's yes. The worker then ends its run asking build-release for a higher rung and naming the trigger. The judge quotes the earlier passage where the trigger fired, such as a review round's commit title or the worker's report of the failing test, never a later mention of it and never the request itself. The quoted passage must sit after the worker's last step-up, which build-release checks, so one passage buys one step. The judge sees the worker's text and tool calls but no tool results, so the quote shows that the run recorded the trigger, not that a tool's output bears it out. build-release checks the quote word for word, as it checks a quoted answer, since stitched fragments can make up a trigger. Without such a quote, the rung holds. A misquote is no failure, since holding the rung is safe and three failures stop an unattended loop. The next cycle's prompt names the worker's rung, so the worker learns whether the step went through. When a quoted answer, or an interrupt the human answers on build-release's terminal, steps the worker up, the prompt that resumes it with the answer names the new rung, so the worker learns of the step sooner. -A run that asks for a higher rung may also ask a question. The judge then interrupts, or quotes the answer from README.md or the records, and either ruling carries the escalation quote too, checked the same way. loop-claude steps the rung as the ruling comes in, before the human is asked or the worker resumes with the quoted answer, since the work after the answer is work the stepped rung should do. An interrupt or a quoted answer is no unfinished verdict, so it adds to no count. +A run that asks for a higher rung may also ask a question. The judge then interrupts, or quotes the answer from README.md or the records, and either ruling carries the escalation quote too, checked the same way. build-release steps the rung as the ruling comes in, before the human is asked or the worker resumes with the quoted answer, since the work after the answer is work the stepped rung should do. An interrupt or a quoted answer is no unfinished verdict, so it adds to no count. -The judge may quote a different passage for the trigger that already stepped the rung, and loop-claude cannot tell from the quote alone whether the trigger is new. So it goes by where the quoted passage sits in the transcript. When an escalation steps the worker, the route marks how many transcript entries the session held: the mark. loop-claude then accepts an escalation quote only from the worker's own lines after the mark, never from its own prompts or the human's lines, which repeat earlier passages. The judge reads a `[step]` line at the mark saying the triggers before it are spent, so it quotes a passage the check accepts. The session's transcript only grows, so the mark holds across cycles. The trigger that bought a step, and any rewording of it before the mark, cannot buy another. A trigger that fires after the step steps the worker again, in the same cycle or a later one. One risk remains: a worker on the stepped rung may restate an old trigger after the mark, and the judge may quote that. The cap two rungs above the rung the item picks limits what this costs. Before the mark, once an interrupt or a quoted answer had taken an escalation, no later ruling of that cycle carried one, so a trigger that fired after the answer was lost. lilleman chose the mark on 2026-10-18 over two alternatives: lifting that rule when a worker run ended would have let one trigger buy two steps, and telling the worker its request was dropped would still have lost the step. +The judge may quote a different passage for the trigger that already stepped the rung, and build-release cannot tell from the quote alone whether the trigger is new. So it goes by where the quoted passage sits in the transcript. When an escalation steps the worker, the route marks how many transcript entries the session held: the mark. build-release then accepts an escalation quote only from the worker's own lines after the mark, never from its own prompts or the human's lines, which repeat earlier passages. The judge reads a `[step]` line at the mark saying the triggers before it are spent, so it quotes a passage the check accepts. The session's transcript only grows, so the mark holds across cycles. The trigger that bought a step, and any rewording of it before the mark, cannot buy another. A trigger that fires after the step steps the worker again, in the same cycle or a later one. One risk remains: a worker on the stepped rung may restate an old trigger after the mark, and the judge may quote that. The cap two rungs above the rung the item picks limits what this costs. Before the mark, once an interrupt or a quoted answer had taken an escalation, no later ruling of that cycle carried one, so a trigger that fired after the answer was lost. lilleman chose the mark on 2026-10-18 over two alternatives: lifting that rule when a worker run ended would have let one trigger buy two steps, and telling the worker its request was dropped would still have lost the step. -The step is one rung up from the rung the worker would otherwise hold: its own, or the rung an item it names on its `Chunk items:` line picks, whichever is higher. It resets the count of unfinished verdicts, so the step every second one takes counts afresh; when both steps fall on one verdict, the worker steps once. It stops at the limit escalated subagents stop at, two rungs above the rung the chunk started on. Past that limit the rung holds: loop-claude takes no yes from the human between cycles, so a worker there asks the human for an escalated subagent instead. The judge keeps its rung, as `routing: on a model judge-replay covered` says. +The step is one rung up from the rung the worker would otherwise hold: its own, or the rung an item it names on its `Chunk items:` line picks, whichever is higher. It resets the count of unfinished verdicts, so the step every second one takes counts afresh; when both steps fall on one verdict, the worker steps once. It stops at the limit escalated subagents stop at, two rungs above the rung the chunk started on. Past that limit the rung holds: build-release takes no yes from the human between cycles, so a worker there asks the human for an escalated subagent instead. The judge keeps its rung, as `routing: on a model judge-replay covered` says. The archive quotes the judge's passage under `Escalation:` in the unfinished verdict, the interrupt or the quoted answer. The step an unfinished verdict causes is archived after it. The step an interrupt or a quoted answer causes is archived with it, at once: the interrupt or answer names the rung the worker ran on until then, and a step-up archived beside it names the rung it runs on from then. So the routing figures charge each stretch to its own rung, and a loop that dies while the human answers resumes on the stepped rung. Each archived worker line names the mark once there is one, so a resumed loop keeps it. `bin/routing_figures/` counts none of these steps as an escalation by trigger, which it counts only from subagent prompts. @@ -676,21 +676,21 @@ Resume's verdict matched or beat the brief's on every item, and the brief cost l Valid while the worker reports in its transcript the triggers that fired, and while a chunk's session transcript only grows. -## routing: loop-claude measures review rounds and unfinished verdicts per rung every 20 cycles, and calls for a routing change when, of two rungs with 5 or more chunks each, the lower took more of either than the one above, or when 5 or more subagents of one type had reports longer than the tool results they read +## routing: build-release measures review rounds and unfinished verdicts per rung every 20 cycles, and calls for a routing change when, of two rungs with 5 or more chunks each, the lower took more of either than the one above, or when 5 or more subagents of one type had reports longer than the tool results they read 2026-10-15, lilleman. Serves goals 1.2 and 1.4. -The cost of a cheaper worker shows as extra review rounds and unfinished verdicts. Every 20 cycles across the archive, loop-claude measures them in code, with no model run (goal 1.4), and interrupts lilleman with the calls not raised before, when chunks routed onto a rung took more of either than chunks routed onto the next rung up, each rung with 5 chunks or more. Five keeps one odd chunk from calling for a change (goal 1.2). It also calls when the reports of 5 or more subagents of one type were longer than the tool results they read, so a delegated search cost the worker more context than it saved. `bin/routing_figures/` measures and words the calls. A loop on another project cannot commit here, so it writes the figures and the calls raised at the archive's root, and this repo's next chunk files the plan item, as `AGENTS.md` says. Off a terminal, a call is said on stderr and the loop goes on: it is about this setup, not the running project's chunk. A reset line in the calls file restarts the figures after a routing change, so they show whether the change worked. +The cost of a cheaper worker shows as extra review rounds and unfinished verdicts. Every 20 cycles across the archive, build-release measures them in code, with no model run (goal 1.4), and interrupts lilleman with the calls not raised before, when chunks routed onto a rung took more of either than chunks routed onto the next rung up, each rung with 5 chunks or more. Five keeps one odd chunk from calling for a change (goal 1.2). It also calls when the reports of 5 or more subagents of one type were longer than the tool results they read, so a delegated search cost the worker more context than it saved. `bin/routing_figures/` measures and words the calls. A loop on another project cannot commit here, so it writes the figures and the calls raised at the archive's root, and this repo's next chunk files the plan item, as `AGENTS.md` says. Off a terminal, a call is said on stderr and the loop goes on: it is about this setup, not the running project's chunk. A reset line in the calls file restarts the figures after a routing change, so they show whether the change worked. -Since 2026-10-16 the reviewers may run above the worker's rung, on the one the highest E + I among their chunk's items picks, so chunks whose worker ran on a lower rung may take more rounds from stronger reviewers, and a call could blame the worker's rung for them; `todo.md` item 171 groups the rounds by the reviewers' rung too. Valid while loop-claude's archive holds every finished chunk's review rounds and unfinished verdicts. +Since 2026-10-16 the reviewers may run above the worker's rung, on the one the highest E + I among their chunk's items picks, so chunks whose worker ran on a lower rung may take more rounds from stronger reviewers, and a call could blame the worker's rung for them; `todo.md` item 171 groups the rounds by the reviewers' rung too. Valid while build-release's archive holds every finished chunk's review rounds and unfinished verdicts. -## routing: loop-claude reads the items a chunk takes from the worker's latest `Chunk items:` line and scores them by `todo.md` as the default branch held it when the cycle started; the judge reports the escalation and whether a release is ready to cut +## routing: build-release reads the items a chunk takes from the worker's latest `Chunk items:` line and scores them by `todo.md` as the default branch held it when the cycle started; the judge reports the escalation and whether a release is ready to cut -2026-11-11, claude. Serves goal 1.4 and code health. The judge's reply held three facts beside its verdict: the items the worker took into the chunk, with their highest L and E + I; whether a release was ready to cut; and any escalation the worker asked for. Routing lifts the worker's and the reviewers' rungs by the items' levels. Code now reads the items: each chunk's first prompt, and each prompt resuming it, asks the worker for a line opening `Chunk items:`, `bin/loop_claude/chunk/chunk_items.py` reads the latest such line in the worker's own text, and `plan.todo_table` scores the items. So the judge's reply is smaller, and every L and E + I that routing reads comes from `todo.md`, through one module. +2026-11-11, claude. Serves goal 1.4 and code health. The judge's reply held three facts beside its verdict: the items the worker took into the chunk, with their highest L and E + I; whether a release was ready to cut; and any escalation the worker asked for. Routing lifts the worker's and the reviewers' rungs by the items' levels. Code now reads the items: each chunk's first prompt, and each prompt resuming it, asks the worker for a line opening `Chunk items:`, `bin/build_release/chunk/chunk_items.py` reads the latest such line in the worker's own text, and `plan.todo_table` scores the items. So the judge's reply is smaller, and every L and E + I that routing reads comes from `todo.md`, through one module. The judge field trials (`judge-field-trials/`) read each fact by code over the 709 archived cases. Code was wrong in each of the 39 cases where it and the judge disagreed on an escalation, and read a release ready to cut in 3 of the 31 interrupts that asked about a cut, so the judge keeps both. Workers stated an item with its L and E + I in 413 cases, but also stated items they filed, finished or only mentioned, so the worker writes the items on a line that holds only them, which code reads. Three fresh readers picked its label `Chunk items:`, 3 to 0, because it says the items are the chunk's. -An item the chunk re-scores on its branch routes on its planned levels until the branch merges; where the new L picks a higher rung, the worker cites escalation trigger 1, which the judge finds. Where the worker writes no line, loop-claude counts no item as taken in, so the route holds. Rerun `judge-field-trials/release_ready.py` when the way `chunk-preflight` detects a release review changes. +An item the chunk re-scores on its branch routes on its planned levels until the branch merges; where the new L picks a higher rung, the worker cites escalation trigger 1, which the judge finds. Where the worker writes no line, build-release counts no item as taken in, so the route holds. Rerun `judge-field-trials/release_ready.py` when the way `chunk-preflight` detects a release review changes. Valid while workers write the line when asked, and while `todo.md` on the default branch scores each item a chunk takes. @@ -712,13 +712,13 @@ Valid while the archived verdicts show what a judge should return, and until the ## routing: one ladder of (model, effort) rungs, ordered by the Artificial Analysis Intelligence Index, shipped as `bin/model_routing/routing-ladder.json`, which a project may replace with a file of that name in its config's folder; a task's L picks its worker's rung and its E + I its reviewers', by fixed steps counted from the cheapest rung of the project's model -2026-10-14, lilleman. Serves goal 1.4, and goal 1.3: one shipped ladder and one set of steps for every project, read by loop-claude and by the worker through `bin/subagent-rung`; a project runs on other rungs only through a ladder file of its own (2026-11-15 note). The judge's rung is set by `routing: on a model judge-replay covered`. `bin/model_routing/routing-ladder.json` holds the rungs and `ladder.py` beside it the steps. +2026-10-14, lilleman. Serves goal 1.4, and goal 1.3: one shipped ladder and one set of steps for every project, read by build-release and by the worker through `bin/subagent-rung`; a project runs on other rungs only through a ladder file of its own (2026-11-15 note). The judge's rung is set by `routing: on a model judge-replay covered`. `bin/model_routing/routing-ladder.json` holds the rungs and `ladder.py` beside it the steps. The rungs, least competent first: Sonnet 5.5 at high; Opus 5.5 at medium; Fable 5.2 at low and medium; Opus 5.5 at xhigh; Fable 5.2 at high and max. The 2026-11-11 note below put them so. Before it they were Sonnet 5.5 at high; Opus 5.5 at medium, high, xhigh and max; Fable 5.1 at max, after the 2026-10-29 note took Haiku 5.5 off. They first were: Haiku 5.5 at low, medium, high, xhigh and max; Sonnet 5.5 at high; Opus 5.5 at medium, high, xhigh and max; Fable 5.1 at max. The order and the cut come from the Artificial Analysis Intelligence Index (https://artificialanalysis.ai/leaderboards/models), which scores each model at each effort and gives a cost per task. A rung stays only where no cheaper rung scores as high, so a step up always buys more score (goal 1.4). The first cut, from the index read 2026-10-14, dropped Sonnet 5.5 at low, medium, xhigh and max, Opus 5.5 at low, and every Fable 5.1 rung, and every tie in the index fell among the dropped rungs. lilleman put Fable 5.1 at max back on top: the index scored it under Opus 5.5 at high, but Anthropic's model catalog names Fable the most capable model, and for the hardest tasks lilleman wants the highest quality at any price. Fable 5.2 at max tops the index outright, so that exception has ended. A project's rung is its model's cheapest rung, which for Opus 5.5 is its default effort, medium. A model off the ladder doesn't route anything: claude runs it at the effort its settings give. A task's L steps its worker from the project's rung: 1 and 2 one down, 3 one up, 4 two up. Its E + I steps its reviewers up from the project's rung: 4 or less none, 5 one up, 6 two up, 7 three up, 8 four up. A step past either end stops there. A worker errs more the more it changes and the newer that is, which L scores; review must look harder the further a defect would escape and the more it would break, which E + I scores (goals 1.1 and 1.4). Size raises L, so a large change runs its worker higher. The steps spread the values this repo's plan held when rescored on 2026-10-16, L 1 to 4 and E + I 2 to 7, so a worker on most items runs below the project's rung, and a review climbs only where a defect would escape far or break much. lilleman approved the steps on 2026-10-16 as a guess, and raised L 3 and L 4 on 2026-11-14, as below. `score-outcomes` reports how well L, E and I each order finished chunks by review rounds and πŸ”΄ findings. A change to the ladder or the steps is lilleman's. -2026-10-21, lilleman, settling the routing calls stamped 2026-10-21T20:33:29Z: L 1 steps one rung down, not two as before, so an Opus 5.5 project runs no worker on Haiku 5.5. A delegated subagent takes the same steps, so an L 1 search moves off Haiku 5.5 too: lilleman chose one set of steps for chunk workers and subagents alike, so loop-claude, `subagent-rung` and rule-hook read one table (code health). No figure yet shows whether Sonnet 5.5 searches better than Haiku 5.5, so this costs more per search for a gain nobody has measured (goal 1.4). The calls came from loop-claude's routing figures, measured at cycle 165 over 46 chunks. Chunks started on Haiku 5.5 at max took a mean 7.8 review rounds past each pass's first, against 2.8 on Sonnet 5.5 at high, and 0.2 unfinished verdicts, against 0.1. The figures also called for moving workers off Sonnet 5.5 at high, whose chunks took 0.1 unfinished verdicts against 0.0 on Opus 5.5 at medium. lilleman kept L 2 on Sonnet 5.5, since that gap rests on one or two verdicts. +2026-10-21, lilleman, settling the routing calls stamped 2026-10-21T20:33:29Z: L 1 steps one rung down, not two as before, so an Opus 5.5 project runs no worker on Haiku 5.5. A delegated subagent takes the same steps, so an L 1 search moves off Haiku 5.5 too: lilleman chose one set of steps for chunk workers and subagents alike, so build-release, `subagent-rung` and rule-hook read one table (code health). No figure yet shows whether Sonnet 5.5 searches better than Haiku 5.5, so this costs more per search for a gain nobody has measured (goal 1.4). The calls came from build-release's routing figures, measured at cycle 165 over 46 chunks. Chunks started on Haiku 5.5 at max took a mean 7.8 review rounds past each pass's first, against 2.8 on Sonnet 5.5 at high, and 0.2 unfinished verdicts, against 0.1. The figures also called for moving workers off Sonnet 5.5 at high, whose chunks took 0.1 unfinished verdicts against 0.0 on Opus 5.5 at medium. lilleman kept L 2 on Sonnet 5.5, since that gap rests on one or two verdicts. 2026-10-23, lilleman: 15 chunks had shipped under today's steps. Over them, L's rank correlation with review rounds was +0.53. They held only 3 πŸ”΄ findings, too few to test E and I. 50 chunks hold about 10 at that rate, and a re-tune on fewer chunks would fit noise. @@ -732,13 +732,13 @@ A project's rung is its model's cheapest rung, which for Opus 5.5 is its default 2026-11-14, lilleman ruled that L 3 is to step one rung up and L 4 two up, in every project and for delegated subagents. The steps take effect in 0.12.0, as lilleman chose on 2026-11-16. On an Opus 5.5 project, an L 3 worker or subagent runs on Fable 5.2 at low, and an escalation stops without lilleman's yes at Opus 5.5 at xhigh. An L 4 one runs on Fable 5.2 at medium, and stops at Fable 5.2 at high. The ruling settles the two calls that `routing-calls-raised.md` stamps 2026-11-14T13:57:34Z, raised on the routing figures measured at 2026-11-14T00:59:50Z. The figures came from 276 chunks finished since the 2026-10-29 reset. Chunks started on Opus 5.5 at medium, 79 of them, took a mean 0.8 review rounds past each pass's first, 0.3 unfinished verdicts and 0.2 later fixes. Chunks started on Fable 5.2 at low, 5 of them, took 0.4, 0.0 and 0.0. Under the old steps, only L 4 items started on Fable 5.2 at low on an Opus 5.5 project, so it did better on harder items. Two things weaken the evidence: 5 chunks is the fewest a call allows, and the Opus 5.5 figures include chunks from before Fable 5.2 joined the ladder. On the 2026-11-11 index, an L 3 task's cost rises about 1.3 times, from $2.45 to $3.10, for fewer rounds and fewer unfinished verdicts (goal 1.4). The chunks started on Sonnet 5.5 at high, 164 of the 276, don't move. -2026-11-15, lilleman asked for the ladder as a file that a project can replace, on a day when an outage left only Fable 5.2 answering: the rungs were a constant in `bin/model_routing/ladder.py`, so no project could leave Sonnet 5.5 and Opus 5.5 without a release. The shipped ladder is `bin/model_routing/routing-ladder.json`, a JSON list of rungs, least competent first. A project that keeps a `routing-ladder.json` in its config's folder, `~/.claude-projects/<key>/`, runs on that ladder whole, and the steps count on it as on the shipped one. Every project still runs the same routing rules and steps, so the workflow of goal 1.3 holds; the ladder joins what a project's config folder may supply, which that goal's list does not name yet. lilleman chose a file per project over one per machine, so a single project can differ. A ladder holds one model of each family, since the Agent tool launches a subagent or a review by its family's name. The project's file is lilleman's to write, as any change to the ladder is, and the loop never commits it. loop-claude reads the project's ladder as each cycle starts; `subagent-rung` and rule-hook's `reviewer-rung` read it each time they run, from the checkout they run in. A ladder file that holds a fault stops each of them, since work routed on the shipped ladder in its place could run on a model the project cannot reach. The routing figures, `judge-replay` and `review-replay` span every project, so they read the shipped ladder: a rung only a project's own ladder holds is left out of the figures' calls, and no replay qualifies it. lilleman shipped the change as 0.10.1, a patch cut from the tag v0.10.0, on the day of the outage: it adds a file format and an exit 1 to `subagent-rung`, which the technical principles' semantic versioning gives a minor, and lilleman asked for the patch "even if that breaks semver", so that the release in use could run again without taking the unreleased work on `main`. +2026-11-15, lilleman asked for the ladder as a file that a project can replace, on a day when an outage left only Fable 5.2 answering: the rungs were a constant in `bin/model_routing/ladder.py`, so no project could leave Sonnet 5.5 and Opus 5.5 without a release. The shipped ladder is `bin/model_routing/routing-ladder.json`, a JSON list of rungs, least competent first. A project that keeps a `routing-ladder.json` in its config's folder, `~/.claude-projects/<key>/`, runs on that ladder whole, and the steps count on it as on the shipped one. Every project still runs the same routing rules and steps, so the workflow of goal 1.3 holds; the ladder joins what a project's config folder may supply, which that goal's list does not name yet. lilleman chose a file per project over one per machine, so a single project can differ. A ladder holds one model of each family, since the Agent tool launches a subagent or a review by its family's name. The project's file is lilleman's to write, as any change to the ladder is, and the loop never commits it. build-release reads the project's ladder as each cycle starts; `subagent-rung` and rule-hook's `reviewer-rung` read it each time they run, from the checkout they run in. A ladder file that holds a fault stops each of them, since work routed on the shipped ladder in its place could run on a model the project cannot reach. The routing figures, `judge-replay` and `review-replay` span every project, so they read the shipped ladder: a rung only a project's own ladder holds is left out of the figures' calls, and no replay qualifies it. lilleman shipped the change as 0.10.1, a patch cut from the tag v0.10.0, on the day of the outage: it adds a file format and an exit 1 to `subagent-rung`, which the technical principles' semantic versioning gives a minor, and lilleman asked for the patch "even if that breaks semver", so that the release in use could run again without taking the unreleased work on `main`. -2026-11-18, lilleman kept the ladder and the steps, settling the call raised on the routing figures measured at 2026-11-18T15:04:48Z: chunks routed onto Sonnet 5.5 at high took more review rounds past each pass's first than chunks routed onto Opus 5.5 at medium. The figures came from 19 chunks finished since the 2026-11-17 reset. The 13 chunks started on Sonnet 5.5 at high took a mean 0.5 rounds and 0.0 unfinished verdicts; the 6 started on Opus 5.5 at medium took 0.5 and 0.2. Neither rung had later fixes, among the 11 and the 4 chunks whose later fixes are known. Both means show 0.5, so the gap is under 0.1 rounds. Sonnet 5.5 did better on unfinished verdicts, and it is the cheaper rung (goal 1.4). loop-claude lists the call in `routing-calls-raised.md` only once the session that put it to lilleman ends, stamped with the time the figures were measured, so this note cites that time. +2026-11-18, lilleman kept the ladder and the steps, settling the call raised on the routing figures measured at 2026-11-18T15:04:48Z: chunks routed onto Sonnet 5.5 at high took more review rounds past each pass's first than chunks routed onto Opus 5.5 at medium. The figures came from 19 chunks finished since the 2026-11-17 reset. The 13 chunks started on Sonnet 5.5 at high took a mean 0.5 rounds and 0.0 unfinished verdicts; the 6 started on Opus 5.5 at medium took 0.5 and 0.2. Neither rung had later fixes, among the 11 and the 4 chunks whose later fixes are known. Both means show 0.5, so the gap is under 0.1 rounds. Sonnet 5.5 did better on unfinished verdicts, and it is the cheaper rung (goal 1.4). build-release lists the call in `routing-calls-raised.md` only once the session that put it to lilleman ends, stamped with the time the figures were measured, so this note cites that time. 2026-11-23, lilleman kept the ladder and the steps, settling two calls raised on the routing figures measured at 2026-11-23T15:40:14Z: chunks routed onto Opus 5.5 at medium took more review rounds past each pass's first, and more unfinished verdicts, than chunks routed onto Fable 5.2 at low. The figures came from 124 chunks finished since the 2026-11-17 reset. The 24 chunks started on Opus 5.5 at medium took a mean 0.7 rounds, 0.4 unfinished verdicts and 0.5 later fixes (18 known); the 11 started on Fable 5.2 at low took 0.3, 0.0 and 0.0 (10 known). Fable 5.2 at low has 6 chunks above the 5 a call needs, and Opus 5.5 at medium costs less per task, $2.45 against $3.10 on the 2026-11-11 index (goal 1.4). The later fixes lean towards Fable 5.2 at low, and the call doesn't count them. lilleman had kept the steps against such gaps on 2026-10-31 and 2026-11-18. -2026-11-25, lilleman kept the ladder, the steps and the delegation rule, settling the same two calls as on 2026-11-23, raised again on the routing figures measured at 2026-11-25T21:54:59Z. The figures came from 141 chunks finished since the 2026-11-17 reset. The 24 chunks started on Opus 5.5 at medium took a mean 0.7 review rounds past each pass's first, 0.4 unfinished verdicts and 0.5 later fixes (18 known); the 16 started on Fable 5.2 at low took 0.2, 0.2 and 0.0 (14 known). The figures compare the old steps with the new ones. By a count of the archive's files by modification time, every chunk started on Opus 5.5 at medium that names an item is L 3 and began by 2026-11-19T09:43Z, and v0.12.0, which moved L 3 to Fable 5.2 at low, was installed at 13:19:03Z that day. On an Opus 5.5 project no L now starts a worker on Opus 5.5 at medium; only a chunk without an item does. lilleman had the figures restart from that install, with a reset stamped 2026-11-19T13:19:03Z. loop-claude stamps these calls when the session that put them to lilleman ends, so their stamp is later than the time this note cites. +2026-11-25, lilleman kept the ladder, the steps and the delegation rule, settling the same two calls as on 2026-11-23, raised again on the routing figures measured at 2026-11-25T21:54:59Z. The figures came from 141 chunks finished since the 2026-11-17 reset. The 24 chunks started on Opus 5.5 at medium took a mean 0.7 review rounds past each pass's first, 0.4 unfinished verdicts and 0.5 later fixes (18 known); the 16 started on Fable 5.2 at low took 0.2, 0.2 and 0.0 (14 known). The figures compare the old steps with the new ones. By a count of the archive's files by modification time, every chunk started on Opus 5.5 at medium that names an item is L 3 and began by 2026-11-19T09:43Z, and v0.12.0, which moved L 3 to Fable 5.2 at low, was installed at 13:19:03Z that day. On an Opus 5.5 project no L now starts a worker on Opus 5.5 at medium; only a chunk without an item does. lilleman had the figures restart from that install, with a reset stamped 2026-11-19T13:19:03Z. build-release stamps these calls when the session that put them to lilleman ends, so their stamp is later than the time this note cites. Valid while the index ranks these models, and while no newer model joins the catalog. @@ -754,7 +754,7 @@ Valid while the index ranks these models, and while no newer model joins the cat - On the 1,104 verdicts, held-out folds: 103 decided, none missed. Latest fifth: 29 decided, all as finished, and 1 interrupt missed. That fails the bar, and shuffles 5 to 9 and 10 to 14 failed it alike. - On the 1,116 verdicts, held-out folds: 95 decided (84 finished, 11 interrupt), none missed. Latest fifth: 20 decided, all as finished, none missed. That meets the bar for finished. -The classifier decides about 1 in 12 verdicts, and about 1 in 100 of what it decides were an interrupt on the 1,104. A latest fifth that starts a few verdicts later no longer holds the one it missed, so the bar flips with the archive's size and doesn't separate a classifier that never misses from one that rarely does. On 2026-11-18 lilleman ruled, at loop-claude's terminal, that a miss rate of about 1 in 100 decided is close enough to none. So the classifier may decide finished and skip the judge's call; the plan holds that change as an item. The judge's model keeps every verdict the classifier leaves, the escalation it quotes and whether a release is ready to cut, since the replay didn't test the classifier on those. +The classifier decides about 1 in 12 verdicts, and about 1 in 100 of what it decides were an interrupt on the 1,104. A latest fifth that starts a few verdicts later no longer holds the one it missed, so the bar flips with the archive's size and doesn't separate a classifier that never misses from one that rarely does. On 2026-11-18 lilleman ruled, at build-release's terminal, that a miss rate of about 1 in 100 decided is close enough to none. So the classifier may decide finished and skip the judge's call; the plan holds that change as an item. The judge's model keeps every verdict the classifier leaves, the escalation it quotes and whether a release is ready to cut, since the replay didn't test the classifier on those. Valid while the archived verdicts hold interrupts that read like a finished chunk. Replay with `judge-replay <model> --offline` when the archive has doubled, or when a decider reads more than the final message. @@ -762,13 +762,13 @@ Valid while the archived verdicts hold interrupts that read like a finished chun 2026-10-14, lilleman. Serves goal 1.4. -Because a model switch inside a session discards its prompt cache, the worker changes rung only as the chunk starts, after every second unfinished verdict, when the worker names an item on its `Chunk items:` line whose L picks a higher rung (`routing: loop-claude reads the items a chunk takes`), or when the judge finds the escalation trigger a worker cites in asking for a higher rung (`routing: a worker whose run ends asking for a higher rung`). loop-claude routes on the first row of the next release in `todo.md`'s table that does not wait: an item waits while it is marked `question` or a blocker of it is still in the table. Since `todo.md` holds no order but its table's (`todo.md: one table`), that row is the item the worker takes. An item the worker takes in beyond that row lifts the worker's rung once the cycle in which the worker names it ends. +Because a model switch inside a session discards its prompt cache, the worker changes rung only as the chunk starts, after every second unfinished verdict, when the worker names an item on its `Chunk items:` line whose L picks a higher rung (`routing: build-release reads the items a chunk takes`), or when the judge finds the escalation trigger a worker cites in asking for a higher rung (`routing: a worker whose run ends asking for a higher rung`). build-release routes on the first row of the next release in `todo.md`'s table that does not wait: an item waits while it is marked `question` or a blocker of it is still in the table. Since `todo.md` holds no order but its table's (`todo.md: one table`), that row is the item the worker takes. An item the worker takes in beyond that row lifts the worker's rung once the cycle in which the worker names it ends. Valid while a model switch inside a session discards its prompt cache. ## rule-hook: a PreToolUse hook enforces each rule a program can check, a `# rule-override <rule>: <reason>` marker overrides any rule but those `rule-hook --help` marks as taking none, and larv-review's overrides pass rules on each override before merge -2026-10-12, lilleman. Serves goals 1.2 and 1.3. Anthropic's best-practices page calls `CLAUDE.md` advisory and hooks deterministic, so a rule that must hold every time moves into `bin/rule-hook`, and `CLAUDE.md` keeps it only where the hook cannot check it. A Claude Code hook ties the check to one vendor ("Prefer the vendor-neutral option", `principles/technical-principles.md`), which is the target itself here: this repo configures Claude Code. What the tie buys: the hook blocks before a write lands, Edit and Write calls included, in every project with no per-repo install; a git `commit-msg` hook sees only commits, and CI sees them only after the push. The hook checks each write, so the agent fixes the line it just wrote; checking the staged diff at commit time would also cover files a Bash command writes, at the cost of later feedback. The marker's spelling was picked by a panel of three fresh readers, two to one. Each override is logged in the checkout's git directory, which is never pushed (goal 5). The plan had loop-claude's judge to rule on overrides inside a loop; lilleman approved larv-review's overrides pass in every run, because it rules before merge and an outrageous override still reaches the human through its ask. 2026-10-16, lilleman, answering plan item 166: no marker overrides `reviewer-rung`. 2026-11-04, lilleman: the title points at `rule-hook --help`, which lists every rule no marker overrides from the code, so the title can't drift from it; the comment above each in `bin/rule_hook/rules.py` says why. Valid while a PreToolUse hook that exits 2 blocks the call and hands its stderr to the model, and while an agent commits through Claude Code's Bash tool. 2026-11-11, lilleman: the hook also checks, at a `git commit`, each file the commit would commit against the rules that name a file, since a file a Bash command writes reaches no write check; the feedback comes at the commit, not at the write. +2026-10-12, lilleman. Serves goals 1.2 and 1.3. Anthropic's best-practices page calls `CLAUDE.md` advisory and hooks deterministic, so a rule that must hold every time moves into `bin/rule-hook`, and `CLAUDE.md` keeps it only where the hook cannot check it. A Claude Code hook ties the check to one vendor ("Prefer the vendor-neutral option", `principles/technical-principles.md`), which is the target itself here: this repo configures Claude Code. What the tie buys: the hook blocks before a write lands, Edit and Write calls included, in every project with no per-repo install; a git `commit-msg` hook sees only commits, and CI sees them only after the push. The hook checks each write, so the agent fixes the line it just wrote; checking the staged diff at commit time would also cover files a Bash command writes, at the cost of later feedback. The marker's spelling was picked by a panel of three fresh readers, two to one. Each override is logged in the checkout's git directory, which is never pushed (goal 5). The plan had build-release's judge to rule on overrides inside a loop; lilleman approved larv-review's overrides pass in every run, because it rules before merge and an outrageous override still reaches the human through its ask. 2026-10-16, lilleman, answering plan item 166: no marker overrides `reviewer-rung`. 2026-11-04, lilleman: the title points at `rule-hook --help`, which lists every rule no marker overrides from the code, so the title can't drift from it; the comment above each in `bin/rule_hook/rules.py` says why. Valid while a PreToolUse hook that exits 2 blocks the call and hands its stderr to the model, and while an agent commits through Claude Code's Bash tool. 2026-11-11, lilleman: the hook also checks, at a `git commit`, each file the commit would commit against the rules that name a file, since a file a Bash command writes reaches no write check; the feedback comes at the commit, not at the write. ## agents/: a reviewer starts without `CLAUDE.md` only where a replay of its pass missed no more findings than the most an unchanged replay missed @@ -836,7 +836,7 @@ Valid while Claude Code loads `~/.claude/rules/*.md` in every project, a path-sc ## settings.json: each machine owns its model, and git's clean filter `bin/settings_filter.py` keeps it, and Claude Code's key order, out of every commit -2026-10-21, lilleman. Serves goal 2: Claude Code rewrites `"model"` in `settings.json` on every `/model` and plugin install, so a tracked model let one machine's pick override every other's. lilleman chose a model per machine over one synced in `env.ANTHROPIC_MODEL`, which would override a `/model` pick from the next session on. A model per machine is simpler, and loop-claude picks each project's model in `~/.claude/loop-claude-models.json` anyway. The filter also sorts the keys, since each write puts them back in Claude Code's order. The cost: a move or pull that changes `settings.json` drops the machine's model. The effort keys, `effortLevel` and `modelSettings`, stay synced: the routing decision on a chunk's worker rung relies on the effort `settings.json` gives every interactive session. Valid while Claude Code writes the model it picks into `settings.json`. +2026-10-21, lilleman. Serves goal 2: Claude Code rewrites `"model"` in `settings.json` on every `/model` and plugin install, so a tracked model let one machine's pick override every other's. lilleman chose a model per machine over one synced in `env.ANTHROPIC_MODEL`, which would override a `/model` pick from the next session on. A model per machine is simpler, and build-release picks each project's model in `~/.claude/loop-claude-models.json` anyway. The filter also sorts the keys, since each write puts them back in Claude Code's order. The cost: a move or pull that changes `settings.json` drops the machine's model. The effort keys, `effortLevel` and `modelSettings`, stay synced: the routing decision on a chunk's worker rung relies on the effort `settings.json` gives every interactive session. Valid while Claude Code writes the model it picks into `settings.json`. ## task-bench: a bench takes 5 bugs and 5 runs per side, after a 2 Γ— 2 pilot on a new setup, and at no affordable count does a chunk-sized change rise above the noise @@ -927,12 +927,12 @@ Valid while the worker writes the tests that larv-review's reviewers hold to the - **The spelling.** A `Touches:` line, then one bullet per file: the path in backticks, then its parts, each a name in backticks or `lines <first>-<last>`, with `(small)` after a part the item changes only a little; a path or a name that holds a backtick takes a longer run of backticks with a space inside each end, as a Markdown code span does. A path alone is the whole file. Three readers seated as the README's audience picked the bulleted list over one line and over a table, since backticks hold a heading's commas, colons and parentheses. Two of the three put `(small)` after the part and outside the backticks, and two left line ranges unquoted. Each picked a different config key: `touch-predictions` was one reader's first choice and the second choice of the other two. - **A part's boundaries.** Python's `ast` module names the innermost function or class, a top-level assignment by the name it sets, and `(module)` for the rest. A Markdown file's parts are its headings outside fenced code. Any other file, and Python that doesn't parse, falls back to line ranges. A table row is no part of its own: the item named one, but the tables chunks collide on are the plan's and the changelog's, which don't count. - **What doesn't count.** The plan and every record the config names, the changelog among them, since every chunk writes them: `chunk-pr merge --finish` writes the plan and the changelog at merge time, and the other records are appended to. `touch-predictions record` leaves them out of what a chunk touched, and the rule keeps them out of predictions. -- **The pick.** `chunk-preflight` takes the items of the next release that don't wait, in the plan's order, each where it overlaps neither the next item nor an item taken before it. The call asked for the set that keeps the most chunks running. The plan's order comes first all the same: the largest set could start a low-ranked item in place of one ranked above it, and with more ready items than the parallel limit, either set fills the limit. loop-claude starts as many of the picked items as `parallel-chunks` allows. +- **The pick.** `chunk-preflight` takes the items of the next release that don't wait, in the plan's order, each where it overlaps neither the next item nor an item taken before it. The call asked for the set that keeps the most chunks running. The plan's order comes first all the same: the largest set could start a low-ranked item in place of one ranked above it, and with more ready items than the parallel limit, either set fills the limit. build-release starts as many of the picked items as `parallel-chunks` allows. - **An overlap that is taken.** Two items may share a part where either marks it `(small)`. The call takes an overlap only for a small change to the same part, and a few lines re-apply onto whatever the other chunk did to it. - **Which items share a chunk** stays the worker's choice, by the review passes they fire, so the pick names items, and an item the next chunk takes starts no chunk of its own. - **The record is optional.** No path setting has a default, and a mandatory one would stop every project until its owner edits the config (goal 1.6). A project that leaves `touch-predictions` out is still picked for, and keeps no record. The worker runs `touch-predictions record` before it removes the chunk's items (`skills/larv-review/SKILL.md` Β§5), since the prediction leaves the plan with the item, and a plan in Jira keeps no history to read it back from. -Valid while loop-claude starts a project's chunks side by side by this pick (`bin/loop_claude/loop/chunk_windows.py` `may_start`), which also checks each new chunk against the running chunks' items. Once the record holds enough chunks to show how often the predictions miss, an item, not filed yet, revisits the pick's order and the `(small)` rule. +Valid while build-release starts a project's chunks side by side by this pick (`bin/build_release/loop/chunk_windows.py` `may_start`), which also checks each new chunk against the running chunks' items. Once the record holds enough chunks to show how often the predictions miss, an item, not filed yet, revisits the pick's order and the `(small)` rule. ## todo.md: one table of items, scored by the formula it states, held to its bar and ranked by `bin/rank_todo.py`, which ranks each blocker above the items it blocks; each achieve goal weighs by its position, code health first and four times as heavy while the comprehension panel's overall is under the project's readability floor or unmeasured, then the goals file's goals, and a maintain goal weighs 0.5 per point of the confidence an item's test, gate leg or probe adds to it; the table's order is the plan's only order @@ -952,7 +952,7 @@ Valid while loop-claude starts a project's chunks side by side by this pick (`bi 2026-10-18, lilleman: `rank_todo.py` derives the goal weights from README.md. Each achieve goal, in reading order, weighs 0.97 times the one before it, and the weights sum to 1; `GOAL_STEP` sets the 0.97. lilleman wanted goals to weigh almost the same, since under the sum-reciprocal weight the goal ranked k of n achieve goals weighed (1/k) / (1 + 1/2 + … + 1/n), so the last of twelve goals weighed a twelfth of the first. The step departs from `docs/scoring-and-goals-research.md`, where sum-reciprocal weights came closest to the weights people gave. -2026-11-08, item 158, replacing lilleman's F of 8 from PR #283. Serves goal 1.4: this repo's plan sets F, the cost every chunk pays whatever its size, to 32, which is `2**5`, one S 5 change. F is the fixed cost divided by the cost of one unit of `2**S`. The fit is least squares over the 10 chunks in this repo's loop-claude archive that shipped an item, counting only those `score-outcomes` finds with an S. A chunk's cost is the new input tokens (input plus cache creation) and the output tokens of its worker and subagents, leaving out cache reads and judge runs. It comes to about 399k tokens fixed plus 10.9k per unit of `2**S`, so F is about 36 (RΒ² 0.24); output tokens alone give 24 (RΒ² 0.35). 32 sits between them. The 10 chunks' (S, thousand tokens) are (1, 405), (2, 446), (2, 442), (2, 368), (2, 294), (2, 130), (3, 1027), (4, 733), (5, 754) and (5, 599). The fit holds loosely: it covers S 1 to 5 and no larger chunk, 10 points scatter widely, and a chunk that shipped several items counts whole against the S of the item its first route names. Lines changed explain little of the tokens (RΒ² 0.07), so the fit uses S, not lines. Hours do not fit: the worker's active time, each gap capped at 10 minutes, has a median of 0.29 hours whatever S (RΒ² 0.01), so hours don't change F. The formula charges each item the whole F, though a chunk that bundles tiny items pays it once, so such an item ranks lower than its real cost warrants. `rank_todo.py --help` keeps 8 in its example, which shows a valid file's shape, not this plan's F. +2026-11-08, item 158, replacing lilleman's F of 8 from PR #283. Serves goal 1.4: this repo's plan sets F, the cost every chunk pays whatever its size, to 32, which is `2**5`, one S 5 change. F is the fixed cost divided by the cost of one unit of `2**S`. The fit is least squares over the 10 chunks in this repo's build-release archive that shipped an item, counting only those `score-outcomes` finds with an S. A chunk's cost is the new input tokens (input plus cache creation) and the output tokens of its worker and subagents, leaving out cache reads and judge runs. It comes to about 399k tokens fixed plus 10.9k per unit of `2**S`, so F is about 36 (RΒ² 0.24); output tokens alone give 24 (RΒ² 0.35). 32 sits between them. The 10 chunks' (S, thousand tokens) are (1, 405), (2, 446), (2, 442), (2, 368), (2, 294), (2, 130), (3, 1027), (4, 733), (5, 754) and (5, 599). The fit holds loosely: it covers S 1 to 5 and no larger chunk, 10 points scatter widely, and a chunk that shipped several items counts whole against the S of the item its first route names. Lines changed explain little of the tokens (RΒ² 0.07), so the fit uses S, not lines. Hours do not fit: the worker's active time, each gap capped at 10 minutes, has a median of 0.29 hours whatever S (RΒ² 0.01), so hours don't change F. The formula charges each item the whole F, though a chunk that bundles tiny items pays it once, so such an item ranks lower than its real cost warrants. `rank_todo.py --help` keeps 8 in its example, which shows a valid file's shape, not this plan's F. 2026-10-16, PR #283: a panel of three readers seated as lilleman picked the spelling. Two put a Moves column holding `1.1 by 8, 1.2 by 5` first, and one put `1.1: 8` first. Two chose `2**S`, since a Python reader takes `^` for XOR. All three chose one decimal of `100 * V / 2**S` over three significant digits or a log. The columns L, E and I sit right before R, which `rank_todo.py` writes from them: of three readers seated as lilleman, two ranked that order first, since a reader meets each level before the R it builds and R sits beside S, and the third ranked it second, after an order with S before the levels. @@ -962,9 +962,9 @@ Valid while loop-claude starts a project's chunks side by side by this pick (`bi 2026-10-18, lilleman. Serves goal 1.1: every project shares one achieve goal, code health, which `CLAUDE.md` β†’ "Shared goal" states once and which replaces each project's own readability goal. It ranks first among a project's achieve goals, since lilleman rates it very important while the comprehension panel's overall is under 7.0. While that overall is under 7.0, or no scoring run has measured the project, it weighs four times its weight at 7.0 or above, as `UNDER_FLOOR` sets. The overall is the mean of the overall means of every scoring run on the newest scored commit in `docs/comprehension-history.md`, as `newest_commit_runs` finds them. Two runs of one head measure it twice, and the newest alone would let their noise flip the weight: 7.13 and 6.88 on one head of another project would have. The review of PR #324 raised this choice. Weighing code health four times as much leaves the other achieve goals' weights as they are. So crossing 7.0 changes only the scores of the items that move code health, and of the defects, since a broken maintain goal weighs as the heaviest achieve goal. `larv-review record-scoring` re-ranks `todo.md` after it appends a run. A project that opts out of the comprehension check voids the goal, as `review: a project decision may opt every chunk out …` records. A README voids the goal with `**Void:** code health, since <reason>.` under `## Goals`, and an item's Moves cell names it as in `code health by 6`. A panel of three readers seated as lilleman picked both 3-0: `code health` over `code`, `health`, `C` and `0`, and the bold `Void:` line over a sentence under `## Goals` or a line under `## Audience`. `score-outcomes` counts the counter-signal's misread findings per chunk, as `review: a reviewer under …` records. Valid while the comprehension panel's overall is how a project measures how hard it is to read. -2026-10-15, lilleman. Serves goal 1.4: loop-claude routes a chunk's first cycle on the item the chunk takes (`routing: a chunk's worker runs on the rung its item's L picks`). An item lists the items that must be done before it starts in a Blocked by column, and `rank_todo.py` ranks each blocker above every item it blocks. The table's order is `todo.md`'s only order: `rank_todo.py` fails on text beside the table under `## Items`, since a prose order there, "Release 0.3.0 takes items 125, 114 and 124 first", contradicted the table and loop-claude could not read it. A decision that wants an order sets the scores instead. An item waits while it is marked `question` or a blocker of it is still in the table, whatever the rows' order, so a release's first row that does not wait is the item a chunk takes. A blocker the table no longer holds was finished or deleted, and is dropped, so the cell shows what still blocks. A panel of three readers seated as lilleman picked the spelling: two ranked "Blocked by" first, as the cell lists only what still blocks, and all three chose bare IDs such as `12, 14` in a column right after Release, read before the tagline and kept apart from the scores. `rank_todo.py` adds the column to a table without it. The tools read cells by column name, so a later column leaves a reader on an older release working; `rank_todo.py`, which writes every column, fails on one it does not know rather than drop it. +2026-10-15, lilleman. Serves goal 1.4: build-release routes a chunk's first cycle on the item the chunk takes (`routing: a chunk's worker runs on the rung its item's L picks`). An item lists the items that must be done before it starts in a Blocked by column, and `rank_todo.py` ranks each blocker above every item it blocks. The table's order is `todo.md`'s only order: `rank_todo.py` fails on text beside the table under `## Items`, since a prose order there, "Release 0.3.0 takes items 125, 114 and 124 first", contradicted the table and build-release could not read it. A decision that wants an order sets the scores instead. An item waits while it is marked `question` or a blocker of it is still in the table, whatever the rows' order, so a release's first row that does not wait is the item a chunk takes. A blocker the table no longer holds was finished or deleted, and is dropped, so the cell shows what still blocks. A panel of three readers seated as lilleman picked the spelling: two ranked "Blocked by" first, as the cell lists only what still blocks, and all three chose bare IDs such as `12, 14` in a column right after Release, read before the tagline and kept apart from the scores. `rank_todo.py` adds the column to a table without it. The tools read cells by column name, so a later column leaves a reader on an older release working; `rank_todo.py`, which writes every column, fails on one it does not know rather than drop it. -2026-10-18, PR #312. Serves goals 1.5 and 1.1: adf-codec renamed its next release, 0.2.1, to 0.3.0, and `chunk-preflight` then called 0.2.1 finished and stopped the loop on every cycle. A change that moves a release's last items elsewhere reads the same whether it renamed the release or deferred its leftovers, so the plan says which: a `## Renamed` section holds one line `- 0.2.1 renamed to 0.3.0` per rename, which `bin/plan/todo_table.py`'s `renames` reads. `chunk-preflight`, `loop-claude` and larv-review's scoring-run trigger skip a marked release; they read only the first version. A release whose items moved unmarked reads as finished: the loop stops, says so and names the fix, and the trigger calls a scoring run once work has landed. So a forgotten mark costs one interrupt and never lets a release end unmeasured. `rank_todo.py` fails on a line of another shape and on an item filed under a marked release, and a newest plan whose marks do not parse leaves the next release unknown. A line goes once a tag at or past its release is cut. Only a rename is marked, since an unmarked move is the deferral. A panel of three readers seated as lilleman picked the spelling 3-0 over `- 0.2.1 β†’ 0.3.0` under `## Releases` and a `Renamed 0.2.1 = 0.3.0` line under `## Scoring`: plain words need no special character to type. Valid while a rename is the only move of a release's items that the tools must tell from finishing it. +2026-10-18, PR #312. Serves goals 1.5 and 1.1: adf-codec renamed its next release, 0.2.1, to 0.3.0, and `chunk-preflight` then called 0.2.1 finished and stopped the loop on every cycle. A change that moves a release's last items elsewhere reads the same whether it renamed the release or deferred its leftovers, so the plan says which: a `## Renamed` section holds one line `- 0.2.1 renamed to 0.3.0` per rename, which `bin/plan/todo_table.py`'s `renames` reads. `chunk-preflight`, `build-release` and larv-review's scoring-run trigger skip a marked release; they read only the first version. A release whose items moved unmarked reads as finished: the loop stops, says so and names the fix, and the trigger calls a scoring run once work has landed. So a forgotten mark costs one interrupt and never lets a release end unmeasured. `rank_todo.py` fails on a line of another shape and on an item filed under a marked release, and a newest plan whose marks do not parse leaves the next release unknown. A line goes once a tag at or past its release is cut. Only a rename is marked, since an unmarked move is the deferral. A panel of three readers seated as lilleman picked the spelling 3-0 over `- 0.2.1 β†’ 0.3.0` under `## Releases` and a `Renamed 0.2.1 = 0.3.0` line under `## Scoring`: plain words need no special character to type. Valid while a rename is the only move of a release's items that the tools must tell from finishing it. 2026-11-09, lilleman. Serves goal 1.1: a test, gate leg or probe that guards a maintain goal proves the output holds it, and an item that adds one scored V 0 and ranked last. adf-codec's item 170 bundles the package with four bundlers to back its goal 8, runs on any JavaScript engine, and scored 0.0 beside items that move an achieve goal by 2. Such an item now names the maintain goal in Moves, by how much more confident the project becomes that the goal holds, 1 to 10, judged against the confidence it already has; `rules/todo-items.md` holds the scale. The goal weighs 0.5 per point of that move, `MAINTAIN_WEIGHT` in `bin/plan/ranking.py`. A defect that restores a broken maintain goal weighs it as the heaviest achieve goal, or 0.5 where that is lighter, since a broken goal outranks any achieve goal and any confidence gain; a maintain goal still vetoes an item that breaks it. The 0.5 comes from 150 distinct item and Moves pairs in 40 random `todo.md` commits from 2026-09-24 to 2026-11-09. The V their scores imply has quartiles 1.4, 2.6 and 4.5, and the median item earns 0.49 per point it moves a goal. At 0.5, a move of 10 is worth 5.0, about the third quartile; a move of 5 is worth 2.5, the median; a move of 1 is worth 0.5, under the tenth percentile, so only a cheap item ships. Valid while the achieve goals' weights and the formula's F keep the typical item's V near that distribution; a change to either revisits the 0.5. 2026-11-10, lilleman: the 0.5 does not change with the number of achieve goals. fejkdata has 11 achieve goals, code health included, and each weighs at most 0.105 per point, or 0.42 for code health while its comprehension overall is under 7.0, so a maintain goal's 0.5 outweighs each of them. Revisit the 0.5 when that becomes a problem, such as maintain items ranking above achieve items the human would take first. @@ -989,9 +989,9 @@ Four choices the item left open: ## worker: a chunk's worker writes the simplest change that solves its item, test first wherever a test can check the change, and reads a technical principle only where the item, a finding or its own record names it; larv-review's reviewers hold the change to the principles and to the project's review standards -2026-10-13, lilleman through todo item 104, implemented by claude. Serves goals 1.4 and 1.5. Like red, green, refactor: the worker makes the item work, and the review passes raise it to the bar. A loop-claude worker loaded `CLAUDE.md` and every file under `rules/`, 4,247 words, and `CLAUDE.md` told it to read `technical-principles.md` too, 2,426 words more. The reviewers read the principles anyway, and a finding against one names it. +2026-10-13, lilleman through todo item 104, implemented by claude. Serves goals 1.4 and 1.5. Like red, green, refactor: the worker makes the item work, and the review passes raise it to the bar. A build-release worker loaded `CLAUDE.md` and every file under `rules/`, 4,247 words, and `CLAUDE.md` told it to read `technical-principles.md` too, 2,426 words more. The reviewers read the principles anyway, and a finding against one names it. -The worker keeps what it needs to write its own work. Each project's decision titles stay in its `AGENTS.md`, since a worker that misses a decision builds the wrong behaviour. 2026-11-11, lilleman: a project principle in `AGENTS.md` now stands in for the titles of the decisions it covers. A core of "Prose" stays in `CLAUDE.md`, since no reviewer reads the worker's chat. lilleman chose both on 2026-10-13. The rules for writing Goals and Audience, `todo.md` items and decisions stay in `rules/`, since writing those is the worker's job. `bin/rule-hook` stays: it blocks what a program can check, at no context cost. "Quality", the rules for comments and READMEs, and the examples behind "Prose" moved to `skills/larv-review/standards/`, which no path loads. loop-claude's judge and the prose reviewer read them, and the stability reviewer reads "Quality". They sit beside larv-review, whose passes apply them; `principles/` stays where it is, since the principles auditor reads it per file. +The worker keeps what it needs to write its own work. Each project's decision titles stay in its `AGENTS.md`, since a worker that misses a decision builds the wrong behaviour. 2026-11-11, lilleman: a project principle in `AGENTS.md` now stands in for the titles of the decisions it covers. A core of "Prose" stays in `CLAUDE.md`, since no reviewer reads the worker's chat. lilleman chose both on 2026-10-13. The rules for writing Goals and Audience, `todo.md` items and decisions stay in `rules/`, since writing those is the worker's job. `bin/rule-hook` stays: it blocks what a program can check, at no context cost. "Quality", the rules for comments and READMEs, and the examples behind "Prose" moved to `skills/larv-review/standards/`, which no path loads. build-release's judge and the prose reviewer read them, and the stability reviewer reads "Quality". They sit beside larv-review, whose passes apply them; `principles/` stays where it is, since the principles auditor reads it per file. A finding against a principle names it, so the worker reads only that one when it fixes or declines the finding. The worker still writes a failing test first wherever a test can check the change, since no reviewer can make a test come first. On 2026-10-13 lilleman widened it from code changes to anything there is to test. A chunk that changes no code, config or test, such as one that only plans, meets no principles review; the chunk that implements its items does. The prose reviewer checks that a doc sorts a list whose order carries no meaning. diff --git a/docs/reading-cost.md b/docs/reading-cost.md index 5433ee0b..178487e8 100644 --- a/docs/reading-cost.md +++ b/docs/reading-cost.md @@ -3970,3 +3970,49 @@ Read most (opens and searches): - `bin/deploy_release/trace.py` 1 - `bin/do_epic/main.py` 1 - `bin/loop_state/paths.py` 1 + +## Reading cost, chunk da77aae96a78, finished 2026-12-03T12:34:13Z + +70235 new input tokens before the first commit. + +Read most (opens and searches): + +- `bin/task_bench/test_task_bench.py` 7 +- `bin/task_bench/main.py` 3 +- `bin/task_bench/tasks.py` 2 +- `README.md` 1 +- `ci.sh` 1 + +## Reading cost, chunk 0dc28be8887c, finished 2026-12-03T13:53:04Z + +105556 new input tokens before the first commit. + +Read most (opens and searches): + +- `bin/do_epic/main.py` 11 +- `bin/do_epic/test_main.py` 11 +- `README.md` 9 +- `bin/do_epic/test_gates.py` 4 +- `docs/decisions.md` 4 +- `bin/chunk_pr/main.py` 2 +- `bin/do_epic/parking.py` 2 +- `bin/forge/commands.py` 2 +- `bin/do_epic/gates.py` 1 +- `bin/do_epic/parked.py` 1 + +## Reading cost, chunk 0b690e8e55db, finished 2026-12-03T14:19:23Z + +109715 new input tokens before the first commit. + +Read most (opens and searches): + +- `README.md` 6 +- `bin/loop_effects/test_effects.py` 6 +- `bin/loop_effects/effects.py` 5 +- `settings.json` 5 +- `bin/agent_cycle/hand_over.py` 3 +- `bin/chunk_driver/project/records.py` 3 +- `bin/rule_hook/rules.py` 3 +- `bin/agent_cycle/run.py` 2 +- `bin/loop_claude/loop/test_usage.py` 2 +- `bin/model_routing/worker_rungs.py` 2 diff --git a/judge-field-trials/README.md b/judge-field-trials/README.md index 5251912d..4350fdae 100644 --- a/judge-field-trials/README.md +++ b/judge-field-trials/README.md @@ -1,13 +1,13 @@ # Judge field trials -These trials ask one question: which of the facts loop-claude's judge reports could code read instead? +These trials ask one question: which of the facts build-release's judge reports could code read instead? The judge is the headless claude that rules on each worker run; its reply named the items the chunk took, whether a release was ready to cut, and any escalation the worker asked for. -They ran on 2026-11-11, over the 709 cases archived by then. `docs/decisions.md` β†’ `routing: loop-claude reads the items a chunk takes` records what was decided from them. +They ran on 2026-11-11, over the 709 cases archived by then. `docs/decisions.md` β†’ `routing: build-release reads the items a chunk takes` records what was decided from them. ## Terms - **Case:** an outcomes file in `~/.claude/loop-claude-transcripts/`, its first verdict, and the transcript the judge read for it. -- **Final message:** the last text the worker wrote after the last prompt loop-claude or the human gave it. +- **Final message:** the last text the worker wrote after the last prompt build-release or the human gave it. ## Results @@ -15,7 +15,7 @@ They ran on 2026-11-11, over the 709 cases archived by then. `docs/decisions.md` |---|---|---| | Escalation | "higher rung", "rung up" or "one rung above" in the final message | Code is wrong in each of the 39 disagreements: 37 where only code finds a request, 2 where only the judge does. Code matched a worker asking for the human's yes at the top rung and a review report quoting "rerun one rung up", and missed requests made before the final message. The judge keeps the field. | | Release ready to cut | The plan as the default branch and tags stood at the verdict, read by `release_plan.release_standing` | Of 240 interrupts, 31 ask about a cut, and code reads ReadyToCut for 3. Two misses are code's: in two projects a release review had merged without the `Release review of <release>` commit that code looks for. The rest asked under older rules or after the cut. The judge keeps the field, and a `todo.md` item files the fix. | -| Items the chunk takes | An item stated with its L and E + I anywhere in the worker's text | 413 of 709 cases state one, 77 of them more than one, and workers also state items they file, finish or only mention. Code reads the items from a line that holds only them, which workers write only since loop-claude asks for it, so the archive can't measure it. | +| Items the chunk takes | An item stated with its L and E + I anywhere in the worker's text | 413 of 709 cases state one, 77 of them more than one, and workers also state items they file, finish or only mention. Code reads the items from a line that holds only them, which workers write only since build-release asks for it, so the archive can't measure it. | ## Running diff --git a/judge-field-trials/cases.py b/judge-field-trials/cases.py index 6de7026c..b4989f68 100644 --- a/judge-field-trials/cases.py +++ b/judge-field-trials/cases.py @@ -36,6 +36,6 @@ def worker_texts(entries) -> list[str]: def last_run_text(entries) -> list[str]: - """The worker's text after the last prompt loop-claude or the human gave it: what the judge rules on.""" + """The worker's text after the last prompt build-release or the human gave it: what the judge rules on.""" at = max((index for index, entry in enumerate(entries) if isinstance(entry, LoopPrompt | HumanTurn)), default=-1) return worker_texts(entries[at + 1:]) diff --git a/presentation/README.md b/presentation/README.md index 06c66ec9..99d1fd86 100644 --- a/presentation/README.md +++ b/presentation/README.md @@ -1,6 +1,6 @@ # presentation -`index.html` explains loop-claude, in 22 pages, to developers who have never seen an agent loop. It is published as a claude.ai artifact and printed to an A4 landscape PDF. +`index.html` explains build-release, in 22 pages, to developers who have never seen an agent loop. It is published as a claude.ai artifact and printed to an A4 landscape PDF. ## Rebuild the PDF @@ -8,7 +8,7 @@ presentation/build-pdf.py ``` -It writes `presentation/loop-claude-explained.pdf`, which stays out of git. It needs Docker, network access to Google Fonts, and the `playwright-for-claude` image. Build the image once with `~/.claude/bin/run-heavy docker build -t playwright-for-claude ~/code/playwright-for-agents`. When a font fails to load, the build stops without printing: fallback fonts would push pages onto a second sheet. +It writes `presentation/build-release-explained.pdf`, which stays out of git. It needs Docker, network access to Google Fonts, and the `playwright-for-claude` image. Build the image once with `~/.claude/bin/run-heavy docker build -t playwright-for-claude ~/code/playwright-for-agents`. When a font fails to load, the build stops without printing: fallback fonts would push pages onto a second sheet. ## Publish the page @@ -22,7 +22,7 @@ People in tech who want to build software factories, work with AI tools more eff ## How the pages are built -- **Page 1 engages.** It states the problem, what loop-claude does, what it aims for, who it is for, and three real figures. +- **Page 1 engages.** It states the problem, what build-release does, what it aims for, who it is for, and three real figures. - **Pages 2 and 3 share one layout.** Page 2 is the simple chart, page 3 the full one. The section frames, the human boxes, the colours and the return arrows sit in the same places on both. Each big box on page 2 is the group of steps at the same place on page 3, so a reader translates by position. Keep it that way. - **The full chart shows every piece.** A simpler view may group pieces, never drop them. - **Three sections:** @@ -40,7 +40,7 @@ People in tech who want to build software factories, work with AI tools more eff The figures were current on 2026-11-09. Refresh them before presenting again. -- **Finished chunks, 466 since 2026-10-03,** in loop-claude's archive: +- **Finished chunks, 466 since 2026-10-03,** in build-release's archive: ```sh find ~/.claude/loop-claude-transcripts -name '*.outcomes.md' -exec grep -l 'Verdict: finished' {} + | wc -l diff --git a/presentation/build-pdf.py b/presentation/build-pdf.py index c013ba39..860e4ea7 100755 --- a/presentation/build-pdf.py +++ b/presentation/build-pdf.py @@ -1,5 +1,5 @@ #!/usr/bin/env python3 -"""Print index.html to loop-claude-explained.pdf beside it, in the playwright-for-claude image.""" +"""Print index.html to build-release-explained.pdf beside it, in the playwright-for-claude image.""" import pathlib, shutil, subprocess, sys, tempfile HERE = pathlib.Path(__file__).resolve().parent @@ -19,8 +19,8 @@ def main() -> int: printed = subprocess.run(["docker", "run", "--rm", "--init", "--memory", "2g", "--memory-swap", "2g", "-v", f"{work}:/work", "-w", "/work", "--entrypoint", "node", IMAGE, "render-pdf.js"]) if printed.returncode != 0: return printed.returncode - shutil.copy(work / "out.pdf", HERE / "loop-claude-explained.pdf") - print(f"Wrote {HERE / 'loop-claude-explained.pdf'}") + shutil.copy(work / "out.pdf", HERE / "build-release-explained.pdf") + print(f"Wrote {HERE / 'build-release-explained.pdf'}") return 0 diff --git a/presentation/index.html b/presentation/index.html index 23c69a5d..2235f4ab 100644 --- a/presentation/index.html +++ b/presentation/index.html @@ -1,4 +1,4 @@ -<title>How loop-claude Works +How build-release Works @@ -195,7 +195,7 @@ dl.gloss dt { font-weight: 700; } dl.gloss dd { margin: 0; color: var(--muted);
-
loop-claude
+
build-release

A software factory that asks you only what is yours to decide

You write down what you want and who it is for. An AI plans the work, writes the code, gets it reviewed and merges it, one pull request at a time, for as long as the plan holds work.

@@ -209,7 +209,7 @@ dl.gloss dt { font-weight: 700; } dl.gloss dd { margin: 0; color: var(--muted);
-

What loop-claude does

+

What build-release does

  • It runs unattended. A judge reads every run, and interrupts you only for a choice that is yours.
  • It starts fresh every chunk. The repo is the memory: goals, plan and decisions are written down.
  • @@ -469,7 +469,7 @@ dl.gloss dt { font-weight: 700; } dl.gloss dd { margin: 0; color: var(--muted);
  • skills/larv-review/ the review recipe and its standards
  • skills/comprehension-panel/ the simulated readers
  • principles/ technical principles reviewers hold code to
  • -
  • bin/ the tools: loop-claude, chunk-preflight, chunk-pr, rule-hook, rank_todo.py, run-heavy and more
  • +
  • bin/ the tools: build-release, chunk-preflight, chunk-pr, rule-hook, rank_todo.py, run-heavy and more
  • settings.json runs rule-hook before each Agent, Bash, Edit, MultiEdit, Read, Skill and Write call
@@ -885,7 +885,7 @@ dl.gloss dt { font-weight: 700; } dl.gloss dd { margin: 0; color: var(--muted);

Talking to the loop

You start it with one command. It interrupts you in its terminal.

# inside a project checkout whose README has ## Goals and ## Audience
-$ loop-claude "Do the next chunk."
+$ build-release "Do the next chunk."
 … worker running: item 12 on claude-opus-5-5 at medium effort
 … judge: unfinished; resuming the same session
 … worker running
@@ -1012,7 +1012,7 @@ dl.gloss dt { font-weight: 700; } dl.gloss dd { margin: 0; color: var(--muted);
     27Shared heavy slots and memory limitsExperience On 2026-10-22 an 8-CPU, 16 GiB machine thrashed for hours: four to six loops ran mutation tests, builds and e2e tests at once. The next day, with 7.6 GiB, it hung until a hard reset, from containers with no memory limit. So heavy commands wait for a slot, one per 4 CPUs, and every container gets a limit.
     28Names and syntax picked by the people who use themOwn measurement A panel of three readers, seated as the users, picks each new name or spelling. It picked /talk, which opens claude for a question.
   
-  

Most measurements come from loop-claude's archive of every run, across all projects; others from git history, review replays, the readability history and two machine incidents. The setup's own docs/decisions.md and docs/scoring-and-goals-research.md hold the full reasoning.

+

Most measurements come from build-release's archive of every run, across all projects; others from git history, review replays, the readability history and two machine incidents. The setup's own docs/decisions.md and docs/scoring-and-goals-research.md hold the full reasoning.

@@ -1023,7 +1023,7 @@ dl.gloss dt { font-weight: 700; } dl.gloss dd { margin: 0; color: var(--muted);
Item
One row of todo.md: a bold one-sentence summary of the change, and its scores.
Worker
The headless Claude Code session that does the chunk.
Judge
The short AI run that reads each worker run and gives a verdict.
-
Interrupt
A question only you can answer, asked on loop-claude's terminal.
+
Interrupt
A question only you can answer, asked on build-release's terminal.
Pass
One kind of review, such as Stability. It runs in rounds.
Round
One review by one reviewer. At most two per pass per chunk, five in the release review.
Gate
The checks a PR must pass to merge: tests, CI, plan format.
@@ -1033,7 +1033,7 @@ dl.gloss dt { font-weight: 700; } dl.gloss dd { margin: 0; color: var(--muted);

The command you use

-
$ loop-claude "Do the next chunk."   # start the loop in a project
+
$ build-release "Do the next chunk."   # start the loop in a project
diff --git a/reviewer-merge-trials/README.md b/reviewer-merge-trials/README.md index a5bedccb..f2dd8f23 100644 --- a/reviewer-merge-trials/README.md +++ b/reviewer-merge-trials/README.md @@ -179,7 +179,7 @@ To replay on another model, change two places: `collect.py` keeps only projects The tracked `*-reviewer.md` files are the merged definitions the figures came from. `build_agents.py` and `build_pair.py` write them again from the current `~/.claude/agents/`, beside the `agents-*.json` the driver passes to claude, which wrap the same text. To replay the exact tracked definitions, restore them with `git checkout` after building, and rebuild the JSON from them in the shape `build_agents.py` writes. -1. `collect.py` reads loop-claude's archive and writes the archived reviewer rounds of Opus 5.5 projects to `runs.pkl`. +1. `collect.py` reads build-release's archive and writes the archived reviewer rounds of Opus 5.5 projects to `runs.pkl`. 2. `mkcases1.py` writes `cases-wave3.json`, candidate 1's cases. `cases-release.json` holds candidate 2's. 3. `build_agents.py` writes candidate 1's and 2's merged agents. `build_pair.py` writes candidate 4's, and `cases-pair.json`: candidate 1's cases without the prose round. 4. `driver.py ` replays one variant. `AT_ONCE` sets how many replays run at once, 4 by default. Results land in `results//-/`. diff --git a/rules/todo-items.md b/rules/todo-items.md index fd22b0d4..c07f6348 100644 --- a/rules/todo-items.md +++ b/rules/todo-items.md @@ -8,7 +8,7 @@ paths: - **A plan is mandatory in every project, and a plan kept as `todo.md` has the shape `rank_todo.py --help` shows**, which `rank_todo.py` checks and ranks; its `--help` shows a valid file. A plan in a Jira epic is read from the epic's open child issues. `todo-item add` files an item there as a new child issue, and `todo-item finish` moves an item's issue to done. `todo-item --help` says what `edit` and `move` change there. Below, `todo.md` means a plan kept as a file, and "the plan" either kind. `## Scoring` holds the formula and the bar; `## Items` is one table of every item; `## Details` holds each item's detail under its ID. `## Renamed` marks each renamed release with a line such as `- 0.2.1 renamed to 0.3.0`; `rank_todo.py --help` says what a mark does. Cite an item by its ID. The formula and bar are the project's own to tune. - **File an item with `todo-item add`, and change one with `todo-item edit` or `todo-item move`.** `add` and `edit --detail` read the item's detail from stdin, and all three commands rank the plan; `todo-item --help` shows the flags. `todo-item finish --no-changelog` drops an item no chunk built. Edit `todo.md` itself only for what `todo-item` has no command for: `## Scoring`, `## Renamed`, and reshaping an old table. - **Order items only by score and the Blocked by column.** An item's Blocked by cell lists the IDs of the items that must be done before it starts, such as `12, 14`; `rank_todo.py --help` says how it ranks them. No text in `todo.md` outside the table orders items: where an item must go first, score it so, and say why in its detail. -- **Plan only on the project's rung or above.** loop-claude's prompt tells you when you run below it. Below it, never score or re-score an item, move it between releases, split a milestone into items, delete an item under the bar, rewrite a filed item's tagline or detail, or choose or replace an item in `docs/score-anchors.md`. Draft each new item, each change to a filed item, and each change to the anchors, instead. Before your next commit, launch one subagent to apply the drafts, score them and set their release. Launch it on the rung `CLAUDE.md`'s delegation rule gives a subagent that files or scores items. Keep the scores and releases it writes. For a security finding, launch it at once. Any rung may remove a finished item's row and detail, and score a delegated task's L. A subagent launched for another task leaves the plan alone. +- **Plan only on the project's rung or above.** build-release's prompt tells you when you run below it. Below it, never score or re-score an item, move it between releases, split a milestone into items, delete an item under the bar, rewrite a filed item's tagline or detail, or choose or replace an item in `docs/score-anchors.md`. Draft each new item, each change to a filed item, and each change to the anchors, instead. Before your next commit, launch one subagent to apply the drafts, score them and set their release. Launch it on the rung `CLAUDE.md`'s delegation rule gives a subagent that files or scores items. Keep the scores and releases it writes. For a security finding, launch it at once. Any rung may remove a finished item's row and detail, and score a delegated task's L. A subagent launched for another task leaves the plan alone. - **An item's release allows the bump that semver read strictly asks for.** An item that changes what exists needs a major, or before 1.0.0 a minor. One that only adds needs a minor, and a fix a patch. - **Score an item when it is filed or edited.** S, the size of the change, is a whole number from 1 to 10. Score L, E and I by the levels below, each level about ten times as likely, or as damaging, as the one below it. `rank_todo.py` writes R, the risk that the change creates serious bugs or issues: L + E + I βˆ’ 2, at least 7 when I is 5 and at least 5 when I is 4, since a severe enough consequence outranks how unlikely it is. A task's L picks its worker's rung, and its E + I its reviewers' rung. @@ -30,4 +30,4 @@ paths: - **The Exempt cell keeps an item whatever its score:** `security` for a security finding, `defect` for a πŸ”΄ finding or an item that restores a maintain goal the project breaks today, `question` for a question only the human can answer, which ranks first in its release, `decision` for an item `docs/decisions.md` cites, `owner` for an item the human told you to keep, and, where no other reason fits, `principle` for a 🟑 finding against a file in the config's principles folder, whose item's detail names that principle. Every item `docs/decisions.md` cites carries one of these reasons. - **A maintain goal vetoes an item that breaks it,** whatever the item scores: redesign the item so it holds the goal, or drop it. - **When you remove an item that no chunk built, title the commit `Drop item : `,** or `Drop items 12, 14 and 15: ` for several. Such an item was deleted under the bar, vetoed, superseded or moot; a finished item is not one. Without the title, `score-outcomes` credits the item with the work of the chunk that removed it, where that chunk changed more than `todo.md`. -- **Predict, in the detail of each item of the next release, what the item will touch.** When you plan the next release, or file or move an item into it, give the item's detail a `Touches:` line, then one bullet per file the item will change. Each bullet names the file, then the parts of it the item will change: a function, a class or a section heading, or line ranges where the file has none of these. A path alone means the whole file. Read the code first; a prediction from the item's text alone misses. `touch-predictions --help` shows the spelling and how a part is named; a name that holds a backtick takes a longer run of backticks with a space inside each end, as a Markdown code span does. Mark a part `(small)` where the item changes only a few lines of it. `(small)` follows a part, never a bare path. A part is a name in backticks, or `lines -`. BANNED: ``- `bin/a.py` (small)``, ``- `README.md`: loop-claude's section (small)``. GOOD: ``- `bin/a.py`: `main` (small)``, ``- `README.md`: `## Tools` (small)``. Leave out the plan and the project's records, which every chunk writes. `chunk-preflight` reads the predictions to name the items that may start chunks at once, and `touch-predictions record` keeps each beside what its chunk touched. `todo-item add`, `todo-item edit` and `rank_todo.py --check` refuse a list touch-predictions cannot read. `rank_todo.py --check` warns, without failing, of each item of the earliest release that has no list, and `chunk-preflight` names them where the release holds other items, so that a subagent writes their lists (`CLAUDE.md` β†’ "Working loop"). +- **Predict, in the detail of each item of the next release, what the item will touch.** When you plan the next release, or file or move an item into it, give the item's detail a `Touches:` line, then one bullet per file the item will change. Each bullet names the file, then the parts of it the item will change: a function, a class or a section heading, or line ranges where the file has none of these. A path alone means the whole file. Read the code first; a prediction from the item's text alone misses. `touch-predictions --help` shows the spelling and how a part is named; a name that holds a backtick takes a longer run of backticks with a space inside each end, as a Markdown code span does. Mark a part `(small)` where the item changes only a few lines of it. `(small)` follows a part, never a bare path. A part is a name in backticks, or `lines -`. BANNED: ``- `bin/a.py` (small)``, ``- `README.md`: build-release's section (small)``. GOOD: ``- `bin/a.py`: `main` (small)``, ``- `README.md`: `## Tools` (small)``. Leave out the plan and the project's records, which every chunk writes. `chunk-preflight` reads the predictions to name the items that may start chunks at once, and `touch-predictions record` keeps each beside what its chunk touched. `todo-item add`, `todo-item edit` and `rank_todo.py --check` refuse a list touch-predictions cannot read. `rank_todo.py --check` warns, without failing, of each item of the earliest release that has no list, and `chunk-preflight` names them where the release holds other items, so that a subagent writes their lists (`CLAUDE.md` β†’ "Working loop"). diff --git a/skills/comprehension-panel/seat-prompts.md b/skills/comprehension-panel/seat-prompts.md index 70591433..a71ef76e 100644 --- a/skills/comprehension-panel/seat-prompts.md +++ b/skills/comprehension-panel/seat-prompts.md @@ -6,7 +6,7 @@ A scoring-run seat's prompt is the opening, the seat's background, the shared br - `{main}`: the project's main checkout. - `{forbidden}`: the plan, the decision log, past panels' records and past chunks' reading cost, each where the project's config puts it in the checkout. Where it puts all four at their usual paths: `todo.md, docs/decisions.md, docs/comprehension-history.md or docs/reading-cost.md (the plan, the decision log, past panels' records and past chunks' reading cost)`. A file the config puts outside the checkout is left out, since the seats' worktree doesn't hold it. - `{git}`: `git -C {checkout} ls-files`, and for a paired seat also `git -C {base checkout} ls-files`, each in backticks. -- `{files}`: every tracked file in `git -C {checkout} ls-files`, except test files and those `{forbidden}` names. Give one recursive glob per top-level source directory, say which test files it leaves out, and list each file no glob matches. Example: `bin/**/*.py` except `test_*.py`, plus launchers such as `bin/loop-claude`. +- `{files}`: every tracked file in `git -C {checkout} ls-files`, except test files and those `{forbidden}` names. Give one recursive glob per top-level source directory, say which test files it leaves out, and list each file no glob matches. Example: `bin/**/*.py` except `test_*.py`, plus launchers such as `bin/build-release`. - `{anchors}` and `{dimensions}`: the six anchor bullets and the four dimension bullets in `SKILL.md` β†’ "The score", verbatim, without bold and each on one line. - `{language}`, `{kind}`, `{domain}`, `{domain docs}` and `{3am question}`: the project's `AGENTS.md` β†’ "Scoring run". @@ -95,4 +95,4 @@ Report, in this shape: - `{kind}`: a Claude Code configuration with an agent loop and review skills - `{domain}`: driving headless Claude Code sessions, agent review workflows - `{domain docs}`: the Claude Code documentation -- `{3am question}`: a loop-claude run exits 1 overnight after the judge returned a verdict the loop rejected, or a larv-review run looped a reviewer a third time +- `{3am question}`: a build-release run exits 1 overnight after the judge returned a verdict the loop rejected, or a larv-review run looped a reviewer a third time diff --git a/skills/larv-review/SKILL.md b/skills/larv-review/SKILL.md index 88425b7d..246e3b68 100644 --- a/skills/larv-review/SKILL.md +++ b/skills/larv-review/SKILL.md @@ -5,7 +5,7 @@ description: Ship a work chunk through review to a merged PR; decisions land in # larv-review β€” ship the chunk, review until clean, gate green, merge -You orchestrate, fix, and ship; reviewers only report. Run every reviewer in the foreground (`run_in_background: false`), each wave's reviewers in one message (Β§3 β†’ "Waves"), and watch CI in the foreground: a headless run exits when the turn ends, and a background watcher dies with it. Never schedule a wakeup: a pending one keeps a headless run from exiting, so loop-claude neither runs its judge nor asks the human. The turn runs on until Β§6. +You orchestrate, fix, and ship; reviewers only report. Run every reviewer in the foreground (`run_in_background: false`), each wave's reviewers in one message (Β§3 β†’ "Waves"), and watch CI in the foreground: a headless run exits when the turn ends, and a background watcher dies with it. Never schedule a wakeup: a pending one keeps a headless run from exiting, so build-release neither runs its judge nor asks the human. The turn runs on until Β§6. **Forge-neutral.** Five PR operations recur below: read a PR's diff, open a draft PR, read check status, mark ready, merge. On GitHub and Gitea, `chunk-pr` opens the draft PR, marks it ready and merges it. Read the diff and the checks with the forge's own CLI, `gh` or `tea` per `~/.claude/CLAUDE.md` β†’ "Git, commits, and PRs". On any other forge, achieve all five through its CLI or API β€” discover how rather than assuming. A forge without a native draft state gets the closest equivalent (a `WIP:`/`Draft:` title prefix); note any approximation in the summary. @@ -31,7 +31,7 @@ No remote β†’ review locally and say so in the summary. **Work in the worktree.** Enter the chunk's worktree with the `EnterWorktree` tool, `path` set to it, unless the session already works there. A reviewer, a seat and the security pass's skill read the diff of the session's working directory, and a subagent starts there; from the checkout root they find the branch's diff empty. -**Reading cost.** Run `reading-cost` in the chunk's worktree, unless loop-claude's prompt shows that `chunk-preflight` already ran it there, and commit what it appends to `docs/reading-cost.md`; the commit re-enters no pass. Resolve a merge conflict in that file by putting the default branch's figures first and dropping a figure for a chunk the default branch already holds. On `Rising:`, file a plan item titled `**Lower the reading cost of the files a chunk reads most before its first commit.**`, scored per `~/.claude/rules/todo-items.md` with the tool's medians and files as its detail; where the plan already holds it, leave it as it is: `docs/reading-cost.md` holds the figures. The item names the next release, or the one after when this chunk ships the next release's last item. On exit 1, repair what its message names and run it again; when the message names no repair, file it as a `question` item, or refresh the question item an earlier run filed, and go on. Leave the plan as it is on any other output. The chunk that ships that item runs the tool with `--reset` instead, so the next rise is measured on chunks that finished after it. +**Reading cost.** Run `reading-cost` in the chunk's worktree, unless build-release's prompt shows that `chunk-preflight` already ran it there, and commit what it appends to `docs/reading-cost.md`; the commit re-enters no pass. Resolve a merge conflict in that file by putting the default branch's figures first and dropping a figure for a chunk the default branch already holds. On `Rising:`, file a plan item titled `**Lower the reading cost of the files a chunk reads most before its first commit.**`, scored per `~/.claude/rules/todo-items.md` with the tool's medians and files as its detail; where the plan already holds it, leave it as it is: `docs/reading-cost.md` holds the figures. The item names the next release, or the one after when this chunk ships the next release's last item. On exit 1, repair what its message names and run it again; when the message names no repair, file it as a `question` item, or refresh the question item an earlier run filed, and go on. Leave the plan as it is on any other output. The chunk that ships that item runs the tool with `--reset` instead, so the next rise is measured on chunks that finished after it. **Tests and static analysis.** Where the branch changes code, config or tests, before each stability round: search the project's Markdown, the help and error text in code, and the comments beside the code for each flag, name, path and number the change renames, removes or changes, and fix each line it made false. Where the change adds a member to a set, such as a locale, command or format, search the same places too for each sentence that claims something of every or each member of that set, and fix each one the new member makes false. For each builtin, flag or option the change adds, take each range or set of inputs its docs state. Run the command once with a value just outside it, such as a date past the years it supports, as the Run and Limits bullets of Β§3 β†’ "Claimed output" say. Where it printed nothing, an error or a clamped value, fix each doc line that states the range so that it names that result, and keep the run for Β§3's hand-over. Commit, then run the project's test suite and static analysis in the chunk's worktree as its README documents them, and fix a failure before going on. Hand stability-reviewer the commit they last passed on; a fix from the mutation tests below moves the head, so run them again after it, and the reviewer doesn't run them again on that commit. @@ -142,7 +142,7 @@ A round's fixes re-enter together: run every pass the table names for any of the **Rung up.** A reviewer rules the work below standard when its report holds systems-architect's BLOCK or a finding against the review standards' `quality.md`. A comprehension seat does when `record-ruling` counts one of its votes as worse. -- **Ask.** Such a reviewer or seat may end its report asking for a rerun one rung up. Relaunch it only on the rung loop-claude's prompt names for it; where the prompt names none, the report stands. +- **Ask.** Such a reviewer or seat may end its report asking for a rerun one rung up. Relaunch it only on the rung build-release's prompt names for it; where the prompt names none, the report stands. - **Relaunch.** Relaunch a reviewer on that rung with the same prompt, except for its header, made with `--rerun` per "Reports"; its report stands in place of the report that asked, in the same round. Relaunch a seat with the same prompt alone; its line replaces the one that asked in the votes file, before `record-ruling` runs. A relaunch cannot ask again. - **Escalate.** A below-standard ruling in the report that stands is escalation trigger 4 in `~/.claude/CLAUDE.md` β†’ "Working with the codebase", unless the fix changes only prose: the worker then fixes it on its own rung. diff --git a/stability-skip-count/README.md b/stability-skip-count/README.md index 72067f61..84a304d6 100644 --- a/stability-skip-count/README.md +++ b/stability-skip-count/README.md @@ -1,7 +1,7 @@ # Stability skip count This count asks one question: would skipping stability round 2 have skipped a round that blocked, where round 1's findings each asked only that a named mutant be killed or a named failing test pass? -It ran on 2026-11-12, over loop-claude's archive in `~/.claude/loop-claude-transcripts/`. `docs/decisions.md` β†’ `review: a fix for a πŸ”΄ reruns the pass that found it…` records what was decided from it, and `skills/larv-review/SKILL.md` Β§3 β†’ "Re-entry" β†’ "Mechanical answers" holds the rule. +It ran on 2026-11-12, over build-release's archive in `~/.claude/loop-claude-transcripts/`. `docs/decisions.md` β†’ `review: a fix for a πŸ”΄ reruns the pass that found it…` records what was decided from it, and `skills/larv-review/SKILL.md` Β§3 β†’ "Re-entry" β†’ "Mechanical answers" holds the rule. ## Terms diff --git a/stability-skip-count/count.py b/stability-skip-count/count.py index 95dcd906..f027c7e2 100644 --- a/stability-skip-count/count.py +++ b/stability-skip-count/count.py @@ -61,7 +61,7 @@ def rounds() -> list[dict]: def main() -> None: """Print the totals, then each report of round 2 or later where the report before it, in the same cycle, held a πŸ”΄ and every πŸ”΄ and 🟑 line of that report before reads as mechanical.""" if not ARCHIVE.is_dir(): - sys.exit(f"No archive at {ARCHIVE}: the count reads loop-claude's transcripts on the machine that ran them.") + sys.exit(f"No archive at {ARCHIVE}: the count reads build-release's transcripts on the machine that ran them.") every = [run for run in rounds() if run["at"] < UNTIL] later = [run for run in every if run["round"] >= 2] print(f"{len(later)} reports of round 2 or later, {sum(run['block'] for run in later)} opening with BLOCK, from {len({run['project'] for run in later})} projects") diff --git a/todo.md b/todo.md index 78c01343..d4e9499e 100644 --- a/todo.md +++ b/todo.md @@ -290,7 +290,7 @@ Touches: - `bin/review_replay/replay.py`: `review` (small), `redirected` (small) - `bin/judge_replay/main.py`: `(module)` (small) - `bin/larv_review/main.py`: `(module)` (small) -- `bin/loop_claude/loop/usage.py`: `HELP` (small) +- `bin/build_release/loop/usage.py`: `HELP` (small) - `bin/notifier/main.py`: `(module)` (small) - `bin/reading_cost/main.py`: `(module)` (small) - `bin/subagent_rung/main.py`: `(module)` (small) @@ -318,9 +318,9 @@ Touches: - `bin/judge_replay/test_judge_replay.py`: `Main` - `bin/larv_review/test_larv_review.py`: `LarvReviewTool` - `bin/larv_review/test_scoring_setup.py`: `PrepareScoring` -- `bin/loop_claude/loop/test_chunk_windows.py`: `StartChunks` -- `bin/loop_claude/loop/test_main.py`: `WindowStarts`, `OwnLadder` -- `bin/loop_claude/test_black_box.py`: `Checkout`, `Premises`, `Cycles`, `Windows`, `Interrupt` +- `bin/build_release/loop/test_chunk_windows.py`: `StartChunks` +- `bin/build_release/loop/test_main.py`: `WindowStarts`, `OwnLadder` +- `bin/build_release/test_black_box.py`: `Checkout`, `Premises`, `Cycles`, `Windows`, `Interrupt` - `bin/notifier/test_notifier.py`: `Project` - `bin/project_config/doubles.py`: `write_config` - `bin/project_config/test_project_config.py`: `ConfigCase`, `LoadTest`, `HeldTest`, `ToolTest` @@ -343,7 +343,7 @@ Touches: Part of the standalone-install plan lilleman approved on 2026-11-20, as reshaped on 2026-12-03 when 0.18.0 was planned. The decision "names" set `build-epic` beside `build-release`. Its machine settings move from `~/.claude-projects/do-epic/` to a folder named for `build-epic` under `~/.config/build-release/`. The changelog names the successor, and nothing forwards from the old name. -Which mentions of `do-epic` in prose change is not predictable, so the list holds every file that names it. The new name of the `do_epic` package is not predictable either, so the list names its old files whole and leaves out the new ones beside the new launchers. Item 485 lands first and renames `bin/loop_claude/`, so the list names those files as they are today. +Which mentions of `do-epic` in prose change is not predictable, so the list holds every file that names it. The new name of the `do_epic` package is not predictable either, so the list names its old files whole and leaves out the new ones beside the new launchers. Item 485 lands first and renames `bin/build_release/`, so the list names those files as they are today. Touches: @@ -430,10 +430,10 @@ Touches: - `bin/chunk_pr/main.py`: `(module)` - `bin/chunk_pr/test_chunk_pr.py`: `Merge` - `bin/forge/reviews.py`: `(module)` -- `bin/loop_claude/__init__.py`: `(module)` -- `bin/loop_claude/chunk/fresh_prompt.py`: `(module)` -- `bin/loop_claude/loop/chunk_windows.py`: `refusal` -- `bin/loop_claude/loop/test_chunk_windows.py`: `StartChunks` +- `bin/build_release/__init__.py`: `(module)` +- `bin/build_release/chunk/fresh_prompt.py`: `(module)` +- `bin/build_release/loop/chunk_windows.py`: `refusal` +- `bin/build_release/loop/test_chunk_windows.py`: `StartChunks` - `bin/plan/release.py`: `(module)` - `bin/project_config/main.py`: `(module)` - `bin/project_config/settings.py`: `(module)`, `DO_EPIC`, `configs`, `env_files` @@ -482,8 +482,8 @@ Touches: - `bin/agent_cycle/hand_over.py`: `hand_over` (small) - `bin/agent_cycle/test_run.py`: `Cycles` - `bin/chunk_driver/cycle_start.py`: `setup_version` (small) -- `bin/loop_claude/loop/main.py`: `main` (small), `run_loop` (small) -- `bin/loop_claude/test_black_box.py`: `Checkout` +- `bin/build_release/loop/main.py`: `main` (small), `run_loop` (small) +- `bin/build_release/test_black_box.py`: `Checkout` - `bin/do_epic/main.py`: `main` (small), `run` (small) - `bin/rule_hook/transcript_read.py`: `(module)` (small), `transcript_breaches` (small) - `bin/repo_checks/test_install.py`: `Install` @@ -502,9 +502,9 @@ Where the wrapper lives is not predictable: a panel picks its spelling, and `bui Touches: -- `bin/loop_claude/loop/main.py`: `run_loop` (small) -- `bin/loop_claude/loop/usage.py`: `HELP` (small) -- `bin/loop_claude/loop/test_main.py` +- `bin/build_release/loop/main.py`: `run_loop` (small) +- `bin/build_release/loop/usage.py`: `HELP` (small) +- `bin/build_release/loop/test_main.py` - `bin/loop_effects/effects.py`: `claude_on_terminal` (small) - `.gitignore` - `README.md`: `## Install` (small), `## Tools` (small) @@ -541,8 +541,8 @@ Touches: - `bin/deploy_release/main.py`: `(module)` - `bin/deploy_release/test_deploy_release.py`: `Cut` - `bin/larv_review/main.py`: `(module)` -- `bin/loop_claude/loop/test_routing_check.py`: `RoutingCheck` -- `bin/loop_claude/loop/usage.py`: `HELP` +- `bin/build_release/loop/test_routing_check.py`: `RoutingCheck` +- `bin/build_release/loop/usage.py`: `HELP` - `bin/loop_state/paths.py`: `paths_from` - `bin/transcript_archive/outcomes.py`: `(module)`, `Annotation` - `presentation/README.md`: `## Where the figures come from` @@ -621,7 +621,7 @@ Touches: - `bin/agent_cycle/stuck_workers.py`: `Watch.check` - `bin/loop_effects/child_shells.py`: `stop` (small) -- `bin/loop_claude/loop/usage.py`: `HELP` (small) +- `bin/build_release/loop/usage.py`: `HELP` (small) ### 521. Refuse a `.dockerignore` that leaves out a secret-named entry the `.gitignore` beside it ignores, where a Dockerfile copies the whole build context. @@ -708,7 +708,7 @@ Raised by the goals audit of PR #296. `bin/routing_figures/calls.py` groups a ch Filed by the comprehension check of PR #473 at 13d1550 (`larv-review record-scoring`), which printed `Floor:` and `Next:`, refreshed from the two runs of item 525's chunk at 68611733, and then from the two runs of item 565's chunk at 98c49021. The lowest mean of the second run at 98c49021 is Self-sufficiency at 5.75, with Locality at 5.88 and Shape at 6.13; the first run put Self-sufficiency lowest at 5.63, with Locality and Shape at 5.75. Self-sufficiency: the why behind code sits in `docs/decisions.md`, cited by title from about 120 places, and the review loop's rules live in `skills/larv-review/SKILL.md`, not beside the unit that enforces them; `bin/agent_cycle/routing.py:115` `unfinished_route` keeps its reasons in the decision log too. Locality: do-epic and chunk-pr run order-dependent steps and keep state in tmux window names and between loop passes (`start_chunks`, `resumed_news`, `merged`, `merge_turn`), and no code enforces the order; `bin/do_epic/main.py:236` `chunk_run` and `bin/do_epic/scheduler.py:172` `start_chunks` are the hardest do-epic places, and the round cap is counted three ways (`bin/rule_hook/round_cap.py:28` `earlier_titles`, `bin/larv_review/reviewer_header.py:83` `branch_summaries`, `bin/review_rules/round_titles.py:39` `named_counts`). Shape: `bin/` stays flat at about 86 entries at one level, long functions carry several flags at once, and the OLD_SHAPE fork in `bin/plan/ranking.py` doubles the paths through ranking. Refresh this item's places and aim from the newest run before the chunk starts; do not file a second floor item. -Newest run, two runs of item 569's chunk at add7c09d: Locality is lowest at 5.63. It adds these places to the list below: `bin/rule_hook/reviewer_rung.py:28` `reviewer_breaches` refuses a launch for its rung and never for its round count, so the round cap has a launch-time gap beside the three counters; `bin/loop_claude/loop/chunk_windows.py:150` `chunks_to_start` is a near-twin of `bin/do_epic/scheduler.py:172` `start_chunks` with different rules and no stated reason for two; `bin/agent_cycle/tmux.py:92` `as_listed` keeps chunk state in window-name suffixes that other code matches on; `bin/plan/ranking.py:144` `weigh` checks the old table shape in every function; `bin/do_epic/__init__.py:1` has no map of its 25 modules. +Newest run, two runs of item 569's chunk at add7c09d: Locality is lowest at 5.63. It adds these places to the list below: `bin/rule_hook/reviewer_rung.py:28` `reviewer_breaches` refuses a launch for its rung and never for its round count, so the round cap has a launch-time gap beside the three counters; `bin/build_release/loop/chunk_windows.py:150` `chunks_to_start` is a near-twin of `bin/do_epic/scheduler.py:172` `start_chunks` with different rules and no stated reason for two; `bin/agent_cycle/tmux.py:92` `as_listed` keeps chunk state in window-name suffixes that other code matches on; `bin/plan/ranking.py:144` `weigh` checks the old table shape in every function; `bin/do_epic/__init__.py:1` has no map of its 25 modules. Aim: one ambitious refactor of the areas below, sized so every mean reaches 7.0 on the chunk's own scoring run. Where a place is already easier to read when the chunk starts, drop it. @@ -719,13 +719,13 @@ Places the seats named in the two runs at 98c49021, hardest first (`larv-review - Self-sufficiency: `bin/do_epic/main.py:485` `next_cycle`: a tmux window name doubles as the Jira issue key, written down nowhere. - Self-sufficiency, Shape: `bin/release_plan/release_standing.py:206` `next_release`: one boolean packs three inputs. - Locality, Self-sufficiency, Shape: `bin/do_epic/parking.py:18` `parked_through`: a crash-ordering protocol of three ordered steps and a polling loop, with state in a file, tmux attributes, Jira and scheduler slots, and the order only in the docstring. Three seats named it. -- Locality, Shape, Navigation: `bin/do_epic/scheduler.py:172` `start_chunks`: window sets and a parked map in a five-way branch under two nested locks, and the cap on running chunks lives here, in `resume` and in `bin/loop_claude/loop/chunk_windows.py:117` `start_chunks`. Three seats named it. +- Locality, Shape, Navigation: `bin/do_epic/scheduler.py:172` `start_chunks`: window sets and a parked map in a five-way branch under two nested locks, and the cap on running chunks lives here, in `resume` and in `bin/build_release/loop/chunk_windows.py:117` `start_chunks`. Three seats named it. - Locality: `bin/rule_hook/round_cap.py:28` `earlier_titles`, with `bin/larv_review/reviewer_header.py:83` `branch_summaries` and `bin/review_rules/round_titles.py:39` `named_counts`: three round counters, and `earlier_titles` fails open where the others don't. Two seats named it. - Locality, Shape: `bin/do_epic/main.py:402` `handed_on`: reads like a getter and writes Jira, the store and tmux. - Locality: `bin/chunk_pr/main.py:624` `levelled_and_finished`: the order of the scoring-run check and the remeasure isn't explained. - Locality: `bin/agent_cycle/judge.py:88` `Reply`: the prompt's wording is coupled to `judge_replay.archived_prompt`. - Locality: `bin/chunk_driver/chunk_run.py:44` `closed_cycle`: `Route.unfinished` and `Run.unfinished_run` have near-identical names and different meanings. -- Locality: `bin/loop_claude/loop/reload.py:97` `exec_if_edited`: a new `LoopRun` field breaks running loops. +- Locality: `bin/build_release/loop/reload.py:97` `exec_if_edited`: a new `LoopRun` field breaks running loops. - Shape, Locality, Self-sufficiency: `bin/chunk_pr/main.py:485` `merged`: a merge-queue loop interleaving approval, parking and a flock, with chained Failure ternaries, four flags whose combinations aren't all visibly handled, about eight functions to follow one merge, and git, forge and plan effects in an unexplained order. Five seats named it. - Shape, Locality: `bin/do_epic/main.py:236` `chunk_run`: a long loop mixing parking and reopening, with flags threaded through and a nested ternary at line 285. Three seats named it. - Shape: `bin/task_bench/main.py:241` `Planner`: three layers of curried callables. Two seats named it. @@ -778,7 +778,7 @@ A release's capacity is a sum of its items' cost, as the formula counts it. Each ### 165. Make this repo's tests assert the facts a prompt or help text carries in place of its sentences, and drop the tests that scan source or assert a constant. -A test audit across lilleman's projects on 2026-10-16 found 10 of 33 sampled tests in this repo pinning wording that is not the contract. Examples of these and other weak tests: many tests under `bin/loop_claude/`, `bin/chunk_driver/` and `bin/agent_cycle/` pin whole sentences of the question, archive, prompt or help text, up to about 750 characters. `test_every_exit_1_stop_has_its_clause_in_help` and `test_every_failed_judge_run_has_its_clause_in_help` parse the source with `ast` and list each `Stop(...)` and `Failure(...)` call by function name. `bin/model_routing/test_ladder.py` asserts `len(LADDER) == 6`. Rewrite each to the technical principles' test bullet: assert the facts the text must carry, such as an item ID, a rung or a model argument, and delete a test no real bug could fail. Before and after rewriting a test, run the mutation tool on the code it covers: every mutant the old test killed, the new one kills. +A test audit across lilleman's projects on 2026-10-16 found 10 of 33 sampled tests in this repo pinning wording that is not the contract. Examples of these and other weak tests: many tests under `bin/build_release/`, `bin/chunk_driver/` and `bin/agent_cycle/` pin whole sentences of the question, archive, prompt or help text, up to about 750 characters. `test_every_exit_1_stop_has_its_clause_in_help` and `test_every_failed_judge_run_has_its_clause_in_help` parse the source with `ast` and list each `Stop(...)` and `Failure(...)` call by function name. `bin/model_routing/test_ladder.py` asserts `len(LADDER) == 6`. Rewrite each to the technical principles' test bullet: assert the facts the text must carry, such as an item ID, a rung or a model argument, and delete a test no real bug could fail. Before and after rewriting a test, run the mutation tool on the code it covers: every mutant the old test killed, the new one kills. ### 392. Group bin/'s packages by concern into seven folders (plan, records, integrations, loop, review, ship and host), so a newcomer finds a tool's neighbours in one place. @@ -821,11 +821,11 @@ The tests also cover `workflow-bench/bench.py`'s `permission_flags`, with a prob ### 102. Give loop-claude's retry delay, its wall clock, and the file it reads the machine's memory from, environment overrides, so the black-box test stops replacing `time.sleep`, `time.time` and `machine_load.memory.MEMINFO` through `sitecustomize`. -Found by the principles audit of PR #242. The `SITECUSTOMIZE` block in `bin/loop_claude/test_black_box.py` swaps the global `time.sleep`, the shape "Functional core, imperative shell" bans, and the audit of PR #376 found the same block swapping `machine_load.memory.MEMINFO`, the constant in `bin/machine_load/memory.py`. An override of each lets the test run the code as production runs it. Release 0.17.0 added a third swap to the block: `LOOP_TEST_NOW` replaces `time.time`, so the test of a usage limit's wait doesn't depend on the wall clock. The override of the wall clock replaces that swap too. +Found by the principles audit of PR #242. The `SITECUSTOMIZE` block in `bin/build_release/test_black_box.py` swaps the global `time.sleep`, the shape "Functional core, imperative shell" bans, and the audit of PR #376 found the same block swapping `machine_load.memory.MEMINFO`, the constant in `bin/machine_load/memory.py`. An override of each lets the test run the code as production runs it. Release 0.17.0 added a third swap to the block: `LOOP_TEST_NOW` replaces `time.time`, so the test of a usage limit's wait doesn't depend on the wall clock. The override of the wall clock replaces that swap too. ### 135. Fingerprint only the modules loop-claude imports, so editing another tool's code no longer reloads a running loop. -The maintainability senior and the inherited architect of PR #257's scoring run named `fingerprint` and `exec_if_edited` in `bin/loop_claude/loop/reload.py`: the fingerprint covers every `bin/**/*.py`, so editing `statusline.py` or `rank_todo.py` re-execs a running loop. Make `fingerprint` easier to read. +The maintainability senior and the inherited architect of PR #257's scoring run named `fingerprint` and `exec_if_edited` in `bin/build_release/loop/reload.py`: the fingerprint covers every `bin/**/*.py`, so editing `statusline.py` or `rank_todo.py` re-execs a running loop. Make `fingerprint` easier to read. ### 443. Measure whether compacting a waiting worker's session cut the cost of 20 chunks with an interrupt, with quality holding. @@ -978,9 +978,9 @@ The replay: `review-replay claude-opus-5-5 --read-limit` already replays Touches: - `bin/agent_cycle/run.py`: `worker_environment` (small) -- `bin/loop_claude/loop/usage.py`: `HELP` (small) +- `bin/build_release/loop/usage.py`: `HELP` (small) - `bin/agent_cycle/test_run.py`: `Cycles` (small) -- `bin/loop_claude/loop/test_usage.py`: `HelpLimits` (small) +- `bin/build_release/loop/test_usage.py`: `HelpLimits` (small) ### 522. Let a subagent that ships a chunk in a worktree of another repo run larv-review's security pass on that worktree's diff. diff --git a/workflow-bench/advisor_bench.py b/workflow-bench/advisor_bench.py index 9c73c234..238091f5 100644 --- a/workflow-bench/advisor_bench.py +++ b/workflow-bench/advisor_bench.py @@ -5,7 +5,7 @@ The question: does a worker below the project's rung, Sonnet 5.5 with Opus 5.5 a Sonnet alone, or match Opus 5.5 at medium for less? Each case is an archived L 1 or L 2 chunk of this repo (CASES holds its todo.md item, the commit it started from and the commit it merged at). `run` clones the repo at the start commit and hands the arm's worker the item's text from todo.md, with the bench rules of -advisor-run-prompt.md in place of loop-claude's prompt. It saves, beside the clone in : the claude +advisor-run-prompt.md in place of build-release's prompt. It saves, beside the clone in : the claude stream (.jsonl), the worker's change (.diff) and the result of the tests of the packages that either change touches (.tests). `grade` has a judge on Opus 5.5 at medium, blind to the arm, rule on the .diff against the merged commit's change (.verdict); `summary` prints a table per arm. diff --git a/workflow-bench/handoff_bench.py b/workflow-bench/handoff_bench.py index ffa8e295..84c00286 100644 --- a/workflow-bench/handoff_bench.py +++ b/workflow-bench/handoff_bench.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 """Bench how a worker's step to a stronger model hands the chunk over: handoff_bench.py start - ..., then run|grade -- ..., then summary -The question: when loop-claude steps a worker to a rung on another model, which handoff serves the stronger model +The question: when build-release steps a worker to a rung on another model, which handoff serves the stronger model best? Each case is an archived chunk of this repo, as in advisor_bench.py, whose judge and files this bench shares. - `start` runs WEAK on the item in the clone /- until it has spent START_BUDGET, which stands in for a run that ends asking for a higher rung. A worker that finishes within the budget leaves no