The /team lead now only assigns tickets. Watching, PR follow-ups, merge checks and recovery moved to scripts and a merger fork, so the lead's context holds only conversation and assignments.
What was wrong with the old setup?
Until now the lead session in /team both assigned work and did work. It reused named worker slots (w1, pi, oc1) and reset them between jobs. A heartbeat cron woke the lead every 30 minutes, and every CI failure and review comment passed through the lead on its way to a worker, so everything piled up in the lead's context.
Retrospectives kept showing the same friction: missed pushes, a 5-hour foreground run, and duplicate implementation during a handoff. All of it traced back to long-lived peer workers.
The trigger was a video about DeepSeek's "super agent". In that design a router session only assigns ticket-sized work, workers isolated in git worktrees do the work, and a watchdog keeps watch. I read the transcript alongside web coverage, wrote an analysis note, and built the plan on that note.
What changed?
The lead is now a router that only assigns. The unit of work is a ticket. team.sh ticket add creates one and team.sh start <id> launches it, which makes a ticket worktree and opens a fresh Claude session in a herdr pane. That session owns everything from plan to draft PR.
watch handles waking. It's a bash loop that spends no tokens, wakes the lead only on anomalies like STUCK or PR-ORPHAN, and never sends the same line twice. PR follow-ups such as a failed check or a new review skip the lead and go straight to the ticket session. Because PR comments are untrusted input, they arrive as a single pointer line instead of the full body.
Every merge goes through a merger fork the lead spawns:
team.sh merge <id> --sha --approved
The script does the judging: changes after the reviewed sha, scope, protected paths, checks. For M and L tickets it also confirms the approved plan's baseline hash hasn't moved. If it hits the same FAIL twice, it stops.
If the lead goes through compact, clear or resume, a SessionStart hook injects team.sh brief. The brief stays at or under 10,000 characters and goes to the lead session only.
What did I settle first?
I settled two things before writing code.
First, no compatibility code for the transition. I had decided not to use /team while rebuilding it, so there was no reason to read old state files, and I could go straight to the end state.
Second, pi and opencode went from resident workers to stage executors. The friction in the retrospectives came from long lifetimes, so I removed the lifetime. Each now runs once, detached, through team.sh stage review|research|s, and leaves behind only a result file and an rc.
Role boundaries live in a hook. If a session carrying TEAM_ROLE tries to merge or push to a protected branch, deny-dangerous.sh blocks it. I considered relying on --disallowedTools alone, but when I measured it, rtk turned Bash calls matching allow rules into allows and skipped the CLI deny.
What did review catch?
Plan review raised 2 Criticals.
The first was the plan approval hash. The draft hashed the whole plan file, but the implementation step keeps editing status, evidence, ticks and Outcome after approval. Left that way, every PR of size M or larger would have been blocked at merge, so now only the baseline part gets hashed.
The second was watch's state file. Sharing the lead's state file meant hitting a lock that rejects instead of waiting, so either watch dies or the lead's commands get refused. watch got a file of its own, and each file now has a single writer.
During implementation, several slices went back and forth between review FAIL and fixes.
The final full review caught 2 more things. The Critical was settings.json: the autoMode text allowing /team Merge and the /team sessions environment text still described the old structure. I rewrote both for the router, approved them, and applied them. The Nice was that the hook can't see a call held in a variable, like $T merge, so team.sh merge now refuses on its own inside a TEAM_ROLE session.
Which paths did I drop?
Running stages synchronously with pi -p. The lead's Bash would be blocked the whole time, so stages run detached and send STAGE-DONE when they finish.
Shipping the test split (s01) as its own PR. One plan is one PR and merges are squashed, so the only gain would have been a smaller diff. All 118 files went into one PR, with a note to review it 12 slice commits at a time.
What did it cost?
14 sessions in one day, about $257, nearly all of it on Opus. harvest, review, simplify, qa, ship and land each ran once.
Lines came out at +6278/−6315, a slight net removal. I split test-team.sh into 25 per-area files and checked right after the split that the case count was still 1285. tests/retired.sh keeps removed names from creeping back.
What's still open?
There's been no real run yet, because until the merge the installed copy points at the old code. After merging I'll run it on 3 or more tickets in a real repo and record cost and a comparison in the ledger.
The role guard still has blind spots, such as a gh held in a variable or a merge inside a script file. Those are written down in the docs. The dead code left in pi's /team branch goes away in a follow-up PR.
Build stats
| Model | Input | Output | Cache read | Cache write | USD |
|---|---|---|---|---|---|
| claude-opus-5-5 | 5,634 | 2,698,612 | 622,913,783 | 12,084,935 | $257.11 |
| claude-sonnet-5-5 | 100 | 23,230 | 1,959,532 | 347,408 | $1.33 |
| Total | 5,734 | 2,721,842 | 624,873,315 | 12,432,343 | $258.44 |
Counted from 14 session transcripts at 2026-11-14T02:10Z (PR #231, sessions 2026-11-06 to 2026-11-06). Tokens include subagents; USD is list price. Code: +6,278 / −6,315 lines.