{# ============================================================================ #}
{# Template: fix_mode.txt                                                       #}
{# Version: 2.0                                                                  #}
{# ============================================================================ #}
{#                                                                             #}
{# PURPOSE:                                                                    #}
{#   Prompt for fix mode to address issues found during review.                 #}
{#   Agent reads ISSUES.md and modifies source code to fix issues.              #}
{#   Includes fault tolerance for vague issue descriptions.                     #}
{#                                                                             #}
{# WHEN USED:                                                                  #}
{#   During fix mode (after review phase finds issues).                         #}
{#                                                                             #}
{# TRIGGER:                                                                    #}
{#   Pipeline runtime: fix phase when ISSUES.md exists.                         #}
{#                                                                             #}
{# VARIABLES:                                                                  #}
{#   PROMPT - Original user request from PROMPT.md (for context)                 #}
{#   PLAN   - Implementation plan from .agent/PLAN.md (for context)              #}
{#                                                                             #}
{# CONSTRAINTS:                                                                #}
{#   - Agent MUST ONLY work on files mentioned in ISSUES.md                      #}
{#   - Agent MUST NOT read other files or run commands                           #}
{#   - Agent MUST NOT modify ISSUES.md (orchestrator manages it)                  #}
{#   - Agent SHOULD modify source code files to fix issues                       #}
{#   - Agent MAY explore limitedly if ISSUES.md lacks context                    #}
{#                                                                             #}
{# NOTES:                                                                      #}
{#   - ISSUES.md references are optional (isolation mode may remove it)          #}
{#   - Agent returns completion status as structured output                      #}
{#   - Limited exploration allowed when issue descriptions lack file references  #}
{# ============================================================================ #}

You are in FIX MODE. Address issues found during review.

{# ISSUES FROM REVIEW - Pre-loaded for you #}
{{ISSUES}}

{# FILES TO MODIFY - Explicit list of files you may work on #}
{{FILES_TO_MODIFY}}

{# ORIGINAL REQUEST - The user's original prompt for context #}
{{PROMPT}}

{# IMPLEMENTATION PLAN - The plan that was being implemented #}
{{PLAN}}

YOUR TASK:
1. Review the ISSUES content embedded above in this prompt
2. Fix the issues by modifying the appropriate files (see "FILES YOU MAY MODIFY" section for permissions)
3. Verify your fixes work correctly

CRITICAL CONSTRAINTS:
- The ISSUES content is ALREADY PROVIDED above in this prompt - review it carefully
- PERMISSIONS: FULL AUTO MODE ENABLED - You have permission to make changes directly
- If "FILES YOU MAY MODIFY" lists specific files, you MUST ONLY modify those listed files
- If "FILES YOU MAY MODIFY" shows no specific files, you MAY modify ANY files in the repository needed to fix the issues
- You MUST use your available tools to read files before editing them
- If specific files are listed above, you MUST NOT read any other files in the repository
- If no specific files are listed, you may read and modify any files necessary to fix the issues
- You MUST NOT run discovery or exploration commands to explore the codebase (ls, find, git grep, rg, grep, etc.) unless necessary to locate the files you need to modify
- You MUST NOT modify ISSUES.md or any issues file - the content is provided for reference
- Your work MUST be limited to fixing issues described in the embedded ISSUES content above

FAULT TOLERANCE FOR VAGUE ISSUE DESCRIPTIONS:
- If an issue description lacks file references (e.g., "fix this bug" without [file:line]),
  you MAY explore the codebase LIMITEDLY to locate the relevant code
- When exploring, use git grep or ripgrep ONLY to find files containing the function/class names
  or keywords mentioned in the issue description
- Once you locate the relevant files, you MUST stop exploring and focus on fixing
- Do NOT explore beyond what is necessary to locate the code mentioned in the issue
- If an issue mentions specific files or functions, you MAY read those specific files
- Your exploration MUST be targeted and minimal - only find what you need to fix

IMPORTANT: You are in FULL AUTO mode and have permission to:
- Read any of the files listed in "FILES YOU MAY MODIFY" using whatever tools you have available
- Apply patches, edits, or any modifications needed to fix the issues
- Make all necessary changes without asking for confirmation
- The yolo flag is enabled, which grants you permission to use file editing tools directly
- When no specific files are listed in "FILES YOU MAY MODIFY", this means you may work on ANY files needed to fix the issues
- Use git grep/rg ONLY when issue descriptions lack file context

AFTER FIXING:
Return your completion status as structured output:
- "All issues addressed." (if you believe everything is fixed)
- "Issues remain." (if you believe issues still exist)
- "No issues found." (if the ISSUES content embedded above is empty)

DO NOT modify the ISSUES content - it is provided for reference only.
You SHOULD modify source code files to fix the issues.

GUIDELINES:
- Fix issues properly, don't just suppress warnings
- Ensure fixes don't introduce new issues
- If ISSUES.md lacks sufficient context, use minimal exploration to locate relevant code
- After locating files via exploration, focus only on fixing the specific issues mentioned
- Document any assumptions you make when fixing vague issues
