Skip to content

Gathers essential project context from documentation files

<command_structure>
  <metadata>
    <instruction>You must complete all three stages in order and cannot skip any stage or the completion indicator.</instruction>
  </metadata>

  <preparation_stage>
    <description>Before you begin any work, you must validate that you have sufficient context and resources</description>
    <requirements>
      <requirement_list>
        <requirement>ai_docs/ directory exists and is accessible</requirement>
        <requirement>ai_specs/ directory exists and is accessible</requirement>
        <requirement>Read permissions for documentation files</requirement>
        <requirement>ai_docs/README.md file exists and is readable</requirement>
        <requirement>ai_specs/README.md file exists and is readable</requirement>
      </requirement_list>
    </requirements>
    <critical_validation>
      <condition>If ANY requirement fails, immediately stop and respond with:</condition>
      <error_response>ERROR: Insufficient context - missing [specific requirement]. Please ensure ai_docs/ and ai_specs/ directories exist with README.md files.</error_response>
      <instruction>Do not proceed to execution. Only continue if you can confirm you have everything needed.</instruction>
    </critical_validation>
  </preparation_stage>

  <execution_stage>
    <success_criteria>Complete project context gathered from required documentation files with optional architecture files read if available</success_criteria>
    <error_handling>
      <policy>IF any step fails:</policy>
      <steps>
        <step>Log error with specific file reading component that failed</step>
        <step>Attempt retry once with alternative file access approach</step>
        <step>If still failing, mark that documentation source as UNAVAILABLE and continue to next file</step>
      </steps>
    </error_handling>
    <sub-agents>
      <agent>Core Documentation Reader Agent: Read ai_docs/README.md and ai_specs/README.md for project management and feature development context</agent>
      <agent>Architecture Documentation Agent: Check for and read optional files ai_specs/prd.md and ai_specs/architecture.md</agent>
      <agent>Context Analysis Agent: Analyze gathered documentation to understand project structure, development processes, and technical specifications</agent>
      <agent>Context Summary Agent: Synthesize all documentation into comprehensive project understanding</agent>
    </sub-agents>
    <execution_steps>
      <instruction>Execute these steps in exact order:</instruction>
      <step_list>
        <step>Initialize specialized sub-agents for documentation reading and analysis</step>
        <step>Execute core documentation reading for required README files</step>
        <step>Check for and read optional architecture documentation files</step>
        <step>Synthesize sub-agent outputs into complete project context understanding</step>
      </step_list>
    </execution_steps>
  </execution_stage>

  <resolution_stage>
    <description>Analyze the complete execution:</description>
    <validation_areas>
      <area>Verify all required documentation files were successfully read</area>
      <area>Confirm project management and feature development context was gathered</area>
      <area>Check that optional architecture files were attempted and noted if unavailable</area>
      <area>Validate comprehensive understanding of project structure and development processes</area>
      <area>Ensure context is sufficient for informed development work</area>
    </validation_areas>
    <completion_indicator>
      <format>Always end with:</format>
      <template>
        FLOW COMPLETE:  execution finished - Status: [SUCCESS/PARTIAL/FAILED] - Timestamp: [completion time]
        [Summary of execution and outcomes]
      </template>
    </completion_indicator>
  </resolution_stage>
</command_structure>