Break down goals into multiple tasks and coordinate execution with gates and recovery. Based on Claw Code's agentic harness.
92
90%
Does it follow best practices?
Impact
100%
1.09xAverage score across 3 eval scenarios
Passed
No known issues
Most LLM agents work like this:
User Goal → LLM Thinks & Acts → Done (or fails)This breaks down because:
Insert clear stages between goal and outcome:
Goal → [Plan] → [Gate] → [Execute] → [Recover] → OutcomeEach stage has a single responsibility:
Before executing, show the plan. A human can catch mistakes before they become changes:
5+ interdependent steps need explicit ordering. Without it:
Different failures need different responses:
Blindly retrying everything is worse than doing nothing.
If you log every state change, you can:
No more "I don't know how we got here."
The gate stage ensures humans can intervene before execution. This is critical for:
The LLM produces a plan. That plan is reviewed. Then execution happens.
This is not "think and act". It's "think, review, then act".
Every stage transition is a named event. Gates are not silent. Users know when approval is needed.
Transient vs permanent. User error vs system error. Expected vs unexpected.
Each classification maps to a recovery strategy.
Some tasks depend on others. Make this explicit so the orchestrator enforces it.
Example dependency graph:
Task 1: Analyze requirements
↓
Task 2: Design (depends on 1)
↓
Task 3: Implement (depends on 2)
├→ Task 4: Unit test (depends on 3)
└→ Task 5: Integration test (depends on 3)
↓
Task 6: Deploy (depends on 4 and 5)Event log is ground truth. If no event was emitted, the state change didn't happen.
This pattern works with:
The core pattern is universal. Only implementation details differ.
Use it when you have multiple steps, dependencies, or need approval.
See EXAMPLES.md for real-world scenarios and edge cases.