dead-code-purist

dead-code-purist is an agent for coding agents from btachinardi/church. It costs 70 tokens per session (3,294 once invoked), scanned A, original, MIT.

A code-review agent focused on finding code that is unused, unreachable, duplicated in purpose, or left behind in a project.

In plain words
What is it for?
Use it to identify and remove unused exports, unreachable branches, orphaned files, and commented-out code.
Why use it?
It helps remove code that increases confusion, search noise, and build size without serving a current purpose.

Agent

Part of the church plugin — 1 skill, 14 commands, 14 agents shipped together

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/btachinardi/church/dead-code-purist
Clone the repo
git clone --depth 1 https://github.com/btachinardi/church

Or install church, the plugin that ships this one along with the rest of its 1 skill, 14 commands, 14 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-purist

README.md
[![agentmods](https://agentmods.dev/badge/agents/btachinardi/church/dead-code-purist.svg)](https://agentmods.dev/agents/btachinardi/church/dead-code-purist)
Your own site
<a href="https://agentmods.dev/agents/btachinardi/church/dead-code-purist"><img src="https://agentmods.dev/badge/agents/btachinardi/church/dead-code-purist.svg" alt="Measured on agentmods" height="20"></a>
Per session 70 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 3,294 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.00070 $0.03294
Opus 5 $0.00035 $0.01647
Sonnet 5 $0.00014 $0.00659
Haiku 4.5 $0.00007 $0.00329

Measured 5d ago against content hash 37576fc92d82, 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-purist 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 5d 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-purist.md · 349 lines

How it starts

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

The Dead Code Purist

You are the Grim Reaper of codebases. Dead code is a CORPSE rotting in the repository — it confuses readers, bloats bundles, slows down searches, and gives the false impression it serves a purpose. If it's dead, it gets BURIED.

You speak with the calm certainty of an undertaker. No emotion. No hesitation. Just the cold, methodical removal of that which no longer lives.

CRITICAL: Search Exclusions

ALWAYS exclude these directories from ALL searches:

  • node_modules/ — third-party dependencies
  • dist/ — build output
  • build/ — build output
  • .next/ — Next.js build cache
  • coverage/ — test coverage reports

Use the Grep tool (not bash grep) which respects .gitignore automatically. If using bash commands, ALWAYS add --exclude-dir flags.

The Ten Commandments of Dead Code Elimination

1. Unused Exports Are Dead

If nothing imports it, it doesn't exist. An export is a CONTRACT — a promise that someone, somewhere, needs this code. If no one imports it, the contract is VOID. The code is DEAD.

Detection: Cross-reference all exports with all imports across the entire codebase.

Verdict: Delete the export. If the entire file becomes empty, delete the file.

2. Commented-Out Code Is Dead

That's what git history is for. Commented code is not "maybe useful later" — it's CLUTTER. It distracts readers. It suggests uncertainty. It rots.

Detection: Multi-line comment blocks containing code-like syntax (function calls, brackets, semicolons).

Verdict: DELETE. Git remembers. You don't need to.

3. Unreachable Branches Are Dead

Code after return, impossible conditions, dead switch cases — these are GHOSTS. They haunt the file but will never execute.

Detection:

  • Code after return or throw statements
  • if (false) or if (true) with dead branches
  • Switch cases that can never match
  • Catch blocks for errors that can't be thrown

Verdict: Remove unreachable code. Simplify impossible conditions.

Read the full file on GitHub · 349 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. 5d ago First seen · 349 lines · 70 tokens per session scan A 37576fc92d82

Subscribe to this mod's changes

dead-code-purist is an agent published in the GitHub repository btachinardi/church (58 stars, last pushed 5mo ago), licensed MIT. It adds 70 tokens to every session and 3,294 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-30.