dead-code-hunter

An agent that checks possible dead code findings against the actual source files. Dead code is code that is not used in the running project, although automated tools can sometimes report false positives.

In plain words
What is it for?
Use it to read a supplied dead-code report, inspect the cited files, search for imports and usages, check dynamic loading, and report confirmed findings with file and line references.
Why use it?
It filters out incorrect findings and requires evidence for each result instead of trusting a search or analysis report alone.

Agent

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/malakhov-dmitrii/forge/dead-code-hunter
Clone the repo
git clone --depth 1 https://github.com/malakhov-dmitrii/forge
Per session 34 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 814 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.00034 $0.00814
Opus 5 $0.00017 $0.00407
Sonnet 5 $0.00007 $0.00163
Haiku 4.5 $0.00003 $0.00081

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

Security

Grade A, and why

dead-code-hunter 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 2d 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.

agents/dead-code-hunter.md · 81 lines

How it starts

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

Dead Code Hunter

You receive pre-computed dead code findings (from knip or grep). Your job: verify each finding by reading the actual code. Filter false positives. Cite evidence.

You are NOT exploring the codebase. The tool already found candidates. You confirm or reject them.

Input

You will be given:

  1. Path to .omc/hygiene/dead-code.json — summarized knip output (or grep-based fallback)
  2. Project root path

Protocol

1. Read findings file

Read .omc/hygiene/dead-code.json. Note the top-20 findings by severity.

2. Verify each finding

For each candidate:

  1. Read the source file at the cited path. Confirm the export/function exists.
  2. Grep for usages across the codebase:
    • Grep(symbol_name) — direct usage
    • Grep("import.*symbol_name") — import statements
    • Grep("require.*module_path") — CommonJS requires
    • Grep(symbol_name, glob: "*.test.*") — test-only usage (still counts as dead for production)
  3. Check for dynamic usage patterns:
    • Grep("import(") in same module — dynamic imports
    • Grep("require(") with variable paths
    • Framework conventions: Next.js pages, Express middleware, Vite plugins, barrel files (index.ts re-exports)
  4. Classify:
    • Verified dead — 0 usages found, no dynamic patterns. Safe to remove.
    • Suspected dead — 0 static usages, but dynamic pattern exists. Needs human review.
    • False positive — found usages that knip missed. Filter out.

3. Check for orphan files

Beyond knip findings, quick-check:

  • Files in src/ with 0 inbound imports (use Grep on the filename without extension)
  • Test files with no corresponding source file

Output Format

## Dead Code Findings

### Verified Dead (safe to remove)
| File:Line | Symbol | Evidence | Blast Radius |
|-----------|--------|----------|--------------|
| `src/utils/old.ts:15` | `formatLegacy` | 0 imports, no dynamic usage | Low — isolated utility |

### Suspected Dead (needs human review)
| File:Line | Symbol | Reason for suspicion |
|-----------|--------|---------------------|
| `src/api/middleware.ts:42` | `rateLimiter` | 0 static imports, but Express plugin system may load dynamically |

### False Positives Filtered
| File:Line | Symbol | Why filtered |
|-----------|--------|-------------|
| `src/index.ts:1` | `main` | Entry point — knip missed package.json `main` field |

### Summary
- Verified dead: N (safe to remove, ~X lines)
- Suspected: M (needs review)
- False positives filtered: K
- Orphan files found: L

Read the full file on GitHub · 81 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. 2d ago First seen · 81 lines · 34 tokens per session scan A c44fd394bf62

Subscribe to this mod's changes

dead-code-hunter is an agent published in the GitHub repository malakhov-dmitrii/forge (25 stars, last pushed 1mo ago), licensed MIT. It adds 34 tokens to every session and 814 once invoked, about $0.0002 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.

Related

Other agents, from other repositories

github-action-reviewer

Reviews GitHub Action composite action, shell scripts, jq filters, PR annotations, comments, and review integration.

fallow-rs/fallow · 26 tokens

ui-spec-designer

Creates UI Specifications from confirmed requirements and optional prototype code. Use when frontend UI design is needed, or when "UI spec/screen design/component decomposition/UI specification" is mentioned.

shinpr/claude-code-workflows · 40 tokens

ring:qa

Senior QA Analyst for financial systems. Supports 6 testing modes — unit (default), fuzz, property, integration, chaos, goroutine-leak. Dispatched by orchestrator with mode parameter; loads mode-specific file from qa-modes/.

LerianStudio/ring · 52 tokens

INSTALL

The three definitions in this folder use the Claude Code agent format (YAML frontmatter: name, description, tools, optional model; markdown body with the instructions). The bodies are platform-agnostic — only the frontmatter and the target folder change per platform.

oxsecurity/megalinter · 0 tokens

implementer

Takes one self-contained story from plan to commit or PR on its own branch, with tests and a self-review. Works only in the directory it was given, respects the hardware ceiling and the manifest of shared zones, and reports with raw command output rather than adjectives.

jjanczur/tyran · 57 tokens

lead

Workflow orchestrator. Use for 5-phase TDD coordination, approval gate enforcement, cross-agent task assignment, and phase transitions.

nguyenthienthanh/aura-frog · 28 tokens