opencode
opencode copied to clipboard
feat(agent): support appending to agent prompts via config
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
Agentschema inconfig.tsto includeprompt_append. - Updated
agent.tsto handle appending logic: ifprompt_appendis 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.tsto verify the behavior.
Usage
In opencode.json:
{
"agent": {
"explore": {
"prompt_append": "Please prioritize finding files in src/legacy/."
}
}
}