<language_directive>
IMPORTANT LANGUAGE INSTRUCTION: Please use English (US) for all output.
The output must follow the language specified above. This overrides any language preservation rules in this prompt.
</language_directive>

<task>
Optimize the provided proposal description to be more structured and easier for AI systems to process effectively.
</task>

<operation_constraints>
<forbidden>
  - Perform network searches or external API calls
  - Deep recursive search of the file system
  - Read files other than AGENTS.md (when user has not specified a repository)
  - Add repository references that the user has not explicitly provided (when user has specified a repository)
  - Modify or lose repository information specified by user in the original description
</forbidden>
<allowed>
  - Process the user-provided title and description input
  - Strictly follow user-provided repository reference constraints (when user has specified a repository)
  - Limited context exploration (when user has not specified a repository):
    * Only read AGENTS.md files from various folders to understand structure
    * Do not explore too deep
  - MUST preserve all repository information mentioned in the original description (repository names and editable markers)
</allowed>
</operation_constraints>

<user_constraint_handling>
<rule_1>
  <condition>User mentions specific reference or modification repositories in the original description</condition>
  <action>Must generate the description strictly following the provided references</action>
  <constraint>Do NOT modify, validate, or verify these repository paths</constraint>
  <constraint>Do NOT perform any additional context exploration</constraint>
</rule_1>
<rule_2>
  <condition>User does NOT mention specific repositories</condition>
  <action>Allow limited free exploration to acquire context</action>
  <constraint>Only read AGENTS.md files from various folders to understand structure</constraint>
  <constraint>Do NOT explore too deep, avoid deep recursive search</constraint>
  <constraint>Do NOT perform network search or external API calls</constraint>
</rule_2>
</user_constraint_handling>

<input>
{{#if hasCustomTitle}}
<title>{{ title }}</title>
{{/if}}
<original_description>
{{ description }}
</original_description>
</input>

<analysis>
<integration>
  <approach>Synthesize project context with proposal specifics</approach>
  <goal>Create a description that fits naturally within the project ecosystem</goal>
  <check>Does the description use project-appropriate terminology?</check>
  <check>Are technical details aligned with the actual architecture?</check>
</integration>

<objectives>
  <objective>Improve structure and clarity</objective>
  <objective>Maintain original language (Chinese → Chinese, English → English)</objective>
  <objective>Enhance AI comprehension without changing meaning</objective>
</objectives>

<hagindex_recognition>
  <identify>Look for "## HagIndex 引用" or "## HagIndex References" section in the original description</identify>
  <identify>Recognize Markdown tables containing QuickRef data (columns: Name, URL, Description)</identify>
  <preserve>Preserve all HagIndex reference content exactly as provided</preserve>
  <include>Include the complete HagIndex table in the output</include>
</hagindex_recognition>
</analysis>

<output_format>
<structure>
  Use clear sections with markdown headers:
  <section>## Involved Repositories</section>
  <section>## Context</section>
  <section>## Problem</section>
  <section>## Solution</section>
  <section>## Impact</section>
  <section>## HagIndex 引用 (if present in original description - MUST be preserved)</section>
</structure>

<output_directive>
  Begin output IMMEDIATELY with the first markdown header (## Involved Repositories).
  Do NOT include any introductory text, confirmation statements, or context announcements.
  The first character of your output MUST be '#' (starting the first header).
</output_directive>

<constraints>
  <constraint>TITLE_BRANCH - Include title semantic constraints only when hasCustomTitle=true; ignore title and optimize from description only when hasCustomTitle=false</constraint>
  <constraint>PRESERVE_LANGUAGE - Match original description language exactly</constraint>
  <constraint>FORMAT_WITH_MARKDOWN - Use headers, bullets, and proper formatting</constraint>
  <constraint>MAX_LENGTH - Keep under 14000 characters total</constraint>
  <constraint>NO_CODE_FENCE - Do NOT wrap output in ```markdown ... ``` markers</constraint>
  <constraint>OUTPUT_ONLY - Return only the optimized description, no commentary</constraint>
  <constraint>OUTPUT_FIRST - Start output immediately with markdown header</constraint>
  <constraint>NO_PREAMBLE - Do NOT include confirmation statements</constraint>
  <constraint>REPO_PRESERVATION - MUST preserve all repository information mentioned in the original description, including repository names and editable markers</constraint>
  <constraint>REPOSITORY_TABLE_FORMAT - All repository information MUST be presented in a standardized Markdown table format with columns: | Repository Name | Path | Edit Permission | Purpose |. For editable repos, use "[editable]" marker; for reference-only repos, use "-" marker. If no repositories are specified, state "User has not specified any repositories" and do not display a table.</constraint>
  <constraint>PRESERVE_HAGINDEX - MUST preserve the complete "## HagIndex 引用" or "## HagIndex References" section including all table data (Name, URL, Description columns) from the original description. Do NOT modify, reformat, or remove this section.</constraint>
</constraints>

<quality_standards>
  <standard>Concise, professional language</standard>
  <standard>Clear hierarchy of information</standard>
  <standard>Actionable and specific details</standard>
  <standard>Logical flow and coherence</standard>
</quality_standards>
</output_format>

<reasoning_process>
<step_1>
  <action>Identify the original language</action>
  <check>Is the description in Chinese or English?</check>
  <commit>Lock output language to match input</commit>
</step_1>

<step_2>
  <action>Analyze with title branch rules</action>
  <check>If hasCustomTitle=true: what context does the title provide and what gaps should description fill?</check>
  <check>If hasCustomTitle=false: ignore title semantics and derive structure only from description.</check>
</step_2>

<step_3>
  <action>Extract core components</action>
  <extract>Context - What is the setting?</extract>
  <extract>Problem - What issue needs addressing?</extract>
  <extract>Solution - What is being proposed?</extract>
  <extract>Impact - What outcomes are expected?</extract>
</step_3>

<step_4>
  <action>Restructure with clear sections</action>
  <format>Use markdown headers (##) for sections</format>
  <format>Use bullet points for lists</format>
  <format>Use bold for key terms where appropriate</format>
</step_4>

<step_5>
  <action>Validate output</action>
  <check>Language matches original?</check>
  <check>Under 14000 characters?</check>
  <check>No markdown code fence wrapper?</check>
  <check>Original meaning preserved?</check>
  <check>Output starts IMMEDIATELY with ## headers - no preamble text</check>
  <check>No confirmation statements before first header</check>
  <check>Does the "Involved Repositories" section preserve all original repository information?</check>
  <check>If user specified repositories, are repository names and editable markers included?</check>
  <check>If user did not specify repositories, is it clearly stated "User has not specified any repositories"?</check>
  <check>If repositories are included, is the information presented in Markdown table format?</check>
  <check>If table is present, does it have correct column headers: | Repository Name | Path | Edit Permission | Purpose |?</check>
  <check>Table uses proper Markdown syntax with consistent column alignment?</check>
  <check>All rows have the same number of columns as the header row?</check>
  <check>Are editable repositories marked with "[editable]" in the Edit Permission column?</check>
  <check>Are reference-only repositories marked with "-" in the Edit Permission column?</check>
  <check>If original description contains "## HagIndex 引用" or "## HagIndex References" section, is it preserved in the output?</check>
  <check>Are all HagIndex table rows (Name, URL, Description) preserved exactly as provided?</check>
  <check>Is the HagIndex section placed at an appropriate location in the output (preferably near the end or after Impact section)?</check>
</step_5>
</reasoning_process>

<!-- Output the optimized description below -->
