Files
mission-control/HEARTBEAT.md
2026-02-04 02:28:51 +05:30

108 lines
3.3 KiB
Markdown

# Mission Control Orchestrator Instructions
You are the Mission Control orchestrator. Your job is to:
1. Claim unassigned tasks (FIFO)
2. Execute work (optionally spawn sub-agents)
3. Log progress and deliverables
4. Move tasks to review when complete
## CRITICAL: You MUST call Mission Control APIs
Every action you take MUST be reflected in Mission Control via API calls. The dashboard shows task status in real-time.
## Required Inputs
- `BASE_URL` (e.g., http://localhost:8000)
- `ORG_ID`
- `WORKSPACE_ID`
- `AGENT_TOKEN` (Authorization Bearer token)
## On Every Heartbeat
### Step 1: Claim next task (FIFO)
```bash
curl -s -X POST "$BASE_URL/api/v1/orgs/$ORG_ID/workspaces/$WORKSPACE_ID/tasks/claim-next" \
-H "Authorization: Bearer $AGENT_TOKEN"
```
- If response is **204**, there is no work. Wait and retry.
- If response returns a task, process it.
### Step 2: Check your in-progress tasks
```bash
curl -s "$BASE_URL/api/v1/orgs/$ORG_ID/workspaces/$WORKSPACE_ID/tasks?status_filter=in_progress&assigned_agent_id=$AGENT_ID" \
-H "Authorization: Bearer $AGENT_TOKEN"
```
If tasks exist, continue work and update activity/deliverables.
## When Processing a New Task
### 1) Log that you're starting
```bash
curl -X POST "$BASE_URL/api/v1/orgs/$ORG_ID/workspaces/$WORKSPACE_ID/tasks/{TASK_ID}/activities" \
-H "Authorization: Bearer $AGENT_TOKEN" \
-H "Content-Type: application/json" \
-d '{"activity_type": "updated", "message": "Starting work on task"}'
```
### 2) Register a sub-agent (if you spawn one)
```bash
curl -X POST "$BASE_URL/api/v1/orgs/$ORG_ID/workspaces/$WORKSPACE_ID/tasks/{TASK_ID}/subagents" \
-H "Authorization: Bearer $AGENT_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"openclaw_session_id": "optional-session-id",
"agent_name": "Designer"
}'
```
### 3) Register deliverables
```bash
curl -X POST "$BASE_URL/api/v1/orgs/$ORG_ID/workspaces/$WORKSPACE_ID/tasks/{TASK_ID}/deliverables" \
-H "Authorization: Bearer $AGENT_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"title": "Homepage Design",
"markdown_content": "## Summary\n- Implemented layout\n- Added responsive styles"
}'
```
### 4) Log completion
```bash
curl -X POST "$BASE_URL/api/v1/orgs/$ORG_ID/workspaces/$WORKSPACE_ID/tasks/{TASK_ID}/activities" \
-H "Authorization: Bearer $AGENT_TOKEN" \
-H "Content-Type: application/json" \
-d '{"activity_type": "completed", "message": "Task completed successfully"}'
```
### 5) Move task to REVIEW
```bash
curl -X POST "$BASE_URL/api/v1/orgs/$ORG_ID/workspaces/$WORKSPACE_ID/tasks/{TASK_ID}/transition" \
-H "Authorization: Bearer $AGENT_TOKEN" \
-H "Content-Type: application/json" \
-d '{"to_status": "review"}'
```
## Task Statuses
```
inbox → in_progress → review → done
```
Other statuses may be used if configured (`assigned`, `testing`), but the default flow above is expected.
## Checklist Before Saying HEARTBEAT_OK
Before responding with HEARTBEAT_OK, verify:
- [ ] No unclaimed tasks remain in INBOX
- [ ] All in-progress tasks have recent activity updates
- [ ] Completed work has deliverables registered
- [ ] Completed tasks are moved to REVIEW
If ANY of these are false, take action instead of saying HEARTBEAT_OK.
## Reference
Full API documentation: See ORCHESTRATION.md in this project.