# Work comments, epics & blueprints

> Execution protocols for standalone MCP comments, managed ACP --run card runs, whole-epic runs, blueprint apply runs, and agents/tasks/*.md files.

Match your delivery mode before calling lifecycle tools:

| Mode | How to tell | Claim? | When blocked | Hand back |
| --- | --- | --- | --- | --- |
| **Standalone MCP** (`pitafix mcp` without `--run`) | External MCP client | Call `claim_comment(id)` first | Call `ask_person(id, question)`; call `claim_comment(id)` after reply | Call `submit_for_review(id, summary, files?, evidence?)` |
| **Managed ACP card run** (`--run <id>`) | PitaFix started your session for comment cards | **Skip `claim_comment`** (already claimed) | Call `ask_person(id, question)` and **end your turn** | **Skip `submit_for_review`** (PitaFix submits on final pass) |
| **Whole-epic ACP run** | PitaFix started your session on `pitafix/epic-<slug>` | None | Ask your question and **end your turn** | Mark all 1:1 ACP plan steps done and end your turn |
| **Blueprint Apply run** | PitaFix started your session on `pitafix/blueprint-<id>` | None | Ask your question and **end your turn** | Run active stack gates and end your turn |
| **Markdown task file** (`agents/tasks/<n>-<slug>.md`) | User handed you an exported `.md` file | None | Ask the user directly | Set YAML `status: open` → `status: done` and append `## Result` |

## Pre-edit checklist

1. Call `get_blueprint()` first. When attached (`attached: true`), follow `fromBlueprint`'s commit rules, `AGENTS.md` layout, skills, and active stack `gates[]` (CLI fallback: `pitafix blueprint show --project . --json`).
2. If a comment belongs to an epic, call `get_epic(id)` and honor `fromPlan` (`why`, `appetite`, `notDoing[]`) plus prior `decisions[]` without re-asking answered questions.
3. Call `find_screens` before editing shared code; call `list_components` and `get_scale` before building or restyling UI.

## Protocol 1: Standalone MCP comments

1. Call `list_open_comments()` → `get_comment(id)` (check `photos[]`, `pin`, `areas`, `areaLinks`, composed scrolled screenshot/tree when `scrolled: true`, anchors, thread).
2. Call `claim_comment(id)` to move status to `working`.
3. Edit and verify, then call `submit_for_review(id, summary, files?, evidence?)` (moves to `needs_review`). Use `reply_to_comment(id, text)` for progress updates and `ask_person(id, question)` when only the user can decide.

## Protocol 2: Managed ACP card run (`--run <id>`)

1. Skip `claim_comment` and `submit_for_review` for the run's comments.
2. When blocked on a product decision, call `ask_person(id, question)` and **end your turn immediately** so PitaFix relays the user's reply into the same session.
3. Expect follow-up **After Each Task** passes (Settings passes plus enabled stack passes from any attached blueprint) in the same session after your main turn ends.
4. Leave git commits and worktree cleanup to the user.

## Protocol 3: Whole-epic ACP run (`pitafix/epic-<slug>`)

1. Call `get_epic(id)` (and `get_blueprint()` if attached).
2. Keep ACP plan entries **1-to-1** with the epic's planned screens in order, marking each done as you go.
3. Stay inside `appetite` and `notDoing[]`; ask and end your turn if a requirement is unspecified, and log out-of-scope observations via `add_signal`.
4. Expect follow-up **After Each Task** passes after your main turn ends; leave commits and worktree cleanup to the user.

## Protocol 4: Blueprint Apply run (`pitafix/blueprint-<id>`)

1. Call `get_blueprint()` and read the rendered apply instructions and source templates under `blueprintDir`.
2. Reconcile the active stacks' and modules' files (`AGENTS.md`, skills, subagents, commit guidelines/hooks, harness packages, starter `.pitafix/` capture setup) while preserving project-specific facts; prefer ratchets or allowlists over deleting working code.
3. Run every verification gate in `stacks.<name>.gates[]` whose `when` condition matches; expect follow-up **After Each Task** passes; leave commits and worktree cleanup to the user.

## Completion criteria

1. Every applicable test, linter, and attached blueprint gate ran and passed (reported in `evidence` or `## Result`).
2. Handback matches your delivery mode (`submit_for_review`, final managed turn, whole-epic plan completion, or `status: done` + `## Result`), with the worktree left uncommitted for human review and resolution.
