Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
0f274df
docs: add ADR 0072 and the check-placement convention
kyle-sexton Oct 16, 2026
8b168bc
docs(harness-config): stop recommending per-edit report-only hooks
kyle-sexton Oct 16, 2026
d8db7eb
docs(harness-config): place shift-left duplicates per check-placement
kyle-sexton Oct 16, 2026
35f4511
feat(testing): move the test judge and test-scan off hooks
kyle-sexton Oct 16, 2026
a894900
docs: drop references to the removed test-scan hook
kyle-sexton Oct 16, 2026
8218fb1
fix: align PR A text with the check-placement rule
kyle-sexton Oct 16, 2026
b863bc3
docs: define entry assets and the stamp hash in check-placement
kyle-sexton Oct 16, 2026
0a4d247
docs: add the hooks-path-owned decision and partly-staged helper
kyle-sexton Oct 16, 2026
721d8f0
docs: record the typos-format pilot in check-placement
kyle-sexton Oct 16, 2026
4f954f0
docs: add the typos-format pre-commit cost row to check-placement
kyle-sexton Oct 16, 2026
79ecbe8
Merge branch 'main' into chore/check-placement-a
kyle-sexton Oct 16, 2026
7b8a17e
fix(testing): contain the judge pass in a read-only test-judge agent
kyle-sexton Oct 16, 2026
5aeb7b3
fix(testing): quote judge-pass paths safely and escape Grep quotes
kyle-sexton Oct 16, 2026
4ba26e3
docs: plainer wording in plugin-philosophy and hook-precision
melodic-automation-lanes[bot] Oct 16, 2026
abb3768
docs: restore meaning lost in the plainer plugin-philosophy wording
kyle-sexton Oct 16, 2026
7539bb0
fix(testing): judge renamed tests and pick a class no writer has
kyle-sexton Oct 16, 2026
a7f6bd0
docs(testing): say test-scan.sh has no hook row in its header
kyle-sexton Oct 16, 2026
edc1ad8
docs: remove AI-writing tells from convention and philosophy prose
melodic-automation-lanes[bot] Oct 16, 2026
a253b86
docs(testing): regenerate the options reference in the README
kyle-sexton Oct 16, 2026
9aba740
docs: remove AI-writing tells found by ai-slop rubric pass
melodic-automation-lanes[bot] Oct 16, 2026
485476b
docs(testing): regenerate the options reference after a hand edit
kyle-sexton Oct 16, 2026
a99279b
docs(philosophy): replace two colon-spliced sentences with plain stat…
melodic-automation-lanes[bot] Oct 16, 2026
7af3242
fix(testing): judge only changed lines of a renamed test, skip pure r…
kyle-sexton Oct 16, 2026
cba19e0
docs(philosophy): replace colon crutch in fresh-eyes checkpoint ratio…
melodic-automation-lanes[bot] Oct 16, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .changes/harness-config/chore-check-placement-a-79d33e99.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
bump: patch
---

### Changed

- `audit-automation-gaps` no longer recommends a per-edit `PostToolUse` hook for a report-only check and flags an existing one with its placement: a git `pre-commit` hook on changed lines, `pre-push` up to 60 s, CI beyond. Formatters are recommended once per batch (`PostToolBatch`) within a 1 s median per fire, and at `pre-commit`. The shift-left carve-out's second conjunct now requires that placement, where it used to accept an advisory per-edit hook.
- `audit-instructions`' `PostToolUse` worked example places the actionlint check in a git `pre-commit` entry.
7 changes: 7 additions & 0 deletions .changes/playbooks/chore-check-placement-a-c153d7c7.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
bump: patch
---

### Changed

- `boris`: the formatting-hook tip runs the formatter once per batch from `PostToolBatch` and again at git `pre-commit`, in place of a per-edit `PostToolUse` hook. The vendored upstream baseline still matches upstream v8.16.0.
7 changes: 7 additions & 0 deletions .changes/source-control/chore-check-placement-a-c8bf243b.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
bump: patch
---

### Changed

- `/source-control:pull-request` prep runs the `/testing:audit --judge` pass over changed tests when the testing plugin is installed and enabled, and reports `judge pass not run: testing plugin not installed or not enabled` otherwise.
16 changes: 16 additions & 0 deletions .changes/testing/chore-check-placement-a-05d65fbe.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
bump: minor
---

### Added

- `/testing:audit --judge [<base>]`: an opt-in pass that hands each test block the change added or changed to the new `testing:test-judge` agent (Read, Grep and Glob only) on another model class, which reports FLAG, PASS or UNKNOWN for where its expected value came from, with checked quotes and a proposed diff it never applies. `--persist-findings` also writes its verdicts for `/testing:cleanup`.

### Changed

- `/testing:setup check`'s hook-entry section points at `/testing:audit` and names the globs the `test-weaken` hook skips, in place of printing a per-edit `PostToolUse` settings entry.

### Removed

- The per-edit `test-scan` hook rows (the `PostToolUse` Write/Edit rows and the Bash row) and the task-end test judge hooks (the background `PostToolUse` job, the `Stop` relay and the `SessionStart` catch-up). Can't-fail findings come from `/testing:audit` on demand; `test-weaken` stays.
- The `test_judge_enabled`, `test_judge_model`, `test_judge_fallback_model`, `test_judge_effort` and `test_judge_session_runs` options.
18 changes: 2 additions & 16 deletions .performance/ratchets.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,33 +63,19 @@
"ceiling": 3,
"goal": "The PostToolUse Bash check of check-bash-file-changes (#6674) after a command that changed no file, the common case, spends at most this many process creations and execs: node, then one git status; no guard process starts. Correlation: unproven: not measured"
},
{
"name": "testing-posttooluse-bash-test-scan-option-off-spawns",
"command": "bash scripts/hook-census.sh testing PostToolUse test-scan-bash.sh '{\"session_id\":\"census\",\"hook_event_name\":\"PostToolUse\",\"cwd\":\"@DIR@\",\"tool_name\":\"Bash\",\"tool_input\":{\"command\":\"true\"},\"tool_response\":{\"stdout\":\"\",\"stderr\":\"\",\"interrupted\":false}}' --env CLAUDE_PLUGIN_OPTION_TEST_GUARDS_ENABLED=false --check 'test ! -s \"$HOOK_STDOUT\"'",
"field": "spawns",
"ceiling": 1,
"goal": "With test_guards_enabled at its default (false), the PostToolUse Bash row costs only the node launcher: the option gate closes before bash starts. The row has no if, so this is what every Bash call costs a user who never opted in (#5608). Measured on WSL2 Ubuntu with bash 5.3.9, dash as sh, strace 6.19; the ratchet step prints the current versions. Correlation: unproven: not measured"
},
{
"name": "testing-posttooluse-bash-test-scan-no-diff-spawns",
"command": "bash scripts/hook-census.sh testing PostToolUse test-scan-bash.sh '{\"session_id\":\"census\",\"hook_event_name\":\"PostToolUse\",\"cwd\":\"@DIR@\",\"tool_name\":\"Bash\",\"tool_input\":{\"command\":\"true\"},\"tool_response\":{\"stdout\":\"\",\"stderr\":\"\",\"interrupted\":false}}' --env CLAUDE_PLUGIN_OPTION_TEST_GUARDS_ENABLED=true --check 'test ! -s \"$HOOK_STDOUT\"'",
"field": "spawns",
"ceiling": 3,
"goal": "With test_guards_enabled on and a Bash payload that carries no bashEditDiff, the row costs node, then bash, and the script exits at its substring test before jq starts: creations 1, execs 2. This is every Bash call for an opted-in user whose Claude Code does not record changed files (#5608). Measured on WSL2 Ubuntu with bash 5.3.9, dash as sh, strace 6.19; the ratchet step prints the current versions. Correlation: unproven: not measured"
},
{
"name": "multi-agent-pretooluse-bash-docs-fetcher-gate-spawns",
"command": "bash scripts/hook-census.sh multi-agent PreToolUse docs-fetcher-gate.mjs '{\"session_id\":\"census\",\"hook_event_name\":\"PreToolUse\",\"cwd\":\"@DIR@\",\"tool_name\":\"Bash\",\"tool_input\":{\"command\":\"true\"}}' --check 'test ! -s \"$HOOK_STDOUT\"'",
"field": "spawns",
"ceiling": 1,
"goal": "A Bash call outside a multi-agent:docs-fetcher subagent costs only node, which reads the payload, finds another agent_type and stays quiet; the row has no if, so this is what every Bash call costs. Not yet measured with this row: the ceiling is the node-launcher count of testing-posttooluse-bash-test-scan-option-off-spawns, and the first CI run corrects it with propose-tighten. Correlation: unproven: not measured"
"goal": "A Bash call outside a multi-agent:docs-fetcher subagent costs only node, which reads the payload, finds another agent_type and stays quiet; the row has no if, so this is what every Bash call costs. Not yet measured with this row: the ceiling is the node-launcher count (1), and the first CI run corrects it with propose-tighten. Correlation: unproven: not measured"
},
{
"name": "discovery-pretooluse-bash-docs-fetcher-gate-spawns",
"command": "bash scripts/hook-census.sh discovery PreToolUse docs-fetcher-gate.mjs '{\"session_id\":\"census\",\"hook_event_name\":\"PreToolUse\",\"cwd\":\"@DIR@\",\"tool_name\":\"Bash\",\"tool_input\":{\"command\":\"true\"}}' --check 'test ! -s \"$HOOK_STDOUT\"'",
"field": "spawns",
"ceiling": 1,
"goal": "A Bash call outside a discovery:docs-fetcher subagent costs only node, which reads the payload, finds another agent_type and stays quiet; the row has no if, so this is what every Bash call costs. Not yet measured with this row: the ceiling is the node-launcher count of testing-posttooluse-bash-test-scan-option-off-spawns, and the first CI run corrects it with propose-tighten. Correlation: unproven: not measured"
"goal": "A Bash call outside a discovery:docs-fetcher subagent costs only node, which reads the payload, finds another agent_type and stays quiet; the row has no if, so this is what every Bash call costs. Not yet measured with this row: the ceiling is the node-launcher count (1), and the first CI run corrects it with propose-tighten. Correlation: unproven: not measured"
},
{
"name": "js-complexity-share",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
# Place each check by coverage, measured cost and model-facing output

- Status: accepted
- Date: 2026-10-15
- Related: [ADR 0003](0003-verification-guards-earn-default-on-by-measured-precision.md) (guard
defaults by measured precision), [ADR 0019](0019-share-code-across-plugins-by-vendoring-with-a-sync-gate.md)
(vendored shared code), [ADR 0048](0048-release-plugins-from-changelog-fragments-through-a-bot-maintained-release-pr.md) (changelog
fragments). The rubric, the registration contract and the duration budgets are in
[`docs/conventions/check-placement/README.md`](../conventions/check-placement/README.md).

## Context

Every check plugin in this marketplace (formatters, linters, typos, actionlint) runs from a
per-edit `PostToolUse` row, and most report their findings to the model as `additionalContext` on
every matching edit while findings remain. Two problems follow:

- **Coverage.** A Claude Code hook sees only Claude Code's tool calls. A human, another agent, or a
Bash write that bypasses Write and Edit commits without the check ever running.
- **Cost and noise.** Probes on Claude Code 2.1.300-2.1.301 with Sonnet 5.5 (2026-10-15) measured
most real per-edit hooks at 40-180 ms on the reference host, and powershell-format at about 1 s
per `.ps1` edit. A per-edit formatter on a partly formatted file broke 2-3 of 5 batched edits in
every run and nearly doubled wall time, turns and context; the same formatter run once per batch
from `PostToolBatch` broke none and cost about 0.7 s. In an open-ended task, an exit-2 per-edit
lint finding led 2 of 2 runs to edit a line the user had not asked about.

A git `pre-commit` hook blocked every commit form probed (`git commit`, `git -C . commit`,
`git -c k=v commit`, `cd . && git commit`, `sh -c 'git commit'`) and passed its stderr straight
into the Bash result. A Claude Code `if: Bash(git commit *)` filter missed `git -C`, `git -c` and
`sh -c` forms.

Matt Pocock's guidance puts typecheck and tests in a pre-commit hook
([aihero.dev](https://www.aihero.dev/essential-ai-coding-feedback-loops-for-type-script-projects)).
This decision adopts that placement on the probe evidence above, not on his authority: his
"slows, fills context, distracts" wording was not found at his own sources, and Anthropic's own
docs show per-edit lint and test hooks as well.

## Decision

1. **Placement by rubric.** Each check runs where the rubric in
[check-placement](../conventions/check-placement/README.md#the-rubric) puts it: a Claude Code
hook to act before a tool call or change files in session; a git hook to cover every author;
`pre-commit` within the commit budget, `pre-push` up to 60 s, CI beyond. Report-only findings
never reach the model per edit. Each report-only check runs in exactly one local place
(formatters excepted; the typos-format pilot left the end-of-turn check opt-in, off by default)
and CI re-runs it on the change only; CI never skips a check because a
hook passed; the twice-daily full-tree CI run stays.
2. **Formatters** rewrite once per batch in session from `PostToolBatch`, with no model-facing
output, while the median per fire stays at or under 1 s, and again at `pre-commit`, rewriting
and re-staging. A slower formatter runs at `pre-commit` only.
3. **Durations live in the convention**, one row per hook with the host that measured it. Other
hosts re-measure; CI enforces counts ([hook-budget](../conventions/hook-budget/README.md)), not
durations.
4. **One skip, defined once.** `git -c checks.skipmissing=<tool>[,<tool>]`, honored only for a tool
the check finds absent and printed on stderr. An agent commit with a missing tool fails with the
install command; a human commit gets a one-line notice. Both rely on CI re-running the check.

### The registration contract

Each check plugin ships `git-hooks/entries.json` (entry name, event, script, tools, whether it
rewrites) and its check scripts. Its setup gains `apply install-git-hooks [scope=local|shared]`,
and `check` runs `verify`. One installer, `lib/git-hooks/install.mjs`, vendored per ADR 0019,
implements a `HookManager` port (`detect`, `list`, `plan`, `copy`, `decline`) with lefthook, husky
and plain adapters, and `lib/git-hooks/check-lib.sh` gives every check script the same inputs:
staged files or the push range, changed-line ranges, the skip key, and agent detection. Installed
copies live in the repository, not the plugin cache: git hooks run outside Claude Code, and a
committed entry cannot name a versioned per-user cache path. Plain shared hooks are a committed
`.githooks/`, activated per clone with `git config core.hooksPath .githooks`; for teams with
non-Claude authors the convention recommends lefthook or husky. The convention's
[registration contract](../conventions/check-placement/README.md#the-registration-contract) holds
the manifest schema, the runtime contract and the port.

### The content-hash stamp

Line 2 of every installed copy is `# <plugin> <name> sha256:<hex>`, the hash of the source script
plus the check lib. `verify` compares it with the current source (stale) and with the copy's own
body (modified locally), and reports missing and declined entries; the SessionStart drift line runs
inside each plugin's existing `prerequisites.mjs probe` row. A plugin-version stamp was rejected:
this repository releases several times a day, so most version-drift notices would be false, and at
shared scope each rerun would add a commit to every consumer repository.

### The D1 split

Scripts only detect, list, diff, render snippets, verify, and write files the plugin owns outright:
copied check scripts, the plain dispatcher and its entries, and the `git config --local` decline
key. Every step that needs judgment returns to the setup agent as data, and the agent applies it:
edits to user-owned hook-manager config, a foreign hook, a manager conflict, scope in an attended
run, local-to-shared migration, which install command to run, and acting on drift.

## Alternatives considered

- **Keep per-edit hooks and tune them.** Rejected: they cover only Claude Code's own tool calls,
and the probes measured broken batched edits and off-task fixes from per-edit output.
- **A Claude Code `if: Bash(git commit *)` gate in place of a git hook.** Rejected: the `if` filter
missed `git -C`, `git -c` and `sh -c` commit forms, and each global git option would need its own
pattern; it still covers no human or non-Claude author.
- **An environment-variable skip.** Rejected: any process inherits it, so one exported variable
silently disables checks for every later commit. A `git -c` key applies to one command, is
visible in the command line, and is honored only for a tool the check finds absent.
- **Agent-followed install recipes per plugin** (guardrails' current shape). Rejected: a SessionStart
hook cannot run a recipe, so drift detection needs a script anyway; a recipe has no unit test; and
the recipe repeats in every plugin.
- **git config-defined hooks (`hook.<name>.*`).** Not adopted: git 2.53.0 ignored a configured
pre-commit entry in a probe. Recheck when the consumer git floor reaches the release that
introduced them.

## Consequences

- Check plugins replace their per-edit report rows with git-hook entries, after a measured
typos-format pilot; formatters move to one `PostToolBatch` row per plugin or to `pre-commit` only.
- Consumer repositories gain installed hook copies: local scope under the git hooks directory or
`lefthook-local.yml`, shared scope under a committed `.githooks/`.
- A consumer without a CI job that re-runs a check should not use the skip, since nothing then
backs it up; setup's agent says so per entry.
- Consumer-facing audit skills stop recommending per-edit report-only hooks and flag existing ones
with the rubric's placement.

Recheck when a Claude Code release changes `PostToolBatch`, the "hook modified <file>" note, `if`
matching, or hook `ask` handling in auto mode.
2 changes: 1 addition & 1 deletion docs/catalog.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ plugin manifests and kept in sync by CI. Never hand-edit it; the category vocabu
- [`playwright`](../plugins/playwright): Live E2E browser automation via Microsoft's @playwright/cli: named sessions, accessibility-ref snapshots, click/fill by ref, screenshots, console and network capture, mocking, tracing, video, and auth state, with artifacts written to disk so only paths enter context, plus produced pull-request demo videos with frame-measured QC, a vendored upstream baseline and maintainer drift-check update flow.
- [`tdd`](../plugins/tdd): A TDD knowledge base distilled from cover-to-cover readings of Kent Beck's Test-Driven Development: By Example and Vladimir Khorikov's Unit Testing: Principles, Practices, and Patterns. Fourteen author-attributed reference files behind a routing table, plus a no-load quick decision guide, answer the WHY behind test design decisions.
- [`evals`](../plugins/evals): LLM evaluation methodology and eval-suite design, based on Anthropic's evaluation guidance. /evals:methodology answers questions on success criteria, eval design, and grading. /evals:design interviews for measurable success criteria and scaffolds a graded eval suite for an LLM app or Claude Code skill. /evals:plugin-eval preflights the CLI and target, prices a suite before running, and reads the with-versus-without delta. /evals:validate checks case files with no model call.
- [`testing`](../plugins/testing): Test-stage discipline: /testing:plan (coverage gaps, test plans), /testing:write (TDD authoring), /testing:run-e2e (live E2E and smoke checks), /testing:diagnose (failing-test root cause, with a fix-until-green workflow across files), /testing:audit (can't-fail test audit with a fail-closed gate), /testing:cleanup (rewrite, quarantine, or delete low-value tests behind a mutation gate), /testing:setup, and opt-in hooks that scan test files Claude writes and flag edits that weaken tests.
- [`testing`](../plugins/testing): Test-stage discipline: /testing:plan (coverage gaps, test plans), /testing:write (TDD authoring), /testing:run-e2e (live E2E and smoke checks), /testing:diagnose (failing-test root cause, with a fix-until-green workflow across files), /testing:audit (can't-fail test audit with a fail-closed gate), /testing:cleanup (rewrite, quarantine, or delete low-value tests behind a mutation gate), /testing:setup, and an opt-in hook that flags edits that weaken tests.
- [`mutation-testing`](../plugins/mutation-testing): Measures whether a test suite detects faults, not merely runs code. /mutation-testing:principles answers operator, mutant-state, and metric questions from the literature. /mutation-testing:setup verifies the mutation tool and writes tracked config. /mutation-testing:audit runs mutation analysis on the diff (or, with --exercised, on code the changed tests call), reports surviving mutants and why each lived, verifies source was restored, and can save survivors as findings.

## Verification
Expand Down
Loading
Loading