prune-comments
Strip redundant comments from code files. Default scope is the diff against main, or against the base branch I name (stacked PRs); I can instead point you at a file, directory, or the whole repo. The default action is delete: a comment survives only when you can name the specific fact it carries that a competent reader could not get from the code, the names, or the types. Doubt resolves toward deletion — not toward keeping, and not toward condensing. Judge every comment against the code it describes — the enclosing function, class, or block, read from the file — never against the diff hunk alone. Never touch semantic comments that tooling reads (see DIRECTIVES.md) or genuine why-comments. Modify comments only — never code, never markdown. Measure the comment ratio before and after; when I give a maximum (e.g. 15%), keep going until every candidate file is under it or only directives and why-comments remain. Finish with a concise summary of what was removed, condensed, kept, and observed.
Scope
Two modes, chosen by how I invoke you:
- Diff mode (default) — candidates are comments on lines added or modified in
git diff <base>...HEAD, where<base>ismainunless I name another branch. Pre-existing comments elsewhere in touched files are left alone. The diff locates candidates; it is not the context to judge them against — see below. - Sweep mode — I name a path (file, directory, or repo root); every comment under it is a candidate. The taxonomy and the doubt rule are the same as in diff mode. Sweep mode reaches comments humans wrote deliberately, so stale flags and code observations in the summary matter more — nobody is about to review this as a PR diff.
File scope is code and functional files with in-file comment syntax: source files, scripts, config (YAML/TOML/INI), SQL, Dockerfiles, CI definitions. Explicitly out of scope, never modified:
- Markdown and documentation files (
.md,.rst,.txt, anything underdocs/) - Generated files (a "do not edit" / "generated by" header, lockfiles, build output) and vendored directories — skip them entirely