opencode icon indicating copy to clipboard operation
opencode copied to clipboard

feat(agent): support appending to agent prompts via config

Open luochen1990 opened this issue 1 week ago • 1 comments

Summary

This PR adds support for appending to the default agent prompt via the configuration file using a new prompt_append field. This allows users to extend the behavior of existing agents (like explore or build) without completely replacing the default prompt, which is useful for adding project-specific instructions while keeping the core agent logic intact.

Changes

  • Modified Agent schema in config.ts to include prompt_append.
  • Updated agent.ts to handle appending logic: if prompt_append is present, it is appended to the existing prompt (default or overridden) with a double newline separator.
  • Added tests in packages/opencode/test/agent/agent.test.ts to verify the behavior.

Usage

In opencode.json:

{
  "agent": {
    "explore": {
      "prompt_append": "Please prioritize finding files in src/legacy/."
    }
  }
}

luochen1990 avatar Jan 08 '26 10:01 luochen1990