Паттерн верификации шагов
Назначение
Заголовок раздела «Назначение»Гарантирует, что каждый шаг workflow действительно завершён перед переходом к следующему. Предотвращает пропуск незавершённой работы и требует доказательств выполнения.
Структура
Заголовок раздела «Структура»[execute-step] → [verify-step] → verified=yes → [next-step] → verified=no → [retry-or-escalate]Реализация
Заголовок раздела «Реализация»Нода выполнения
Заголовок раздела «Нода выполнения»{ "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" }}Нода верификации
Заголовок раздела «Нода верификации»{ "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" }}Нода проверки
Заголовок раздела «Нода проверки»{ "type": "condition", "id": "check-verification", "condition": { "operator": "eq", "left": { "contextPath": "step_verified" }, "right": "yes" }, "connections": { "true": "proceed-to-next", "false": "handle-failure" }}Требования к доказательствам
Заголовок раздела «Требования к доказательствам»Укажите, что считается доказательством:
{ "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)"}Контекстные переменные шага
Заголовок раздела «Контекстные переменные шага»Храните метаданные шага в контексте:
{ "initialData": { "current_step_index": 1, "current_step_name": "Step 1", "current_step_action": "Implement feature X", "expected_output": "Feature X works with tests passing" }}Используйте expression ноды для обновления:
{ "type": "expression", "id": "increment-step", "expressions": ["current_step_index = current_step_index + 1"]}Реальный пример
Заголовок раздела «Реальный пример»Из 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"] }}Обработка неудачной верификации
Заголовок раздела «Обработка неудачной верификации»При неудаче — повторная попытка или эскалация:
{ "type": "condition", "id": "check-retry-limit", "condition": { "operator": "lt", "left": { "contextPath": "current_iteration" }, "right": 3 }, "connections": { "true": "fix-and-retry", "false": "escalate-to-user" }}Связанные паттерны
Заголовок раздела «Связанные паттерны»- Цикл валидации - Повторные попытки при неудачной верификации
- Эскалация - Обработка повторяющихся сбоев