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/nxtg-ai/forge-plugin/refactorgit clone --depth 1 https://github.com/nxtg-ai/forge-pluginWhat 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.00000 | $0.01993 |
| Opus 5 | $0.00000 | $0.00996 |
| Sonnet 5 | $0.00000 | $0.00399 |
| Haiku 4.5 | $0.00000 | $0.00199 |
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 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 — 134 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Refactor
Restructures code without changing behavior -- extracts functions, eliminates duplication, reduces complexity, and splits oversized files, all with a green test suite as the safety net.
| Level | L1 Vibe Coder |
| Category | Domain Specialist |
| Model | Sonnet |
What It Does
The Refactor agent improves code structure while preserving external behavior. It takes an 800-line file and splits it into focused modules. It finds duplicated WebSocket logic across four components and extracts a reusable hook. It takes a function with cyclomatic complexity of 15 and simplifies it with early returns and extracted helpers. Every change it makes is protected by the test suite -- it runs tests before the refactoring to establish a green baseline, makes one structural change at a time, and runs tests after each step to verify behavior is preserved.
What makes this agent more disciplined than "just rename things" is its safety protocol. It will not refactor untested code. If a module lacks tests, it stops and tells you to generate them first (via the Testing agent). This is non-negotiable because refactoring without tests is not refactoring -- it is rewriting, and rewriting breaks things. The Refactor agent enforces the distinction: refactoring changes structure, never behavior, and tests prove it.
The agent encodes specific complexity thresholds: functions over 25 lines get extracted, cyclomatic complexity over 10 gets simplified, files over 300 lines get split, functions with more than 4 parameters get an options object, nesting deeper than 3 levels gets early returns. These are not arbitrary -- they are the thresholds where code comprehension drops sharply. The Refactor agent knows the catalog of refactoring patterns (Extract Function, Extract Hook, Replace Conditional with Polymorphism, Simplify with Early Returns) and applies the right one for each situation.
When to Use It
- When a file has grown too large: When a service, component, or utility has accumulated responsibilities and needs decomposition into focused modules with clear boundaries.
- When you see code duplication: When the same logic appears in multiple places and needs extraction into a shared function, hook, or utility.
- When complexity is too high: When a function has deeply nested conditionals, long switch statements, or cyclomatic complexity that makes reasoning about behavior difficult.
- When naming is misleading: When function names do not describe what they do, variable names are abbreviated, or class names do not reflect their single responsibility.
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 · 134 lines · 0 tokens per session scan A 838247b19e91
refactor is an agent published in the GitHub repository nxtg-ai/forge-plugin (5 stars, last pushed 12d ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 1,993 tokens. 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
code-reviewer
Reviews code for project guideline compliance, bugs, and quality issues. Use after writing code, before commits, or before PRs. Specify files to review or defaults to unstaged git changes. High-confidence issues only (80+) to minimize noise.
accessibility-specialist
Accessibility expert: WCAG 2.2 audits, screen reader compat, keyboard navigation, ARIA patterns, automated a11y testing.
data-pipeline-engineer
Data pipeline specialist: embeddings, chunking strategies, vector indexes, data transformation for AI consumption.
demo-producer
Universal demo video producer that creates polished marketing videos for any content - skills, agents, plugins, tutorials, CLI tools, or code walkthroughs. Uses VHS terminal recording and Remotion composition.
emulate-engineer
Stateful API emulation via Vercel emulate. Seeds GitHub/Vercel/Google/Slack/Apple/Entra/AWS/MongoDB/Okta/Resend/Stripe/Clerk/Linear, webhooks, port isolation, Next.js adapter. Use to replace flaky API mocks.
TESTING
This document provides comprehensive guidance for testing the Multi-Agent Networks feature in NeuroLink.