{
 "schema": "aiblocks-page/1",
 "id": "the-10-step-heartbeat-protocol-implementation-planner",
 "type": "skill",
 "name": "Single-task agent heartbeat builder",
 "summary": "Plan a safe AI agent run loop: one task per run, no overlapping runs, time and cost limits, and a run record. Draft code only.",
 "headline": "Single-task agent heartbeat builder",
 "subhead": "Give it your agent's jobs, its work queue, the order it should pick work and its time and cost limits. It plans a run loop that does one task, then stops and records the run. You get the steps, a run record, a schedule worksheet and tests. Nothing is run.",
 "job": {
  "id": "build-software",
  "name": "Build and ship software"
 },
 "level": "intermediate",
 "thinking": "medium",
 "tested": true,
 "updated": "2026-11-03",
 "first_published": "2026-10-25",
 "inputs": [
  {
   "type": "question",
   "required": true,
   "label": "Question",
   "what": "the problem, decision or piece of work you want help with, and what a good outcome looks like"
  },
  {
   "type": "codebase",
   "required": false,
   "label": "Codebase",
   "what": "a project's code, in a folder or repo the AI can open"
  }
 ],
 "outputs": [
  {
   "type": "plan",
   "required": true,
   "label": "Plan",
   "what": "a dated plan: what to do, in what order, with a decision rule for each step"
  },
  {
   "type": "code_change",
   "required": false,
   "label": "Code change",
   "what": "a change to the code, with what it fixes and how it was checked"
  }
 ],
 "you_give": [
  "Your agents, and what each one is responsible for",
  "The kinds of work in your queue and the order the agent should pick them",
  "The ways a run can start, such as a timer, a wakeup or a person",
  "How long a run may take, how many runs a day and the cost limit for each",
  "Your runner code and tables (optional)"
 ],
 "you_get": [
  "A numbered run loop, with what stops the run at each step",
  "The four checks that run before any work, and what is saved when one fails",
  "The pick order for work, with how ties are broken",
  "The fields of the run record",
  "A schedule worksheet for each agent",
  "A list of gaps in the starter runner, and test cases"
 ],
 "use_when": [
  "You want an agent to work through its task list on a timer without doing the same task twice.",
  "An agent run hung once and the task stayed locked, and you want that fixed.",
  "You need a record of every run: what it did, how long it took and what it cost.",
  "You have a starter runner with stubs and need to know what to fill in first."
 ],
 "skip_when": [
  "You have one script that does one job on a timer. A plain scheduled job is enough.",
  "You want to plan how wakeups are saved, claimed and retried. Use the Agent wakeup and claim recovery builder.",
  "You want the task table and the lock on each task. Use the Agent task ownership workflow builder.",
  "You want hard spending limits. Use the Agent spending cap builder.",
  "You want jobs that survive a server restart. Use the Recoverable agent job queue builder."
 ],
 "output_sample": {
  "input": [
   "Your agents and what each is responsible for",
   "Your work types and the order to pick them",
   "How runs start, and the time, run count and cost limits",
   "Your runner code and tables (optional)"
  ],
  "prerequisites": [
   "A task list the agent can read, or the starter layout to build one",
   "Somewhere to save a run record, such as a database table"
  ],
  "output": [
   {
    "name": "Run loop",
    "contains": "The steps of one run in order, what stops the run at each, and what is saved."
   },
   {
    "name": "Checks before work",
    "contains": "Switch, budget, one-run-at-a-time and time limit, with what is saved when one fails."
   },
   {
    "name": "Pick order",
    "contains": "Which kind of work goes first, and how ties are broken."
   },
   {
    "name": "Run record",
    "contains": "The fields saved for every run, such as status, reason, items done and cost."
   },
   {
    "name": "Schedule worksheet",
    "contains": "For each agent, how often it runs, its active hours, and its time and cost limits."
   },
   {
    "name": "Gaps in the starter",
    "contains": "Where the starter would leave a task locked or run twice, and the fix for each."
   },
   {
    "name": "Test cases",
    "contains": "Cases such as two runs at once, a hung run and a crash in the middle of a task."
   }
  ]
 },
 "output_shape": "BASIS\n<what was read; nothing was run>\nMISSING: <inputs and what each stops>\n\nRUN LOOP\n<step> | <what happens> | <stops the run if> | <what is saved>\n\nCHECKS BEFORE WORK\n<check> | <how it is tested> | <what is saved when it fails>\n\nPICK ORDER\n<order> | <kind of work> | <how ties are broken>\n\nRUN RECORD\n<field> | <meaning>\n\nSCHEDULE WORKSHEET\n<agent> | <purpose> | <how often> | <active hours and time zone> | <wakeup types> | <longest run> | <runs per day> | <cost limit>\n\nGAPS IN THE STARTER\n<#> | <what it does> | <why it matters> | <fix>\n\nTEST CASES\n<name> | <set-up> | <expected result>\n\nNEXT STEP\n<one smallest useful step>",
 "how_to_use": [
  "Open the skill in an AI that can read your code, such as Claude Code or Codex. A chat AI works if you paste the files in.",
  "Paste your agent list, work types, pick order and limits. Never paste a key or a password.",
  "Read GAPS IN THE STARTER first. Mark each one as a problem for you or not.",
  "Check the PICK ORDER against how you would sort your own to-do list.",
  "Check the RUN RECORD has the fields you need to answer 'what did it do last night?'",
  "Run the draft code and the test cases on a copy of your system. This skill never runs anything."
 ],
 "checks": [],
 "next": [
  {
   "name": "Slack agent message router builder",
   "url": "https://useaiblocks.com/skills/how-messages-reach-your-agent-implementation-planner",
   "why": "Build it"
  }
 ],
 "source": null,
 "credits": [],
 "files": [
  "references/heartbeat-runner-starter.ts",
  "references/method-notes.md",
  "references/visual-reference-notes.md"
 ],
 "links": {
  "page": "https://useaiblocks.com/skills/the-10-step-heartbeat-protocol-implementation-planner",
  "markdown": "https://useaiblocks.com/skills/the-10-step-heartbeat-protocol-implementation-planner.md",
  "json": "https://useaiblocks.com/skills/the-10-step-heartbeat-protocol-implementation-planner.json",
  "instructions": "https://useaiblocks.com/skills/the-10-step-heartbeat-protocol-implementation-planner/SKILL.md",
  "download": "https://useaiblocks.com/skills/the-10-step-heartbeat-protocol-implementation-planner.zip",
  "api_item": "https://useaiblocks.com/api/v1/items/the-10-step-heartbeat-protocol-implementation-planner",
  "api_document": "https://useaiblocks.com/api/v1/documents/skill/the-10-step-heartbeat-protocol-implementation-planner",
  "mcp": "https://useaiblocks.com/mcp"
 }
}
