Home › Rules › Claude Code workflows
Claude Code workflows: /deep-research, running and saving dynamic workflows, and what they cost
Short answer: a Claude Code dynamic workflow is a JavaScript file, written by Claude, that coordinates many subagents in parallel in the background, while your session stays free. The script holds the plan and the in-between results, so only the final answer comes back into your chat. Try one with the built-in /deep-research, start your own by typing ultracode or "use a workflow" in a prompt, watch it with /workflows, and press s there to save a run as your own /command. Anthropic's warning: "a single run can use meaningfully more tokens than working through the same task in conversation." So try a small slice first.
Which "workflow" do you mean?
Three things in Claude Code are called workflows:
- Dynamic workflows (this page): the scripted, many-agent runs started with
/deep-research,ultracodeor a saved/name. Their files live in.claude/workflows/. - Common workflows: Anthropic's page of everyday recipes. Advice, not a feature.
- GitHub Actions workflows: the YAML files in
.github/workflows/that run Claude Code in CI. See our Claude Code review guide for those.
Dynamic workflows are on every paid plan, with Anthropic API access, and on Amazon Bedrock, Google Cloud's Agent Platform and Microsoft Foundry. On the Pro plan they're off until you turn on the Dynamic workflows row in /config.
Start with /deep-research
/deep-research is the one workflow that ships with Claude Code. Give it a question and it searches the web from several angles, fetches and cross-checks the sources, votes on each claim, and hands back one report with citations. Claims that didn't hold up are already filtered out. Claims its checkers couldn't verify (after a rate limit, say) are marked unverified, not wrong. It needs the WebSearch tool.
- Type
/deep-researchand your question, for example/deep-research what changed in the Node.js permission model between v20 and v22?(Anthropic's example). - Claude Code asks whether to allow the workflow. Pick Yes.
- It runs in the background. Type
/workflowsto watch it. - The report shows up in your session when it's done.
/deep-research <question> # the bundled research workflow
/workflows # list runs, open one to watch, pause, stop or save it
/effort ultracode # Claude plans a workflow for each big task (this session)
/effort ultracode off # back to normal
/config workflowSizeGuideline=small
/workflow-authoring # load the script reference before you edit a saved workflow
/reload-skills # re-read the workflow folders after an edit
claude --effort ultracode # start a session at xhigh with ultracode on
Free rules starter pack for Cursor, Claude Code, Codex and Antigravity
One shared AGENTS.md that works across Cursor, Claude Code, Codex, Copilot and Antigravity, plus database and test rules in each tool's format. Unzip it into your project and fill in two sections. I'll email you the link.
Free. No spam. Unsubscribe anytime. See our privacy note.
The /workflows screen
Arrow keys and Enter open a phase or an agent (its prompt, tool calls and result), and Esc backs out. p pauses or resumes, x stops the selected agent or the whole run, r restarts a running agent, f filters by status, and s saves the run as a command. It also shows each agent's token use as it goes.
Three ways to start your own workflow
- One task: put the word
ultracodein your prompt, or just say "use a workflow". Claude writes a script for that task instead of working through it turn by turn, and your effort level doesn't change. Claude Code highlights the keyword; if you didn't mean it, Alt+W dismisses it (Option+W on macOS), or Backspace right after the word. - Every big task:
/effort ultracodehas Claude decide when a task needs a workflow for the rest of the session. One request can turn into several workflows in a row (understand, change, verify). The details, and how it fits with effort levels, are on our Claude Code effort levels page. - A saved one:
/deep-researchor any workflow you've saved runs as/name.
The keyword only counts in a prompt you type yourself, not in a claude -p prompt, a scheduled task, or a webhook or pull request comment passed into the chat. To type the word without starting anything, turn off Ultracode keyword trigger in /config (the workflowKeywordTriggerEnabled setting).
Anthropic's example prompts show the shapes that fit: audit many files for one problem, fix until a check passes, migrate many files in parallel, review every changed file into one summary, and research across many sources. Three of ours in the same style:
ultracode: check every page under src/pages/ for images with no alt text, and verify each finding before reporting it
use a workflow to read every rules file in this repo (CLAUDE.md, AGENTS.md and .cursor/rules/) and list the instructions that contradict each other
use a workflow to run npm test and fix the failing test files one at a time, using a smaller model for the first pass, and stop when two rounds in a row make no progress
Approving a workflow before it runs
In the terminal, the approval prompt lists the planned phases and gives you Yes, run it, View raw script, No, and, for a bundled, saved or plugin workflow you ran by name, Yes, and don't ask again for that workflow in that project. Ctrl+G opens the script in your editor. Whether you see the prompt at all depends on your permission mode:
| Permission mode | When Claude Code asks |
|---|---|
| Manual, accept edits | Every run, unless you picked "don't ask again" for that saved workflow |
| Auto | The first launch only (any Yes is remembered in your user settings); never while ultracode is on |
| Bypass permissions | Never. The run starts right away |
claude -p, Agent SDK | Never shows the prompt. The launch goes through your normal permission rules instead |
So in a claude -p script, a workflow won't start unless something allows it: an allow rule (Workflow for all, or Workflow(name) for one saved workflow), auto or bypass mode, a PreToolUse hook that returns allow (not enough on its own in plan mode), or your host's approval. The Desktop app shows a card with the phases, a token-use caution and Once, Always or Deny.
Approving the workflow doesn't approve what its agents do. They follow your normal permission rules, so before a long run, allow the tools the agents need or the run can sit paused on a prompt.
Saving a workflow as your own command
When a run did what you wanted, open /workflows, pick the run and press s. Tab switches between two places to save it:
.claude/workflows/in your project: shared with everyone who clones the repo.~/.claude/workflows/in your home folder: in every project, only for you.
From then on it runs as /name and shows in / autocomplete next to /deep-research. A saved workflow can take input: "Run /triage-issues on issues 1024, 1025, and 1030" (Anthropic's example) passes the list to the script as a global named args.
- Name clash: if a project workflow and a personal one share a name, the project one runs. That's the opposite of skills, where your personal skill beats the project's.
- Monorepos: saving to the project writes to the closest
.claude/workflows/between where you are and the repo root, and the closest one wins on a name clash. - Plugins: a
workflows/folder in a plugin shares it across repos as/plugin-name:workflow-name.
What a saved workflow file looks like
You don't have to write these, but it helps to read one before you approve it. Here is our own small workflow in Anthropic's documented format: a meta block first, then plain JavaScript. agent() starts one subagent, pipeline() runs one per item in a list, phase() groups what follows under a title in the progress view, and log() prints a line above the phases.
export const meta = {
name: 'check-rules-files',
description: 'Check every CLAUDE.md and AGENTS.md for commands and paths that no longer exist',
}
const root = typeof args === 'string' ? args : '.'
phase('Find the files')
const found = await agent(`List every CLAUDE.md and AGENTS.md under ${root}. Skip node_modules.`, {
schema: { type: 'object', required: ['files'], properties: { files: { type: 'array', items: { type: 'string' } } } },
})
phase('Check each file')
const reports = await pipeline(found.files, file =>
agent(`Read ${file}. For each command it mentions, check it exists in package.json scripts or the Makefile. For each file path, check it exists. List only the wrong ones with their line. Don't edit any files.`, { label: file }),
)
phase('One list')
log(`Checked ${found.files.length} files`)
const summary = await agent(`Merge these findings into one list, most serious first, and drop duplicates:\n\n${reports.filter(Boolean).join('\n\n')}`)
return summary
What it does: one agent lists the rules files, one agent per file checks its commands and paths, and a last agent merges the findings. Run it as /check-rules-files (or add a folder name; if Claude doesn't pass it as plain text, the script checks the whole repo). The schema makes the first agent return JSON. .filter(Boolean) drops the empty results from agents that were stopped, hit an API error or stalled every time.
The rules Claude Code enforces on these files:
- Keep
export const metathe first statement, with plain values only. A variable or function call in it removes/namefrom autocomplete. Date.now(),Math.random()andnew Date()throw inside the script, so a resumed run repeats the same agents. Pass a date in throughargsinstead.- No
import(), and the script itself can't touch files or run commands. The agents do that work. - Before you edit a saved script, run
/workflow-authoring(Claude Code v2.1.248 or later) so Claude has the script reference, then/reload-skillsand run/nameagain.
And a settings file to go with it:
{
"workflowSizeGuideline": "small",
"permissions": {
"allow": ["Workflow(check-rules-files)"]
}
}
"small" asks Claude for fewer than 5 agents per workflow. The allow rule lets only our saved workflow start in claude -p and Agent SDK runs.
Workflows vs skills vs subagents vs agent teams vs hooks
The first four columns are Anthropic's own comparison, shortened. We added the hooks column from Anthropic's Hooks guide because people mix them up too ("n/a" where the docs don't say).
| Workflows | Skills | Subagents | Agent teams | Hooks (ours) | |
|---|---|---|---|---|---|
| What it is | A script the runtime runs | Instructions Claude follows | A worker Claude starts | A lead agent running other sessions | Your shell command at set points |
| Who decides the next step | The script | Claude, following the skill | Claude, turn by turn | The lead agent | Nobody: it always runs when its event fires |
| Where results go | Script variables; only the answer reaches your chat | Your chat's context | Your chat's context | A shared task list | n/a |
| Scale | Dozens to hundreds of agents | Same as subagents | A few per turn | A handful of long-running peers | n/a |
| If interrupted | Can resume in the same session | Restarts the turn | Restarts the turn | Teammates keep going | n/a |
| Use it for | Audits, migrations, cross-checked research | A procedure you keep pasting | A side job that would flood your chat | Splitting a project across workers | Things that must happen every time: format, block, notify |
Workflows vs skills in one line: a skill tells Claude how to do a job and Claude stays in charge; a workflow moves the plan into code so many agents can run it and check each other. Anthropic says you can point Claude at a skill that fans work out and ask for a workflow that does the same. Copy-paste starting points: Claude Code skills examples, subagents examples and hooks examples. Agent teams are experimental and off by default; how to turn them on and what they cost: Claude Code agent teams. Background sessions, agent view and worktrees: Claude Code multi-agent setup.
Matching kit: MVP Spec-to-Build Pack ($7)
The free rules set the boundaries. The MVP pack gives you the build order: a 1-page spec to fill in first, then 7 prompts in sequence (skeleton, review, login, database, security, one feature at a time, polish), plus a "did I leak user data?" checklist.
See the MVP Spec-to-Build Pack ($7) →
Instant download. 7-day refund, no questions asked.
What workflows cost, in Anthropic's words
"A workflow spawns many agents, so a single run can use meaningfully more tokens than working through the same task in conversation. Runs count toward your plan's usage and rate limits." Every agent sends its own requests on top of your main chat. What the docs suggest:
- Try a small slice first: one folder instead of the whole repo, or a narrow question instead of a broad one.
- Watch it:
/workflowsshows each agent's tokens as it runs, and you can stop the run there, usually without losing finished work. - Check
/modelbefore a big run, because workflow agents run on your session's model unless something else sets one. Ask Claude to use a smaller model for stages that don't need the strongest one.CLAUDE_CODE_SUBAGENT_MODELalso sets the default for workflow agents. Prices: Claude Code models. - Pick a size guideline (table below). It's advice to Claude, not a hard cap.
| workflowSizeGuideline | Agents Claude aims for |
|---|---|
small | Fewer than 5. The default on Pro (Claude Code v2.1.271 or later) |
medium | Fewer than 10. The default on other plans |
large | Fewer than 50 |
unrestricted | No guideline; Claude sizes it to the task |
Set it in /config or a settings file (the file wins). A run that plans more than 25 agents, or more than 1.5 million tokens, shows a Large workflow warning on its progress line; if you picked a size yourself, its agent count replaces the 25. The warning doesn't stop anything. Hard limits: 16 agents at once by default (CLAUDE_CODE_WORKFLOW_MAX_CONCURRENT_AGENTS, 1 to 256, v2.1.269 or later), 4,096 items per pipeline() or parallel() call, and 1,000 agents per run.
Hitting your limit mid-run: in an interactive terminal session on a claude.ai subscription without usage-based billing (v2.1.271 or later), the run pauses and carries on after the reset, if autoContinueAtUsageLimit is on, the reset is within 24 hours and it hasn't already waited twice. Otherwise, as in claude -p, the agents fail; ask Claude to relaunch after the reset.
Workflows, effort and ultracode
Turn workflows off and ultracode goes too; it also needs a model with xhigh effort. While it's on, the Large workflow warning doesn't show, the session's 20-subagent limit isn't enforced, and auto mode skips the first-launch approval. Anthropic says a session with it on "reaches a session or weekly limit sooner than the same work with it off", so use /effort ultracode off when you're back to small jobs. Workflow agents with the same model, effort level, agent type, tools, output schema and folder can share a prompt cache. Every level and setting is on Claude Code effort levels.
Stopping, pausing and resuming
Press p in /workflows to pause and again to resume. For a stopped run, ask Claude to relaunch the workflow with the same script. Finished agents return saved results, but a failed agent reruns along with every agent started after it, and stopping one agent with x counts as failing. If you exit Claude Code mid-run, the run doesn't continue by itself: resume the session with claude --resume and ask Claude to relaunch it. In a fresh session Claude has no earlier run, so it starts over. If a relaunch fails with nothing to resume, ask Claude to start the workflow over as a new run.
Turning workflows off
For yourself: switch off Dynamic workflows in /config, or set CLAUDE_CODE_DISABLE_WORKFLOWS=1. For a whole company: "disableWorkflows": true in managed settings or the toggle on the Claude Code admin settings page. With them off, /workflows, workflow commands and /workflow-authoring disappear, the keyword stops working, and ultracode leaves the /effort slider. A run already going keeps going.
Workflow problems: 8 things to check
/workflowsor/deep-researchisn't there. On Pro, turn on Dynamic workflows in/config; otherwise a setting, the environment variable or your admin turned them off.disableBundledSkills(orCLAUDE_CODE_DISABLE_BUNDLED_SKILLS=1) also removes the bundled workflows, andclaude --safe-modeloads no workflows./deep-researchcan't search. It needs the WebSearch tool to be available in your session.- You typed
ultracodeand nothing happened. The prompt came throughclaude -p, a scheduled task or a webhook, or the keyword trigger is off in/config. - A workflow started that you didn't want. Alt+W (Option+W) dismisses the keyword before you send; at the prompt pick No; once running,
xin/workflowsstops it. - Your saved workflow isn't in
/autocomplete.metaisn't the first statement or holds something other than plain values. Fix it and run/reload-skills. A workflow namedanthropic-skills(or inside that namespace) never loads; that name is reserved. - The script throws right away. It calls
Date.now(),Math.random()ornew Date(), or has animport(). Pass values in throughargsand move library work into an agent's task. - A
claude -prun never starts its workflow, or a long run sits waiting. Add aWorkfloworWorkflow(name)allow rule for the launch, and allow the tools the agents need before you start. - An agent shows
(retry 1)or fails with "stalled on all 6 attempts". Give it more time withstallMson thatagent()call, orCLAUDE_ASYNC_AGENT_STALL_TIMEOUT_MSfor all. "Lost its reply on all 6 attempts" is a different timeout:CLAUDE_STREAM_IDLE_TIMEOUT_MS.
Where Anthropic's own pages don't agree
- Turning workflows off for yourself. The Workflows page says to set
"disableWorkflows": truein~/.claude/settings.json. The Settings reference saysdisableWorkflowsis for everyone your settings reach, such as a company, and that for yourself you should useenableWorkflows, which is what the/configtoggle writes. Both turn them off, butenableWorkflows: truecan't undodisableWorkflows, so on your own machine the/configtoggle is easier to undo. - A model setting for workflow agents only. The changelog for v2.1.296 says it added
CLAUDE_CODE_WORKFLOW_SUBAGENT_MODEL"to run every workflow agent on one model while other subagents keep theirs". Neither the Environment variables page nor the Workflows page lists it today. The documented routes are asking Claude for a smaller model per stage, orCLAUDE_CODE_SUBAGENT_MODEL, which covers subagents, teammates and workflow agents together. - A skill called deep-research. The Skills page's research example is a skill named
deep-research, the same name as the bundled/deep-researchworkflow. Its same-name table doesn't cover bundled workflows, so neither page says which runs. If you copy it, rename it, likecode-research.
Related setups
Workflows sit on top of the rest of a Claude Code setup. Put your project rules in CLAUDE.md, save step-by-step jobs as skills, hand off single side jobs with subagents, pick the model on Claude Code models, and set how hard Claude thinks on effort levels. Need a starting rules file? The free rules generator writes one.
Next step for Claude Code: Agent Skills
Skills are folders your AI coding agent loads only when the job comes up, and Claude Code, Cursor and OpenAI Codex all read the same SKILL.md format. The Vibe Coder Skills Pack ($9) is 6 ready-to-copy SKILL.md skills (fix-one-bug, stop-the-loop, leak-check, ship-check, explain-project, builder-handoff) for Claude Code, Cursor and OpenAI Codex. Also included in the 6-kit bundle.
Get the Skills Pack for $9 on Gumroad → See what's inside
One .zip of skill folders plus one markdown file. 7-day refund, no questions asked.
Best value
All 6 kits for $29 — or $20.30 with code WELCOME30 (through Nov 30)
A workflow runs many agents on a plan Claude writes for one job. The kits give your AI the plan for a whole project, step by step: a small game, a Discord bot, an email-triage agent, an MVP, or a cleanup of messy code.
Get all 6 kits for $29 → See what's in each kit
$29 instead of $48 for the six kits bought separately; WELCOME30 takes 30% off that at checkout ($20.30). Instant download from Gumroad. 7-day refund, no questions asked.
Related
- Claude Code effort levels (low to max, ultrathink vs ultracode)
- Claude Code skills examples (7 copy-paste SKILL.md files)
- Claude Code subagents examples (7 copy-paste subagents)
- Claude Code agent teams (turn them on, cost, teams vs subagents, tmux)
- Claude Code multi-agent setup (subagents vs agent view vs teams vs workflows, worktrees)
- Claude Code hooks examples (7 copy-paste hooks)
- Claude Code models (full list, aliases, /model, opusplan, effort)
- Claude Code advisor (/advisor, which model can advise which, cost)
- Claude Pro vs Max vs Ultra (which plan for Claude Code)
- CLAUDE.md examples (copy-paste template)
- Free rules file generator
Sources
- Claude Code docs: Orchestrate subagents at scale with dynamic workflows
- Claude Code docs: Run agents in parallel
- Claude Code docs: Extend Claude with skills
- Claude Code docs: Create custom subagents (concurrent subagent limit)
- Claude Code docs: Commands (/deep-research, /workflows, /workflow-authoring)
- Claude Code docs: Manage costs effectively
- Claude Code docs: Settings reference (disableWorkflows, enableWorkflows, workflowSizeGuideline, ultracode)
- Claude Code docs: Environment variables
- Claude Code docs: Model configuration (ultracode)
- Claude Code docs: Automate actions with hooks
- Claude Code docs: CLI reference (--effort ultracode, --safe-mode)
- Claude Code docs: Changelog (v2.1.296)
Every command, setting, limit and version number here was checked Nov 13, 2026 on Anthropic's own Claude Code docs. Workflows change often (Claude Code ships new versions most days), so run claude --version and check the Workflows page if something looks different. If something here no longer matches, tell us at [email protected].