Introducing /rewind — Undo for your entire agent session - Elyra v0.7.6
We've all been there. You ask the agent to refactor a module, it gets three turns deep, and somewhere along the way things went sideways. The conversation branched into a dead end, and your files are in a state that's hard to untangle.
You could git stash, manually revert, and start over — but now you've lost the conversation context too.
Today we're shipping /rewind, a built-in command that rolls back both your conversation history and your filesystem in a single operation.
The problem
Elyra already had /tree for navigating conversation branches and /fork for starting fresh from a previous message. But neither of these touched the filesystem. If the agent modified 15 files across three turns, navigating back in the session tree left you with a conversation that said one thing and a codebase that said another.
The git-checkpoint extension example showed this was solvable, but it required manual setup and stored checkpoints only in memory — they vanished when the process exited.
/rewind makes this a first-class, zero-configuration feature.
How it works
Every time the agent starts a new turn, Elyra snapshots your working tree using git stash create. The resulting ref is persisted in a .checkpoints.json file alongside your session, so checkpoints survive restarts, crashes, and coffee breaks.
When you run /rewind, a selector shows each checkpoint with a timestamp and the number of files that would change:
Rewind Session
Select a point to rewind to — restores both conversation and file state
› Fix the authentication bug
12m ago · 3 files will change
Add rate limiting middleware
8m ago · 7 files will change
Refactor error handling (current)
2m ago
Select a point, and Elyra does two things atomically:
Navigates the session tree to that entry — your conversation rewinds, and the agent's context matches the point you selected.
Restores tracked files via
git checkoutandgit stash apply— your working tree matches the filesystem state at that checkpoint.
Before touching any files, Elyra creates a safety stash of your current state. If the restore fails or you change your mind, git stash list has your back.
A real workflow
Suppose you're building a REST API and the session looks like this:
You: "Add user registration with email validation"
Agent: [creates routes, controller, validation, tests — 6 files]
You: "Now add password reset flow"
Agent: [modifies auth controller, adds reset routes, mailer — 8 files]
You: "Hmm, the mailer setup is wrong. Let's rethink this."
Instead of manually reverting changes or starting a new session:
/rewind
Pick the checkpoint after "Add user registration" — the conversation rewinds to that point, and your codebase returns to a clean state with just the registration code. The password reset changes disappear from both the conversation and the filesystem.
Type a new message and continue from there. The agent sees only the registration context and has no memory of the failed password reset attempt.
For extension authors
Extensions can trigger rewind programmatically via the command context:
elyra.registerCommand("undo-last-turn", {
description: "Rewind to the previous checkpoint",
handler: async (args, ctx) => {
const points = ctx.session.getRewindPoints();
const previous = points[points.length - 2];
if (previous) {
const result = await ctx.rewind(previous.entryId);
if (result.error) {
ctx.ui.notify(result.error, "error");
}
}
},
});
Requirements and limitations
Requires git. If your project isn't a git repo, checkpoints aren't created and
/rewindwill tell you so.Tracked files only.
git stash createcaptures changes to tracked files. If the agent creates a brand-new file that git doesn't know about, it won't be removed on rewind. Rungit statusto check for stragglers.Stash refs can expire. Git's garbage collector prunes unreachable objects after ~2 weeks by default. For long-lived sessions, very old checkpoints may become invalid.
Comparison with existing commands
/tree /fork /rewind Restores files No No Yes Same session file Yes No Yes Use case Explore branches Start fresh Undo agent work
/tree is for exploring. /fork is for diverging. /rewind is for undoing.
Get it
elyra update
Or install fresh:
npm i -g @elyracode/coding-agent