Repository navigation
Description
Epic: graph-2026-10-freeze-b Tier: judgment Execution: sequant_run (after the owner rules on OQ-1)
Problem
A repo adopted with sequant init --manifest-only + sequant sync --only skills (the existing-repo path from #1209) gets a content-drift warning that never clears. Both commands the warning suggests install files the adopter deliberately left out, and the first one also overwrites the repo's own constitution.
Field case (2026-10-12): a Python repo with a repo-owned .claude/memory/constitution.md, adopted this way, runs through MCP sequant_run on npm 2.19.0. The behaviour below is the same on main.
sync --only skills --dry-runreports "Skills are already up to date", exit 0.- Every
status/serve/ run start still warnsVersion current, but 12 file(s) differ from bundled content. sync --force --dry-runlists those 12 as new files the skills-only install never wrote:.claude/agents/sequant-{implementer,qa-checker,testgen}.md,.claude/hooks/{capture-tokens,parallel-marker,post-tool,pre-tool,relay-check}.sh,scripts/dev/{cleanup-worktree,list-worktrees,new-feature}.shand.claude/settings.json. It also listsLocal overrides (will be overwritten): .claude/memory/constitution.md.
Where it comes from (main)
computeContentDrift(src/commands/sync.ts:228) counts template changes with statusnewormodified, over the whole template set. A file that was never installed counts as drift, so a partial install drifts permanently.- The remedy lines (
sync.ts:883-887andformatSkillsInstallWarninginsrc/commands/version-preflight.ts:160) sayRun: sequant sync --force (or sequant update):sync --forceoverwrites user-owned files, the constitution included (by design:bin/cli.ts:240, fix(sync): plain sync overwrites CUSTOMIZABLE_FILES (constitution) — copyDir ignores force and never consults isCustomizableFile #814). It also installs every skipped group.- Bare
updateprotects local overrides (src/commands/update.ts:250), but its apply set includes allnewFiles. So it installs the skipped hooks, agents and.claude/settings.json, which changes the repo's Claude Code hooks and permissions.updatehas no--only.
.sequant-manifest.jsonkeeps"files": {}aftersync --only skills; onlyupdatedAtchanges. The manifest never records which groups were installed, so the drift check has nothing to scope against.
Why it matters
--only skills is the documented way to adopt sequant in an existing repo. Every such adopter gets a permanent warning, and the first fix it suggests deletes a repo-owned file. A user or agent that follows it either loses the constitution or ends up with hooks and settings they chose not to install. Here, the agent running the repo stopped only because its own rules ban overwriting the constitution.
Owner decision (graph doc OQ-1, before exec)
Does the install record its scope in .sequant-manifest.json, or is scope worked out from what exists on disk? Recommended: record it (for example, a groups field that init and sync --only write). Inference from disk can't tell "deliberately skipped" from "deleted by accident". The owner's ruling is written into AC-4's text before exec (an AC prescription is changed by editing the AC, not by a comment).
Acceptance Criteria
- AC-1: After
init --manifest-only+sync --only skillsin a fixture repo, the drift count printed bystatusis 0. Evidence: a test that sets up a skills-only fixture and asserts the count, mutation-verified by restoring the whole-template-set count incomputeContentDrift. - AC-2: A skills-only fixture with one modified
SKILL.mdreports drift of 1, and the remedy line names a command that, when run, rewrites only.claude/skills/**: no constitution, hooks, agents orsettings.json. Evidence: a test that runs the printed remedy on the fixture and diffs the tree, mutation-verified by restoring thesync --forceremedy text. - AC-3: A full install (
initwithout--manifest-only) still reports new and modified files as drift, as today. Evidence: the existing drift tests pass unchanged. - AC-4: The install's scope is recorded in
.sequant-manifest.jsonbyinitandsync --only, andcomputeContentDriftreads it throughsrc/lib/manifest.ts; a manifest without the field reads as a full install. Evidence: a test that writes a skills-only manifest and asserts the recorded scope, plus a test that a pre-existing manifest with no scope field still reports full-install drift.
Prior fixes / producers
git log -S computeContentDrift -- src/commands/sync.ts: fix(sync): areSkillsOutdated/checkAndWarnSkillsOutdated pre-flight is version-only — misses content drift (sibling of #708) #713 (PR fix(#713): make pre-flight skill check content-aware, not version-only #717, content-aware pre-flight). Related: fix(update/sync): sync reports 'up to date' on content drift; update overwrites in-place customizations (constitution) #708/fix(#708): content-truth for update/sync; protect in-place customizations #710 (one content diff), fix(sync): plain sync overwrites CUSTOMIZABLE_FILES (constitution) — copyDir ignores force and never consults isCustomizableFile #814 (--forceoverwrites by design), feat(adopt):init --manifest-onlyandsync --only skills— cheap, documented adoption; the manifest stays the single installed marker #1209 (the--only skillsadoption path).- The manifest is read or written by 11 non-test modules (
init,sync,update,doctor,status,run,run-manifest,version-preflight,skills-commit-state,manifest,bin/cli.ts).src/lib/manifest.tsowns the format (graph doc anti-gap pass 4); a new field is added there and read throughgetManifest, not parsed in each consumer.
May touch
src/commands/sync.ts, src/commands/version-preflight.ts, src/commands/init.ts, src/lib/manifest.ts, their tests, CHANGELOG.md.
Non-Goals
- Adding
--onlytoupdate. - Changing what
sync --forceoverwrites for a full install (fix(sync): plain sync overwrites CUSTOMIZABLE_FILES (constitution) — copyDir ignores force and never consults isCustomizableFile #814). - Any edit under
plugin/,.claude/skills/ortemplates/skills/(plugin freeze). The fixture's.claude/skills/lives in a temp dir, not the repo.
Activity
admarble commentedon Oct 16, 2026
Runner context (graph-2026-10-freeze-b, tracker #1452), for the exec and qa phases:
npm test/npx vitest runwith no file filter). Six phase agents run at once and the MCP phase wall is 30 minutes (graph doc I-5). Full-suite evidence comes from CI. Run only the targeted test files, in the foreground, undertimeout 600, after a WIP commit. Do not userun_in_backgroundor Monitor.plugin/,.claude/skills/ortemplates/skills/(plugin freeze, I-1)..sequant-manifest.json(AC-4 as filed).src/lib/manifest.tsowns the format, and other modules read it throughgetManifest(graph doc §9).admarble commentedon Oct 16, 2026
Complexity: Standard (4 ACs, 2 directories:
src/commands/,src/lib/)AC Quality Check
Evidence:names a test and a mutation. All three fail onmaintoday: the skills-only drift is 12, the remedy issync --force, and there is no scope field.main. That is fine for a regression guard, but it gates nothing on its own. AC-4's second test (a manifest with no scope field reports full-install drift) is the real gate for the full-install path..claude/skills/**". At a matching version, plainsync --only skillsonly reports and writes nothing (fast path,sync.ts:478). The remedy that does the rewrite has to besync --only skills --force. Skills paths aresequant-owned(ownershipPolicy,templates.ts:367), so--forcewidens nothing inside that tree.Scope Assessment
Non-Goals: present (no
update --only, no change to full-install--force(#814), no edits underplugin/or the skill dirs).Verdict: ✅ SCOPE_OK
Acceptance Criteria
AC-1: skills-only install →
statusdrift 0Verification: Integration Test (real temp-dir fixture)
Scenario: Given
init --manifest-only+sync --only skillsin a temp repo → When thestatuspre-flight runs (areSkillsOutdated, viarunVersionPreflight) → ThencontentDrift === 0and no "differ" warning is printed.Assumptions: The fixture runs the real
templates/tree. Hooks, agents,scripts/devandsettings.jsonare absent on disk. Mutation: makecomputeContentDriftcount the whole template set again.AC-2: one modified SKILL.md → drift 1, and the remedy touches only skills
Verification: Integration Test
Scenario: Given the AC-1 fixture plus a repo-owned
.claude/memory/constitution.md, and one edited.claude/skills/*/SKILL.md→ When the pre-flight warns → Then the count is 1 and the remedy line is<cli> sync --only skills --force. When the test runs that remedy, a before/after tree diff shows changes only under.claude/skills/**(plus.sequant-manifest.jsonand.claude/.sequant/cache files). No constitution, hooks, agents orsettings.jsonappear.Assumptions: The test parses the printed remedy and maps it to
syncCommand({ only: "skills", force: true }), or spawns the CLI assync-source-invocation.integration.test.tsdoes. The allowed-diff list must be explicit. Mutation: restore thesync --force (or update)remedy text.AC-3: a full install still reports new and modified files as drift
Verification: Unit Test (existing
sync.test.ts"areSkillsOutdated content-drift" block andversion-preflight.test.ts, unchanged)Scenario: Given a manifest with no scope field → When the drift is computed → Then the result matches today's
new+modifiedcount over the whole set.AC-4: the scope is recorded in the manifest and read through
manifest.tsVerification: Unit Test
Scenario: (a) After
init --manifest-only+sync --only skills, the manifest on disk records the skills scope. (b) A pre-existing manifest with no field →getInstallScopereturns full → the drift count includesnewfiles outside.claude/skills/.Assumptions: No consumer parses the field itself. Every read goes through
getManifestand a helper inmanifest.ts.Implementation Plan
Phase 1: Manifest format (
src/lib/manifest.ts)groups?: InstallGroup[]toManifest, withtype InstallGroup = "skills"(theSYNC_ONLY_GROUPSvocabulary). Absent means a full install. AddgetInstallScope(manifest): { kind: "full" } | { kind: "partial"; groups: InstallGroup[] }.createManifest(stack, pm, { groups? }):init --manifest-onlypassesgroups: [], and fullinitpasses nothing.updateManifest({ addGroup? }):sync --only skillsunions"skills"into an existinggroupsarray. It never adds a field to a manifest that has none, so a later--onlycannot narrow a full install. All of this stays inmanifest.ts.Phase 2: Scoped drift (
src/commands/sync.ts)computeContentDrift: filterchangesthrough a singlefilterToInstallScope(changes, scope)(full means no filter;skillsreusesfilterToSkillsOnly). The drift fingerprint already stats the manifest, so a scope change invalidates the cache with no further work.syncCommand, the apply path callsupdateManifest({ addGroup: "skills" })whenskillsOnly. The fast-path report (line ~523) names the scoped remedy whenskillsOnly.Phase 3: One remedy producer (
sync.ts+version-preflight.ts)driftRemedy(scope, cli): a partial scope returns${cli} sync --only skills --force, and a full scope returns today's string.checkAndWarnSkillsOutdated(sync.ts:883-887) andgetSkillsInstallStatus'sremediation(version-preflight.ts:136, which feedsformatSkillsInstallWarningandsequant://install) both read it. That gives one producer instead of two diverging strings.src/commands/sync.install-scope.integration.test.ts(temp dir, real templates; AC-1/AC-2/AC-4a), unit cases insrc/lib/manifesttests (AC-4 a/b), and aversion-preflight.test.tscase for the scopedremediation. Add a CHANGELOG entry under Unreleased.Design Review
src/lib/manifest.ts(owner of the format, per the graph doc §9). Filtering by scope and the remedy belong insync.tsnext tofilterToSkillsOnly, which is the only place that knows the groups' write-sets.groupsfield, absent meaning full. Rejected: inferring the scope from disk (owner ruling OQ-1: it can't tell "skipped" from "deleted"). Also rejected: a required field with a migration (it breaks pre-existing manifests andrun's documented minimal manifest shape from feat(adopt):init --manifest-onlyandsync --only skills— cheap, documented adoption; the manifest stays the single installed marker #1209).init --manifest-onlyandsync --only skills— cheap, documented adoption; the manifest stays the single installed marker #1209--only skillsfilter (filterToSkillsOnly).git log -S computeContentDrift: fix(sync): areSkillsOutdated/checkAndWarnSkillsOutdated pre-flight is version-only — misses content drift (sibling of #708) #713 (PR fix(#713): make pre-flight skill check content-aware, not version-only #717) only. Related, but a different class: fix(update/sync): sync reports 'up to date' on content drift; update overwrites in-place customizations (constitution) #708/fix(#708): content-truth for update/sync; protect in-place customizations #710 (one content diff) and fix(sync): plain sync overwrites CUSTOMIZABLE_FILES (constitution) — copyDir ignores force and never consults isCustomizableFile #814 (--forceby design). This is the first fix to the drift scope, so it is not a recurring class.updatethe remedy?" Because it installs allnewFiles(update.ts:213,252), including hooks andsettings.json. (b) "Why can'tsync --onlynarrow a full install?" A narrowing would hide real drift on files the user has. (c) "The version-mismatch remedies still say baresync/update." See OQ-1.createManifest(init.ts:650manifest-only,init.ts:1172full) andupdateManifest(sync.ts:766,update.ts:373). Readers:sync.ts(227, 419),version-preflight.ts(77, 128),status.ts:370,doctor.ts:595,run.ts:57,update.ts:80,init.ts:639, therun-manifestshape and thesrc/index.tsexport. The two writers go throughmanifest.ts, so no parity test is needed. Remedy string producers: 3 (sync.ts:523,sync.ts:887,version-preflight.ts:136), collapsed intodriftRemedyby step 6.ADR required: the plan picks a recorded scope over disk inference, and an optional field over a required one. The exec PR adds
docs/adr/0014-install-scope-recorded-in-manifest.md(shape perdocs/adr/README.md). That is a docs path outside the plugin freeze.Feature Quality Planning
computeDriftFingerprint, so a scope change invalidates the cache. A test should still show that the cached pre-flight (cache: true) returns 0 aftersync --only skills. This guards against a stale cached 12.process.cwdspies (they leak across forks). Usechdirin a dedicated integration file or spawn the CLI. A name without.integration.gets the 5 s timeout.Open Questions
checkAndWarnSkillsOutdatedsaysRun: sync(sync.ts:875),doctor.ts:649sayssync, andgetSkillsInstallStatussaysupdate. After an npm upgrade, all three steer a skills-only adopter into a full install. Recommendation: route them through the samedriftRemedy/scope helper (a skills scope givessync --only skills). This is trivially co-located and the same root cause. Impact if skipped: the same defect reappears on every version bump.doctor.tsis outside "May touch"; the owner decides.sync(no--only) on a skills-scoped install. Today it diffs the whole set and exits 1 forever at a matching version. Recommendation: the effectiveonly=options.only ?? manifest scope, and widening happens only through a fullinit. Impact if not: the report-only fast path still shows the 12-file drift with exit 1.updateon a scoped install installs everynewFilesentry but would leavegroups: ["skills"]. The drift stays correctly scoped, but the manifest understates what is on disk. Recommendation: leave it, becauseupdate --onlyis a Non-Goal. Record it as a follow-up issue rather than widen this one.Recommended Workflow
Phases: exec → qa
Quality Loop: disabled
Reasoning: A bounded fix in two modules with declared test evidence. The ACs name their own tests and mutations, so testgen stubs add little. The graph run rules apply: targeted test files only, no full suite, and the mutation records go in the PR body.
Label Review
Current: graph-2026-10-freeze-b
Recommended: +
bug, +plannedReason: A user-facing defect (a permanent warning, and a remedy that deletes a repo-owned file).
admarble commentedon Oct 16, 2026
QA Verdict: AC_MET_BUT_NOT_A_PLUS
AC coverage: 4/4 met
Gaps:
groupsfield, so it reads as a full install.init --manifest-onlyrefuses to touch an existing manifest (init.ts:640).sync --only skillsnever adds the field.sync --only skillsandinit --manifest-only.statusstill prints13 file(s) differ … Run: sequant sync --force (or sequant update), which is the constitution-overwriting remedy.sync --only skillsclaiming the scope whenfilesis{}.SEQUANT_MUTATIONmarker parses. The AC-2 marker is cut off at{"ac":"AC-2","mutat, and the two AC-4 markers are missing. The prose records exist, but the machine-readable record is incomplete.Suggestions:
syncwith no--onlyon a skills-scoped install, at a matching version, still reports drift over the whole template set and exits 1, with theupdate/sync --forceremedy.docs(#1409): renumber the install-scope ADR to 0015
fix(#1409): record the install scope so a skills-only install stops d…
fix(#1409): update records a full install in the manifest (#1477)