Skip to content

Evaluate splitting context-budget's settings-write-ask hook from its two skills #3726

Closed

Description

@kyle-sexton

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>_enabled userConfig 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.sh governs how it may be re-declared.

Related

Activity

  1. added
    needs-triage
    on Sep 4, 2026
  2. added
    agent-ready
    status: ready
    and removed
    needs-triage
    on Sep 23, 2026
  3. kyle-sexton commented on Sep 23, 2026

    @kyle-sexton
    MemberAuthor

    This was generated by AI during triage.

    Decision defaulted: merge into guardrails' Write/Edit dispatcher rather than split — veto before merge

  4. added theissue type on Sep 23, 2026
  5. kyle-sexton commented on Sep 23, 2026

    @kyle-sexton
    MemberAuthor

    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 ask when 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 permissionDecision ask over any non-blocking document when it must pick one JSON result to emit, so it already knows how to carry an ask verdict 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 ask verdict 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:

    • ADR 0028 — the governing classification
    • guardrails' guard dispatcher (run-guards.sh) and its existing ask-aware verdict-merge logic — the destination for the settings-write check
    • The settings-write-ask check's own userConfig boolean (settings_write_ask_enabled) and its settings-surface detection logic — preserved behavior, relocated call site
    • check-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 use

    Acceptance criteria:

    • The settings-write-ask check runs as part of guardrails' Write/Edit/MultiEdit/NotebookEdit guard dispatch rather than as a separate hook registration, so a matching write triggers one dispatcher process instead of two.
    • A write targeting a Claude Code settings surface still returns a permissionDecision of ask after the move, with the same detection behavior as before.
    • The check's enable/disable userConfig switch still exists (under its existing name or a documented rename) and still suppresses the check when disabled.
    • context-budget's plugin manifest no longer registers the settings-write-ask hook once the move lands; context-budget's two skills are unaffected.
    • No new plugin is created; aside from the moved hook, context-budget's and guardrails' plugin structures are otherwise unchanged.

    Out of scope:

  6. self-assigned this
    on Sep 27, 2026
  7. kyle-sexton commented on Sep 27, 2026

    @kyle-sexton
    MemberAuthor
    No description provided.
  8. kyle-sexton commented on Sep 27, 2026

    @kyle-sexton
    MemberAuthor

    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

    1. The hook guards this plugin's own write path. The /context-budget:audit fix path edits project settings, and it names this hook as the protection on those writes: "The plugin's PreToolUse checkpoint returns permissionDecision: \"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 to guardrails, a user who installs context-budget alone runs audit fix with no checkpoint on its settings writes. Neither manifest declares a dependency on the other plugin (neither plugin.json has a dependencies key), so nothing would pull guardrails in.

    2. The setup skill checks the hook's prerequisites. /context-budget:setup verifies the node that the checkpoint hook and the measurement engine both need, and it reports the effective settings_write_ask_enabled value (plugins/context-budget/skills/setup/SKILL.md:2, :37-40, :56-60). docs/plugin-philosophy.md:496-497 gives the node-launched hook as the reason context-budget has a setup skill at all. So setup covers the hook, and a move would leave setup checking a hook in another plugin.

    3. The merge would not save a process. guardrails' Write/Edit dispatcher runs bash guards through run-guards.sh (plugins/guardrails/hooks/hooks.json:10), and none of its guards use node. The check is Node (settings-write-ask.mjs, exec-form node at plugins/context-budget/hooks/hooks.json:10-11). Folding it in leaves two options:

      • Port the detection logic to bash. The item lists that as out of scope ("Rewriting the settings-write-ask check's own detection logic").
      • Have the dispatcher spawn 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-510 prefers deny over ask over the first document. It just doesn't change this outcome.

    4. 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 the settings_write_ask_enabled kill switch (plugins/context-budget/.claude-plugin/plugin.json:12-17, read at settings-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-budget under Class C (ADR 0028:28-32). On the evidence, the hook sits in the same position as disk-hygiene's guard: it protects the plugin's own write path. That is Class B, "the hook IS the feature mechanism" for the audit fix path'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 in guardrails rather 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|NotebookEdit matcher 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 no context-budget installed. If that happens, have guardrails add its own settings guard alongside this one, and leave this one in place.

  9. removed
    status: ready
    agent-ready
    on Sep 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Fields

No fields configured for Task.

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions