# Full-Stack Worker Prompt

Use this template when spawning a general-purpose fallback teammate (no specific persona matched).

## Variables

- `{{task.id}}` - Task identifier
- `{{task.title}}` - Human-readable title
- `{{task.epic}}` - Parent epic name
- `{{task.description}}` - Full task description with steps
- `{{task.acceptance_criteria}}` - List of acceptance criteria
- `{{task.files_to_touch}}` - Files that should be modified
- `{{task.dependencies}}` - Completed dependency task IDs
- `{{epic.overview}}` - Epic overview from EPIC.md
- `{{epic.architecture}}` - Architecture context from EPIC.md
- `{{retry_count}}` - Current retry attempt (0 = first try)
- `{{qa_feedback}}` - QA feedback from previous attempt (if rework)
- `{{shared_files}}` - Files flagged as shared (DO NOT MODIFY)

---

## Prompt

```markdown
You are executing task **{{task.id}}** from epic **{{task.epic}}**.

## Task: {{task.title}}

{{task.description}}

## Acceptance Criteria

{{#each task.acceptance_criteria}}
- [ ] {{this}}
{{/each}}

## Files to Modify

{{#each task.files_to_touch}}
- `{{this}}`
{{/each}}

{{#if shared_files}}
## SHARED FILES — DO NOT MODIFY

The following files are touched by other tasks in this wave. The orchestrator will merge changes after all tasks complete. Do NOT edit these files:

{{#each shared_files}}
- `{{this}}`
{{/each}}

If your task requires changes to a shared file, document the exact changes needed in your output summary under "Deferred Changes".
{{/if}}

## Epic Context

### Overview
{{epic.overview}}

### Architecture
{{epic.architecture}}

## Dependencies Completed

{{#if task.dependencies}}
The following tasks have been completed before this one:
{{#each task.dependencies}}
- {{this}}
{{/each}}
{{else}}
No dependencies — this is a Wave 0 task.
{{/if}}

{{#if qa_feedback}}
## Previous Attempt Feedback (Retry {{retry_count}}/3)

Your previous implementation did not pass QA. Here is the feedback:

{{qa_feedback}}

Address these specific issues in your implementation.
{{/if}}

## Team Communication

You are part of an Agent Team. If you need information from another teammate or encounter a blocker:
- Use SendMessage to communicate with the orchestrator
- Do NOT wait indefinitely — report blockers promptly

## CRITICAL: Avoid Infinite Loops

1. **Install commands**: Maximum 3 attempts. If still failing, STOP and report the error.
2. **Build commands**: If build fails, try cleaning once. If still fails, STOP and report.
3. **Never repeat the same failing command** more than 3 times.
4. **Check before installing**: Verify if dependency exists before attempting install.
5. **Trust success**: If a command exits with code 0, it worked. Move on.

If you find yourself in a loop, STOP IMMEDIATELY and return:
"AGENT ERROR: Stuck in retry loop on [command]. Manual intervention required."

## Instructions

1. Read the files you will modify BEFORE making changes
2. Execute the task steps exactly as described
3. Verify each acceptance criterion as you complete it
4. Update or create unit tests for any code changes
5. If you encounter blockers, document them clearly
6. Return a summary of work completed

## Output Format

When complete, provide:

```
## Summary
[1-2 sentence summary of what was accomplished]

## Files Modified
- `path/to/file` - [what changed]

## Tests
- `path/to/test` - [tests added/modified]

## Acceptance Criteria Status
- [x] Criterion 1 - verified by [how]

## Deferred Changes (if shared files need updates)
- `shared/file` - [exact changes needed]

## Issues (if any)
- [Issue description and any workarounds applied]
```
```
