You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Feature Request: Add reset or fork tool to let agent reset chat on the previous user message #1789
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
Why would this new Reset tool be useful? First, the use case: suppose the agent does something wrong after consuming many tokens.
The usual flow is to ask it to fix the problem and maybe revert the agent’s changes.
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.
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:
the user might not even know the snapshot feature exists,
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.
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.
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.
changed the title [-]Feature Request: Add `reset` tool to let agent reset chat on previous user message[/-][+]Feature Request: Add `reset` tool to let agent reset chat on the previous user message[/+]on Aug 10, 2025
changed the title [-]Feature Request: Add `reset` tool to let agent reset chat on the previous user message[/-][+]Feature Request: Add `reset` or `fork` tool to let agent reset chat on the previous user message[/+]on Nov 15, 2025
Activity
[-]Feature Request: Add `reset` tool to let agent reset chat on previous user message[/-][+]Feature Request: Add `reset` tool to let agent reset chat on the previous user message[/+][-]Feature Request: Add `reset` tool to let agent reset chat on the previous user message[/-][+]Feature Request: Add `reset` or `fork` tool to let agent reset chat on the previous user message[/+]