You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
My issue is not a minor or cosmetic quirk (e.g., formatting, spacing, or other non-functional details)
Neovim version (nvim -v)
v0.11.5 LuaJIT 2.1.1765228720
Operating system/version
macOS 15.4
Adapter and model
any
Describe the bug
Changing adapter replaces my system prompt from a custom prompt by the default system prompt.
Steps to reproduce
Store the markdown below as prompts/test.md directory next to the minimal.lua.
Run :CodeCompanionActions and select the prompt
Use gd to confirm the system prompt that will be replaced is among the messages. It is the first system message.
Use ga and change adapter to anything.
Use gd and confirm the custom system prompt was replaced by the default prompt. The default system prompt is there twice now.
---name: Test Promptinteraction: chatdescription: Reproduce bug---## system
system prompt that will be replaced
## user
Test
Expected behavior
I expected the custom system prompt to be kept when changing adapters.
I also expected this custom system prompt to be the last system prompt (most custom -> highest priority -> last) -- after the default system prompt and after system prompts from rules when they are used.
Moving the custom system prompt behind the default system prompt would also fix the bug because the change_adapter implementation assumes the default system prompt is the first message.
As a workaround it is possible to use opts: ignore_system_prompt: true in the frontmatter (this blocks change_adapter from replacing the system prompt) and copy the default system prompt directly to the file (optionally).
Screenshots or recordings (optional)
No response
minimal.lua file
---@diagnosticdisable:missing-fieldsvim.env.LAZY_STDPATH=".repro"load(vim.fn.system("curl -s https://raw.githubusercontent.com/folke/lazy.nvim/main/bootstrap.lua"))()
-- Your CodeCompanion setuplocalplugins= {
{
"olimorris/codecompanion.nvim",
dependencies= {
{ "nvim-lua/plenary.nvim" },
{
"nvim-treesitter/nvim-treesitter",
lazy=false,
--[[ Without master branch, the prompts were not loading and these warnings showed up: [Prompt Library] Missing frontmatter, name or interaction in `/private/tmp/nvim_issue_repro/try2/.repro/data/nvim/lazy/codecompanion.nvim/lua/codecompanion/actions/builtins/code_workflow.md` ... [Prompt Library] Missing frontmatter, name or interaction in `/private/tmp/nvim_issue_repro/try2/.repro/data/nvim/lazy/codecompanion.nvim/lua/codecompanion/actions/builtins/unit_tests.md` [Prompt Library] Missing frontmatter, name or interaction in `/private/tmp/nvim_issue_repro/try2/prompts/test.md`--]]branch="master",
build=":TSUpdate",
},
},
opts= {
--Refer to: https://github.com/olimorris/codecompanion.nvim/blob/main/lua/codecompanion/config.luainteractions= {
chat= { adapter="ollama" },
},
opts= {
log_level="DEBUG",
},
prompt_library= {
markdown= {
dirs= {
vim.fn.getcwd() .."/prompts",
},
},
},
},
},
}
require("lazy.minit").repro({ spec=plugins })
-- CONFIGURE PLUGINS HERE ------------------------------------------------------- Setup Tree-sitterrequire("nvim-treesitter.configs").setup({
ensure_installed= { "lua", "markdown", "markdown_inline", "yaml" },
})
This discussion was converted from issue #2608 on January 01, 2026 09:00.
Heading
Bold
Italic
Quote
Code
Link
Numbered list
Unordered list
Task list
Attach files
Mention
Reference
Menu
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Pre-submission checklist
Neovim version (nvim -v)
v0.11.5 LuaJIT 2.1.1765228720
Operating system/version
macOS 15.4
Adapter and model
any
Describe the bug
Changing adapter replaces my system prompt from a custom prompt by the default system prompt.
Steps to reproduce
prompts/test.mddirectory next to theminimal.lua.gdto confirm thesystem prompt that will be replacedis among the messages. It is the first system message.gaand change adapter to anything.gdand confirm the custom system prompt was replaced by the default prompt. The default system prompt is there twice now.Expected behavior
I expected the custom system prompt to be kept when changing adapters.
I also expected this custom system prompt to be the last system prompt (most custom -> highest priority -> last) -- after the default system prompt and after system prompts from rules when they are used.
Moving the custom system prompt behind the default system prompt would also fix the bug because the change_adapter implementation assumes the default system prompt is the first message.
As a workaround it is possible to use
opts: ignore_system_prompt: truein the frontmatter (this blockschange_adapterfrom replacing the system prompt) and copy the default system prompt directly to the file (optionally).Screenshots or recordings (optional)
No response
minimal.lua file
Log output (optional)
[INFO] 2026-01-01 03:53:44
[Interaction] Chat Initiated
Minimal reproduction confirmation
minimal.luafile that reproduces the issueBeta Was this translation helpful? Give feedback.
All reactions