Repository navigation
Open
Description
Description
Custom system prompts were possible before — but now the text users adds instead gets appended to the built-in prompt (rather than replacing it). Reformulating based on discussion below: the user-provided prompt is appended on top of "prompt-looking" text that I'd like to heavily edit, but OpenCode doesn't consider that text a part of a prompt, which I guess turns the issue into an RFE.
Basically, everything that's before start of tools listing (and tbh would be great to edit tools descriptions as well).
Plugins
No response
OpenCode version
2.2.4
Steps to reproduce
- Have
~/.config/opencode/opencode.jsonwith this content:{ "$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", } } } - Run
nc -vkl 9931 - Launch
opencode, make sure it has "Build" plan, send a prompthi - Look at
ncoutput:
Expected (snip till square bracket)
{"model":"local","messages":[{"role":"system","content":"hello world",},{"role":"user","content":"hi"}] …
Actual (snip till square bracket)
{"model":"local","messages":[{"role":"system","content":"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: they only work as JavaScript inside the `execute` tool. Every other tool you have is a normal tool call: call it directly, never inside `execute`.\n\nThe catalog is complete. Do not guess tool names.\n\n## Code Mode tools (call only inside `execute`)\n\n- opencode (8 tools) // Tools for managing OpenCode itself, such as working with sessions and worktrees, searching the available models, and reading MCP resources.\n - tools.opencode.list_mcp_resources({\n /** MCP server name as configured. Omit to list every server. */\n server?: string,\n}): Promise<{\n resources: Array<{\n server: string,\n name: string,\n uri: string,\n description?: string,\n mimeType?: string,\n }>,\n templates: Array<{\n server: string,\n name: string,\n uriTemplate: string,\n description?: string,\n mimeType?: string,\n }>,\n}> // List documents, records, and other data exposed by MCP servers. Use this when the user refers to something that is no...\n - tools.opencode.models({\n /** Text to search for in model names and IDs. */\n query?: string,\n /** Provider ID or name to filter by. Try your own provider first. */\n provider?: string,\n /**\n * Which kind of model to list. Defaults to \"chat\".\n * \"chat\": a language model (LLM). Powers sessions, agents and subagents, and can call tools.\n * \"image\": generates or edits images from a prompt. It can't chat or call tools.\n */\n type?: \"chat\" | \"image\",\n /** Include older versions of each model family. By default only the newest version is listed. */\n all?: boolean,\n /** Maximum number of models to return. Defaults to 20. @integer @minimum 1 @maximum 100 */\n limit?: number,\n /** Number of models to skip, for paging through results. @integer @minimum 0 */\n offset?: number,\n}): Promise<{\n /** Matching models grouped by provider. Your own provider comes first. */\n providers: Array<{\n id: string,\n name: string,\n /** Newest first. */\n models: Array<{\n /** providerID/modelID */\n id: string,\n name: string,\n /** Release date as a Unix timestamp in milliseconds, or 0 when unknown. */\n released: number,\n variants: Array<string>,\n /** Pricing in USD per million tokens. */\n cost: Array<{\n tier?: {\n type: \"context\",\n /** @integer */\n size: number,\n },\n input: number,\n output: number,\n cache: {\n read: number,\n write: number,\n },\n }>,\n status: \"alpha\" | \"beta\" | \"deprecated\" | \"active\",\n }>,\n }>,\n /** Number of matching models across all pages. @integer */\n total: number,\n /** Offset of the next page, or null on the last page. */\n next: number | null,\n}> // Search the models available to use. Use this to turn a model name the user mentions into an exact reference for a too...\n - tools.opencode.read_mcp_resource({\n /** The server field of the discovered resource. */\n server: string,\n /** Exact resource URI from discovery, an expanded uriTemplate, or the user. */\n uri: string,\n}): Promise<{\n server: string,\n uri: string,\n contents: Array<{\n type: \"text\",\n uri: string,\n text: string,\n mimeType?: string,\n } | {\n type: \"blob\",\n uri: string,\n blob: string,\n mimeType?: string,\n }>,\n}> // Read one MCP resource by server and URI. Not for local files. Always return the full contents rather than slicing or ...\n - tools.opencode.session_move({\n /** Omit to move the current session. @pattern ^ses */\n sessionID?: string,\n /** Destination directory, relative to the target session's directory or absolute. Supports ~. @minLength 1 */\n directory: string,\n}): Promise<{\n /** @pattern ^ses */\n sessionID: string,\n directory: string,\n}> // Move a session to another directory, or omit sessionID to move the current session. The current session moves at the ...\n - tools.opencode.session_rename({\n /** Omit to rename the current session. @pattern ^ses */\n sessionID?: string,\n /** New session title. @minLength 1 */\n title: string,\n}): Promise<{\n /** @pattern ^ses */\n sessionID: string,\n title: string,\n}> // Rename a session, or omit sessionID to rename the current session. Use a short, specific title that summarizes the wo...\n - tools.opencode.worktree_create({\n name: string,\n}): Promise<{\n directory: string,\n}> // Create a named worktree. Returns its directory.\n - tools.opencode.worktree_list(): Promise<{\n worktrees: Array<{\n directory: string,\n strategy?: string,\n }>,\n}> // List a repository's worktrees.\n - tools.opencode.worktree_remove({\n /** Absolute path of the worktree to remove. @minLength 1 */\n directory: string,\n /** Discard modified and untracked files. Only set this when the user has confirmed forced removal. */\n force?: boolean,\n}): Promise<{\n directory: string,\n removed: boolean,\n}> // Remove a worktree. The repository location selects configuration; directory identifies the worktree to remove.\n\nSkills provide specialized instructions and workflows for specific tasks.\nUse the skill tool to load a skill when a task matches its description.\nThe user may also invoke a skill directly. When that happens, its instructions appear in the conversation as a <skill_content> block, the same shape the skill tool returns. A skill that is already present this way does not need to be invoked again.\n<available_skills>\n <skill>\n <id>opencode</id>\n <name>OpenCode</name>\n <description>Use this skill for any question about OpenCode itself, including how OpenCode works, using or configuring it, migrating from V1 to V2, troubleshooting it, developing plugins or integrations, using the OpenCode SDK, clients, server, or API, and contributing to the OpenCode codebase. Also use it for OpenCode agents, commands, skills, tools, permissions, MCP servers, providers, models, themes, keybinds, formatters, the CLI, TUI, desktop app, and web app.</description>\n </skill>\n <skill>\n <id>report</id>\n <name>Report</name>\n <description>Use when the user wants to report an opencode issue or bug. Collect standard diagnostics, add user-specific reproduction context, and publish the issue with GitHub CLI.</description>\n </skill>\n</available_skills>\n\nInstructions from: /home/constantine/Projects/baum/bacula-gui/AGENTS.md\n# AGENTS.md\n\nBacula GUI is a monorepo: `backend/` is the Node/TypeScript HTTP API server and parser layer (low-level Bacula work is delegated to Bacula daemons), and `frontend/` is the React + Vite web UI. Cross-cutting types and utils live in `shared/` and `frontend/shared/`.\n\n## Structure & entrypoints\n\n- `backend/app/Main.ts` — server entrypoint (Express routers, HTTPS/WS server, socket server). Built to `dist/index.js`; `pnpm run server` runs it via `node --watch dist/index.js`, which auto-reloads when `index.js` changes.\n- `frontend/main.tsx` + `frontend/vite.config.ts` — React app entry. Vite aliases `@shared` to `../shared`.\n- `shared/`, `frontend/shared/` — shared types and utilities used by both the backend and the frontend.\n- `image/` — Python tooling that builds/runs the podman images used by CI and local dev (`image.py build bas-builder`, `image.py run bas-devel`, …); also holds the Dockerfiles and unit systemd files consumed by the images.\n- `gitlab-ci/` — CI scripts and local-run wrappers (`run_ci_locally.py`, `lint_merge_request.py`, `run_build.py`).\n\n## Commands\n\n- Backend (deps, lint, build, test):\n - `cd backend && pnpm run lint` / `pnpm run lint:fix`\n - `cd backend && pnpm run tests` (jest; `pnpm run tests:http` runs the HTTP tests, requires `NODE_TLS_REJECT_UNAUTHORIZED=0`)\n - `cd backend && pnpm run build` (debug) or `pnpm run build:release`; `build:common` also runs `prisma generate`, `tsc`, and `ts-prune`.\n - Frontend must be built before backend (the CI compile check builds frontend → backend per commit).\n- Frontend (lint, build, test):\n - `cd frontend && pnpm run lint`\n - `cd frontend && pnpm run build`\n - `cd frontend && pnpm run test` — Robot Framework tests via pabot (`robot/tests` batch + `robot/tests_sequential` sequential; screenshots regenerated with `pnpm run test:update`).\n\n## Running\n\n- From the repo root: `./image/image.py run bas-devel` builds the dev image (unless already cached) and runs it. The backend runs as service `bas` in the container; check its state with `systemctl status bas`.\n\n## Notes\n\n- Node/PNPM deps: local runs need the node_modules workaround used by CI (`ln -s ~/.backend/node_modules backend/node_modules` or `.frontend`, or set `PNPM_CONFIG_VERIFY_DEPS_BEFORE_RUN=false`); do not assume `pnpm` always auto-installs deps.\n- Frontend E2E tests run against the running backend (CI executes them in the `bas-ci` image and checks `frontend/test-results/tests-succeeded`).\n- Commit convention (README \"Contributing\"): prefix commits with `backend:`, `frontend:`, `docs:`, or `ci:`; a merge request needs at least one approval.\n\n\nToday's date: Mon Nov 02 2026\n\nHere is some useful information about the environment you are running in:\n<env>\n Working directory: /home/constantine/Projects/baum/bacula-gui\n Workspace root folder: /home/constantine/Projects/baum/bacula-gui\n Is directory a git repo: yes\n Platform: linux\n Prefer /tmp/opencode over generic system temporary directories such as /tmp; it is pre-created and approved for external access.\n</env>\nWhen you create a worktree outside the current working directory and intend to use it as your primary working directory, consider using `execute` to call `tools.opencode.session_move` and make the worktree the session's working directory."},{"role":"user","content":"hi"}]
Screenshot
Operating System
Archlinux
Terminal
Konsole
Metadata
Metadata
Assignees
Labels
No labels
Activity
opencodejr commentedon Nov 2, 2026
Thanks for the detailed report and the
nccapture, @Hi-Angel, it makes the request very clear.From the code, the custom agent prompt already replaces OpenCode's built-in system prompt in v2. Your capture shows this: the system message starts with
hello world, and none of the default prompt text is there. The text after it is context that v2 adds separately for every agent:# Your ModelblockAGENTS.mdThe comment you linked in #1242 is about v1, which also added the environment block and
AGENTS.mdafter a custom prompt. So this looks like a request for a new option, not something that broke: a way for an agent to send only its own prompt, or to choose which of these sections are included. Maintainers will consider it.In the meantime, these settings may trim some of it (based on the code, I haven't tested them):
"plugins": ["-opencode.prompt.identity"]inopencode.jsonshould remove the# Your Modelblock.permissionsettings removes them from the Code Mode catalog.Related issues:
Hi-Angel commentedon Nov 2, 2026
Oh, there was even more text? Fair, I didn't know — then yeah, I guess it's rather a feature request to replace the context information. I'd really like if there was a way to completely edit it.
[-][REGRESSION] Unable to modify system prompt[/-][+][RFE] Ability to modify context info that follows the system prompt[/+]Hi-Angel commentedon Nov 2, 2026
UPD: applied edits to the main post to reflect the new info
[-][RFE] Ability to modify context info that follows the system prompt[/-][+][RFE] Ability to modify text in between system prompt and tools listing[/+]