Feature Request: Add reset or fork tool to let agent reset chat on the previous user message #1213

Open
opened 2026-02-16 17:30:02 -05:00 by yindo · 0 comments
Owner

Originally created by @remorses on GitHub (Aug 10, 2025).

Originally assigned to: @thdxr on GitHub.

Summary

The idea is to add a built-in tool called Reset that resets the chat on the previous user message.
Its input will be an appendToPrompt field that the LLM can use to add context to the initial user message.

Motivation & Use Case

  1. Why would this new Reset tool be useful? First, the use case: suppose the agent does something wrong after consuming many tokens.
  2. The usual flow is to ask it to fix the problem and maybe revert the agent’s changes.
  3. That’s ineffective because it piles up mistakes and problematic code, and if you ask the agent to revert, you add even more tokens to the context window that aren’t helpful.
  4. Instead, when the agent goes wrong, you can ask to reset changes on the next message and add context that prevents the agent from taking the same path and making the same mistakes.

Feasibility

This is possible to add to OpenCode thanks to the new snapshot feature.

Why Not Just Snapshots?

The tool is comparable to a user manually reverting to a previous snapshot, but it’s better because:

  1. the user might not even know the snapshot feature exists,
  2. and the agent can autonomously revert to an earlier user message when it decides the current implementation is wrong and should follow a different path/idea.

Relation to Existing Features

You can think of this tool as an alternative to the Codex feature where you ask the agent for three different versions using the same prompt.

  1. That feature is useful because you can run the same prompt three times and one implementation may be correct while another isn’t, due to model randomness and temperature.
  2. This rollback tool achieves a similar effect linearly instead of in parallel. In my view it’s even more powerful: the agent can consider three different ways to implement a function and, after each attempt, jump back to a prior message, tell itself not to follow a given path, and proceed with the next one. This approach doesn’t consume additional tokens; it actually reduces them.
Originally created by @remorses on GitHub (Aug 10, 2025). Originally assigned to: @thdxr on GitHub. ## Summary The idea is to add a built-in tool called Reset that resets the chat on the previous user message. Its input will be an `appendToPrompt` field that the LLM can use to add context to the initial user message. ## Motivation & Use Case 1. Why would this new Reset tool be useful? First, the use case: suppose the agent does something wrong after consuming many tokens. 2. The usual flow is to ask it to fix the problem and maybe revert the agent’s changes. 3. That’s ineffective because it piles up mistakes and problematic code, and if you ask the agent to revert, you add even more tokens to the context window that aren’t helpful. 4. Instead, when the agent goes wrong, you can ask to reset changes on the next message and add context that prevents the agent from taking the same path and making the same mistakes. ## Feasibility This is possible to add to OpenCode thanks to the new snapshot feature. ## Why Not Just Snapshots? The tool is comparable to a user manually reverting to a previous snapshot, but it’s better because: 1. the user might not even know the snapshot feature exists, 2. and the agent can autonomously revert to an earlier user message when it decides the current implementation is wrong and should follow a different path/idea. ## Relation to Existing Features You can think of this tool as an alternative to the Codex feature where you ask the agent for three different versions using the same prompt. 1. That feature is useful because you can run the same prompt three times and one implementation may be correct while another isn’t, due to model randomness and temperature. 2. This rollback tool achieves a similar effect linearly instead of in parallel. In my view it’s even more powerful: the agent can consider three different ways to implement a function and, after each attempt, jump back to a prior message, tell itself not to follow a given path, and proceed with the next one. This approach doesn’t consume additional tokens; it actually reduces them.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#1213