[FEATURE] Ability to rewind/undo the last message exchange without clearing the full session

Resolved 💬 3 comments Opened Apr 13, 2026 by huangzhen1997 Closed Apr 17, 2026

Preflight Checklist

  • [x] I have searched existing requests and this feature hasn't been requested yet
  • [x] This is a single feature request (not multiple features)

Problem Statement

When exploring a complex topic, I often ask a broad question and get a large, multi-faceted response. I then want to dive deeper into one specific detail — but after that sub-conversation, I want to return to the original context
cleanly, as if the detour never happened.

Currently there's no way to do this without either:

  • /clear — loses everything, including the valuable original response
  • /compact — summarizes history but doesn't surgically remove the detour
  • Double-escape checkpoint — only reverts file changes, conversation history stays

Proposed Solution

A command (e.g., /undo or /rewind 1) that removes the last N message exchanges (user message + assistant response) from the active context window, freeing those tokens and restoring the conversation to its prior state.

Why this matters

Token context is a finite resource. When drilling into a sub-question produces a large but ultimately tangential exchange, there's no way to reclaim that context budget. This forces users to either abandon the session or carry
dead weight through the rest of the conversation, degrading response quality on the original topic.

Expected behavior

  • /undo removes the last user+assistant message pair from context
  • /undo 3 removes the last 3 pairs
  • Does not affect file changes already made on disk
  • Session JSONL could soft-delete entries (mark as removed) to keep an audit trail without loading them into context

Alternative Solutions

_No response_

Priority

High - Significant impact on productivity

Feature Category

CLI commands and flags

Use Case Example

_No response_

Additional Context

_No response_

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗