Skip to content

[FEATURE]: More prompt control in Agent V2 #53411

Open

Description

@Roffild

Feature hasn't been suggested before.

  • I have verified this feature I'm about to request hasn't been suggested before.

Describe the enhancement you want to request

OpenCode is built for developers.
I want to:

  • Create an Agent WITHOUT a prompt.
  • Include "docs/**/prompt.md" files in the prompt WITHOUT "AGENTS.md".
  • Execute code upon Agent creation.

I propose extending OpenCode V2 for Agent creation.

instructions

Currently, there are global instructions.
I propose adding agent.instructions:

  • If agent.instructions is NOT defined, then agent.instructions: ["**/AGENTS.md", ...global.instructions].
  • If agent.instructions: ["docs/**/prompt.md"], then agent.instructions: ["docs/**/prompt.md"] WITHOUT global.instructions.
  • If agent.instructions: [], then agent.instructions: [] WITHOUT files (Empty).

instructions are arguments for glob.
The resulting list must be sorted after each glob call, because the OS returns the list in random order.

agent.SystemPrompt

Add agent.SystemPrompt: false disables

`You are powered by the model named ${model.api.id}. The exact model ID is ${model.providerID}/${model.api.id}`,

myagent.ts

Only in the ~/.config/opencode/agents/ directory:

  • myagent.ts
  • myagent.js when myagent.ts is not found
  • otherwise myagent.md

myagent.ts returns an Agent Object/JSON schema.
This will allow creating an Agent with unique settings and a project-specific prompt.

Activity

  1. github-actions commented on Oct 5, 2026

    @github-actions
    Contributor

    This issue might be a duplicate of existing issues. Please check:

    • #10688: Agent-specific instructions array.
    • #47879: Disable or replace project AGENTS.md instructions.
    • #3195: Dynamic system prompts for custom agents, including code-generated prompts.
  2. opencodejr commented on Oct 27, 2026

    @opencodejr
    Contributor

    Thanks for the detailed proposal, @Roffild!

    If I understand correctly, you'd like more control over what goes into an agent's prompt in v2:

    • a per-agent instructions list that replaces the global instructions and AGENTS.md discovery (with [] meaning no instruction files);
    • a per-agent switch to turn off the built-in system/environment prompt;
    • agents defined in code (~/.config/opencode/agents/myagent.ts / .js).

    Right now, v2 loads instructions the same way for every agent. The agent config can change system, model, permissions and so on, but not which instruction files are included. Configured instruction globs are already sorted after matching, so that part should already hold.

    The third point can mostly be done today with a plugin: plugins can create and change agents in code through ctx.agent.transform(...), for example to set system from project files. The first two can't be done from a plugin yet, because plugins can't filter the instructions that are added to a session's prompt.

    Maintainers will consider this request. I couldn't search for related issues this time, so a duplicate may turn up later.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions