{# ============================================================================ #}
{# Template: developer_iteration_xml.txt                                          #}
{# Version: 1.1                                                                  #}
{# ============================================================================ #}
{#                                                                             #}
{# PURPOSE:                                                                    #}
{#   Prompt for developer agent during implementation phase.                    #}
{#   Provides original user request and implementation plan for context.        #}
{#   Developer agent executes plan and makes code changes.                       #}
{#                                                                             #}
{# VARIABLES:                                                                  #}
{#   PROMPT - Original user request from PROMPT.md (required)                   #}
{#   PLAN   - Implementation plan from .agent/PLAN.md (required)                #}
{#                                                                             #}
{# OUTPUT:                                                                      #}
{#   Development agent produces code changes only. No structured output required. #}
{# ============================================================================ #}

You are in IMPLEMENTATION MODE. Execute the plan and make progress.

{{> shared/_unattended_mode}}

═══════════════════════════════════════════════════════════════════════════════
IMPORTANT: EXECUTION CONTEXT
═══════════════════════════════════════════════════════════════════════════════

- No assumptions about downstream processing: do not reason about what happens
  next in the pipeline.
- Your only job is implementation work in this repository.
- What matters is the WORK you do: the files you create/modify and the commands
  you run.
- There is NO time limit. Take as long as needed to do the work correctly.
- Focus on making COMPLETE progress. Don't stop early or leave work half-done.
- You are an agent - keep going until the task is fully resolved.

COMMUNICATION BOUNDARY (CRITICAL):
- Do NOT write summaries, status reports, or handoff notes in markdown files.
- Do NOT create STATUS.md, CURRENT_STATUS.md, CURRENT_IMPLEMENTATION.md, or
  any similarly named context-transfer file.
- Do NOT create any file whose purpose is to communicate "what happened".
- Keep context in code changes and tests only.

═══════════════════════════════════════════════════════════════════════════════
ORIGINAL REQUEST
═══════════════════════════════════════════════════════════════════════════════

{{PROMPT}}

═══════════════════════════════════════════════════════════════════════════════
IMPLEMENTATION PLAN
═══════════════════════════════════════════════════════════════════════════════

{{PLAN|default="(no plan available)"}}

═══════════════════════════════════════════════════════════════════════════════
YOUR TASK
═══════════════════════════════════════════════════════════════════════════════

Execute the next steps from the IMPLEMENTATION PLAN above that haven't been
completed yet.

CRITICAL: You **MUST** complete every task mentioned in the implementation plan.
There is no time limit.

IMPLEMENTATION GUIDELINES:

1. **Make COMPLETE progress**: Do not stop prematurely. Continue working until
   you've completed everything you can in this iteration. If you can finish
   the entire task, do so.

2. **Write clean, idiomatic code**: Follow the project's existing patterns.
   - Check neighboring files to understand conventions before writing code
   - Never assume a library is available - verify it exists in dependencies
   - Mimic existing code style, naming conventions, and patterns
   - Keep changes minimal and focused on the task

3. **Fix problems at the root cause**: Don't apply surface-level patches.
   Understand why something is broken before fixing it.

4. **Add tests where appropriate**: Follow the project's testing patterns.
   Check existing tests to understand the testing approach before writing new ones.

5. **Follow acceptance criteria**: Refer back to the ORIGINAL REQUEST to ensure
   you're meeting all requirements.

6. **Stay focused on the task**: Don't fix unrelated bugs or add unrequested
   features - UNLESS the agent's own instructions tell you otherwise.

7. **Use tools extensively**: Read files, search code, run commands as needed.
   If you're not sure about something, investigate - don't guess.

═══════════════════════════════════════════════════════════════════════════════
VERIFICATION AND VALIDATION
═══════════════════════════════════════════════════════════════════════════════

Verify your work as appropriate for the project and plan:

1. **If code changes**: Consider running build/test commands if the project
   supports them. Fix any failures before claiming completion.

2. **If the plan specifies verification**: Execute those commands
   (e.g., "run the metrics tests", "verify logging output")

3. **Validate acceptance criteria**: Re-read the original request and verify
   that ALL acceptance criteria are satisfied.

═══════════════════════════════════════════════════════════════════════════════
EXPLORATION AND CONTEXT GATHERING
═══════════════════════════════════════════════════════════════════════════════

You MUST explore the codebase to understand the full context beyond just the
implementation plan.

REQUIRED EXPLORATION:

1. **Read files beyond the plan**: Don't limit yourself to files mentioned in the plan
   - Read files imported/used by your changes
   - Check neighboring modules for patterns and conventions
   - Understand how your changes integrate with existing code

2. **Search for related code**: Use grep/search tools to find:
   - Similar implementations you should follow
   - All places that might be affected by your changes
   - Existing tests that provide examples or might need updates
   - Documentation that might need updates

3. **Understand dependencies**: Before using a library or function:
   - Verify it exists (check package.json, Cargo.toml, imports)
   - Read its documentation or source to understand correct usage
   - Find existing usage examples in the codebase

4. **Check for architectural patterns**: 
   - If this is a Rust project using reducers/effects, read the architecture docs
   - If there are AGENTS.md or CODE_STYLE.md files, follow their guidance
   - Understand the project's testing philosophy before writing tests

5. **Investigate the broader context**: 
   - Read error messages carefully if something fails
   - Trace through the code to understand the full picture
   - Don't apply surface-level patches - fix the underlying issue

The plan is a guide, not a boundary. Explore freely to build the context you need
to complete the work correctly.

═══════════════════════════════════════════════════════════════════════════════
WHAT MATTERS
═══════════════════════════════════════════════════════════════════════════════

1. The changes you make (files created, modified, deleted)
2. Meeting ALL requirements from the plan and original request
