Skip to content

Design additive prompt layering for app agent personas #34774

Description

@opencode-agent

Summary

OpenCode V2 currently treats a configured agent system prompt as a replacement for the model-family OpenCode system prompt. That is surprising for embedded/chat products such as OpenCode Agent: a short Discord/Slack persona can accidentally remove the baseline coding-agent behavior.

We should design a clearer prompt layering model before changing behavior.

Current observed behavior

In V2 request assembly, a non-empty agent system replaces the provider/model-family prompt:

system: [
  agent.info?.system ? agent.info.system : SessionRunnerSystemPrompt.provider(model),
  system.baseline,
]

So a Discord persona like “be a concise teammate in chat” becomes the privileged system prompt instead of being added after the standard OpenCode prompt.

Design directions to gang-grill

  1. Additive app/persona instructions by default

    • Always include SessionRunnerSystemPrompt.provider(model).
    • Add app/channel persona as a separate later system part.
  2. Split replacement from additions

    • Example fields: systemOverride vs instructions / persona.
    • Replacement stays possible, but has to be explicit.
  3. Named prompt stack

    • Model/provider base prompt
    • Selected agent behavior
    • App/channel persona
    • Durable session baseline/context
    • UI/debug surfaces can show each layer separately.

Why this matters

  • Embedded agents need product/chat persona without losing core OpenCode behavior.
  • Debugging “why did the agent behave this way?” needs visibility into the effective prompt stack.
  • Future app integrations should not have to copy/paste or manually preserve the base coding prompt.

Source discussion

Discord thread: https://discord.com/channels/1391832426048651334/1521895759694270584

This issue is intentionally tagged gang-grill so we can collect design topics and later run a focused team discussion without pinging everyone immediately.

Metadata

Metadata

Assignees

Labels

2.0gang-grillDesign topics queued for later group grilling

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions