PtcRunner.Lisp.Prompts (PtcRunner v0.4.1)
View SourcePrompt loader for PTC-Lisp language references.
Loads prompt snippets from priv/prompts/ directory at compile time and
provides compositions for common use cases.
Available Prompts
| Key | Description |
|---|---|
:single_shot | Base + single-shot rules |
:multi_turn | Base + multi-turn rules (return/fail, memory) |
Raw Snippets
| Key | File | Description |
|---|---|---|
:base | lisp-base.md | Core language reference |
:addon_single_shot | lisp-addon-single_shot.md | Single-shot mode rules |
:addon_multi_turn | lisp-addon-multi_turn.md | Multi-turn mode rules |
Version Metadata
Prompt files can include optional metadata headers:
<!-- version: 2 -->
<!-- date: 2025-01-15 -->
<!-- changes: Removed threading examples -->Access metadata via version/1 and metadata/1.
Usage
# For single-turn queries
PtcRunner.Lisp.Prompts.get(:single_shot)
# For multi-turn conversations
PtcRunner.Lisp.Prompts.get(:multi_turn)
# Raw snippets for custom compositions
PtcRunner.Lisp.Prompts.get(:base) <> my_custom_addon
# Use in SubAgent
SubAgent.new(
prompt: "...",
system_prompt: %{language_spec: PtcRunner.Lisp.Prompts.get(:single_shot)}
)
Summary
Functions
Check if a prompt is archived.
Get a prompt by key.
Get a prompt by key, raising if not found.
List all available prompt keys (compositions, snippets, and archived).
List only current (non-archived) prompt keys.
List all prompts with descriptions.
Get full metadata for a prompt.
Get the version number for a prompt.
Functions
Check if a prompt is archived.
Compositions are never archived.
Examples
iex> PtcRunner.Lisp.Prompts.archived?(:single_shot)
false
Get a prompt by key.
Supports both raw snippets (:base, :addon_memory) and compositions
(:single_shot, :multi_turn).
Parameters
key- Atom identifying the prompt
Returns
The prompt content as a string, or nil if not found.
Examples
iex> prompt = PtcRunner.Lisp.Prompts.get(:single_shot)
iex> is_binary(prompt)
true
iex> prompt = PtcRunner.Lisp.Prompts.get(:multi_turn)
iex> String.contains?(prompt, "State Persistence")
true
Get a prompt by key, raising if not found.
Examples
iex> prompt = PtcRunner.Lisp.Prompts.get!(:single_shot)
iex> is_binary(prompt)
true
@spec list() :: [atom()]
List all available prompt keys (compositions, snippets, and archived).
Examples
iex> keys = PtcRunner.Lisp.Prompts.list()
iex> :single_shot in keys
true
iex> :multi_turn in keys
true
@spec list_current() :: [atom()]
List only current (non-archived) prompt keys.
Examples
iex> keys = PtcRunner.Lisp.Prompts.list_current()
iex> :single_shot in keys
true
iex> :base in keys
true
List all prompts with descriptions.
Returns a list of {key, description} tuples for all available prompts.
Archived prompts have "[archived]" appended to their description.
Examples
iex> list = PtcRunner.Lisp.Prompts.list_with_descriptions()
iex> Enum.any?(list, fn {k, _} -> k == :single_shot end)
true
Get full metadata for a prompt.
Returns a map with metadata keys like :version, :date, :changes.
For compositions, returns metadata of the first component.
Examples
iex> meta = PtcRunner.Lisp.Prompts.metadata(:base)
iex> is_map(meta)
true
@spec version(atom()) :: pos_integer()
Get the version number for a prompt.
Returns the version from the prompt's metadata, or 1 if not specified. For compositions, returns the version of the first component.