Login
Back to Blog
EnglishAI Coding

Claude Code Dynamic Workflows, Rebuilt: A Practical Ultracode-Style Orchestration Template

Dynamic workflows in Claude Code are trending because they turn one prompt into orchestration, subagents, and verification gates. We rebuilt the useful pattern as a reproducible local workflow with model routing through Crazyrouter.

C
Crazyrouter Team
June 3, 2026 / 58 views
Share:
Claude Code Dynamic Workflows, Rebuilt: A Practical Ultracode-Style Orchestration Template

Claude Code Dynamic Workflows, Rebuilt: A Practical Ultracode-Style Orchestration Template#

Claude Code Dynamic Workflows and ultracode are getting attention because they change the shape of AI coding work.

Instead of asking one agent to do everything in one long conversation, the workflow pattern looks more like this:

  1. detect that a task is complex;
  2. write an orchestration plan;
  3. split the work into scoped packets;
  4. assign subagents or roles;
  5. require review and verification gates;
  6. keep trace evidence for what happened.

The important part is not the brand name. The important part is the orchestration pattern.

So we rebuilt the useful part locally as a reproducible template that works with an OpenAI-compatible model gateway like Crazyrouter.

Dynamic workflow score and latency chart

Why dynamic workflows are different#

A normal AI coding session is linear:

text
human prompt -> agent edits files -> human checks result

A dynamic workflow is closer to:

text
human goal
  -> planner packet
  -> implementer packet
  -> adversarial reviewer packet
  -> verifier packet
  -> trace log + go/no-go

That structure matters because complex coding tasks fail when everything is mixed together:

  • planning gets confused with implementation;
  • implementation gets reviewed by the same assumptions that created it;
  • tests are mentioned but not actually run;
  • the developer cannot tell what happened after a long agent session;
  • token usage explodes without a routing policy.

The local reproduction#

We created a small tool:

text
tools/agent_workflows/workflow_orchestrator.py

It creates a dynamic-workflow folder with role packets, verification gates, and trace logging.

Example:

bash
python tools/agent_workflows/workflow_orchestrator.py \
  --title "Claude Code Dynamic Workflows ultracode reproduction" \
  --task "Reproduce the useful part of Claude Code Dynamic Workflows / ultracode: split a complex coding request into scoped packets, assign model routes, require adversarial review, and verify with evidence." \
  --out generated/dynamic_workflows_20260603/ultracode_reproduction

Generated output:

text
ultracode_reproduction/
├── README.md
├── workflow.json
├── trace.jsonl
├── verify.sh
├── article_notes.md
└── packets/
    ├── 01-planner.md
    ├── 02-implementer.md
    ├── 03-adversarial-reviewer.md
    └── 04-verifier.md

This is not trying to clone Claude Code internals. It reproduces the workflow primitive in a way that is portable, inspectable, and publishable.

The four-packet workflow#

PacketRoleSuggested model routeCompletion gate
PlannerConvert request into scope, risks, acceptance criteria, file-level planclaude-opus-4-7Plan lists affected files, risks, tests, rollback
ImplementerApply the smallest safe patchcoding-optimized modelPatch maps to acceptance criteria
Adversarial reviewerChallenge assumptions, security, edge cases, testsalternate reviewer model, e.g. claude-opus-4-8Returns approve / request changes / block
VerifierRun tests or inspect evidencefast summary modelProduces command output or direct inspection notes

The point is role separation. The model that implements should not be the only model that reviews.

Crazyrouter model routing setup#

When model calls are needed, use one OpenAI-compatible base URL and switch only the model ID.

python
from openai import OpenAI

client = OpenAI(
    api_key="YOUR_CRAZYROUTER_API_KEY",
    base_url="https://cn.crazyrouter.com/v1"
)

planner = client.chat.completions.create(
    model="claude-opus-4-7",
    messages=[{"role": "user", "content": "Create a scoped implementation plan with risks and tests."}],
    temperature=0
)

reviewer = client.chat.completions.create(
    model="claude-opus-4-8",
    messages=[{"role": "user", "content": "Adversarially review this plan. Return approve, request-changes, or block."}],
    temperature=0
)

Keep API endpoints clean. Do not add UTM parameters to base_url.

Correct:

text
https://cn.crazyrouter.com/v1

Wrong:

text
https://cn.crazyrouter.com/v1?utm_source=blog

Why ultracode-style workflows can get expensive#

Dynamic workflows can fan out. A single request may create many sub-tasks, and each sub-task may ask for context, write code, review code, and run verification.

That is powerful, but it needs budget control.

A good workflow should log:

FieldWhy it matters
roleplanner / implementer / reviewer / verifier
modelmodel routing and cost attribution
latencyuser experience and bottleneck analysis
tokensusage and cost estimation
resultapprove / changes / blocked / verified
evidencetests, screenshots, logs, URLs

We also created:

text
tools/agent_workflows/agent_trace_logger.py

Example trace summary:

text
By model:
- claude-opus-4-7: calls=1, avg_latency=7.46s, total_tokens=1800
- claude-opus-4-8: calls=1, avg_latency=4.59s, total_tokens=1500

Dynamic workflow test matrix

A practical routing policy#

For teams using AI coding agents, start simple:

Workflow stepRouting rule
Planningstronger reasoning model, low temperature
Implementationcoding-specialized or cost-balanced model
Reviewdifferent model from implementer
Verification summaryfast/cheap model only after tests run
High-risk changesrequire human approval before merge

The mistake is using the most expensive model for every step. The other mistake is using the cheapest model for steps where failure is expensive.

A gateway lets you route by step.

What we shipped#

For this reproduction, we created:

  • tools/agent_workflows/workflow_orchestrator.py
  • tools/agent_workflows/agent_packetizer.py
  • tools/agent_workflows/agent_trace_logger.py
  • generated/dynamic_workflows_20260603/ultracode_reproduction/
  • growth_ops/codex_claude_search_report_20260603.md
  • growth_ops/twitter_codex_claude_cases.md

This turns a trending workflow idea into reusable operating infrastructure.

FAQ#

Is this the same as Claude Code Dynamic Workflows?#

No. It is a local reproduction of the useful workflow pattern: orchestration, packets, review, verification, and trace logging.

Why not just use one agent?#

One agent is fine for small tasks. For complex tasks, role separation catches more mistakes and creates better evidence.

Why use Crazyrouter here?#

Crazyrouter provides an OpenAI-compatible API gateway so each workflow step can route to a different model without rewriting client code.

Should every task use dynamic workflows?#

No. Use them for multi-file changes, migrations, security-sensitive edits, large refactors, or tasks where review evidence matters.

What is the next improvement?#

The next step is to connect the orchestrator to real model calls, collect token/latency data automatically, and compare routing policies.

Final take#

Dynamic workflows are not magic. They are structured orchestration.

The winning pattern is:

text
plan -> implement -> adversarial review -> verify -> log evidence

If you combine that with model routing, you get something more useful than a single long AI coding chat: a measurable engineering workflow.

Try the API gateway here: Crazyrouter

Implementation Guides

Related Posts

Background Coding Agents Without Lock-In: Recreating the Cursor Pattern with Git WorktreesAI Coding

Background Coding Agents Without Lock-In: Recreating the Cursor Pattern with Git Worktrees

Cursor background agents are useful because they move long-running AI coding work out of your local single-branch loop. This guide rebuilds the same workflow pattern with plain git worktrees, task packets, trace logs, and Crazyrouter model routing.

Jun 4
Same Agent Workflow, Three Model Routes: A Real Crazyrouter BenchmarkAI Coding

Same Agent Workflow, Three Model Routes: A Real Crazyrouter Benchmark

We ran the same four-step AI coding workflow through three routing policies: all Claude Opus 4.7, all Claude Opus 4.8, and a mixed 4.7/4.8 route. The result shows why dynamic workflows need model routing and trace logs, not vibes.

Jun 3
"Claude Plans, Codex Reviews: Rebuilding the Viral Two-Agent Coding Workflow with Crazyrouter"AI Coding

"Claude Plans, Codex Reviews: Rebuilding the Viral Two-Agent Coding Workflow with Crazyrouter"

"Twitter is full of Codex-in-Claude-Code workflows. We rebuilt the useful part: one agent plans or implements, a second agent reviews adversarially, and the whole process becomes reproducible packets instead of copy-paste chaos."

Jun 3
Claude Code Skills vs Subagents vs Dynamic Workflows: Which One Should You Use?AI Coding

Claude Code Skills vs Subagents vs Dynamic Workflows: Which One Should You Use?

Claude Code, Codex, Cursor, and modern AI coding tools now expose multiple workflow primitives: skills, subagents, background agents, and dynamic workflows. This guide explains when to use each, with a small selector tool and Crazyrouter model-routing examples.

Jun 3
GPT-5.2 vs Claude Opus 4.6 vs Gemini 3 Pro: Ultimate AI Model Comparison 2026Comparison

GPT-5.2 vs Claude Opus 4.6 vs Gemini 3 Pro: Ultimate AI Model Comparison 2026

"Head-to-head comparison of the three most powerful AI models in 2026. Benchmarks, pricing, API features, and which one to choose for your project."

Feb 26
Crazyrouter Codex CLI: Use Codex with One API Key and an OpenAI-Compatible GatewayTutorial

Crazyrouter Codex CLI: Use Codex with One API Key and an OpenAI-Compatible Gateway

Set up OpenAI Codex CLI through Crazyrouter with one command on Windows, macOS, and Linux. Use an OpenAI-compatible base URL, one API key, and model routing for GPT, Claude, Gemini, DeepSeek, and Qwen-style workflows.

Jun 4