Skip to content

Discovers and executes Unity Bridge communication tool

<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>User home directory is accessible for tool discovery</requirement>
        <requirement>Read and execute permissions for checking script files</requirement>
        <requirement>Understanding of Unity Bridge tool location patterns</requirement>
        <requirement>Command arguments are provided if script execution is required</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 file system access is available for Unity Bridge tool discovery.</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>Unity Bridge tool successfully discovered, validated, and executed with proper command arguments and output capture</success_criteria>
    <error_handling>
      <policy>IF any step fails:</policy>
      <steps>
        <step>Log error with specific discovery or execution component that failed</step>
        <step>Attempt retry once with alternative tool location search</step>
        <step>If still failing, provide clear error message with expected tool location and mark as INCOMPLETE</step>
      </steps>
    </error_handling>
    <sub-agents>
      <agent>Tool Discovery Agent: Search for unity_bridge.sh in expected locations and validate accessibility</agent>
      <agent>Tool Validation Agent: Verify script permissions, integrity, and executable status</agent>
      <agent>Tool Execution Agent: Execute Unity Bridge script with provided arguments and capture output</agent>
      <agent>Error Handling Agent: Provide clear feedback for tool discovery failures and execution errors</agent>
    </sub-agents>
    <execution_steps>
      <instruction>Execute these steps in exact order:</instruction>
      <step_list>
        <step>Initialize specialized sub-agents for Unity Bridge tool discovery and execution</step>
        <step>Search for unity_bridge.sh at ~/.claude/custom-scripts/unity_bridge.sh location</step>
        <step>Validate tool accessibility, permissions, and executable status</step>
        <step>Cache discovered tool location for session use</step>
        <step>Execute tool with provided arguments and capture output, or acknowledge readiness if no execution required</step>
      </step_list>
    </execution_steps>
  </execution_stage>

  <resolution_stage>
    <description>Analyze the complete execution:</description>
    <validation_areas>
      <area>Verify Unity Bridge tool was successfully discovered at expected location</area>
      <area>Confirm tool validation passed including permissions and accessibility checks</area>
      <area>Check that tool location was properly cached for future session use</area>
      <area>Validate tool execution completed successfully with proper output capture</area>
      <area>Ensure clear status messages were provided during discovery and execution process</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>