Summary
Replace DevAIFlow's temp directory cloning (temp_directory.py, ~560 lines) with native git worktree commands for investigation and ticket-creation session isolation. This is faster, uses less disk space, and works with all 8 agent backends.
Full proposal document: docs/proposals/git-worktree-isolation.md
Why git worktree, not Claude Code --worktree?
Claude Code has a --worktree flag, but DevAIFlow supports 8 agent backends (Claude, Cursor, Windsurf, Copilot, Aider, Continue, Crush, Ollama). Using git worktree add/remove directly keeps the feature agent-agnostic — no changes needed to AgentInterface.
Current state
devflow/utils/temp_directory.py (~560 lines) — full git clone to /tmp/, complex cleanup
- Session creation: 2-10 seconds (full clone)
- Disk usage: full duplicate of repository
Proposed state
devflow/utils/worktree.py (~100 lines) — git worktree add/remove wrappers
- Session creation: ~100ms (worktree add)
- Disk usage: shared
.git directory, only working files duplicated
- Worktrees stored in
.daf/worktrees/<session-name>/
Changes required
New: devflow/utils/worktree.py (~100 lines)
Remove: devflow/utils/temp_directory.py (~560 lines)
Modify:
devflow/cli/commands/git_new_command.py — use worktree instead of temp-clone
devflow/cli/commands/open_command.py — restore session in existing worktree
devflow/cli/signal_handler.py — worktree cleanup on exit
devflow/session/models.py — add worktree_path field
Net: ~460 lines removed
Edge cases
- Non-git repos: fall back to current temp-clone
- Dirty worktree on exit: prompt user to keep or remove
- Session reopen: check if worktree exists, recreate from branch if not
- Env files:
.dafworktreeinclude pattern copies gitignored files into worktree
Summary
Replace DevAIFlow's temp directory cloning (
temp_directory.py, ~560 lines) with nativegit worktreecommands for investigation and ticket-creation session isolation. This is faster, uses less disk space, and works with all 8 agent backends.Full proposal document:
docs/proposals/git-worktree-isolation.mdWhy git worktree, not Claude Code --worktree?
Claude Code has a
--worktreeflag, but DevAIFlow supports 8 agent backends (Claude, Cursor, Windsurf, Copilot, Aider, Continue, Crush, Ollama). Usinggit worktree add/removedirectly keeps the feature agent-agnostic — no changes needed toAgentInterface.Current state
devflow/utils/temp_directory.py(~560 lines) — fullgit cloneto/tmp/, complex cleanupProposed state
devflow/utils/worktree.py(~100 lines) —git worktree add/removewrappers.gitdirectory, only working files duplicated.daf/worktrees/<session-name>/Changes required
New:
devflow/utils/worktree.py(~100 lines)Remove:
devflow/utils/temp_directory.py(~560 lines)Modify:
devflow/cli/commands/git_new_command.py— use worktree instead of temp-clonedevflow/cli/commands/open_command.py— restore session in existing worktreedevflow/cli/signal_handler.py— worktree cleanup on exitdevflow/session/models.py— addworktree_pathfieldNet: ~460 lines removed
Edge cases
.dafworktreeincludepattern copies gitignored files into worktree