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
Input: A goal
Output: Ordered list of concrete tasks with dependencies
Task Requirements:
| Property | Definition | Example |
|---|---|---|
| Concrete | Specific action, not vague intent | ✓ "Remove unused imports from src/main.rs" ✗ "Clean up code" |
| Testable | Pass/fail is objective | ✓ "API response < 200ms" ✗ "Make it faster" |
| Ordered | Listed in execution sequence | ✓ Task 2 (depends on Task 1) ✗ Task 1, 2, 3 (order unclear) |
| Sized | Not too large, not too small | ✓ 3-7 tasks for most goals ✗ 1 massive task or 50 tiny tasks |
Dependency Notation:
Task 1: Base layer
Task 2: Build on Task 1 (depends on Task 1)
Task 3: Parallel with Task 2 (depends on Task 1)
Task 4: Combine results (depends on Task 2, Task 3)What Makes a Bad Plan:
Input: Proposed plan
Output: Approved or modified plan
Gate Actions:
| Action | When | Example |
|---|---|---|
| Approve | Plan looks correct | "Yes, proceed" |
| Modify | Reorder, add, or remove tasks | "Move Task 2 before Task 1" |
| Request Clarification | Don't understand | "What does 'sync data' mean?" |
| Reject | Plan is wrong approach | "This won't work, try different approach" |
Gate is mandatory. Do not execute without explicit approval.
Approval Signals:
Gate Examples:
Risky operation (always gate):
Plan: Delete all old user records
Gate: [BLOCKED]
Requires: Explicit confirmation from data owner
Confirm: "Yes, delete old records from before 2020"Simple operation (still gate, but may be quick):
Plan: Fix typo in README
Gate: [APPROVED immediately]
User: "Fine"Input: Approved plan + working environment
Output: Task completions and failures
Execution Rules:
Progress Report Format (MANDATORY):
Use CLEAR NOTATION with N/M progress and completion symbols. Format is flexible:
All these formats are acceptable:
[Task 1/5] ✓ Analyze requirements: 5 key features identified
Step 2/5: Design schema (✗ failed: timeout)
Step 2/5 - Retry: Design schema (✓ succeeded)
Item 3/5 [COMPLETED] Implement models: 3 models createdKey requirements:
Why flexible formats matter:
This is the execution log — every task must appear with clear N/M progress and completion symbol.
On Error — Ask for Approval:
[Task 3/5] ✗ API integration: 403 Forbidden
What now?
- Retry this task?
- Skip and continue?
- Abort entire plan?
Waiting for approval...Input: A failure
Output: Recovery action
Failure Classification:
| Type | Characteristics | Recovery | Example |
|---|---|---|---|
| Transient | Temporary, will likely work if retried | Retry once, then escalate | Network timeout, rate limit |
| Permission | Access denied, needs approval or credentials | Ask user for help | Access denied, wrong API key |
| Invalid Input | Data is malformed or incorrect | Ask user for correction | Missing required field |
| Unrecoverable | Task no longer makes sense or is impossible | Skip or escalate | Resource was deleted |
| Logic Error | Code or approach is wrong | Fix and retry | Function returned wrong type |
Recovery Recipe Structure:
Failure Type: [name]
Detection: [how to identify]
Recovery:
1. [action]
2. [action]
3. [if still failing, escalate]Example Recipes:
Recipe: Network Timeout
Detection: "Connection timeout" or "No response after 30s"
Recovery:
1. Wait 5 seconds
2. Retry the request
3. If still fails after 2 retries, ask user: "Network unstable. Abort or try again?"Recipe: Permission Denied
Detection: "403 Forbidden" or "Access Denied"
Recovery:
1. Emit PERMISSION_REQUIRED event
2. STOP execution. Do NOT ask for credentials as text input.
3. Instruct user to set credentials via secure channels (environment variables,
config files, vaults) BEFORE resuming
4. Ask: "Credentials configured? Retry, or skip/abort?"
SECURITY NOTE: Credentials must come from secure sources (env vars, vaults,
config files), never as text input during execution. Never log or expose them.Recipe: Invalid Input
Detection: "Missing required field" or "Invalid format"
Recovery:
1. Ask user: "Field X is missing. Provide it?"
2. If provided, retry
3. If not, skip task or abortInput: All state changes
Output: Complete event log
Events to Log:
Log Format:
[Timestamp] [Event Type] [Details]
2024-01-15 14:23:45 PLAN_CREATED Tasks: 5
2024-01-15 14:24:00 GATE_APPROVED User: "yes, proceed"
2024-01-15 14:24:05 TASK_1_STARTED
2024-01-15 14:24:12 TASK_1_COMPLETED
2024-01-15 14:24:15 TASK_2_STARTED
2024-01-15 14:24:45 TASK_2_FAILED "Network timeout"
2024-01-15 14:24:47 RECOVERY_ATTEMPTED "Retry transient error"
2024-01-15 14:24:52 TASK_2_COMPLETED "Success on retry"Why Logging Matters:
Task execution fails: Connection timeout
Classification: Transient
Recovery: Retry immediately
Result: Success on retry → continueTask execution fails: 403 Forbidden
Classification: Permission
Recovery: Ask user for approval or credentials
Result: User provides credentials → retry with new auth → successPlan: Task A depends on B, Task B depends on A
Classification: Logical error in planning
Recovery: Return to planning stage, fix dependencies
Result: New plan with correct dependencies → gate approval → executeTask execution fails: "File not found"
Classification: Unrecoverable (file was deleted or moved)
Recovery: Ask user: Skip task, or abort plan?
Result: User chooses skip → continue with next taskDuring execution: User says "Actually, skip Task 3"
Classification: User-requested change
Recovery: Ask for confirmation, update plan, log the change
Result: Plan updated → continue execution