The argument in one line.
When code — not the model — carries results between sub-agents, the orchestrator context never fills, letting you chain 20, 30, or 100 agents without degradation or a mounting token tax at every join.
Read if. Skip if.
- You already use Claude Code sub-agents or skill-based workflows and have felt the context bloat or sloppy orchestration after ten or more agents.
- You run repeatable multi-step jobs (issue triage, code review loops, outreach drafting) and want them to auto-retry on failure without babysitting.
- You are comfortable reading JavaScript and want deterministic, code-defined control flow instead of hoping the model keeps its place.
- You are still learning the basics of Claude Code and haven't shipped a sub-agent workflow yet — the token-tax problem won't feel real until you've hit it.
- You only run one-off tasks; the video explicitly says those don't need a workflow.
The full version, fast.
Claude Code 2.1.147 adds a Workflow tool that moves orchestration from the model into a JavaScript file in .claude/workflows/. Instead of every sub-agent result flowing back through the main context, results pass directly through the code so the orchestrator context stays flat no matter how many agents run. The workflow file exposes agent(), parallel(), pipeline(), schema typing, phase logging, runtime arguments, and a token-budget guard. Three live demos (Sentry triage, dead-code sweep, personalized outreach) show the pattern in practice. Reach for a workflow when a job is repeatable, fans out across multiple agents, or is long enough that a mid-run failure is worth auto-recovering from.
Chat with this breakdown.
Modern Creator members can chat with any breakdown — ask for the hook, quote a framework, find the exact transcript moment. Unlocks at T2: refer 3 friends + add your own API key.
Create a free account →Where the time goes.

01 · Introduction
Hook — announces the Workflow feature, shows /workflows slash command, previews a previous Sentry triage run.

02 · The Big Picture
Explains the old model-as-orchestrator pattern, the token tax at each sub-agent join, and why context fills and causes sloppy orchestration.

03 · How Workflows Look
Introduces the code-as-orchestrator concept, shows slide diagrams contrasting the two patterns, introduces agent() and loops in code.

04 · Making a Workflow
Walks through triage-sentry.js manually — meta, schemas, args, phase definitions, plain JS filtering.

05 · Workflow Demo
Shows the triage-sentry workflow running live — phase log, parallel fix agents, retrying, background execution.

06 · Running the Workflow
Continues live demo — navigating /workflows UI, pausing and resuming, watching the verifying stage.

07 · Workflow 2: Dead Code Sweep
While loop up to 8 rounds, parallel removal with test-and-revert safety check, early exit when no dead code remains.

08 · Workflow 3: Personalized Outreach
CSV leads, Haiku research stage, Opus writing stage via pipeline(), model-switching per stage.

09 · Results
Triage-sentry completes — 7 sub-agents, 400K tokens, three fixes verified. Personalized outreach output folder shown.

10 · Workflow Creator
Mentions a GitHub skill that teaches Claude Code to generate workflow files; expects Anthropic to ship an official one.

11 · The Toolkit
Rapid summary of all workflow primitives: agent, parallel, pipeline, schema, phase log, args.

12 · Budgets
Shows budget.remaining() in a while loop — token-aware self-stopping loops to prevent runaway spend.

13 · My Suggestion
Recommends asking Claude Code to audit previous sessions and identify workflow opportunities.

14 · When to Workflow
The three-condition decision rule: repeatable, fans out, worth resuming. Everything else: just let Claude do it.

15 · Conclusion
CTA to newsletter and masterclass.
Lines worth screenshotting.
- Every time a sub-agent result passes back through the main orchestrator context, you pay a token tax — with 15 agents that tax compounds to serious money and serious degradation.
- Moving orchestration into a JavaScript file means the main Claude session context stays flat whether you run 3 agents or 300.
- The pipeline() primitive starts stage 2 on the first completed item from stage 1 — you don't wait for all parallel work to finish before the next stage begins.
- Workflows auto-retry each failed sub-agent up to three times, which makes long jobs resumable without manual re-runs.
- You can mix plain JavaScript conditionals and loops directly with agent() calls — a JS filter that drops low-impact Sentry issues runs for free before any agent is spawned.
- A budget.remaining() guard in a while loop lets the workflow self-regulate token spend instead of running until an arbitrary loop count.
- The /workflows slash command gives live visibility into running and completed workflows — phases, agent counts, tool calls, and token usage per agent.
- For one-off tasks the video explicitly says to skip workflows and just run Claude manually — the overhead only pays off on repeatable or multi-agent jobs.
- Schemas on agent() calls give downstream agents typed, structured data instead of raw text, reducing prompt-engineering needed to parse intermediate results.
- The same five-step job: with model-as-orchestrator you pay a token tax at every arrow; with code-as-orchestrator you pay nothing at each join.
- Conditional branching is reliable when it lives in code — when it lives in a filling context window it degrades over time.
- Parallel outreach research with a cheap Haiku model, then a switch to Opus only for writing, is a real cost pattern the workflow makes easy to express.
Replace the model with code and pay nothing at every join.
The token tax in multi-agent pipelines is not a fixed cost — it multiplies at every sub-agent join, and moving orchestration into a JavaScript file eliminates it entirely.
- The Workflow feature shipped in v2.1.147 as an opt-in with a /workflows slash command for browsing history — visibility that previously required parsing scrolling terminal output.
- Every sub-agent result that passes back through the main orchestrator context burns tokens twice — once as output, once as input to the next agent — and this tax compounds with agent count.
- An orchestrator running 15 agents degrades because its context window fills with intermediate results it never needed to hold.
- Replacing the model orchestrator with a code file means joins between agents are free — no token cost at handoff, no context growth, no degradation over long runs.
- Conditional branching and loops expressed in JavaScript are deterministic; the same logic in a model context drifts as the context fills.
- Plain JavaScript runs for free between agent() calls — a filter that drops low-impact issues before spawning agents is a zero-cost code operation, not a model operation.
- Schemas defined at the top of the file and passed to agent() calls give downstream stages typed data, removing the prompt-engineering needed to parse free text.
- The phase log in /workflows gives real-time visibility into which agents are running, how many tools they called, and how many tokens they spent — replacing the wall-of-text problem.
- Workflows run in the background — the main session stays interactive while agents execute, and multiple workflows can run simultaneously.
- Auto-retry per sub-agent means a failed MCP call does not abort the whole workflow; Claude Code retries that agent before moving on.
- A while loop with a round counter and an early-exit condition is the correct pattern for iterative cleanup jobs — it terminates when the job is done, not after a fixed number of runs.
- pipeline() is the right primitive when stage 2 can start on item 1 before all stage-1 work is done — it reduces total elapsed time compared to parallel-all-then-batch.
- Assigning different models to different pipeline stages is a cost pattern that only works cleanly when orchestration is in code.
- The six workflow primitives — agent, parallel, pipeline, schema, phase, args — cover the full space of fan-out, fan-in, sequential, and conditional patterns without needing a model to manage control flow.
- budget.remaining() turns a while loop into a token-budget-aware run that self-terminates when budget is depleted, preventing open-ended loops from exceeding cost targets.
- Repeatable, fans out, worth resuming — any job that fails all three conditions is a one-off and should be run directly without a workflow file.
- The value of a workflow file is highest when the job will run many times; the upfront cost of writing the file amortizes across every future run.
Terms worth knowing.
- Workflow tool
- A Claude Code feature (enabled via CLAUDE_CODE_WORKFLOWS=1) that reads a .js file from .claude/workflows/ and runs its defined agents and phases as a managed background process, visible via /workflows.
- Token tax
- The cumulative cost of passing sub-agent results back through the main orchestrator context window; grows with each agent handoff and causes the orchestrator to degrade as its context fills.
- Code-as-orchestrator
- The pattern where a JavaScript file — not the model — decides sequencing, conditionals, and data passing between sub-agents, keeping the main session context flat.
- pipeline()
- A workflow primitive that streams items through sequential stages, starting the next stage on each completed item rather than waiting for all items in the prior stage to finish.
- parallel()
- A workflow primitive that launches N agent() calls simultaneously and waits for all of them to complete before continuing.
- schema
- A typed return definition attached to an agent() call that tells the sub-agent what structured shape to return, so the next stage can reference named fields without parsing free text.
- budget.remaining()
- A workflow-runtime property that returns the number of tokens still available in the current budget, usable as a while-loop guard to self-terminate expensive loops before they overspend.
Things they pointed at.
Lines you could clip.
“Four sub-agents is not one tax, it is a tax at every join. The more you fan out, the more you pay.”
“Same five steps — one run pays a tax at every arrow; the other pays nothing.”
“Reviewing is no longer the model's decision, it is the file's.”
“Repeatable, fans out, worth resuming — that is the sweet spot.”
Word for word.
The bait, then the rug-pull.
Claude Code 2.1.147 shipped a feature Anthropic hadn't announced yet: a Workflow tool that replaces the model-as-orchestrator pattern with a JavaScript file, and with it, the token tax that compounds with every sub-agent handoff.
Named ideas worth stealing.
When to Workflow (3 conditions)
- Repeatable — you will run it over and over
- Fans out — conditionals, loops, or parallel agents based on data
- Worth resuming — long enough that a mid-run failure is costly
A portable decision rule for deciding when to invest in a workflow file vs. just running Claude manually.
Code-as-Orchestrator Pattern
Replace the model orchestrator with a JS file — agent(), parallel(), pipeline(), schema, phase(), args, budget — so context stays flat and joins are free.
How they asked for the click.
“If you want to get free insights delivered from me on a regular basis, then you may want to join my newsletter as well linked below.”
Soft close at the very end after the decision-rule summary; non-intrusive, no mid-video pitch.

































































