opencode icon indicating copy to clipboard operation
opencode copied to clipboard

feat(prompt): add `extend: true` to the config to append/replace agent's system prompt

Open spoons-and-mirrors opened this issue 5 months ago • 4 comments

Summary

Introduce a new optional config parameter to agents: promptMode

The promptMode param has 2 possible values: append and replace

  • append: Appends the agent's system prompt to opencode's default prompt (example: keep beastmode prompt for gpt 4.1 while adding something to the system prompt of your custom agent)
  • replace: Using replace or not specifying promptMode is the same thing - it will replace opencode's default system prompt with yours

Maybe this should a boolean instead?

spoons-and-mirrors avatar Aug 14 '25 21:08 spoons-and-mirrors

i've been thinking about the right way to allow configuring this. i think maybe saying extend: true can make sense?

thdxr avatar Aug 15 '25 03:08 thdxr

Yes! much better. god naming things is hard :D

the PR is updated to use extend

spoons-and-mirrors avatar Aug 15 '25 12:08 spoons-and-mirrors

Love this! What about extendPrompt: z.boolean().optional() to make it even more clear?

svkozak avatar Aug 15 '25 18:08 svkozak

idk, we're already within an agent config, there's not much you can extend other than the default system prompt, is there?

spoons-and-mirrors avatar Aug 15 '25 18:08 spoons-and-mirrors