comment-cop.py
enforces a why-only comment policy for Claude Code and Codex.
It blocks newly added change-history comments, obvious code narration, comment blocks longer than two lines, and comment-heavy changes. Directives, short TODOs, generated-code notices, and commented configuration are ignored. A per-turn Git baseline keeps the final audit from blaming an agent for pre-existing worktree changes.
Install the script at ~/.claude/hooks/comment-cop.py
, merge claude-settings.json
into ~/.claude/settings.json
, and install codex-hooks.json
as ~/.codex/hooks.json
. Add AGENTS.md
to ~/.codex/AGENTS.md
so Codex sees the preference before it edits.
Run python3 ~/.claude/hooks/comment-cop.py --self-test
to test the checker. Codex requires new or changed command hooks to be reviewed with /hooks
before they run.