Claude Code's Dynamic Workflow can orchestrate dozens to hundreds of subagents working in parallel. It is highly powerful, but there are a few pitfalls you need to be aware of in advance.
Table of Contents
- What is Dynamic Workflow
- Enabling and Disabling
- Trigger Methods
- Keyword Highlighting and Cancellation
- Permission Configuration
- Cost and Token Consumption
- Ultracode Mode
- Managing Runs: /workflows
- Saving as Reusable Commands
- Resumption and Limitations
- Complete Cheat Sheet
What is Dynamic Workflow
A Dynamic Workflow is a JavaScript script written by Claude that orchestrates multiple subagents in the background to execute tasks during runtime.
| Comparison | Subagent | Skill | Workflow |
|---|---|---|---|
| Orchestrator | Claude decides turn-by-turn | Claude follows instructions | Script decides |
| Intermediate result storage | Claude's context | Claude's context | Script variables |
| Scale | A few | A few | Dozens to hundreds of agents |
| Interruptible/Resumable | No | No | Resumable within the same session |
| Reproducible | No | Instructions are reproducible | Script is reproducible + can be saved as a command |
✅ Suitable Scenarios: Large-scale code audits, 500-file migrations, multi-source cross-validation research, multi-perspective solution comparisons.
❌ Unsuitable Scenarios: Simple Q&A, a few subtasks (use subagents directly), repetitive operations with fixed instructions (use skills).
Enabling and Disabling
Checking the Status
/config # Open the configuration interface to check the Dynamic Workflows status
Disabling Methods (Choose One)
| Method | Persistence | Action |
|---|---|---|
/config Toggle |
Persistent | Open config → Disable Dynamic Workflows |
settings.json |
Persistent | Set "disableWorkflows": true |
| Environment Variable | Per startup | CLAUDE_CODE_DISABLE_WORKFLOWS=1 |
Re-enabling
Simply reverse the operation. Once disabled:
- Built-in commands like
/deep-researchbecome unavailable. - The
workflowkeyword no longer triggers it. - The ultracode option is removed from the
/effortmenu.
Trigger Methods
Method 1: Keyword Trigger
Include the workflow keyword in your prompt:
Run a workflow to audit every API endpoint for missing auth checks
Claude Code will highlight the word workflow to indicate that the trigger intent has been recognized.
Method 2: Ultracode Automatic Trigger
By setting /effort ultracode, Claude automatically plans a workflow for every substantial task.
Method 3: Saved Commands
Saved workflows become /<name> commands that can be called directly. Built-in examples include /deep-research.
Keyword Highlighting and Cancellation
When your prompt contains workflow, Claude Code highlights the word, indicating that a dynamic workflow is about to be triggered.
How to Cancel the Trigger?
Press Alt+W to cancel the highlight, reverting the current prompt to normal conversation mode.
⚠️ Important: Some terminals intercept Alt key combinations and require additional configuration for
Alt+Wto work.
Terminal Configurations
🟣 Ghostty
Add the following to ~/.config/ghostty/config:
macos-option-as-alt = true
🔵 iTerm2
Preferences → Profiles → Keys → Left Option Key: Set to Esc+
🟢 Kitty
Generally supported by default. If not, add this to kitty.conf:
macos_option_as_alt yes
🟠 WezTerm
In the configuration:
config.keys = {
{ key = "w", mods = "ALT", action = wezterm.action.SendKey({ key = "w", mods = "ALT" }) },
}
Restart the terminal for the changes to take effect.
Permission Configuration
Core Rules
| Operation Type | Permission Behavior |
|---|---|
File Editing (Write/Edit) |
✅ Auto-approved (Subagents are fixed in acceptEdits mode) |
| Shell Commands | ⚠️ Will pause with a prompt if not in the allowlist |
| Web Search/Scraping | ⚠️ Will pause with a prompt if not in the allowlist |
| MCP Tool Calls | ⚠️ Will pause with a prompt if not in the allowlist |
Startup Confirmation (By Permission Mode)
| Permission Mode | Behavior |
|---|---|
Default / acceptEdits |
Prompts for confirmation before every startup, unless "don't ask again" was selected |
Auto |
Confirms only the first time; completely skipped under ultracode |
Bypass / claude -p |
Never prompts |
⚠️ Prerequisites for Long Runs
Add required commands to the
allowlistin advance, otherwise the workflow will pause and get stuck on a prompt mid-execution!
Method 1: Tell Claude directly:
Allow git and npm commands without prompting
Method 2: Manually edit settings.json:
{
"permissions": {
"allow": [
"Bash(git *)",
"Bash(npm *)",
"WebSearch",
"WebFetch"
]
}
}
Configuration File Locations:
| File | Scope |
|---|---|
~/.claude/settings.json |
🌐 Global (All projects) |
.claude/settings.json |
👥 Project-level (Team shared, committed with the repo) |
.claude/settings.local.json |
👤 Project-level (Personal only, gitignored) |
Cost and Token Consumption
Cost Characteristics
- A single workflow spawns a large number of agents, consuming significantly more tokens than normal conversations.
- All agents use the current session's model by default.
- Counts towards plan usage and rate limits.
💰 Cost-Saving Tips
| Tip | Description |
|---|---|
| Check the Model | Confirm with /model before long runs; avoid using Opus for simple tasks. |
| Specify Smaller Models | When describing the task, state "use Haiku for simple phases." |
| Stop Early | Use /workflows → x to stop; completed work is not lost. |
| Use the Default Model | Use Sonnet for daily tasks, switch to Opus only for complex tasks. |
Model Cost Comparison (Rough Estimate)
Haiku < Sonnet < Opus
💰 Cheap 💰💰 Medium 💰💰💰 Expensive
You can specify different models for different phases within the workflow script:
agent('Simple classification task', { model: 'haiku' })
agent('Complex reasoning task', { model: 'opus' })
Ultracode Mode
What is it?
Ultracode =
xhighReasoning Depth + Automatic Workflow Orchestration
Enabling
/effort ultracode
Behavior
- Automatically plans a workflow for every substantial task.
- A single request may trigger multiple sequential workflows:
understand→design→implement→verify. - Skips startup confirmation under the
autopermission mode.
Trade-offs
- 🔴 Extremely high token consumption; each task may spawn dozens or hundreds of agents.
- 🟡 Longer execution time, but yields more comprehensive and reliable results.
- 🔵 Valid only for the current session.
Exiting
/effort high # Downgrade to normal high effort
/effort medium # Downgrade to medium effort
Suitability Guide
| Scenario | Recommendation |
|---|---|
| Large-scale code audits | ✅ ultracode |
| Complex refactoring requiring multi-perspective validation | ✅ ultracode |
| Research tasks requiring cross-verification | ✅ ultracode |
| Daily development, simple Q&A | ❌ Do not enable |
| Quick bug fixes | ❌ Do not enable |
Managing Runs: /workflows
/workflows
Opens the workflow management interface to view running and completed workflows.
⌨️ Operation Shortcuts
| Key | Function |
|---|---|
↑ / ↓ |
Select phase or agent |
Enter / → |
Drill down to view details (prompts, tool calls, results) |
Esc |
Return to the previous level |
j / k |
Scroll within details |
p |
⏸️ Pause / ▶️ Resume execution |
x |
🛑 Stop the selected agent or the entire workflow |
r |
🔄 Restart the selected running agent |
s |
💾 Save the script as a command |
Progress Information
Each phase displays:
- Number of agents
- Token consumption
- Elapsed time
Saving as Reusable Commands
How to Save
/workflows→ Select a satisfactory run- Press
s - Press
Tabto toggle the save location - Press
Enterto confirm
Save Locations
| Location | Path | Description |
|---|---|---|
| 📦 Project-level | .claude/workflows/ |
Team shared, committed with the repo |
| 👤 Personal-level | ~/.claude/workflows/ |
Available across all projects, personal only |
Usage
Once saved, it becomes a /<name> command:
/my-audit # Call directly
It appears in the / autocomplete list, alongside built-in commands (like /deep-research).
Priority
In case of a name collision, 📦 Project-level > 👤 Personal-level.
Resumption and Limitations
Resuming Execution
- Can be resumed within the same session after pausing.
- Completed agents return cached results and do not rerun.
- How to resume:
/workflows→p, or ask Claude to restart using the same script.
⚠️ Not Retained Across Sessions
Workflows are not retained after exiting Claude Code. They must be rerun in the next session. However, saved command scripts remain and can be re-executed.
Runtime Limitations
| Limitation | Value | Reason |
|---|---|---|
| Concurrent agent limit | min(16, CPU-2) | Resource control |
| Total agents per run | 1000 | Prevents infinite loops |
| In-script file system access | None | Only agents can read/write files |
| In-script shell access | None | Only agents can execute commands |
| User input during execution | None | Only permission prompts can pause execution |
Need Phase Sign-offs?
Break it down into multiple independent workflows, reviewing each upon completion before running the next.
Complete Cheat Sheet
# 🔄 Enable/Disable
/effort ultracode # Enable ultracode (xhigh + auto workflow)
/effort high # Exit ultracode
/config # Toggle Dynamic Workflows switch
# 🚀 Triggers
Include "workflow" in prompt # Keyword trigger
/<saved-name> # Call a saved command
/deep-research <question> # Built-in command
# 📋 Management
/workflows # Open management interface
Alt+W # Cancel keyword highlight (prevents workflow trigger)
# ⌨️ Interface Operations
p = Pause/Resume
x = Stop
s = Save as command
Enter = View details
Esc = Go back
# 🔐 Permissions
Say "allow git commands without prompting" → Claude updates the allowlist
Or manually edit the permissions.allow array in settings.json
# 💰 Cost Saving
/model # Check current model
Specify haiku for simple phases # In script: { model: 'haiku' }
/workflows → x # Promptly stop unnecessary runs
Compiled based on official Claude Code documentation, last updated: 2026-05-30