⚡ Claude Code Dynamic Workflows

By Nate Herk · AI Automation · Full comparison: Skills vs Sub-agents vs Agent Teams vs /goal

Claude Code Dynamic Workflows Agentic AI Cost Analysis

💡 What Is a Dynamic Workflow?

Claude Opus 4.8 feature. Claude writes a JavaScript script that orchestrates hundreds of agents working in parallel. Results are merged and sent back to the main Claude session.

🎯 You describe the goal
📝 Claude writes JS script
🤖 N agents run in parallel
🔄 Results merged & returned
Unlike /goal (loop until done=true), workflows are width-first — many agents run horizontally, then stop. No endless loop checking.

🔑 The Core Insight

Skill = the HOW

A reusable recipe. "How do I do this task?"

Workflow = the HOW MANY / WIDTH

A parallel execution engine. "How many agents do I spin up?"

📊 /goal vs Workflow

✅ /goal — Depth-first

  • Loop until done == true
  • Can run 24h+
  • Good for: iterative refinement
  • Single agent or sub-agents
  • Checks end criteria each pass

⚡ Workflow — Width-first

  • N agents execute in parallel
  • Stops when all done
  • Good for: parallel batch jobs
  • Results synthesized at end
  • No criteria loop — "do your task, then stop"
Combine both: run a workflow inside a /goal for complex nested parallelism. But be careful — that's a money burner!

🧩 What Gets Generated

A JavaScript file saved to .claude/workflows/. You can:

By default workflows may save to a global location, not your project. Specify the save path explicitly in your prompt.

📐 Feature Ladder — Complexity vs Power

As you move up: more complexity, more functionality, but also more cost and more risk.

$
Direct Question — Just ask
Quick questions, general knowledge work
$
$$
Skill — Reusable Recipe
Repeatable tasks, define once, run many times
$$
$$$
Sub-agent — Parallel Isolated Worker
Side tasks, isolated context, only reports back to main session
$$$
$$$$
Agent Team — Small Crew that Talks
War rooms, councils, debates. Members share task list & communicate
$$$$
$$$$
/goal — Loop Until Done
Repeated passes until end criteria met. Can run 24h+
$$$$
$$$$$
Dynamic Workflow — Giant Parallel Job
Hundreds of agents, width-first, results synthesized at end
$$$$$

🔄 Sub-agent vs Workflow

Sub-agent

  • Single agent in parallel execution
  • Only talks back to main session
  • Cannot talk to other sub-agents
  • Isolated context window
  • Best for: one-off side tasks

Workflow

  • Many agents in parallel (can be 100+)
  • All results merged at end
  • More like a "big sub-agent"
  • Claude holds overall plan
  • Best for: batch parallel analysis

🏢 Agent Team vs Workflow

Agent Team

  • Members can talk to each other
  • Share task list
  • War rooms / councils / debates
  • Individual roles & tools
  • High cost due to inter-agent communication

Workflow

  • Agents work alone
  • No inter-agent communication
  • Results merged at end
  • No shared task list
  • More predictable cost

🆚 Feature Comparison Table

Feature Agents Inter-Agent Talk Context Best For Cost
Direct Ask 1 Full session Quick Q&A
Skill 1 Session + skill Repeatable recipes
Sub-agent 1+ ❌ No Isolated Side tasks
Agent Team 2-5 ✅ Yes Own + shared Debates, councils
/goal 1 (+ subs) Via subs Session Iterative until done
Dynamic Workflow 1 to 100+ ❌ No Own each Batch parallel jobs

🔬 Deep Comparison: /goal vs Workflow

/goal — Depth Loop

  • Execution model: Sequential passes
  • End condition: Explicit done == true
  • Duration: Can run 24+ hours
  • Agent count: 1 primary (can spin up sub-agents)
  • Communication: Main agent coordinates sub-agents
  • Cost profile: Predictable but can balloon with long loops

Workflow — Width Parallel

  • Execution model: Parallel batch
  • End condition: All agents report done
  • Duration: Bounded by longest single task
  • Agent count: Up to 100+ simultaneously
  • Communication: None between agents
  • Cost profile: High input tokens (each agent reads own context)

🔍 Workflow Internal Architecture

👤 User prompt
📝 JS script created
🤖 Agent 1
|
🤖 Agent 2
|
🤖 ...N
🤖 Agent 1
|
🤖 Agent 2
|
🤖 ...N
🔄 Results merged
👤 Back to main session
Each agent is a full Claude call with its own context window. This is why input tokens add up fast — even with Haiku models.

💰 Real Cost: Skill Audit Case

Actual Data Nate Herk's Skill Audit
41
Haiku agents
1
Opus synthesis
~5M
input tokens
30+
minutes
~$100
half of $200/mo
One workflow prompt burned through half of a $200/month subscription. Budget carefully!

💸 Cost Drivers

DriverWhy It CostsMitigation
Number of agents Each agent = 1 full Claude API call Only use workflow when truly parallelizable
Context size per agent Each agent reads its own context window Minimize shared context; keep agent prompts lean
Model tier Opus >> Sonnet >> Haiku in cost Use Haiku for workers, Opus only for synthesis
Duration Agents run concurrently but time still adds up Bound scope tightly, name deliverables explicitly
Input >> Output Most tokens are input (context reads) Output-heavy is more expensive per token

✅ Cost-Saving Strategies

📊 Model Cost Tiers (relative)

ModelRelative CostUse Case in Workflow
Haiku $ Worker agents (scoring, analysis)
Sonnet $$ Intermediate synthesis
Opus $$$ Final synthesis, high-reasoning tasks
Ultra Code MAX Every prompt = workflow (very expensive!)

✅ Good Fit for Workflows

If the task can be split into N independent pieces that can run simultaneously, workflow is a fit.

❌ Bad Fit for Workflows

If a simple skill or sub-agent would do the job, adding a workflow just burns money.

🔧 /deep research — Built-in Workflow

Slash deep research is a built-in workflow that:

If you're doing research and want to build your own deep research skills, test /deep first to see how the built-in workflow works.

🚀 Ultra Code Mode

Unless you need this level of orchestration constantly, use lower effort levels to control costs.

📋 The Skill Audit — Step by Step

Nate's actual workflow invocation prompt:

"Run a workflow that audits all of my Claude Code skills in two places: my user-level global skills and this project skills. Grade each on: Clarity, Front matter pass-fail, Trigger quality, and give me the single highest value fix. One final agent ranks every skill worst to best..."

⚙️ What Happened Internally

1
Claude asks permission
"Can you let me run a dynamic workflow to do this?"
2
User approves
Click "Yes, run it" — or view raw JS script first
3
41 Haiku agents spin up in parallel
Each scores one skill. All running simultaneously via JS script.
4
Opus synthesis agent receives all results
Ranks skills worst to best, generates HTML report with fixes
5
Output: HTML file saved to .claude/workflows/
Reusable — run again anytime by pointing at the workflow

👀 What You Can Monitor

🤖
Agent count
All 41 visible
🧠
Model used
Haiku per worker
📊
Tokens used
Per agent shown
⏱️
Duration
Running time
🛠️
Tools used
Per agent
Workflows may save to global ~/.claude/workflows/ by default. Specify your project path explicitly if you want project-level storage.

📁 Output Format

Nate's skill audit output was an HTML file containing:

To re-run: /workflows → select the saved workflow → "run again". No need to rebuild the prompt.

🌳 Which Tool Should I Use?

Do you need immediate answers? → Just ask Claude
Is this a repeatable task you run often? → Use a Skill
Is it a messy one-off side task? → Use a Sub-agent
Do you need multiple agents to debate or collaborate? → Use Agent Team
Should it keep looping until a specific criteria is met? → Use /goal
Can the task be split into N independent parallel pieces? → Use Dynamic Workflow
Skills = HOW · Sub-agents = CLEAN SIDETASKS · Agent Teams = CREWS · /goal = LOOPS · Workflows = PARALLEL JOBS

🎯 The Parallelism Test

Ask yourself:

"Does this break into many pieces that can run individually of each other at the same time?"

If YES → Dynamic Workflow is appropriate
If NO → Consider /goal, skill, or sub-agent

⚡ Invocation Tips

Ultra Code mode will bypass many permission checks automatically. Be extra careful about cost.

🔗 Combination Play

Advanced users can nest these:

/goal (loop)
Workflow (parallel)
Haiku agents
Opus synthesis
This level of autonomy is very powerful but very expensive. Use only when the value justifies the cost.

Dynamic Workflow

Claude Code feature (Opus 4.8+). Claude writes a JavaScript script that orchestrates many agents in parallel, merging results at the end. Width-first, not loop-based.

Skill

A reusable recipe for a task. Can be run by main session, sub-agents, agent teams, or workflows. Defines the "how."

Sub-agent

A parallel agent isolated from the main session context. Cannot talk to other sub-agents — only reports back to main session.

Agent Team

A small crew of agents that can talk to each other, share a task list, and have individual roles/tools. Good for debates, councils, collaborative problem-solving.

/goal

A Claude Code command that loops until done==true. Depth-first, iterative. Can run 24+ hours. Can spin up sub-agents. Good for: keep refining until criteria met.

Slash Deep Research (/deep)

Built-in workflow that spins up parallel research agents, has them vote on claims, and outputs a cited deep research report.

Ultra Code

Highest intelligence mode. Uses X-high reasoning + defaults every prompt to a workflow. Most expensive mode. Bypasses many permission checks.

Workflow Script

JavaScript file generated by Claude when a workflow runs. Saved to .claude/workflows/. Can be reviewed, reused, and re-run later.

Context Window

Each agent (sub-agent or workflow worker) has its own isolated context window. This is why input tokens multiply — every agent re-reads shared data.

Synthesis Agent

The final agent in a workflow that collects all parallel agent results and produces the unified output. Often Opus-tier for complex synthesis.

Width-first vs Depth-first

Width-first = many agents in parallel, results merged at end (workflow). Depth-first = one agent looping until done=true (/goal).

Cost-per-Agent

Each agent in a workflow = 1 full Claude API call with its own context. 100 agents = 100x the context reads = massive input token accumulation.