Skip to content

Per-turn checkpoints: rewind an agent session's edits #149

Description

@liam-russell

Problem

One bad agent turn can wreck a previously-good working tree, and recovery means reading the whole diff and untangling it by hand. #93 (reflog undo) covers destructive git actions — agent file edits never touch the reflog.

Proposal

  • After each completed ACP turn (turn boundaries are explicit in chat.ts runTurn), snapshot the worktree's state to a hidden ref (git stash create-style dangling commit — no working-branch pollution, no index disturbance).
  • A timeline on the chat panel: each turn is a restore point; "Restore to before turn N" resets the working tree (with a confirm showing what would be lost).
  • Auto-prune snapshots (keep last N per session, drop on worktree delete).
  • Terminal-mode agents get best-effort snapshots on output-idle boundaries.

Together with #93 this makes "let the agent try something" genuinely safe — the worktree-first equivalent of an editor's undo stack.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Table stakes — expected of any polished Git GUIarea:uxUser experience & interaction designenhancementNew feature or request

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions