EN 中文

seek's built-in safety net automatically snapshots the working tree before every destructive action. Two complementary layers cover different granularities:

Layer Granularity Command Dependency
Git checkpoint Per-turn (cross-tool) /checkpoints / /restore / seek checkpoint git repo + git binary
File checkpoint Per write/edit /undo / /redo / seek undo None (git-independent)

Git Checkpoint — Per-Turn Rollback

Before every first destructive action (write / edit / mutating bash) per turn, seek snapshots the working tree via git stash create + git update-ref to refs/seek/checkpoints/<sid>/<turn>.

每当模型发起第一个破坏性操作,seek 自动快照工作区——通过 git stash create + git update-ref 将当前工作树的状态固定到 refs/seek/checkpoints/<session-id>/<turn>。

List checkpoints

$ seek checkpoint list
$ seek checkpoint list --session <id>   # specific session
$ seek checkpoint list --json           # JSONL output

Restore

回滚

$ seek checkpoint restore 3
$ seek checkpoint restore 3 --session <id>

Uses git read-tree --reset -u <ref> — an in-place overwrite. No branching.

覆盖式回滚,不衍生分支。

Prune

清理

$ seek checkpoint prune --before 2025-01-01

Checkpoints also enter git's natural GC cycle (90-day default expiry).

检查点也受 git 自身 GC 管理(默认 90 天过期)。

File Checkpoint — Per-Step Undo/Redo

Every write/edit snapshots the prior file content to a content-addressed SHA-256 blob with an append-only event log. Supports undo and redo.

每次 write/edit 自动备份旧文件内容到内容寻址 blob,记录事件日志。支持撤销和重做。

Undo

撤销

$ /undo          # TUI: undo last write/edit (global)
$ /undo <path>   # TUI: undo last write/edit on specific file
$ seek undo      # CLI
$ seek undo -n 3      # CLI: undo last 3 steps
$ seek undo <path>    # CLI: undo specific file only

Redo

重做

$ /redo          # TUI: redo last undone change
$ /redo <path>   # TUI: redo last undo on specific file
$ seek redo      # CLI
$ seek redo -n 3      # CLI: redo last 3 steps
Note: 注意: New write/edit operations truncate the redo history (classic editor semantics). 新的 write/edit 操作会截断重做历史(经典编辑器语义)。

CLI Reference

CLI 参考

$ seek checkpoint — inspect / restore / prune the safety-net layer

Usage:
  seek checkpoint <command> [flags] [args]

Commands:
  list                   List git checkpoints (default: most recent session)
  restore <turn>         Restore working tree to named checkpoint
  prune --before <date>  Delete checkpoint refs older than a date

Shared flags:
  --session <id>         Target a specific session (default: most recent)
  --json                 (list) emit JSONL on stdout

See also:
  seek undo / seek redo  File-level undo/redo

TUI Slash Commands

TUI 斜杠命令

Command Action
/undoUndo last write/edit
/undo <path>Undo last write/edit on specific file
/redoRedo last undone change
/redo <path>Redo last undo on specific file
/restoreRoll back to latest git checkpoint (or /restore <turn> to specify turn)
/checkpointsList current session git checkpoints

Design Notes

设计要点

See guide-references.md — LSP-based semantic find-references via the references tool, protected by checkpoint undo/redo. 另见 guide-references.md——references 工具用 LSP 做语义符号引用查找,checkpoint 的 undo/redo 保护这些查找后的编辑。