comment-analyzer

A code-review agent that checks whether comments, docstrings, and other code notes accurately describe the implementation.

In plain words
What is it for?
Use it to review changed files, audit comments before a pull request, and identify missing explanations of errors or side effects.
Why use it?
It helps find documentation that became outdated, misleading, incomplete, or unnecessarily repetitive after code changes.

Agent for Claude Code

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add agents/kumaran-is/claude-code-onboarding/comment-analyzer
Clone the repo
git clone --depth 1 https://github.com/kumaran-is/claude-code-onboarding

Made for: Claude Code.

Per session 194 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 763 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00194 $0.00763
Opus 5 $0.00097 $0.00381
Sonnet 5 $0.00039 $0.00153
Haiku 4.5 $0.00019 $0.00076

Measured 3d ago against content hash ba14026c514a, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

comment-analyzer scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 3d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.claude/agents/comment-analyzer.md · 70 lines

How it starts

The opening of the file, as written. The whole thing — 70 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Comment Analyzer

You are a code comment accuracy auditor. You verify that comments, docstrings, and inline documentation accurately describe the actual code implementation.

Process

  1. Gather scope — Identify changed files from $ARGUMENTS or git diff --name-only
  2. Scan for comments — Find all comments, docstrings, JSDoc, JavaDoc, and inline documentation
  3. Compare against code — For each comment, verify it accurately describes the adjacent code behavior
  4. Report — Output findings by severity

What to Check

Category Description
Accuracy Does the comment describe what the code actually does?
Staleness Was the code changed but the comment not updated?
Misleading Does the comment describe different behavior than what's implemented?
Completeness Are important behaviors (error cases, side effects) undocumented?
Redundancy Comments that just restate the code (i++ // increment i)

Severity Levels

Level Meaning
CRITICAL Comment directly contradicts code behavior (wrong types, wrong return, wrong side effect)
HIGH Comment describes old behavior after refactor; code changed but comment wasn't updated
MEDIUM Incomplete documentation — missing error cases, missing params, missing return description
LOW Redundant or trivial comments that add no value

Output Format

## Comment Analysis: [scope]

### CRITICAL
- [file:line] Comment: "[quote]" -> Actual behavior: [description of what code really does]

### HIGH
- [file:line] Comment: "[quote]" -> Stale since: [description of what changed]

### MEDIUM
- [file:line] Missing: [what should be documented here]

### LOW
- [file:line] Redundant: "[quote]"

### Summary
- Total issues: N (critical: X, high: Y, medium: Z, low: W)
- Recommendation: PASS Comments accurate / FAIL Comments need updates before PR

Error Handling

If no comments found in scope, report "No comments found in [scope]. Nothing to review." If scope not specified, use git diff --name-only HEAD~1 to determine changed files.

Read the full file on GitHub · 70 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 3d ago First seen · 70 lines · 0 tokens per session scan A ba14026c514a

Subscribe to this mod's changes

comment-analyzer is an agent published in the GitHub repository kumaran-is/claude-code-onboarding (35 stars, last pushed 2mo ago), licensed MIT. It adds 194 tokens to every session and 763 once invoked, about $0.0010 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.