Claude Code Introduces Dynamic Workflows: Enabling AI to Form Teams and Collaborate

marsbitPublished on 2026-06-04Last updated on 2026-06-04

Abstract

Claude Code introduces dynamic workflows, enabling AI to coordinate teams of specialized agents for complex tasks. This transforms Claude from a code assistant into a programmable workbench. Workflows address key limitations of single-agent systems: agentic laziness (premature task completion), self-preferential bias (favoring own outputs), and goal drift (losing sight of original objectives). The system allows Claude to dynamically create execution frameworks using JavaScript. It can split tasks, dispatch parallel agents for isolated work (e.g., in separate worktrees), implement adversarial validation, run tournaments, and synthesize results. This multi-agent approach is valuable for tasks requiring deep research, factual verification, code migration, root cause analysis, large-scale triage, and qualitative sorting. Key patterns include: classify-and-route, fan-out-and-synthesize, adversarial verification, generate-and-filter, tournaments, and loop-until-done. While token usage is higher, workflows excel where tasks resemble programming—needing problem decomposition, isolated context, hypothesis testing, and handling many details. They extend Claude Code's utility beyond technical work to areas like business plan review, resume screening, and naming brainstorm. The feature is not a universal solution but points to a future where AI tool competitiveness depends on organizing reliable, reusable, and auditable execution flows for complex goals.

Editor's Note: Claude Code is evolving from a coding assistant into a composable Agent workbench.

The workflows introduced in this article are designed to enable Claude to move beyond "thinking and then doing" within the same context window. Instead, it can dynamically generate an execution framework for tasks: decomposing tasks, dispatching sub-agents, parallel processing, cross-validation, iterative cycles, and even allowing different agents to compete with each other before synthesizing the final results.

This signifies a clear expansion of Claude Code's applicable scenarios. It's not just suitable for code migration, refactoring, test reproduction, and code review, but also for non-technical tasks such as deep research, fact-checking, resume screening, incident post-mortems, rule distillation, business plan reviews, and naming brainstorms. Many complex tasks are inherently similar to programming: they require problem decomposition, context isolation, hypothesis validation, handling of extensive details, and making choices among multiple candidate paths.

Dynamic workflows aim to address several common issues with large language models on long tasks: "Agentic laziness," where the agent declares completion prematurely; "Self-preferential bias," where the agent tends to favor its own conclusions; and "Goal drift," where the agent gradually deviates from the original objective over multiple execution rounds. By assigning tasks to multiple Claude instances with independent contexts, it transforms complex tasks from a "single-agent marathon" into "multi-agent collaboration."

Of course, workflows are not a universal solution. They typically consume more tokens and may not be necessary for every routine coding task. However, they point to an important direction: future competition among AI tools may depend not only on the intelligence of a single model but also on its ability to organize reliable, reusable, and reviewable execution processes around complex objectives.

Below is the original article:

Although Claude Code's default execution framework is built for programming, it is also applicable to many other types of tasks. It turns out that many tasks are structurally similar to programming tasks. However, for certain specific task types to perform optimally, we still need to build customized execution frameworks on top of Claude Code, such as for research, security analysis, agent team collaboration, or code review.

Workflows allow you to dynamically create execution frameworks, enabling Claude to solve the aforementioned problems, and more, more natively within Claude Code itself. You can also share and reuse these workflows with others.

In this article, I'll share my initial experiences and insights using workflows to help you leverage their capabilities more fully.

It should be noted, however, that best practices are still emerging. Dynamic workflows typically consume more tokens, so you need to carefully consider when and how to use them.

Note: This article is also published on the Claude Blog.

Example Prompts

Before diving into technical details, I'd like to provide some example prompts to help you understand the possibilities with workflows:

"This test fails approximately once every 50 runs. Set up a workflow to reproduce it, formulate hypotheses, and conduct adversarial testing across different worktrees. /goal Do not stop until one hypothesis is validated."

"Use a workflow to review my last 50 sessions, extract recurring corrections I've made, and convert these persistent issues into CLAUDE.md rules."

"Use a workflow to examine the past six months of the #incidents channel in Slack and identify recurring root causes that no one filed tickets for."

"Run my business plan through a workflow, having different agents critique it from the perspectives of an investor, a customer, and a competitor."

"Here is a folder with 80 resumes. Use a workflow to rank them according to backend role requirements and double-check the top ten. Use the AskUserQuestion tool to query me to help you establish evaluation criteria."

"I need to name this CLI tool. Use a workflow to brainstorm a batch of options, then select the top three through a tournament mechanism."

"Use a workflow to rename our User model to Account everywhere."

"Read my blog draft and use a workflow to verify every technical claim against the codebase. I don't want to publish anything incorrect."

How Dynamic Workflows Work

A dynamic workflow executes a JavaScript file containing special functions for generating and coordinating sub-agents.

Dynamic workflows also include standard JavaScript functions like JSON, Math, and Array for data manipulation.

Notably, dynamic workflows can decide which model a particular agent uses and whether a sub-agent runs in its own worktree. This allows Claude to autonomously select the required level of intelligence and isolation based on task needs.

If a workflow is interrupted—for example, by a manual user action or terminal exit—it can resume execution from the point of interruption when the session is restored.

Why Dynamic Workflows are Needed

When you have Claude Code's default execution framework handle a task, it needs to perform both planning and execution within the same context window. While this is very effective for many programming tasks, it can sometimes fail on long-running, massively parallel, or highly structured adversarial tasks.

The reason is that the longer Claude works on a complex task within a single context window, the more prone it becomes to several specific failure modes:

Agentic laziness: This occurs when Claude stops prematurely on particularly complex, multi-part tasks, declaring the task complete after only partial progress. For example, processing only 20 out of 50 items in a security audit and announcing completion.

Self-preferential bias: Claude tends to prefer its own results or findings, especially when asked to verify or judge its own output against some evaluation criteria.

Goal drift: Over multiple rounds of execution, Claude's fidelity to the original goal gradually declines, particularly after context compression. Each summarization incurs information loss, and specific details like edge cases or "don't do X" constraints can be lost.

Creating a workflow helps mitigate these issues by orchestrating multiple independent Claude instances, each with its own context window, focused on isolated, well-defined tasks.

Dynamic Workflows vs. Static Workflows

You may have previously created static workflows using the Claude Agent SDK or claude -p to coordinate multiple Claude Code instances.

However, because static workflows need to cover various edge cases, they tend to be more generic. With the advent of Claude Opus 4.8 and dynamic workflows, Claude is now intelligent enough to write a tailored execution framework for your specific use case.

Practical Patterns When Using Dynamic Workflows

You can directly ask Claude to create a dynamic workflow, or use the trigger word "ultracode" to ensure Claude Code creates a workflow.

However, if you build a mental model of how dynamic workflows operate, it's easier to judge when to use them and to guide Claude via prompts.

When constructing workflows, Claude commonly uses and combines the following patterns:

Classify & Execute: Use a classification agent to determine the task type, then route to different agents or behaviors based on that type. A classifier can also be used at the end of the process to judge the output.

Fan-out & Synthesize: Split a task into multiple smaller steps, have each step handled by an agent, and finally synthesize the results. This is particularly suitable for tasks with numerous small steps or where each step needs a clean context window to avoid interference or cross-contamination. The synthesis step acts as a "barrier": it waits for all fanned-out agents to finish, then merges their structured outputs into a single result.

Adversarial Verification: For each generated output, run an independent agent to adversarially verify it against a set of evaluation criteria or guidelines.

Generate & Filter: Generate a large number of ideas around a theme, then filter them based on evaluation criteria or a verification process, removing duplicates and returning only the highest-quality, tested ideas.

Tournament: Instead of splitting the work, have agents compete. Generate N agents, each attempting to complete the same task using different methods. Then, a prompt or model-driven reviewing agent compares the results pairwise until a winner emerges.

Loop Until Done: For tasks with unknown workload, instead of a fixed number of rounds, cycle through generating agents until a stop condition is met, such as no new discoveries or errors in the logs.

Use Cases

You can think more creatively about when and how to have Claude Code create dynamic workflows. I've found workflows can sometimes be even more useful for non-technical work.

Migration & Refactoring

Bun used workflows for its rewrite from Zig to Rust. You can read Jarred's post on X for details.

The key is to split the task into a series of steps to process, like call sites, failing tests, modules, etc. Launch a sub-agent for each fix in a worktree to complete the repair; then have another agent perform an adversarial review before merging results. You might consider explicitly telling agents not to use overly resource-intensive commands, maximizing parallelism without exhausting local machine resources.

Deep Research

We released a deep research skill (/deep-research) in Claude Code, which uses dynamic workflows. Specifically, it fans out to perform web searches, scrape sources, adversarially verify relevant claims, and synthesize a referenced report.

But this kind of research isn't limited to web searches. For example, you could have Claude compile a status report from Slack context or explore the codebase deeply to study how a feature works.

Deep Verification

Conversely, if you have a report and want to fact-check every factual claim and source cited, generate a workflow: first, an agent identifies all factual claims; then, launch a sub-agent for each claim to meticulously verify it. You can also have a verification agent check the sourcing sub-agents to ensure their source quality is high enough.

Ranking

You might have a set of items you want to rank by some qualitative metric, and you believe Claude Code is good at evaluating that metric. For example, ranking support tickets by bug severity.

But if you try to rank 1000+ lines in a single prompt, quality degrades, and it might not fit the context window. It's better to run a tournament, building a pipeline of pairwise comparison agents because comparative judgments are often more reliable than absolute scoring; or perform parallel bucket sorting first, then merge results. Each comparison is done by an independent agent, so a deterministic loop can maintain the tournament structure, with only the current running order needing to stay in context.

Memory & Rule Adherence

If you have a set of specific rules that Claude often misses or fails to execute well, even when seeing them in CLAUDE.md, create a workflow listing these rules and have verification agents check them one by one—one verifier per rule. Creating a sub-agent with a "skeptic" persona to review whether these rules are sensible can also help avoid excessive false positives.

Conversely: mine your recent sessions and code review comments to find corrections you repeatedly make; have parallel agents cluster these issues; then adversarially validate each candidate rule to judge if it genuinely would have prevented a real mistake; finally, distill the surviving rules back into CLAUDE.md.

Root Cause Investigation

The most effective debugging involves generating several independent hypotheses and testing each. But if you use only one context window, Claude may fall prey to self-preferential bias.

Workflows can structurally prevent this: they can launch multiple agents to generate hypotheses based on non-overlapping evidence. For example, have different agents look at logs, files, and data separately. Then, each hypothesis can be scrutinized by a set of verifiers and refuters.

This isn't just for code. Workflows can also be used for sales analysis, e.g., "Why did March sales drop?"; for data engineering, e.g., "Why did this pipeline fail?"; or for any post-mortem.

Large-Scale Triage

Every team has support queues, bug reports, or other backlogs that can't be fully handled by humans. A triage workflow can classify each item, deduplicate against tracked issues, and take action. This could mean attempting a fix or escalating to a human user.

For triage workflows, a useful pattern is quarantine. That is, forbid agents reading untrusted public content from performing high-privilege actions; high-privilege actions should be done by dedicated action-taking agents.

You can pair triage workflows with /loop for continuous execution of such tasks.

Exploration & Taste Judgment

Workflows are useful when you need to explore different solution paths, especially for tasks involving aesthetic judgment like design or naming, and can benefit from a set of evaluation criteria.

You can have Claude explore numerous options and give a reviewing agent criteria for "what a good solution looks like." The task is done when the reviewing agent deems the result meets the criteria. Different options can also be ranked or filtered via a tournament based on these criteria.

Evals (Evaluations)

You can run lightweight evals for specific tasks by launching independent agents in worktrees and then comparison agents to compare and score outputs against evaluation criteria. For example, you can evaluate and improve a skill you created against specific standards.

Model & Intelligence Routing: You can create a classification agent tuned for your tasks to decide which model to use. This is useful when tasks involve many tool calls and doing research beforehand can help identify the most suitable model.

For example, for the task "explain how the auth module works," the best model depends on how many files are in the auth module and the codebase structure. The classification agent can do this research first, then route the task to Sonnet or Opus based on expected complexity.

When Not to Use Dynamic Workflows

Workflows are still new. While they can deliver far better results in many use cases, not every task needs them, and they can significantly increase token consumption.

It's best to use workflows on tasks that expand Claude Code's capabilities in new ways. For routine programming tasks, ask yourself: does this task really need more compute? For example, most traditional programming tasks don't need a panel of 5 reviewers.

Tips for Building Dynamic Workflows

Prompt Design

When writing prompts for dynamic workflows, more detail usually yields better results, especially using the specific techniques mentioned above.

Workflows aren't only for large tasks. You can also prompt the model to use a "quick workflow." For instance, you could create a quick adversarial review process to check a hypothesis.

Combine with /goal and /loop

When using repeatable workflows like triage, research, or verification workflows, you can pair them with /loop to run at fixed intervals, and /goal to set hard completion requirements.

Token Usage Budget

You can set explicit token usage budgets for dynamic workflows to limit token consumption. You can write something like "use 10k tokens" in the prompt to set a 10k token cap.

Saving & Sharing Dynamic Workflows

You can save workflows by pressing 's' in the workflow menu. You can commit them to ~/.claude/workflows or distribute them via skills.

To share them via a skill, place the JavaScript workflow file in the skill folder and reference it in SKILL.md. For greater flexibility, you can also prompt Claude to treat workflows in a skill as templates rather than scripts to be run verbatim.

A Whole New World

Workflows are a useful new way to extend Claude Code. I encourage you to see them as a starting point. There's much more to explore on how best to use them. Please share your findings with us.

Thariq Shihipar and Sid Bidasaria (@sidbid) are members of the Anthropic technical team working on Claude Code.

Trending Cryptos

Related Questions

QWhat is the core value of the dynamic workflows introduced by Claude Code?

AThe core value is enabling Claude to dynamically generate an execution framework for complex tasks: breaking down tasks, dispatching sub-agents, parallel processing, cross-validation, iterative cycles, and even making different agents compete, before synthesizing the results.

QWhat common issues in long-running tasks does the dynamic workflow aim to solve?

AIt aims to solve agentic laziness (stopping prematurely), self-preferential bias (favoring its own conclusions), and goal drift (losing track of the original goal over multiple rounds of execution).

QName one practical pattern mentioned for building dynamic workflows and briefly describe it.

AFan-out and Merge: It splits a task into multiple smaller steps, each handled by a separate agent in its own clean context, and then merges their structured outputs into a final result.

QAccording to the article, what is a significant non-technical use case for dynamic workflows?

ADeep research, such as generating a status report from Slack context or investigating how a feature works by deeply exploring the codebase, is a significant non-technical use case.

QWhat is one key consideration or limitation when deciding to use a dynamic workflow?

ADynamic workflows typically consume more tokens and may not be necessary or efficient for every routine coding task. They are best used to extend Claude Code's capabilities for complex, structured problems.

Related Reads

Wall Street's Most Famous 'Cassandra' Now Has His Sights Set on Nvidia

Michael Burry, the famed "Big Short" investor, has once again captured Wall Street's attention with a series of short positions against major tech and semiconductor stocks, most notably Nvidia. In late June and July, through his "Cassandra Unchained" newsletter, Burry disclosed short bets against Nvidia, Tesla, Applied Materials, Caterpillar, the SOXX semiconductor ETF, and later, Micron Technology. His core thesis revolves around potential distortions in the AI infrastructure boom, specifically questioning whether extended depreciation schedules (e.g., 6 years vs. a realistic 2-3 years for AI chips) by cloud giants like Microsoft and Google artificially inflate profits. He also raises concerns about possible "off-balance-sheet circular financing," where chip demand might be propped up by vendor-backed funding to clients. Nvidia's stock experienced volatility following these disclosures, briefly dipping but largely holding near Burry's reported entry points, leaving his positions roughly flat or slightly underwater as of late July. This move is part of a pattern for Burry, whose track record since his legendary 2008 bet is mixed. He has faced notable losses, such as on Tesla in 2021, while scoring on broader market turns like the 2020 pandemic crash. His methodology focuses intensely on free cash flow and scrutinizing original financial documents to spot overvaluation and structural risks, but it often struggles with timing the market. The article contrasts Burry's stance with other prominent investors. Steve Eisman, another "Big Short" figure, is not shorting Nvidia, citing strong fundamentals but expressing nervousness about sustainability. Jim Chanos agrees with the broad "accounting mismatch" concern—comparing it to the dot-com bubble—but targets financial leverage in private equity firms rather than the chip stocks themselves. While Nvidia's short interest remains relatively low at 1.3-1.4% of float, the massive stock size means absolute short losses have been significant, exceeding $5 billion earlier this year. The piece concludes that for ordinary investors, the key takeaway is not replicating specific short bets but learning from the critical frameworks these investors use: questioning rosy accounting, identifying structural vulnerabilities, and maintaining skepticism during market euphoria, even if pinpointing the exact catalyst for a downturn remains elusive.

marsbit23m ago

Wall Street's Most Famous 'Cassandra' Now Has His Sights Set on Nvidia

marsbit23m ago

Weekly Selection丨Epic Stock Market Volatility, Changxin Tech's IPO Reshapes Storage Landscape, Saylor Aims to Re-Anchor STRC Around September 8th

PANews Weekly Digest: Market Turmoil, Tech Breakthroughs, and Crypto Developments. The week saw significant volatility across global markets. South Korea's KOSPI index experienced extreme turbulence, including multiple trading halts, largely driven by sharp declines in AI hardware stocks like SK Hynix. In contrast, China's Changxin Xinqiao (CXC) achieved a landmark IPO with a market cap surpassing 4 trillion yuan, marking a major success for the domestic DRAM industry after a decade of losses. In the crypto and Web3 space, several key narratives emerged. AI is driving demand for new infrastructure, with projects like AI agent wallets and programmable payments gaining traction, attracting interest from firms like Coinbase. The Bitcoin mining sector is pivoting, with companies like MARA focusing on energy management as electricity becomes a core AI-era asset. Meanwhile, the RWA (Real World Assets) sector faces a "utilization puzzle," with hundreds of billions in on-chain assets remaining dormant. Notable market movements included a historic single-day surge of over 17% for the KOSPI index and a significant migration of $16.5 billion in staked ETH within the Lido ecosystem. Michael Saylor announced a target to re-peg the STRC stablecoin around September 8th. Other highlights include discussions on Ethereum's ambitious 2030 roadmap for scaling and privacy, analysis showing high protocol revenues not always translating to token price gains, and warnings from Citi about potential extreme commodity price shocks by late 2026.

marsbit28m ago

Weekly Selection丨Epic Stock Market Volatility, Changxin Tech's IPO Reshapes Storage Landscape, Saylor Aims to Re-Anchor STRC Around September 8th

marsbit28m ago

When the Market Begins to Question AI Capex: A Full Analysis of Q2 Earnings Reports from Five Tech Giants

In late July 2026, five major US tech giants—Alphabet, Intel, Microsoft, Meta, and Apple—released their Q2 earnings reports. While all companies exceeded revenue and profit expectations, driven by strong AI-related business growth, investor reactions diverged sharply due to concerns over escalating AI capital expenditures (capex) and their impact on free cash flow. Alphabet reported strong revenue growth and a surging cloud business, but its stock fell after announcing a doubled year-on-year capex and negative quarterly free cash flow for the first time. Intel posted its strongest revenue growth in over 15 years, but its stock experienced volatile trading after significantly raising its full-year capex guidance. Microsoft saw its stock surge after beating estimates and, crucially, lowering its capex forecast while projecting positive free cash flow. Meta faced the most severe sell-off as its profits declined despite revenue beats, with free cash flow plunging over 90% and its capex guidance raised. Apple reported record June-quarter results, but its stock plummeted after providing Q4 revenue guidance that fell short of expectations, citing supply chain constraints and forex headwinds. The overall takeaway is that the market's focus has shifted from validating AI demand to scrutinizing the timeline for returns on massive AI investments. Companies demonstrating a clearer path to managing capex and preserving free cash flow, like Microsoft, were rewarded, while those signaling continued aggressive spending faced investor skepticism.

Odaily星球日报37m ago

When the Market Begins to Question AI Capex: A Full Analysis of Q2 Earnings Reports from Five Tech Giants

Odaily星球日报37m ago

a16z: From Companies to DAOs, DUNA May Become the Next Generation Organizational Form

This article, "From Companies to DAOs: How DUNA Could Become the Next Organizational Form," traces the 500-year evolution of business collaboration. It begins with medieval structures like the *commenda* and Florentine *compagnia*, which exposed partners to personal risk. The modern corporation, exemplified by the Dutch East India Company (VOC), was a revolutionary leap, enabling large-scale, capital-intensive ventures by offering limited liability and reducing coordination costs. However, corporations introduced new challenges like principal-agent problems and bureaucratic overhead. The piece argues that software and internet-native protocols are now reducing these traditional overheads. Decentralized Autonomous Organizations (DAOs) emerged as a new model for coordination without centralized management. Yet, DAOs face a significant legal vacuum: they lack legal recognition, leaving members exposed to unlimited personal liability, and their tokens are vulnerable to being classified as securities under unclear regulations (e.g., the Howey Test). This has forced projects into suboptimal workarounds like offshore foundations. The article identifies the Decentralized Unincorporated Nonprofit Association (DUNA) as a potential solution. Recently legalized in states like Wyoming, the DUNA provides a legal wrapper for decentralized networks. It grants key protections—legal personality, limited liability, and perpetual existence—to a group without imposing a traditional hierarchical management structure. This allows token-holder communities to govern, hold assets, and contract as a single legal entity, aligning with their decentralized nature. While DUNA doesn't solve all governance challenges or magically resolve securities law questions, it represents a crucial step. It fills the legal recognition gap, offering a native legal form for internet-scale, decentralized collaboration and extending the separation of personal risk from organizational venture into a new domain.

marsbit1h ago

a16z: From Companies to DAOs, DUNA May Become the Next Generation Organizational Form

marsbit1h ago

2026 Mid-Year Report On-Chain RWA: Tokenized Stock Market Cap Doubles in a Year, But 90% of Rights Are Hollow Shells

The 2026 Mid-Year Report on On-Chain RWA highlights a significant growth in tokenized stock market capitalization, which nearly doubled from $951 million in March to $1.89 billion by July. However, the report reveals a fundamental contradiction in this "layer 2.5" ecosystem: products with the strongest legal foundation (like regulated U.S. infrastructure) lack liquidity and distribution, while freely tradable offshored wrapper products often lack substantive ownership rights. The increase is driven largely by a few products (SECZ, FGRS, STRCx) and platforms (Ondo, xStocks, Securitize collectively hold over 85% share). While distributed value across networks like Ethereum, Solana, and BNB Chain has grown, the market remains fragmented. Products referencing the same underlying asset (e.g., Apple stock) are distinct legal liabilities with different intermediaries and jurisdictional rules, offering varying degrees of legal claim. The report cautions that headline numbers are misleading, as they reflect changes in distributed token value—driven by issuance, conversions, and price movements—not pure investor inflows. True "canonical shares" with legal ownership, wide wallet distribution, institutional liquidity, and independent on-chain price discovery do not yet exist at scale. Tokenized treasuries show stronger product-market fit, and ETFs may be easier to scale than single stocks. The core takeaway is a trade-off: legal certainty versus liquidity and composability.

marsbit2h ago

2026 Mid-Year Report On-Chain RWA: Tokenized Stock Market Cap Doubles in a Year, But 90% of Rights Are Hollow Shells

marsbit2h ago

Trading

Spot

Hot Articles

Discussions

Welcome to the HTX Community. Here, you can stay informed about the latest platform developments and gain access to professional market insights. Users' opinions on the price of AI (AI) are presented below.

活动图片