Перейти к содержимому

Паттерн сбора информации

Сбор информации об окружении агента, предпочтениях пользователя или конфигурации проекта перед продолжением workflow. Это позволяет использовать условное поведение на последующих шагах.

[start] → [collect-info] → [route-by-info] → [branch-a | branch-b]
{
"type": "agent-directive",
"id": "collect-info",
"directive": "Determine agent capabilities:\n- File system access?\n- Web fetch access?\n- Test framework?",
"inputSchema": {
"type": "object",
"properties": {
"has_file_access": { "type": "boolean" },
"has_web_access": { "type": "boolean" },
"test_framework": { "type": "string" }
},
"required": ["has_file_access", "has_web_access"]
},
"connections": { "success": "route-by-capabilities" }
}
{
"type": "condition",
"id": "route-by-capabilities",
"condition": {
"operator": "eq",
"left": { "contextPath": "has_file_access" },
"right": true
},
"connections": {
"true": "file-based-flow",
"false": "memory-based-flow"
}
}

После сбора значения находятся в контексте. Используйте их с условными шаблонами:

{
"directive": "{{#if has_file_access}}Save to {{output_path}}{{else}}Store in context variable{{/if}}"
}

Из development-flow.json:

{
"type": "agent-directive",
"id": "get-initial-requirements",
"directive": "Study project and collect ALL information for development.\n\n1) Find CLAUDE.md or similar agent instructions\n2) Determine test command (npm test, pytest, etc.)\n3) Check for project checklist\n4) Check for agent onboarding document\n...",
"inputSchema": {
"properties": {
"test_command": { "type": "string" },
"has_tests": { "type": "string", "enum": ["yes", "no"] },
"build_command": { "type": "string" },
"checklist_path": { "type": "string" },
"has_checklist": { "type": "string", "enum": ["yes", "no"] },
"has_browser_ui": { "type": "string", "enum": ["yes", "no"] }
},
"required": ["test_command", "has_tests", "build_command", "has_checklist"]
}
}