Summary
When using prime-agent --print with --prompt-template <path> or with files auto-discovered from ~/.prime/agent/prompts/, the template content does not reach the model as system context. The model behaves as if no prompt template was supplied.
To reproduce
# 1. Install prime-agent v0.7.1
PRIME_AGENT_PACKAGE=prime-agent sh install.sh
# 2. Wire Ollama (any model — reproduced with gemma4:e4b and gemma4:26b)
mkdir -p ~/.prime/agent
cat > ~/.prime/agent/models.json <<'JSON'
{
"providers": {
"ollama": {
"baseUrl": "http://localhost:11434/v1",
"api": "openai-completions",
"apiKey": "ollama",
"compat": { "supportsDeveloperRole": false, "supportsReasoningEffort": false },
"models": [{ "id": "gemma4:e4b" }, { "id": "gemma4:26b" }]
}
}
}
JSON
# 3. Drop a prompt template
mkdir -p ~/.prime/agent/prompts
cat > ~/.prime/agent/prompts/00-test.md <<'MD'
---
name: test
description: Test template
---
The secret word is BANANA.
MD
# 4. Try to use it
prime-agent --print --provider ollama --model gemma4:e4b --no-session \
"What is the secret word mentioned in your prompt template?"
Expected: the model answers BANANA (or a paraphrase of the template).
Actual: the model says it has no context, asks for the document, etc.
I was unable to retrieve the information... Could you please provide the document, resource identifier, or section name associated with this?
What I tried
--prompt-template /home/suspect/.prime/agent/prompts/00-test.md (full file path) — same result.
--prompt-template /home/suspect/.prime/agent/prompts (directory) — same result.
- Inlining the same content into the user message works perfectly. So the template loader is producing the right content; the issue is that the loaded template is never appended to the system prompt (or
print mode doesn't read it from the right place).
Environment
- prime-agent v0.7.1
- macOS / Linux (Ubuntu 22, kernel-venv from auto-bootstrap)
- Provider: Ollama (openai-completions compat)
- Mode:
--print (also relevant for --mode json / --mode rpc)
Workaround
For headless runs, inline the template content into the user message. For interactive TUI, the template seems to land correctly (per the docs), but I haven't yet isolated a single repro inside the TUI.
Likely cause (from a quick source read)
loadPromptTemplates in dist/core/prompt-templates.js is wired correctly (it discovers agentDir/prompts/ when includeDefaults: true), and resource-loader.js calls it — but in --print mode the loaded templates do not appear to be appended to the system prompt. The expandPromptTemplate helper exists for /prompt slash command expansion, which suggests prompt templates may only be visible to /prompt, not to the system prompt in print mode.
Happy to send a PR if you can point at the right place to wire this.
Summary
When using
prime-agent --printwith--prompt-template <path>or with files auto-discovered from~/.prime/agent/prompts/, the template content does not reach the model as system context. The model behaves as if no prompt template was supplied.To reproduce
Expected: the model answers
BANANA(or a paraphrase of the template).Actual: the model says it has no context, asks for the document, etc.
What I tried
--prompt-template /home/suspect/.prime/agent/prompts/00-test.md(full file path) — same result.--prompt-template /home/suspect/.prime/agent/prompts(directory) — same result.printmode doesn't read it from the right place).Environment
--print(also relevant for--mode json/--mode rpc)Workaround
For headless runs, inline the template content into the user message. For interactive TUI, the template seems to land correctly (per the docs), but I haven't yet isolated a single repro inside the TUI.
Likely cause (from a quick source read)
loadPromptTemplatesindist/core/prompt-templates.jsis wired correctly (it discoversagentDir/prompts/whenincludeDefaults: true), andresource-loader.jscalls it — but in--printmode the loaded templates do not appear to be appended to the system prompt. TheexpandPromptTemplatehelper exists for/promptslash command expansion, which suggests prompt templates may only be visible to/prompt, not to the system prompt in print mode.Happy to send a PR if you can point at the right place to wire this.