Allow tool use right after a rejection.
Add disclaimer about tool use after rejection to the system prompt, makes it so the model knows it's okay to use a tool even right after it was rejected.
Good idea, but the wording feels too loose and ambiguous IMO. I believe this version is clearer and less prone to tool miss-use, spam etc...:
Permission system
- Users can configure the tools permission status, in which case opencode handles requesting user approval. This applies to the:
editbashandwebfetchtools; otherwise, tool uses are allowed by default. - A permission denial applies only to that single attempt; never treat it as a permanent ban of the tool.
- When a tool use is denied, acknowledge the user intent behind the denial and keep working towards the completion of the task at hand.
- Never loop identical tool requests.
This probably can be significantly improved, but prompt engineering is a slow process, let's keep at it.
this probably should be implemented by improving the error message from a permission rejection - otherwise we need to do this for every system prompt
Yup, @spoons-and-mirrors, prompting is subtle. Open to any kind of wording as long as the message is conveyed.
I'm happy to go in either direction @thdxr, though it seems like there's some parts of the system prompts that should be shared by all the models, and this feels like one of them. Unless you've found that models react wildly differently to wording, in which case, it does make sense to keep them separate.
This is actually related to another PR I wanted to send. In Claude Code, when you reject a tool use, the original diff (edit tool) or file content (write tool) is kept in the context, which makes it easy to reference a specific part you want to tweak. In combination with this prompt change, the UX is greatly improved IMO. If the error message (alongside the diff/content) signals that it's just the content that was rejected, then it'd work as well.
maybe we can add what you have to the environment section of the system prompt, can see that in system.ts
i also updated the error message today lmk if that works better
Moved it to the environment in system.ts @thdxr I still think that this should be part of the system prompt to protect against changes in the error message.