Step Verification Pattern
Purpose
Section titled “Purpose”Ensure each workflow step is truly complete before moving to the next. Prevents skipping incomplete work and requires evidence of completion.
Structure
Section titled “Structure”[execute-step] → [verify-step] → verified=yes → [next-step] → verified=no → [retry-or-escalate]Implementation
Section titled “Implementation”Execute Node
Section titled “Execute Node”{ "type": "agent-directive", "id": "execute-step", "directive": "Implement {{current_step_name}}:\n{{current_step_action}}", "completionCondition": "Step implementation complete", "inputSchema": { "type": "object", "properties": { "implementation_summary": { "type": "string" } }, "required": ["implementation_summary"] }, "connections": { "success": "verify-step" }}Verify Node
Section titled “Verify Node”{ "type": "agent-directive", "id": "verify-step", "directive": "Verify step {{current_step_name}} completed:\n- Expected: {{expected_output}}\n- Check actual result matches expected\n- Provide evidence", "inputSchema": { "type": "object", "properties": { "step_verified": { "type": "string", "enum": ["yes", "no"] }, "verification_evidence": { "type": "string" } }, "required": ["step_verified", "verification_evidence"] }, "connections": { "success": "check-verification" }}Check Node
Section titled “Check Node”{ "type": "condition", "id": "check-verification", "condition": { "operator": "eq", "left": { "contextPath": "step_verified" }, "right": "yes" }, "connections": { "true": "proceed-to-next", "false": "handle-failure" }}Evidence Requirements
Section titled “Evidence Requirements”Specify what counts as evidence:
{ "directive": "Verify implementation. Evidence must include:\n- Test command output (npm test results)\n- API response (curl output)\n- File diff (git diff)\n- Screenshot (for UI changes)"}Step Context Variables
Section titled “Step Context Variables”Store step metadata in context:
{ "initialData": { "current_step_index": 1, "current_step_name": "Step 1", "current_step_action": "Implement feature X", "expected_output": "Feature X works with tests passing" }}Use expression nodes to update:
{ "type": "expression", "id": "increment-step", "expressions": ["current_step_index = current_step_index + 1"]}Real Example
Section titled “Real Example”From development-flow.json:
{ "id": "verify-step-implementation", "directive": "Verify step {{current_step_index}} ({{current_step_name}}) implementation.\n\nExpected outcome: {{expected_outcome}}\n\nVerification checklist:\n- Functionality works as expected\n- Tests pass (if applicable)\n- No regressions introduced\n\nProvide concrete evidence for each claim.", "inputSchema": { "properties": { "step_verified": { "type": "string", "enum": ["yes", "no"] }, "verification_evidence": { "type": "string" }, "issues_found": { "type": "string" } }, "required": ["step_verified", "verification_evidence"] }}Handling Verification Failure
Section titled “Handling Verification Failure”On failure, either retry or escalate:
{ "type": "condition", "id": "check-retry-limit", "condition": { "operator": "lt", "left": { "contextPath": "current_iteration" }, "right": 3 }, "connections": { "true": "fix-and-retry", "false": "escalate-to-user" }}Related Patterns
Section titled “Related Patterns”- Validation Loop - Retry failed verifications
- Escalation - Handle repeated failures