Repository navigation
Description
Summary
../worktrees/ is a single namespace shared by every sibling repository, and the skills resolve worktrees inside it by globbing on issue number alone. A glob written for issue #9 in one project can therefore resolve into a different project's worktree.
The directory is derived from the parent of the git root (src/lib/workflow/worktree-manager.ts:615):
const worktreesDir = path.join(path.dirname(gitRoot), "worktrees");and identically in the shell path (scripts/new-feature.sh:103):
WORKTREE_DIR="../worktrees/${BRANCH_NAME}"So every repo under ~/Projects/ writes into one ~/Projects/worktrees/feature/ tree. new-feature.sh:404 already acknowledges this for the npm cache ("../worktrees/ is shared by every repo (#847)") — the consequence for worktree resolution was never followed through.
The skills then look up by issue number, not by repo:
.claude/skills/fullsolve/SKILL.md:366—export SEQUANT_WORKTREE=../worktrees/feature/<issue-number>-*/.claude/skills/exec/SKILL.md:483— "check if../worktrees/contains a directory for this issue"
Issue numbers are per-repo and collide constantly.
Evidence
~/Projects/worktrees/feature/ today, resolved via git rev-parse --git-common-dir per entry:
| directory | owning repo |
|---|---|
9-create-solve-sequence-real-terminal-footage-with-p |
sequant-demo-video |
10-create-result-and-cta-sequences-3-30-5-00 |
sequant-demo-video |
35-qa-final-cross-browser-and-mobile-review |
portfolio-2025 |
125-onboarding-flow-ai-program-generation |
workout |
145-sheet-save-load-named-campaigns |
ad-motion |
578-seo-expand-city-coverage-to-20-cities |
matcha-maps |
Five repos, one flat namespace. ai-devtools-weekly was working issues #9 and #10 on 2026-08-05; ../worktrees/feature/9-* and 10-* from that repo glob straight onto sequant-demo-video's directories.
A second reason the path name is not identity: ~/Projects/worktrees/feature/578-seo-expand-city-coverage-to-20-cities currently has feature/578-city-expansion-clean checked out. The directory slug and the branch it holds have already diverged, so a glob match tells you nothing about which branch you land on.
Creation is not the exposed surface — git worktree add onto an existing foreign path fails loudly. Resolution is: an issue-number glob silently returns a live directory belonging to another project.
Same class as #881 (parallel-group marker filename was global across projects), fixed there by scoping the name per project. This is the worktree-path instance of the same defect.
Impact
- A
/execor/fullsolverun can adopt another project's worktree and edit files in the wrong repository. - Presents as an unreproducible glitch, exactly as bug(exec/hooks): parallel-group marker filename is global — one project's /exec run redirects worktree enforcement for every concurrent session #881 did — it depends on which sibling repos have live worktrees at that moment.
- The exposure grows with the dogfood testbed, where concurrent runs across
sequant,ad-motion,matcha-mapsand others are routine.
Acceptance Criteria
- AC-1: Worktree lookup in the skills resolves through
git worktree listin the current repository, never by globbing../worktrees/feature/<issue-number>-*. - AC-2:
/exec's standalone "check if../worktrees/contains a directory for this issue" step is replaced by the repo-scoped lookup from AC-1. - AC-3: A resolved worktree path that is absent from the current repo's
git worktree listis rejected with a named error rather than used. - AC-4: Lookup selects on the branch (
feature/<issue-number>-*as reported bygit worktree list), not on the directory slug, so a directory whose name has diverged from its branch cannot be mis-selected. - AC-5: Both skill mirrors (
.claude/skills/,templates/skills/) carry identical changes. - AC-6: A regression test creates a foreign worktree directory matching the issue-number glob and asserts the lookup does not select it, with a recorded mutation result per CLAUDE.md.
Non-Goals
- Not relaying out
../worktrees/into per-project subdirectories. That would strand every existing worktree on disk and is not required: scoping resolution to the current repo closes the failure mode. Worth revisiting separately if the flat namespace causes trouble elsewhere. - Not changing
worktree-manager.ts's creation path, which is already repo-correct.
Relationship to #899
The /exec guard proposed in #899 (AC-4: halt when SEQUANT_WORKTREE is absent from git worktree list) neutralizes most of this hazard as a side effect, since it rejects a foreign path before use. This issue is the general fix — it also covers the standalone /exec path, where no orchestrator sets SEQUANT_WORKTREE at all. If the companion lands first, this one shrinks to AC-2 and AC-4.
Activity
admarble commentedon Aug 6, 2026
Consolidated into #899 — same two files (
fullsolve/SKILL.md,exec/SKILL.md), same two mirrors, one PR. Splitting them would have put two PRs on the same files for no benefit.Everything here is carried over, nothing dropped:
578-seo-expand-city-coverage-to-20-citiesholdingfeature/578-city-expansion-clean) → same section, and bug(fullsolve/exec): the worktree is never created and never verified — skill-driven runs execute in the main checkout, or in another repo's worktree #899 AC-6git worktree list→ bug(fullsolve/exec): the worktree is never created and never verified — skill-driven runs execute in the main checkout, or in another repo's worktree #899 AC-4 and AC-5 (AC-5 covers the standalone/execpath, which had no orchestrator settingSEQUANT_WORKTREEat all)fix(#899): create the worktree in /fullsolve, verify it in /exec (#902)