{{!--
  ABOUTME: Beads tracker prompt template (REFERENCE COPY).
  Context-first structure: PRD → Task → Workflow

  NOTE: This file is for REFERENCE ONLY. The actual template used at runtime
  is embedded in the code to avoid path resolution issues in bundled distributions.
  See: https://github.com/subsy/ralph-tui/issues/248

  To customize this template, copy it to one of these locations:
  - Project: .ralph-tui/templates/beads.hbs
  - Global: ~/.config/ralph-tui/templates/beads.hbs
--}}

{{!-- Full PRD for project context (agent studies this first) --}}
{{#if prdContent}}
We are working in a project to implement the following Product Requirements Document (PRD):

{{prdContent}}

---
{{/if}}

## Bead Details
- **ID**: {{taskId}}
- **Title**: {{taskTitle}}
{{#if epicId}}
- **Epic**: {{epicId}}{{#if epicTitle}} - {{epicTitle}}{{/if}}
{{/if}}
{{#if taskDescription}}
- **Description**: {{taskDescription}}
{{/if}}

{{#if acceptanceCriteria}}
## Acceptance Criteria
{{acceptanceCriteria}}
{{/if}}

{{#if dependsOn}}
**Prerequisites**: {{dependsOn}}
{{/if}}

{{#if recentProgress}}
## Recent Progress
{{recentProgress}}
{{/if}}

## Workflow
1. Study the PRD context above to understand the bigger picture (if available)
2. Study `.ralph-tui/progress.md` to understand overall status, implementation progress, and learnings including codebase patterns and gotchas
3. **BEFORE implementing**: Review the relevant parts of the codebase to understand existing patterns and architecture
4. **Check the original task list**: Verify if there are any related tasks or dependencies that affect this implementation
5. **If something is missing**: If you discover that related functionality needs changes, implement those changes as part of this task
6. Implement the requirements (stay on current branch)
7. Run your project's quality checks (typecheck, lint, etc.)
{{#if config.autoCommit}}
8. Do NOT create git commits. Changes will be committed automatically by the engine after task completion.
{{else}}
8. Do NOT create git commits. Leave all changes uncommitted for manual review.
{{/if}}
9. Close the bead: `bd close {{taskId}} --db {{beadsDbPath}} --reason "Brief description"`
10. Document learnings (see below)
11. Signal completion

## Before Completing
APPEND to `.ralph-tui/progress.md`:
```
## [Date] - {{taskId}}
- What was implemented
- Files changed
- **Learnings:**
  - Patterns discovered
  - Gotchas encountered
---
```

If you discovered a **reusable pattern**, also add it to the `## Codebase Patterns` section at the TOP of progress.md.

## Stop Condition
**IMPORTANT**: If the work is already complete (implemented in a previous iteration or already exists), verify it works correctly and signal completion immediately.

When finished (or if already complete), signal completion with:
<promise>COMPLETE</promise>
