feat: Multi-agent worktree support (gitWorkflow option)#153
Open
feat: Multi-agent worktree support (gitWorkflow option)#153
Conversation
added 10 commits
February 13, 2026 17:53
#146 - Feature grouping over-corrects (REGRESSION) - Fixed groupRelatedFeatures to push ALL groups, not just those with items - Features without endpoints are now preserved as separate phases #140 - Plan scaffold generates .txt paths for Java - Root cause: TemplateKey.language was a separate restricted type from DetectedLanguage - Fix: TemplateKey.language now reuses DetectedLanguage type directly - No more manual switch mapping - detected language passes through - Adding new languages only requires updating DetectedLanguage + LANGUAGE_DEFAULTS #143 - Endpoints as separate phases - Fixed by #146 - endpoints now grouped with preceding feature
- Deploy to staging on push to fix/* and feat/* branches - Deploy to staging on PRs to main - Deploy to production only on push to main - Add PR comment with staging URL for testing
Staging environment was being redirected to production custom domain. Added ENVIRONMENT check to skip redirect when ENVIRONMENT=staging.
Haiku agent only sees the current context and can't reference CLAUDE.md. Added COMPLETION_INSTRUCTION constant that gets inserted after each subtask's Completion Notes section, telling the agent exactly how to mark the subtask as complete. Closes #148
- Add worktree.ts module with setup script generation, agent instructions, and CLAUDE.md coordination section - New MCP tool: devplan_setup_worktrees for configuring parallel agents - Each agent gets isolated worktree, branch, ports, deps, and database - Advisory locking for shared resources (migrations, config) - Edge cases: lockfile conflicts, port conflicts, DB migration ordering, shared config files - 19 new tests (336 total, all passing) - TypeScript compiles clean
- Add gitWorkflow: 'branch' | 'worktree' to ProjectBriefSchema (models.ts) - Parse gitWorkflow from brief content in parseBrief() - Add GitInstructions abstraction with branch/worktree implementations - Replace hardcoded branch instructions in renderTemplatePhases() - Replace hardcoded Git Workflow section in generatePlan() - Append worktree addendum to executor agent when workflow=worktree - Add design doc at docs/devplan-worktrees.md - 13 new integration tests (349 total, all passing) The gitWorkflow option controls all git instruction blocks: - Task headers: 'Create branch' vs 'Work in worktree' - Completion notes: 'feature/X' vs 'task/X (worktree)' - Merge checklists: squash-merge vs worktree-remove - CLAUDE.md conventions: branch strategy vs worktree layout - Executor agent: branch checkout vs worktree awareness
- Add gitWorkflow to MinimalScaffoldConfig - Pass git instructions through generateMinimalPhase0/1 and generateDomainSubtasks - Replace all hardcoded branch refs in Phase 0 and Phase 1 scaffold with git helpers - Language example snippets left as branch-mode (they're illustrative, not generated) - 349 tests still passing, TypeScript clean
- Test generatePlan() with gitWorkflow: worktree produces worktree instructions - Test generatePlan() defaults to branch instructions - Test conflict zone warnings appear in worktree mode - 352 total tests, all passing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds
gitWorkflow: "worktree"option to DevPlan that generates worktree-based git instructions instead of branch-checkout instructions. Enables true parallel execution where multiple Claude Code agents work simultaneously in separate directories.What it does
When
- **Git Workflow**: worktreeis added to a PROJECT_BRIEF.md:devplan_setup_worktreesgenerates setup scripts and coordination docsLayout
Implementation
models.ts: AddedgitWorkflow: z.enum(["branch", "worktree"]).default("branch")generators.ts:GitInstructionsabstraction with branch/worktree implementations; all git instruction sites (task headers, completion notes, merge checklists, CLAUDE.md conventions, executor workflow) go through thisworktree.ts: Setup script generator, agent coordination instructions, CLAUDE.md sectionindex.ts: New MCP tooldevplan_setup_worktrees(Tool 24)docs/devplan-worktrees.md: Design documentEdge cases handled
.env.localwith unique portTests
Status
Prototype — ready for review. Future work: