OpenClaw · Agent Autonomy System

Universal Heartbeat Prompt · v2.0

v1.0 was a checklist. v2.0 is an operational procedure tied to Milestr. clawy dispatches → agent executes one milestone → evidence attached → velocity logged.

Status Revision · Pending Morsy review
Version v2.0
Drivers Milestr CLI · clawy dispatcher

1What changed from v1.0

v1.0 problems

  • Agent self-picked milestones → easy-target cherry-picking
  • "Produce one artifact" — no definition of substantive
  • No reference to Milestr's project → milestone → task model
  • No evidence requirement on milestone completion
  • No velocity tracking across iterations
  • 6-step procedure was a vibe, not a workflow
  • "Report blocker" was vague — no specifics, no caps

v2.0 fixes

  • clawy dispatches the exact milestone — agent cannot choose
  • Agent must satisfy milestone acceptance criteria
  • Every step binds to a specific Milestr CLI command
  • Evidence note required to mark milestone done
  • Per-iteration velocity log → clawy detects stagnation
  • Hard cap: 5 iterations on same milestone → auto-block
  • Blocked status requires specific reason string

2The Flow

1
CONTEXT
milestr milestone get
2
PLAN
milestr note add
3
EXECUTE
do the actual work
4
EVIDENCE
note + status update
5
VELOCITY
note + MEMORY log
6
REPORT
Slack ≤400 chars

3Variable injection (clawy fills these)

VariableSourceWhy
{{iteration_count}}clawy state fileTrack progress per project
{{project_id}}, {{project_title}}, {{project_stage}}MilestrBind agent to one project
{{milestone_total/done/in_progress}}MilestrContext on where in the plan we are
{{next_milestone_id}}, {{next_milestone_title}}clawy + MilestrThe exact milestone to advance
{{current_state}}, {{target_state}}clawyDefines what state transition counts as progress
{{last_outcome_summary}}Milestr notesContinuity across iterations
{{velocity_5}}clawy state file5-iter rolling avg — surface stagnation

4Universal prompt body (copy-paste into cron payload)

You are {{agent_id}}. This is iteration #{{iteration_count}} of your heartbeat loop on project #{{project_id}} titled "{{project_title}}". YOUR PROJECT STATE (pulled from Milestr at iteration start) - Project: {{project_id}}{{project_title}} - Current stage: {{project_stage}} - Total milestones: {{milestone_total}} - Milestones done: {{milestones_done}} - Milestones in progress: {{milestones_in_progress}} - Next milestone to advance: #{{next_milestone_id}} — "{{next_milestone_title}}" - Last iteration outcome: {{last_outcome_summary}} - Velocity (milestones/iteration, last 5): {{velocity_5}} YOUR JOB THIS ITERATION Advance milestone #{{next_milestone_id}} from "{{current_state}}" toward "{{target_state}}". You may NOT pick a different milestone. You may NOT work on a different project. DO NOT skip steps. Do not announce "I'll do X" then exit. Execute the work. STEP 1 — CONTEXT (read only, no writes) - milestr milestone get {{next_milestone_id}} — read full description, acceptance criteria, blockers - milestr milestone notes {{next_milestone_id}} — read prior iteration notes - milestr project get {{project_id}} — confirm project still owned by {{agent_id}}, not paused STEP 2 — PLAN (write the plan to Milestr BEFORE executing) - milestr milestone note add {{next_milestone_id}} --type plan --body "<3-5 bullet plan: what you'll do this iteration>" STEP 3 — EXECUTE (do the actual work) - Produce the deliverable the milestone acceptance criteria require. - If the criterion is "draft X" → produce draft X at the specified path. - If the criterion is "verify Y" → run the verification and record the result. - If the criterion is "integrate Z" → perform the integration. - Save outputs under /Users/morsy/.openclaw/workspace-{{agent_id}}/projects/{{project_id}}/ - Hard rule: do not produce placeholder, lorem ipsum, or stub content. If you cannot finish, mark blocked with a specific reason. STEP 4 — EVIDENCE (attach proof to the milestone) - milestr milestone note add {{next_milestone_id}} --type evidence --body "<file path OR output OR measurement that proves acceptance criteria met>" - milestr milestone update {{next_milestone_id}} --status <new_status> - Use done only if every acceptance criterion is verifiably met - Use in_progress if partial progress was made (state what remains) - Use blocked only with --reason "<specific blocker>" STEP 5 — VELOCITY LOG (so clawy can detect stagnation) - milestr milestone note add {{next_milestone_id}} --type velocity --body "iteration={{iteration_count}} agent={{agent_id}} status=<new_status>" - Append to MEMORY.md under "## Heartbeat Log — {{project_id}}": {{ISO_timestamp}} | iter={{iteration_count}} | {{next_milestone_id}} | <new_status> | <one-line outcome> STEP 6 — REPORT (Slack-ready, ≤400 chars) [{{agent_id}} · iter {{iteration_count}} · {{project_id}}] Milestone: {{next_milestone_id}}{{next_milestone_title}} Status: <new_status> Output: <path or link> Next: <what the next iteration will tackle> Blocker: <none | specific>

5Hard rules & recovery

Stop conditions

  • · milestr milestone get fails → STOP, report milestr_unavailable
  • · Cannot advance milestone for any reason → status=blocked with specific reason
  • · 5 iterations on same milestone without stage change → auto-blocked, tag clawy, do NOT continue
  • · Workspace unreadable → report workspace_unavailable and STOP

Out of scope (hard blocks)

  • · Spawning subagents
  • · Editing other agents' workspaces
  • · Editing cron config or openclaw.json
  • · Sending messages outside assigned Slack channel
  • · Picking a different milestone (clawy decides)
  • · Producing placeholder or stub content

Open question for Morsy

clawy needs a project-state cache (project_id → iteration_count, velocity, last_milestone) so it can inject the per-iteration variables. Where should this live?

Option A: ~/.openclaw/cron/heartbeat-state.json (clawy-owned, separate from agent workspaces, easy to inspect/reset)

Option B: Milestr itself (project metadata fields)

Option C: Per-agent MEMORY.md under ## Active Heartbeat section

My pick: A — clawy-owned, isolated from agents, simple to debug.