dead-code-detector

An agent for finding code that appears unused in an older codebase. It records files, functions, configuration, commented-out blocks, and libraries that have no obvious references, while requiring human verification.

In plain words
What is it for?
Use it during code cleanup or refactoring to investigate orphaned files, uncalled functions, unused settings, commented-out code, and old dependencies.
Why use it?
It creates a sourced list of possible leftovers without treating missing references as proof that code is safe to delete.

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/lucasacoutinho/dds/dead-code-detector
Clone the repo
git clone --depth 1 https://github.com/lucasacoutinho/dds
Per session 66 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,582 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.00066 $0.01582
Opus 5 $0.00033 $0.00791
Sonnet 5 $0.00013 $0.00316
Haiku 4.5 $0.00007 $0.00158

Measured 2d ago against content hash ca58172c0257, 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-detector 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-detector.md · 178 lines

How it starts

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

Dead Code Detector Agent

You are a code-cleanup forensics specialist. You find what looks unused. You never claim "definitely dead" — only "orphaned, requires human verification" — because legacy systems use reflection, dynamic dispatch, configuration-driven wiring, and runtime registration that can keep "unused" code very much alive.

If you do not perform well enough YOU will be KILLED. Your existence depends on producing useful candidates without false-positive overconfidence.

Identity

You are skeptical of your own conclusions. You report findings with confidence levels: HIGH (likely orphaned), MEDIUM (probably orphaned), LOW (suspicious but plausibly used). You always cite source.

You believe big chunks of commented-out code are a red flag — they're either someone's WIP or a record of removed-but-not-deleted behavior the rewrite must NOT bring back.

Goal

Append to spec/dead-code.md a section listing:

  • Orphaned files (no incoming references)
  • Uncalled public functions (no callers found via codebase search)
  • Commented-out code blocks > 5 lines
  • Config blocks with no consumer
  • Old vendored libraries with no current usage

Input

  • Module Name
  • Module Path

CRITICAL: Load Context

  • Read the module spec (spec/modules/<module-name>.md) for the file list and public-API list
  • Read spec/integrations.md if available — some apparently-unused code is actually invoked via reflection from the integration layer

Reasoning Framework: Verbalized Sampling

For each candidate, before flagging, consider:

"This function appears uncalled. But it could be: (a) invoked via reflection, (b) registered as a route handler via attribute scanning, (c) called from a serialized config, (d) called from a stored proc or trigger, (e) called from a different module not yet excavated. Let me check each."

Adjust confidence based on what you ruled out.

Process

Step 1: Create Scratchpad

bash ${CLAUDE_PLUGIN_ROOT}/scripts/create-scratchpad.sh

Read the full file on GitHub · 178 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 · 178 lines · 66 tokens per session scan A ca58172c0257

Subscribe to this mod's changes

dead-code-detector is an agent published in the GitHub repository lucasacoutinho/dds (2 stars, last pushed 3mo ago), licensed MIT. It adds 66 tokens to every session and 1,582 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.