Skip to content

v0.9.5: prompt-scoped file recovery (restore workspace from a prior prompt) #5272

Description

@Hmbown

Goal

From a prior user prompt, restore the workspace files that turn wrote (session snapshots) — not only transcript scrollback. Confirm before destructive restore; cooperate with git (do not discard user commits).

Why

When an agent damages the tree, recovery today is mostly git archaeology or transcript nostalgia. Prompt-scoped file restore makes “undo that turn’s writes” a product feature.

Current state (codewhale)

  • Session/history and checkpoint/artifact storage under ~/.codewhale/sessions/
  • crates/tui/src/tui/history/, crates/state/
  • Sandbox / execpolicy presentation paths (recovery must not fight safety docs)

Target

  1. Extend existing checkpoint/session artifact storage so each user prompt can be associated with a file snapshot of writes from that turn (or a documented equivalent restore set).
  2. Operator UI/command to pick a prior prompt and restore those files after confirmation.
  3. Play with git: never silently discard user commits; prefer restore that is reviewable (diff/confirm).
  4. Document lifetime, location, and opt-out/cleanup.

Acceptance criteria

  • Restore files from a prompt-scoped checkpoint with an explicit confirm step
  • Restored set matches what that turn wrote (or docs honestly bound what is covered)
  • No silent discard of user commits
  • Docs for location, lifetime, sharing/cleanup, opt-out
  • Tests for missing checkpoint, partial snapshot, and confirm-cancel
  • Suite green; just fmt clean

Non-goals

  • Full VCS replacement or magit-style UI
  • Rewinding chat-only without files (already have history)
  • Sandbox policy redesign

Depends on

Optional in the craft set — can ship after turn honesty and mid-turn control. Benefits from clearer session metadata (#5262) but can use current session store.

Related

Drive-while-working craft set.

Metadata

Metadata

Assignees

No one assigned

    Labels

    agent-readySelf-contained for a fresh-clone cloud agent; implement in a tested PR with no live credentialsenhancementNew feature or requestreliabilityReliability, flaky behavior, retries, fallbacks, and robustnesstuiTerminal UI behavior, rendering, or interactionuxUser experience, interaction, or presentation polish

    Projects

    Status
    Backlog

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions