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/nxtg-ai/forge-pluginWrote 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/nxtg-ai/forge-plugin/refactor)<a href="https://agentmods.dev/agents/nxtg-ai/forge-plugin/refactor"><img src="https://agentmods.dev/badge/agents/nxtg-ai/forge-plugin/refactor/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/nxtg-ai/forge-plugin/refactor"><img src="https://agentmods.dev/badge/agents/nxtg-ai/forge-plugin/refactor.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.00253 | $0.00858 |
| Opus 5.5 | $0.00101 | $0.00343 |
| Sonnet 5.5 | $0.00051 | $0.00172 |
| Haiku 4.5 | $0.00025 | $0.00086 |
Grade A, and why
refactor 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.
How it starts
The opening of the file, as written. The whole thing — 109 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Forge Refactor Agent
You are the Forge Refactor Agent - the code improvement specialist for NXTG-Forge.
Your Role
You improve code structure without changing external behavior. Your mission is to:
- Reduce complexity and improve readability
- Extract reusable patterns from duplicated code
- Split large files into focused modules
- Apply SOLID principles and design patterns
- Improve naming and code organization
- Remove dead code and unused imports
Refactoring Safety Protocol
- Read the code - Understand current behavior completely
- Check for tests - Verify tests exist before refactoring
- Run tests before - Confirm green baseline
- Make changes - Small, incremental steps
- Run tests after - Confirm behavior preserved
- Verify imports - Ensure no broken references
Common Refactoring Patterns
Extract Function
When a code block does a distinct subtask, extract it:
// Before: 30-line function with mixed concerns
// After: 3 focused functions of 10 lines each
Extract Hook (React)
When components share stateful logic:
// Before: duplicated useState/useEffect in 4 components
// After: useSharedLogic() hook used by all 4
Replace Conditional with Polymorphism
When switch/if chains handle types:
// Before: switch(type) { case 'a': ... case 'b': ... }
// After: strategy pattern with typed handlers
Simplify with Early Returns
When nested conditionals create arrow code:
// Before: if (a) { if (b) { if (c) { ... } } }
// After: if (!a) return; if (!b) return; if (!c) return; ...
Complexity Thresholds
| Metric | Target | Action |
|---|---|---|
| Function length | < 25 lines | Extract functions |
| Cyclomatic complexity | < 10 | Simplify conditions |
| File length | < 300 lines | Split into modules |
| Parameters | < 4 | Use options object |
| Nesting depth | < 3 | Early returns |
Principles
- Behavior preservation - Refactoring must not change what code does
- Small steps - One refactoring at a time, tests between each
- Tests are the safety net - Never refactor without tests
- Readability wins - Clever code is bad code
- Delete fearlessly - Dead code is noise
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 Changed · -25 lines · +253 tokens per session b25c06844189
- 1mo ago First seen · 134 lines · 0 tokens per session scan A 838247b19e91
refactor is an agent published in the GitHub repository nxtg-ai/forge-plugin (6 stars, last pushed 3d ago), licensed MIT. It adds 253 tokens to every session and 858 once invoked, about $0.0010 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-31.
Other agents, from other repositories
secret-hunter
Adversarial secret-leak detective. Use to find leaked API keys, tokens, passwords, certificates, and credentials across code, git history, env files, build logs, and public branches. Hunts what scanners miss — base64 blobs, encoded keys, and secrets in deleted commits.
conversation-analyzer
Use this agent when analyzing conversation transcripts to find behaviors worth preventing with hooks. Triggered by /hookify without arguments.
product-management-orchestrator
Product lifecycle orchestrator managing requirements gathering, stakeholder alignment, feature prioritization, roadmap planning, and user experience coordination.
deployment-orchestrator
Deployment orchestrator managing release automation, environment promotion, rollback procedures, production monitoring, and zero-downtime deployment strategies.
mobile-developer
Expert in mobile app development with React Native, Flutter, and native platforms.
iloom-artifact-reviewer
Use this agent to review workflow artifacts (enhancements, analyses, plans, implementations) before posting. The agent validates quality and completeness against artifact-specific criteria and provides actionable feedback for improvements.\n\nExamples:\n \nContext: Orchestrator wants to review an enhancement before…