Skip to content

Analyzes directory structure for specified file extensions

<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>Target directory path MUST BE provided by the user and be accessible</requirement>
        <requirement>File extensions are specified by user (or use default .cs,.asmdef)</requirement>
        <requirement>Read permissions are available for the target directory</requirement>
        <requirement>Target directory contains files matching the specified extensions</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 provide: [list missing requirements]</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 markdown report analyzing only specified file extensions with comprehensive module identification, testing opportunities, and documentation gaps</success_criteria>
    <error_handling>
      <policy>IF any step fails:</policy>
      <steps>
        <step>Log error with specific agent responsible</step>
        <step>Attempt retry once with fallback analysis</step>
        <step>If still failing, mark that analysis section as INCOMPLETE and continue to next step</step>
      </steps>
    </error_handling>
    <sub-agents>
      <agent>Directory Walker Agent: Perform recursive traversal filtering only specified extensions</agent>
      <agent>File Analyzer Agent: Analyze individual files for purpose, complexity, and dependencies within specified extensions</agent>
      <agent>Module Identification Agent: Categorize code modules and shared components for target file types</agent>
      <agent>Test Coverage Agent: Evaluate existing test coverage and identify testing gaps for target extensions</agent>
      <agent>Documentation Agent: Assess documentation status and identify documentation needs</agent>
      <agent>Dependency Mapper Agent: Map relationships and dependencies between modules within target extensions</agent>
      <agent>Report Synthesizer Agent: Combine all findings into structured markdown report with sections for Analysis Scope, Directory Tree, Module Analysis, File Inventory, Testing Opportunities, Documentation Gaps, Recommendations, Dependencies, and Summary</agent>
    </sub-agents>
    <execution_steps>
      <instruction>Execute these steps in exact order:</instruction>
      <step_list>
        <step>Create specialized subagents for parallel analysis (Directory Walker, File Analyzer, Module Identification, Test Coverage, Documentation, Dependency Mapper, Report Synthesizer)</step>
        <step>Once all agents have returned their analysis, utilise provided information to synthesise into a final audit report in markdown report</step>
        <step>Save markdown report in the root of the working directory at the path `ai_docs/reports/<DATE>_<REPORT_NAME>.md` 
      </step_list>
    </execution_steps>
  </execution_stage>

  <resolution_stage>
    <description>Analyze the complete execution:</description>
    <validation_areas>
      <area>Verify markdown report contains all required sections</area>
      <area>Confirm analysis was properly filtered to specified extensions only</area>
      <area>Check that testing opportunities and documentation gaps are identified</area>
      <area>Validate that subagent coordination was successful</area>
      <area>Ensure final report enables follow-up testing and documentation planning</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>