Claude Can Now Build Its Own Harness... For Every Task
By Prompt Engineering
Key Concepts
- Dynamic Workflows: A methodology where an AI model (like Claude) generates a custom "harness" (execution environment) on the fly for a specific task, rather than forcing all tasks into a single, static coding-oriented harness.
- Agentic Laziness: A failure mode where an agent quits prematurely after completing only a portion of a task.
- Self-Preferential Bias: The tendency of an agent to grade its own work too leniently.
- Goal Drift: The phenomenon where the original objective of a task is lost or diluted as the context window becomes cluttered or compacted.
- Context Window: The limited amount of information an AI model can process at one time; exceeding this leads to performance degradation.
1. The Problem with Static Harnesses
Current coding tools (like Cloud Code or Codex) are designed for software development. When users force non-coding knowledge work into these tools, they encounter three primary failure modes:
- Agentic Laziness: The model stops working before the task is complete (e.g., finishing 35 of 50 security checks).
- Self-Preferential Bias: The model fails to objectively critique its own output.
- Goal Drift: The original instructions are forgotten as the context window fills up.
The Solution: Instead of running an entire job in one context, dynamic workflows split the job across multiple, separate, clean context windows.
2. Technical Framework of Dynamic Workflows
Dynamic workflows are implemented via JavaScript files that manage a team of agents. Key functions include:
agent: Spawns a sub-agent in a dedicated, clean context window.parallel: Executes multiple agents simultaneously and waits for all to complete.pipeline: Streams items through a sequential chain of processing stages.
These workflows allow the system to select the optimal model for each specific sub-task and provide each agent with its own "work tree," allowing for seamless resumption if interrupted.
3. Six Patterns for Custom Harnesses
Anthropic identifies six patterns for building these custom harnesses:
- Classify and Act: A classifier agent determines the task type and routes it to the appropriate specialist (e.g., a bug goes to a "fixer," a question to an "answerer").
- Fan Out and Synthesize: A task is split across many agents in separate contexts to prevent bias contamination; a final "synthesize" step merges the results.
- Critic/Adversarial Review: A worker agent produces output, while a separate "critic" agent evaluates it against a rubric. Output is only accepted if it passes the critique.
- Generate and Filter: Multiple candidates are generated and then passed through a filter (rubric or verification) to remove duplicates and keep only the best results.
- Tournament: Agents compete head-to-head. A judge compares two outputs at a time, with the winner advancing until a single champion remains. This is highly effective for sorting large datasets.
- Loop Until Done: A conditional gate checks for new findings after each pass. The process continues until no new work is identified, effectively curing agentic laziness.
4. Real-World Applications
Dynamic workflows extend beyond coding into complex operational tasks:
- Hiring: Ranking 80+ résumés using a tournament pattern.
- Strategy: Breaking down business plans into multiple analytical angles.
- Operations: Analyzing six months of Slack data to identify root causes of issues that never generated formal tickets.
- Security: Using "quarantine" patterns where agents reading untrusted content are restricted from taking direct actions.
5. Implementation and Best Practices
- Triggering: Users can trigger these workflows by using specific keywords like "workflow" or "ultra code" in their prompts.
- Cost Management: These workflows consume significant tokens. Users should cap costs within the prompt (e.g., "use only 10,000 tokens") and evaluate if a complex panel of agents is truly necessary for the task.
- Persistence: Once a custom harness is generated for a specific task, it can be saved as an artifact and reused, turning a one-time solution into a repeatable tool.
Synthesis
Dynamic workflows represent a shift from "one-size-fits-all" AI interaction to task-specific, modular execution. By utilizing patterns like tournaments, adversarial critiques, and conditional loops, users can overcome the inherent limitations of static context windows. While powerful for messy, non-coding knowledge work, users must balance the increased computational cost against the complexity of the task to ensure efficient resource usage.
Chat with this Video
AI-PoweredLoad the transcript when you're ready to chat so the initial page stays lighter.
Related Videos

You Can't Prompt the Room: The Last Skill AI Won't Replace - Balázs Horváth, VisualLabs
AI Engineer

The Future Is Domain-Specific Agents - Justin Schroeder, StandardAgents
AI Engineer

Build a multi-agent system using ADK & MCP
Google Cloud Tech

Builders Unscripted: Ep. 4 - Pietro Schirano
OpenAI

OpenAI Codex lead on the new shape of product work | Andrew Ambrosino
Lenny's Podcast

How Sakana Fugu Uses a Mixture of Models to Beat Fable 5.
The AI Automators

Turn 10,994 Notes Into Memory - Paul Iusztin, Decoding AI & Louis-François Bouchard, Towards AI
AI Engineer