PtcRunner.Prompts (PtcRunner v0.9.0)

Copy Markdown View Source

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

FileFunctionUsed By
lisp-base.mdlisp_base/0LanguageSpec
lisp-addon-single_shot.mdlisp_addon_single_shot/0LanguageSpec
lisp-addon-multi_turn.mdlisp_addon_multi_turn/0LanguageSpec
json-system.mdjson_system/0JsonMode
json-user.mdjson_user/0JsonMode
json-error.mdjson_error/0JsonMode
tool-calling-system.mdtool_calling_system/0ToolCallingMode
must_return_warning.mdmust_return_warning/0TurnFeedback
retry_feedback.mdretry_feedback/0TurnFeedback
planning-examples.mdplanning_examples/0MetaPlanner
verification-predicate-guide.mdverification_guide/0MetaPlanner
verification-predicate-reminder.mdverification_reminder/0MetaPlanner

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., must_return_warning.md):

  • {{variable}} - Simple substitution
  • {{#section}}...{{/section}} - Conditional/iteration
  • {{^section}}...{{/section}} - Inverted (if falsy)

See PtcRunner.Mustache for expansion.

Adding New Prompts

  1. Create priv/prompts/my-prompt.md with markers
  2. Add to this module:
    • @my_prompt_file path
    • @external_resource @my_prompt_file
    • @my_prompt loaded content
    • def my_prompt, do: @my_prompt
  3. Document in the table above

Summary

Functions

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).

Journal addon (task caching, step-done, semantic progress).

Raw header + content for lisp-addon-journal.md.

Multi-turn mode addon (memory, return/fail, println).

Raw header + content for lisp-addon-multi_turn.md.

Single-shot mode addon (no memory, no return/fail).

Raw header + content for lisp-addon-single_shot.md.

Core PTC-Lisp language reference (always included).

Raw header + content for lisp-base.md (for metadata parsing).

List all available prompt keys.

Final work turn warning template (Mustache).

Example plan structure for MetaPlanner.

Retry phase feedback template (Mustache).

Guide for writing task signatures.

Tool calling mode system prompt.

Comprehensive guide for writing verification predicates.

Quick reference reminder for verification predicates.

Functions

get(arg1)

@spec get(atom()) :: String.t() | nil

Get a prompt by key.

Examples

iex> prompt = PtcRunner.Prompts.get(:lisp_base)
iex> String.contains?(prompt, "<role>")
true

iex> PtcRunner.Prompts.get(:unknown)
nil

json_error()

@spec json_error() :: String.t()

Text mode (JSON variant) error feedback template (Mustache).

json_system()

@spec json_system() :: String.t()

Text mode (JSON variant) system prompt.

json_user()

@spec json_user() :: String.t()

Text mode (JSON variant) user message template (Mustache).

lisp_addon_journal()

@spec lisp_addon_journal() :: String.t()

Journal addon (task caching, step-done, semantic progress).

lisp_addon_journal_with_header()

@spec lisp_addon_journal_with_header() :: {String.t(), String.t()}

Raw header + content for lisp-addon-journal.md.

lisp_addon_multi_turn()

@spec lisp_addon_multi_turn() :: String.t()

Multi-turn mode addon (memory, return/fail, println).

lisp_addon_multi_turn_with_header()

@spec lisp_addon_multi_turn_with_header() :: {String.t(), String.t()}

Raw header + content for lisp-addon-multi_turn.md.

lisp_addon_single_shot()

@spec lisp_addon_single_shot() :: String.t()

Single-shot mode addon (no memory, no return/fail).

lisp_addon_single_shot_with_header()

@spec lisp_addon_single_shot_with_header() :: {String.t(), String.t()}

Raw header + content for lisp-addon-single_shot.md.

lisp_base()

@spec lisp_base() :: String.t()

Core PTC-Lisp language reference (always included).

lisp_base_with_header()

@spec lisp_base_with_header() :: {String.t(), String.t()}

Raw header + content for lisp-base.md (for metadata parsing).

list()

@spec list() :: [atom()]

List all available prompt keys.

Examples

iex> keys = PtcRunner.Prompts.list()
iex> :lisp_base in keys
true

must_return_warning()

@spec must_return_warning() :: String.t()

Final work turn warning template (Mustache).

Variables: has_retries (bool), retry_count (int).

planning_examples()

@spec planning_examples() :: String.t()

Example plan structure for MetaPlanner.

retry_feedback()

@spec retry_feedback() :: String.t()

Retry phase feedback template (Mustache).

Variables: is_final_retry, current_retry, total_retries, retries_remaining, next_turn.

signature_guide()

@spec signature_guide() :: String.t()

Guide for writing task signatures.

tool_calling_system()

@spec tool_calling_system() :: String.t()

Tool calling mode system prompt.

verification_guide()

@spec verification_guide() :: String.t()

Comprehensive guide for writing verification predicates.

verification_reminder()

@spec verification_reminder() :: String.t()

Quick reference reminder for verification predicates.