Skip to main content

CLAUDE CODE

DYNAMIC WORKFLOWS v2.1.154+

Orchestrate dozens to hundreds of subagents from a script Claude writes — plus 24 copy-paste workflow scripts the docs don't give you.

Official docs Launch announcement Updated

What is a Claude Code dynamic workflow?

A dynamic workflow is a JavaScript script that orchestrates subagents at scale. You describe a task, Claude writes the script, and a runtime executes it in the background — spawning dozens to hundreds of agents — while your session stays responsive. The script holds the loop, the branching, and the intermediate results, so only the final answer reaches Claude's context window.

Reach for one when a task needs more agents than a single conversation can coordinate, or when you want the orchestration codified as a script you can read and rerun: a codebase-wide bug sweep, a 500-file migration, or research that cross-checks its own sources. Below are 24 ready-to-run scripts you can copy, plus the full trigger, API, and runtime reference.

When to use a workflow

Subagents, skills, agent teams, and workflows can all run a multi-step task. The difference is who holds the plan — and a workflow moves it into code.

SubagentsSkillsAgent teamsWorkflows
What it isA worker Claude spawnsInstructions Claude followsA lead supervising peersA script the runtime executes
Who decides what runs nextClaude, turn by turnClaude, per the promptThe lead agent, turn by turnThe script
Where results liveClaude's contextClaude's contextA shared task listScript variables
What's repeatableThe worker definitionThe instructionsThe team definitionThe orchestration itself
ScaleA few per turnSame as subagentsA handful of peersDozens to hundreds per run
InterruptionRestarts the turnRestarts the turnTeammates keep runningResumable in the session

A workflow can also apply a repeatable quality pattern — independent agents adversarially reviewing each other's findings, or a plan drafted from several angles and weighed against each other — for a more trustworthy result than a single pass.

How to trigger a workflow

The ultracode keyword

Put the keyword ultracode in any prompt to run that single task as a workflow without changing the session effort level. Asking in your own words ("use a workflow") works too.

Ultracode effort mode

Set /effort ultracode to combine xhigh reasoning with automatic workflow orchestration — Claude then plans a workflow for every substantial task. Lasts the session; drop back with /effort high.

Bundled /deep-research

The built-in workflow: fans out web searches, cross-checks sources, votes on each claim, and returns a cited report with unsupported claims filtered out. Needs the WebSearch tool.

Saved workflows

After a run does what you want, open /workflows, select it, and press s to save its script as a command. It then runs as /<name> in future sessions and accepts input via args.

Workflow recipe library 24

24 of 24

Codebase-wide bug sweep

Audit & Security Loop-until-dry + adversarial verify

Repeatedly fan out finders across the repo, dedupe against everything seen, then have independent skeptics try to refute each bug before it is reported.

When: You suspect latent bugs but have no single entry point. Keeps spawning finders until two consecutive rounds turn up nothing new.

What you type
#bugs#verify#loop-until-dry#parallel

Security & hardening pass

Audit & Security Dimension fan-out + verify pipeline

One agent per OWASP-style dimension reviews the codebase; each finding is verified by a focused skeptic as soon as its review lands — no barrier between stages.

When: Pre-release hardening or a periodic security review across an entire service or repo.

What you type
#security#owasp#pipeline#verify

Missing auth-check audit

Audit & Security Discover sites → check each

Scout every route handler first, then check each one for an authorization guard in parallel. The official docs use this exact shape as the canonical ultracode example.

When: Confirming every endpoint under a routes directory enforces auth before a release.

What you type
#auth#routes#pipeline

Dependency risk audit

Audit & Security Per-package fan-out

List direct dependencies, then in parallel assess each for known CVEs, maintenance health, and license risk, returning only the ones worth acting on.

When: Quarterly supply-chain review or vetting before adding a dependency-heavy feature.

What you type
#dependencies#supply-chain#cve#parallel

Accessibility audit

Audit & Security Per-page pipeline

Enumerate user-facing pages, audit each against WCAG criteria, then group violations by severity so you fix the blockers first.

When: Bringing a UI up to WCAG AA, or catching regressions across many templates at once.

What you type
#accessibility#wcag#frontend#pipeline

Framework migration (per-file, isolated)

Migrate & Refactor Pipeline + worktree isolation

Discover every file using the old API, then migrate and verify each in its own git worktree so parallel edits never collide.

When: Swapping a framework or library across hundreds of files where agents must edit concurrently.

What you type
#migration#worktree#pipeline#isolation

API deprecation rollout

Migrate & Refactor Call-site fan-out

Find every call site of a deprecated function, then rewrite each to the replacement in parallel, reporting any that need human judgment.

When: Removing a deprecated internal API and cleaning up all of its consumers in one pass.

What you type
#deprecation#codemod#parallel

Language / module port

Migrate & Refactor Per-module pipeline + test gate

Port each source module to the target language in isolation, then immediately run its tests so a failing port is flagged without blocking the others.

When: Large ports like the Bun Zig→Rust effort — module-by-module with a test gate per unit.

What you type
#port#tests#pipeline#worktree

Dead-code removal

Migrate & Refactor Find → verify-unused → remove

Find candidate dead exports, confirm each truly has zero references (including dynamic/string uses), then remove only the confirmed ones.

When: Shrinking a codebase safely — the verify step prevents deleting something used via reflection or a string key.

What you type
#cleanup#refactor#pipeline#verify

Project-wide safe rename

Migrate & Refactor Plan → apply per file

Plan a rename (including docs, tests, and config), then apply it file-by-file in isolated worktrees, skipping unrelated same-named symbols.

When: Renaming a widely-used symbol when a naive find-and-replace would clobber unrelated matches.

What you type
#rename#refactor#pipeline#worktree

Cross-checked deep research

Research & Planning Fan-out → cross-check → synthesize

Search a question from several angles, fetch and read the sources, vote on each claim, and synthesize a report with unsupported claims filtered out. This is the shape behind the bundled /deep-research.

When: Any research question where a single search pass is not trustworthy enough and sources must be checked against each other.

What you type
#research#web#verify#synthesis

Plan from competing angles (judge panel)

Research & Planning Judge panel

Draft a plan from several independent angles, score each with parallel judges, then synthesize a final plan from the winner while grafting the best ideas from the runners-up.

When: A hard design decision worth more than one pass before you commit — architecture, a rollout, a tricky refactor.

What you type
#planning#judge-panel#design#parallel

Codebase understanding map

Research & Planning Parallel readers → synthesis

Point one reader at each subsystem to summarize its responsibilities and key files, then merge the summaries into a single architecture map.

When: Onboarding to an unfamiliar repo, or producing an up-to-date architecture overview on demand.

What you type
#understand#architecture#parallel#onboarding

Incident root-cause analysis

Research & Planning Multi-modal sweep → synthesis

Investigate an incident from several blind angles at once — recent diffs, error logs, config changes, dependency bumps — then synthesize the most likely root cause.

When: A regression appeared and you want parallel lines of inquiry instead of one serial hunt.

What you type
#debugging#rca#multi-modal#parallel

Multi-dimension PR review

Review & QA Dimension pipeline + adversarial verify

Review the diff across dimensions (correctness, security, performance, tests), then have each finding adversarially verified before it is surfaced — the canonical review pattern.

When: A review you run on every branch. Save it and it runs the same orchestration each time.

What you type
#code-review#diff#pipeline#verify

Test-coverage gap finder

Review & QA Per-module fan-out

For each module, identify behaviors with no test, rank by blast radius, and propose the specific test cases that would close each gap.

When: Deciding where to invest test effort, or hardening a module before a risky change.

What you type
#tests#coverage#parallel

Docs-vs-code drift check

Review & QA Per-doc verify pipeline

Check each documentation page against the current code and flag statements that are now wrong — stale flags, renamed options, removed APIs.

When: Keeping a docs site or README honest after a release without re-reading everything by hand.

What you type
#docs#drift#pipeline#verify

Flaky-test hunt

Review & QA Scan → diagnose → propose fix

Scan CI history for tests that fail intermittently, diagnose the cause of each (timing, shared state, ordering), and propose a fix.

When: A flaky suite eroding trust in CI — turn the noise into a ranked, actionable list.

What you type
#tests#flaky#ci#pipeline

Docstring / JSDoc backfill

Generate & Document Per-file fan-out (worktree)

Find public functions lacking documentation and write accurate doc comments for each in an isolated worktree so parallel writes never conflict.

When: Bringing an under-documented public API up to standard in one pass.

What you type
#docs#jsdoc#parallel#worktree

Test generation for a module

Generate & Document Plan cases → write → verify

Enumerate the test cases a module needs, write each as a test, then run the suite to confirm the new tests pass and actually exercise the code.

When: Backfilling tests for a critical module before you refactor it.

What you type
#tests#generation#pipeline

Changelog / release notes builder

Generate & Document Per-commit classify → group

Classify each commit since the last release by type and audience impact, drop the noise, and group the rest into human-readable release notes.

When: Turning a messy commit range into clean release notes without hand-curating every line.

What you type
#changelog#release#parallel

Onboarding guide generator

Generate & Document Parallel readers → synthesis

Have agents read setup, architecture, conventions, and the dev loop in parallel, then synthesize a single onboarding doc a new engineer can follow start to finish.

When: Producing a "day one" guide for a repo that has none, grounded in what the code actually does.

What you type
#docs#onboarding#parallel#synthesis

i18n string extraction

Generate & Document Per-file extract + key proposal

Find hardcoded user-facing strings across the UI and, for each, propose a stable translation key and the catalog entry to add.

When: Preparing an app for localization without manually combing every component.

What you type
#i18n#extraction#parallel

Budget-scaled exhaustive audit

Generate & Document Loop-until-budget

Keep spawning audit rounds until the token budget you set with a "+Nk" directive is nearly spent — depth scales to what you are willing to pay for.

When: You explicitly want maximum coverage and have set a token target for the turn; the script self-paces to fill it.

What you type
#budget#loop-until-budget#scale

Script API reference

The hooks available inside a workflow script. Default to pipeline() — it runs each item through every stage with no barrier between stages. Reach for parallel() only when a stage genuinely needs all prior results at once.

agent()agent(prompt, { schema?, label?, phase?, model?, isolation?, agentType? }) → Promise

Spawn one subagent. With a JSON-schema, it returns a validated object; without, its final text. Returns null if it is skipped or dies.

pipeline()pipeline(items, stage1, stage2, ...) → Promise<any[]>

Run each item through every stage independently — NO barrier between stages. The default for multi-stage work. A throwing stage drops that item to null.

parallel()parallel(thunks) → Promise<any[]>

Run thunks concurrently and await all of them — a barrier. A failing thunk resolves to null, so filter(Boolean) before use. Reach for it only when you need all results together.

phase()phase(title)

Start a new progress group; later agent() calls are shown under it in /workflows.

log()log(message)

Emit a progress line to the user above the progress tree.

argsargs: any

The input passed to a saved workflow, verbatim. undefined if none. Read it for a question, target paths, or a config object.

budgetbudget: { total, spent(), remaining() }

The turn token target from a "+Nk" directive. total is null if unset; remaining() is Infinity then. The target is a hard ceiling — agent() throws once it is hit.

workflow()workflow(nameOrRef, args?) → Promise

Run another saved workflow inline as a sub-step. Nesting is one level deep.

Running & managing workflows

/workflows keys
↑ / ↓Select a phase or agent
Enter / →Drill into a phase, then an agent, to read its prompt, tool calls, and result
EscBack out one level
j / kScroll within an agent detail when it overflows
pPause or resume the run
xStop the selected agent, or the whole workflow when focus is on the run
rRestart the selected running agent
sSave the run as a /<name> command
Behavior & limits
16 concurrent agents
Fewer on machines with limited CPU cores. Excess calls queue and run as slots free up.
1,000 agents per run
A backstop against runaway loops, far above any real workflow.
No mid-run input
Only agent permission prompts pause a run. For sign-off between stages, run each stage as its own workflow.
No direct FS / shell
The script coordinates agents; agents read, write, and run commands.
Resumable in-session only
Completed agents return cached results. Exiting Claude Code restarts the workflow fresh next session.
Requires v2.1.154+
On all paid plans, Anthropic API, Amazon Bedrock, Vertex AI, and Microsoft Foundry. On Pro, enable it from the Dynamic workflows row in /config.
Enable / disable
/config
Toggle the Dynamic workflows row. Persists across sessions.
"disableWorkflows": true
Set in ~/.claude/settings.json (or managed settings for a whole org) to turn workflows off.
CLAUDE_CODE_DISABLE_WORKFLOWS=1
Environment variable read at startup; applies wherever you set it.
Ultracode keyword trigger
Turn off in /config to stop the ultracode keyword from triggering runs.

Frequently asked questions

What is a dynamic workflow in Claude Code?

A dynamic workflow is a JavaScript script that orchestrates subagents at scale. Claude writes the script for the task you describe, and a runtime runs it in the background — spawning dozens to hundreds of agents — while your session stays responsive. The script holds the loop, branching, and intermediate results, so only the final answer lands in Claude's context.

How do I start a dynamic workflow?

Include the keyword ultracode in your prompt (or just ask for "a workflow"), and Claude writes a workflow for that task. Or set /effort ultracode so Claude plans a workflow for every substantial task in the session. You can also run the bundled /deep-research, or any workflow you have saved.

What is ultracode?

Ultracode is a Claude Code setting that combines xhigh reasoning effort with automatic workflow orchestration. With it on, Claude decides when a task warrants a workflow and a single request can become several workflows in a row. It lasts for the session and resets when you start a new one.

When should I use a workflow instead of subagents or a skill?

Reach for a workflow when a task needs more agents than one conversation can coordinate, or when you want the orchestration codified as a repeatable script — codebase-wide audits, large migrations, and research that must cross-check its sources. With subagents, skills, and agent teams, Claude orchestrates turn by turn; a workflow moves the plan into code.

How much do dynamic workflows cost?

A workflow spawns many agents, so one run can use meaningfully more tokens than the same task in conversation. Runs count toward your plan usage and rate limits. To gauge spend, run on a small slice first — one directory, or a narrow question — and watch per-agent token usage in /workflows.

Can I save and reuse a workflow?

Yes. After a run does what you want, open /workflows, select it, and press s to save its script to .claude/workflows/ (shared in the repo) or ~/.claude/workflows/ (just you). It then runs as a /<name> command and can accept input through args.

Can a workflow resume if I interrupt it?

Within the same session, yes — agents that already finished return their cached results and the rest run live. Resume from /workflows with p, or ask Claude to relaunch the same script. Exiting Claude Code while a run is going starts it fresh next session.

What are the limits on a dynamic workflow?

Up to 16 concurrent agents (fewer on limited CPUs) and 1,000 agents total per run. The script itself has no direct filesystem or shell access — agents do that work. There is no mid-run user input beyond agent permission prompts; for sign-off between stages, run each stage as its own workflow.

Reference generated from the official Claude Code workflows docs and the launch announcement. Recipes are starting points — Claude writes the actual script for your task. Last updated 2026-06-12.
WebMCP Developers