cd /news/developer-tools/cc-hook-for-comments · home › topics › developer-tools › article
[ARTICLE · art-119416] src=gist.github.com ↗ pub= topic=developer-tools verified=true sentiment=· neutral

CC hook for comments

A developer released comment-cop.py, a hook that enforces a why-only comment policy for Claude Code and Codex. The script blocks change-history comments, code narration, and comment-heavy changes while ignoring directives and short TODOs, using a per-turn Git baseline to avoid blaming agents for pre-existing changes. Installation involves placing the script and configuration files in the respective hook directories.

read1 min views21 publishedAug 18, 2026

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.

── more in #developer-tools 4 stories · sorted by recency
── more on @claude code 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
→ Live at https://your-agent.zahid.host ✓
Get free account → Pricing
from €0/mo · no card required
LIVE [news/cc-hook-for-comments] indexed:0 read:1min 2026-08-18 · —