Delagen Agent Worktrees
Delagen Agent Worktrees is the free editor extension from Delagen AI for isolating AI coding agents in git worktrees. Create, list, open, and remove checkouts under .worktrees/<slug>, copy gitignored local files via .worktreeinclude, assign lane-scoped env overlays, and run optional post-create setup — so Cursor and VS Code chats (and human teammates) can work in parallel without stomping the same working tree.
Built for developers and AI-assisted teams who run multiple agent sessions, feature branches, or review sandboxes side by side. Local-only: no account required, no network calls, no telemetry.
What this extension owns vs what you own
| Layer |
Owner |
Git worktree lifecycle under .worktrees/ |
This extension |
Copy gitignored files (.worktreeinclude) |
This extension |
Lane id + declarative env overlay (.agent-worktrees.json) |
This extension |
| Starting databases, Redis, Docker services, workers |
Your setup script / Compose — not the extension |
Checkout isolation is the easy half. Runtime services stay in scripts that read AGENT_LANE / your overlay file.
Why use it
- Parallel AI agents — each Cursor / VS Code agent chat gets its own branch and folder under
.worktrees/
.worktreeinclude — same de-facto contract as Conductor / Claude Code: copy matching gitignored files into new worktrees before setup
- Lane env overlays — assign
AGENT_LANE (1–9 by default) and optional port/DB URL templates from .agent-worktrees.json
- Post-create setup — run your own script or the Cursor-compatible
.cursor/worktrees.json contract (setup-worktree-unix / setup-worktree-windows / setup-worktree), with AGENT_LANE in the environment
- Multi-root friendly — pick which git root in a multi-folder workspace
- Privacy-first — only local
git and scripts you configure; nothing phones home
Gallery


Screenshots are regenerated per version with pnpm screenshots (also during pnpm package) and archived under media/screenshots/archive/vX.Y.Z/.
Install
- Cursor: Extensions → search
delagen-ai.delagen-agent-worktrees
- VS Code: Marketplace → search Delagen Agent Worktrees by delagen-ai
- Requires VS Code 1.85+ or Cursor, and git on your PATH
If you still have the legacy id delagen-ai.agent-worktrees (0.1.x), uninstall it and install this extension instead.
Commands
| Command |
Action |
| Agent Worktrees: Create |
Pick a git root, enter a slug, create branch + worktree, copy includes, assign lane, run setup |
| Agent Worktrees: List / Open |
Quick-pick managed worktrees and open the folder |
| Agent Worktrees: Remove |
git worktree remove (optional force after confirm) |
| Agent Worktrees: Run Post-Create Setup |
Re-run include + lane env (reuse lane) + setup for an existing worktree |
| Agent Worktrees: Refresh |
Refresh the activity-bar list |
Also available from the Agent Worktrees activity-bar view.
Create order
git worktree add under .worktrees/<slug>
- Copy matches from repo-root
.worktreeinclude (if present)
- Allocate a free lane, write
.agent-worktree.json + .env.agent-worktree.local
- Run post-create setup with
ROOT_WORKTREE_PATH and AGENT_LANE
.worktreeinclude
Optional file at the repository root. Gitignore pattern syntax. Only files that match and are gitignored in the source checkout are copied. Tracked files are never copied. Existing destination files are never overwritten. If the file is missing, nothing is copied (no silent .env* default).
.env
.env.local
config/secrets.json
.agent-worktrees.json (lane contract)
Optional repo-root config. Without it, the extension still assigns AGENT_LANE and writes a minimal overlay.
{
"maxLanes": 9,
"envFile": ".env.agent-worktree.local",
"offsets": {
"PORT": { "base": 3000, "stride": 1 },
"API_PORT": { "base": 4000, "stride": 1 },
"DB_PORT": { "base": 5432, "stride": 1 }
},
"templates": {
"DATABASE_URL": "postgresql://postgres:postgres@127.0.0.1:${DB_PORT}/${REPO_SLUG}_lane_${AGENT_LANE}"
}
}
Offset formula: base + stride * lane (lane 1, base 3000, stride 1 → 3001). Templates may reference ${AGENT_LANE}, ${REPO_SLUG}, and any offset keys.
The extension appends .agent-worktree.json and the env file name to .gitignore when missing. It does not create databases or bind ports — your app or setup script must consume these variables.
Settings
| Setting |
Default |
Meaning |
agentWorktrees.directory |
.worktrees |
Folder under each repo root |
agentWorktrees.branchPrefix |
feat/ |
Branch prefix + slug |
agentWorktrees.postCreateScript |
"" |
Script path (absolute or repo-relative). Sets ROOT_WORKTREE_PATH and AGENT_LANE |
agentWorktrees.openInNewWindow |
false |
Open worktrees in a new window |
If postCreateScript is empty, the extension reads .cursor/worktrees.json using the same contract as Cursor worktrees (setup-worktree-unix / setup-worktree-windows / setup-worktree).
Privacy
Delagen Agent Worktrees does not make network calls and does not collect telemetry. It only runs local git and optional setup scripts you configure.
Support
Include your editor (VS Code or Cursor), OS, and git version when reporting a bug.