Workflow Execution
by @levineam
Plan-first workflow for non-trivial work: plan with done criteria, create a tracking issue, package context as documents on the issue, decide where code live...
clawhub install workflow-executionπ About This Skill
name: workflow-execution description: > Plan-first workflow for non-trivial work: plan with done criteria, create a tracking issue, package context as documents on the issue, decide where code lives, hand off to an executing agent, verify completion. Use when tasks involve 3+ steps, architecture/strategy decisions, risky edits, or iterative bug-fixing.
Workflow Execution
Run this workflow for any meaningful work. The core loop: plan β track β package context β route β hand off β execute β verify.
Core Principles
Phase 1: Plan
Enter planning before acting when any trigger is true:
Plan contents
1. Goal β one sentence describing what done looks like. 2. Done criteria β explicit, checkable conditions. Not "it works" but "tests pass, PR merged, deployed." 3. Constraints β what must not break, budget limits, timeline, dependencies. 4. Failure modes β what could go wrong and how you'll detect it. 5. Ordered steps β small, each with a verification method (test, build, smoke check, log proof, diff).
Phase 2: Track
Before implementation starts, create or reference a tracking issue in your project management system.
What to do
1. Create an issue with a clear title and the goal from Phase 1.
2. Attach the plan as a document on the issue (key: plan). This is the source of truth β not a chat message, not a comment, a structured document.
3. Link to parent issues if this work is part of a larger effort.
Why documents, not descriptions
plan, design, context each have a clear role.Tracker reference implementations
This skill is tracker-agnostic. See references/ for how to do this with specific systems:
references/tracker-paperclip.md β Paperclip Issues + Documents APIreferences/tracker-github.md β GitHub Issues + issue body/commentsreferences/tracker-none.md β skip tracking, plan in a local filePhase 3: Package Context
Before handing off to an executing agent, attach structured documents to the tracking issue:
Required: plan document
The plan from Phase 1. Always attached.When applicable: design document
Attach when work involves:
When applicable: context document
Attach when the executing agent needs background that isn't obvious from the code:
Packaging principle
Ask: *"If a brand new agent picked up this issue with zero chat history, could they do the work?"* If not, add more context documents.Phase 4: Route
Before execution, decide where the code lives.
Decision criteria
| Signal | Destination | |--------|-------------| | Work extends an existing project/repo | Existing repo β branch off main | | Work is reusable, publishable, or useful to others | New repo β create it, then work there | | Work is pure local glue, config, or one-off automation | Local workspace β but document why it's local |
Routing rules
SUP-490/skill-rewrite).Phase 5: Hand Off
Spawn the executing agent with an issue reference, not inline context.
Dispatch rule
Code handoffs MUST use sessions_spawn, not sessions_send.
sessions_spawn triggers the full enforcement pipeline (Lobster gate, spawn-code-lint, post-spawn PR creation). sessions_send bypasses all of it. Use sessions_send only for non-code work: status checks, coordination, questions.
The test: if the message asks the target agent to write, edit, or move code β sessions_spawn. Everything else β sessions_send is fine.
Handoff protocol
1. The spawn message includes: the tracking issue identifier, the repo/branch to work in, and any model/thinking preferences.
2. The executing agent's first step is: read the issue, read attached documents (plan, design, context), then proceed.
3. The executing agent updates the issue as it works β comments for progress, status changes for state transitions.
Subagent strategy
Phase 6: Execute
Minimal-impact changes
Failure recovery hierarchy
When something goes wrong during execution, follow this priority order:1. Transient provider failure (429, timeout, model overload): OpenClaw's native model fallback chain handles this automatically. Do not change tracker issue status. Continue in the same session once the request succeeds.
2. Context reset or compaction: Re-read the plan, context, and design
documents from the tracking issue. Never reconstruct plan state from in-session
memory after compaction β the issue documents are the source of truth.
3. Durable blocker (missing dependency, unclear requirements, architectural gap):
Update the tracking issue status to blocked. Add a comment naming the specific
blocker and what needs to resolve it.
4. The tracker is an audit trail and coordination hub β not the place to manage transient retries. Do not flip status on transient errors, partial progress, or model fallbacks.
Autonomous bug-fix behavior (guardrailed)
When bugs appear during execution: 1. Reproduce and isolate the failing path. 2. Form the smallest plausible fix hypothesis. 3. Apply minimal-touch patch. 4. Re-run impacted checks and one nearby regression check. 5. Repeat until pass or a guardrail is hit.Stop and escalate when:
Demand elegance (balanced)
Phase 7: Verify
Do not mark complete without proof.
Evidence types
Governance
Close the loop
1. Update the tracking issue status to done. 2. Add a closing comment with verification evidence. 3. If the work produced a reusable lesson, capture it durably.Self-Correction Loop
If the correction cycle was triggered by a context reset or compaction, re-read the issue's plan, context, and design documents before resuming β do not reconstruct plan state from in-session memory.
After any correction cycle (failed check, rework, rollback):
1. Record what failed and why (brief, concrete). 2. Extract one reusable lesson/pattern. 3. Apply that lesson immediately to remaining work. 4. Capture a durable note when the lesson is broadly reusable.