Free rules / Parallel agents
Parallel Agents Rules for AI Coding (free)
AI coding tools can run several agents at once, but two agents editing the same working tree will overwrite each other. This free rules file tells your agent to isolate each run in its own git worktree, how to start one in Cursor and Claude Code, and what to do when you merge the results.
If you used Conductor Cloud
Conductor's official announcement (Nov 4, 2026) says Conductor Cloud goes read-only on Friday, Nov 13, 2026: you can still read old chats and export data, but you can't send new messages. On Friday, Nov 20, 2026, Conductor begins deleting Cloud user data. Export before Nov 20: right-click a workspace and choose Transfer to local, or go to Settings → Account → Export data. The announcement does not name a time of day or time zone. Local Conductor keeps getting new models and critical bug fixes until early 2027. These rules are a docs-checked way to keep running several agents in isolated git worktrees after you move the work to your own machine, not a Conductor replacement product.
How to start a worktree
| Tool | What the docs say |
|---|---|
| Cursor (Agents Window) | Start or move an agent into a worktree. Cursor creates a separate checkout for that agent. |
| Cursor (IDE) | /worktree for one isolated run. /best-of-n runs the same task across multiple models, each in its own worktree; it does not merge the results back for you. |
| Cursor CLI | agent --worktree [name]. Checkouts go under ~/.cursor/worktrees/. |
| Claude Code | claude --worktree <name> or -w. By default under .claude/worktrees/ at the repo root, on a new branch. Add that folder to .gitignore. You can also ask Claude to “work in a worktree”, or set isolation: worktree on a custom subagent. |
| Manual (any tool) | git worktree add -b <branch> <path>, then open that folder in the tool. List them with git worktree list. |
How to use the file
- Cursor: save the file below as
.cursor/rules/parallel-agents.mdc.alwaysApply: trueloads it in every chat. - Claude Code, Codex and others: paste everything below the
---header intoCLAUDE.mdorAGENTS.mdin your repo root. - Ask the agent to start each parallel task in its own worktree, for example: “Start this in a worktree, don't edit my main checkout, and list the worktree path before you change files.”
The rules file
---
description: Run several coding agents in parallel without colliding on the same checkout
alwaysApply: true
---
# Parallel agents (worktrees)
Checked against Cursor's worktrees and CLI docs, Claude Code's worktrees and "Run agents in parallel" docs, and the official git-worktree page, on 2026-11-11. Where those docs are silent, these rules say so.
## Isolate each agent
- Give each agent its own git worktree (a separate working directory and branch, sharing the same repository). Do not let two agents edit the same working tree at once.
- Git refuses to check out a branch that is already checked out in another worktree, unless you pass `--force`. Do not use `--force` to share a branch across worktrees.
- If worktrees are not available (Claude Code's agent teams do not isolate teammates in worktrees), partition the work so each agent owns a different set of files. The docs do not require a specific folder-naming scheme.
## How to start a worktree
- Cursor, Agents Window: start or move an agent into a worktree. Cursor creates a separate checkout for that agent.
- Cursor, IDE: `/worktree` for one isolated run. `/best-of-n` runs the same task across multiple models, each in its own worktree; it does not merge the results back for you.
- Cursor CLI: `agent --worktree [name]`. Checkouts go under `~/.cursor/worktrees/`.
- Claude Code: `claude --worktree <name>` or `-w`. By default the worktree is created under `.claude/worktrees/` at the repo root, on a new branch. Add `.claude/worktrees/` to `.gitignore`. You can also ask Claude to "work in a worktree", or set `isolation: worktree` on a custom subagent.
- Manual: `git worktree add -b <branch> <path>` and open that folder in the tool. List them with `git worktree list`.
## Set up the fresh checkout
- A worktree is a fresh checkout: install dependencies there. Do not symlink `node_modules` or other dependencies into the worktree (Cursor's docs advise against it; it can affect the main checkout).
- Cursor: put setup commands in `.cursor/worktrees.json` (`setup-worktree`, or OS-specific keys). Typical: package install, then copy `.env` from `$ROOT_WORKTREE_PATH`.
- Claude Code: initialize the environment in the worktree, or add a `.worktreeinclude` file (gitignore syntax) so gitignored files such as `.env` are copied in automatically. Tracked files are not duplicated.
## After the agent finishes
- Review the result in the worktree, then commit and open a PR from that checkout, or bring the changes back into your main checkout (Cursor: `/apply-worktree`).
- Cursor `/best-of-n` compares runs only. Pick a winner yourself, then commit or `/apply-worktree`.
- Merge one worktree at a time. After each merge, re-run the project's tests. The Cursor, Claude Code and git docs do not prescribe a merge order or a required test command; do not skip the tests the project already has.
- If two branches both changed the lockfile or shared config (`package-lock.json`, `pnpm-lock.yaml`, `tsconfig.json`, CI config), resolve that conflict yourself. Prefer letting one agent own dependency and shared-config changes. The docs do not ban two agents from touching those files in separate worktrees; the clash appears at merge time.
## Clean up
- Cursor IDE: `/delete-worktree` when you are done. Cursor can also auto-clean older worktrees (default cap 25 per machine in Cursor 3.5 and later).
- Claude Code: a clean unnamed session is removed on exit; a named session or a worktree with work prompts you. Subagent worktrees with no changes are removed automatically; ones with changes stay until a periodic sweep (`cleanupPeriodDays`). Use `git worktree remove` (and `git worktree unlock` first if git says it is locked).
- Manual: `git worktree remove <path>`. Git only removes a clean worktree unless you pass `--force`.
Common questions
Why not just run two agents in the same folder?
Two agents editing the same working tree can overwrite each other's files. Cursor's worktrees docs say to use worktrees when you want to start several agents on the same repo without conflicts. Claude Code's worktrees docs say to isolate parallel sessions in separate git worktrees so changes don't collide. Each worktree is a separate working directory and branch that still shares the same repository history.
Can two worktrees check out the same branch?
Not by default. The official git-worktree documentation says add refuses to create a new worktree when the branch is already checked out in another worktree, unless you pass --force. These rules tell the agent not to use --force to share a branch.
I used Conductor Cloud. What do these rules have to do with that?
Conductor's official announcement (Nov 4, 2026) says Conductor Cloud goes read-only on Friday, Nov 13, 2026 (you can still read old chats and export data, but you can't send new messages) and that Conductor begins deleting Cloud user data on Friday, Nov 20, 2026. Export before Nov 20: right-click a workspace and choose Transfer to local, or go to Settings → Account → Export data. The announcement does not name a time of day or time zone. These rules are not a Conductor product; they are a docs-checked way to keep running several coding agents in isolated git worktrees after you move the work to your own machine. Local Conductor itself keeps getting new models and critical bug fixes until early 2027.
If Cursor or Claude Code already creates worktrees, do I still need a rules file?
The built-in commands create the isolated checkout. They do not, on their own, tell the agent how to merge results or what to do about lockfile conflicts. Cursor's docs say /best-of-n compares runs only and does not merge changes back for you. The Cursor, Claude Code and git docs also do not prescribe a merge order or a required test command, so these rules tell the agent to merge one worktree at a time and re-run the project's tests after each merge.
Should each agent own certain folders, and can two agents edit the lockfile?
When each agent has its own worktree, it already has a full copy of the files, so folder ownership is not required. The one official exception is Claude Code's agent teams, which do not isolate teammates in worktrees; those docs say to partition the work so each teammate owns a different set of files. They do not require a specific folder-naming scheme. The docs also do not ban two agents from touching the lockfile or shared config in separate worktrees. If both branches change package-lock.json, pnpm-lock.yaml or similar, the clash appears when you merge: resolve it yourself, and prefer letting one agent own dependency and shared-config changes.
Sources, checked Nov 11, 2026: Cursor Worktrees and Using Agent in CLI; Claude Code Run parallel sessions with worktrees and Run agents in parallel; the official git-worktree page; and Conductor's joining Meta announcement. Where the docs give no rule, this page says so and does not invent one.
Want stack-specific rules too? The Rules Mega Pack ($19) adds a longer launch-safety rule and stack rules for Next.js, FastAPI, Godot, Unity and discord.js.