parallel-workspaces
Skill1 starsChanged 3 months agoMITView on GitHub
Give each parallel agent its own checkout, environment, and slice of shared numbering so they do not corrupt each other, and tear the workspaces down at the right time. Use when spawning multiple agents against one repository, setting up git worktrees for concurrent work, or when the user says "run these in parallel", "agents are clobbering each other", "my worktree got switched out from under me", or "clean up the worktrees".
- Deletes or force-pushes
In this repository5 other files it gives its agents.
- fleet-review-loopSkill
- handoff-briefSkill
- lucidSkill
- rebase-recoverySkill
- visual-reviewSkill
The file
We split this skill into the rules it gives an agent
1 rule. About 0 are common, 1 is distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 39
Verify the removal rather than assuming it.
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Parallel workspaces
Agents working in one repository collide in four places: the checkout, the environment, shared numbering, and local ports. Each collision is silent and each surfaces later as a bug in something unrelated.
One checkout per agent, never shared
Take a fresh dedicated worktree for every agent. Do not point two agents at one directory, and do not reuse a worktree another session opened.
A shared checkout fails in a way that reads as your own bug. The other session stashes your uncommitted work, or switches the branch, and your next command runs against a tree you did not write. The symptom appears in the code you are reading, so that is where you look, and the cause is the directory you are in.
git worktree add ../wt-<task> -b <branch>Tell each agent the absolute path of its own worktree, and tell it not to cd
elsewhere in the repository.
Tear down by phase, not on a timer
Teardown timing differs by what the agent was doing, and getting it backwards costs you the work.
| Agent | Remove when |
| Reviewer | Its findings have landed. Reviewers hold no state you need again. |
| Implementer | Its PR is open and review is finished. Removing earlier destroys the context that makes the agent resumable, so the next round starts from nothing. |
Verify the removal rather than assuming it. Deleting the directory leaves the entry in the registry, which keeps holding the branch:
$ git checkout feature
fatal: 'feature' is already used by worktree at '/tmp/wtb'git worktree list marks the entry prunable. git worktree prune clears it
and releases the branch. Removing a worktree with git worktree remove does
both at once, so prefer it over rm -rf.
Claim shared numbers before writing
Anything sequential is a shared resource that parallel agents allocate identically: migration numbers, ADR numbers, fixture IDs, changelog entries. Two agents each read "the highest is 0065" and both write 0066.
Have each agent claim its number as its first action, in a place the others can see, then write the file. Renumbering afterward is worse than it sounds, because the number is already referenced from commit messages, branch names, and other documents by the time you notice.
The same applies to any append-only ledger. Reads are safe; concurrent appends are not.
Pass an environment, do not inherit one
An agent launched from a configured shell inherits that shell's variables. Some of them break the build in ways that look like code failures: a shared build cache directory that makes each agent's compiler output collide, a stale authentication context that makes every request fail as unauthorized.
State the variables each agent needs. Unset the ones it must not inherit. When a tool behaves differently inside the agent than it does in your terminal, compare the two environments before you read any code.
Give each agent its own ports
Dev servers, test fixtures, and databases bind to a default port, so the second agent to start either fails or, worse, attaches to the first agent's instance and passes tests against the wrong build. Assign a distinct port per agent and pass it explicitly.
When something breaks, check isolation first
A failure that appears only under parallel execution is a collision until proven otherwise. Before debugging the code, confirm the agent had its own checkout, ran with the environment you intended, and did not share a port or a number with a sibling. That check takes a minute, against a session spent debugging the wrong layer.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

