Language Reference
This reference covers all the syntax elements in the .prompt language.
The One Rule
@ means variable. Always. Only. Everywhere.
Structural keywords never use @.
Init Block
Every .prompt file starts with an init block that declares metadata, parameters, and fragments:
init do@version: 1.0@major: 1def:mode: explanationdescription: Human readable description.params:@name: type = default -> documentationfragments:{name}: static from: folder_or_file{{name}}: dynamic -> fetched freshdocs doFree text documentation. Surfaces via MCP.end docsend init
Fields
| Field | Required | Description |
|---|---|---|
@version | Yes | Semantic version (major.minor) |
@major | Yes | Major version for stability (callers pin to this) |
def | No | Human-readable metadata (mode, description) |
params | No | Input contract |
fragments | No | Fragment declarations |
docs | No | Free-form documentation |
Sigils
| Sigil | Meaning |
|---|---|
@name | Variable |
{name} | Static fragment |
{{name}} | Dynamic fragment |
# | Comment — never reaches LLM |
-> | Documentation — surfaces via MCP |
= | Default value |
Operators
Operator Meaning is Equality not Inequality above Greater than below Less than min Greater than or equal max Less than or equal between Inclusive range
Example
init do
@version: 1.0
@major: 1
params:
@greeting: enum[hello, hi, hey] = hello
@name: str
end init
case @greeting do
hello: Hello, @name!
hi: Hi, @name!
hey: Hey, @name!
end @greeting
Next Steps
- Types — Learn about the type system
- Control Flow — Add branching logic
- Fragments — Compose from reusable pieces