Lilleman ccaa2cc672
CI / tests (pull_request) Successful in 5m56s
Widen item 514 to scripts that run git on another repository
2026-11-22 19:06:19 +01:00
2026-11-22 15:52:21 +01:00
2026-11-18 10:50:47 +01:00

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.

Goals

  1. Achieve: Get the highest quality out of Claude Code while interrupting me the least, so development scales.
    • Signal: interrupts of me per finished chunk fall.
    • Counter-signal: findings that a later change fixes, per finished chunk, rise.
    • Why: fewer asks don't buy anything if the output gets worse.
    1. Achieve: Proven, stellar output quality: code, documentation and plans.
      • Signal: 🔴 and 🟡 findings that review raises per chunk fall.
      • Counter-signal: later changes that fix a chunk's code rise.
      • Why: review findings show the first draft's quality, later fixes show what review missed.
    2. Achieve: Decide by the project's goals when confident; ask me when not, and never the same thing twice.
      • Signal: asks that a goal or decision already settled fall to zero.
      • Counter-signal: decisions I reverse rise.
      • Why: guessing instead of asking saves an interrupt only if the guess holds.
    3. Maintain: The same workflow in every project and every session; each project's config supplies its premises, principles, plan and records.
    4. Achieve: Keep lowering cost, except where that would cut quality meaningfully.
      • Signal: tokens per finished chunk fall.
      • Counter-signal: reading cost, the new input tokens a chunk reads before its first commit, rises; or review rounds or unfinished verdicts per chunk rise.
      • Why: a cheaper chunk that leaves the project harder to read moves the cost to every later chunk, whose changes need more reading and grow likelier to break what nobody saw; and a chunk that needs more rounds costs more.
    5. Achieve: Delivery speed.
      • Signal: hours from a chunk's start to its merge fall.
      • Counter-signal: 🔴 findings per chunk rise.
      • Why: speed bought by skipping review shows up as defects.
    6. Achieve: Plug into a project without changing what its owners keep: its repo layout, tracker, wiki and conventions.
      • Signal: the changes a project's owners must make before the loop runs in it fall.
      • Counter-signal: defects where a backend loses or misreads a plan item, a premise or a record rise.
      • Why: fitting in isn't worth anything if the loop then works from wrong facts.
  2. Maintain: Make my claude setup shareable between computers.
  3. Maintain: Keep my claude setup and the transcripts of unattended runs backed up. A bench's transcripts are the exception: they stay only until task-bench gather has filed plan items from their digest, or the next bench starts.
  4. Maintain: Don't leak anything: no credentials, transcripts or memory files to this repo's remote, and no client's code, transcripts or credentials to another client or to this repo.

Audience

Me, on my own machines and on those I use for the clients I consult for, which take tagged releases. Client teams read what the loop writes in their Jira, Confluence and pull requests, so it must read as written for them.

Install

Take this checkout only onto a machine that is a sandbox with no direct access to a production environment, such as a dedicated VM: settings.json runs Claude Code in auto mode with the dangerous-mode prompt skipped.

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.

Claude Code may already have created ~/.claude, where git clone refuses to run, so make the repository in place, then clone it for development:

mkdir -p ~/.claude && cd ~/.claude
git init
git remote add origin ssh://git@gitea.larvit.se:21022/lilleman/claude-config.git
git fetch --tags origin
git checkout -f "$(git tag -l 'v*' --sort=-v:refname | head -n 1)"
git clone ssh://git@gitea.larvit.se:21022/lilleman/claude-config.git ~/code/claude-config

Have the latest stable Python, today 3.14, as python3 on PATH, and for Rust projects rust-analyzer on PATH, which the rust-analyzer-lsp plugin needs. Install every plugin settings.json enables:

claude plugin marketplace add anthropics/claude-plugins-official
claude plugin install claude-security@claude-plugins-official
claude plugin install code-review@claude-plugins-official
claude plugin install rust-analyzer-lsp@claude-plugins-official

Have git store settings.json without "model", so a model you pick with /model stays on this machine and never reaches a commit. Run this in each checkout, ~/.claude and ~/code/claude-config:

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.

Back up three folders: ~/.claude/loop-claude-transcripts, where loop-claude keeps every transcript, ~/.claude/do-epic-transcripts, where do-epic keeps its chunks' transcripts, and ~/.local/state/larv-review, where larv-review keeps each chunk's reports. 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:

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.

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/<key>.env, in the keys ~/.claude/bin/notify --help names, run chmod 600 on it, and add env-file = "~/.claude-projects/<key>.env" and notifier = "mattermost" (or "slack") to the project's config, as Install → "Set up a project" describes.

Set up a project

Each project the loop runs in has a folder, ~/.claude-projects/<key>/, where <key> is the project's name, and a config in it, config.toml. The folder is a git repo of its own, so the config has a history and a client's files never enter this repo. The loop commits each change it makes to a file there, such as the plan, in that repo, titled as its commits in the checkout. A project is a whole git checkout, never a subfolder of one.

The config names the project's main checkout and the path of every file the loop keeps for it. No path setting has a default: project-config fails and names each setting a config leaves out. A path is checkout:<path> inside the checkout, folder:<path> inside the config's folder, or one that starts with / or ~/. Every tool reads and writes each file at the path its setting gives, and chunk-preflight and todo-item print those paths for the agents. Five of the settings name the project's records: decisions, score-anchors, comprehension-history, reading-cost and changelog. Keep each file's name, such as todo.md: the rules for a file load by its name. A project of your own keeps every file but the principles and the review standards in its checkout:

checkout = "~/code/log"
plan = "checkout:todo.md"
working-rules = "checkout:AGENTS.md"
decisions = "checkout:docs/decisions.md"
score-anchors = "checkout:docs/score-anchors.md"
comprehension-history = "checkout:docs/comprehension-history.md"
reading-cost = "checkout:docs/reading-cost.md"
changelog = "checkout:CHANGELOG.md"
goals-and-audience = "checkout:README.md"
principles = "~/.claude/principles"
standards = "~/.claude/skills/larv-review/standards"

principles and standards name the folders the reviewers hold the project to: the technical principles and the review standards. Both ship with this setup, at the paths above. A folder of your own replaces the shipped one. A standards folder must hold quality.md, prose.md, comments.md and readme.md, since the reviewers and the rules name those files.

A project may also set env-file, the file of KEY=value credentials its tools read, such as env-file = "~/.claude-projects/log.env". It is a path that starts with / or ~/, outside the checkout and the config's folder, so that no git remote receives it. A tool that needs a key fails and names each one the file lacks. No failure message, prompt, log line or archived loop output holds a token from the file. rule-hook refuses a Read or a Grep of the file and a Bash command that names it or searches a folder holding it with ag, grep -r or rg, unless the tool skips the file as hidden or ignored, so a worker doesn't read it in passing; rule-hook --help says which calls it checks. A project without the setting has no credentials, and never reads another project's. project-config env-file prints the path.

A project may also set touch-predictions, a path spelt as changelog's is, such as touch-predictions = "checkout:docs/touch-predictions.md". touch-predictions record appends each chunk's predicted files and parts there, beside those it touched. A project that leaves it out keeps no such record.

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'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 <pass> round <n>:, 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.

A legacy project with no container setup sets tooling-on-host = true, so the loop runs its language runtime, package manager, tests and task runner directly on the host. One whose code the comprehension panel scores low may lower readability-floor from 7.0: under it, the ranking weighs code health 4 times as much, and a scoring run asks for a floor item. To let more than one chunk run at once, set parallel-chunks to the most that may; left out, it is 1. Beside the plan's next item, only items whose Touches: predictions overlap none of the running chunks' items start.

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 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 <epic's key> <title>, 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.

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.

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:

  • The ID is the issue's number, so every child must be in the epic's own Jira project.
  • The tagline is the summary.
  • The detail is the description, which a docker container converts to markdown.
  • The release is the earliest Fix Version named as a semver version, such as 1.2.0. Every open child needs one.
  • A blocker is an "is blocked by" link to another open child.
  • The scores are the issue property plan-item, a JSON object such as {"L": 2, "E": 2, "I": 3, "S": 3, "Moves": "1.6 by 4", "Exempt": ""}. An issue without it reads as an item nobody scored yet.

A read fails, naming the issue, where a child is in another Jira project or names no such Fix Version. The config's env-file must hold ATLASSIAN_EMAIL and ATLASSIAN_API_TOKEN, an API token of that Atlassian account, and only its owner may read that file: chmod 600 it.

The loop reads such a plan and files each item into it as a Task under the epic. A Jira project that has no Task type, such as TW, sets jira-finding-type to a type it has, such as "Feature". todo-item add fails, naming the project's types, where the project lacks the type set. todo-item add also needs the item's release among the Jira project's Fix Versions, named as 1.2.0 or v1.2.0. The config states the formula and the bar that a todo.md states under ## Scoring, such as jira-score-formula = "100 * V / (2**S + 8)" and jira-score-bar = 1, and fails to load without them. todo-item add refuses an item that scores under the bar, unless it is exempt. It ranks the new issue among the issues the loop filed: questions first, then security findings, then by score. A person's issues keep the rank the team gave them, and rank_todo.py doesn't rank the plan.

todo-item edit and move change only an issue the loop filed. Of an issue a person filed, edit sets only the scores, and posts its --comment on the issue to tell the team why; the summary, description and Fix Version stay the team's to change in Jira, as do its links. On an issue the loop filed, edit --blocked-by makes and deletes the links to the epic's open items. For todo-item finish, the config names the workflow transition that finishes an item and the status it leads to, both as Jira shows them: jira-finish-transition = "Mark as done" and jira-finish-status = "Done". Finish then moves the item's issue by that transition. It refuses a transition that leads to another status, or to one Jira doesn't count as done, and fails where the config sets neither. The four things not supported for a plan outside the checkout, above, are not supported for a plan in Jira either.

A client that keeps its goals and audience in an epic's description names that epic as the goals file: goals-and-audience = "jira:https://acme.atlassian.net/browse/ABC-12", which may be the plan's own epic. Such a config keeps its plan in Jira too, and reads both with the same env-file. The description needs ## Goals and ## Audience as headings, level-2 headings in Jira's editor. project-record open goals-and-audience prints a file holding the description's text, and project-record save writes it back, except a change to ## Goals or ## Audience: edit those two in Jira. A save rewrites the whole description from markdown, which keeps no mention, macro or block id that markdown can't hold. Whoever may edit that description sets the premises every worker and judge follows, so keep its edit rights to the people who own the project's goals.

To name a chunk's branch, worktree, commits and pull request by the issue key, as in ABC-123 and ABC-123 - …, set these three templates, with your Jira project's key in place of ABC: branch = "ABC-{id}", commit-title = "ABC-{id} - {summary}" and pull-request-title = "ABC-{id} - {summary}". project-config --help says how the templates work.

mkdir -p ~/.claude-projects/acme && cd ~/.claude-projects/acme
git init
$EDITOR config.toml
git add config.toml && git commit -m "Add the config"
cd ~/code/acme-billing && ~/.claude/bin/project-config

The last line prints each setting's path once the config is complete.

do-epic keeps its settings per machine, not per project, in ~/.claude-projects/do-epic/, two files for every epic:

  • config.toml sets jira-url, the site, such as https://acme.atlassian.net; env-file, the file holding ATLASSIAN_EMAIL and ATLASSIAN_API_TOKEN, a path that starts with / or ~/, outside the clone folder and every folder of ~/.claude-projects; and repoless-model, the model that works an item with no repo. It may also set clone-folder, where a missing repo is cloned, ~/code if left out; language, the language of Jira text, English if left out; and jira-finish-transition with jira-finish-status, which name the workflow transition that moves a finished chunk's issue, and closes a finished epic, and the status it leads to, such as "Mark as done" and "Done". Set both or neither: without them do-epic moves no issue to done and closes no epic, and a chunk that finishes stops with that reason.
  • config.toml fits do-epic to a team whose own automation moves issues, such as a CI job that moves an issue when its pull request merges. Two settings do:
    • jira-unblocking-statuses lists the statuses at which an issue's work has landed though Jira doesn't count it done yet, such as ["Release Ready"], in upper or lower case. An issue in one of them takes no chunk and no longer blocks the issues it blocks, and --status names the statuses beside each blocker. A status Jira counts as done always does both. The release reviews, which are the epic's last chunk, still wait until Jira counts every issue done: run do-epic <EPIC-KEY> then, to start them.
    • jira-automation-moves-issues = true keeps do-epic from moving the issue of a finished chunk in a repo: the automation moves it, and do-epic waits for that move before it starts what the issue blocks. An issue without a repo has no pull request, so do-epic still moves it, with jira-finish-transition. The setting needs jira-unblocking-statuses, which names the status the automation gives an issue whose pull request merged.
  • config.toml names the statuses do-epic itself gives an issue whose chunk merges into an epic's working branch, in a repo whose config sets epic-branch. A team's automation moves an issue only for a pull request into the default branch, so there do-epic makes both moves, whatever jira-automation-moves-issues says. jira-pull-request-open-status, such as "Code Review", is the status of an issue whose chunk parks with its pull request open; a pull request that opens and merges within one run of the worker skips it, unless the workflow leads to the merged status only through it. jira-pull-request-merged-status, such as "Release Ready", is the status once the pull request has merged into the working branch. jira-unblocking-statuses must list it, and an issue that has it counts as done when the release reviews and the finishing chunk fall due, since both come before a person merges the working branch. Without it, do-epic moves a finished chunk's issue to done. Where jira-automation-moves-issues is set, it stops instead and asks you to move the issue.
  • config.toml names how do-epic moves a parent issue whose sub-tasks a person filed. Once every sub-task is done, the parent moves to done by jira-finish-transition; without that setting it stays. Before that, once each sub-task is done or in one of jira-unblocking-statuses, the parent moves by the transition jira-sub-tasks-landed-transition names, such as "Release Ready"; without that setting it stays. The transition must lead to one of jira-unblocking-statuses, or do-epic doesn't make it. do-epic makes these moves as each run plans and as each chunk finishes, and --dry-run prints them. A parent that is done, or already in one of jira-unblocking-statuses, never moves back. A move that is not made is said, and the run goes on.
  • config.toml also says how a starting chunk's issue shows on its team's board. A starting chunk always assigns its issue to the account do-epic works as, unless someone else holds it; that issue keeps its assignee, and moves and joins the sprint like any other. jira-start-transition names the workflow transition that then moves the issue, such as "In Progress"; an issue whose work has started already keeps its status. jira-sprint-board is the ID of the board whose active sprint the issue joins, such as 6. Where a setting is left out, do-epic doesn't take its step.
  • config.toml may set jira-finding-type, the issue type do-epic files a finding as, and jira-review-type, the one it files a repo's release review as, such as "Feature" and "Chore". Both are Task where left out. do-epic doesn't file anything where the Jira project lacks the type, and says which types it has.
  • config.toml may set sub-task-summary, which shapes the summary of each sub-task do-epic files for an issue that changes several repos, such as sub-task-summary = "{label}: {Summary}". {label} is the team's label for the repo, else the repo's name, and {Summary} is the issue's summary with a capital first letter. It must hold {Summary}. Without it a summary is [<repo>] <the issue's summary>.
  • config.toml may end with a [label-repos] table, for a team that already labels its issues by repo. Give it one line for each such label: the label, then the repo's name, such as twu-4 = "tenant-web-ui-4". do-epic reads such a label as it reads its own repo:<name>. Where the label is the repo's name, map the name to itself, as in core-4 = "core-4". Where several lines name one repo, do-epic writes the label of the first. Write every other setting above the table.
  • repo-rule.md is prose that says how to tell an item's repo, such as "a label that equals a repo's name names that repo". It may not be blank. do-epic <EPIC-KEY> uses it to pick where each open issue without such a label is worked, and records the pick as a label. For a repo that is the team's own label from [label-repos], else repo:<name>; for work of Claude's that changes no repo, do-epic-claude; for a task of yours, do-epic-human. Where the rule leaves an issue unclear, do-epic asks you on the terminal. Answer with the label, or with Enter alone to leave the issue waiting. Change a pick by editing the label in Jira.

An epic's description states the formula that puts its issues in order: once under ## Scoring, on a line of its own and inside backticks, such as `Score = 100 * V / (2**S + 32)`. do-epic starts the epic's issues by that score, highest first, with each blocker before what it blocks, whatever their order on the board. Where two or more issues may start, it scores each of them that holds no scores, a person's included, against the epic's goals and the goals of the issue's repo, and tells the team the scores in a comment on the issue. It doesn't score a task of yours, and it keeps the scores an issue already holds. On the board it re-ranks only the issues it filed, so a person's issue keeps the rank the team gave it. Without that line do-epic says so, doesn't score anything and starts the issues in the backlog's order.

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.

Update

Move ~/.claude to the newest release:

~/code/claude-config/bin/deploy-release

It prints CHANGELOG.md's section for each version it moved past: do what each asks, such as a new step under Install. deploy-release --help says what else it checks.

It refuses while a file ~/.claude tracks has an uncommitted change, such as a hook Claude Code wrote into settings.json; a model picked with /model is no such change. Read the change first, as in git -C ~/.claude diff HEAD -- settings.json. When it holds a credential, such as a token in env or mcpServers, move that out of the file: a token in env to the shell profile, a server in mcpServers to ~/.claude.json with claude mcp add --scope user. Then carry the change into ~/code/claude-config on a branch of its own, merge it through a PR, and cut a release.

Release

Once the next release holds no item in todo.md and its release review has landed, cut it from ~/code/claude-config:

bin/deploy-release --cut

It renames ## Unreleased in CHANGELOG.md to the version and merges that through a pull request, since nobody can push to main. Then it tags the merged commit v<version>, pushes the tag, and moves this machine's ~/.claude to it. Where a step fails it stops with the reason, and a rerun continues where it stopped. deploy-release --help lists the steps. Each other machine takes the release with Update.

Tools

Install puts only loop-claude on PATH; call the others by their path, such as ~/.claude/bin/metric-bench, from the project's checkout. Those 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.
  • 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.
  • deploy-release [--cut] [<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, 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-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.
  • 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.
  • 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.
  • 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.
  • 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.
  • score-outcomes [L E I S] shows what each finished item's chunk measured beside the scores the item was guessed at, to score a new item by. Per chunk it also shows code health's two counter-signals, misread findings and later fixes, and how many of the human's answers reversed a worker's choice; score-outcomes --help states the report.
  • settings_filter.py is git's clean filter for settings.json: it drops "model" and sorts the keys. .gitattributes sets the filter settings on settings.json, and Install's git config line makes this script that filter.
  • statusline.py renders Claude Code's status line; settings.json → statusLine runs it.
  • subagent-rung [--plan] <model> <L> prints the Agent tool's model and effort for a subagent's task, picked by its L from the project's model on the project's routing ladder, and with --plan never below the project's rung; subagent-rung --help states the rule.
  • task-bench --image <image> --test <shell text> [<options>] plants bugs that the tests catch, at the places the comprehension seats found hardest, has Haiku fix each at the base and at the head, and prints how often the fix passes and what it took. It needs docker and a token from claude setup-token; task-bench --help says how it plants, runs and checks. It leaves a digest of why runs failed. task-bench gather starts a claude on the project's rung, which files a plan item for each place the digest shows to be hard; then gather removes the bench's folder, digest and streams.
  • todo-item reads and changes a project's plan, whatever holds it: list prints the items in the plan's order and show <ID> one item's row and detail; add … files an item under the next free ID, edit <ID> … sets an item's cells or detail, and move <ID> --release <version> sets an item's release; finish <ID> removes a finished item and adds the bullet passed with --changelog to CHANGELOG.md, except for a plan kept in Jira. Each change ranks a markdown plan. todo-item --help states the flags.
  • touch-predictions record <ID>... appends what a chunk's items were predicted to touch, under Touches: in their details, beside the files and parts its branch touched, to the record the config names as touch-predictions; touch-predictions --help shows the spelling and how a part is named. chunk-preflight reads the same predictions to name the items that may start chunks at once.
  • wait-for <file> [<pattern>] [--timeout <seconds>] waits until a file a background job writes holds a line matching the pattern, and prints it.

Packages under bin/

bin/ is the import root: each launcher puts it on sys.path, so a module imports another by its path under bin/, such as from claude_code.entries import parse_entry. Each tool's package holds its tests. Beside the packages, bin/'s root holds only the launchers, the tools of one file with their tests, test_env.py, failure.py and setup.cfg. failure.py's Failure, which modules across bin/ return for a failed step, belongs to no single package. agent_cycle/, atlassian/, branch_chunks/, chunk_driver/, claude_code/, command_lines/, forge/, git_cli/, loop_effects/, loop_state/, machine_load/, model_routing/, notifier/, plan/, plan_store/, record_store/, release_plan/, review_rules/, rung_replay/, text_files/ and transcript_archive/ serve more than one tool. No package imports one that imports it back, and a package's doubles.py holds the test doubles that other packages' tests use, so no module imports a test_* module of another package; repo_checks/test_package_cycles.py checks both. No Python file of the repo, workflow-bench/'s included, uses mock.patch, which repo_checks/test_no_patched_globals.py checks.

  • adf_codec/ converts markdown to ADF, the rich text of Jira Cloud and Confluence, and back, in a throwaway container running a pinned @larvit/adf-codec. It builds the container's image inside a heavy slot.
  • 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.
  • atlassian/ holds what the Jira and Confluence backends share (client.py): one Atlassian account's credentials, the request both backends send, and each service's error messages. jira.py holds what every reader of Jira shares: a search read page by page, the key, fields, links and property of each issue it finds, checked for their shape, and the transition that finishes an issue, for plan_store and do_epic.
  • 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 and routing_figures. It imports reading_cost's record path.
  • 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.
  • 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.
  • deploy_release imports release_plan's release_standing.
  • 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.
    • 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.
    • 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.
    • 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.
    • config.py reads its machine-wide settings, importing project_config's settings and model_routing's ladder file, and epic_record.py reads and writes an epic's description by section, language line and cap line, through record_store's EpicDescription.
    • repos.py finds a repo's checkout and project config by its name, and clones a missing checkout from the host and owner of the epic's other repos, through forge's url_beside.
    • repo_pick.py asks claude, by repo-rule.md, where an epic item is worked, and records the answer as a label on the issue.
    • split.py has claude predict from the code which repos an item changes, and files a sub-task per repo under it where there are several.
    • parent_moves.py moves a parent whose sub-tasks a person filed, once those have landed or are done.
    • 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.
  • forge/ tells a GitHub origin from a Gitea one, names a repo beside an origin's and runs that forge's CLI (commands.py), finds a pull request, lists the ready ones and reads its checks, once or until they settle (pulls.py), and reads a pull request's review state (reviews.py), for chunk_preflight, chunk_pr, deploy_release, do_epic and larv_review.
  • git_cli/ runs git for every tool (git_repo.py), reads the git calls in a shell command (git_command.py), and keeps an epic's working branch level with the default branch (epic_branch.py).
  • judge_replay imports agent_cycle's judge and verdicts, and chunk_driver's premises, records and ANSWER_DESTINATIONS.
  • 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.- loop_state/ holds where loop-claude and do-epic keep their files (paths.py), which rung_replay reads too.
  • 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.
  • 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.
  • 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_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.
  • rank_todo.py, settings_filter.py and statusline.py are tools of one file each, tested beside them.
  • 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.
  • repo_checks/ tests the repo itself.
  • rest_client/ sends a JSON request to a REST API and reads its credentials from an env file, for notifier, atlassian and record_store.
  • 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.
  • 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.
  • task_bench/ holds task-bench, which plants bugs in a Go project and has Haiku fix them in containers.
  • test_env.py serves the tests.
  • 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.
  • transcript_archive/ stores loop-claude's transcripts. Its project_key.py names each project's archive folder, loop-claude session and models-file entry.

Test

Test on the host with bin/run-tests, which runs pytest through uvx, pinned in bin/run_tests/main.py. It prints each failing test with its error and pytest's summary line, and saves the whole output to a file whose path it prints. It passes on any test paths or pytest options it is given, such as bin/run-tests bin/chunk_pr -x. It needs uv on PATH, which fetches pytest, pytest-xdist and mypy, a Docker daemon, Linux, and a user other than root; a test that lacks one fails, naming it. pytest-xdist runs the tests in one worker per CPU of a heavy slot (docs/decisions.md → bin/: the tools support only the latest stable Python, …). python3 -m unittest discover -s bin -p 'test_*.py' runs the same tests one at a time, with the same needs. Test the bench's scripts with python3 -m unittest discover -s workflow-bench -p 'test_*.py'.

bin/do-epic-e2e checks do-epic against a real Jira site, which run-tests never reaches. It makes an epic with issues and sub-tasks in a sandbox project, runs do-epic --file, --record-decision and --close-epic against it in a home folder of its own, and deletes the epic and its issues when it ends. The sandbox project must be team-managed, with a Done transition, and its account must be able to create, edit, transition, comment on and delete issues there. Set DO_EPIC_E2E_JIRA_URL to the sandbox site's address, DO_EPIC_E2E_ENV_FILE to the absolute path of the file holding the account's ATLASSIAN_EMAIL and ATLASSIAN_API_TOKEN, and DO_EPIC_E2E_PROJECT to the project's key. The command fails, naming each setting that is missing. It needs a Docker daemon, as run-tests does.

CI runs ci.sh on every pull request, and main doesn't merge anything until it passes. The script runs the same tests on the committed HEAD in a pinned Python container. Run it under run-heavy to reproduce a CI failure, with Docker on PATH and its socket at /var/run/docker.sock, which the container shares.

To mutation-test the lines a branch changes, run ~/.claude/bin/run-heavy ~/.claude/bin/mutate-changes --prefix 'uvx --python "$(command -v python3)" --with pytest==9.2.0 --from "mutmut>=3,<4"' in its checkout.

Tracking a new file

.gitignore is an allowlist. Track a file by negating it and its parent directories, then confirm with git check-ignore -v <path>:

!docs/
!docs/*.md
S
Description
Authored half of ~/.claude: instructions, agents, skills, principles, settings
Readme 53 MiB
Languages
Python 97.6%
HTML 2.3%