Repository navigation
Description
Problem
scripts/dev/*.sh in a downstream project are symlinks whose target is computed as relative(dest, <templates dir of the sequant package that ran init/sync>) (src/lib/templates.ts:499-506, symlinkDir). The comment calls these "portable symlinks", but the target is wherever the invoking package happens to live:
| How sequant ran | Symlink target | Consequence |
|---|---|---|
npx sequant@latest … / plugin MCP server |
~/.npm/_npx/<hash>/node_modules/sequant/templates/scripts/… |
npx cache is evicted; links go dead |
npm link to a sibling checkout |
../../../sequant/templates/scripts/… |
machine-specific; wrong on any other clone |
| global install | <prefix>/lib/node_modules/sequant/… |
machine-specific |
| local devDependency | ../../node_modules/sequant/templates/scripts/… |
the only target that survives git clone && npm install |
init does not gitignore scripts/dev/ (GITIGNORE_ENTRIES is .sequant/ only), so downstream projects commit these links and every re-sync from a different runner shows as churn on three tracked files.
Evidence (downstream, 2026-09-06)
matcha-maps: a sync fired by the plugin's npx sequant@latest serve (#988) re-pointed scripts/dev/{new-feature,cleanup-worktree,list-worktrees}.sh from ../sequant/templates/… (sibling checkout) to ~/.npm/_npx/ff1581e8907a8ea7/…. Committing that would have broken the worktree scripts on every other machine and, once the cache was evicted, on this one. The user reverted by hand.
The npm link variant is already recorded as a known trap in project memory ("revert with git checkout scripts/dev/*.sh"), i.e. users are working around this rather than sequant handling it.
Acceptance Criteria
- AC-1: When the project has
node_modules/sequant/templates/scripts/(local dependency), symlinks target that path regardless of which sequant binary is running the command. - AC-2: When there is no local
node_modules/sequantand the resolved templates dir is inside an npx cache (/_npx/path segment) or outside the project tree, sequant copies the scripts instead of symlinking and prints why (one line, names--no-symlinksas the explicit form). - AC-3:
sequant sync --dry-run/update --dry-runshow the symlink target that would be written when it differs from the current one. - AC-4:
sequant doctorflags ascripts/dev/*.shsymlink whose target does not exist or resolves outsidenode_modules/sequantand the project tree, with the fix command. - AC-5: Tests cover the four rows above with
SEQUANT_TEMPLATES_DIRpointing at (a) a fakenode_modules/sequant, (b) a fake_npxcache path, (c) a sibling directory; mutation-verified per CLAUDE.md.
Notes
- feat: Use symlinks instead of copies for scripts/dev in init #107 introduced symlinks so users pick up script updates without re-running init; AC-1 keeps that benefit for the install shape the README recommends (
npm install sequantthennpx sequant init). - Whether
initshould also addscripts/dev/to.gitignoreis a separate call (it changes what a fresh clone gets); not in scope here. - Related: fix(cli): preAction auto-sync fires on
serve— the plugin's @latest MCP server silently rewrites .claude/hooks, skills, AGENTS.md in every project it starts in (#793 pin never ships via marketplace source "./") #988 (the sync that surfaced this), fix(fullsolve, exec): wrong cleanup-worktree.sh path in skill mirrors (scripts/dev/ is gitignored) #583 (scripts/dev/path confusion in skill mirrors).
Activity
admarble commentedon Sep 7, 2026
Sibling from the same 2026-09-06 downstream sync: #990 (AGENTS.md regenerated unconditionally).
admarble commentedon Sep 8, 2026
Runner context — opencode dogfood sample (graph-2026-09 node 16, #997). This issue is being run spec→exec→qa twice as a sample for the opencode promotion gate: once with
--agent opencode(base branchdogfood/opencode-2026-09, which carries the generated.opencode/wrappers and hook shim), then once with the default claude-code driver. The resulting PRs are samples and will not be merged; the owner reads them for defects and the runner records verdict, skill-marker presence, fan-out, cost and wall time indocs/investigations/multi-backend-2026-07.md("Dogfood 2026-09"). Work the issue exactly as you would for real — same ACs, same PR body discipline, mutation records for gate tests — but do not file any issue and do not merge. Commit a WIP within 5 minutes and every ~10 minutes; targeted tests in the foreground only; a phase silent for 30 minutes is killed. Cost cap for the opencode arm across all three sample issues: $30.admarble commentedon Sep 9, 2026
Consolidated into #990 (W2 plan D1: both edit
src/lib/templates.tsand are one contract — sync never writes something the downstream user did not ask for). This issue's ACs are #990 AC-4 (prefernode_modules/sequant), AC-5 (npx-cache / outside-tree → copies, one-line reason — the fixture is the verbatim target committed in sequant-io/sequant-landing), AC-6 (--dry-runshows retargets) and AC-7 (doctorflags dead/outside links). Plan:docs/internal/graph-2026-09-w2/.fix(#1159): diff scripts/dev against the install target, not the runn…