From b96f3b6bae6ad0d447be0ad0071f5f89dda3eb18 Mon Sep 17 00:00:00 2001 From: Alex Clarke Date: Wed, 15 Jul 2026 16:28:19 -0600 Subject: [PATCH] docs: Added documentation for the new .undo REPL command --- REPL.md | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/REPL.md b/REPL.md index 79ce622..88b7486 100644 --- a/REPL.md +++ b/REPL.md @@ -101,6 +101,7 @@ Use the following commands to manage sessions in Coyote: |---------------------|---------------------------------------------------------------------------------------------| | `.session` | Start or switch to a session | | `.empty session` | Clear all messages for the active session | +| `.undo` | Remove the last exchange from the session and restore your prompt for editing | | `.compress session` | Compress the session messages using the `summarization_prompt` setting in the global config | | `.info session` | Display information about the active session | | `.edit session` | Open the active session's configuration in your preferred text editor | @@ -198,6 +199,33 @@ this without having to retype your query: ![regenerate](./images/repl/regenerate.gif) +## `.undo` - Undo the last exchange +Removes the last user prompt and LLM response from the active session and restores the original prompt text +directly into the input buffer, ready for editing or re-sending. + +``` +.undo +``` + +Calling `.undo` multiple times walks backward through the conversation history one exchange at a time. It errors +with "Nothing to undo" once the session has no more messages to remove. + +> **Requires an active session.** `.undo` is only available when a session is open. Outside a session, conversation +> history is not tracked in memory, so there is nothing to walk back. + +Note that `.undo` only modifies the in-memory session state. The append-only `messages.md` log is not affected. +If you save the session after undoing (via `.save session` or automatic save-on-exit), the saved file will reflect +the trimmed history. + +> **Compressed sessions:** `.undo` can only walk back through the uncompressed message tail. If the session has been +> compressed (via `.compress session` or automatic compression), exchanges that were folded into the compressed +> summary cannot be undone. `.undo` will return "Nothing to undo" once the uncompressed tail is exhausted, even +> if compressed history exists. This is the same limitation as `.regenerate`. + +> **Graph agents:** `.undo` is not supported inside a graph-based agent. The graph manages its own state +> independently of the session message list, so modifying that list could corrupt the graph's execution state. +> Attempting `.undo` from inside a graph agent will produce an error. + ## `.copy` - Copy the last response to your clipboard If you're trying to copy the last response (like copying some code), you can use the `.copy` command to copy the entire last response to your system clipboard: