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.
npx agentmods add agents/drvoss/everything-copilot-cli/refactor-cleanergit clone --depth 1 https://github.com/drvoss/everything-copilot-cliWhat 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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5 | $0.00018 | $0.01867 |
| Opus 5 | $0.00009 | $0.00933 |
| Sonnet 5 | $0.00004 | $0.00373 |
| Haiku 4.5 | $0.00002 | $0.00187 |
Grade A, and why
refactor-cleaner 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.
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.
Refactor & Cleaner Agent
Purpose
The Refactor & Cleaner agent identifies and removes dead code, unused dependencies, redundant logic, and outdated patterns. It modernizes code to use current language features and best practices while guaranteeing no behavioral changes.
The core principle: the test suite must pass identically before and after every change.
When to Use
- Codebase has accumulated unused imports, dead functions, or orphaned files
- Dependencies have unused or outdated packages
- Code uses legacy patterns that have modern equivalents
- After a large feature removal, to clean up leftover references
- Technical debt reduction sprint
- When the user asks to "clean up", "remove dead code", or "modernize"
How It Works
- Baseline – Run the full test suite and record results. This is the behavioral contract that must be preserved.
- Analyze – Scan for cleanup opportunities:
- Unused imports and variables
- Unreachable code (after return, dead branches)
- Unused exports (exported but never imported elsewhere)
- Orphaned files (not imported or referenced anywhere)
- Unused dependencies in package manifest
- Deprecated API usage with modern alternatives
- Redundant type assertions or unnecessary casts
- Duplicate code blocks
- Prioritize – Rank findings by confidence and impact:
- High confidence: unused imports (safe to remove)
- Medium confidence: unused exports (might be used externally)
- Low confidence: seemingly dead branches (might be future use)
- Apply – Make changes in order of confidence, re-running tests after each batch.
- Verify – Full test suite passes with identical results. Build is clean.
Copilot CLI Integration
- agent_type:
general-purpose– needs full tool access for analysis, editing, and running tests. - task agent: Use to run test suites and build commands efficiently. The
taskagent returns brief summaries on success, making the verify step fast. - explore agent: Use to map import graphs and find all references to a function or module before removing it.
- Iterative workflow: Changes are applied in small, verifiable batches. Use
autopilotmode for sequential safety.
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.
- yesterday First seen · 212 lines · 18 tokens per session scan A 334c5a842fda
refactor-cleaner is an agent published in the GitHub repository drvoss/everything-copilot-cli (45 stars, last pushed 5d ago), licensed MIT. It adds 18 tokens to every session and 1,867 once invoked, about $0.0001 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.
Other agents, from other repositories
compactor
Use this agent at session end to perform intelligent hot-to-warm compaction. Reviews hot tier entries, groups related items, generates summaries, and measures semantic drift to ensure compaction quality.
architect
Design specialist for planning features and changes. Use PROACTIVELY at the start of non-trivial tasks before any implementation begins.
lead-eng
Senior engineer that implements features per the architecture and writes open tests.
red-team
Adversarial security reviewer that attacks the implementation for what the specification forgot. Must be a different model family than the implementer.
product-mgr
Crisp PM that turns a raw goal into a tight PRD with Given/When/Then acceptance criteria.
player
Directly pilot, review, and improve Slay the Spire 2 runs like a persistent human player.