Centralized prompt loading for PtcRunner.
All prompt templates are loaded from priv/prompts/ at compile time and
exposed through this module. Changes to prompt files trigger recompilation.
Prompt Files (2-Axis Architecture)
Language specs are composed from two axes plus optional capabilities:
| Axis | File | Function |
|---|---|---|
| Reference | reference.md | reference/0 |
| Behavior | behavior-single-shot.md | behavior_single_shot/0 |
| Behavior | behavior-multi-turn.md | behavior_multi_turn/0 |
| Return mode | behavior-return-explicit.md | behavior_return_explicit/0 |
| Capability | capability-journal.md | capability_journal/0 |
Other Prompt Files
| File | Function | Used By |
|---|---|---|
json-system.md | json_system/0 | JsonMode |
json-user.md | json_user/0 | JsonMode |
json-error.md | json_error/0 | JsonMode |
tool-calling-system.md | tool_calling_system/0 | ToolCallingMode |
turn-feedback-must-return.md | must_return_warning/0 | TurnFeedback |
turn-feedback-retry.md | retry_feedback/0 | TurnFeedback |
File Format
Prompt files use HTML comment markers to separate metadata from content:
# Title
Description for maintainers.
<!-- version: 1 -->
<!-- date: 2026-01-01 -->
<!-- PTC_PROMPT_START -->
Actual prompt content here.
<!-- PTC_PROMPT_END -->Content between PTC_PROMPT_START and PTC_PROMPT_END markers is extracted.
If no markers exist, the entire file (trimmed) is used.
Mustache Templates
Some prompts use Mustache templating (e.g., turn-feedback-must-return.md):
{{variable}}- Simple substitution{{#section}}...{{/section}}- Conditional/iteration{{^section}}...{{/section}}- Inverted (if falsy)
See PtcRunner.Mustache for expansion.
Adding New Prompts
- Create
priv/prompts/my-prompt.mdwith markers - Add to this module:
@my_prompt_filepath@external_resource @my_prompt_file@my_promptloaded contentdef my_prompt, do: @my_prompt
- Document in the table above
Summary
Functions
Shared multi-turn core: one code block per turn, state, short programs.
Raw header + content for behavior-multi-turn.md.
Explicit return fragment: use (return ...) / (fail ...).
Raw header + content for behavior-return-explicit.md.
Single-shot behavior: last expression is the answer, one turn.
Raw header + content for behavior-single-shot.md.
Journal capability: task caching, step-done, semantic progress.
Raw header + content for capability-journal.md.
Get a prompt by key.
Text mode (JSON variant) error feedback template (Mustache).
Text mode (JSON variant) system prompt.
Text mode (JSON variant) user message template (Mustache).
List all available prompt keys.
Final work turn warning template (Mustache).
Language reference: tool syntax, Java interop, restrictions.
Raw header + content for reference.md.
Retry phase feedback template (Mustache).
Tool calling mode system prompt.
Functions
@spec behavior_multi_turn() :: String.t()
Shared multi-turn core: one code block per turn, state, short programs.
Raw header + content for behavior-multi-turn.md.
@spec behavior_return_explicit() :: String.t()
Explicit return fragment: use (return ...) / (fail ...).
Raw header + content for behavior-return-explicit.md.
@spec behavior_single_shot() :: String.t()
Single-shot behavior: last expression is the answer, one turn.
Raw header + content for behavior-single-shot.md.
@spec capability_journal() :: String.t()
Journal capability: task caching, step-done, semantic progress.
Raw header + content for capability-journal.md.
Get a prompt by key.
Examples
iex> prompt = PtcRunner.Prompts.get(:reference)
iex> String.contains?(prompt, "<role>")
true
iex> PtcRunner.Prompts.get(:unknown)
nil
@spec json_error() :: String.t()
Text mode (JSON variant) error feedback template (Mustache).
@spec json_system() :: String.t()
Text mode (JSON variant) system prompt.
@spec json_user() :: String.t()
Text mode (JSON variant) user message template (Mustache).
@spec list() :: [atom()]
List all available prompt keys.
Examples
iex> keys = PtcRunner.Prompts.list()
iex> :reference in keys
true
@spec must_return_warning() :: String.t()
Final work turn warning template (Mustache).
Variables: has_retries (bool), retry_count (int).
@spec reference() :: String.t()
Language reference: tool syntax, Java interop, restrictions.
Raw header + content for reference.md.
@spec retry_feedback() :: String.t()
Retry phase feedback template (Mustache).
Variables: is_final_retry, current_retry, total_retries,
retries_remaining, next_turn.
@spec tool_calling_system() :: String.t()
Tool calling mode system prompt.