Most days I have two crews of coding agents working on two tickets, and a third Claude session where I design the next ticket. Each of these sessions gets its context cleared at some point, usually several times a day.

It took me a few weeks to set this up so that clearing a context loses nothing. One rule made it work: when a decision is made, the agent writes it into a file right away. The context only holds the work in progress.

The setup is a few Claude Code skills. They run inside Herdr, a terminal workspace for agents, and use git worktrees managed by worktrunk. Below I follow one ticket from the start to the PR.

Why one long session was not enough

I started with one Claude session per ticket. In that session I read the ticket, discussed the design, and had the agent write the code, review it, fix it and open the PR. For small tickets this works.

For bigger tickets I hit two problems. The context fills up with options we tried and dropped. When the agent starts coding, those rejected options are still in its context next to the chosen one, and now and then it implements the wrong one. After compaction, decisions from an hour earlier can be gone. The second problem is me: I can only follow one session at a time.

So I split the work into roles. Each role runs in its own session, and any session can be cleared or restarted without losing work.

The shape

A ticket goes to the brain, which writes a spec and a queue entry. The context is cleared. The dispatcher reads the queue and starts one coordinator per ticket. Each coordinator runs a crew that ends in a PR. Coordinators send questions to the user through inbox files. Ticket Brain grooms, grills, writes the spec context cleared worktree: brief + spec queue.json: ready Dispatcher keeps the queue, limit: 2 You Coordinator ticket A Coordinator ticket B inbox file Crew implementer + reviewer Crew implementer + reviewer PR PR
One ticket, four roles. Only files cross the dashed line.

Each box in the diagram is a separate session. Each role also has a list of things it must not do, and those limits keep the sessions apart.

RoleDoesNever does
BrainChecks one ticket against the code, discusses the design with me, writes the specWrite production code
DispatcherKeeps the queue, starts coordinators, collects questions for meDesign, run a crew, write code
CoordinatorRuns one crew from the first commit to a green PRWrite code
CrewAn implementer writes the code, a reviewer reads itPush, merge, or post on GitHub

The brain

The brain works on one ticket. Before it reads any code, it switches into the ticket’s worktree. If there is no worktree yet, it creates one with wt switch --create. A worktrunk hook copies .env and the build caches into it, so the crew’s first build is not a cold one. Everything the brain writes from then on is where the crew will look for it.

Then it grooms the ticket. Many of our tickets are written with AI help, and some of their claims are wrong. The brain lists every claim in the ticket (“the tool returns X”, “field Y is missing”) and marks it as true (with a file:line), false (with what the code actually does), or not checked. If a crew starts from a wrong claim, it will implement it.

Next, it grills me on the design. For each decision we make, the brain adds one line to the brief with the decision, the rejected options and the reason. It writes the line as soon as the decision is made. At the end of the session the context is at its fullest, so that is the worst time to write things down.

Then the decisions go into the spec. I use OpenSpec, so that means proposal.md and design.md in a change folder. Anything that stays only in the brief or in the chat is lost when the context is cleared.

The hand-off is a commit, a clean git status and one entry in the queue:

{
  "ticket": "TICKET-142",
  "state": "ready",
  "mode": "openspec",
  "level": 2,
  "worktree": "~/code/app.ticket-142",
  "input": "openspec/changes/ticket-142-retry-on-timeout"
}

At the end the brain tells me the ticket is ready and that I can clear the context, and I clear it.

The dispatcher

The dispatcher reads the queue and starts one coordinator per ready ticket, up to a limit. The limit is 2. The skill gives the reason:

The limit counts the user’s attention, not agents.

Starting more agents costs almost nothing. My time is what runs out. Every crew needs me at some point, for a design question, a failed check or a review comment, and with more than two crews I stop keeping up. Two crews on one laptop also already compete for ports and build caches.

So a ticket only counts as active when it needs a crew or me. It is active while a crew works on it, or when its PR waits for me: a failed check, a requested change, an open thread or an unanswered question. A PR that only waits for a colleague’s approval does not count, so the next ticket can start in the meantime.

The dispatcher also handles questions. Coordinators do not ask me in their own tabs. They write the question to a file and continue with work that does not depend on the answer:

{
  "ticket": "TICKET-142",
  "coordinator": "coord-ticket-142",
  "questions": [{
    "q": "Retry on 503 too, or only on timeouts?",
    "options": ["Timeouts only", "Timeouts and 503"],
    "recommendation": "Timeouts only",
    "why": "The spec names timeouts; 503 needs its own backoff rule."
  }]
}

The dispatcher collects all inbox files and shows them in one dialog, with each coordinator’s recommendation as the first option. I answer the questions of both tickets in one go. With /loop 10m the dispatcher repeats this every ten minutes and gives me a short report.

The coordinator and its crew

The coordinator is the only session that talks to the crew. It starts two opencode agents in Herdr panes:

  • An implementer on a Claude Opus model. It works through the tasks with tests and commits locally.
  • A reviewer on a GPT model in read-only mode. It reviews main...HEAD as the last check before merge.

Review runs in rounds until a round has no findings. The coordinator checks every finding in the code before it sends it to the implementer, because reviewers often rate findings too high. For example, a “cross-tenant, high” finding that only works if the victim sends a malformed token is low in practice. After three rounds the coordinator stops and asks me what to do. By then the fixes usually cause new findings.

The coordinator’s context gets cleared too. It keeps a short work state with fixed keys, such as phase and next, and a new coordinator session starts from there.

The level in the queue entry sets how much the coordinator decides alone. At level 1 it asks me about everything. At level 2 it fixes verified high and medium findings without asking. At level 3 it can also open a draft PR. At every level it asks before a scope change, a merge, a force-push or a comment on GitHub.

Problems I ran into

Herdr does not detect the state of opencode. It showed the agent as idle while it was working, and never as blocked. I wrote a small script that polls the session’s last update time instead. It prints DONE when the turn ends and STUCK after five minutes without a change. So far STUCK has almost always meant a permission prompt.

Our local start script runs kill -9 on whatever holds its ports, and one of them was held by Docker Desktop. Now the coordinator checks lsof and docker ps before the first server start.

When two implementers work in one worktree, they share one git index. A plain git add and git commit from one of them can include files the other one staged. So each implementer commits with a pathspec: git commit -m "…" -- <paths>.

Start scripts print live tokens, and the agents read pane output. The implement prompt asks agents to redact tokens when they quote it. If a token leaks anyway, I end that session.

The retro

After each merge, a retro skill sorts the review findings by cause, for example “test does not prove its name”, and adds one line to a log. It proposes a new prompt rule only when a class keeps coming back. After four PRs the numbers do not show an improvement yet. The latest PR took five crew rounds, and one class appeared twice without getting a rule, then six times before it got one. I will write about this once I have enough PRs to see whether it helps.

Where to start

If you want to try something like this, start with the hand-off. Let one session write its decisions and a spec into the repo, clear its context, and start a second session from those files only. If the second session can do the work without asking what was decided, you can add the other roles one at a time.