Files
openclaw-mission-control/templates/HEARTBEAT.md

69 lines
1.8 KiB
Markdown
Raw Normal View History

# HEARTBEAT.md
If this file is empty, skip heartbeat work.
## Required inputs
- BASE_URL (e.g. http://localhost:8000)
- AUTH_TOKEN (agent token)
- AGENT_NAME
- BOARD_ID
## Schedule
- Schedule is controlled by gateway heartbeat config (default: every 10 minutes).
- On first boot, send one immediate check-in before the schedule starts.
## On every heartbeat
1) Check in:
```bash
curl -s -X POST "$BASE_URL/api/v1/agents/heartbeat" \
-H "X-Agent-Token: $AUTH_TOKEN" \
-H "Content-Type: application/json" \
-d '{"name": "'$AGENT_NAME'", "board_id": "'$BOARD_ID'", "status": "online"}'
```
2) List boards:
```bash
curl -s "$BASE_URL/api/v1/boards" \
-H "X-Agent-Token: $AUTH_TOKEN"
```
3) For each board, list tasks:
```bash
curl -s "$BASE_URL/api/v1/boards/{BOARD_ID}/tasks" \
-H "X-Agent-Token: $AUTH_TOKEN"
```
4) Claim next task (FIFO):
- Find the oldest task with status "inbox" across all boards.
- Claim it by moving it to "in_progress":
```bash
curl -s -X PATCH "$BASE_URL/api/v1/boards/{BOARD_ID}/tasks/{TASK_ID}" \
-H "X-Agent-Token: $AUTH_TOKEN" \
-H "Content-Type: application/json" \
-d '{"status": "in_progress"}'
```
5) Work the task:
- Update status as you progress.
- Post a brief work log to the task comments endpoint (do not use chat).
- When complete, move to "review":
```bash
curl -s -X PATCH "$BASE_URL/api/v1/boards/{BOARD_ID}/tasks/{TASK_ID}" \
-H "X-Agent-Token: $AUTH_TOKEN" \
-H "Content-Type: application/json" \
-d '{"status": "review"}'
```
```bash
curl -s -X POST "$BASE_URL/api/v1/boards/{BOARD_ID}/tasks/{TASK_ID}/comments" \
-H "X-Agent-Token: $AUTH_TOKEN" \
-H "Content-Type: application/json" \
-d '{"message": "Summary of work, result, and next steps."}'
```
## Status flow
```
inbox -> in_progress -> review -> done
```
Do not say HEARTBEAT_OK if there is inbox work or active in_progress work.