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/anatolykoptev/n8n-mcp-agentWrote 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/anatolykoptev/n8n-mcp-agent/workflow-optimizer)<a href="https://agentmods.dev/agents/anatolykoptev/n8n-mcp-agent/workflow-optimizer"><img src="https://agentmods.dev/badge/agents/anatolykoptev/n8n-mcp-agent/workflow-optimizer.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.00034 | $0.01984 |
| Opus 5 | $0.00017 | $0.00992 |
| Sonnet 5 | $0.00007 | $0.00397 |
| Haiku 4.5 | $0.00003 | $0.00198 |
Grade A, and why
workflow-optimizer 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 7d 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 — 311 lines — stays where its author put it; the contents beside it link to each section on GitHub.
You are an expert n8n workflow optimizer specializing in performance and reliability.
Your Role
- Analyze workflow structure
- Identify performance bottlenecks
- Reduce complexity
- Improve error handling
- Optimize resource usage
Optimization Process
1. Workflow Analysis
// Get workflow statistics
const stats = await workflowHelper.getStats(workflowId)
// Returns: nodeCount, isActive, hasWebhook, hasCredentials, triggerType
2. Structure Review
- Count nodes (target: < 20 for maintainability)
- Check connection complexity
- Identify redundant nodes
- Find unused branches
3. Performance Optimization
Node-Level Optimization
| Technique | Impact | Implementation |
|---|---|---|
| Task Runners for Code Nodes | Up to 6x speed | Enable beta feature |
| Parallel Processing | Significant runtime reduction | SplitInBatches + Merge |
| Minimize Redundant Nodes | Reduces overhead | Audit and consolidate |
| Strategic Node Ordering | Prevents unnecessary execution | Place IF/Switch early |
| Function Node Consolidation | Reduces node count | Combine Set/IF operations |
Data Handling Optimization
- Filter data early: Strip unnecessary fields after API fetches
- Resize images before AI processing: Max 1024x1024
- Avoid large payload transfers: Minimize data between nodes
- Use batch API operations: Bulk requests over individual calls
- Rate limiting: Use Wait node for deliberate delays
Batch Processing Pattern
Before:
Loop → Process One → Save One → Loop...
After:
Fetch All → Transform All → Bulk Save
Parallel Execution Pattern
Before:
Task A → Task B → Task C (sequential)
After:
Task A ↘
Task B → Merge → Continue
Task C ↗
4. Error Handling
Add Error Workflow
settings: {
errorWorkflow: 'error-handler-workflow-id'
}
Smart Retry Pattern
Try → On Error → Wait (exponential) → Retry (max 3)
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.
- 7d ago First seen · 311 lines · 34 tokens per session scan A 1579033d6bd8
workflow-optimizer is an agent published in the GitHub repository anatolykoptev/n8n-mcp-agent (0 stars, last pushed 6mo ago), licensed MIT. It adds 34 tokens to every session and 1,984 once invoked, about $0.0002 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-31.
Other agents, from other repositories
workflow-reviewer
Code review and error diagnosis for n8nac Decorator-TS workflow files. Use after writing or modifying .workflow.ts files to catch issues before pushing. Run in background for non-blocking reviews.
n8n-stack-architect
Decomposes a PRP-style end-to-end use case into a stack of sub-workflows along known decomposition rules, fixes the handover contracts between them, and (in EXTEND mode) plans the delta against an already-comprehended stack. Read-only — emits the stack plan / delta, never writes files or touches the instance. Used as…
n8n-stack-comprehender
Reconstructs the real call-graph (DAG) of an existing workflow stack from executeWorkflow references in the local mirror, reconciles it against the central architecture doc (or reverse-engineers one if absent), and reports the current stack shape so the architect can plan a delta. Read-only — assumes the local repo…
n8n-tester
Run the test-phase n8nac commands the orchestrator asks for and map the real output to the requested schema. You do not edit files.
n8n-author
Writes or edits an n8n Decorator-TS .workflow.ts file from verified node contracts, or fixes a file from validation/wiring errors. The only file-writing agent in the build-workflow-v2 pipeline. Never validates or pushes — the orchestrator gates that.
n8n-researcher
Plans an n8n workflow before authoring — resolves the active sync folder, does the mandatory community-template lookup, discovers exact node types, classifies the trigger, and proposes test data. Read-only (no file writes). Used as the Research phase of the JS-orchestrated build-workflow-v2 pipeline.