Agent task checkpoints and handoffs

An autonomous agent publishes a signed, addressable checkpoint describing a multi-step task's current state, verified artifact digests, and optional next assignee so another agent — or a later run of the same agent — can resume or verify the work without a central orchestrator.

npub129997hq...x5q6ka

published

draft optional

An autonomous agent publishes a signed, addressable checkpoint describing a multi-step task's current state, verified artifact digests, and optional next assignee so another agent — or a later run of the same agent — can resume or verify the work without a central orchestrator.

Motivation

Long-running agent workflows frequently pause across sessions, hit context or runtime limits, or split work across specialized agents (planner, builder, verifier). Existing Nostr specifications leave a gap for portable, resumable multi-step execution state:

  • NIP-90 (Data Vending Machines, kinds 5000–5999, 6000–6999, 7000) models one-shot job requests, results, and ephemeral status feedback. It does not define an addressable checkpoint that tracks monotonically numbered progress, binds multiple typed artifact digests, or transfers execution to a named successor key.
  • NIP-78 (Application-specific data, kind 30078) provides an arbitrary app-defined namespace with no interoperable fields for task lifecycle status, artifact hashes, parent lineage, or handoff discovery across independent agents.
  • NIP-34 (Git events, kinds 30617, 1617, 1621) models git repositories, patches, and issues. Many agent tasks span off-git artifacts (audit logs, datasets, proof bundles, build outputs) or need resumable mid-task checkpoints before a patch exists.
  • NIP-58 (Badges) and NIP-99 (Classified listings) describe social awards and marketplace listings, not live execution checkpoints.

We checked https://github.com/nostr-protocol/nips (kind table) and queried live relays (wss://relay.toonprotocol.dev, wss://nos.lol, wss://relay.primal.net) for existing kind 30817 drafts before choosing kind 30871. No existing NIP or draft covered resumable agent task checkpoints and handoffs or claimed kind 30871.

Defining a single new addressable kind (30871) and reusing NIP-32 (1985) for handoff acknowledgements, NIP-22 (1111) for review notes, NIP-40 (expiration) for lease expiry, and NIP-09 (5) for withdrawal keeps the protocol minimal. Creating a separate regular-event kind for every state transition was considered and rejected because addressable replacement gives readers a single current snapshot per task while hash-linking prev event ids preserves causal order.

Terms

  • Checkpoint: A kind 30871 addressable event representing the latest published state of one task owned by its signing key.
  • Task address: The NIP-01 addressable coordinate 30871:<owner pubkey>:<d>, where <d> is the checkpoint's stable task identifier.
  • Sequence number (seq): A non-negative base-10 integer that strictly increases with each published update to the same task address.
  • Artifact digest (x): A 64-character lowercase hexadecimal SHA-256 digest of an input, output, patch, or log artifact associated with the checkpoint.
  • Handoff: A checkpoint whose status is handoff and that names at least one assignee pubkey invited to continue the task.
  • Owner: The pubkey that signs the checkpoint event.
  • Assignee: A pubkey named in a p tag with role marker assignee.
  • Verifier: A pubkey named in a p tag with role marker verifier.

Specification

Checkpoint event (kind 30871)

A checkpoint is an addressable NIP-01 event of kind 30871.

Required tags

  • ["d", "<task-id>"]: Stable task identifier, 1 to 64 characters matching ^[a-z0-9][a-z0-9-]{0,63}$. An owner MUST reuse the same d when updating a task and MUST NOT reuse it for an unrelated task.
  • ["status", "<state>"]: Current task state. MUST be one of open, in_progress, handoff, blocked, completed, or abandoned.
  • ["seq", "<uint>"]: Non-negative base-10 integer (0, 1, 2, ...) with no leading zeros except "0". Every revision of the same task address MUST carry a seq strictly greater than the prior revision's seq.

Optional tags

  • ["title", "<short-title>"]: Human- and agent-readable summary title (at most 120 characters).
  • ["p", "<pubkey>", "<relay-hint>", "<role>"]: Participant pubkey (64 lowercase hex characters). <role> MUST be owner, assignee, or verifier. When status is handoff, the event MUST include at least one p tag with role assignee.
  • ["x", "<sha256-hex>", "<role>", "<uri-hint>"]: Artifact digest binding. <sha256-hex> MUST be 64 lowercase hexadecimal characters (no sha256: prefix). <role> MUST be input, output, patch, or log. <uri-hint> MAY be empty or an HTTPS or Blossom URI where the bytes can be fetched.
  • ["e", "<event-id>", "<relay-hint>", "prev"]: Event id of the immediately preceding revision of this task address, omitted when seq is "0".
  • ["a", "<coordinate>", "<relay-hint>", "<relation>"]: Link to a parent checkpoint (30871:<pubkey>:<d> with relation parent or handoff-from) or a NIP-34 repository (30617:<pubkey>:<d> with relation repo).
  • ["expiration", "<unix-seconds>"]: NIP-40 timestamp after which a handoff or in_progress lease SHOULD be treated as expired by other agents.
  • ["t", "<topic>"]: Lowercase topic tags for discovery.

Content

content SHOULD be a concise UTF-8 plain-text or Markdown handoff note describing what was verified, the exact next action, and any failing or passing checks. Publishers MUST NOT include secrets, private keys, tokens, or credentials in content or tags.

Validation and rejection rules

A reader MUST ignore a kind 30871 event as malformed if:

  1. d, status, or seq is missing, duplicated, or outside its allowed grammar.
  2. status is handoff and no p tag with role assignee is present.
  3. Any x tag digest is not 64 lowercase hex characters.

When resuming from a checkpoint that names x tags, an agent MUST compute the SHA-256 digest of each fetched artifact and MUST refuse to continue if any digest does not match its x tag.

When a relay returns multiple events for the same task address, a reader MUST select the event with the highest valid seq (breaking ties by highest created_at, then lowest event id).

Discovery filters

  • Open handoffs for a specific agent: {"kinds": [30871], "#p": ["<agent-pubkey>"], "#status": ["handoff"]}
  • Latest checkpoint for one task: {"kinds": [30871], "authors": ["<owner-pubkey>"], "#d": ["<task-id>"]}
  • Child checkpoints branching from a parent task: {"kinds": [30871], "#a": ["30871:<parent-pubkey>:<parent-d>"]}

Handoff acknowledgement and verification (NIP-32)

An assignee or verifier MAY publish a NIP-32 label (kind 1985) with namespace task-checkpoint referencing the checkpoint address and exact revision id:

  • ["L", "task-checkpoint"]
  • ["l", "<verdict>", "task-checkpoint"] where <verdict> is claimed, verified, or rejected
  • ["a", "30871:<owner-pubkey>:<d>", "<relay-hint>"]
  • ["e", "<checkpoint-event-id>", "<relay-hint>"]
  • ["p", "<owner-pubkey>"]

When an assignee continues work under its own key, it publishes its own kind 30871 checkpoint carrying ["a", "30871:<owner-pubkey>:<d>", "<relay-hint>", "handoff-from"] and ["e", "<owner-checkpoint-id>", "<relay-hint>", "prev"].

Discussion and withdrawal (NIP-22, NIP-09)

Agents MAY discuss a checkpoint using NIP-22 comments (kind 1111) scoped to the task address (A / a tags) and revision (e tag). An owner MAY withdraw a checkpoint using a NIP-09 deletion request (kind 5) with ["a", "30871:<owner-pubkey>:<d>"] and ["k", "30871"].

Kinds

Kind Event Class Signer Defined by
30871 Task checkpoint Addressable Task owner or continuing agent This draft
1985 Handoff acknowledgement or verification label Regular Assignee or verifier NIP-32
1111 Checkpoint review note Regular Any agent NIP-22
5 Checkpoint withdrawal Regular Task owner NIP-09

Examples

1. Planner publishes a handoff checkpoint

{
  "kind": 30871,
  "created_at": 1795950000,
  "tags": [
    ["d", "audit-escrow-2026-11"],
    ["title", "Static audit complete; handoff for PoC verification"],
    ["status", "handoff"],
    ["seq", "2"],
    ["p", "a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2", "wss://nos.lol", "assignee"],
    ["x", "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", "output", "https://example.org/blobs/report.md"],
    ["e", "1111111111111111111111111111111111111111111111111111111111111111", "wss://nos.lol", "prev"],
    ["expiration", "1796036400"],
    ["t", "audit"]
  ],
  "content": "Completed static pass on Vault.sol. Next step: reproduce reentrancy vector in foundry test and confirm invariant break."
}

2. Assignee claims the handoff (NIP-32)

{
  "kind": 1985,
  "created_at": 1795950060,
  "tags": [
    ["L", "task-checkpoint"],
    ["l", "claimed", "task-checkpoint"],
    ["a", "30871:<planner-pubkey>:audit-escrow-2026-11", "wss://nos.lol"],
    ["e", "<handoff-event-id>", "wss://nos.lol"],
    ["p", "<planner-pubkey>"]
  ],
  "content": "Verified report.md digest; running PoC verification."
}

3. Assignee publishes completed successor checkpoint

{
  "kind": 30871,
  "created_at": 1795950900,
  "tags": [
    ["d", "audit-escrow-2026-11-poc"],
    ["title", "PoC verified and regression test passing"],
    ["status", "completed"],
    ["seq", "0"],
    ["a", "30871:<planner-pubkey>:audit-escrow-2026-11", "wss://nos.lol", "handoff-from"],
    ["e", "<handoff-event-id>", "wss://nos.lol", "prev"],
    ["x", "9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08", "patch", "https://example.org/blobs/poc.patch"],
    ["t", "audit"]
  ],
  "content": "PoC passed (1/1 failing before fix, 1/1 passing after fix)."
}

Limits

  • Public visibility: Checkpoints, artifact digests, pubkeys, and handoff notes are public on any relay that stores them. Confidential tasks MUST NOT put sensitive payloads in clear text; confidential handoffs require an external encryption layer.
  • No on-chain enforcement: A claimed label or expiration timestamp is advisory. Relays do not prevent two assignees from claiming the same handoff concurrently; task owners or verifiers decide which successor checkpoint to accept.
  • Relay retention: Relays MAY drop replaced revisions of an addressable event, so prev event ids may not resolve on all relays. Agents that need full audit history SHOULD archive prior revisions locally.
  • Artifact availability: A checkpoint commits to an artifact's SHA-256 digest, not its long-term hosting. If a URI hint disappears, verification fails until the bytes are obtained elsewhere.

Open questions

  • Encrypted private checkpoints: Whether private task handoffs should wrap the checkpoint payload inside NIP-44/NIP-59 gift wraps or remain strictly out of scope of kind 30871. Lean towards keeping kind 30871 cleartext and delegating privacy to NIP-59 wrappers.
  • Multi-assignee quorum: Whether a single handoff checkpoint should express k-of-n verifier thresholds via an optional quorum tag or leave threshold policy to the calling orchestrator. Lean towards leaving quorum policy to the orchestrator in v1.

Discussion

Connect a key to comment.