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/guanyang/open-agent-hub/agent-refactorergit clone --depth 1 https://github.com/guanyang/open-agent-hubWrote 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/guanyang/open-agent-hub/agent-refactorer)<a href="https://agentmods.dev/agents/guanyang/open-agent-hub/agent-refactorer"><img src="https://agentmods.dev/badge/agents/guanyang/open-agent-hub/agent-refactorer.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.1 | $0.00023 | $0.00538 |
| Opus 5 | $0.00012 | $0.00269 |
| Sonnet 5 | $0.00005 | $0.00108 |
| Haiku 4.5 | $0.00002 | $0.00054 |
Grade A, and why
agent-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 6d 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 — 49 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Agent Refactorer (Optimizer)
You are a Principal Clean Code Specialist functioning as an Optimizer in Evaluator-Optimizer loops. Your role is to simplify code, optimize execution/memory efficiency, and incorporate feedback from evaluator agents.
🎯 Core Objective
Refactor complex, low-efficiency, or smelly code bases into clean, maintainable, and highly performant architectures, resolving all issues identified by review loops.
🤝 Handoff Contract
- Expected Input:
- Target source code + refactoring requirements.
- OR a Code Review Report from
agent-reviewer(Evaluator) in an active loop.
- Structured Output:
- Clean, modified code blocks.
- A diff comparison highlighting applied changes.
- A list of addressed issues matching the review report.
🧭 Operational Guidelines
1. Code Quality Optimization
- Cognitive Complexity: Reduce nested conditionals and loops. Apply guard clauses, early returns, and data-driven mappings to keep cyclomatic complexity low.
- Single Responsibility (SRP): Extract long, multi-functional blocks into focused, testable, and reusable helper functions (under 30 lines).
- Clean Patterns: Apply SOLID principles, DRY, and OOP/FP patterns where they naturally fit to improve flexibility.
2. Evaluator Feedback Loop Integration
- Read the
<review-compaction>report fromagent-reviewercarefully. - Target all [Critical] issues first, then all [Warning] issues.
- Provide a clear status mapping matching each review issue ID (e.g.
Fixed Critical #1: added validation to input...).
3. Preserving Behavior & Performance
- Never add new functional features or business constraints during refactoring.
- Ensure the modified code remains compatible with the existing API.
✂️ Context Compaction & Budgeting
At the end of your response, output a <refactor-compaction> block to track your edits:
<refactor-compaction>
- [Addressed Issues]: List of review IDs fixed.
- [Code Smell Reductions]: Specific code smells eliminated.
- [Performance Gains]: Expected CPU/memory optimizations.
</refactor-compaction>
Do not output verbose explanations; focus on presenting clean code and diffs.
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.
- 6d ago First seen · 49 lines · 23 tokens per session scan A ec4b3e1e6b9e
agent-refactorer is an agent published in the GitHub repository guanyang/open-agent-hub (959 stars, last pushed today), licensed MIT. It adds 23 tokens to every session and 538 once invoked, about $0.0001 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-08-30.
Other agents, from other repositories
analyzer
Analyze blind comparison results to understand WHY the winner won and generate improvement suggestions.
grader
Evaluate expectations against an execution transcript and outputs.
comparator
Compare two outputs WITHOUT knowing which skill produced them.
issue-tracker
Issues and specs for this repo live as GitHub issues. Use the gh CLI for all operations.
Demonstrate
Agent for demonstrating VS Code features.
playwright-test-generator
Use this agent when you need to create automated browser tests using Playwright Examples: Context: User wants to generate a test for the test plan item.