Skip to content

Make worktree isolation opt-in — default to simple branch strategy #173

@xliry

Description

@xliry

Problem

Worktree isolation adds 289 lines of complexity (worktree.ts) and causes real problems:

Worktrees only help when multiple agents work on the same repo simultaneously. But logs show agents typically work on different repos (lota-1 on kid-club-vue, lota-3 on bosphorusIre).

What to do

In src/daemon.ts, runClaude() function:

  1. Make worktree creation conditional — only use worktrees when --worktree flag is passed
  2. Default behavior (no flag): agent works directly in the workspace on a branch task-{id}-{agent}
  3. The agent creates the branch, does work, commits, pushes the branch
  4. Daemon merges the branch to main after completion (simple git merge + git push)
  5. No worktree creation, no worktree cleanup, no path confusion

New default flow (no worktree):

1. cd <workspace>
2. git checkout -b task-{id}-{agent}
3. [agent does work]
4. git commit + git push origin task-{id}-{agent}
5. [daemon merges branch to main]

Opt-in worktree flow (with --worktree flag):

1. createWorktree() in <workspace>/.worktrees/<agent>
2. [agent works in worktree]
3. [daemon merges + cleans up worktree]

Files

  • src/daemon.ts — make worktree conditional in runClaude()
  • src/worktree.ts — keep the code but only call it when opt-in
  • Add --worktree flag to parseArgs()

Acceptance

  • Default: no worktrees, agent works on branch in workspace directly
  • --worktree flag enables worktree isolation
  • Agent no longer confused about directory paths
  • Timeout doesn't lose work (branch still exists on remote)
  • Build passes: npm run build

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions