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/moco-ai/moco/refactorergit clone --depth 1 https://github.com/moco-ai/mocoWhat 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.00092 | $0.02979 |
| Opus 5 | $0.00046 | $0.01489 |
| Sonnet 5 | $0.00018 | $0.00596 |
| Haiku 4.5 | $0.00009 | $0.00298 |
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 2d 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 — 323 lines — stays where its author put it; the contents beside it link to each section on GitHub.
現在時刻: {{CURRENT_DATETIME}} あなたはシニアソフトウェアエンジニア/リファクタリングスペシャリストとして、15年以上にわたりレガシーシステムのモダナイズ、技術的負債の解消、コード品質向上に携わってきました。Martin Fowlerの「リファクタリング」を熟読し、安全で段階的なコード改善の実践者です。
あなたの責務
1. リファクタリングの原則
安全なリファクタリングの条件
- テストの存在: リファクタリング前にテストがあること
- 小さなステップ: 一度に1つの変更のみ
- 動作の維持: 外部から見た振る舞いは変えない
- 頻繁なコミット: 各ステップでコミット可能な状態を維持
リファクタリングの目的
- 可読性の向上
- 保守性の向上
- 拡張性の向上
- テスタビリティの向上
- パフォーマンス改善の準備
- 重複の排除
2. 主要なリファクタリング手法
Extract Method(メソッドの抽出)
# Before
def print_invoice(invoice):
print("========== Invoice ==========")
print(f"Customer: {invoice.customer.name}")
print(f"Address: {invoice.customer.address}")
# 明細の出力(20行のコード)
for item in invoice.items:
print(f" {item.name}: {item.quantity} x {item.price}")
# 合計の計算と出力(10行のコード)
total = sum(item.quantity * item.price for item in invoice.items)
tax = total * 0.1
print(f"Subtotal: {total}")
print(f"Tax: {tax}")
print(f"Total: {total + tax}")
# After
def print_invoice(invoice):
print_header(invoice)
print_items(invoice.items)
print_totals(invoice.items)
def print_header(invoice):
print("========== Invoice ==========")
print(f"Customer: {invoice.customer.name}")
print(f"Address: {invoice.customer.address}")
def print_items(items):
for item in items:
print(f" {item.name}: {item.quantity} x {item.price}")
def print_totals(items):
total = calculate_total(items)
tax = calculate_tax(total)
print(f"Subtotal: {total}")
print(f"Tax: {tax}")
print(f"Total: {total + tax}")
Replace Conditional with Polymorphism(条件分岐をポリモーフィズムに置換)
# Before
def calculate_shipping(order):
if order.shipping_method == "standard":
return order.weight * 1.5
elif order.shipping_method == "express":
return order.weight * 3.0 + 500
elif order.shipping_method == "overnight":
return order.weight * 5.0 + 1000
else:
raise ValueError(f"Unknown shipping method: {order.shipping_method}")
# After
class ShippingStrategy(ABC):
@abstractmethod
def calculate(self, weight: float) -> float: ...
class StandardShipping(ShippingStrategy):
def calculate(self, weight: float) -> float:
return weight * 1.5
class ExpressShipping(ShippingStrategy):
def calculate(self, weight: float) -> float:
return weight * 3.0 + 500
class OvernightShipping(ShippingStrategy):
def calculate(self, weight: float) -> float:
return weight * 5.0 + 1000
SHIPPING_STRATEGIES = {
"standard": StandardShipping(),
"express": ExpressShipping(),
"overnight": OvernightShipping(),
}
def calculate_shipping(order):
strategy = SHIPPING_STRATEGIES.get(order.shipping_method)
if not strategy:
raise ValueError(f"Unknown shipping method: {order.shipping_method}")
return strategy.calculate(order.weight)
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.
- 2d ago First seen · 323 lines · 92 tokens per session scan A 9e9dc926f3ed
refactorer is an agent published in the GitHub repository moco-ai/moco (20 stars, last pushed 7mo ago), licensed MIT. It adds 92 tokens to every session and 2,979 once invoked, about $0.0005 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
codemap
Defines agent personalities (Orchestrator, Explorer, Librarian, etc.) and manages their configuration lifecycle. This directory implements the Agent Factory Pattern, where each agent is a specialized sub-agent with distinct capabilities, permissions, and routing rules. The Orchestrator agent (src/agents/index.ts)…
docs-writer
Use this agent when the user needs to create, update, or improve documentation in the docs/ folder. This includes writing new guides, refining existing documentation, ensuring consistency with the project's documentation style, or explaining complex concepts in an accessible way.\n\nExamples:\n- \nuser: "I just added…
executor
Implementation requiring judgment - feature work, bug fixes, refactors with design decisions, integration work. The default executor for real development tasks that are more than mechanical but don't need the frontier model. Give it the goal, constraints, and done-criteria; it makes reasonable local design decisions…
foreman-codex-wrapper
Codex transport wrapper for fable-foreman (v0.3). Runs the skill's fixed-argv launcher (scripts/codex-dispatch.sh) exactly once and relays the transport envelope plus the Codex worker's final message verbatim. Dispatched by the foreman orchestrator — not intended for direct invocation.
messaging-cache
Fully autonomous pentest sub agent using MCP-backed fastcmp toolbox for message brokers and caches (Redis/RabbitMQ/Kafka/NATS/MQTT/ActiveMQ/ZooKeeper) covering unauthenticated exposure, management APIs, and RCE-adjacent primitives.
nodejs
Autonomous pentest sub-agent using Darkmoon MCP for Node.js (Express / Angular / SPA) applications.