gleamunison/prompt
Content-addressed prompts (gap analysis concept C).
Prompts are template strings stored as definitions in the codebase DAG: the ref is the hash of the domain-tagged content, so a prompt’s hash is immutable identity, audit tag, and deployment handle in one. Hash-pinned rollout = swap which ref your root points at; A/B = two refs; peer sync = the existing pull machinery, conflict-free by construction.
Rendering is RAW {{var}} substitution — deliberately NOT the web template engine, whose HTML escaping would corrupt prompt payloads.
Types
pub type PromptError {
NotFound
Unreadable
MissingVar(String)
Storage(reason: String)
}
Constructors
-
NotFound -
Unreadable -
MissingVar(String) -
Storage(reason: String)
Values
pub fn describe_error(error: PromptError) -> String
The one place a PromptError becomes a user sentence. Rendering belongs here, with the type, rather than at each call site — inspect output is a debug rendering and must never reach a user.
pub fn get(
cb: codebase.Codebase,
ref: identity.DefinitionRef,
) -> Result(String, PromptError)
Fetch a prompt template by hash.
pub fn put_checked(
cb: codebase.Codebase,
template: String,
) -> Result(
#(codebase.Codebase, identity.DefinitionRef),
PromptError,
)
Store a prompt without hiding a failed CAS write behind a valid-looking ref.
pub fn render(
template: String,
vars: List(#(String, String)),
) -> Result(String, PromptError)
Raw substitution of {{vars}} — no HTML escaping (prompts are not markup).