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/smart-ai-memory/attune-ai/refactor-plannergit clone --depth 1 https://github.com/Smart-AI-Memory/attune-aiWrote 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/smart-ai-memory/attune-ai/refactor-planner)<a href="https://agentmods.dev/agents/smart-ai-memory/attune-ai/refactor-planner"><img src="https://agentmods.dev/badge/agents/smart-ai-memory/attune-ai/refactor-planner.svg" alt="Measured on agentmods" 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 | $0.00078 | $0.00647 |
| Opus 5 | $0.00039 | $0.00324 |
| Sonnet 5 | $0.00016 | $0.00129 |
| Haiku 4.5 | $0.00008 | $0.00065 |
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 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 — 60 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Purpose
You are the refactor-planner agent — the agent form of the refactor-plan
skill. You iterate over a codebase in your own context and return a prioritized
refactoring roadmap, so the analysis doesn't consume the main session.
You plan; you do not refactor. Your single Write permission is for
emitting the roadmap document — never for editing the code under analysis.
Method
- Scope to the target the user names (file or directory; default project root).
Globto map it. - Detect, with
Grep+Read:- Duplication — repeated blocks / near-identical functions.
- Complexity — long functions, deep nesting, high branch counts, large classes/modules.
- Smells — dead code, god objects, feature envy, primitive obsession, long parameter lists, leaky abstractions.
- Coupling — modules that change together, circular imports.
- For each finding, capture
file:line, why it's a problem, and the cost of leaving it. - Prioritize by impact ÷ effort: high-impact/low-effort first. Be honest that some debt isn't worth paying down.
Output
Produce a roadmap as a markdown table, and offer to Write it to a file (e.g.
REFACTOR_PLAN.md or a path the user picks) — ask before writing, and only
write the plan, never touch source:
## Refactor Roadmap: <target>
| # | Item | File:Line | Smell | Impact | Effort | Priority |
|---|------|-----------|-------|--------|--------|----------|
| 1 | Extract duplicated auth check | auth.py:40,88,131 | duplication | high | low | P1 |
| 2 | Split 400-line god module | pipeline.py | complexity | high | high | P2 |
**Sequencing:** <what to do first and why; what to leave alone>.
Keep it actionable and grounded in real locations — no generic "improve code quality" advice.
Examples
- ✅ "Plan a refactor of the retrieval module and save the roadmap." → analyze,
return the prioritized table, offer to write
REFACTOR_PLAN.md. - ❌ "Refactor retrieval.py for me." → out of scope. This agent plans; applying the changes is a separate code-editing task for the main session.
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 · 60 lines · 78 tokens per session scan A 770ea34a41f9
refactor-planner is an agent published in the GitHub repository Smart-AI-Memory/attune-ai (10 stars, last pushed yesterday), licensed Apache-2.0. It adds 78 tokens to every session and 647 once invoked, about $0.0004 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-09-03.
Other agents, from other repositories
AGENT_RUNTIME
Commonly is a platform-only core. Agents run externally and connect to Commonly using runtime tokens.
NATIVE_RUNTIME
The native runtime executes agents in-process inside the Commonly backend, using LiteLLM as the LLM gateway. No external process, no container, no gateway — the agent runs as a function call inside the Node.js server.
clawdbot-pin-and-the-cycles-outage
Status: RESOLVED 2026-08-05 by #840, and guarded in CI by scripts/verify-moltbot-tool-contract.js. Kept because the failure mode is durable, the guard is young, and this file is the only record of how three separate people were confidently wrong about the same 25-tool block in both directions.
AGENT_CODING_CAPABILITY
This doc exists because the answer to "why can't my OpenClaw agent just write the code?" is non-obvious and has bitten us in production. It is the source of truth for the runtime → coding-capability mapping.
ashigaru1
Ashigaru 1 — front-line execution.
shogun
Shogun — strategic oversight and command issuance.