Skip to content

feat: Add /undo command to revert last conversation turn #18708

@matteorossi117

Description

@matteorossi117

Working with LLMs in a CLI is an iterative process of trial and error. Currently, if a model provides a
suboptimal or hallucinated response, that turn remains in the context window. This pollutes future interactions
and wastes tokens unless the user manually saves/resumes sessions or starts over.

I would like a simple /undo slash command. When executed, it removes the last response from the model, removes
the last user prompt that triggered it, and refreshes the UI to reflect the "rewound" state.

Starting a new session is sub optimal because it loses all previous valid context.

Additional context
I have already prototyped a working implementation of this feature. It involves adding removeLastTurn() to useHistoryManager, hooking it into slashCommandProcessor, and triggering refreshStatic() for the UI update.

I am ready to submit a PR if this proposal is aligned with the project's goals.

Metadata

Metadata

Assignees

Labels

area/coreIssues related to User Interface, OS Support, Core Functionalityhelp wantedWe will accept PRs from all issues marked as "help wanted". Thanks for your support!priority/p3Backlog - a good idea but not currently a priority.
No fields configured for Feature.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions