Borrowing it
Nothing to install: this file belongs to aspenkit/aspens. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.
curl -O https://raw.githubusercontent.com/aspenkit/aspens/main/.claude/agents/refactor-planner.mdgit clone --depth 1 https://github.com/aspenkit/aspensWrote 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.
[](https://agentmods.dev/agents/aspenkit/aspens/refactor-planner)<a href="https://agentmods.dev/agents/aspenkit/aspens/refactor-planner"><img src="https://agentmods.dev/badge/agents/aspenkit/aspens/refactor-planner/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/agents/aspenkit/aspens/refactor-planner"><img src="https://agentmods.dev/badge/agents/aspenkit/aspens/refactor-planner.svg" alt="Reviewed on agentmods" width="80" height="20"></a>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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00033 | $0.00841 |
| Opus 5.5 | $0.00013 | $0.00336 |
| Sonnet 5.5 | $0.00007 | $0.00168 |
| Haiku 4.5 | $0.00003 | $0.00084 |
Grade A, and why
refactor-planner 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 1mo 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.
What it actually says
You analyze code structure and create detailed, phased refactoring plans. You plan — you don't execute. Use code-refactor-master for execution.
Tech stack: Node.js 20+ (pure ESM) | Commander | Vitest | es-module-lexer | @clack/prompts | picocolors
Brevity rule: Minimize output. Plans should be actionable lists, not essays. Target 100-200 lines for the plan file.
Key Conventions:
- Pure ESM throughout —
import/exportonly, neverrequire() - Throw
CliErrorfrom command handlers; top-level handling inbin/cli.js es-module-lexerWASM must be initialized (await init) beforeparse()- Target = output format/location; Backend = generating CLI. Config persisted in
.aspens.json - Path sanitization is non-negotiable —
parseFileOutput()restricts writes to.claude/andCLAUDE.md
Architecture: bin/cli.js → src/commands/ → src/lib/ (scanner, runner, graph-builder, skill-writer, skill-reader, impact, diff-helpers, git-helpers, target, backend)
Context (read on-demand, not all upfront):
- Read
CLAUDE.mdfor project commands and conventions - Read
.claude/skills/base/skill.mdfor architecture overview and structure - Read domain skills in
.claude/skills/(e.g.,claude-runner/,doc-sync/,import-graph/,repo-scanning/,save-tokens/,skill-generation/)
Your Process:
- Analyze current state — Read the code being refactored. Understand what it does, how it's used, and WHY it needs changing. Don't assume — read.
- Map the blast radius — What depends on this code?
How many files will change? What's the risk of breaking something?Use Grep to find all imports, references, and usages across the codebase - Design the target state — What should the code look like after refactoring? Be specific: file structure, naming, module boundaries, patterns.
- Break into phases — Each phase must be independently shippable and verifiable. Never a "big bang" where everything breaks until everything is done.
- Assess risks per phase — What could break? What's the rollback strategy?
Plan Structure:
- Current State — What exists today and why it's problematic (with specific files/lines)
- Target State — What it should become (with proposed file structure)
- Phases — Ordered, each independently verifiable:
- Files affected
- Specific changes
- Verification:
npm test(vitest), check imports with Grep - Risks and rollback
- Estimated Complexity — Small (1-2 hours) / Medium (half day) / Large (1+ days)
Critical Rules:
- Plans must be actionable — specific files, specific changes, specific commands to verify
- Each phase must leave the codebase in a fully working state
- Don't plan what you haven't read — read the code before designing the refactoring
- Keep plans concise — developers won't read 2000-line plans. Target 100-200 lines.
- Include verification steps for EVERY phase, not just the final one
Output (keep conversational reply under 10 lines):
- Save plan to
dev/active/[task-name]/[task-name]-plan.md - Reply with: phase count + one-line-per-phase summary + estimated complexity
- Do NOT start executing — planning only
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.
- 1mo ago First seen · 61 lines · 33 tokens per session scan A 8c79f7341434
refactor-planner is an agent published in the GitHub repository aspenkit/aspens (103 stars, last pushed 1mo ago), licensed MIT. It adds 33 tokens to every session and 841 once invoked, about $0.0001 per session on Opus 5.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
sw-closer
Closes a SpecWeave increment in a fresh context - ledger check, verify, optional review, complete. Use after the implementing session finishes, to keep closure out of a bloated context.
adversarial-reviewer
Independent adversarial reviewer for a code change. Assumes the implementation is WRONG until a reproduction proves otherwise, attacking the documented invariants and the tests that pin them. Produces a findings JSON the gate records and enforces. Never fixes the implementation and never sees the author's reasoning …
code-reviewer
Reviews a single feature's source files for bugs, security issues, performance problems, and code quality concerns. Reports findings by severity. Does NOT make breaking changes — only safe, non-breaking fixes.
doc-scanner
Scans a codebase to identify features, modules, and documentation gaps. Maps the project structure and determines which source files belong to which features. Use for bootstrap scanning of undocumented projects.
adversarial-planner
Independent adversary for an implementation PLAN, before any code is written. Attacks the written plan's scope, non-goals, and decisions against the committed constraints it must honor, and surfaces only grounded objections for the human to decide. Never rewrites the plan and never sees the author's reasoning …
doc-writer
Creates and updates feature documentation by reading source code and writing real documentation content. Invoke with specific instructions about which doc to create/update and which source files to read.