workflow-optimizer

workflow-optimizer is an agent for Claude Code from anatolykoptev/n8n-mcp-agent. It costs 34 tokens per session (1,984 once invoked), scanned A, original, MIT.

An agent for reviewing n8n workflows, which are visual chains of automated steps. It examines their structure, performance, complexity, error handling, and resource use.

In plain words
What is it for?
Reviewing n8n workflows, finding bottlenecks and redundant steps, simplifying branches, improving error handling, and reducing unnecessary execution.
Why use it?
It helps identify slow, unnecessarily complex, unreliable, or wasteful workflow designs.

Agent for Claude Code

Written for Claude Code: a Claude Code subagent (agents/*.md). Also seen: model in frontmatter.

Good fit Reviewing n8n workflows, finding bottlenecks and redundant steps, simplifying branches, improving error handling, and reducing unnecessary execution.

Compare 6 agents from other repositories ↓
Install with agentmods
npx agentmods add agents/anatolykoptev/n8n-mcp-agent/workflow-optimizer
Install

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.

Clone the repo
git clone --depth 1 https://github.com/anatolykoptev/n8n-mcp-agent

Made for: Claude Code.

Wrote 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.

agentmods badge for workflow-optimizer

README.md
[![agentmods](https://agentmods.dev/badge/agents/anatolykoptev/n8n-mcp-agent/workflow-optimizer.svg)](https://agentmods.dev/agents/anatolykoptev/n8n-mcp-agent/workflow-optimizer)
Your own site
<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>
Per session 34 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,984 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

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.

ModelPer sessionOnce 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

Measured 7d ago against content hash 1579033d6bd8, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-07, from the pricing page.

Security

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.

agents/workflow-optimizer.md · 311 lines

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)

Read the full file on GitHub · 311 lines

Changes

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.

  1. 7d ago First seen · 311 lines · 34 tokens per session scan A 1579033d6bd8

Subscribe to this mod's changes

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.

Related

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.

neurawork-git/n8n-autopilot · 45 tokens

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…

neurawork-git/n8n-autopilot · 94 tokens

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…

neurawork-git/n8n-autopilot · 100 tokens

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.

neurawork-git/n8n-autopilot · 92 tokens

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.

neurawork-git/n8n-autopilot · 60 tokens

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.

neurawork-git/n8n-autopilot · 70 tokens