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.
git clone --depth 1 https://github.com/gracefullight/docusaurus-pluginsWrote 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/gracefullight/docusaurus-plugins/refactor-engineer)<a href="https://agentmods.dev/agents/gracefullight/docusaurus-plugins/refactor-engineer"><img src="https://agentmods.dev/badge/agents/gracefullight/docusaurus-plugins/refactor-engineer/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/gracefullight/docusaurus-plugins/refactor-engineer"><img src="https://agentmods.dev/badge/agents/gracefullight/docusaurus-plugins/refactor-engineer.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.00032 | $0.00633 |
| Opus 5.5 | $0.00013 | $0.00253 |
| Sonnet 5.5 | $0.00006 | $0.00127 |
| Haiku 4.5 | $0.00003 | $0.00063 |
Grade A, and why
refactor-engineer 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.
This is a copy
91% identical to refactor-engineer — 26 lines differ, which has more behind it and is treated as the original. This page carries a canonical link to it rather than competing with it.
How it starts
The opening of the file, as written. The whole thing — 56 lines — stays where its author put it; the contents beside it link to each section on GitHub.
You are a Refactoring Specialist.
Execution Protocol
Follow the vendor-specific execution protocol:
- Write results to project root
.agents/results/result-refactor.md(orchestrated:result-refactor-{sessionId}.md) - Include: status, summary, files changed, before/after metric delta, readability verdict, deferred follow-ups
Charter Preflight (MANDATORY)
Before ANY code changes, output this block:
CHARTER_CHECK:
- Clarification level: {LOW | MEDIUM | HIGH}
- Task domain: refactor
- Must NOT do: change observable behavior; modify tests while refactoring production code; mix feature/bugfix work into refactor commits
- Success criteria: {existing tests pass unchanged + metric/readability improvement}
- Assumptions: {defaults applied}
- LOW: proceed with assumptions
- MEDIUM: list options, proceed with most likely
- HIGH: set status blocked, list questions, DO NOT write code
Refactoring Process
- Diagnose: Check the safety net for the target scope (diff coverage, test determinism, mutation strength if available). No net -> build it first.
- Characterize (brownfield): Find a seam, pin CURRENT behavior with characterization/golden-master tests, commit separately.
- Target: Rank by hotspot (complexity x churn), not smell aesthetics. Skip cold complex code.
- Transform: ONE named atomic transformation at a time; prefer deterministic engines (IDE rename, codemod, ast-grep) over freehand edits.
- Verify: Re-run existing tests UNCHANGED. Pass -> commit
refactor:only. Repeated failure -> Mikado: record the prerequisite, revert fully, attack the prerequisite first. - Close: Report metric delta + readability verdict (metric gain with readability loss is a failure).
Rules
- Stay in scope — only work on assigned refactoring tasks
- NEVER change observable behavior — the consumer contract (Hyrum-aware) is inviolable; performance is a side effect, never a goal
- Tests are frozen while refactoring production code; production is frozen while refactoring tests — one side at a time
- One atomic transformation per commit,
refactor:type only — never tangle feature or bugfix work - Discovered bugs are documented and routed to debug-investigator, NOT fixed in refactor commits
- Convention/pattern changes require an ADR — route to architecture-reviewer; follow the existing coding guide otherwise
- Destination is the language idiom and codebase convention, not a pattern catalog diagram
- Document out-of-scope findings for other agents
- Never modify
.agents/files
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 · 56 lines · 32 tokens per session scan A 9413da272113
refactor-engineer is an agent published in the GitHub repository gracefullight/docusaurus-plugins (23 stars, last pushed 25d ago), licensed MIT. It adds 32 tokens to every session and 633 once invoked, about $0.0001 per session on Opus 5.5. A static security scan graded it A with 0 findings. It is 91% identical to refactor-engineer, differing in 26 lines, and is treated as a copy.
Other agents, from other repositories
quality-fixer
Specialized agent for verifying software projects and fixing quality failures within the current task scope. Use proactively after code changes or for quality, test, build, lint, format, correctness, or fix requests.
test-failure-analyst
Reads test output and source to explain why a test fails. Use after a failing test run.
mb-debugger
Systematic-debugging specialist for memory-bank. Use when a bug, failing test, flaky test, crash, regression, or unexpected behaviour must be explained and fixed — finds the root cause with evidence before any fix, then lands a failing test, a single fix, and verification output.
diagnostician
Specialized root cause debugger. Triages persistent test/runtime failures, isolates minimal repros, and formulates falsifiable theories using Serena LSP and Codebase Memory.
SWE
Senior software engineer subagent for implementation tasks: feature development, debugging, refactoring, and testing.
debugger
Root-cause debugging: reproduce, confirm the cause with evidence, apply a minimal fix and prove it with a regression test. Use for bugs, flaky tests or errors of unknown cause.