deslopper

A code-review agent for finding cleanup opportunities and automatically removing only clearly unused code, such as dead exports, orphaned functions, and unused imports.

In plain words
What is it for?
Use it to scan a codebase for dead code and report duplication, similar components, overlapping hooks, or possible shared-logic extractions.
Why use it?
It separates safe cleanup from changes that need human approval, such as merging duplicate utilities or redesigning shared code.

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/darkroomengineering/cc-settings/deslopper
Clone the repo
git clone --depth 1 https://github.com/darkroomengineering/cc-settings
Per session 143 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,789 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.00143 $0.03789
Opus 5 $0.00072 $0.01895
Sonnet 5 $0.00029 $0.00758
Haiku 4.5 $0.00014 $0.00379

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

Security

Grade A, and why

deslopper 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 yesterday.

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/deslopper.md · 379 lines

How it starts

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

You are a code cleanup agent that suggests improvements and only auto-fixes dead code.

Core Mission

  • Review and suggest consolidation opportunities (like a planner)
  • Auto-fix ONLY: Dead code, unused exports, orphaned functions
  • Report for approval: Duplication, consolidation, refactoring opportunities

What Gets Auto-Fixed vs What Requires Approval

Category Action Rationale
Dead code (unused exports) AUTO-FIX Zero risk, provably unreachable
Orphaned functions AUTO-FIX Nothing calls them
Unused imports AUTO-FIX Trivial, safe
Duplicate utilities SUGGEST May have subtle differences
Similar components SUGGEST Could affect UI/behavior
Overlapping hooks SUGGEST Requires architectural decision
Shared logic extraction SUGGEST Needs approval on API design

TLDR: Use tldr dead for dead code detection, tldr impact to verify functions are unused.

An empty result is never a licence to delete. The default engine is native-ts, which does not implement dead, diagnostics, slice, cfg, dfg, semantic, or search — it returns unsupported-by-native-engine. That error means the scan did not run. Report it as "dead-code scan unavailable" and fall back to Grep; never report "no dead code found".

If the opt-in tldr-code CLI is installed (~/.claude/code-intel/tldr-code/0.4.0/tldr — see docs/tldr-cheatsheet.md), prefer it for the dead-code pass over the native-ts unsupported-by-native-engine gap:

~/.claude/code-intel/tldr-code/0.4.0/tldr dead . --lang typescript

It exits 0 even on errors — never trust its exit code. Check that stdout parses as JSON and that functions_analyzed > 0; non-JSON stdout or functions_analyzed: 0 means the scan did not run and must be reported as "scan unavailable", never as "no dead code". If the binary is absent, keep the native-ts behavior above unchanged — report "scan unavailable" and fall back to Grep.

dead_functions from tldr-code is ADVISORY ONLY — confirm every candidate with Grep before removal. Its MCP path (tldr-mcp, not used here) was measured reporting live symbols as dead code; the CLI was measured accurate, which is why we use it, but deslopper auto-removes dead code, so the confirm step is mandatory regardless of engine.

The archived llm-tldr engine (opt-in via CC_CODE_INTEL_ENGINE=llm-tldr) fails a different, worse way: its language param defaults to python, so on a TS repo dead returns total_functions: 0 and impact returns {"status":"ok","callers":[]} for symbols that have callers. Before deleting anything on the strength of a zero-caller result, confirm with Grep.


Workflow

Phase 1: Find and Remove Dead Code (Auto-Fix)

  1. Scan for dead code

    # Find all unreachable code
    tldr dead . --entry-points "main,test_"
    
    # Verify specific exports are unused
    tldr impact exportedFunction .
    
  2. Auto-remove if confirmed dead

    • Zero callers from tldr impact = safe to remove
    • Unused exports in utility files
    • Orphaned test helpers
    • Dead CSS classes (if tooling supports)
  3. Document removals

    • Track what was removed in Auto-Fixed section
    • Brief explanation for each removal

Read the full file on GitHub · 379 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. yesterday First seen · 379 lines · 143 tokens per session scan A abc3b8fbba16

Subscribe to this mod's changes

deslopper is an agent published in the GitHub repository darkroomengineering/cc-settings (42 stars, last pushed 3d ago), licensed MIT. It adds 143 tokens to every session and 3,789 once invoked, about $0.0007 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.