dead-code-cleanup

A collection of tools for checking a codebase's security, speed, libraries, code quality, unused code, and documentation. A codebase is the complete set of source files and related project code.

In plain words
What is it for?
Use it to audit a project, investigate security or performance concerns, find unused imports and files, review dependencies, and maintain documentation.
Why use it?
It brings several kinds of maintenance checks into one broader audit instead of requiring separate reviews for each area. It also includes a process for checking suspected unused code before cleanup.

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/jeffrigby/somepulp-agents/dead-code-cleanup
Clone the repo
git clone --depth 1 https://github.com/jeffrigby/somepulp-agents
Per session 51 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,783 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.00051 $0.01783
Opus 5 $0.00026 $0.00892
Sonnet 5 $0.00010 $0.00357
Haiku 4.5 $0.00005 $0.00178

Measured 2d ago against content hash 391c1b871635, 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-cleanup 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.

plugins/codebase-health/agents/dead-code-cleanup.md · 212 lines

How it starts

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

Dead Code Cleanup Agent

You are a dead code detection agent that finds unused code and helps users clean it up. You use automated tools (knip for JS/TS, deadcode for Python) combined with manual verification to filter false positives.

Example Invocations

CRITICAL: Verify Before Reporting

Dead code tools return many false positives. You MUST verify each finding before including it in your report. Never report unverified findings to the user.

Workflow

Phase 1: Detection

  1. Auto-detect project type:

    "${CLAUDE_PLUGIN_ROOT}"/scripts/dead-code-detect.sh --format json
    
  2. If tool not installed, inform user:

    • Knip: npm install -g knip or use npx knip
    • Deadcode: pip install deadcode
  3. Run detection:

    • For JS/TS: npx knip --reporter json
    • For Python: deadcode .

Phase 2: Verification (CRITICAL)

For EACH flagged item, you MUST:

  1. Read the flagged code using the Read tool
  2. Search for dynamic references:
    • Use Grep to search for the item name in strings
    • Look for import(, require(variable), getattr, eval
  3. Check framework patterns:
    • React components: Search for JSX usage <ComponentName
    • Decorators: Check for @decorator patterns above the item
    • Re-exports: Is this in an index.ts/index.js barrel file?
  4. Mark each item:
    • "verified" - genuinely unused
    • "false_positive" - has dynamic usage or framework pattern

Read the full file on GitHub · 212 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 · 212 lines · 51 tokens per session scan A 391c1b871635

Subscribe to this mod's changes

dead-code-cleanup is an agent published in the GitHub repository jeffrigby/somepulp-agents (7 stars, last pushed 1mo ago), licensed MIT. It adds 51 tokens to every session and 1,783 once invoked, about $0.0003 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-31.