You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
perf(hooks): gate the three ungated PostToolUse rows with an if: predicate (typos-format, eol-normalizer, guardrails trio) #3751
Three PostToolUse rows spawn on every Write and Edit regardless of file type: typos-format, eol-normalizer, and the guardrails verifier trio (cli-flag-verify, skill-reference-verify, stale-path-verify under run-guards.sh). Measured on the Linux CI host on a .txt the hooks have nothing to say about (N = 15, hook-logging-pipeline topic, 2026-09-05):
Row
Cost on a non-matching file
typos-format
72 to 73 ms
eol-normalizer
45 to 46 ms
guardrails trio
73 to 81 ms
The six extension-gated formatters spawn zero processes on a non-matching file. Fleet-wide, if: is present on 27 of 55 handlers.
Fix
An if: predicate per row in each plugin's hooks.json, scoped to the file types the hook can act on (typos-format and eol-normalizer to text-like extensions they already handle internally; the trio to the markdown and shell shapes the three verifiers scan). Each plugin's README states the measured before/after share per .claude/rules/hook-budget.md, and each gets a patch bump with a CHANGELOG entry.
Acceptance
jq '.hooks.PostToolUse[] | has("if")' is true for the three rows.
The harness row for each on a .txt write drops to the spawn floor (about 2 ms), recorded in the README.
Every existing case in the three suites still passes; one new case per hook pins that a non-matching file produces no spawn (PATH shim counter).
Activity
perf(guardrails): gate the PostToolUse verifier dispatcher with an if…
perf(guardrails): drop dirname and sed execs from the always-on path (#…