@siuver/omp-undo
v0.1.0
Published
An oh-my-pi extension that adds the /undo slash command to remove the latest user prompt and its model response from the session tree.
Maintainers
Readme
@siuver/omp-undo
An oh-my-pi extension that adds the /undo slash command to remove the latest user prompt and its model response from the current session tree.
Install
omp plugin install @siuver/omp-undoWhat it does
Running /undo removes the latest completed user prompt and every session entry descended from it (the model response and any follow-up entries) from the current session tree:
- Finds the most recent user message on the active branch that has a following assistant response.
- Asks for confirmation, showing a preview of the prompt and the number of session entries that will be removed.
- On confirmation, prunes the session tree: the user message and all of its descendants are removed, the branch pointer is moved back to the parent entry (or reset when the prompt was the root), and the session file on disk is rewritten.
- Reloads the session and restores the removed prompt's text into the input box so it can be edited and resubmitted.
Behavior notes
- Requires an interactive UI: in headless contexts
/undowarns and does nothing. - Waits for the agent to become idle before touching the session.
- Declining the confirmation leaves the session untouched.
- Only the latest completed prompt (one followed by an assistant response) can be undone; an unanswered trailing prompt is left alone.
Local Development
From the repository root:
omp plugin link ./plugins/undoRestart omp after linking.
Changelog
See CHANGELOG.md for release notes included in the npm package.
