A curly-brace DSL for prompts
Write prompts in a small declarative DSL with the .prompt extension, parsed by a Chevrotain grammar. Blocks — meta, context, params, body, constraints, output, hooks — are legible in a diff and reviewable line by line.
promptel is a small, declarative framework for production LLM prompts. Author once in the DSL or YAML, pick the technique as a block, and run across OpenAI, Anthropic, or Groq from the same file. Grouped by what you're doing.
Two equivalent surfaces for writing a prompt, both parsing to the same AST.
Write prompts in a small declarative DSL with the .prompt extension, parsed by a Chevrotain grammar. Blocks — meta, context, params, body, constraints, output, hooks — are legible in a diff and reviewable line by line.
The same prompt in plain YAML, parsed with js-yaml. Convert in either direction with FormatConverter (promptToYaml / yamlToPrompt) — the DSL is for humans reading review, the YAML is for schema validation and codegen.
Params are declared, typed, and bound before any token leaves your machine.
Declare params with a type, optionality, and a default: code: string, language?: string = "javascript". The executor refuses to run a prompt whose params do not bind, catching a class of runtime failures at parse time.
maxTokens, temperature, topP, and stop live in a constraints block rather than being threaded through call sites. Output format and schema are declared in an output block.
Prompt techniques become nodes in the AST, not folklore pasted between repos.
chainOfThought, fewShot, zeroShot, treeOfThoughts, reAct, and selfConsistency are first-class technique blocks inside body.technique. Reviewers can see which technique is in play without reading the whole string.
A harmony block declares reasoning effort and channels ("final", "analysis", "commentary"). Multi-channel responses are surfaced as structured fields on the result rather than parsed out of prose.
Provider-portable execution from a library API or the CLI.
A provider abstraction wires in OpenAI, Anthropic Claude, and Groq via their official SDKs. Select with executePrompt(src, params, { provider }); switch by changing a flag, not by rewriting templates. Keys come from PROMPTEL_API_KEY or the provider-native env var.
The promptel CLI executes a prompt (-f file -p provider --params …) or converts between .prompt and YAML (--convert yaml). Pipe results into evals, feed CI, or spot-check a change without owning the runtime in your test harness.
The quickstart writes and runs a prompt in a few commands; the architecture page shows how the DSL becomes a provider call.