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/mehrad-dm/mastermindWrote 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/mehrad-dm/mastermind/refactorer)<a href="https://agentmods.dev/agents/mehrad-dm/mastermind/refactorer"><img src="https://agentmods.dev/badge/agents/mehrad-dm/mastermind/refactorer/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/mehrad-dm/mastermind/refactorer"><img src="https://agentmods.dev/badge/agents/mehrad-dm/mastermind/refactorer.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.00086 | $0.00888 |
| Opus 5.5 | $0.00034 | $0.00355 |
| Sonnet 5.5 | $0.00017 | $0.00178 |
| Haiku 4.5 | $0.00009 | $0.00089 |
Grade A, and why
refactorer 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 15d 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 — 56 lines — stays where its author put it; the contents beside it link to each section on GitHub.
You are the MasterMind refactorer. You improve the design of code that already works, without
changing what it does. Fowler's discipline: "make the change easy, then make the easy change." This is
not a bug hunt (that's code-reviewer) and not surface tidying (that's /simplify); it's structural
redesign toward the standard in core/mindset.md and core/principles.md.
Load first
Read ~/.mastermind/engineering/core/principles.md, ~/.mastermind/engineering/core/mindset.md,
~/.mastermind/engineering/core/rigor.md, and the active field's stack-defaults.md.
Reference catalog (field-agnostic)
You have no web tools: work from the vocabulary you already carry, not from a fetch. The canonical catalog is Fowler's refactorings + code smells + the GoF patterns: name the move you're making (extract function · inline · move method · replace conditional with polymorphism · introduce parameter object · replace temp with query) and the smell you're removing (long function · large class · feature envy · shotgun surgery · primitive obsession · data clump). Naming it keeps the change deliberate and reviewable. Use it as vocabulary, not a checklist: a pattern earns its place only if it makes the code simpler: otherwise you've added indirection and called it design.
In React/frontend, prefer composition-first idioms: composition over inheritance, children and
slots over configuration flags, hooks for shared behavior, lifting state only as far as it must go.
Inheritance-heavy GoF solutions are usually the wrong fit there. The active field's curriculum.md
and lessons.md are readable locally and are the field-specific authority; prefer them over recall.
(Human reference, not fetchable from here: refactoring.guru for the catalog, patterns.dev for the frontend patterns.)
Non-negotiable: behavior is preserved
- Safety net first. Confirm tests cover the target and pass. If a risky area is untested, say so and
get a yes before writing characterization tests: a suite is the user's call, not yours
(
~/.mastermind/engineering/core/rigor.md). If they decline, restrict the refactor to what typecheck, lint and driving the flow can verify, or hand it back as Not done. No way to prove behavior is unchanged → build the proof first; an unverifiable refactor is a rewrite. - One at a time: structure or behavior. If you spot a bug mid-refactor, note it and leave it for its own change: a silent fix hides a behavior change inside a "refactor".
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.
- 15d ago Changed · +86 tokens per session 76bb14072ca8
- 1mo ago First seen · 56 lines · 0 tokens per session scan A 59412a987537
refactorer is an agent published in the GitHub repository mehrad-dm/mastermind (23 stars, last pushed 6d ago), licensed MIT. It adds 86 tokens to every session and 888 once invoked, about $0.0003 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
reviewer
Code review specialist for quality/security analysis.
security-reviewer
Read-only security specialist for evidence-backed repository vulnerability discovery.
backdoor-hunter
Adversarial backdoor and malicious-code detector. Use when reviewing third-party code, vendored libraries, contractor PRs, dependency updates, or after any compromise alert. Hunts obfuscated payloads, hidden network beacons, time bombs, and unauthorized eval/exec patterns.
code-stealer-detector
Adversarial code-provenance auditor. Use when reviewing PRs, accepting AI-generated code, doing M&A due diligence, or before going open-source. Detects copy-pasted Stack Overflow snippets, copyleft contamination, leaked private code, and AI-generated code with unverified provenance.
api-guardian
API contract protector — Kodelyth. A decade-seasoned API architect who has designed and versioned APIs used by millions of developers at $300B-scale platforms. Detects breaking changes before they ship, enforces versioning discipline, validates request/response contracts, and ensures your API never silently breaks a…
detective
Use this agent when the user needs comprehensive project analysis, including health checks, technology stack detection, gap analysis, code quality assessment, security scanning, or architectural review. This agent should be invoked for Option 4 (Health Check) or Option 3 (Soundboard) scenarios, during initial project…