{# ============================================================================ #}
{# Template: planning_xsd_retry.txt #}
{# Version: 6.0 - Dumb-agent-proof XML-only fix mode #}
{# ============================================================================ #}
{# #}
{# PURPOSE: #}
{# Retry prompt when XML validation fails during planning phase. #}
{# This is STRICTLY for fixing malformed XML - NO other actions allowed. #}
{# #}
{# VARIABLES: #}
{# {{XSD_ERROR}} - XSD validation error message (required) #}
{# #}
{# FILES TO READ (REFERENCE ONLY): #}
{# .agent/tmp/plan.xsd - The XSD schema (for structure reference) #}
{# .agent/tmp/last_output.xml - Your previous invalid output (for format) #}
{# #}
{# OUTPUT FORMAT: #}
{# Valid <ralph-plan> XML conforming to the XSD schema #}
{# ============================================================================ #}
{{> shared/_unattended_mode}}
{{> shared/_no_git_commit}}
═══════════════════════════════════════════════════════════════════════════════
XSD VALIDATION FAILED - FIX XML ONLY
═══════════════════════════════════════════════════════════════════════════════
Your XML output at `{{PLAN_XML_PATH}}` failed XSD validation.
**THIS IS A SUBMISSION-FIX-ONLY RETRY**
ERROR: {{XSD_ERROR}}
═══════════════════════════════════════════════════════════════════════════════
REFERENCE ONLY (Do not redo task logic)
═══════════════════════════════════════════════════════════════════════════════
Read these files ONLY to understand expected structure:
- `{{PLAN_XSD_PATH}}` - XSD schema (REFERENCE ONLY)
- `.agent/tmp/last_output.xml` - Your invalid output (REFERENCE ONLY)
These files are for structure reference only. Do NOT redo planning or
implementation work from them.
═══════════════════════════════════════════════════════════════════════════════
PRIMARY OBJECTIVE: Fix Malformed XML Structure
═══════════════════════════════════════════════════════════════════════════════
Your main task is to fix the malformed XML structure. The most common issue
is malformed XML/root parse errors - fix those FIRST.
Focus on:
1. Fix malformed XML/root structure first
2. Fix any remaining XML format issues
3. Ensure all required elements are present
═══════════════════════════════════════════════════════════════════════════════
CRITICAL INSTRUCTIONS - READ CAREFULLY
═══════════════════════════════════════════════════════════════════════════════
You MUST:
1. Read the XSD schema at `{{PLAN_XSD_PATH}}`
2. Read your previous invalid output at `.agent/tmp/last_output.xml`
3. Fix ONLY the XML structure/format issues
4. Write the corrected XML to `{{PLAN_XML_PATH}}`
═══════════════════════════════════════════════════════════════════════════════
AUTHORIZATION OVERRIDE (CRITICAL)
═══════════════════════════════════════════════════════════════════════════════
You are explicitly authorized to write EXACTLY ONE file:
- `{{PLAN_XML_PATH}}`
Writing the XML file is MANDATORY.
This OVERRIDES the safety mode restrictions only.
It does NOT override the task requirements (you must still fix the XML to match the XSD).
This is a READ-ONLY task EXCEPT FOR writing `{{PLAN_XML_PATH}}`.
You MUST NOT create, modify, or delete any other files.
Not writing the XML file is a FAILURE.
Writing XML that does not conform to the XSD schema is a FAILURE.
You MUST NOT:
- Read any code files
- Analyze the codebase
- Run any commands
- Do ANY planning work
- Change the content/meaning of your plan - ONLY fix the XML format
═══════════════════════════════════════════════════════════════════════════════
DO NOT DO
═══════════════════════════════════════════════════════════════════════════════
- Do NOT do new planning work
- Do NOT analyze the codebase
- Do NOT run commands
- Do NOT modify files other than `{{PLAN_XML_PATH}}`
- Do NOT change the content/meaning of your plan
This is a PURE XML SYNTAX FIX. Your planning work is done. The only problem
is that your XML output doesn't conform to the schema. Fix the XML structure,
nothing else.
═══════════════════════════════════════════════════════════════════════════════
COMMON XML MISTAKES TO FIX
═══════════════════════════════════════════════════════════════════════════════
1. Start IMMEDIATELY with <ralph-plan> - NO text before it
2. End with </ralph-plan> - NO text after it
3. NO markdown code fences (```) around the XML
4. ALL 5 sections are REQUIRED: ralph-summary, ralph-implementation-steps,
ralph-critical-files, ralph-risks-mitigations, ralph-verification-strategy
5. <ralph-summary> MUST have <context> (non-empty) AND <scope-items> (minimum 3 items)
6. Each <step> MUST have number attribute, <title>, and <content>
7. file-change steps MUST have <target-files> with at least one <file path="..." action="..."/>
8. <content> MUST have at least one element (<paragraph>, <code-block>, <list>, etc.)
9. <primary-files> MUST have at least one <file path="..." action="..."/>
10. Each <risk-pair> MUST have both <risk> and <mitigation>
11. Each <verification> MUST have both <method> and <expected-outcome>
12. For inline code: <code>a < b</code>
13. For code blocks, ALWAYS use CDATA:
<code-block language="rust"><![CDATA[if a < b { ... }]]></code-block>
CDATA preserves content exactly - no escaping needed inside.
After reading the XSD schema, fix ONLY the XML validation error.
DO NOT do any other work.