[PR #4142] feat: Add "system.prompt.append" hook #10883

Closed
opened 2026-02-16 18:15:38 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/4142

State: closed
Merged: No


This PR adds a new hook for the plugin system, "system.prompt.append", to allow appending instructions to the system prompt between messages. The primarily use case for this is to allow plugins to add system instructions dynamically, based on context.

I attempted to write a plugin to implement cursor-style rules, that can always be inserted or inserted when certain glob patterns are matched. With the plugin system as it is currently, the best way to insert these rules was through user messages with noReply set. Thus, rules can only be added, not removed, and are lost when the conversation is compacted. With this hook, rules can be added dynamically as needed, without polluting the chat history with messages.

This is just a first pass of something that works, and I'm looking for feedback on how this can be improved, or if it is even wanted by the team.

**Original Pull Request:** https://github.com/anomalyco/opencode/pull/4142 **State:** closed **Merged:** No --- This PR adds a new hook for the plugin system, "system.prompt.append", to allow appending instructions to the system prompt between messages. The primarily use case for this is to allow plugins to add system instructions dynamically, based on context. I attempted to write a plugin to implement cursor-style rules, that can always be inserted or inserted when certain glob patterns are matched. With the plugin system as it is currently, the best way to insert these rules was through user messages with noReply set. Thus, rules can only be added, not removed, and are lost when the conversation is compacted. With this hook, rules can be added dynamically as needed, without polluting the chat history with messages. This is just a first pass of something that works, and I'm looking for feedback on how this can be improved, or if it is even wanted by the team.
yindo added the pull-request label 2026-02-16 18:15:38 -05:00
yindo closed this issue 2026-02-16 18:15:38 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#10883