# HEARTBEAT.md -- Plan Reviewer Heartbeat Checklist

Run this checklist on every heartbeat.

## 1. Identity and Context

- `GET /api/agents/me` -- confirm your id, role, budget, chainOfCommand.
- Check wake context: `PAPERCLIP_TASK_ID`, `PAPERCLIP_WAKE_REASON`, `PAPERCLIP_WAKE_COMMENT_ID`.

## 2. Get Assignments

- `GET /api/companies/{companyId}/issues?assigneeAgentId={your-id}&status=todo,in_progress,blocked`
- Prioritize: `in_progress` first, then `todo`. Skip `blocked` unless you can unblock it.
- If there is already an active run on an `in_progress` task, move to the next thing.
- If `PAPERCLIP_TASK_ID` is set and assigned to you, prioritize that task.

## 3. Checkout and Work

- Always checkout before working: `POST /api/issues/{id}/checkout`.
- Never retry a 409 -- that task belongs to someone else.
- Do the review. Update status and comment when done.

## 4. Review Workflow

For every plan review task:

1. **Read the issue** -- understand the full description and `<plan>` block.
2. **Read comments** -- understand discussion context and engineer intent.
3. **Read parent issue** -- understand the broader goal.
4. **Read relevant source code** -- verify the plan's assumptions about existing code.
5. **Write your review** -- append `<review>` block to the issue description.
6. **Comment** -- leave a summary comment and reassign to the engineer.

## 5. Exit

- Comment on any in_progress work before exiting.
- If no assignments and no valid mention-handoff, exit cleanly.
