Borrowing it
Nothing to install: this file belongs to aidemd-mcp/server. 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/aidemd-mcp/server/main/.claude/commands/aide/refactor.mdgit clone --depth 1 https://github.com/aidemd-mcp/serverWrote 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/commands/aidemd-mcp/server/refactor)<a href="https://agentmods.dev/commands/aidemd-mcp/server/refactor"><img src="https://agentmods.dev/badge/commands/aidemd-mcp/server/refactor/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/commands/aidemd-mcp/server/refactor"><img src="https://agentmods.dev/badge/commands/aidemd-mcp/server/refactor.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.00000 | $0.01952 |
| Opus 5.5 | $0.00000 | $0.00781 |
| Sonnet 5.5 | $0.00000 | $0.00390 |
| Haiku 4.5 | $0.00000 | $0.00195 |
Grade A, and why
refactor 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 2mo 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.
How it starts
The opening of the file, as written. The whole thing — 107 lines — stays where its author put it; the contents beside it link to each section on GitHub.
/aide:refactor — Refactor Phase
Agent: This command is orchestrated by the
/aideorchestrator. It has two modes selected by the--specsflag — code-drift refactor (default) and spec-bloat sweep (--specs). Each mode delegates to different agents and follows a different flow.
Refactor existing artifacts to close drift from canonical contracts. The two modes target different artifact classes and use different agents:
| Mode | Target | Drift detected against | Agents |
|---|---|---|---|
| Default | Source code | Coding playbook + progressive disclosure | aide-auditor → aide-implementor → aide-qa |
--specs |
.aide files |
Brevity Contract | aide-aligner → aide-spec-writer and/or aide-strategist → aide-aligner |
This command requires a path argument. It does NOT perform full-app refactoring in one pass. Scope it to a directory and it will audit every .aide-defined section within that path.
Usage
/aide:refactor <path> # code-drift refactor (default)
/aide:refactor --specs <path> # spec-bloat sweep
Mode 1 — Code-drift refactor (default)
Audit existing code against the coding playbook and refactor to close convention drift. This is a post-QA mode — it runs on code that already works and already passed QA. The goal is conformance, not new functionality.
Flow
- Discover sections — run
aide_discoverwith the given path to find all.aidespecs in the subtree - Audit each section — spawn one
aide-auditoragent per.aidespec found. Each auditor:- Reads the implementation
- Consults the coding playbook via
study-playbook - Compares against progressive disclosure conventions
- Produces
plan.aidewith refactoring steps
- Pause for approval — present all plans to the user. Do not proceed until approved
- Execute refactoring — for each approved
plan.aide, delegate toaide-implementoragents (one per numbered step, same as build phase) - Re-validate — delegate to
aide-qaper section to verify the refactoring didn't break spec conformance
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.
- 2mo ago First seen · 107 lines · 0 tokens per session scan A 4eb49cfc18eb
refactor is a command published in the GitHub repository aidemd-mcp/server (4 stars, last pushed 2d ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 1,952 tokens. 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-31.
Other commands, from other repositories
watchdog
Run a superskill watchdog pass. Input: $ARGUMENTS (empty = dig the latest session).
api-aqa-flow-test-correction
Phase 7 Test Corrections of api-aqa-flow (USER APPROVAL REQUIRED).
ui-aqa-flow-test-report-analysis
Phase 7 Test Report Analysis of ui-aqa-flow.
api-aqa-flow-execution-and-report-analysis
Phase 6 Execution & Report Analysis of api-aqa-flow (USER INTERACTION REQUIRED).
ui-aqa-flow-test-correction
Phase 8 Test Correction of ui-aqa-flow.
doctor
Run IJFW health check (files, MCP server, hooks, memory, caps, framing).