Repository navigation
Description
Summary
#899 gave /exec a verification gate before it trusts SEQUANT_WORKTREE. /qa and /loop receive the same variable from the same orchestrator and still cd into it unchecked — the identical line #899 removed from /exec:
.claude/skills/qa/SKILL.md:365—- Use the provided worktree path directly: \cd $SEQUANT_WORKTREE``.claude/skills/loop/SKILL.md:220— same line, verbatim
(Both mirrored into templates/skills/ and skills/.)
Surfaced by #899's cross-file sibling-site scan (§5). Deliberately left out of PR #902 rather than widening its scope mid-review.
Why this is lower-severity than #899 was
#899's /fullsolve Phase 1.5 now creates the worktree and resolves an absolute path before any child skill runs, so under the orchestrator the value /qa and /loop receive is already known-good. The residual exposure is the standalone path: /qa 123 or /loop 123 invoked in a shell that still carries a SEQUANT_WORKTREE export from an earlier, unrelated run. That value can point at a deleted worktree, or — because ../worktrees/ is one flat namespace shared by every sibling repository — at another project's.
Failure shape is the same as #899's: the cd fails, the skill keeps going in whatever directory it is in, and QA reviews or /loop edits the wrong tree while reporting success.
Acceptance Criteria
- AC-1:
/qahalts with the named error fromsequant worktree verifywhenSEQUANT_WORKTREEis set but is not an existing directory of this repository, instead of continuing in the current directory. - AC-2:
/loopcarries the same guard, with the same halt semantics. - AC-3: Both guards reuse
npx sequant worktree verify(added in 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) rather than reimplementing the check inline, so there is one source of truth for the three named errors. - AC-4: All three skill mirrors (
.claude/skills/,templates/skills/,skills/) carry identical changes. - AC-5: A regression test asserts the guard is present in both skills, scoped to a delimited region rather than the whole file, with a recorded mutation result per CLAUDE.md — matching the pattern established by
__tests__/integration/worktree-contract-skill.integration.test.ts.
Non-Goals
- Not changing the
sequant worktreeresolver itself; 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 shipped it and it is unchanged here. - Not adding a guard to
/test— it does notcd $SEQUANT_WORKTREEtoday. Add one only if that changes. - Not re-laying-out
../worktrees/(explicit non-goal of 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, unchanged).
Activity
fix(#904): close the unverified-worktree defect in every skill, not j…
admarble commentedon Aug 6, 2026
Absorbed into PR #902 rather than shipped separately — same defect class, same files, same mirrors.
Scope grew once I actually swept for it. This issue named two sites (
/qa,/loop); the sweep found six, in five skills:Unguarded
cd $SEQUANT_WORKTREE—/qa(reviewed the main checkout while reporting on the feature branch) and/loop(worse: it writes, so it applied fixes and committed them there). Both now run thesequant worktree verifygate from #899 and halt on a named error.Globbing the shared
../worktrees/namespace —/qa,/loop, and/testgen./testgenwas not in this issue's AC list and matters as much as the others: it writes test stubs, so a cross-repo match scatters them into an unrelated project.Prefix matching on the issue number instead of the branch — the sharpest one, also not in the original AC list.
/mergerhadgit worktree list | grep "feature/$ISSUE"withgit worktree remove --forceon the very next line, soISSUE=89matchedfeature/899-…and force-removed an unrelated issue's worktree. Also/qa's Phase 0 implementation probe (a bare-numbergrep -igating the "no implementation found" verdict), and/assess's read-only probe.AC-5 was implemented differently than written, deliberately. The AC asked for a regression test asserting the guard is present in both skills. Pinning known sites is what would have let this spread in the first place — the pattern reached six skills by being copied. Instead the gate test carries two completeness invariants over every skill in every mirror:
cd $SEQUANT_WORKTREEsits inside a verify-bearing guard region.../worktrees/or grepsgit worktree listfor an issue number.A newly-added skill that reintroduces either pattern now fails the build. The per-skill assertions AC-5 asked for are still there; the invariants sit on top.
Both invariants are scoped to spare legitimate uses —
/assess'sgrep "^worktree"enumerates every worktree for diff-overlap and keys on nothing, so it is not flagged. Narrowing that exemption is what surfaced a--porcelainvariant in/mergerthat the first regex had missed.Mutation-verified per CLAUDE.md: removing
/qa's guard failed exactly 2 tests (the per-skill one and the invariant); appending a glob to/docs— a skill in no pinned list — failed exactly 1 and nameddocs:as the offender, which is the case pinning could never have caught; restoring/merger's grep failed exactly 1 and namedmerger:. All restored, 62/62 green.Full suite green (237 files, 5011 passed, 0 failed) and CI 8/8 on #902.
AC-1 through AC-4 met as written; AC-5 met via the stronger invariant form described above.
admarble commentedon Aug 6, 2026
Closing as consolidated into #902 (see above). Tracked by #899.
fix(#899): create the worktree in /fullsolve, verify it in /exec (#902)
Merge origin/main (#899, #904) into feature/901