Repository navigation
Description
A Class C candidate under
ADR 0028.
The ADR gates the proposal; it does not mandate the split. A decline with recorded reasoning
closes this issue.
The shape
context-budget carries 2 skills and one hook: PreToolUse on
Write|Edit|MultiEdit|NotebookEdit → settings-write-ask.mjs (node, exec form), which asks before a
write lands on a Claude Code settings surface.
What to decide
The hook and the skills look unrelated on their names alone — a settings-write confirmation gate
versus context-budget auditing — which is what put this on the Class C list. The first job is to
check whether that reading is right, because if it is, this is the cleanest split of the five: the
hook has nothing to do with context budget and is arguably in the wrong plugin entirely.
Note the second possibility, which is more interesting than a split: the hook may belong in
guardrails, which is the fleet's home for PreToolUse gates on Write/Edit and already runs three
of them through one dispatcher on that exact matcher. Moving it there would cost one fewer hook
process per write rather than adding a plugin, which is the opposite of what a split does to the
budget.
The budget angle, which is specific to this candidate
This is the only Class C hook that adds a separate process on the always-on Write/Edit path —
guardrails already dispatches three guards there in one process. Merging into that dispatcher is
the option that improves docs/conventions/hook-budget/ compliance; splitting into its own plugin
leaves the process count where it is. Weigh both against a plain decline.
One constraint on the merge option: the hook emits "ask", and a hook's "ask" forces a prompt even
in auto mode. Check how run-guards.sh's decision merge handles an ask alongside other guards'
verdicts before proposing the move.
Constraints
- The
<name>_enableduserConfig boolean stays either way, and must survive a move to another
plugin under its existing name or a documented rename. - The hook is node in exec form;
scripts/check-hook-exec-form.shgoverns how it may be re-declared.
Related
- PreToolUse guard remediation: scratch-root default, kill-switch hoist, MCP coverage, two conventions #3719 — the audit that produced the taxonomy
- ADR 0028 — the classification and the bar
docs/conventions/hook-budget/— the ceiling the merge option would help and the split would not
Activity
chore(topics): prune the contract slice before merge
fix(hooks): PreToolUse guard remediation — scratch-root default, kill…
kyle-sexton commentedon Sep 23, 2026
This was generated by AI during triage.
Decision defaulted: merge into guardrails' Write/Edit dispatcher rather than split — veto before merge
kyle-sexton commentedon Sep 23, 2026
This was generated by AI during triage.
Agent Brief
Type: Task
Summary: Merge context-budget's settings-write-ask hook into guardrails' existing Write/Edit guard dispatcher instead of splitting it into its own plugin.
Current behavior:
context-budget ships as one plugin with 2 skills and one hook: a pre-write check (run as its own Node process, in exec form) on Write/Edit/MultiEdit/NotebookEdit that asks before a write lands on a Claude Code settings surface, returning a permissionDecision of
askwhen it does. This hook runs as a separate process on every matched write, apart from guardrails, which already runs several guards on the identical matcher through one dispatcher process. That dispatcher's own verdict-merge logic already prefers a document carrying permissionDecisionaskover any non-blocking document when it must pick one JSON result to emit, so it already knows how to carry anaskverdict through. ADR 0028 flags the context-budget hook as unrelated in name to the plugin's own context-budget-auditing skills, making it the cleanest split candidate on its face — but folding it into guardrails costs one fewer process per write rather than adding a plugin.Desired behavior:
Defaulted decision: merge the settings-write-ask check into guardrails' existing Write/Edit/MultiEdit/NotebookEdit guard dispatcher. Maintainer-vetoable alternative: extract the settings-write-ask hook into its own standalone plugin, separate from context-budget's two skills.
The dispatcher already merges an
askverdict correctly among several guards' results, so folding this check in adds no new merge logic; it removes a separate always-on process from the Write/Edit path. The check's own userConfig kill switch survives the move, either under its existing name or a documented rename.Key interfaces:
run-guards.sh) and its existing ask-aware verdict-merge logic — the destination for the settings-write checksettings_write_ask_enabled) and its settings-surface detection logic — preserved behavior, relocated call sitecheck-hook-exec-form.sh— governs how the moved check may be re-declared, since it currently runs via a Node exec-form entry rather than the shell-script form guardrails' other guards useAcceptance criteria:
askafter the move, with the same detection behavior as before.Out of scope:
kyle-sexton commentedon Sep 27, 2026
kyle-sexton commentedon Sep 27, 2026
This was generated by AI during work-loop.
ADR 0028 evaluation: context-budget settings-write-ask hook
Recommendation: DECLINE. No packaging change. Keep the hook in
context-budget. This overrides the triage default ("merge into guardrails"), for the reasons below.Evidence
The hook guards this plugin's own write path. The
/context-budget:auditfix path edits project settings, and it names this hook as the protection on those writes: "The plugin's PreToolUse checkpoint returnspermissionDecision: \"ask\"for any settings-surface write, so even in auto mode the write prompts rather than sliding through" (plugins/context-budget/skills/audit/SKILL.md:229-232). The hook's prompt text mentions that fix path by name ("If this write came from the /context-budget:audit fix path, the printed config and the measured delta should match what you approved",plugins/context-budget/hooks/settings-write-ask.mjs:52-56). The ADR's Class B test covers this case:disk-hygiene"polices that plugin's OWN delete engine — split apart, the guard and the engine version independently and the guard can be installed without what it guards, or worse, the engine without its guard" (docs/adr/0028-classify-a-plugin-s-hooks-by-packaging-before-proposing-a-split.md:24-26). If the hook moves toguardrails, a user who installscontext-budgetalone runsaudit fixwith no checkpoint on its settings writes. Neither manifest declares a dependency on the other plugin (neitherplugin.jsonhas adependencieskey), so nothing would pullguardrailsin.The setup skill checks the hook's prerequisites.
/context-budget:setupverifies thenodethat the checkpoint hook and the measurement engine both need, and it reports the effectivesettings_write_ask_enabledvalue (plugins/context-budget/skills/setup/SKILL.md:2,:37-40,:56-60).docs/plugin-philosophy.md:496-497gives thenode-launched hook as the reasoncontext-budgethas a setup skill at all. So setup covers the hook, and a move would leave setup checking a hook in another plugin.The merge would not save a process.
guardrails' Write/Edit dispatcher runs bash guards throughrun-guards.sh(plugins/guardrails/hooks/hooks.json:10), and none of its guards use node. The check is Node (settings-write-ask.mjs, exec-formnodeatplugins/context-budget/hooks/hooks.json:10-11). Folding it in leaves two options:node. That is still a second process, nested under bash, so the first acceptance criterion ("one dispatcher process instead of two") is not met.The item's premise does check out:
run-guards.sh:496-510prefersdenyoveraskover the first document. It just doesn't change this outcome.Splitting into a standalone plugin has the same flaw. The fix path would lose its guard, and there would be a second plugin, version and catalog entry to keep in step (
ADR 0028:34-36). No consumer who wants one half without the other has been shown. A consumer who wants the skills without the prompt already has thesettings_write_ask_enabledkill switch (plugins/context-budget/.claude-plugin/plugin.json:12-17, read atsettings-write-ask.mjs:31). The ADR names that switch as "the mechanism that already lets a consumer take a Class C plugin's skills and turn its hooks off, which is why no Class C split is urgent" (ADR 0028:73-75).Class
The ADR lists
context-budgetunder Class C (ADR 0028:28-32). On the evidence, the hook sits in the same position asdisk-hygiene's guard: it protects the plugin's own write path. That is Class B, "the hook IS the feature mechanism" for the auditfixpath's safety posture, and the ADR says Class B must not split (ADR 0028:20-26). The ADR's own question for this item (ADR 0028:63, "Does the hook belong inguardrailsrather than in a plugin of its own?") gets a no: the hook belongs with the engine it guards.Disposition
Decline: no move, no split, no matcher change. The
Write|Edit|MultiEdit|NotebookEditmatcher already exits early on any path that is not a settings file (settings-write-ask.mjs:35-46). ADR 0028 says a decline with recorded reasoning closes the item (ADR 0028:55), so this item is being closed. Reopen it if a consumer turns up who needs a settings-write ask with nocontext-budgetinstalled. If that happens, haveguardrailsadd its own settings guard alongside this one, and leave this one in place.