nanocoder icon indicating copy to clipboard operation
nanocoder copied to clipboard

[Feature] /rewind to restore files and conversation to before an earlier prompt

Open akramcodez opened this issue 1 week ago • 2 comments

Description

Add /rewind to the TUI: pick an earlier prompt and restore both the files and the conversation to how they were before it, optionally putting that prompt back in the input to edit and resend.

Use Case

When a turn goes wrong (wrong files edited, a bad direction across several tool calls), the choices today are:

  • /checkpoint load, which only works if a checkpoint was created by hand beforehand, and per #1242 does not restore the messages.
  • Architect mode's Revert, which only covers the last turn and only in that mode.
  • Fixing things by hand and telling the model to forget what it did, which leaves the bad turn in the context.

Rewinding to just before a prompt is what you usually want. OpenCode (/undo) and OMP both support it.

Proposed Solution

  • /rewind opens a picker of this session's prompts (newest first, with the files each turn changed).
  • Choosing one offers: Restore code and conversation, Restore conversation only, Restore code only.
  • After restoring, the chosen prompt is loaded into the input so it can be edited and sent again.
  • Bash side effects are not undone, so the picker says so, the same as architect mode's Revert.

Alternatives Considered

Automatic checkpoints through /checkpoint on every turn. Those snapshot more than needed, and still don't cover the conversation.

Additional Context

  • [x] I have searched existing issues to ensure this is not a duplicate (#2018 is about forking a conversation into a new session, #1242 about /checkpoint load dropping messages, #809 was the VS Code timeline)
  • [x] This feature aligns with the project's goals (local-first AI assistance)

Implementation Notes (optional)

Most of this already exists for ACP. source/services/timeline-manager.ts records a before-image for every mutating tool call, tagged with the prompt's turnId, and ACP exposes it as _nanocoder/timeline/list, _nanocoder/timeline/revert (files and history) and _nanocoder/retryTurn. The TUI does not create a TimelineManager, so the work is to create one per TUI session, record edits from the TUI tool executor, and build the picker on list() and revert.

akramcodez avatar Nov 25 '26 08:11 akramcodez

Description

Add /rewind to the TUI: pick an earlier prompt and restore both the files and the conversation to how they were before it, optionally putting that prompt back in the input to edit and resend.

Use Case

When a turn goes wrong (wrong files edited, a bad direction across several tool calls), the choices today are:

Rewinding to just before a prompt is what you usually want. OpenCode (/undo) and OMP both support it.

Proposed Solution

  • /rewind opens a picker of this session's prompts (newest first, with the files each turn changed).
  • Choosing one offers: Restore code and conversation, Restore conversation only, Restore code only.
  • After restoring, the chosen prompt is loaded into the input so it can be edited and sent again.
  • Bash side effects are not undone, so the picker says so, the same as architect mode's Revert.

Alternatives Considered

Automatic checkpoints through /checkpoint on every turn. Those snapshot more than needed, and still don't cover the conversation.

Additional Context

Implementation Notes (optional)

Most of this already exists for ACP. source/services/timeline-manager.ts records a before-image for every mutating tool call, tagged with the prompt's turnId, and ACP exposes it as _nanocoder/timeline/list, _nanocoder/timeline/revert (files and history) and _nanocoder/retryTurn. The TUI does not create a TimelineManager, so the work is to create one per TUI session, record edits from the TUI tool executor, and build the picker on list() and revert.

hey @akramcodez would love to take this issue thank you

shravanramakunja avatar Nov 26 '26 01:11 shravanramakunja

sure @akramcodez 👍

akramcodez avatar Nov 26 '26 08:11 akramcodez