Checkpoints & rewind
Every allowed write lands on a checkpoint first: ka agent snapshots the session workspace into a shadow git repository before the engine’s answer reaches it, so an approved write that goes wrong is one /rewind away from undone. Approvals stay the security boundary; the checkpoint is the safety net, not a gate.
What gets snapshotted
Section titled “What gets snapshotted”- The snapshot happens inside the single allow settle, so every Allow path is covered: an operator
/y, a session allow, and a durable allow-rule alike. Denied and expired asks leave no checkpoint. - The repo is never the workspace’s own
.git: ka agent runsgit initonce per session into the user’s checkpoints directory (<data>/users/<u>/checkpoints/<short session id>; the operator keeps the profile root) and drives it with--git-dir/--work-tree, so the workspace never sees a second git directory. Each checkpoint isadd -Aplus a commit. - Rows live in the store (schema v14): the ask that was allowed, the turn, and the tree sha. A failed snapshot (git absent, disk full) records a row with a null sha, audits
checkpoint.failed, and the write still runs: the gap shows as a hole in/rewind’s list. A checkpoint failure never vetoes an allowed write.
/rewind
Section titled “/rewind”Local surfaces only (terminal and web; a phone gets a refusal):
- Bare
/rewindlists checkpoints newest first:HH:MM · before <question> (turn <id>). /rewind <n>restores withcheckout -f <sha> -- .. The session must have no open cycle (Running,AwaitingApprovalandStoppingrefuse). The reply carries the stored question and the checkpointed turn’s inbound text, so the same call can be re-proposed with a fix.- Code only: the restore never runs
git clean, so files created after the checkpoint are left alone, and it rewinds nothing conversational (the strand keeps every turn; only the workspace tree moves).
Limits
Section titled “Limits”Stated in /rewind’s help as well:
- Only ask-gated writes checkpoint. Writes inside a
[[grants.path]]allowdirectory,grants.installinstalls, andaccept_edits/allow-mode edits raise no ask, so they raise no snapshot. Rule- and session-allowed writes do checkpoint (they ride the same settle site). - Gitignored trees, symlink targets and edits made by bash outside a snapshotted moment are never captured; a restore neither reverts nor deletes them.
- A nested git repository in the workspace is recorded as a contentless gitlink: restoring it yields an empty directory, not the nested repository’s contents.
checkpoint.keep_dayspruning is destructive: past the window, that history is gone.
Config
Section titled “Config”[checkpoint]enabled = true # snapshot the workspace before every approved writekeep_days = 30 # rows and shadow repos this old are pruned (1..=3650)Pruning rides the retention pass: past the window both the store rows and the shadow repositories are deleted.
What /rewind is not
Section titled “What /rewind is not”- Not conversation rewind: the transcript is never rewritten (rewinding the strand itself needs a fork operation in the engine, a ka-harness handoff).
- Not staging: there is no pending-changes view; the mechanism is snapshot, list and restore.