Repository navigation
Description
Summary
Follow-up from #708 (PR #710). The content-truth fix corrected sync's own up-to-date decision, but the sibling pre-flight warning path other commands rely on is still version-only and will under-report real content drift — the same root cause as #708's Bug 1, just on a different surface.
Where
src/commands/sync.ts:
54 export async function areSkillsOutdated(): Promise<{ outdated; currentVersion; packageVersion }>
63 outdated: currentVersion !== packageVersion, // <-- version marker only
199 export async function checkAndWarnSkillsOutdated(): Promise<boolean>
200 const { outdated, currentVersion, packageVersion } = await areSkillsOutdated();
checkAndWarnSkillsOutdated is invoked from the preAction hook in bin/cli.ts (runs before most commands) and gates both the "Skills are outdated" warning and the auto-sync trigger. Because areSkillsOutdated compares only the .sequant-version marker against the package version, a tree at the matching version but with drifted content (exactly the #708 scenario) reports outdated: false — so:
- No "skills outdated" warning is shown to the user before running other commands.
- The auto-sync hook does not fire (it's gated on
outdated && currentVersion !== null).
i.e. the drift that sequant sync now correctly flags is still invisible to every other command's pre-flight path.
Why it was deferred
#708 was explicitly scoped to the update/sync commands' own correctness. The /spec review for #708 flagged this sibling and recommended a separate issue rather than widening that PR. This is that issue.
Acceptance criteria
-
areSkillsOutdated(or a content-aware variant) reflects content drift, not just the version marker — a tree at the matching version but with drifted bundled content is reported as needing attention. - The
preActionpre-flight inbin/cli.tswarns on content drift at a matching version (consistent withsync's own drift message), instead of staying silent. - Decide and document auto-sync behavior on content-only drift: either trigger the (non-destructive) drift report or leave auto-sync to version bumps only — but the warning must surface either way.
- Reuse
computeTemplateChanges(already the source of truth insrc/lib/templates.ts) rather than reintroducing a parallel comparison — avoid re-creating the divergence that caused fix(update/sync): sync reports 'up to date' on content drift; update overwrites in-place customizations (constitution) #708. - Performance: the pre-flight runs before most commands; ensure content comparison is cheap enough (or gated/cached) not to add noticeable latency to every invocation.
Suggested approach
Have checkAndWarnSkillsOutdated (and/or areSkillsOutdated) call computeTemplateChanges to detect new/modified drift in addition to the version marker. Consider a fast-path: keep the version-marker check as a cheap hint, only run the content diff when versions match (mirrors sync's own structure post-#708), and weigh whether the pre-flight should run the diff on every command or only emit a lighter signal.
Out of scope
- The
updateTTY/--yesergonomics (tracked in fix(update): no non-interactive path — crashes without a TTY, add --yes #709). - Re-litigating fix(update/sync): sync reports 'up to date' on content drift; update overwrites in-place customizations (constitution) #708's report-only
syncdecision.
Activity
admarble commentedon Jun 4, 2026
→ PROCEED — Make
areSkillsOutdated/checkAndWarnSkillsOutdatedpre-flight content-aware (not version-only)Workflow: spec → exec → qa (-Q)
Clear ACs (5). Reuse
computeTemplateChanges(per AC) rather than a parallel comparison; mind the per-command pre-flight latency. Touchesbin/cli.ts(preAction hook) — coordinate with #709 (also edits bin/cli.ts).admarble commentedon Jun 4, 2026
📋 Plan Review (
/spec)Complexity: Standard — 5 ACs, 2 dirs (
src/commands/,bin/) + docs. Scope: ✅ OK.computeTemplateChanges/buildTemplateVariables(AC-4's "source of truth") were added by #708 / PR #710 (f52d6fe), which is NOT onmain— only on the feature branches. So #713 is stacked on #710:feature/713-…worktree is already atf52d6fe, so the symbols are present there — implementation can proceed.mainwon't compile.bin/cli.tsnearpreAction→ coordinate; merge (don't rebase).Acceptance Criteria + verification
areSkillsOutdatedcontent-aware) — Unit. On version match, callcomputeTemplateChanges(stack, tokens)and countnew+modified(excludelocal-override/unchanged). Currently loads neither stack nor tokens — will load both likesyncCommand.preActionwarns) — Integration.syncCommand's drift path setsprocess.exitCode=1and is report-only. The hook must warn only for content drift — do NOT callsyncCommand, do NOT set exit code, command still exits 0.sync; avoids clobbering bug(customization): .claude/.local/skills (and likely hooks) never load — documented override layer is non-functional #711's in-place customizations). Document at the hook +docs/internal/plugin-updates.md.computeTemplateChanges) — Unit + review. No re-implemented diff loop. Depends on fix(#708): content-truth for update/sync; protect in-place customizations #710.Implementation plan
sync.ts— extendareSkillsOutdated()→{ outdated, currentVersion, packageVersion, contentDrift }. KeepcurrentVersion !== packageVersionas fast-path; only on a version match, loadmanifest/config.tokensand runcomputeTemplateChanges, countingnew+modified. MirrorsyncCommand's post-fix(update/sync): sync reports 'up to date' on content drift; update overwrites in-place customizations (constitution) #708 drift block. UpdatecheckAndWarnSkillsOutdated(currently unused) to surface content drift.bin/cli.tspreAction— branch: version mismatch → keepsyncCommand({quiet:true})(copy); version match + drift>0 → warn only. Add AC-3 decision as a code comment.plugin-updates.md; unit onareSkillsOutdated(match→drift true/false, mismatch→skips diff), integration on hook (warns + exit 0 on drift; auto-syncs on version mismatch). Extendsrc/commands/sync.test.ts.Quality flags / derived ACs
local-override/unchangedor a customized constitution (bug(customization): .claude/.local/skills (and likely hooks) never load — documented override layer is non-functional #711) warns on every command.process.exitCode./qato sanity-check; mtime-cache deferrable.Open questions
Recommended workflow
exec → qa, quality loop enabled (matches
/assess). Notestgen(bug fix, targeted tests in/exec); notest(no UI). Pre-req: confirm #710 stack/merge order before/exec.admarble commentedon Jun 4, 2026
✅ Implementation Complete (
/exec)PR: #717 (base
main)Pre-PR AC Verification
areSkillsOutdatedcontent-awaresrc/commands/sync.ts— addscontentDriftviacomputeTemplateChangeson version match; countsnew+modified, excludeslocal-override/unchangedpreActionwarns on content drift at matching versionbin/cli.tshook — warn-only branch;checkAndWarnSkillsOutdatednever setsprocess.exitCodedocs/internal/plugin-updates.md+ hook commentcomputeTemplateChangesFiles changed
src/commands/sync.ts—SkillsOutdatedStatusinterface, content-awareareSkillsOutdated, content-drift warn branch incheckAndWarnSkillsOutdated(+ optional pre-computed status param)bin/cli.ts—preActionhook: version mismatch → copy; version match + drift → warn onlysrc/commands/sync.test.ts— unit tests for drift detection, exclusions, fast-path skip, diff-failure tolerance, warn-only/exit-0docs/internal/plugin-updates.md— "Pre-flight Skill Drift Check" section (AC-3 decision + perf)CHANGELOG.md—[Unreleased]entryChecks
npm run buildnpm run lintnpm test(sync, doctor, cli.integration)Quality Plan Alignment
local-override/unchanged)process.exitCodechange in pre-flight/qato sanity-check; mtime-cache deferrable per specCoverage note
bin/cli.tspreActionhook is thin glue over the two unit-tested helpers (areSkillsOutdated,checkAndWarnSkillsOutdated); a subprocess hook test would risk mutating the repo's own.claude, so decision logic is covered at the helper level. The warn-only/exit-0 contract (AC-2) is asserted directly oncheckAndWarnSkillsOutdated.Coordination
computeTemplateChangessource of truth) is merged to main — PR bases cleanly onmain.bin/cli.tsnearpreAction— coordinate at merge (merge, don't rebase).fix(#713): point content-drift pre-flight warning at the commands tha…
admarble commentedon Jun 4, 2026
QA Review for Issue #713
AC Coverage
areSkillsOutdatedreflects content drift, not just version markercomputeTemplateChangesand countsnew+modifiedintocontentDrift; a matching-version tree with drifted content now reports drift. Unit-tested (reports contentDrift on a version match…).preActionwarns on content drift at matching version (consistent withsync's drift message)checkAndWarnSkillsOutdated; never setsprocess.exitCode, command exits normally. Fixed during QA: remediation now points atsync --force/updateto matchsyncCommand's own drift message (baresyncis report-only).docs/internal/plugin-updates.md("Pre-flight Skill Drift Check") + hook comment.computeTemplateChanges(no parallel comparison)Coverage: 5/5 AC items fully met (0 derived ACs)
CI Status
build (22.x)typecheckvalidate-pluginvalidate-skillsCI Summary: 4 passed, 0 pending, 0 failed ·
mergeable=MERGEABLE, stateCLEANQuality Metrics
any)Code Review
Strengths:
currentVersion === null(manual-managed installs) stays silent as before; new branch only fires on version-match + drift.contentDriftexcludeslocal-override/unchanged, so customized files (constitution, bug(customization): .claude/.local/skills (and likely hooks) never load — documented override layer is non-functional #711) don't warn on every command — verified by unit test.try/catcharound the diff guarantees the pre-flight can't break the actual command (returnscontentDrift: 0on failure) — unit-tested.statusparam avoids a double template scan on the hook hot path (AC-5).any/casts); namedSkillsOutdatedStatusinterface;doctor.ts's.outdatedconsumer is unaffected by the additive field.Issues (found + fixed during QA):
sequant sync, but at a matching versionsyncis report-only and won't copy — it would have sent users on a two-hop. Fixed tosync --force/update, matchingsyncCommand's own message. Test + docs updated (commit8e4b10f).Suggestions (non-blocking, optional follow-ups):
doctor.tsnow pays the ~22ms scan viaareSkillsOutdated()but ignorescontentDrift— could surface drift indoctoroutput as a follow-up, or read a lighter signal there.Test Coverage Analysis
src/commands/sync.tssync.test.ts(contentDrift detection, exclusions, fast-path skip, diff-failure tolerance, warn-only/exit-0)bin/cli.ts(preAction hook)cli.integration+ helper unitsCoverage: Core logic fully unit-tested. Hook wiring intentionally not subprocess-tested (would risk mutating the repo's own
.claude); decision logic asserted at the helper level.Risk Assessment
computeTemplateChangesscan on every command (~22ms here); only noticeable in tight automation loops — gated and spec-acknowledged, mtime-cache deferred.preActionhook end-to-end (decision branches verified via helper unit tests instead).doctor.tsis the only otherareSkillsOutdatedconsumer; it reads.outdatedonly and is unaffected. No other version-only pre-flight siblings.syncCommand's own drift block was the reference; the QA fix aligned the helper's remediation message to it.syncCommand's report-only behavior left intentionally unchanged (Non-Goal: re-litigating fix(update/sync): sync reports 'up to date' on content drift; update overwrites in-place customizations (constitution) #708).Adversarial Re-Read
Findings: No remaining gaps. Walked the diff against: (1) the issue scenario (matching-version + drifted content → now reported) — covered by unit test; no verbatim code-block fixtures in the issue body to execute; (2) exec evidence is post-fix validation (local build/lint/65 tests + measured perf), not a bug repro; (3) process state clean — fix committed (
8e4b10f) and pushed, branchMERGEABLE/CLEAN, 1 commit behind main (#714 merge, within threshold); (4) sibling sites cited above (cross-filedoctor.ts, intra-filesyncCommand); (5) Non-Goals respected —syncCommand's report-only decision and #709's TTY/--yesergonomics untouched. The one issue surfaced (misleading remediation) was fixed in-PR.Status: Clean
Verdict: READY_FOR_MERGE
All 5 ACs MET, CI fully green, PR
CLEAN. The one real finding (AC-2 remediation message pointed at the report-onlysyncinstead ofsync --force/update) was fixed during QA in commit8e4b10f, with test and docs aligned. Code quality is A+: correct behavior parity, drift exclusions protect customizations, pre-flight is failure-isolated, and the per-command cost is gated and measured.Documentation
docs/internal/plugin-updates.mdupdated (Pre-flight Skill Drift Check + AC-3 decision)[Unreleased]entry present (fix(sync): areSkillsOutdated/checkAndWarnSkillsOutdated pre-flight is version-only — misses content drift (sibling of #708) #713)/docs 713if admin-facing docs are desired before merge.Next Steps
bin/cli.tsnearpreAction— merge, don't rebase.admarble commentedon Jun 4, 2026
QA Review for Issue #713 (PR #717)
Verdict: AC_MET_BUT_NOT_A_PLUS — all 5 ACs met, CI green, build clean, 19 new/updated tests passing. Two small, optional polish items keep it just shy of A+.
AC Coverage
areSkillsOutdatedreflects content drift, not just version markercontentDriftcount fromcomputeTemplateChanges, countingnew+modifiedand excludinglocal-override/unchanged(so #711 customizations don't warn). Tested.bin/cli.tshook callscheckAndWarnSkillsOutdated(status)whencontentDrift > 0; warn-only, never setsprocess.exitCode. Tested.docs/internal/plugin-updates.md, CHANGELOG, and inline comments.computeTemplateChanges(single source of truth)syncCommand; no parallel comparison reintroduced.Coverage: 5/5 met.
CI Status (PR #717)
Quality Metrics
anycasts addedtsc)sync.test.ts+doctor.test.tsCode Review
Strengths
computeTemplateChangeswith the identicalnew/modifiedfilter assyncCommand— exactly what AC-4 asked for; no divergence reintroduced.local-override/unchangedexclusion correctly protects bug(customization): .claude/.local/skills (and likely hooks) never load — documented override layer is non-functional #711 in-place customizations from warning on every command.process.exitCode, so the pre-flight can't fail the command it precedes.afterEachresetsexitCode, and the warn-only path assertsexitCode === 0.sync --force/update(commit4e213fa), since a baresyncat a matching version is report-only post-fix(update/sync): sync reports 'up to date' on content drift; update overwrites in-place customizations (constitution) #708 — good attention to the fix(update/sync): sync reports 'up to date' on content drift; update overwrites in-place customizations (constitution) #708 semantics.preActionreuses the already-computedstatuswhen callingcheckAndWarnSkillsOutdated, avoiding a second template scan on the hot path. ThecurrentVersion === nullearly-return preserves prior behavior.computeTemplateChangesnot called), error-swallowing, and all threecheckAndWarnSkillsOutdatedbranches.Issues / polish (non-blocking)
updateis not in the hook's skip-list (onlyinit/syncare). On a drifted tree, runningsequant update— the remediation command — first prints "…N file(s) differ… Run: sync --force (or update)" and then updates. Mildly circular/noisy. Suggest addingupdateto the skip set (one line:if (cmd === "init" || cmd === "sync" || cmd === "update") return;).Suggestion (optional):
doctorcallsareSkillsOutdatedbut still only reports the version marker — it could now surfacecontentDrifttoo, giving users a content-aware health check. Out of scope for this issue.Self-Evaluation
tscclean), ran the suite (53 passing incl. 19 new), traced the preAction wiring and thecomputeTemplateChangesreuse end-to-end, and confirmed callers (doctor.ts) remain backward-compatible with the widened return type.Verdict: AC_MET_BUT_NOT_A_PLUS
All five ACs are met with high-quality, well-tested, well-documented code and green CI — this is essentially mergeable. It lands at AC_MET_BUT_NOT_A_PLUS only for the two optional polish items above (skip
updatein the pre-flight to avoid the circular warning; file the mtime-cache follow-up). Both are cheap; addressing #1 would make it A+.Documentation
[Unreleased]entry added (fix(sync): areSkillsOutdated/checkAndWarnSkillsOutdated pre-flight is version-only — misses content drift (sibling of #708) #713)docs/internal/plugin-updates.mdupdated (pre-flight drift section + AC-3/AC-5 rationale)Next Steps
updateto the preAction skip-list to avoid the circular "run update" warning duringsequant update./docs 713if feature docs are desired (internal docs already updated).fix(#713): cache the pre-flight drift scan + skip it on `update`
admarble commentedon Jun 4, 2026
Gap fixes pushed (follow-up to QA)
Both QA polish items are now fixed in PR #717 (commit
70bdeb6), taking this to A+:1. UX gap —
updatetriggered the circular pre-flight warning.The
preActionhook now excludesupdatealongsideinit/sync(bin/cli.ts).updateis itself the command that resolves drift, so the warn-only "run sync/update" message was a nag right before it ran.2. AC-5 performance — full scan ran on every command for up-to-date installs.
The existing gate only skipped on a version mismatch, but the common case is a match — so the ~15ms read+render+diff template scan ran on every command. Replaced the prose "mtime cache is a follow-up" note with an actual opt-in stat-only fingerprint cache:
.claude/.local/override, and the config/manifest.sync/updaterewrites bump mtimes, so the cache self-invalidates — no explicit cache-clearing.areSkillsOutdated({ cache: true })from the hotpreActionpath only;doctor/syncstay uncached for fresh truth. Degrades gracefully: any fingerprint/cache error falls back to a fresh scan, write failures are swallowed.Verification:
tscclean,eslint --max-warnings 0clean, 23synctests (4 new cache tests: hit / mtime-miss / default-uncached / graceful-fallback) + 34doctortests green. Docs (docs/internal/plugin-updates.md) + CHANGELOG updated.Note: PR #717's branch had been rebased server-side (head
8e4b10f) to exclude the already-merged #714 content; this commit was replayed onto that real head as a clean fast-forward (8e4b10f..70bdeb6), so no #707/#714 content was re-introduced.Updated verdict: READY_FOR_MERGE (pending CI green on
70bdeb6).fix(#713): make pre-flight skill check content-aware, not version-only (
fix(#1490): the Skills Version check says "Up to date" when skills di…