「Behind!」:餐廳廚房如何啟發平行編碼智能體協作
"Behind!": what a restaurant kitchen teaches parallel coding agents
文章提出以工作目錄隔離、鎖定式任務認領及逾期認領釋放,管理同一程式碼庫中的多個 Claude Code 或 Codex 工作階段。具體做法包括每個工作階段使用獨立 Git worktree 和分支,在主工作目錄的 claims.md 記錄任務、工作階段與時間,並在鎖定下認領;例如,超過兩小時且沒有相關提交的認領可重新分配。
Run two or three Claude Code or Codex sessions on one repository and sooner or later one of them rewrites the file the other just fixed. Neither did anything wrong. Nobody told them who had what.
Kitchens solved this a long time ago with three cheap things. All three work for agents today, for free.
1. Stations: one worktree per session
A cook never works on another cook's board. Give each session its own board:
git worktree add ../app-auth -b auth
git worktree add ../app-billing -b billing
Each session starts in its own directory on its own branch. Two edits to the same file stop being a silent overwrite and become a merge you can read.
2. The rail: one claims file, written under a lock
Stations alone do not stop two cooks from making the same dish. The rail does: a ticket says what is being cooked and by whom. For agents, that is one file in the main checkout, say claims.md, one line per task:
auth-refresh | session-a | 2026-10-22T14:05Z
Add one rule to your CLAUDE.md or AGENTS.md: before you start a task, read claims.md; if the task is there, pick another; if not, append your line. Append it under a lock, so two sessions cannot claim at once:
flock claims.md -c 'grep -q "^auth-refresh |" claims.md || echo "auth-refresh | session-a | $(date -u +%FT%RZ)" >> claims.md'
- "Behind!": the claim has a lease
A ticket nobody is cooking goes back on the rail. Sessions die, hit their context limit, get closed at night. So a claim carries its time, and the rule says: a claim older than, say, two hours with no commit behind it is free to take. The last thing a session does before it stops is delete its own line.
What this does not fix
- The rule lives in an instruction file, so a session can skip it. Put the check in a hook if it matters.
- It only works on one machine, or where everyone mounts the same file.
- Nobody sees the whole board at a glance; you read the file.
That is enough for a solo developer with a few sessions. It starts to hurt with several people, each with their own agents, on their own machines.
Disclosure: I build memento Team, which does this on your own machines: https://overflow.games/memento/?ref=devto
來源:DEV Community · dev.to