Session checkpoints
Save a summary of where an agent got to, so its next session picks up with context intact.
Why checkpoints exist
Agents that run for hours or days fill their context window quickly. A session checkpoint gives an agent a lasting hand-off point: a single record summarizing progress, learnings and next steps. The next session reads the latest checkpoint and carries on, without going back over every earlier turn.
Anatomy of a checkpoint
A checkpoint is a LEARN record on the session thread with
body.kind = "agent.session.checkpoint". The body carries:
{
"summary": "Completed auth refactor; next: migration tests",
"learnings": [
"mutex pattern worked for concurrent refresh",
"refactor touched 14 files"
],
"next_steps": "Write migration tests for the new mutex path",
"thread": "th_auth_refactor_...",
"session_id": "sess_...",
"actor": "did:sync:agent:dev"
}The session_id can be anything: the short alias your task tracker
assigns, a UUID, or the thread ID itself.
Creating a checkpoint from the CLI
spl session save \
--thread th_auth_refactor_abc123 \
--summary "Completed auth refactor; next: migration tests" \
--learnings "mutex pattern worked" \
--learnings "refactor touched 14 files" \
--next-steps "Write migration tests" \
--actor did:sync:agent:devFlags:
--thread: the session thread to checkpoint. Defaults to your latest active task thread.--summary: a one-paragraph progress summary.--learnings: repeat for each learning (at least 1).--next-steps: what the next session should pick up first.--actor: the agent's DID. Defaults to the identity in your configuration.
Creating a checkpoint from an SDK
Python
await client.emit(
act="LEARN",
kind="agent.session.checkpoint",
body={
"summary": "Completed auth refactor",
"learnings": ["mutex pattern worked"],
"next_steps": "Write migration tests",
},
thread=thread,
)TypeScript
await client.emit({
act: "LEARN",
kind: "agent.session.checkpoint",
body: {
summary: "Completed auth refactor",
learnings: ["mutex pattern worked"],
next_steps: "Write migration tests",
},
thread: threadId,
});Let the workspace draft it: --draft
You don't have to write the checkpoint by hand. With --draft, the
workspace works out what happened from your records (what closed,
what's still open, which decisions await you, what moved) and saves
it to your attention thread:
spl session save --draft --summary "One human line on top of the drafted summary"--summary, --learnings, and --next-steps are added to the draft rather
than replacing it; the one summary line is usually the only part worth
writing by hand. --reason records why the session stopped
(explicit_end, context_window_limit, timeout, …) so a later reader knows
whether the session ended cleanly.
Run this before an agent's context fills up, a laptop lid closes, or a shift ends. It takes one command and makes coming back easy.
spl resume: where was I, what changed, what needs me
The other half of --draft. On a fresh session:
spl resumeOne answer covers three questions: the summary line you
left, what changed while you were away (rooms with new activity), and what
needs you (pending decisions; answer them with spl decisions). It also shows
the totals and a suggested next room. To go into a specific
room (a thread ID, a thread prefix or a task alias) for its
re-entry brief:
spl resume <task>spl resume reads what spl session save --draft saved. Save when you stop, resume when you return, and nothing between sessions depends on memory.
Resuming from a checkpoint
The agent's first action each session is to read the latest checkpoint:
# List checkpoints on a thread
spl session list --thread th_auth_refactor_abc123
# Show one in detail
spl session show th_auth_refactor_abc123In code, query the records on the thread, keep those with
body.kind == "agent.session.checkpoint", sort by clock, and take the
last one:
const records = await client.queryThread({ thread: threadId });
const checkpoints = records
.filter(r => r.body?.kind === "agent.session.checkpoint")
.sort((a, b) => a.clock - b.clock);
const latest = checkpoints[checkpoints.length - 1];
// agent now has: summary, learnings[], next_stepsDev agent protocol
The dev agent (did:sync:agent:dev) prompt template expects a
checkpoint at the end of every session. See
Agent integration for the details. People
reviewing an agent's work read its checkpoints first to see progress.
When NOT to use checkpoints
- Single-turn tasks: nothing to resume, so a checkpoint is wasted
- Throwaway exploration: nothing worth keeping
- Fine-grained progress tracking: use KNOW records per step, not checkpoints per step. Checkpoints are summaries, not step logs.
Retention and cleanup
Checkpoints are records like any other: unchangeable and permanent. They are not deleted automatically. On long-running threads with many sessions, they keep accumulating.
If you want to retain only the last N checkpoints per thread, emit a
core.erasure record referencing older ones.
Pairs with
- Agent integration: the full protocol for the dev agent + other roles
- Python SDK / TypeScript SDK: the full
emit()and thread-query reference
Body-Kind Manifests
Speed up queries that filter on fields inside a record's body by declaring which fields to index for a given body.kind.
Dispatch observability
See what happened in a dispatched task. Covers the records each dispatch writes, how to read them with spl task diagnose and spl logs, and what the completion and failure values mean.