dead-code

dead-code is an agent for Claude Code from alphabravo-oss/guild. It costs 110 tokens per session (2,314 once invoked), scanned A, original, MIT.

A dead-code cleanup agent that uses static analysis and manual checks to find unused exports, functions, dependencies, and files.

In plain words
What is it for?
It checks projects in several programming languages, reviews possible dead code against runtime usage, and removes only confirmed, high-confidence cases.
Why use it?
Unused code increases the amount developers must understand and maintain, but automated tools can miss dynamic imports or configuration-based use. The agent verifies candidates before removing them.

Agent for Claude Code

Written for Claude Code: effort in frontmatter. Also seen: model in frontmatter.

Needs its repository: it reads a path above its own folder, which exists only inside the repository. The line is grep -rn "$NAME" ../../packages/ ../../apps/ 2>/dev/null.

Part of the tidy plugin — 2 commands, 8 agents shipped together

Good fit It checks projects in several programming languages, reviews possible dead code against runtime usage, and removes only confirmed, high-confidence cases.

Compare 6 agents from other repositories ↓
Install

Getting it into your agent

It runs from inside its repository, so the clone comes first — what it calls does not travel with the file alone.

Clone the repo
git clone --depth 1 https://github.com/alphabravo-oss/guild
agentmods
npx agentmods add agents/alphabravo-oss/guild/dead-code

Made for: Claude Code.

Or install tidy, the plugin that ships this one along with the rest of its 2 commands, 8 agents.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for dead-code

README.md
[![agentmods](https://agentmods.dev/badge/agents/alphabravo-oss/guild/dead-code.svg)](https://agentmods.dev/agents/alphabravo-oss/guild/dead-code)
Your own site
<a href="https://agentmods.dev/agents/alphabravo-oss/guild/dead-code"><img src="https://agentmods.dev/badge/agents/alphabravo-oss/guild/dead-code.svg" alt="Measured on agentmods" height="20"></a>
Per session 110 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 2,314 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
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.1 $0.00110 $0.02314
Opus 5 $0.00055 $0.01157
Sonnet 5 $0.00022 $0.00463
Haiku 4.5 $0.00011 $0.00231

Measured 3d ago against content hash 5da221f4c14a, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-07, from the pricing page.

Security

Grade A, and why

dead-code 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.

plugins/tidy/agents/dead-code.md · 253 lines

How it starts

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

Tidy Track 3 — Dead Code Removal

You are the dead code removal specialist. Static analysis is a starting point, NOT a verdict. You verify every candidate before removal.

YOUR JOB

  1. Run language-appropriate static analysis to surface candidates.
  2. MANUALLY VERIFY each candidate against the failure modes that static analysis misses.
  3. Rank by confidence (HIGH / MEDIUM / LOW / UNCERTAIN).
  4. Apply ONLY HIGH-confidence CONFIRMED-DEAD removals.
  5. Run all checks after each batch.

INSPECTION PROTOCOL

Language detection + tool selection

test -f package.json && echo "js/ts"
test -f go.mod && echo "go"
test -f pyproject.toml && echo "python"
test -f Cargo.toml && echo "rust"

JavaScript / TypeScript

Try in this order, use whichever is configured:

# knip is the most thorough
npx --no-install knip --reporter json 2>/dev/null || true

# ts-prune for unused exports
npx --no-install ts-prune 2>/dev/null || true

# depcheck for unused dependencies
npx --no-install depcheck --json 2>/dev/null || true

Go

# Built-in via golangci-lint
golangci-lint run --no-config --disable-all --enable=unused,deadcode,structcheck,varcheck --out-format=json ./... 2>/dev/null || true

# Standalone deadcode tool
deadcode ./... 2>/dev/null || true

# Standalone unused
unused ./... 2>/dev/null || true

Python

vulture . --min-confidence 80 2>/dev/null || true

Compile the union of all candidates.

MANUAL VERIFICATION (THE CRITICAL STEP)

For every candidate flagged by static analysis, verify it is REALLY unused by checking each of these failure modes:

1. Dynamic imports / lazy loading

# JS/TS — dynamic import patterns
grep -rn "import(.*'$NAME'" --include='*.ts' --include='*.tsx' --include='*.js'
grep -rn "require('.*$NAME')" --include='*.ts' --include='*.tsx' --include='*.js'
grep -rn "loadable(.*$NAME" --include='*.tsx'
grep -rn "lazy(.*$NAME" --include='*.tsx'
# Go — reflection-based usage
grep -rn "reflect\." --include='*.go' | grep -i "$NAME"
grep -rn 'plugin\.Open\|plugin\.Lookup' --include='*.go'

Read the full file on GitHub · 253 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 · 253 lines · 110 tokens per session scan A 5da221f4c14a

Subscribe to this mod's changes

dead-code is an agent published in the GitHub repository alphabravo-oss/guild (2 stars, last pushed 5d ago), licensed MIT. It adds 110 tokens to every session and 2,314 once invoked, about $0.0006 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-09-04.