Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Comment lint

tool-gates measures how much narrative commentary a write or edit adds relative to the code it adds, and how long any single comment runs. It covers Claude Write/Edit and Codex apply_patch added lines on the PostToolUse path, the same path as the security-reminder and design-lint nudges. Antigravity has no PostToolUse hook, so comment lint does not run there. Findings are a single tier: a match attaches a post-write nudge so the next action can trim. Nothing is blocked. The gate is opt-in (default off) and only scans code extensions; Markdown, JSON, and other prose or data files are skipped.

Why it is opt-in

Volume, not judgement.

Assistant prompts already say whether to write a comment. Nothing bounds how many or how long, which is where commentary accumulates: an edit that adds more narration than code, or one comment that runs a full paragraph. These rules measure only that. They make no claim about whether an individual comment is worth keeping.

Doc comments are exempt. ///, //!, /** */, and Python docstrings are API documentation, and flagging them would push toward undocumented public surfaces. Tooling directives (# noqa, //nolint, eslint-disable, @ts-expect-error) are exempt too: they are machine instructions, not prose.

Defaults are tuned to the tail rather than the median. Every additionalContext injection costs tokens and disturbs the prompt cache, so a gate that fires on a typical edit costs more than it saves.

Comment volume

post-write nudge · PostToolUse
volume/comment-heavy
Nudge
Keep the ones a reader could not infer from the code and delete the rest.
volume/long-block
Nudge
State the constraint in one or two lines, or move the explanation to a doc comment on the item it describes.

Configure

documented
[features]
comment_lint = true
[comment_lint]
max_per_100 = 40
min_code_lines = 15
max_block_lines = 5
disable_rules = ["volume/long-block"]

Opt-in. Set comment_lint = true under [features] to turn the gate on; it is off by default.

max_per_100 is narrative comment lines per 100 code lines before volume/comment-heavy fires. min_code_lines is how much code an edit must add before that rule applies at all, so a small edit that is legitimately comment-dense stays quiet.

max_block_lines is the longest run of consecutive own-line comments allowed before volume/long-block fires. Raise it for codebases that favor long explanatory headers.

Lower the thresholds to tighten the house style; raise them to make the gate rarer. Disable a single rule by id via disable_rules.

tool-gates · permission gate hook for Claude Code, Codex CLI, and Antigravity CLI, with deprecated Gemini CLI support. github.com/camjac251/tool-gates

13 gates · 400+ commands · built from rules/*.toml