Claude Code guide in three levels, Beginner to Advanced: hands-on lessons with checked exercises, every volatile fact cited to its source. Independent community guide.
JavaScript agent-skillsagentic-codingai-agentsanthropicanthropic-claudebest-practicesclaudeclaude-aiclaude-codeclaude-code-guideclaude-code-hooksclaude-code-pluginsclaude-code-skillsclaude-code-tutorialclaude-code-workflowsguidelearn-claude-codemcpsubagentstutorial
docs: add dynamic workflows guide and a runnable workflow (#20)
Wesam Abousaid65b7d0f4a768
diff --git a/.claude/workflows/stale-docs-audit.js b/.claude/workflows/stale-docs-audit.jsnew file mode 100644index 0000000..d1890c9--- /dev/null+++ b/.claude/workflows/stale-docs-audit.js@@ -0,0 +1,101 @@+// Run with: /stale-docs-audit (audits this repo's default doc set)+// /stale-docs-audit on README.md docs/skills.md+//+// Shape: fan one reader agent per file, then have independent skeptics try to+// REFUTE each claim before it's reported. The refute-by-default framing is what+// keeps plausible-but-wrong findings out of the result.++export const meta = {+ name: 'stale-docs-audit',+ description: "Find version- or date-pinned claims in this repo's docs that no longer match official Claude Code documentation",+ phases: [+ { title: 'Scan', detail: 'one agent per file extracts pinned claims' },+ { title: 'Verify', detail: 'independent skeptics try to refute each claim' },+ ],+}++const DEFAULT_TARGETS = [+ 'README.md',+ 'docs/workflows.md',+ 'docs/agent-teams.md',+ 'docs/skills.md',+ 'docs/reference/changelog.md',+ 'docs/reference/commands.md',+ 'docs/reference/effort-levels.md',+ 'docs/reference/models.md',+ 'docs/reference/faq.md',+]++const targets = Array.isArray(args) && args.length ? args : DEFAULT_TARGETS++const CLAIMS_SCHEMA = {+ type: 'object',+ required: ['claims'],+ properties: {+ claims: {+ type: 'array',+ items: {+ type: 'object',+ required: ['claim', 'line'],+ properties: {+ claim: { type: 'string', description: 'The pinned claim, quoted from the file' },+ line: { type: 'integer', description: '1-indexed line the claim appears on' },+ },+ },+ },+ },+}++const VERDICT_SCHEMA = {+ type: 'object',+ required: ['stale', 'reason'],+ properties: {+ stale: { type: 'boolean', description: 'True only if the claim is provably wrong today' },+ reason: { type: 'string', description: 'What the current official docs say instead' },+ source: { type: 'string', description: 'URL that settles it' },+ correction: { type: 'string', description: 'Suggested replacement text' },+ },+}++phase('Scan')+log(`Auditing ${targets.length} file(s).`)++const results = await pipeline(+ targets,++ // Stage 1 — extract only claims that CAN go stale. Prose and opinion are noise here.+ (_, file) => agent(+ `Read ${file} in this repository. Extract every factual claim pinned to a version, ` ++ `date, price, numeric limit, command name, file path, or setting key — the kinds of ` ++ `claim that can silently go stale. Skip prose, opinion, mental models, and advice. ` ++ `Quote each claim verbatim and give its 1-indexed line number.`,+ { label: file, phase: 'Scan', schema: CLAIMS_SCHEMA },+ ),++ // Stage 2 — verify each claim from this file as soon as the file is scanned.+ // No barrier: file B is still scanning while file A's claims are being checked.+ (scan, file) => parallel(+ (scan?.claims ?? []).map(c => () =>+ agent(+ `Try to REFUTE this documentation claim from ${file}:\n\n"${c.claim}"\n\n` ++ `Check it against current official sources (code.claude.com/docs, ` ++ `platform.claude.com/docs, anthropic.com/news, the anthropics/claude-code CHANGELOG). ` ++ `Set stale:true ONLY if you can show it is wrong today and cite the source that ` ++ `settles it. If you cannot verify it either way, set stale:false — an unverified ` ++ `claim is not a stale claim, and a false report costs more than a missed one.`,+ { label: `${file}:${c.line}`, phase: 'Verify', schema: VERDICT_SCHEMA },+ ).then(v => ({ file, line: c.line, claim: c.claim, ...v })),+ ),+ ),+)++const checked = results.flat().filter(Boolean)+const stale = checked.filter(r => r.stale)++log(`${checked.length} claim(s) verified · ${stale.length} confirmed stale.`)++return {+ filesAudited: targets.length,+ claimsVerified: checked.length,+ stale: stale.sort((a, b) => a.file.localeCompare(b.file) || a.line - b.line),+}diff --git a/README.md b/README.mdindex c3c2a6d..a8bb527 100644--- a/README.md+++ b/README.md@@ -3,7 +3,7 @@**From first prompt to agent teams — one guide.**[](https://github.com/hesreallyhim/awesome-claude-code)-[](https://github.com/wesammustafa/Claude-Code-Everything-You-Need-to-Know/stargazers)+[](https://github.com/wesammustafa/Claude-Code-Everything-You-Need-to-Know)[](https://github.com/wesammustafa/Claude-Code-Everything-You-Need-to-Know/commits/main)[](LICENSE)@@ -24,22 +24,23 @@ npm install -g @anthropic-ai/claude-code|---|---|---|| 🚀 **New to Claude Code** | [Setup](#claude-code-setup) → [Prompt Engineering](#prompt-engineering-deep-dive) → [Your First Skill](#claude-skills) | ~15 min || ⚡ **Already using it, want depth** | [Skills](#claude-skills) · [Hooks](#hooks) · [MCP](#model-context-protocol-mcp) | ~30 min each |-| 🧠 **Building teams or automation** | [Agent Teams](#agent-teams-experimental) · [Workflows & automation](#beyond-one-terminal--the-2026-automation-surface) · [BMAD](#the-bmad-method--ai-agent-framework) | varies |+| 🧠 **Building teams or automation** | [Dynamic Workflows](#dynamic-workflows) · [Agent Teams](#agent-teams-experimental) · [BMAD](#the-bmad-method--ai-agent-framework) | varies |---## 🧠 When to use what-The four extension points in Claude Code, side by side:+The five extension points in Claude Code, side by side:| Tool | Use when… | Skip if… | Lives in ||---|---|---|---|| **[Skills](#claude-skills)** *(slash commands)* | You repeat the same prompt or workflow ≥3 times | One-off task | `.claude/commands/*.md` || **[Hooks](#hooks)** | You want code to run *automatically* on tool use, session start, etc. | You only want manual triggers | `.claude/settings.json` || **[Subagents](#ai-agents)** | A subtask is big enough to need its own isolated context | The task fits in your main session | `.claude/agents/*.md` |+| **[Workflows](#dynamic-workflows)** | The job needs more agents than one conversation can coordinate | A couple of subagents would do | `.claude/workflows/*.js` || **[MCP servers](#model-context-protocol-mcp)** | You need Claude to use *external* tools (browsers, DBs, APIs) | All your data is in local files | Configured per project |-> 💡 These four compose. Most polished workflows combine 2–3.+> 💡 These five compose. Most polished setups combine 2–3.---@@ -49,7 +50,7 @@ The four extension points in Claude Code, side by side:**Workflow extensions** — [Slash Commands](#claude-commands) · [Skills](#claude-skills) · [Hooks](#hooks)-**Multi-agent & integration** — [Subagents](#ai-agents) · [Agent Teams](#agent-teams-experimental) · [Workflows & automation](#beyond-one-terminal--the-2026-automation-surface) · [MCP](#model-context-protocol-mcp)+**Multi-agent & integration** — [Subagents](#ai-agents) · [Dynamic Workflows](#dynamic-workflows) · [Agent Teams](#agent-teams-experimental) · [Automation surface](#beyond-one-terminal--the-2026-automation-surface) · [MCP](#model-context-protocol-mcp)**Productivity & frameworks** — [Effort levels](#effort-levels) · [Fast Mode](#fast-mode) · [Super Claude](#super-claude-framework) · [BMAD Method](#the-bmad-method--ai-agent-framework)@@ -153,6 +154,7 @@ This repo's own [`.claude/`](.claude/) directory is a working example of a fully| [`.claude/agents/`](.claude/agents) | 5 specialized subagents (frontend, tech lead, PM, UX designer, code reviewer) || [`.claude/commands/`](.claude/commands) | 7 custom skills — `/pr`, `/review`, `/tdd`, `/test`, `/five`, `/ux`, `/todo`. Slash commands and Agent Skills are now one system — see [Skills](#claude-skills). || [`.claude/hooks/`](.claude/hooks) | Python hook scripts (`post_tool_use.py`, `notification.py`, `stop.py`, `subagent_stop.py`) — see [Hooks](#hooks) |+| [`.claude/workflows/`](.claude/workflows) | A runnable [dynamic workflow](#dynamic-workflows) — `/stale-docs-audit` fans agents across the docs and refutes its own findings |> 💡 **Next:** Once you're comfortable with the basics, jump to [Claude Skills](#claude-skills) to build reusable slash commands in 3 minutes.@@ -681,13 +683,50 @@ Dependencies:---+<a id="dynamic-workflows"></a>+### Dynamic Workflows++*~3 min read · [Full guide in `docs/workflows.md` →](docs/workflows.md)*++> **Mental model:** A dynamic workflow is a **JavaScript script that orchestrates subagents**. Claude writes the script for the task you describe; a runtime executes it in the background while your session stays responsive. Everything else on this page has Claude deciding what runs next, turn by turn — here, **the script holds the plan**.++Two consequences make this more than "more agents":++- **Your context stays clean.** Intermediate results live in script variables, not Claude's context window. That's why a workflow can coordinate 200 agents when a conversation can't coordinate 10.+- **Quality patterns become repeatable.** A script can make independent agents *adversarially refute each other's findings* before anything is reported, or draft a plan from several angles and weigh them. Same structure every run.++#### Try it in 2 minutes — no script required++```text+/deep-research What changed in the Node.js permission model between v20 and v22?+```++`/deep-research` is bundled. It fans searches across several angles, cross-checks the sources, votes on each claim, and returns a cited report with the claims that failed cross-checking already filtered out. Approve the run, then `/workflows` to watch phases, agent counts, and live token spend.++#### Starting your own++| Scope | How |+|---|---|+| **One task** | Say `ultracode` — or just "use a workflow" — in your prompt |+| **Whole session** | `/effort ultracode` (or `claude --effort ultracode`) — Claude plans a workflow for every substantive task |+| **Forever** | Run `/workflows`, select a run, press `s` to save its script to `.claude/workflows/` — it becomes `/<name>` for everyone who clones the repo |++Three phrases that reliably improve the script Claude writes: **"adversarially verify each finding"** (skeptic agents that try to refute results), **"in its own isolated copy"** (each agent gets a git worktree, so parallel edits can't conflict), and **"until two rounds in a row find nothing new"** (a convergence condition instead of a guessed count).++> 📂 **This repo ships a working one:** [`.claude/workflows/stale-docs-audit.js`](.claude/workflows/stale-docs-audit.js) — one reader agent per doc file, then independent skeptics that try to refute each finding before it's reported. Clone and run `/stale-docs-audit`.++> ⚠️ **Two things that surprise people.** The subagents a workflow spawns **always run in `acceptEdits`** regardless of your session's permission mode — file edits are auto-approved. And an agent still running when you stop a run isn't cached, so **many small agents preserve far more progress on resume** than a few long ones. [Details →](docs/workflows.md#permissions)++Limits: **16 concurrent agents**, **1,000 per run**, no mid-run user input, resume only within the same session. Cost control lives in `/config` (**Dynamic workflow size**, default `medium` ≈ under 15 agents) — and the cheapest habit is running on one directory before the whole repo.++---+### Beyond one terminal — the 2026 automation surfaceClaude Code grew a set of orchestration features in mid-2026 that compose with everything above:| Feature | What it does | Docs ||---|---|---|-| **Dynamic workflows** | Claude writes and runs an orchestration script that fans out tens to hundreds of subagents in the background; watch runs with `/workflows`. Opt in per session with `/effort ultracode` | [workflows](https://code.claude.com/docs/en/workflows) || **Cloud code review** | `/code-review ultra` runs a multi-agent review in the cloud (alias `/ultrareview` — 3 free runs on Pro/Max, then usage credits); `claude ultrareview` runs it non-interactively for CI | [commands](https://code.claude.com/docs/en/commands) || **Routines** | `/schedule` (alias `/routines`) runs scheduled agents on Anthropic-managed cloud infrastructure; `/loop` and the Cron tools cover local scheduling | [scheduled tasks](https://code.claude.com/docs/en/scheduled-tasks) || **Artifacts** *(beta)* | Publish live, shareable web pages to claude.ai straight from the CLI — Pro/Max/Team/Enterprise, CSP-sandboxed, 16 MiB limit | [artifacts](https://code.claude.com/docs/en/artifacts) |diff --git a/docs/reference/commands.md b/docs/reference/commands.mdindex 22c36e6..38011b6 100644--- a/docs/reference/commands.md+++ b/docs/reference/commands.md@@ -11,14 +11,17 @@ The most useful built-in slash commands, plus the file-format spec for custom co| Command | Purpose ||---|---|| `/add-dir` | Add additional working directories |+| `/batch` | Orchestrate a large change in parallel — researches the codebase, decomposes the work into 5–30 independent units, presents a plan, then spawns one background subagent per unit **in its own git worktree**, each opening a PR || `/cd` | Change the session's working directory || `/clear` | Clear conversation history || `/code-review [level]` | Review the current diff (`low`–`max`, or `ultra` for a multi-agent cloud review); `--fix` applies findings, `--comment` posts them to the PR. `/ultrareview` is an alias for the ultra tier || `/compact [instructions]` | Compact conversation with optional focus instructions || `/config` | View or modify configuration (`/config key=value` sets directly) || `/debug` | Troubleshoot current session and configuration |+| `/deep-research <question>` | Bundled [workflow](../workflows.md) — fans web searches across several angles, cross-checks sources, votes on each claim, returns a cited report. Needs the WebSearch tool || `/desktop` *(alias `/app`)* | Hand the current CLI session to the desktop app (macOS/Windows) || `/doctor` | Check the health of your Claude Code installation |+| `/fork` | Copy the current conversation into a new background session and keep working here. Pass a prompt and the copy starts on it immediately || `/effort` | Set reasoning effort (`low` / `medium` / `high` / `xhigh` / `max` / `ultracode`); no args opens an interactive slider; `/effort auto` resets to the model default. See [Effort levels](effort-levels.md) || `/fast` | Toggle Fast Mode — Opus 4.8 at 2× price for up to 2.5× output speed || `/goal` | Set a standing goal for the session |@@ -41,12 +44,14 @@ The most useful built-in slash commands, plus the file-format spec for custom co| `/scroll-speed` | Adjust terminal scroll speed || `/simplify` | Cleanup-only review — reuse, simplification, efficiency (no bug hunting) || `/status` | View account and system statuses |+| `/subtask` | Fork a subagent that inherits your **full conversation context** instead of starting fresh (with agent view off, this is `/fork` instead) |+| `/tasks` | List the current session's background work — subagents, workflows, background commands — and attach to or stop any of it || `/teleport` *(alias `/tp`)* | Send current session to claude.ai/code for web access || `/terminal-setup` | Configure terminal key bindings (iTerm2/VSCode) || `/usage` | Show token and plan usage (merged `/cost` + `/stats` in v2.1.118) || `/usage-credits` | Manage usage credits (renamed from `/extra-usage` in v2.1.144) || `/vim` | Enter vim mode for alternating insert and command modes |-| `/workflows` | Watch dynamic multi-agent workflow runs |+| `/workflows` | List and watch [dynamic workflow](../workflows.md) runs — drill into phases and agents, pause, stop, or press `s` to save a run's script as a reusable command |> 💡 **Day 1 essentials:** start with `/init`, `/help`, `/clear`, `/usage`, and `/model`.>diff --git a/docs/workflows.md b/docs/workflows.mdnew file mode 100644index 0000000..a329618--- /dev/null+++ b/docs/workflows.md@@ -0,0 +1,302 @@+# Dynamic Workflows — Orchestrating Agents at Scale++*~12 min read · [← Back to README](../README.md#dynamic-workflows)*++> **Mental model:** A dynamic workflow is a **JavaScript script that orchestrates subagents**. Claude writes the script for the task you describe, and a runtime executes it in the background while your session stays responsive. The difference from every other multi-agent feature: **the script holds the plan**, not Claude's turn-by-turn judgement.++Requires Claude Code v2.1.154+. Available on all paid plans, the Anthropic API, Amazon Bedrock, Google Cloud's Agent Platform, and Microsoft Foundry. On Pro, turn them on from the **Dynamic workflows** row in `/config`.++---++## Contents++- [Start here: `/deep-research`](#start-here-deep-research)+- [Who holds the plan?](#who-holds-the-plan)+- [Three ways to start a workflow](#three-ways-to-start-a-workflow)+- [Watching a run](#watching-a-run)+- [What the script looks like](#what-the-script-looks-like)+- [Saving a workflow for reuse](#saving-a-workflow-for-reuse)+- [Limits and behavior](#limits-and-behavior)+- [Permissions](#permissions)+- [Controlling cost](#controlling-cost)+- [Resuming a run](#resuming-a-run)+- [Turning workflows off](#turning-workflows-off)+- [Prompt patterns that work](#prompt-patterns-that-work)++---++## Start here: `/deep-research`++Don't write a script. Run the bundled one:++```text+/deep-research What changed in the Node.js permission model between v20 and v22?+```++It fans web searches across several angles, fetches and cross-checks the sources, votes on each claim, and returns a cited report with claims that failed cross-checking filtered out. Claude Code asks permission first; approve it, then run `/workflows` to watch.++This one command shows you the whole model in ~2 minutes: background execution, phases, fan-out, and adversarial verification. `/deep-research` runs only when you invoke it (as of v2.1.218 — earlier versions let Claude start it unprompted).++> It needs the WebSearch tool available in your session.++---++## Who holds the plan?++Subagents, skills, agent teams, and workflows can all run a multi-step task. The real distinction is **who decides what runs next**:++| | Subagents | Skills | Agent teams | Workflows |+|---|---|---|---|---|+| **What it is** | A worker Claude spawns | Instructions Claude follows | A lead supervising peer sessions | A script the runtime executes |+| **Who decides what runs next** | Claude, turn by turn | Claude, following the prompt | The lead agent, turn by turn | **The script** |+| **Where intermediate results live** | Claude's context window | Claude's context window | A shared task list | **Script variables** |+| **What's repeatable** | The worker definition | The instructions | The team definition | **The orchestration itself** |+| **Scale** | A few tasks per turn | Same as subagents | A handful of long-running peers | **Dozens to hundreds per run** |+| **Interruption** | Restarts the turn | Restarts the turn | Teammates keep running | **Resumable in the same session** |++Two consequences fall out of "the script holds the plan":++1. **Your context stays clean.** Intermediate results live in script variables, so Claude's context holds only the final answer. This is why a workflow can coordinate 200 agents when a conversation can't.+2. **Quality patterns become repeatable.** A script can have independent agents *adversarially review each other's findings* before anything is reported, or draft a plan from several angles and weigh them against each other. That's a more trustworthy result than a single pass — and it runs the same way every time.++> 💡 **When not to use one.** A workflow is overhead for anything a couple of subagents can handle. Reach for it when the task outgrows one conversation's coordination, or when you want the orchestration codified as a script you can read and rerun.++---++## Three ways to start a workflow++### 1. Run one that already exists++`/deep-research`, a workflow [you saved](#saving-a-workflow-for-reuse), or one shipped in a [plugin](https://code.claude.com/docs/en/plugins). Saved workflows appear in `/` autocomplete like any other command.++### 2. Ask for one in a single prompt++Include the keyword `ultracode`, or just say what you want in plain words — "use a workflow", "run a workflow". Claude treats a direct request as the same opt-in.++```text+ultracode: audit every API endpoint under src/routes/ for missing auth checks+```++Claude Code highlights the keyword and Claude writes a script instead of working turn by turn. The keyword only changes *how* the work is structured — the run stays inside your session's [permission mode](https://code.claude.com/docs/en/permission-modes), and its agents get the same permission checks and sandboxing as any other tool call.++**Dismiss it:** `Option+W` (macOS) or `Alt+W` (Windows/Linux) clears the highlight for this prompt; backspace right after the keyword also works. Turn it off entirely with **Ultracode keyword trigger** in `/config`.++**Where the keyword does *not* work** — by design, it's an opt-in only in a prompt *you* typed. It won't trigger from `-p`, a scheduled task, a webhook payload, or a relayed PR comment. (Before v2.1.210 it did fire from those routes.)++### 3. Let Claude decide for the whole session++```bash+/effort ultracode # this session+claude --effort ultracode # from launch (v2.1.203+)+```++`ultracode` combines `xhigh` reasoning with automatic workflow orchestration: Claude plans a workflow for **every substantive task** instead of waiting to be asked. One request can become several workflows in a row — one to understand the code, one to make the change, one to verify it.++That means every request costs more and takes longer. It resets when you start a new session; drop back with `/effort high` for routine work. Only offered on models that support `xhigh`.++### Approving the run++The prompt shows the planned phases, plus **Yes, run it** / **Yes, and don't ask again for this workflow in this project** / **View raw script** / **No**. `Ctrl+G` opens the script in your editor; `Tab` lets you adjust the prompt first.++| Permission mode | When you're prompted |+|---|---|+| Manual (default), accept edits | Every run, unless you chose "don't ask again" for that workflow in this project |+| Auto | First launch only — a **Yes** records consent in user settings. Skipped entirely when `ultracode` is on |+| Bypass permissions, `claude -p`, Agent SDK | Never — the run starts immediately |++---++## Watching a run++Runs execute in the background, so the session stays usable. `/workflows` lists running and completed runs; select one and press Enter for its progress view (phases, agent counts, token totals, elapsed time). A one-line summary also appears in the task panel below the input box — press `↓` to focus it, Enter to expand.++| Key | Action |+|---|---|+| `↑` / `↓` | Select a phase or agent |+| `Enter` / `→` | Drill into a phase, then an agent — read its prompt, recent tool calls, and result |+| `Esc` / `←` | Back out one level |+| `j` / `k` | Scroll within agent detail when it overflows |+| `f` | Filter the phase's agent list by status; press again to cycle (v2.1.186+) |+| `p` | Pause or resume the run |+| `x` | Stop the selected agent — or the whole run when focus is on the run |+| `r` | Restart the selected running agent |+| `s` | [Save](#saving-a-workflow-for-reuse) this run's script as a command |++> ℹ️ In v2.1.203–v2.1.205, `←` didn't step back out of a phase or agent. Use `Esc` on those versions.++---++## What the script looks like++You don't write these by hand — but you should be able to read one, because reading it is how you audit what 50 agents are about to do. Here's the shape:++```javascript+export const meta = {+ name: 'audit-routes',+ description: 'Audit every route handler for missing auth checks',+}++const found = await agent('List every .ts file under src/routes/.', {+ schema: { type: 'object', required: ['files'],+ properties: { files: { type: 'array', items: { type: 'string' } } } },+})++const audits = await pipeline(found.files, file =>+ agent(`Audit ${file} for missing authentication checks.`, { label: file }),+)++return audits.filter(Boolean)+```++Plain JavaScript with top-level `await`. `agent()` spawns one subagent; `pipeline()` runs one per item in a list; passing a `schema` forces structured output so the script gets a validated object instead of prose it has to parse.++Every run writes its script to a file under your session directory in `~/.claude/projects/`, and Claude receives the path — so you can ask for it, diff it against a previous run, or edit it and ask Claude to relaunch from the edited version.++> 📂 **A working example lives in this repo:** [`.claude/workflows/stale-docs-audit.js`](../.claude/workflows/stale-docs-audit.js) — fans one reader agent per doc file, then has independent verifier agents try to *refute* each finding before it's reported. Clone the repo and run `/stale-docs-audit` to see it work.+>+> For the full script API, see the Workflow tool entry in the [Agent SDK reference](https://code.claude.com/docs/en/agent-sdk/typescript).++---++## Saving a workflow for reuse++When a run does what you wanted, keep it. Run `/workflows`, select the run, press `s`. `Tab` toggles the location:++| Location | Scope |+|---|---|+| `.claude/workflows/` | Project — shared with everyone who clones the repo |+| `~/.claude/workflows/` | Personal — every project, only you. Honors `CLAUDE_CONFIG_DIR` |++Press Enter and it runs as `/<name>` from then on. If a project and personal workflow share a name, **the project one wins**.++**Monorepos** (v2.1.178+): saving to the project location writes to the closest existing `.claude/workflows/` between your cwd and the repo root. Project workflows load from *every* `.claude/workflows/` along that path, and the one closest to your cwd wins on name collisions.++**In a plugin:** put the script in a `workflows/` directory at the plugin root. Plugin workflows are namespaced — a plugin `acme-tools` with `meta.name: 'release-audit'` runs as `/acme-tools:release-audit`.++### Passing input with `args`++A saved workflow reads invocation input from a global named `args`:++```text+> Run /triage-issues on issues 1024, 1025, and 1030+```++Claude passes the list as **structured data**, so the script can call array and object methods on `args` directly — no parsing. If you omit input, `args` is `undefined`.++> 🔒 Since v2.1.216, Claude Code refuses to write a saved workflow through a symlink. For the project location it checks `.claude`, `.claude/workflows`, and the target file; for the personal location only the target file, so dotfiles-managed `~/.claude` still works.++---++## Limits and behavior++| Constraint | Why |+|---|---|+| **No mid-run user input** | Only agent permission prompts pause a run. For sign-off between stages, run each stage as its own workflow |+| **No direct filesystem or shell access from the script** | Agents read, write, and run commands. The script only coordinates them |+| **Up to 16 concurrent agents** (fewer on low-core machines) | Bounds local resource use — excess calls queue and run as slots free |+| **1,000 agents total per run** | Runaway-loop backstop, set far above any real workflow |++---++## Permissions++Worth internalizing, because it surprises people:++- **The subagents a workflow spawns always run in `acceptEdits` mode**, regardless of your session's permission mode. **File edits are auto-approved.** Your mode controls only the launch prompt.+- Agents inherit your [tool allowlist](https://code.claude.com/docs/en/settings#permission-settings).+- Shell commands, web fetches, and MCP tools *not* in your allowlist can still prompt you mid-run. On a long run, allowlist what the agents will need **before** starting — otherwise you'll be babysitting a background job.+- In `claude -p` and the Agent SDK there's nobody to prompt, so tool calls follow your configured rules without interactive confirmation.++---++## Controlling cost++A workflow spawns many agents, so one run can use meaningfully more tokens than doing the same work in conversation. Runs count against your plan's usage and rate limits like any other session.++**The cheapest habit: run it on a slice first.** One directory instead of the whole repo, a narrow question instead of a broad one. The `/workflows` view shows per-agent token usage live, and stopping a run there never loses completed work.++### Size guideline++Tells Claude how many agents to aim for. It's **advice, not a cap** — a prompt calling for different scale still overrides it. Requires v2.1.202+.++| Value | Agents Claude aims for |+|---|---|+| `unrestricted` | No guideline — sized to the task |+| `small` | Fewer than 5 |+| `medium` *(default)* | Fewer than 15 |+| `large` | Fewer than 50 |++```bash+/config workflowSizeGuideline=small+```++On v2.1.219+ you can also set `workflowSizeGuideline` in any settings file, which takes precedence over `/config`. Changes apply on the next prompt; the [runtime caps](#limits-and-behavior) always apply regardless.++### The large-run warning++When a workflow schedules more than **25 agents**, or its projected token total passes **1.5 million**, its progress line shows a `Large workflow` warning pointing you at `/workflows` (v2.1.203+). It's advisory — it doesn't pause anything. Choosing a size guideline replaces the 25-agent threshold with that guideline's count, and sessions with `ultracode` on don't show it at all (you already opted in).++### Model routing++Every agent uses your session's model unless the script routes a stage elsewhere or `CLAUDE_CODE_SUBAGENT_MODEL` is set (that env var overrides both). So: **check `/model` before a large run**, and when describing the task, ask Claude to use a smaller model for stages that don't need the strongest one.++---++## Resuming a run++Stop a run and you can resume it: agents that already completed return **cached** results, and the rest run live. Resume from `/workflows` with `p`, or ask Claude to relaunch with the same script.++> 💡 **The non-obvious consequence:** an agent still running when you stopped isn't saved and starts over. So a workflow that fans work across **many small agents preserves far more progress on interruption** than one built around a few long-running agents. Worth knowing before you write a script that does everything in three giant steps.++Resume works **within the same session only**. Exit Claude Code mid-run and the next session starts that workflow fresh.++---++## Turning workflows off++For yourself:++- Toggle **Dynamic workflows** off in `/config` — persists across sessions+- `"disableWorkflows": true` in `~/.claude/settings.json` — persists+- `CLAUDE_CODE_DISABLE_WORKFLOWS=1` — read at startup, applies wherever you set it++Organization-wide: `"disableWorkflows": true` in [managed settings](https://code.claude.com/docs/en/server-managed-settings), or the toggle on the [Claude Code admin settings](https://claude.ai/admin-settings/claude-code) page.++When disabled, bundled workflow commands disappear, the `ultracode` keyword stops triggering, and `ultracode` is removed from the `/effort` menu.++---++## Prompt patterns that work++You describe the shape; Claude writes the script. These are the shapes that pay off:++| Goal | Prompt |+|---|---|+| **Audit many files for one issue** | `use a workflow to audit every route handler under src/routes/ for missing authentication checks, and adversarially verify each finding before reporting it` |+| **Fix until a check passes** | `use a workflow to run npx tsc --noEmit and keep fixing the reported errors until the type check passes or two rounds in a row make no progress` |+| **Migrate many files in parallel** | `use a workflow to migrate every component under src/components/ from styled-components to Tailwind, working on each file in its own isolated copy` |+| **Review, then one summary** | `use a workflow to review every file changed in this PR for correctness issues, then merge the per-file findings into one ranked summary` |+| **Research across sources** | `use a workflow to research how our three competitors handle rate limiting: read their public docs and recent changelog entries in parallel, then compare the approaches` |+| **Find issues until the list stops growing** | `use a workflow to find flaky tests in this repo: run the suite repeatedly, record which tests fail intermittently, and stop once two rounds in a row find nothing new` |++Three phrases that reliably improve the script Claude writes:++- **"adversarially verify each finding"** — adds skeptic agents that try to *refute* results before they're reported. Kills plausible-but-wrong findings.+- **"in its own isolated copy"** — puts each agent in a separate git worktree so parallel edits can't conflict.+- **"until two rounds in a row find nothing new"** — replaces a guessed count with a convergence condition. Better for discovery work where you don't know the answer's size.++> 💡 Already have an orchestrator built another way — a folder of subagent prompts, or a skill that fans work out? Point Claude at it and ask for a workflow that does the same thing.++---++## See also++- [Official workflows docs](https://code.claude.com/docs/en/workflows) — authoritative reference+- [Run agents in parallel](https://code.claude.com/docs/en/agents) — subagents vs agent view vs teams vs workflows+- [Agent Teams](../README.md#agent-teams-experimental) — the other multi-agent surface, and when to pick it instead+- [Effort levels](reference/effort-levels.md) — what `ultracode` changes+- [Slash commands](reference/commands.md) — `/workflows`, `/deep-research`, `/batch`++---++[← Back to README](../README.md#dynamic-workflows) · [Skills](skills.md) · [Effort levels](reference/effort-levels.md)