Claude Code Dynamic Workflows: More Than Multi‑Agent—Agents Build Their Own Execution Harness
Claude Code’s new Dynamic Workflows feature lets the system generate a custom execution harness for each task, addressing agentic laziness, self‑preferential bias, and goal drift by structuring work into coordinated sub‑agents, with concrete patterns, examples, and practical guidance for when and how to use them.
Claude Code now generates dynamic harnesses for tasks
Last week Anthropic added “dynamic workflows” to Claude Code. The system can instantly write a task‑specific “harness” – a lightweight execution framework that is generated on the fly for the current job.
The default harness is designed for coding, but many other tasks behave like coding problems, so the same approach works for research, security analysis, agent‑team coordination, and code review.
Key idea: a harness, not just more agents
Dynamic workflows are not merely a “more‑agent orchestration” feature. Their core is a harness – a temporary execution scaffold that the agent writes itself for the specific task.
Prompt examples that define the scope of dynamic workflows
“This test fails about 1 time in 50. Set a workflow to reproduce it, generate multiple theories, and adversarially test them in worktrees. Use /goal , don’t stop until a theory survives the evidence.”
“Run a workflow over my last 50 sessions, surface the places I repeatedly corrected Claude, and turn those recurring issues into CLAUDE.md rules.”
“Run a workflow over the #incidents channel in Slack, find recurring root causes that never got a ticket.”
“Run a workflow on my business plan, let different agents dissect it from investor, customer, and competitor perspectives.”
“Given a folder of 80 resumes, use a workflow to rank them for a backend role, then interview me with AskUserQuestion to refine the rubric.”
“Brainstorm names for a CLI tool, then run a tournament to pick the top three.”
“Rename every User model in the codebase to Account using a workflow.”
“Check my blog draft, verify each technical claim against the codebase, and prevent publishing errors.”
All these examples share a common pattern: they are not single‑step commands but multi‑step processes that split a task into sub‑problems, compare, verify, and synthesize results.
How dynamic workflows work
Each workflow runs a JavaScript file containing special functions that launch and coordinate sub‑agents. Standard JavaScript objects (JSON, Math, Array) are available for data handling.
A crucial detail is that a workflow can decide which model each sub‑agent uses and whether the sub‑agent runs in its own worktree, allowing the system to pick the appropriate intelligence level and isolation.
If a workflow is interrupted (e.g., the user aborts or the terminal closes), it can resume from the interruption point when the session is restored.
The workflow extracts the execution state from a single context and places it into a more stable, program‑like structure, avoiding the compression, forgetting, and drift that occur in a single Claude context.
Why dynamic workflows are needed
When the default Claude Code harness handles a task, it must plan, execute, and check within a single context window. This works for ordinary coding tasks but breaks down for long‑running, large‑scale parallel, highly structured, or adversarial tasks.
1. Agentic laziness
Claude may stop early and claim completion before actually finishing a complex, multi‑part task (e.g., handling only 35 of 50 security‑review items and then summarizing as done).
2. Self‑preferential bias
When the same Claude both proposes solutions and evaluates them, it tends to favor its own conclusions, similar to a human reviewer grading their own work.
3. Goal drift
During multi‑round execution, the fidelity to the original goal degrades, especially after context compression. Dynamic workflows combat this by assigning independent sub‑agents with isolated contexts to each sub‑goal.
Dynamic vs. static workflows
Static workflows (e.g., using claude -p) must cover all edge cases and are therefore generic and heavyweight. Dynamic workflows, introduced with Claude Opus 4.8, let Claude write a custom harness on the fly, acting like a “temporary project manager + temporary script engineer.”
Common workflow patterns
Classify‑and‑act : Use a classifier agent to determine task type, then route to appropriate agents or actions.
Fan‑out‑and‑synthesize : Split a task into many small steps, run each in its own agent, then combine structured outputs at a barrier.
Adversarial verification : For each spawned agent, run an independent verifier that checks its output against a rubric.
Generate‑and‑filter : Produce many ideas, filter and deduplicate them using a rubric before returning the highest‑quality results.
Tournament : Launch multiple agents on the same task, then let a judging agent pairwise compare results until a winner emerges.
Loop‑until‑done : Repeatedly start agents until a stop condition (no new findings, error‑free logs, or a verifier’s approval) is met.
Use cases beyond coding
Migration and refactoring : Bun used workflows to rewrite Zig code to Rust, launching sub‑agents for each fix, then adversarially reviewing them before merging.
Deep research : The /deep-research skill fans out web searches, gathers sources, performs adversarial verification, and produces a cited report. It can also be used on Slack contexts, codebases, or any investigative task.
Deep verification : Identify factual claims in a report, spawn a sub‑agent for each claim to verify sources, and optionally run a skeptic sub‑agent to test rule quality before committing them to CLAUDE.md.
Sorting : For large item sets (e.g., ranking 1,000 support tickets by severity), use a tournament or pairwise‑comparison pipeline rather than a single prompt, preserving quality and staying within context limits.
Memory and rule compliance : List required rules in CLAUDE.md, assign a verifier agent to each, and optionally add a skeptic persona to audit the rules themselves.
Root‑cause investigation : Spawn independent agents to examine logs, files, and data, generate hypotheses, and then run verifiers and refuters on each hypothesis.
Large‑scale triage : Classify backlog items, deduplicate against tracked items, and either fix them automatically or hand them off to humans. The “quarantine” pattern isolates agents that read untrusted content from those that perform privileged actions.
Exploration and taste‑based tasks : Generate multiple design or naming options, have a review agent apply a rubric, and only consider a task complete when the rubric is satisfied.
Evals : Run lightweight evaluations by launching agents to produce outputs, then comparison agents to score them against a rubric.
Model and intelligent routing : Create a classifier agent that decides which model (e.g., Sonnet vs. Opus) to use based on task complexity, file count, or code‑base structure, enabling vertical allocation of compute resources.
When not to use dynamic workflows
Workflows are still new and can dramatically increase token usage. They are valuable for long‑running, parallel, highly structured, or adversarial tasks, but not for routine small fixes. Over‑parallelizing without clear goals, boundaries, or verification can waste resources and give a false sense of reliability.
Practical tips for building dynamic workflows
1. Prompting: be specific
Provide detailed prompts that include the technical details described earlier. You can also ask for a “quick workflow” for smaller tasks.
2. Combine /goal and /loop
Use /loop for repeatable workflows (triage, research, verification) and /goal to enforce a hard completion condition.
3. Token‑budgeting
Set an explicit token budget in the prompt (e.g., “use 10 k tokens”) to keep costs under control and give agents a sense of resource constraints.
4. Saving and sharing
Press “s” in the workflow menu to save. Saved workflows live in ~/.claude/workflows and can be distributed via skills. Include the workflow file in a skill folder and reference it in SKILL.MD. Treat skills as reusable templates rather than rigid scripts.
A new starting point
Dynamic workflows extend Claude Code in a meaningful way, but they should not become the default. Use them for tasks where a single context would fail: long‑running, parallel, adversarial, review, ranking, migration, research, triage, or post‑mortem analyses. For simple fixes, keep the process lightweight.
Ultimately, the breakthrough is not more agents but a system that can design a temporary organization—researchers, executors, skeptics, arbitrators, budget controllers, and stop‑condition managers—on the fly.
—
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Design Hub
Periodically delivers AI‑assisted design tips and the latest design news, covering industrial, architectural, graphic, and UX design. A concise, all‑round source of updates to boost your creative work.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
