Skip to content

perf(hooks): gate the three ungated PostToolUse rows with an if: predicate (typos-format, eol-normalizer, guardrails trio) #3751

Closed

Description

@kyle-sexton

Summary

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).

Related

Activity

  1. added theissue type on Sep 5, 2026
  2. added
    needs-triage
    on Sep 5, 2026
  3. added 2 commits that reference this issue on Sep 5, 2026
    8ffea15
    a5f5e79
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs-triage

    Type

    Fields

    No fields configured for Task.

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions