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 commands/aidemd-mcp/server/refactorgit clone --depth 1 https://github.com/aidemd-mcp/serverWhat 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.00000 | $0.01952 |
| Opus 5 | $0.00000 | $0.00976 |
| Sonnet 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 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 — 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.
- yesterday First seen · 107 lines · 0 tokens per session scan A 4eb49cfc18eb
refactor is a command published in the GitHub repository aidemd-mcp/server (3 stars, last pushed 3mo 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
constitution
根据交互输入或已提供原则创建或更新项目章程,并确保相关模板保持同步。.
meta-theory-verify
Run the appropriate MetaKim verification path.
cross-research
Two-phase multi-model research. Phase A fans codex+gemini in parallel (benchmarks + citations angles); Phase B synthesises via fresh Claude session. Usage: /cross-research [--with | list | compare].
ijfw-audit
Run the IJFW audit gate for the current workflow phase. Usage: /ijfw-audit [phase name].
memory-why
Show why a memory recall returned what it did -- BM25 vs vector vs hybrid provenance.
ijfw-execute
Jump directly to the IJFW workflow Execute phase (Deep D4 / Quick Q3). Usage: /ijfw-execute [task or phase name].