Skip to content

Add option to modify system prompt #1242

Closed

Description

@ChaseRensberger

I'd love the ability to edit the system prompt/toggle between system prompts. My main interest in this would be to be able to use the opencode interface for tasks other than coding. Like similar to toggling between PLAN and BUILD it'd be cool to toggle between CODE and CHAT or something like that.

Activity

  1. adamdotdevin commented on Jul 23, 2025

    @adamdotdevin
    Member
  2. self-assigned this
    on Jul 23, 2025
  3. ChaseRensberger commented on Jul 24, 2025

    @ChaseRensberger
    Author

    My fault for not checking the docs. Thanks for taking time out of your day to send that link.

  4. cbarkinozer commented on May 15, 2026

    @cbarkinozer

    The link was broken, the correct one is: https://open-code.ai/en/docs/modes which says it is deprecated now. "Caution: Modes are now configured through the agent option in the opencode config. The mode option is now deprecated. Learn more.". As I understand we can now change our defined agent's system prompt:

    {
      "$schema": "https://opencode.ai/config.json",
      "agent": {
        "build": {
          "mode": "primary",
          "model": "anthropic/claude-sonnet-4-20250514",
          "prompt": "{file:./prompts/build.txt}",
          "tools": {
            "write": true,
            "edit": true,
            "bash": true
          }
        },
        "plan": {
          "mode": "primary",
          "model": "anthropic/claude-haiku-4-20250514",
          "tools": {
            "write": false,
            "edit": false,
            "bash": false
          }
        },
        "code-reviewer": {
          "description": "Reviews code for best practices and potential issues",
          "mode": "subagent",
          "model": "anthropic/claude-sonnet-4-20250514",
          "prompt": "**You are a code reviewer. Focus on security, performance, and maintainability.**",
          "tools": {
            "write": false,
            "edit": false
          }
        }
      }
    }

    Even though this example does not showcase, we should change the plan and the build agent's system prompts.

  5. Hi-Angel commented on Nov 2, 2026

    @Hi-Angel

    @cbarkinozer doesn't seem work in 2.2.4, unless I misconfigured something.

    Have this opencode.json:

    {
      "$schema": "https://opencode.ai/config.json",
      "enabled_providers": ["llamacpp"],
      "provider": {
        "llamacpp": {
          "npm": "@ai-sdk/openai-compatible",
          "name": "llama-server (local)",
          "options": { "baseURL": "http://127.0.0.1:9931/v1" },
          "models": {
            "local": {
              "name": "local llm"
            }
          }
        }
      },
      "model": "llamacpp/local",
      "small_model": "llamacpp/local",
      "agent": {
        "build": {
          "mode": "primary",
          "model": "llamacpp/local",
          "prompt": "hello world",
        }
      }
    }

    I launch opencode in Build plan, send a hi, then I look at the text being sent, and I see a bunch of unrelated junk like:

    hello world\\n# Your Model\\n- Name: local llm\\n- Provider ID: llamacpp\\n- Model ID: local\\n# Code Mode\\n\\nThe tools listed below cannot be called directly. I did write the "hello world" but why would I ever want to spend tokens on useless information like "Model ID: local".

    There's a lot of content, none of which I want to see for my local coding agent and the solution suggested doesn't work.

  6. Hi-Angel commented on Nov 2, 2026

    @Hi-Angel

    I'm assuming this functional has regressed, so I created an issue describing how to reproduce it

  7. Hi-Angel commented on Nov 2, 2026

    @Hi-Angel

    Update from the linked issue — turns out, the text I see in the prompt isn't considered part of the prompt by OpenCode, but instead kinda an additional info. I guess that turns that into an RFE… Edited the issue accordingly.

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