Syntax Reference
Keywords
Section titled “Keywords”Declaration Keywords
Section titled “Declaration Keywords”| Keyword | Description |
|---|---|
let | Declare mutable variable |
const | Declare immutable constant |
function | Declare function |
tool | Declare AI-callable tool |
model | Declare AI model configuration |
type | Declare structural type |
export | Export declaration |
import | Import from module |
from | Specify import source |
Control Flow Keywords
Section titled “Control Flow Keywords”| Keyword | Description |
|---|---|
if | Conditional statement |
else | Else clause |
for | For-in loop |
in | Loop iterator |
while | While loop |
break | Exit innermost loop |
return | Return from function |
AI Keywords
Section titled “AI Keywords”| Keyword | Description |
|---|---|
do | Single-turn AI call |
vibe | Multi-turn AI with tools |
Modifiers
Section titled “Modifiers”| Keyword | Description |
|---|---|
async | Asynchronous execution |
private | Hide from AI context |
Context Modes
Section titled “Context Modes”| Keyword | Description |
|---|---|
forget | Discard loop context |
verbose | Keep full context (default) |
compress | Summarize context |
default | Default context mode |
local | Local context mode |
Literals
Section titled “Literals”| Keyword | Description |
|---|---|
true | Boolean true |
false | Boolean false |
null | Null value |
Logical Operators
Section titled “Logical Operators”| Keyword | Description |
|---|---|
and | Logical AND |
or | Logical OR |
not | Logical NOT |
Statements
Section titled “Statements”Variable Declaration
Section titled “Variable Declaration”let identifier: type = expressionlet identifier = expressionconst identifier: type = expressionconst identifier = expressionAsync Declaration
Section titled “Async Declaration”async let identifier = expressionasync const identifier = expressionPrivate Declaration
Section titled “Private Declaration”private let identifier = expressionlet private identifier = expressionDestructuring
Section titled “Destructuring”let { field1: type1, field2: type2 } = expressionconst { private field: type } = expressionFunction Declaration
Section titled “Function Declaration”function name(param1: type1, param2: type2): returnType { statements}
export function name(params): type { ... }Tool Declaration
Section titled “Tool Declaration”tool name(param1: type1, param2: type2): returnType @description "description" @param param1 "description"{ ts(params) { // implementation }}Model Declaration
Section titled “Model Declaration”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 Declaration
Section titled “Type Declaration”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 Statement
Section titled “If Statement”if condition { statements }if condition { statements } else { statements }if condition { statements } else if condition { statements } else { statements }For Loop
Section titled “For Loop”for identifier in expression { statements }for identifier in expression { statements } forgetfor identifier in expression { statements } verbosefor identifier in expression { statements } compressfor identifier in expression { statements } compress("prompt")for identifier in expression { statements } compress(model)for identifier in expression { statements } compress("prompt", model)While Loop
Section titled “While Loop”while condition { statements }while condition { statements } forgetwhile condition { statements } compressReturn Statement
Section titled “Return Statement”return expressionreturnBreak Statement
Section titled “Break Statement”breakExits the innermost for or while loop immediately.
Import Statement
Section titled “Import Statement”import { name1, name2 } from "path"Export Statement
Section titled “Export Statement”export function name() { }export let name = valueexport const name = valueexport model name = { }Expressions
Section titled “Expressions”AI Expressions
Section titled “AI Expressions”do "prompt"do "prompt" modeldo "prompt" model context
vibe "prompt"vibe "prompt" modelvibe "prompt" model contextTypeScript Block
Section titled “TypeScript Block”ts() { code }ts(var1, var2) { code }ts(alias=expr) { code }ts(x=arr[0], y=obj.field, z=arr[1:3]) { code }Range Expression
Section titled “Range Expression”start..end1..10Binary Operators
Section titled “Binary Operators”a + b // Additiona - b // Subtractiona * b // Multiplicationa / b // Divisiona % b // Moduloa == b // Equalitya != b // Inequalitya < b // Less thana > b // Greater thana <= b // Less or equala >= b // Greater or equala and b // Logical ANDa or b // Logical ORUnary Operators
Section titled “Unary Operators”not a // Logical NOT-a // NegationAccess Expressions
Section titled “Access Expressions”object.property // Member accessarray[index] // Index accessarray[start:end] // Slice accessarray[:end] // Slice from startarray[start:] // Slice to endFunction Call
Section titled “Function Call”functionName()functionName(arg1, arg2)Literals
Section titled “Literals”"string" // Double-quoted string'string' // Single-quoted string`template {var}` // Template literal42 // Integer3.14 // Decimaltrue // Booleanfalse // Booleannull // Null[1, 2, 3] // Array{ key: value } // ObjectComments
Section titled “Comments”// Single line comment/* Multi-line comment */Operator Precedence
Section titled “Operator Precedence”From lowest to highest:
- Assignment (
=) - Logical OR (
or) - Logical AND (
and) - Equality (
==,!=) - Comparison (
<,>,<=,>=) - Addition (
+,-) - Multiplication (
*,/,%) - Unary (
not,-) - Range (
..) - Postfix (
.,[],()) - Primary (literals, identifiers, parentheses)