Skip to content

feat: worktree-based parallel development for /qq:execute #1

@tykisgod

Description

@tykisgod

Summary

/qq:execute should support git worktree-based isolation for parallel feature development. Multiple Claude Code sessions can work on orthogonal features simultaneously, each in its own worktree.

Workflow

1. execute detects current branch (if main → prompt to create feature branch)
2. Create worktree + sub-branch from current branch
3. AI writes code in worktree
4. Compile via batch mode (no Unity Editor needed in worktree)
5. Test via batch mode
6. All pass → merge back to source branch
7. Ask: delete worktree? (default yes)

Why worktrees (not just branches)

Multiple Claude Code sessions can't share one working directory. Worktrees give each session its own file system while sharing the same .git object database.

Unity-specific considerations

  • Library/ regeneration: first batch-mode compilation in a new worktree generates Library/ (~5-10 min one-time cost). Subsequent compilations are incremental (~15-30s).
  • Unity Accelerator: running on localhost can cache imported assets, dramatically speeding up Library/ generation for new worktrees.
  • No symlink: Unity officially does not support symlinked Library/ folders — will cause corruption.
  • Batch mode fallback: unity-compile-smart.sh already falls back to batch mode when no Editor is detected. No script changes needed.

Changes needed

execute SKILL.md

  • Add worktree creation step before implementation
  • Main branch detection + warning
  • Merge-back step after completion
  • Worktree cleanup prompt

commit-push SKILL.md

  • Detect if in a worktree → offer merge back to source branch
  • After merge, prompt to delete worktree

Compile/test in worktree

  • Already works via batch mode fallback in existing scripts
  • No changes to unity-compile-smart.sh or unity-test.sh needed

Example

# User on branch dev/vehicle-system, starts 3 Claude Code sessions:

# Session 1:
/qq:execute damage-system.md
# → creates worktree ../project-wt-damage on branch dev/vehicle-damage
# → implements, compiles (batch), tests (batch)
# → merges back to dev/vehicle-system
# → deletes worktree

# Session 2 (parallel):
/qq:execute fire-effect.md
# → creates worktree ../project-wt-fire on branch dev/vehicle-fire
# → same flow, independent

# Session 3 (parallel):
/qq:execute explosion.md
# → creates worktree ../project-wt-explosion on branch dev/vehicle-explosion
# → same flow, independent

Not in scope

  • Ephemeral worktrees (Claude Code's isolation: "worktree") — Library/ cost makes these impractical for Unity
  • Shared Library/ via symlink — officially unsupported by Unity
  • Auto-opening Unity Editor in worktrees — batch mode is sufficient

Metadata

Metadata

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions