Repository navigation
Description
Epic: graph-2026-10-ergonomics Tier: mechanical Execution: sequant_run Blocked by: #1602
Problem
Sequant delivers its guard hooks two ways: sequant init writes .claude/hooks/*.sh and registers them in .claude/settings.json, and the plugin ships the same scripts in hooks/hooks.json. Nothing arbitrates. On 2026-10-26 both channels were active in both inspected checkouts (sequant itself and matcha-maps): the timing logs show the same tool call logged twice at the same second, costing 70–120 ms (pre) plus ~40 ms (post) per call. doctor checks 4–5 only look for .claude/hooks and its mode bits; init.ts never reads enabledPlugins. §3 of the founding doc.
Decisions
| ID | Decision | Rejected alternative |
|---|---|---|
| D-1.1 | doctor gains a Hook channels check reading project settings.json hooks plus enabledPlugins in ~/.claude/settings.json and .claude/settings.local.json; each enabled plugin is resolved to its install path through ~/.claude/plugins/installed_plugins.json and counts as a channel only if its hooks/hooks.json registers pre-tool.sh; fail when a repo registration and such a plugin coexist; message names both sources and both fixes |
matching on the plugin name (a dev plugin without a hooks/ dir would false-positive); runtime dedupe in the hook scripts (no tool-use id in the payload; identical consecutive calls would skip a guard) |
| D-1.2 | init and update skip the hooks group when such a plugin is enabled and record "hooks": "plugin" in .sequant-manifest.json; one printed line says so |
asking at init (OQ-1; owner may override) |
Acceptance Criteria
- AC-1:
doctorreportsfailfor a checkout whose.claude/settings.jsonregisterspre-tool.shwhile an enabled plugin's resolved install path carries ahooks/hooks.jsonregisteringpre-tool.sh, andpassotherwise. Evidence:npx vitest run src/commands/doctor.test.ts -t "Hook channels"→≥ 4 passed, 0 failed(fixtures: both active → fail naming both paths; repo only → pass; plugin only → pass; plugin enabled but its install path has nohooks/hooks.json→ pass) - AC-2:
initwith a sequant plugin enabled writes no.claude/hooks/and no hook entries in.claude/settings.json, and the manifest carries"hooks": "plugin". Evidence:npx vitest run src/commands/init.test.ts -t "plugin channel"→≥ 2 passed, 0 failed - AC-3:
updateon a manifest with"hooks": "plugin"leaves hooks absent instead of adding them. Evidence:npx vitest run src/commands/update.test.ts -t "hooks: plugin"→≥ 1 passed, 0 failed - AC-4: The plugin-distribution doc states the one-channel rule and names the
doctorcheck. Evidence:grep -c 'Hook channels' docs/features/plugin-distribution.md→≥ 1 - AC-5: No skill-directory edits. Evidence:
git diff --name-only $(git merge-base origin/main HEAD)..HEAD | grep -cE '^(plugin/|\.claude/skills/|templates/skills/)'→0(constraint)
May touch
src/commands/doctor.ts, src/commands/init.ts, src/commands/update.ts, the manifest reader/writer, their tests, docs/features/plugin-distribution.md, CHANGELOG.
Non-Goals
- Changing the hook scripts or
hooks/hooks.json. - Deduplicating at runtime.
Done when
A user with the plugin installed who runs sequant init gets one set of hooks, and a user who already has both learns it from sequant doctor with the fix spelled out.
Activity
docs(#1602): graph-2026-10-ergonomics — founding doc, evidence, issue…
admarble commentedon Oct 27, 2026
Runner context (2026-10-26, before the W0 launch). For the spec, exec and qa phases.
main:docs/internal/graph-2026-10-ergonomics/PROJECT-DISCUSSION.md(the §N citations in this issue point there) andphase0-evidence.md. Read the cited section before planning; D-rows there are decisions, not suggestions. If implementing shows a D-row is wrong, say so in the PR body rather than quietly deviating..claude/skills/**,templates/skills/**orplugin/**. Skill-side changes belong to feat(skills): the human-surface reference — decisions viaAskUserQuestion, waiting per mode, completion with a link; skills callsequant comment renderandsequant mutation …instead of hand-rendering #1606.npm testat most once, in the foreground, withtimeout 1500, and only after a WIP commit. Prefer targetednpx vitest run <file>while iterating. Each phase has a hard 30-minute wall; the suite takes 10–13 minutes.CLAUDE.mdrule: a mutation-verified record in the PR body,failedTeststarting with the test file path. A mutation must still type-check (delete the block, neverfalse &&).Issue-specific: §3 D-1.1 is the contract: detect a hook channel by resolving each enabled plugin's install path (via
~/.claude/plugins/installed_plugins.json) and checking forhooks/hooks.json, never by matching the plugin name. Thedoctorcheck uses the existingCheck {name,status,message,fix?}shape insrc/commands/doctor.ts. Before adding a new reader of the plugin registry, grep for existing ones; if a second producer or an earlier fix of the same artifact turns up, name the owner in the PR and stop rather than patch locally.admarble commentedon Oct 27, 2026
Complexity: Standard (5 ACs, 3 directories)
AC Quality Check
The linter passes all 5 ACs (5/5, 0 flagged). Every AC has one line and an
Evidence:clause. Vacuity check againstmain(d6d66a9): AC-1, AC-2 and AC-3 name-tcases that do not exist yet, andgrep -c 'Hook channels' docs/features/plugin-distribution.mdreturns0today, so AC-1 to AC-4 all fail today. AC-5 is a constraint, so it passes today by design.Scope Assessment
Non-Goals: do not change the hook scripts or
hooks/hooks.json; no runtime dedupe.src/commands,src/lib,docs/features)Verdict:⚠️ SCOPE_WARNING. Both features share one detector, so a split would duplicate it. Keep it as one issue.
Acceptance Criteria
AC-1: doctor
Hook channels. Verification: Unit Test. Given a temp home whoseinstalled_plugins.jsonmaps an enabled plugin to an install path, and a project.claude/settings.json→ Whendoctorchecks run → Thenfail(the message names both paths and both fixes) only when both channels registerpre-tool.sh. Four fixtures, as the AC lists. Assumption:enabledPluginsvalues are booleans, and a localfalseoverrides a usertrue. This checkout shows that today:sequant@sequantistruein user settings andfalsein.claude/settings.local.json.AC-2:
initwith the plugin channel. Verification: Unit Test. Given a detector that reports a plugin hook channel → Wheninitruns → Then there is no.claude/hooks/, no.claude/settings.jsonhook entries, the manifest has"hooks": "plugin", and one line is printed.AC-3:
updatehonours"hooks": "plugin". Verification: Unit Test. Given such a manifest → Whenupdateruns → ThenapplySetcontains no.claude/hooks/**and no.claude/settings.json.AC-4: Docs. Verification: grep. The plugin-distribution doc states the one-channel rule and names
Hook channels. Line 74 ("Hooks … Yes (viasequant init)") must also stop implying both channels.AC-5: No skill-directory edits. Verification: diff grep (C-1 freeze).
Implementation Plan
Phase 1: One detector (one producer, C-3)
src/lib/hook-channels.tsthat exportsdetectHookChannels({ cwd, home })→{ repo: string | null, plugins: { id, installPath, hooksJson }[] }. It mergesenabledPluginsin Claude Code's precedence order: user~/.claude/settings.json< project.claude/settings.json< local.claude/settings.local.json. Only ids whose final value istruecount.installed_plugins.json(v2:plugins[id]is an array of entries). Pick the entry withscopelocal/project whoseprojectPathequals the checkout, otherwise theuserentry. Local-scope entries are per project; this machine has 60+sequant-dev@my-modsentries, one per checkout.<installPath>/hooks/hooks.jsonparses and some command string containspre-tool.sh. Never match on the plugin name (D-1.1).homethe same waycheckShadowingLocalSequantdoes (doctor.ts:194).hooks?: "plugin"toManifestinsrc/lib/manifest.ts, plus acreateManifestoption. Add one path predicate,isHookChannelPath(p)(.claude/hooks/**,.claude/settings.json), so every filter below uses it.Phase 2: Consumers
Hook channelscheck tocollectInstallChecksusing theCheckshape. When the manifest says"hooks": "plugin", checks 4–5 (Hooks,Settings) report pass with "hooks come from plugin " instead of the current "No hooks directory" / "No settings.json" warns.copyTemplates. On a hit, pass a newskipHooksoption that skips thehookscopy and thesettings.jsonwrite. The template holds only hooks, so skipping the whole file is correct. Writehooks: "plugin"and print one line. Apply this only when--agentis claude: codex's.codex/config.tomlwraps.claude/hooks/*.sh.allChangeswithisHookChannelPathwhenmanifest.hooks === "plugin".updateManifestmust preserve the field.Phase 3: Docs and changelog
docs/features/plugin-distribution.md(one-channel rule and theHook channelscheck), add a CHANGELOG entry, and add an ADR (see below).Design Review
src/lib/hook-channels.ts, because three commands consume it and none of them should own it. The scope field belongs inmanifest.ts, next togroups(fix(sync): a --only skills install warns 'N file(s) differ' forever, and the suggested sync --force overwrites the repo's constitution #1409)."hooks"toInstallGroup/groups.updaterefuses every partial scope (update.ts:204), so that approach would blockupdatefor exactly these users.getInstallScope+ filter).git log -S enabledPluginsshows no earlier fix insrc, and no existing reader ofinstalled_plugins.jsonexists outside theupstreamtests. 0 prior fixes, so this is not a recurrence.enabledPluginsforsequant*?" Becausesequant-dev@my-modsmay have nohooks/dir (§3 D-1.1), and a localfalsedisables a usertrue. "Why skip all ofsettings.json?" Because the template holds onlyhooks, and users extend it throughsettings.local.json(templates.ts:317ruling).copyTemplates(used byinitandsync),updateapplySet(computeTemplateChanges), andprovisionCodex(wrapper only).update.ts,sync.ts(filterToInstallScopeand drift pre-flight) anddoctor.ts(drift message).sync(full) is a third producer the issue does not list. Without a fix,sequant syncre-adds the hooks, and the drift scan reports the absent hook files asnewdrift on every run (templates.ts:862). Every site uses the sameisHookChannelPathpredicate (derived AC-6).ADR required. The plan chooses a manifest field over an install group (Q2). The exec PR adds
docs/adr/NNNN-hook-channel-manifest-field.md.Feature Quality Planning
installed_plugins.jsonorhooks.jsongives "no plugin channel" and never crashes doctor or init. Needs a unit test.warncase (neither channel present while the manifest expects hooks) has no AC. Leave it out unless it costs one branch.Mutation-verified:record whosefailedTeststarts with the test file path (e.g. delete the plugin branch indetectHookChannelsand confirm the "both active" case fails).Derived ACs
syncand the drift scan honour"hooks": "plugin". They write no hook files and report none as drift. Evidence:npx vitest run src/commands/sync.test.ts -t "hooks: plugin"→ ≥ 1 passed.passwith no throw. Covered inhook-channels.test.ts.Open Questions
.claude/settings.jsonenabledPluginstoo? Recommendation: yes; Claude Code merges all three. Impact if wrong: a plugin enabled at project scope goes undetected.sync(AC-6) here? It is outside "May touch". Recommendation: yes; without it the nextsequant syncundoes AC-2. Impact if wrong: AC-2 only lasts until the nextsync.Recommended Workflow
Phases: spec → testgen → exec → qa
Quality Loop: disabled
Reasoning: AC-1 to AC-3 declare vitest evidence (unit_test), so testgen stubs the named
-tcases. The scope warning comes from the shared detector, not from size.Label Review
Current: graph-2026-10-ergonomics. Recommended: add
enhancement,planned. No UI files, so notestphase.admarble commentedon Oct 27, 2026
QA Verdict: AC_MET_BUT_NOT_A_PLUS
Gaps:
fix(#1604): check restores the tree when the runner throws, three fil…
fix(#1603): init names both active channels on a re-init that already…
feat(#1603): one hook channel per checkout — doctor fails when repo h…
feat(#1604): sequant mutation begin | check | render — mutation verif…