<p> You could <code>git stash</code>, manually revert, and start over — but now you've lost the conversation context too.</p><p>Today we're shipping <code>/rewind</code>, a built-in command that rolls back both your conversation history and your filesystem in a single operation.</p><h2>The problem</h2><p>Elyra already had <code>/tree</code> for navigating conversation branches and <code>/fork</code> 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.</p><p>The <code>git-checkpoint</code> extension example showed this was solvable, but it required manual setup and stored checkpoints only in memory — they vanished when the process exited.</p><p><code>/rewind</code> makes this a first-class, zero-configuration feature.</p><h2>How it works</h2><p>Every time the agent starts a new turn, Elyra snapshots your working tree using <code>git stash create</code>. The resulting ref is persisted in a <code>.checkpoints.json</code> file alongside your session, so checkpoints survive restarts, crashes, and coffee breaks.</p><p>When you run <code>/rewind</code>, a selector shows each checkpoint with a timestamp and the number of files that would change:</p><pre><code>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
</code></pre><p>Select a point, and Elyra does two things atomically:</p><ol><li><p><strong>Navigates the session tree</strong> to that entry — your conversation rewinds, and the agent's context matches the point you selected.</p></li><li><p><strong>Restores tracked files</strong> via <code>git checkout</code> and <code>git stash apply</code> — your working tree matches the filesystem state at that checkpoint.</p></li></ol><p>Before touching any files, Elyra creates a safety stash of your current state. If the restore fails or you change your mind, <code>git stash list</code> has your back.</p><h2>A real workflow</h2><p>Suppose you're building a REST API and the session looks like this:</p><pre><code>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."
</code></pre><p>Instead of manually reverting changes or starting a new session:</p><pre><code>/rewind
</code></pre><p>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.</p><p>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.</p><h2>For extension authors</h2><p>Extensions can trigger rewind programmatically via the command context:</p><pre><code class="language-typescript">elyra.registerCommand("undo-last-turn", {
  description: "Rewind to the previous checkpoint",
  handler: async (args, ctx) =&gt; {
    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");
      }
    }
  },
});
</code></pre><h2>Requirements and limitations</h2><ul><li><p><strong>Requires git.</strong> If your project isn't a git repo, checkpoints aren't created and <code>/rewind</code> will tell you so.</p></li><li><p><strong>Tracked files only.</strong> <code>git stash create</code> captures 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. Run <code>git status</code> to check for stragglers.</p></li><li><p><strong>Stash refs can expire.</strong> Git's garbage collector prunes unreachable objects after ~2 weeks by default. For long-lived sessions, very old checkpoints may become invalid.</p></li></ul><h2>Comparison with existing commands</h2><p><code>/tree</code> <code>/fork</code> <code>/rewind</code> Restores files No No Yes Same session file Yes No Yes Use case Explore branches Start fresh Undo agent work</p><p><code>/tree</code> is for exploring. <code>/fork</code> is for diverging. <code>/rewind</code> is for undoing.</p><h2>Get it</h2><pre><code class="language-bash">elyra update
</code></pre><p>Or install fresh:</p><pre><code class="language-bash">npm i -g @elyracode/coding-agent
</code></pre>