Skip to content

Syntax Reference

KeywordDescription
letDeclare mutable variable
constDeclare immutable constant
functionDeclare function
toolDeclare AI-callable tool
modelDeclare AI model configuration
typeDeclare structural type
exportExport declaration
importImport from module
fromSpecify import source
KeywordDescription
ifConditional statement
elseElse clause
forFor-in loop
inLoop iterator
whileWhile loop
breakExit innermost loop
returnReturn from function
KeywordDescription
doSingle-turn AI call
vibeMulti-turn AI with tools
KeywordDescription
asyncAsynchronous execution
privateHide from AI context
KeywordDescription
forgetDiscard loop context
verboseKeep full context (default)
compressSummarize context
defaultDefault context mode
localLocal context mode
KeywordDescription
trueBoolean true
falseBoolean false
nullNull value
KeywordDescription
andLogical AND
orLogical OR
notLogical NOT
let identifier: type = expression
let identifier = expression
const identifier: type = expression
const identifier = expression
async let identifier = expression
async const identifier = expression
private let identifier = expression
let private identifier = expression
let { field1: type1, field2: type2 } = expression
const { private field: type } = expression
function name(param1: type1, param2: type2): returnType {
statements
}
export function name(params): type { ... }
tool name(param1: type1, param2: type2): returnType
@description "description"
@param param1 "description"
{
ts(params) {
// implementation
}
}
model name = {
name: "model-id",
apiKey: expression,
provider: "anthropic" | "openai" | "google",
url: "optional-url",
maxRetriesOnError: number,
thinkingLevel: "none" | "low" | "medium" | "high" | "max",
tools: [tool1, tool2]
}
type TypeName {
field1: type1
field2: type2
}
type TypeName { field1: type1, field2: type2 }

Fields can be separated by commas, newlines, or both.

Nested types:

type Outer {
inner: InnerType // Reference named type
data: { // Inline nested object
value: number
label: text
}
}

Arrays of types:

type Team { players: Player[] }
if condition { statements }
if condition { statements } else { statements }
if condition { statements } else if condition { statements } else { statements }
for identifier in expression { statements }
for identifier in expression { statements } forget
for identifier in expression { statements } verbose
for identifier in expression { statements } compress
for identifier in expression { statements } compress("prompt")
for identifier in expression { statements } compress(model)
for identifier in expression { statements } compress("prompt", model)
while condition { statements }
while condition { statements } forget
while condition { statements } compress
return expression
return
break

Exits the innermost for or while loop immediately.

import { name1, name2 } from "path"
export function name() { }
export let name = value
export const name = value
export model name = { }
do "prompt"
do "prompt" model
do "prompt" model context
vibe "prompt"
vibe "prompt" model
vibe "prompt" model context
ts() { code }
ts(var1, var2) { code }
ts(alias=expr) { code }
ts(x=arr[0], y=obj.field, z=arr[1:3]) { code }
start..end
1..10
a + b // Addition
a - b // Subtraction
a * b // Multiplication
a / b // Division
a % b // Modulo
a == b // Equality
a != b // Inequality
a < b // Less than
a > b // Greater than
a <= b // Less or equal
a >= b // Greater or equal
a and b // Logical AND
a or b // Logical OR
not a // Logical NOT
-a // Negation
object.property // Member access
array[index] // Index access
array[start:end] // Slice access
array[:end] // Slice from start
array[start:] // Slice to end
functionName()
functionName(arg1, arg2)
"string" // Double-quoted string
'string' // Single-quoted string
`template {var}` // Template literal
42 // Integer
3.14 // Decimal
true // Boolean
false // Boolean
null // Null
[1, 2, 3] // Array
{ key: value } // Object
// Single line comment
/* Multi-line
comment */

From lowest to highest:

  1. Assignment (=)
  2. Logical OR (or)
  3. Logical AND (and)
  4. Equality (==, !=)
  5. Comparison (<, >, <=, >=)
  6. Addition (+, -)
  7. Multiplication (*, /, %)
  8. Unary (not, -)
  9. Range (..)
  10. Postfix (., [], ())
  11. Primary (literals, identifiers, parentheses)