auto-checkpoint — bounded working context, durable work
Use the existing work state, not another memory store. In roberdan-os, kb owns the card
and handoff/resume.md owns the recovery capsule. Existing job databases/cursors remain
authoritative for their jobs; this skill does not create state.db or a scheduler.
Outside this installation, use one local session/workspace checkpoint with the same
fields. Never put confidential notes in a public working tree.
When to checkpoint
- At each completed phase, before a large read/output, before compaction, and when a job
starts, finishes or becomes uncertain. A whole turn can be long: end-of-turn saving is
not sufficient.
- If the host reports context pressure, save before doing more broad exploration.
Do not estimate percentages from conversation length. Without a measured signal, use
phase boundaries and symptoms: rereading the same material, losing a constraint,
repeating a failed approach, or inability to restate the next step.
- Save only conclusions, constraints and evidence references. Keep raw tool output in
files and retrieve bounded ranges on demand. Delegate independent investigations to
fresh contexts with explicit scope, required model profile and a bounded result.
- At phase ends, reconcile the vault and repository docs manually with [[sync]];
regenerating platform wrappers is not memory reconciliation.
Recovery capsule
kb pause --context '<JSON>' validates these seven fields and atomically replaces the
existing checkpoint. Input is at most 12000 UTF-8 bytes; the complete checkpoint is at
most 16384 bytes. Oversized/invalid input is refused, never silently truncated. Use
references when the working set does not fit.
{
"goal": "Current authorized objective and card ID",
"acceptance": "Exact observable terminal condition; reference the full criteria",
"constraints": ["Scope exclusions, human gates, remaining review budget"],
"decisions": ["Choice and reason; rejected approach and why not to retry it"],
"evidence": ["Artifact path plus revision and observed result; unverified claims labelled"],
"pending": ["Job/agent ID, owner, scope, state, artifact, next observation; unresolved approval"],
"next": "One exact safe action from the correct working directory"
}
goal, acceptance, next are nonempty strings; the other fields are arrays of up to
12 nonempty strings. Empty arrays mean none, not unknown: record uncertainty explicitly.
Never put credentials or transcripts in the capsule. Its origin revision stays frozen
when kb pause --auto updates mechanical state; newer HEAD does not revalidate old evidence.
Include owned worktree paths in pending until cleanup is complete. At task close, prove
they have no active users, unsaved/untracked/ignored data to preserve or unmerged commits;
remove only those exact owned paths via kb finish / git worktree remove, never force.
If any check is uncertain, retain the path with its reason and next check.
Compaction and recovery
- Reach a safe boundary and save the capsule. Compaction must not cancel healthy jobs,
reset review budgets, grant approvals, change models/effort or increase paid limits.
- Let the host's native compaction manage its window. Use a supported compact operation
when available; do not send
/compact to Bash or pretend that printing it executes it.
Never substitute /clear or /new, which can lose live task/session handles.
- After compaction/resume, read
kb resume --context, the current card and only the
referenced artifacts needed next. Recheck working directory, current revision/dirty
state, approvals and live jobs. The capsule is a set of claims, not new authority.
- State the goal, constraints and next action from that evidence. If any essential fact
is missing, recover it from its source before effects. Ask only for genuinely missing
human decisions; do not reopen settled choices just because the conversation shrank.
- Resume the outstanding step, not the whole job. A cancelled/timeout result can have
side effects: reconcile it first. Two observations without progress stop that step,
not launch a third identical attempt. See [[long-running-jobs]].
Actual platform behavior
- Claude Code: installed
PreCompact runs the mechanical checkpoint; SessionStart
reloads context after compact. The agent still writes semantic decisions at phase ends.
- Copilot CLI 1.0.84-1: the adapter uses typed root
session.usage_info to request one
mechanical save at 65% (rearmed below 50%), plus session.compaction_start. It never changes
the host's compaction thresholds. On successful session.compaction_complete, the next
prompt/tool receives one bounded kb resume --context result. Child events are ignored.
Idle/end saves remain. Event callbacks cannot hold up compaction or capture thoughts:
the saved capsule must already exist. Missing events on older hosts mean phase saves,
not a fabricated automation guarantee.
- Other hosts: use their declared tools only. Manual capsule recovery remains valid;
no automatic
launchd, cron, factory or wakeup loop is installed by this skill.
Quality boundary
A bigger window is not a remedy for accumulated noise. Preserve required model profiles
and reasoning effort; [[model-selection-policy]] governs any change. Recheck acceptance
against real artifacts after recovery. Fresh reviewers receive scope, current diff and
evidence, not a transcript or the author's verdict.
These controls bound replay/context overhead and preserve recorded state. They cannot
guarantee unchanged model accuracy for arbitrarily long sessions. Existing regression
tests exercise storage and lifecycle behavior, not a paid outcome benchmark.
1---2name: auto-checkpoint3description: Portable "loop kit" — inject durable state, terminal-condition, auto-resume and auto-escalation into any session. Makes the loop reliable without a daemon.4---56# auto-checkpoint — bounded working context, durable work78Use the existing work state, not another memory store. In roberdan-os, `kb` owns the card9and `handoff/resume.md` owns the recovery capsule. Existing job databases/cursors remain10authoritative for their jobs; this skill does not create `state.db` or a scheduler.11Outside this installation, use one local session/workspace checkpoint with the same12fields. Never put confidential notes in a public working tree.1314## When to checkpoint1516- At each completed phase, before a large read/output, before compaction, and when a job17 starts, finishes or becomes uncertain. A whole turn can be long: end-of-turn saving is18 not sufficient.19- If the host reports context pressure, save before doing more broad exploration.20 Do not estimate percentages from conversation length. Without a measured signal, use21 phase boundaries and symptoms: rereading the same material, losing a constraint,22 repeating a failed approach, or inability to restate the next step.23- Save only conclusions, constraints and evidence references. Keep raw tool output in24 files and retrieve bounded ranges on demand. Delegate independent investigations to25 fresh contexts with explicit scope, required model profile and a bounded result.26- At phase ends, reconcile the vault and repository docs manually with [[sync]];27 regenerating platform wrappers is not memory reconciliation.2829## Recovery capsule3031`kb pause --context '<JSON>'` validates these seven fields and atomically replaces the32existing checkpoint. Input is at most 12000 UTF-8 bytes; the complete checkpoint is at33most 16384 bytes. Oversized/invalid input is refused, never silently truncated. Use34references when the working set does not fit.3536```json37{38 "goal": "Current authorized objective and card ID",39 "acceptance": "Exact observable terminal condition; reference the full criteria",40 "constraints": ["Scope exclusions, human gates, remaining review budget"],41 "decisions": ["Choice and reason; rejected approach and why not to retry it"],42 "evidence": ["Artifact path plus revision and observed result; unverified claims labelled"],43 "pending": ["Job/agent ID, owner, scope, state, artifact, next observation; unresolved approval"],44 "next": "One exact safe action from the correct working directory"45}46```4748`goal`, `acceptance`, `next` are nonempty strings; the other fields are arrays of up to4912 nonempty strings. Empty arrays mean none, not unknown: record uncertainty explicitly.50Never put credentials or transcripts in the capsule. Its origin revision stays frozen51when `kb pause --auto` updates mechanical state; newer HEAD does not revalidate old evidence.52Include owned worktree paths in `pending` until cleanup is complete. At task close, prove53they have no active users, unsaved/untracked/ignored data to preserve or unmerged commits;54remove only those exact owned paths via `kb finish` / `git worktree remove`, never force.55If any check is uncertain, retain the path with its reason and next check.5657## Compaction and recovery58591. Reach a safe boundary and save the capsule. Compaction must not cancel healthy jobs,60 reset review budgets, grant approvals, change models/effort or increase paid limits.612. Let the host's native compaction manage its window. Use a supported compact operation62 when available; do not send `/compact` to Bash or pretend that printing it executes it.63 Never substitute `/clear` or `/new`, which can lose live task/session handles.643. After compaction/resume, read `kb resume --context`, the current card and only the65 referenced artifacts needed next. Recheck working directory, current revision/dirty66 state, approvals and live jobs. The capsule is a set of claims, not new authority.674. State the goal, constraints and next action from that evidence. If any essential fact68 is missing, recover it from its source before effects. Ask only for genuinely missing69 human decisions; do not reopen settled choices just because the conversation shrank.705. Resume the outstanding step, not the whole job. A cancelled/timeout result can have71 side effects: reconcile it first. Two observations without progress stop that step,72 not launch a third identical attempt. See [[long-running-jobs]].7374## Actual platform behavior7576- **Claude Code:** installed `PreCompact` runs the mechanical checkpoint; `SessionStart`77 reloads context after compact. The agent still writes semantic decisions at phase ends.78- **Copilot CLI 1.0.84-1:** the adapter uses typed root `session.usage_info` to request one79 mechanical save at 65% (rearmed below 50%), plus `session.compaction_start`. It never changes80 the host's compaction thresholds. On successful `session.compaction_complete`, the next81 prompt/tool receives one bounded `kb resume --context` result. Child events are ignored.82 Idle/end saves remain. Event callbacks cannot hold up compaction or capture thoughts:83 the saved capsule must already exist. Missing events on older hosts mean phase saves,84 not a fabricated automation guarantee.85- **Other hosts:** use their declared tools only. Manual capsule recovery remains valid;86 no automatic `launchd`, `cron`, factory or wakeup loop is installed by this skill.8788## Quality boundary8990A bigger window is not a remedy for accumulated noise. Preserve required model profiles91and reasoning effort; [[model-selection-policy]] governs any change. Recheck acceptance92against real artifacts after recovery. Fresh reviewers receive scope, current diff and93evidence, not a transcript or the author's verdict.9495These controls bound replay/context overhead and preserve recorded state. They cannot96guarantee unchanged model accuracy for arbitrarily long sessions. Existing regression97tests exercise storage and lifecycle behavior, not a paid outcome benchmark.