Repository navigation
Description
Description
Add .cursor/worktrees.json and update development commands to support Cursor's native Parallel Agents feature, which uses git worktrees for isolated agent execution.
Problem Statement
When working on an issue and needing to start a second task (e.g. found a bug while working on a feature), the current workflow requires stashing and switching branches. Cursor's Parallel Agents feature can run agents in isolated worktrees, but this repo has no worktree setup configuration.
Proposed Solution
1. Create .cursor/worktrees.json
Setup script to initialize worktrees for this repo:
uv sync(install Python deps)pre-commit install(hooks)git config commit.template .gitmessage- Copy
.envif present
2. Update start-issue.md
When the user is already on a feature branch with changes, offer the parallel agent option as an alternative to stash-and-switch.
3. Document the workflow
Add guidance for when to use parallel agents vs. local mode.
Known Limitations (as of Feb 2026)
Cursor's worktree/parallel agents have known bugs inside devcontainers:
- Path resolution failure — agents produce ENOENT errors with malformed worktree paths in WSL + devcontainer environments.
.cursor/worktrees.jsondetection also fails despite files existing. (Forum: misresolved paths) - Apply button failure — in devcontainers, the "Apply" button tries to read files via
vscode-remote://URIs instead of local paths, failing completely. (Forum: apply failure)
Worktrees work correctly when Cursor runs natively (macOS local, Linux local). Since this project is a devcontainer, the primary user workflow (developing inside the container) is affected. Implementation should proceed once Cursor fixes the devcontainer integration, or can be scoped to local-only development initially.
Research References
- Cursor Parallel Agents docs
- Cursor blog: agent best practices
- Git worktrees done right (bare repo pattern)
- Reddit: organizing worktree folders
- obra/superpowers: using-git-worktrees
Acceptance Criteria
-
.cursor/worktrees.jsoncreated with repo-specific setup script -
start-issue.mdupdated to mention parallel agent option - Devcontainer limitation documented
- Tested with Cursor Parallel Agents in local (non-container) mode
Activity
gerchowl commentedon Feb 18, 2026
Idea: tmux + cursor-agent CLI for multi-worktree terminals
We might want to include
tmuxin the container and also have thecursor-agentCLI installed. This would allow running multiple worktrees in parallel terminals via tmux sessions — useful for orchestrating several agent-driven development streams simultaneously from within the devcontainer.gerchowl commentedon Feb 18, 2026
Design: Cursor Worktree & Parallel Agent Support
Overview
Two parallel paths for running agents in isolated worktrees:
.cursor/worktrees.json) — for macOS/Linux local development (Cursor UI handles everything).cursor-agentCLI) — for devcontainer environments where native worktrees have known bugs.Both paths are complemented by a set of autonomous worktree skills that mirror the interactive workflow skills but never block for user feedback.
Component 1:
.cursor/worktrees.jsonNative Cursor worktree initialization config. When Cursor creates a worktree on macOS/Linux, this script sets up the environment:
{ "setup-worktree-unix": [ "uv sync", "pre-commit install --install-hooks", "git config commit.template .gitmessage", "test -f \"$ROOT_WORKTREE_PATH/.env\" && cp \"$ROOT_WORKTREE_PATH/.env\" .env || true" ] }setup-worktree-unixonly (no Windows support needed — devcontainer is Linux, native is macOS/Linux).$ROOT_WORKTREE_PATHis set by Cursor automatically, pointing to the primary working tree..envcopy — doesn't fail if no.envexists.Known limitation: Cursor's native worktree UI does not work inside devcontainers (Feb 2026). Path resolution and Apply button failures. See forum thread. This file only takes effect when Cursor runs natively.
Component 2:
justfile.worktree— CLI-based worktree recipesNew justfile module imported from the main
justfile. Provides tmux +cursor-agentCLI orchestration for devcontainer environments.Worktree location:
../<repo>-worktrees/<issue>/relative to the project root. Example:Recipes:
worktree-start <issue> [prompt]cursor-agentworktree-listworktree-attach <issue>worktree-stop <issue>worktree-cleanworktree-startflow:CURSOR_API_KEYset).<repo>frombasename $(git rev-parse --show-toplevel).git worktree add ../<repo>-worktrees/<issue>.wt-<issue>.agent chat "<prompt>"(or drop to shell if no prompt).Devcontainer limitation documented as comments at the top of
justfile.worktree:Component 3: Autonomous worktree skills
Worktree-specific skill variants that mirror the interactive workflow but never block for user feedback. They make reasonable decisions autonomously.
State-aware pipeline (
worktree:solve-and-pr)The compound skill reads the full issue (body + comments) to determine what phase to start from:
Read full context:
gh issue view <number> --json title,body,labels,commentsState detection:
worktree:brainstorm## Designcommentworktree:plan## Design+## Implementation Planworktree:executeThe body is always read as the foundation — it contains the problem, proposed solution, and acceptance criteria. Comments layer completed phases on top.
Full pipeline:
worktree:brainstorm## Designcomment on issueworktree:plan## Implementation Plancomment on issueworktree:executeworktree:verifyworktree:prIndividual skills
worktree:brainstorm## Designcommentworktree:plan## Implementation Plancommentworktree:executeworktree:verifyworktree:prworktree:askworktree:solve-and-prFeedback channel:
worktree:askWhen an autonomous agent is genuinely stuck, it uses
worktree:askto post a question as a GitHub issue comment. Placeholder implementation — a future issue will add Telegram/Element bot integration for push notifications and faster reply loops.Component 4: Sync manifest update
Add to
scripts/sync_manifest.py:.cursor/worktrees.json— synced as-is (setup commands are generic for uv-based projects).justfile.worktree— synced to downstream projects (may need transforms for project-specific paths).Component 5: Changelog
Under
## Unreleased→### Added:Out of scope
issue:claim— theagent:parallel/worktree:solve-and-prskill handles parallel workflow separately.worktree:askuses GitHub comments as placeholder.gerchowl commentedon Feb 18, 2026
Implementation Plan
Issue: #64
Branch:
feature/64-cursor-worktree-supportTasks
Phase 1: Native Cursor worktree config
.cursor/worktrees.jsonwithsetup-worktree-unixcommands (uv sync, pre-commit install, git config, conditional .env copy) —.cursor/worktrees.json— verify:cat .cursor/worktrees.json | python -m json.toolPhase 2: Justfile worktree recipes
justfile.worktreewith header comment documenting devcontainer limitation and theworktree-startrecipe (validate prereqs, create worktree at../<repo>-worktrees/<issue>/, setup env, start tmux + cursor-agent) —justfile.worktree— verify:just --list | grep worktreeworktree-listrecipe (list active worktrees and tmux sessions) —justfile.worktree— verify:just worktree-listworktree-attachrecipe (attach to tmux session for an issue) —justfile.worktree— verify:just --list | grep worktree-attachworktree-stoprecipe (kill tmux session, remove worktree) —justfile.worktree— verify:just --list | grep worktree-stopworktree-cleanrecipe (remove all cursor-managed worktrees and sessions) —justfile.worktree— verify:just --list | grep worktree-cleanjustfile.worktreefrom the mainjustfile—justfile— verify:just --list | grep worktreePhase 3: Autonomous worktree skills
worktree:brainstormskill — autonomous design, reads full issue, posts## Designcomment, never blocks —.cursor/skills/worktree:brainstorm/SKILL.md— verify: file exists with correct frontmatterworktree:planskill — autonomous planning, posts## Implementation Plancomment, never blocks —.cursor/skills/worktree:plan/SKILL.md— verify: file exists with correct frontmatterworktree:executeskill — TDD implementation, commits as it goes, no user checkpoints —.cursor/skills/worktree:execute/SKILL.md— verify: file exists with correct frontmatterworktree:verifyskill — full verification (test + lint + precommit), evidence only, loops back to fix on failure —.cursor/skills/worktree:verify/SKILL.md— verify: file exists with correct frontmatterworktree:prskill — creates PR from worktree branch —.cursor/skills/worktree:pr/SKILL.md— verify: file exists with correct frontmatterworktree:askskill — posts question to issue comment, placeholder for Telegram bot (see future issue) —.cursor/skills/worktree:ask/SKILL.md— verify: file exists with correct frontmatterworktree:solve-and-prcompound skill — state detection from full issue (body + comments H2 headings), runs remaining phases in order: brainstorm → plan → execute → verify → PR —.cursor/skills/worktree:solve-and-pr/SKILL.md— verify: file exists with correct frontmatterPhase 4: Sync manifest & housekeeping
.cursor/worktrees.jsonentry to sync manifest —scripts/sync_manifest.py— verify:uv run python scripts/sync_manifest.py list | grep worktreesjustfile.worktreeentry to sync manifest —scripts/sync_manifest.py— verify:uv run python scripts/sync_manifest.py list | grep worktree## Unreleased→### Addedwith worktree support entry —CHANGELOG.md— verify:grep -A2 'Unreleased' CHANGELOG.mdCLAUDE.md— verify:grep worktree CLAUDE.mdNotes
worktree:askfeedback channel is a separate future issue.feat: add worktree support for parallel agent development
fix: check existing cursor-agent login before requiring API key
fix: unset core.hooksPath in worktree before pre-commit install
fix: drop --install-hooks from worktree setup
fix: auto-trust worktree directory and pass --yes to cursor-agent
fix: use trustedDirectories config instead of nonexistent --yes flag
fix: ensure trust for pre-existing worktrees on restart
feat: pass --yolo to cursor-agent for autonomous command execution
feat: agent-driven development workflows, templates, and declarative …
chore: release 0.3.0 (#270)