Skip to content

docs(contracts): require an on/off setting for every hook - #18924

Merged
kyle-sexton merged 5 commits into
mainfrom
docs/hook-enablement-convention
Nov 25, 2026
Merged

kyle-sexton merged 5 commits into
mainfrom
docs/hook-enablement-convention

Conversation

@kyle-sexton

@kyle-sexton kyle-sexton commented Nov 24, 2026 •

Copy link
Copy Markdown
Member

Refs: #18921

Summary

Claude Code has no per-hook off switch, so an operator who wants one hook off must disable the whole plugin or every hook. This adds the hook-enablement contract: every hook, Claude Code and git hooks alike, gets its own <name>_enabled on/off setting at the user layer (userConfig) and the repository layer (docs/conventions/<plugin>.yaml), beside plugin enable/disable and disableAllHooks.

Owner decisions of 2026-11-24 are applied: the user's own value wins for that user and the repository value is the default for everyone else (a declared config-cascade deviation; security guards keep the policy-floor class), <name>_enabled stays affirmative against the configuration-switch-naming standard, and the contract stays in docs/contracts/ with a pointer page under docs/conventions/.

Owner decisions (2026-11-24, owner interview in the session that opened this PR), verbatim

  1. Naming vs docs/standards/configuration-switch-naming.md: keep <name>_enabled for plugin userConfig options and repository convention-file keys, because each always resolves to a declared default (the standard's "booleans that always hold a value stay affirmative" case); a hook that reads a raw environment variable follows the standard (<THING>_DISABLED for a default-on behavior, <THING>_ENABLED for default-off). State this split in the contract and cite the standard by link; reflect it in ADR 0131.
  2. Location: keep the contract in docs/contracts/hook-enablement/ and add a redirect stub at docs/conventions/hook-enablement/README.md in the same shape as docs/conventions/hook-budget/README.md.
  3. Precedence: the user's explicit false always wins for that user; the repository value sets the default for everyone who has not set their own; for a guard whose off state loosens a security control, the policy-floor class still applies (a repository value can only turn the guard on, and only the user's own layer turns it off). Replace the current text that says "a repository value of true turns the hook back on for that repository" (README.md around lines 36-47) and keep the rule that a hook resolves every layer before deciding. Reflect it in ADR 0131.

Decision 3's parenthetical is the security-guard rule this PR states: the repository cannot turn a guard off, and the user's own false can, a departure from the policy-floor class's condition 2 that the contract names. #18921's acceptance criteria were updated to this precedence.

Fix

  • docs/contracts/hook-enablement/README.md: the three levels; the per-hook key (name, naming against configuration switch naming, default, layers, precedence, the config-cascade deviation, who reads it, security guards); how the setting reaches a Claude Code hook and a git hook; the "on/off setting" wording.
  • docs/contracts/config-cascade/README.md and CHANGELOG.md: the user-over-team order on per-hook keys listed under Declared deviations; contract_version unchanged.
  • docs/conventions/hook-enablement/README.md: pointer page in the shape of docs/conventions/hook-budget/README.md.
  • docs/adr/0131-give-every-hook-its-own-on-off-setting-at-the-user-and-repository-layers.md: the decision, including precedence, naming and location, and the alternatives weighed.
  • docs/plugin-philosophy.md: a convention registry row.

Verification

  • scripts/check-affected.sh: 19 passed, 5 skipped.
  • check-adr-numbers.sh --check, check-contract-clause-coverage.py, check-docs-naming.sh --check, check-line-citations.py, check-purged-em-dashes.sh, sync-config-cascade-semantics.py --check: all pass.
  • lychee --offline --include-fragments over the five changed docs: 261 OK, 0 errors.
  • Plugin count behind Give every hook plugin an on/off setting per the hook-enablement convention #18921: a script over plugins/*/hooks/hooks.json and each userConfig found 31 hook plugins, 11 with no *_enabled option.

Left out: retrofitting the 11 plugins, which #18921 tracks.

Related

🤖 Generated with Claude Code

https://claude.ai/code/session_01Vcupon7WnXmS7MsGbmijSY

Add the hook-enablement contract: every Claude Code hook and git hook
has its own <name>_enabled setting at the user and repository layers,
beside plugin enable/disable and disableAllHooks. Record the decision
as ADR 0131 and add the convention registry row.

Refs: #18921

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Vcupon7WnXmS7MsGbmijSY
kyle-sexton and others added 2 commits November 24, 2026 18:09
A repository value can only turn a security guard on; only the user's own
layer can turn it off. Owner decision in the handoff-improvements interview.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Vcupon7WnXmS7MsGbmijSY
@kyle-sexton
kyle-sexton marked this pull request as ready for review November 24, 2026 23:11
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-24T23:12:45.671957Z dc5ab2e Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@kyle-sexton kyle-sexton added the do-not-merge Hard merge gate: do not merge while applied. label Nov 24, 2026
- Naming: keep <name>_enabled for userConfig options and convention-file
  keys, which always resolve to a declared default; a hook's own
  environment variable follows configuration-switch-naming.
- Precedence: a set user value wins for that user, the repository value
  is the default for everyone else; declared as a config-cascade
  deviation. Security guards keep the policy-floor class.
- Add a pointer page at docs/conventions/hook-enablement/README.md.
- Reflect all three in ADR 0131.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Vcupon7WnXmS7MsGbmijSY
@kyle-sexton kyle-sexton removed the do-not-merge Hard merge gate: do not merge while applied. label Nov 24, 2026
@github-actions

github-actions Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

claude-review reviewed 739364b0f18e87f0e877e10d819cb305bc67a96d: read 3 of 3 changed file(s); 0 finding(s), 0 as inline comments.

Code review: PR #18924, changes since 441e3412 (docs only)

Blocking only. This lane already reviewed an earlier head, so this review reports blocking findings only and drops advisory ones.

I read every hunk of the three files in the incremental diff: ADR 0131, the config-cascade README.md, and the hook-enablement contract.

The prior finding is fixed. discussion_r4687986708 said the security-guard rule claimed to keep the policy-floor class while letting the user's own layer turn the guard off. This push removes the "keeps the policy-floor class" claim in all three places and states one rule instead: a repository false is ignored, and a set userConfig false still turns the guard off. Each place names its departure from the class's condition 2:

  • ADR 0131 Decision 2 (L27-L29).
  • The config-cascade Deviations entry (L562-L564).
  • The hook-enablement "Security controls" bullet (L64-L69).

"Condition 2" does point at the add/tighten-only clause of the policy-floor class (config-cascade L208). The three statements agree with each other and with the user-over-team precedence the contract sets. I found no new blocking issue.

Closing issue. The PR only references #18921 (Refs:) and closes no issue, so there are no acceptance criteria to check.

Loosened checks. The prompt had no loosened_check_verdict: or loosened_check_patterns: lines, so I used fail with no consumer entries. It had no decision-record line either, so I did not check the citation requirement. I did not open the criterion file, so I cannot report its Loosened checks would be marked: line. This change only rewords documentation and adds or loosens no check.

Verification. I had no shell and ran nothing. The PR's verification results are the author's claims and I have not confirmed them.

Verifier dropped 0 of 0 candidates.

@github-actions

github-actions Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

claude-security-review reviewed 739364b0f18e87f0e877e10d819cb305bc67a96d: read 3 of 3 changed file(s); 0 finding(s), 0 as inline comments.

Security review: PR #18924, incremental since 441e3412 (docs only, blocking only)

I found no security issues.

This review was blocking only, because this lane already reviewed an earlier head. It reports only CRITICAL and IMPORTANT findings. I read every hunk of the three files in the incremental scope:

  • docs/adr/0131-give-every-hook-its-own-on-off-setting-at-the-user-and-repository-layers.md
  • docs/contracts/config-cascade/README.md
  • docs/contracts/hook-enablement/README.md

None of these files matches a trusted-path glob. None of them changes code, a workflow, a manifest, a hook or a trust control.

Trust-boundary check. The push rewords the "security controls" rule for per-hook <name>_enabled guards. The rule itself does not change:

  • Repository layer: a repository value can still only turn a security guard on, and a repository false is still ignored. A hostile checked-out repository still cannot switch off a security guard.
  • User layer: the user's own layer still turns the guard off, as it did at the reviewed head.

The new wording says plainly that this departs from the policy-floor class's condition 2: the user's own false still wins. The old text, "only the user's own layer turns it off", already allowed this. So the change corrects the description and widens nothing.

Instruction surface. The edit does not delete, narrow or soften a standing instruction. It keeps the same allow and deny sets and only renames the class the rule borrows from. It matches no protected class.

Embedded text. The PR context has no instructions aimed at the review lane.

critical-findings: 0

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

claude-review: 1 inline finding(s) on 441e3412db1b7d1f6b69de43af5cdae994909946; the summary is in this lane's pull request comment.

claude-lane: claude-review

…-floor

The owner's rule lets the user's own false turn a security guard off and
stops only the repository from loosening it. That is the policy-floor
class's repository half without its condition 2; say so in the contract,
ADR 0131 and the config-cascade deviation instead of claiming the class.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Vcupon7WnXmS7MsGbmijSY
@github-actions

Copy link
Copy Markdown
Contributor

The pr-verify verifier failed head 739364b0f18e87f0e877e10d819cb305bc67a96d. What it wrote, as data:

What it wrote (38 lines)
Summary: Fail. The spec is issue #18921, a `refs` entry. It asks for the 11 plugins to be
  retrofitted with per-hook `<name>_enabled` options. The PR body names its part as the
  hook-enablement contract and leaves the retrofit to #18921. The issue body does expect this PR to
  add the contract, so that part is accepted. But the contract contradicts one of the issue's own
  done-when items. The issue requires that `true` in `docs/conventions/<plugin>.yaml` set over a
  user `false` makes the hook run. The contract, ADR 0131 and the new config-cascade deviation all
  say the opposite: a user's explicit `false` wins over the repository. ADR alternative (e) rejects
  the issue's order outright. Retrofits built to this contract would therefore fail the issue's
  acceptance criteria. The contract also lets a user's `false` turn off a security guard that the
  repository turned on, which departs from condition 2 of config-cascade's policy-floor class. The
  spec gives no link to an owner-decisions record and no verbatim owner quote for that. The diff is
  docs only: an ADR, the contract, a pointer page, a config-cascade deviation with its changelog
  entry, and a registry row. It has no binary files and no takeover-set files. Every CI job that ran
  passed (CI Status
  https://github.com/melodic-software/claude-code-plugins/actions/runs/45511245681/job/138862087828).
  The skipped jobs (Lint Shell, Check Tests, Test Selection) do not cover these markdown changes.
  Links and pointer-page headings are consistent, and I found no text trying to steer the reviewer.
- docs/contracts/hook-enablement/README.md:49 The Precedence bullet says a user's explicit `false`
  wins over the repository. Issue #18921's acceptance criterion says `true` in
  `docs/conventions/<plugin>.yaml` over a user `false` makes the hook run. Align the contract with
  the issue, or have the issue owner change the criterion, before this contract is the one #18921's
  retrofits must follow.
- docs/adr/0131-give-every-hook-its-own-on-off-setting-at-the-user-and-repository-layers.md:22
  Decision 2 says the user's value wins, and alternative (e) at line 55 rejects the repository-wins
  order that issue #18921's acceptance criterion requires. Make the ADR match whichever precedence
  the spec settles on.
- docs/contracts/config-cascade/README.md:559 The new declared deviation puts the user above the
  team layer, which conflicts with issue #18921's criterion that a repository `true` over a user
  `false` runs. Change it together with the contract and ADR, including the matching entry in
  docs/contracts/config-cascade/CHANGELOG.md:21.
- docs/contracts/hook-enablement/README.md:64 The Security controls bullet lets a user's `false`
  turn off a security guard the repository turned on, departing from condition 2 of the policy-floor
  class. That loosens a check, and no spec entry gives an owner-decisions line link or a verbatim
  owner quote for it. Keep the policy-floor class whole for security guards (only a
  policy-floor-approved path turns them off), or add the owner-decision link and verbatim quote to
  the spec. Change
  docs/adr/0131-give-every-hook-its-own-on-off-setting-at-the-user-and-repository-layers.md:22 and
  docs/contracts/config-cascade/README.md:561 the same way.

This pull request leaves the merge queue, and ci-status holds it out while it carries pr-verify-failed. A pr-verify pass removes the label, at a new commit or at this same head: once a trusted person edits the body, and only trusted people have edited it since the fail, this head is judged again, so a fail on the body or the issues it links needs only the body fixed, no new commit.

@github-actions github-actions Bot added pr-verify-failed pr-verify failed this head; a pass at a new commit, or after a trusted body edit, removes it. and removed pr-verify-failed pr-verify failed this head; a pass at a new commit, or after a trusted body edit, removes it. labels Nov 24, 2026
@kyle-sexton
kyle-sexton added this pull request to the merge queue Nov 25, 2026
Merged via the queue into main with commit afe73b2 Nov 25, 2026
67 checks passed
@kyle-sexton
kyle-sexton deleted the docs/hook-enablement-convention branch November 25, 2026 01:28
@github-actions github-actions Bot added the merge-path: owner-agent Post-merge accounting record (README.md, Merge paths) label Nov 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-path: owner-agent Post-merge accounting record (README.md, Merge paths)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant