Claude Code Workflows

Claude Code Just Dropped Workflows — An Actual Game Changer

Mansel Scheffel · ~16 min · Deep Dive Document
Video thumbnail
⏱ ~16 min 🎤 Mansel Scheffel 🏷 Claude Code · Workflows · Sub-Agents · Deep Research · Token Cost · JavaScript Orchestration

Overview

Claude Code's new Dynamic Workflows feature moves the sub-agent orchestration layer from the LLM's context window into a deterministic JavaScript script. Instead of Claude managing dozens of agents while holding intermediate state in its context (causing bloat, lost track, and compaction), a workflow.js file handles state in variables, runs deterministic loops, and returns only final answers to the main session. The result: you can spawn up to 1,000 agents per run (16 concurrent max), mix models per phase (Haiku for discovery, Sonnet for critique, Opus for synthesis), and pause/resume mid-run via a journal. Mansel demos two workflows — deep research (105 agents, 3M tokens, 15 min for vitamin C research) and Startup Forge (adversarial idea validation with VC judges) — and is refreshingly honest about the token cost.

1 Sub-Agents & The Context Bloat Problem

▶ 0:17

Mansel starts with the problem workflows solve. In a normal Claude Code session, most people just keep chatting until the context is exhausted. The context window fills with tool calls, MCP results, long reasoning, and conversation history — all bloat.

Sub-agents were the first solution: spawn a fresh Claude Code session with its own isolated context for a specific task, then return only the answer (~500 tokens) to the main session instead of the full 6,000-60,000 tokens of work. No bloat, no compaction needed.

But the problem with sub-agents was that Claude itself was the orchestrator. It had to keep track of what agents were doing, manage requests and results, reason about ordering — all inside its own context. At scale (6+ agents), it starts losing track.

💡 "We have our manager over here who loses track of everything because it has to hold intermediate states within its context."

2 The Script-Based Orchestrator

▶ 2:34

The solution: move the manager to a script. A workflow.js file replaces the overburdened main context window as the orchestrator:

  • State held in variables — not in the LLM's context
  • Deterministic loops — the script runs until conditions are met, not until Claude "feels" done
  • Only final answers return to the main Claude session
  • Massive scale — up to 1,000 agents total per run, 16 concurrent max

The script includes a journal that tracks execution state, enabling pause and resume mid-run.

3 Runtime Architecture & Limits

▶ 3:11

At runtime, the workflow.js runs as a separate process that spawns agents to do the work. Key technical details:

  • No direct file system or shell access from the script — only the agents have that capability
  • 16 concurrent agents max — but 1,000 total per run (sequential batching)
  • Requires Claude Code desktop app or terminal-based IDE — not VS Code extension (yet)
  • Journal-based resumability — pause mid-run and resume later
  • Default permissions: edit-accept mode — won't bypass permissions unless told to

4 Live Demo: Deep Research on Vitamin C

▶ 4:22

Mansel triggers the /deep-research skill (built on workflows) by asking about vitamin C benefits. The workflow runs through 5 stages:

  1. Scope — breaks the question into 5 research angles (1 agent, 31K tokens, 17 seconds)
  2. Search — 5 parallel web searches, one per angle
  3. Fetch — dedupes URLs, pulls top 15 sources, extracts falsifiable claims
  4. Verifyadversarial three-vote fact-checking on each claim. Each claim needs 2-out-of-3 refutes killed before proceeding. This is where ~75 of the 105 agents ran
  5. Synthesize — produces the final research document
⚠️ Cost reality: After 1 minute — 22 agents, 550K tokens. After 12 minutes — 3.1M tokens. Final: 105 agents, 3M+ tokens, 15 minutes. The output was "not as much information as one would think after that amount of time."

Mansel suggests reserving deep research for very specific, high-stakes problems — not everyday research. Examples: medical blood work analysis, competitor research for a critical decision.

5 Startup Forge — Beyond Software Dev

▶ 6:22

To show workflows aren't just for developers, Mansel asked Claude to create a demo workflow on its own. It built Startup Forge:

  1. Ideation — 4 agents each invent a startup from a different angle (consumer, B2B, climate, AI-native)
  2. Judging — each idea is scored by a VC judge the moment it's ready (idea #1 gets judged while idea #4 is still being written). Judges must return validated novelty, market size, feasibility, and total scores
  3. Stress testing — the top-ranked idea is attacked by 3 skeptics in parallel, each with a distinct lens (persona prompting), trying to find fatal flaws
  4. Synthesis — writes an honest investor pitch that must confront every objection head-on

Use cases beyond software: business idea validation, audits, competitive analysis, lead generation.

6 Inside the Script & Model Mixing

▶ 9:00

The workflow script is saved as a .js file with clear structure:

  • Name and description — reusable metadata
  • Phases — each with a defined model, agent count, and prompt
  • Per-phase model selection — the killer feature

Example configuration:

  • Generate phase: 6 Haiku agents brainstorm name/tagline candidates (cheap, fast)
  • Critique phase: Sonnet scores each candidate (balanced reasoning)
  • Synthesis phase: Opus writes the final brand brief (highest quality)

You can edit the script directly or ask Claude to modify it via natural language. The script is reusable — saved for future runs with the same parameters.

💡 "You can use different models per phase. Some phases run in Haiku for discovery, Sonnet for critique, Opus for synthesis — you choose the cost/quality tradeoff at each step."

7 Token Cost Reality Check

▶ 11:50

Mansel is refreshingly direct about costs:

  • Deep research: 105 agents → 3M+ tokens → 15 minutes for a single vitamin C query
  • Sub-agents don't magically reduce token usage — each agent still consumes its own tokens
  • The deterministic loop means it will keep running until done — set budget guards to prevent death spirals
  • Max/Team users: workflows enabled by default
  • Pro users: NOT enabled by default — "It will probably nuke your entire budget and you won't be able to feed your family for a week"
  • Organizations: off by default, admin must enable

Enable/disable via /config in Claude Code settings.

8 Three Levels of Control

▶ 13:06

Mansel outlines three levels of workflow control:

  • Level 1 — Prompt design: be very specific up front. Research your use case before prompting. The more clarity you provide, the better the workflow script
  • Level 2 — Pre-run inspection: inspect the generated script before execution. Change agent counts, parallelism, prompts, models, and budget guards
  • Level 3 — Direct script editing: open the .js file and edit it manually, or ask Claude to modify it via natural language

Workflows trigger automatically when you use the word "workflow" in chat. There's also an "ultra code" effort mode that auto-creates workflows for every substantive task (not recommended for most users).

9 When To Actually Use Workflows

▶ 14:59

Mansel's guidance on workflows vs skills:

  • Skills for daily work — determinism, reliability, same thing every day (lead gen, replies, routine tasks)
  • Workflows for specific high-value tasks:
    • Task fans out across many similar items
    • You need deterministic loops (relentlessly achieve a complex goal)
    • You want resumability mid-run
    • Massive bug sweeps, code reviews, codebase audits
    • Deep research on critical decisions
  • Not for everything — the token cost makes daily use impractical. Reserve for when the stakes justify 3M+ tokens
💡 "Skills for the majority of my workflows. Workflows are for when the task fans out across many similar items or you want those deterministic loops — relentlessly trying to achieve a complex goal."

🎯 Key Takeaways

🔑 Key Takeaways

  • Workflows move orchestration from LLM context to a JS script — state in variables, deterministic loops, only final answers returned. Solves the "manager loses track" problem at scale
  • 1,000 agents per run, 16 concurrent max — massive parallelism for research, audits, code reviews, and multi-angle analysis
  • Mix models per phase — Haiku for cheap discovery, Sonnet for reasoning, Opus for synthesis. Optimize cost/quality at each step
  • Deep research = 105 agents, 3M tokens, 15 minutes — adversarial 3-vote fact-checking is the biggest token consumer (~75 of 105 agents)
  • Journal enables pause/resume — state persisted to disk, resume mid-run later. Critical for expensive long-running workflows
  • Not a daily tool — reserve for high-stakes decisions where the cost of 3M+ tokens is justified. Skills are for daily deterministic work
  • Three levels of control — specific prompts, pre-run inspection, direct script editing. Always inspect before running
  • Pro users: not enabled by default — for good reason. Max/Team users get it automatically. Organizations must opt in via admin
  • Scripts are reusable — saved as .js files, re-runnable, editable via natural language or direct code editing
  • Beyond software dev — Startup Forge demo shows business idea validation with VC judges and adversarial skeptics. Also useful for audits, competitor research, lead gen

Timestamp Index

▶ 0:00 Intro — workflows are the best feature
▶ 0:17 Sub-agents explained — context bloat problem
▶ 2:34 Script-based orchestrator solution
▶ 3:11 Runtime architecture — journal, limits
▶ 4:22 Deep research demo — vitamin C
▶ 6:22 Startup Forge demo — adversarial validation
▶ 9:00 Inside the script — model mixing per phase
▶ 11:50 Token cost reality — 3M+ tokens per run
▶ 13:06 Three levels of control
▶ 14:18 Saved workflows — VS Code support
▶ 14:59 When to use workflows vs skills