From 6b239c5ce5b5dc8e95923b4a4599b082bf4282a6 Mon Sep 17 00:00:00 2001 From: Hibryda Date: Wed, 11 Mar 2026 00:35:09 +0100 Subject: [PATCH] docs(todo): expand worktree isolation plan with research findings Detail 3-part implementation: UI toggle, --worktree spawn, CWD-based detection from .claude/worktrees/, $CODEX_HOME/worktrees/, and ~/.cursor/worktrees/ patterns. --- TODO.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TODO.md b/TODO.md index b1a20f7..85d13e4 100644 --- a/TODO.md +++ b/TODO.md @@ -14,7 +14,7 @@ - [ ] **Agent provider adapter pattern** -- Abstract model interface (ProviderConfig, ProviderCapabilities) for multi-model support (Claude, Codex, Ollama). Rename agent-runner.mjs → claude-runner.mjs, capability gates in UI. - [ ] **S-1 Phase 2 — filesystem write detection** -- inotify-based file change detection (already have notify crate). PID attribution to distinguish BTerminal-managed vs external writes. Always-on red "write conflict" cards. - [ ] **S-2 — session anchors** -- Preserve first 5 turns / 2K tokens verbatim through checkpoint chains. Pin additional turns via AST conversation tree action. -- [ ] **Worktree spawning per project** -- useWorktrees field exists on ProjectConfig. Need UI toggle in SettingsTab and wiring to auto-spawn agents in git worktrees via Agent SDK isolation:"worktree". +- [ ] **Worktree isolation per project (S-1 Phase 3)** -- Three parts: (1) **UI toggle**: useWorktrees checkbox in SettingsTab per-project settings, persisted in groups.json ProjectConfig. (2) **Spawn with --worktree**: when useWorktrees=true, pass `--worktree ` flag to Claude Code CLI via sidecar AgentQueryOptions. Sidecar creates worktree at `/.claude/worktrees//`, agent CWD is set there. (3) **Worktree detection improvement**: current extractWorktreePath checks tool_call params, but agents don't signal worktrees in tool calls — the real signal is CWD-based (path contains `.claude/worktrees/`) or from sidecar notification events (`worktreePath`/`worktreeBranch` fields, Claude Code v2.1.72+). Update agent-dispatcher to parse init event CWD or notification fields. For Codex/Cursor agents: detect `$CODEX_HOME/worktrees/` or `~/.cursor/worktrees/` CWD patterns. Conflict suppression already works once worktree is registered via setSessionWorktree(). ## Completed