bug: unused tool prompts included in context even when not configured #1805

Closed
opened 2026-02-16 17:32:41 -05:00 by yindo · 6 comments
Owner

Originally created by @srevn on GitHub (Sep 23, 2025).

Originally assigned to: @rekram1-node on GitHub.

When configuring a local provider (llama.cpp), the custom prompt specified in the configuration is being ignored. Instead, the system sends an initial prompt of 198 tokens followed by a much larger secondary prompt of 7604 tokens, which isn't ideal for small rigs with limited VRAM.

Here is the configuration:

{
	"$schema": "https://opencode.ai/config.json",
	"provider": {
		"llama.cpp": {
			"npm": "@ai-sdk/openai-compatible",
			"name": "llama.cpp",
			"options": {
				"baseURL": "https://api.example.com/v1"
			},
			"models": {
				"qwen3-coder-30b": {
					"name": "Qwen 3 Coder"
				}
			}
		}
	},
	"agent": {
		"chat": {
			"mode": "primary",
			"model": "llama.cpp/qwen3-coder-30b",
			"prompt": "You are a helpful assistant.",
			"tools": {
				"webfetch": true
			}
		}
	}
}

Here are llama.cpp logs:

main: server is listening on http://127.0.0.1:9091 - starting the main loop
srv  update_slots: all slots are idle
srv  log_server_r: request: GET /health 127.0.0.1 200
srv  params_from_: Chat format: Hermes 2 Pro
slot get_availabl: id  0 | task -1 | selected slot by LRU, t_last = -1
slot launch_slot_: id  0 | task 0 | processing task
slot update_slots: id  0 | task 0 | new prompt, n_ctx_slot = 16384, n_keep = 0, n_prompt_tokens = 198
slot update_slots: id  0 | task 0 | kv cache rm [0, end)
slot update_slots: id  0 | task 0 | prompt processing progress, n_past = 198, n_tokens = 198, progress = 1.000000
slot update_slots: id  0 | task 0 | prompt done, n_past = 198, n_tokens = 198
srv  params_from_: Chat format: Hermes 2 Pro
slot      release: id  0 | task 0 | stop processing: n_past = 202, truncated = 0
slot print_timing: id  0 | task 0 | 
prompt eval time =   16903.98 ms /   198 tokens (   85.37 ms per token,    11.71 tokens per second)
       eval time =      80.05 ms /     5 tokens (   16.01 ms per token,    62.46 tokens per second)
      total time =   16984.03 ms /   203 tokens
slot get_availabl: id  0 | task 0 | selected slot by LRU, t_last = 228539689251
srv  log_server_r: request: POST /v1/chat/completions 127.0.0.1 200
slot launch_slot_: id  0 | task 2 | processing task
slot update_slots: id  0 | task 2 | new prompt, n_ctx_slot = 16384, n_keep = 0, n_prompt_tokens = 7604
slot update_slots: id  0 | task 2 | kv cache rm [6, end)
slot update_slots: id  0 | task 2 | prompt processing progress, n_past = 2054, n_tokens = 2048, progress = 0.269332
Originally created by @srevn on GitHub (Sep 23, 2025). Originally assigned to: @rekram1-node on GitHub. When configuring a local provider (llama.cpp), the custom prompt specified in the configuration is being ignored. Instead, the system sends an initial prompt of 198 tokens followed by a much larger secondary prompt of 7604 tokens, which isn't ideal for small rigs with limited VRAM. Here is the configuration: ```JSON { "$schema": "https://opencode.ai/config.json", "provider": { "llama.cpp": { "npm": "@ai-sdk/openai-compatible", "name": "llama.cpp", "options": { "baseURL": "https://api.example.com/v1" }, "models": { "qwen3-coder-30b": { "name": "Qwen 3 Coder" } } } }, "agent": { "chat": { "mode": "primary", "model": "llama.cpp/qwen3-coder-30b", "prompt": "You are a helpful assistant.", "tools": { "webfetch": true } } } } ``` Here are llama.cpp logs: ``` main: server is listening on http://127.0.0.1:9091 - starting the main loop srv update_slots: all slots are idle srv log_server_r: request: GET /health 127.0.0.1 200 srv params_from_: Chat format: Hermes 2 Pro slot get_availabl: id 0 | task -1 | selected slot by LRU, t_last = -1 slot launch_slot_: id 0 | task 0 | processing task slot update_slots: id 0 | task 0 | new prompt, n_ctx_slot = 16384, n_keep = 0, n_prompt_tokens = 198 slot update_slots: id 0 | task 0 | kv cache rm [0, end) slot update_slots: id 0 | task 0 | prompt processing progress, n_past = 198, n_tokens = 198, progress = 1.000000 slot update_slots: id 0 | task 0 | prompt done, n_past = 198, n_tokens = 198 srv params_from_: Chat format: Hermes 2 Pro slot release: id 0 | task 0 | stop processing: n_past = 202, truncated = 0 slot print_timing: id 0 | task 0 | prompt eval time = 16903.98 ms / 198 tokens ( 85.37 ms per token, 11.71 tokens per second) eval time = 80.05 ms / 5 tokens ( 16.01 ms per token, 62.46 tokens per second) total time = 16984.03 ms / 203 tokens slot get_availabl: id 0 | task 0 | selected slot by LRU, t_last = 228539689251 srv log_server_r: request: POST /v1/chat/completions 127.0.0.1 200 slot launch_slot_: id 0 | task 2 | processing task slot update_slots: id 0 | task 2 | new prompt, n_ctx_slot = 16384, n_keep = 0, n_prompt_tokens = 7604 slot update_slots: id 0 | task 2 | kv cache rm [6, end) slot update_slots: id 0 | task 2 | prompt processing progress, n_past = 2054, n_tokens = 2048, progress = 0.269332 ```
yindo closed this issue 2026-02-16 17:32:41 -05:00
Author
Owner

@github-actions[bot] commented on GitHub (Sep 23, 2025):

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

  • #2465: feat(compact): override compact default model and prompt - Similar issue where custom prompt configuration in agent settings is being ignored
  • #2460/#2461: 'model' field in slash command appears to be ignored - Similar configuration issues where model/prompt settings in configuration are being ignored
  • #847: AGENTS.md is being ignored - Another case of configuration/prompt files being ignored by the system
  • #1130: AGENTS.md isn't being respected by copilot - Related issue with prompt/configuration files not being respected

Feel free to ignore if none of these address your specific case with local provider custom prompts.

@github-actions[bot] commented on GitHub (Sep 23, 2025): This issue might be a duplicate of existing issues. Please check: - #2465: feat(compact): override compact default model and prompt - Similar issue where custom prompt configuration in agent settings is being ignored - #2460/#2461: 'model' field in slash command appears to be ignored - Similar configuration issues where model/prompt settings in configuration are being ignored - #847: AGENTS.md is being ignored - Another case of configuration/prompt files being ignored by the system - #1130: AGENTS.md isn't being respected by copilot - Related issue with prompt/configuration files not being respected Feel free to ignore if none of these address your specific case with local provider custom prompts.
Author
Owner

@rekram1-node commented on GitHub (Sep 23, 2025):

@srevn there may be a misunderstanding here so before I try to answer can you clarify what you mean by ignored?

This prompt:
"You are a helpful assistant."

Should be included, but opencode also has other system prompts it will include (information about your environment, and the normal opencode default system prompt see here: https://github.com/sst/opencode/blob/dev/packages/opencode/src/session/prompt/qwen.txt

You may already know this but I wanna clarify so I can understand here

@rekram1-node commented on GitHub (Sep 23, 2025): @srevn there may be a misunderstanding here so before I try to answer can you clarify what you mean by ignored? This prompt: "You are a helpful assistant." Should be included, but opencode also has other system prompts it will include (information about your environment, and the normal opencode default system prompt see here: https://github.com/sst/opencode/blob/dev/packages/opencode/src/session/prompt/qwen.txt You may already know this but I wanna clarify so I can understand here
Author
Owner

@srevn commented on GitHub (Sep 24, 2025):

Thanks for the clarification, i've missed this in the documentation. I think I was expecting the behaviour of other similar tools where a custom prompt typically replaces the default system prompt entirely.

I'm guessing there isn't such a mode available?

@srevn commented on GitHub (Sep 24, 2025): Thanks for the clarification, i've missed this in the documentation. I think I was expecting the behaviour of other similar tools where a custom prompt typically replaces the default system prompt entirely. I'm guessing there isn't such a mode available?
Author
Owner

@srevn commented on GitHub (Sep 24, 2025):

I did some digging to figure out where those ~7k tokens are coming from.

The system prompt ("You are a helpful assistant.") is being applied correctly and it does override any other system prompt. However, it looks like all the tool-related prompts are still being loaded after the session starts — even if only one specific tool is actually configured in the "tools" section.

@srevn commented on GitHub (Sep 24, 2025): I did some digging to figure out where those ~7k tokens are coming from. The system prompt ("You are a helpful assistant.") is being applied correctly and it does override any other system prompt. However, it looks like all the tool-related prompts are still being loaded after the session starts — even if only one specific tool is actually configured in the `"tools"` section.
Author
Owner

@rekram1-node commented on GitHub (Sep 24, 2025):

@srevn thats because all tools are loaded by default, adjust it to do:

“*”: false,
“webfetch”: true

and that should behave as expected

@rekram1-node commented on GitHub (Sep 24, 2025): @srevn thats because all tools are loaded by default, adjust it to do: “*”: false, “webfetch”: true and that should behave as expected
Author
Owner

@srevn commented on GitHub (Sep 24, 2025):

Great! Looks like this was actually a misconfiguration on my part. I hadn’t realized that all tools are enabled by default unless explicitly disabled.

Thanks a lot for your help!

@srevn commented on GitHub (Sep 24, 2025): Great! Looks like this was actually a misconfiguration on my part. I hadn’t realized that all tools are enabled by default unless explicitly disabled. Thanks a lot for your help!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#1805