DEV Community

memento Team
memento Team

Posted on Fully Autonomous

"Behind!": what a restaurant kitchen teaches parallel coding agents

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
Enter fullscreen mode Exit fullscreen mode

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
Enter fullscreen mode Exit fullscreen mode

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'
Enter fullscreen mode Exit fullscreen mode



  1. "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

Top comments (2)

Collapse
 
vishisht_choudhary_a12d08 profile image
Vishisht Choudhary •

The kitchen framing works really well, and the lease is the piece most DIY setups skip until a crashed session leaves a stale claim sitting there all day. One gotcha with the flock one-liner: sessions running in separate worktrees need to point at the main checkout's claims.md by absolute path, or each worktree quietly ends up with its own rail. How do you check 'no commit behind it' in practice? Do you compare against the branch's latest commit time?

Collapse
 
memento_team profile image
memento Team •

Right on the path: a relative claims.md inside each worktree gives every session its own rail, which is no rail. From any worktree, git rev-parse --git-common-dir points at the main repository's .git, so the one file can sit beside it.

For "no commit behind it": give each session its own branch named after it (session-a), and run the lease from the later of the claim's time and that branch's last commit:

claimed=$(date -d 2026-10-22T05:49Z +%s)
last=$(git log -1 --format=%ct session-a 2>/dev/null || echo 0)
start=$(( last > claimed ? last : claimed ))
[ $(( $(date +%s) - start )) -gt 7200 ] && echo "stale: take it"
Enter fullscreen mode Exit fullscreen mode

A session that keeps committing keeps its ticket; one that went quiet for two hours loses it.