Skip to content

Analyzes system logs for debugging and troubleshooting

<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>System logs or console output are provided for analysis</requirement>
        <requirement>Logs contain timestamps and relevant error information</requirement>
        <requirement>Understanding of the system/platform that generated the logs</requirement>
        <requirement>Context about what operation was being performed when logs were captured</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 the system logs and context about what operation was being performed.</error_response>
      <instruction>Do not proceed to execution. Only continue if you can confirm you have everything needed. Do NOT change any files - this is analysis only.</instruction>
    </critical_validation>
  </preparation_stage>

  <execution_stage>
    <success_criteria>Comprehensive analysis report identifying root causes, contributing factors, failure propagation, and prioritized solutions</success_criteria>
    <error_handling>
      <policy>IF any step fails:</policy>
      <steps>
        <step>Log error with specific subagent analysis that failed</step>
        <step>Attempt retry once with simpler analysis approach</step>
        <step>If still failing, mark that analysis component as INCOMPLETE and continue to next subagent</step>
      </steps>
    </error_handling>
    <sub-agents>
      <agent>Chronological Flow Analyst: Trace exact sequence of events and identify where process deviates from expected flow</agent>
      <agent>Error Pattern Detective: Identify all error types, their relationships, and cascading failure chains</agent>
      <agent>State Management Auditor: Track state changes, transitions, and identify inconsistencies or race conditions</agent>
      <agent>Performance & Timing Specialist: Analyze timing issues, bottlenecks, and synchronization problems</agent>
      <agent>Integration Boundary Inspector: Examine cross-component/service communication failures</agent>
    </sub-agents>
    <execution_steps>
      <instruction>Execute these steps in exact order:</instruction>
      <step_list>
        <step>Initialize specialized sub-agents for parallel log analysis</step>
        <step>Execute sub-agent processing in coordinated sequence</step>
        <step>Wait for all subagent analyses to complete before proceeding</step>
        <step>Synthesize findings into comprehensive report covering Root Causes, Contributing Factors, Missing Events Analysis, Failure Propagation Map, and Solution Prioritization</step>
      </step_list>
    </execution_steps>
  </execution_stage>

  <resolution_stage>
    <description>Analyze the complete execution:</description>
    <validation_areas>
      <area>Verify all subagent analyses were completed and integrated</area>
      <area>Confirm root causes are clearly identified with evidence</area>
      <area>Check that failure propagation is mapped from initial issue through cascading effects</area>
      <area>Validate that solutions are prioritized by impact and implementation difficulty</area>
      <area>Ensure no files were modified (analysis only)</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>