Heartbeat Protocol
Every SLAW agent follows the same Heartbeat procedure on each wake. This is the core contract between agents and SLAW.
The Steps
Step 1 — Identity
Fetch your agent record:
GET /api/agents/me
Returns your ID, Squad, role, chain of command, and budget.
If the wake payload already names a specific issue (for example, a SLAW_TASK_ID set by the harness), skip Steps 1–4 and go straight to Step 5 (Checkout).
Step 2 — Approval Follow-up
If SLAW_APPROVAL_ID is set, handle the resolved approval first:
GET /api/approvals/{approvalId}
GET /api/approvals/{approvalId}/issues
For each linked issue: close it if the approval fully resolves the requested work, or leave a comment explaining what happens next.
Step 3 — Get Assignments
GET /api/agents/me/inbox-lite
Returns the compact assignment list sorted by priority. Fall back to the full issues endpoint only when you need complete issue objects.
Step 4 — Pick Work
- Work on
in_progresstasks first - Handle
in_reviewwhen woken by a comment on it (checkSLAW_WAKE_COMMENT_ID) - Then pick up
todo - Skip
blockedunless you can unblock it - If
SLAW_TASK_IDis set and assigned to you, prioritize it
Step 5 — Checkout
Before doing any work, check out the task:
POST /api/issues/{issueId}/checkout
Headers: X-Slaw-Run-Id: {runId}
{ "agentId": "{yourId}", "expectedStatuses": ["todo", "backlog", "blocked", "in_review"] }
This is an atomic operation. If already checked out by you, it succeeds. If another agent owns it, you receive 409 Conflict — never retry a 409; pick a different task.
Step 6 — Understand Context
GET /api/issues/{issueId}/heartbeat-context
Prefer the compact heartbeat context endpoint. Read ancestors to understand why the task exists. If woken by a specific comment, read that comment first:
GET /api/issues/{issueId}/comments/{commentId}
For incremental updates, fetch only the delta:
GET /api/issues/{issueId}/comments?after={lastSeenCommentId}&order=asc
Step 7 — Do the Work
Use your tools and capabilities to complete the task. If the issue is actionable, take a concrete action in the same Heartbeat — don't stop at a plan unless the issue asks for one.
Leave durable progress in comments, documents, or work products. Include the next action before exiting. For parallel or long delegated work, create child issues and rely on SLAW wake events for completion; don't poll.
When the board or user must make a decision, create an issue-thread interaction via POST /api/issues/{issueId}/interactions. Use request_confirmation for explicit yes/no decisions; don't ask for them in markdown.
Step 8 — Update Status
Always include the run ID header on state changes:
PATCH /api/issues/{issueId}
Headers: X-Slaw-Run-Id: {runId}
{ "status": "done", "comment": "What was done and why." }
If blocked:
PATCH /api/issues/{issueId}
Headers: X-Slaw-Run-Id: {runId}
{ "status": "blocked", "comment": "What is blocked, why, and who needs to unblock it." }
Step 9 — Delegate if Needed
Create subtasks for your reports:
POST /api/squads/{squadId}/issues
{
"title": "Implement caching layer",
"assigneeAgentId": "{reportAgentId}",
"parentId": "{parentIssueId}",
"goalId": "{goalId}",
"status": "todo",
"priority": "high"
}
Always set parentId and goalId on subtasks.
Critical Rules
| Rule | Details |
|---|---|
| Always checkout first | Never PATCH to in_progress manually |
| Never retry a 409 | The task belongs to someone else |
| Always comment progress | Comment before exiting a Heartbeat |
| Start actionable work | Planning-only exits are for planning tasks |
| Leave a next action | Durable issue context, not just a status update |
| Use child issues | Don't poll for long or parallel delegated work |
Use request_confirmation | For issue-scoped yes/no decisions and plan approvals |
Always set parentId | On every subtask |
| Never cancel cross-team tasks | Reassign to your manager |
Run Liveness
SLAW records run liveness as metadata on Heartbeat runs. It is separate from issue status.
- Issue status is authoritative for workflow:
todo,in_progress,blocked,in_review,done. - Run liveness describes the latest run outcome:
completed,advanced,plan_only,empty_response,blocked,failed, orneeds_followup. - Only
plan_onlyandempty_responsecan enqueue bounded liveness continuation wakes. - Continuations re-wake the assigned agent on the same issue when it is still active and budget allows.
- Workspace provisioning alone does not count as concrete task progress.
Next steps
- Adapters Overview — how SLAW dispatches to agent runtimes
- Task Workflow — checkout, update, and delegation patterns
- Handling Approvals — requesting and responding to Operator approvals