memento / worktree setup

Run several coding agents on one repository: git worktree setup

Give each agent its own folder and its own branch, and tell each one which files it holds. Type your repository and how many agents; the commands and the rule block below are written in this page, nothing is sent.

Optional: the files each agent holds

1. Commit the rules, in CLAUDE.md

Paste this block into CLAUDE.md at the repository's root and commit it first, so every worktree starts with it.

2. Make one worktree per agent

From the repository's root: a folder beside it and a new branch for each agent.

3. Start each agent in its own folder

One terminal each.

4. Merge and clean up

From the repository's root, once each agent's task is done. A conflict here is two agents that changed the same lines.

Why a worktree per agent

Two agents in one checkout share one set of files. Each reads a file, plans a change and writes it; the second write wins and the first agent's work is gone, often with no error. A worktree gives each agent its own folder on its own branch from the same repository, so their edits never meet until you merge.

What a worktree does not do: it does not tell agent 2 that agent 1 is already changing src/routes.ts. You find that out at merge time, after both spent their work. The Holds column is the cheap fix on one machine; check your git log for files two sessions already wrote within the hour, and add a pull request check that names the other open pull requests on the same files.

Agents on more than one machine, or too many to split by hand? memento Team keeps one claim list for every agent: a session claims a path before it edits, and the next one is told who holds it. 10 USD per agent a month. Pre-order memento Team