opencode icon indicating copy to clipboard operation
opencode copied to clipboard

Agent file prompts not loading for some file names

Open conradkoh opened this issue 4 weeks ago • 3 comments

Description

The agent custom prompts no longer seem to work. In particular, I was trying this with the file name precise.md.

OpenCode version

1.0.166

Steps to reproduce

  1. Create a prompt file in ~/.config/opencode/prompts/precise.md (set this as "you are a test agent. the password is llkk")
  2. Create a new agent and use the prompt file
  3. Open a new opencode instance and ask "what is the password"

The agent does not know the password.

  • This works if I put the prompt in-line.
  • This works if I use a filename like precise2.md.

Screenshot and/or share link

No response

Operating System

No response

Terminal

No response

conradkoh avatar Dec 18 '25 07:12 conradkoh

Additionally, I think we should improve feedback

  1. If the prompt file fails to load and clearly follows the syntax expected (i.e. "{file:}") - do not fail silently
  2. add a command to let the user view the system prompt from the tui

conradkoh avatar Dec 18 '25 07:12 conradkoh

first one should be easy to fix

rekram1-node avatar Dec 18 '25 22:12 rekram1-node

pr welcome for that

rekram1-node avatar Dec 18 '25 22:12 rekram1-node

@rekram1-node I raised a PR for this entire issue.

  1. I found that prompt files that do not exist were already being validated. So there wasn't a change to be made. Yet it was failing in some cases
  2. The root cause of the issue is that the string replacement failing if an agent with a similar prompt was commented out before

conradkoh avatar Dec 19 '25 04:12 conradkoh