{"slug": "cc-hook-for-comments", "title": "CC hook for comments", "summary": "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.", "body_md": "`comment-cop.py`\n\nenforces a why-only comment policy for Claude Code and Codex.\n\nIt 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.\n\nInstall the script at `~/.claude/hooks/comment-cop.py`\n\n, merge `claude-settings.json`\n\ninto `~/.claude/settings.json`\n\n, and install `codex-hooks.json`\n\nas `~/.codex/hooks.json`\n\n. Add `AGENTS.md`\n\nto `~/.codex/AGENTS.md`\n\nso Codex sees the preference before it edits.\n\nRun `python3 ~/.claude/hooks/comment-cop.py --self-test`\n\nto test the checker. Codex requires new or changed command hooks to be reviewed with `/hooks`\n\nbefore they run.", "url": "https://wpnews.pro/news/cc-hook-for-comments", "canonical_source": "https://gist.github.com/mariusv/689d1b30c57a49a6412703e35ad21096", "published_at": "2026-08-18 20:47:23+00:00", "updated_at": "2026-09-02 19:53:16.197216+00:00", "lang": "en", "topics": ["developer-tools", "ai-agents"], "entities": ["Claude Code", "Codex", "comment-cop.py"], "also_reported_by": [], "alternates": {"html": "https://wpnews.pro/news/cc-hook-for-comments", "markdown": "https://wpnews.pro/news/cc-hook-for-comments.md", "text": "https://wpnews.pro/news/cc-hook-for-comments.txt", "jsonld": "https://wpnews.pro/news/cc-hook-for-comments.jsonld"}}