Skip to content

Human & machine syntax mode

VibeLang gives you one language, one AST, and two lossless surface representations:

  • Human representation — standard readable .vibe formatted with your repository's dprint or Prettier config (effect function, uninterruptible, 2-space indentation, standard spacing).
  • Machine representation — token-compact TypeScript-shaped .vibe (ef / ef*, unint / intr, 1-space indentation and BPE-tight punctuation spacing, on the same lines as the human form) that parses to the exact same AST and compiles to byte-identical JavaScript and .d.vibe.ts declarations, which the benchmark run below checks on all 30 tasks. FuzzMachineFormEmitsSameJavaScript holds the same bytes for generated programs.

Why machine mode stays close to human VibeLang

Our benchmarks across 30 verified Effect 4 programs and 342 live agent trials proved that alien expression syntaxes (indentation-only blocks or Lisp S-expressions) trigger up to +412.5% more hidden thinking tokens and cut small-model pass@1 from 90.9% to 40.9%.

By keeping TypeScript/Vibe expressions, braces, and single-token keywords (error, service, schema, data, provide, try, catch, match, when) untouched and compacting only multi-token heads and BPE-expensive whitespace, machine mode achieves:

Representationo200k_base (30 tasks)cl100k_base (30 tasks)Charactersvs. Human .vibevs. Effect 4 TS
Effect 4 TypeScript6,1836,16523,982+31.9%baseline
Human VibeLang (.vibe)4,6884,67917,391baseline-24.2%
Machine VibeLang (--indent=1, default)3,9603,94414,878-15.5%-36.0%
Machine VibeLang (--indent=0, flat)3,8223,80714,340-18.5%-38.2%

Every number in this table is a field of vip82MachineMode30Tasks in docs/user/benchmarks/agent-syntax/results.json, which one command regenerates from the 30 benchmark-30 tasks with the native compiler:

node docs/user/benchmarks/agent-syntax/verify-machine-mode.mjs --write

The same run checks, for all 30 tasks: 30/30 human → machine (--indent=1 and --indent=0), 30/30 idempotent machine → machine, 30/30 machine → human → machine returning the machine file byte for byte, 30/30 byte-identical .d.ts declarations, 30/30 byte-identical JavaScript, 30/30 expected runtime output, and 30/30 --syntax=human and --syntax=machine EK3014 enforcement. The command exits 1 when any check fails; --check also fails when results.json differs from what it measures.

Exact differences between human and machine forms

ConstructHuman formMachine form
Effect functioneffect function f(x: number)ef f(x:number)
Exported effect functionexport effect function f()export ef f()
Effect producereffect function* stream()ef* stream()
Effect methodeffect m() { ... }ef m(){...}
Interruption blocksuninterruptible { ... } / interruptible { ... }unint{...} / intr{...}
Layout & spacingStandard formatter style1-space indent (or --indent=0), tight punctuation, same lines

ef, unint, and intr are strictly contextual: variables, parameters, properties, and calls named ef, unint, or intr keep their ordinary TypeScript meaning, and TypeScript module bodies are never modified.

One program, both views

Human representation (86 o200k_base tokens):

// human.vibe
error NotFound { id: string }
 
effect function findName(id: string): string!NotFound {
  if (id === "1") return "Ada"
  throw new NotFound({ id })
}
 
export effect function run() {
  const found = findName("1") catch () => "Guest"
  const fallback = findName("99") catch () => "Guest"
  return { found, fallback }
}

Machine representation (69 o200k_base tokens, -19.8%), exactly as vibe convert --to=machine prints it:

// machine.vibe
error NotFound{id:string}
 
ef findName(id:string):string!NotFound{
 if(id==="1") return "Ada"
 throw new NotFound({id})
}
 
export ef run(){
 const found=findName("1") catch()=>"Guest"
 const fallback=findName("99") catch()=>"Guest"
 return{found,fallback}
}

Two-way compiler conversion (vibe convert)

Switch seamlessly in either direction with the native compiler:

# Convert to machine representation (stdout, in-place write, or CI check)
npx vibe convert --to=machine src/app.vibe
npx vibe convert --to=machine --write src/
npx vibe convert --to=machine --check src/
npx vibe convert --to=machine --indent=0 src/app.vibe
 
# Convert back to canonical human representation
npx vibe convert --to=human --write src/
npx vibe convert --to=human --check src/
 
# Pipe over stdin/stdout (for editors, pre-commit hooks, or agent bridges)
npx vibe convert --to=machine --stdin-filepath src/app.vibe < src/app.vibe

vibe --convert is the same command as vibe convert and takes the same options.

You can also switch through the formatter:

npx vibe format --mode=machine --write src/
npx vibe format --mode=human --write src/

What a round trip returns

The machine form and the human form are each a fixed point of their own conversion, and each converts to the other byte for byte:

  • machine → human → machine returns the machine file exactly.
  • human → machine → human returns the human file exactly, for every file vibe convert --to=human has formatted.
  • Converting a file to machine form gives the same bytes whether or not it was converted to human form first.

The machine form carries every token, comment and line of the program, blank lines included, and keeps the file's line ending (LF or CRLF). Only indentation and the spacing inside a line change, so nothing is lost in either direction. The compiler holds these rules on every .vibe and .vibex file of its acceptance corpus that parses (TestConvertRoundTripCorpus) and on the fuzz targets FuzzMachineSyntaxRoundTrip and FuzzConvertLayoutRoundTrip.

vibe format --mode=human also runs your repository's dprint style over the human form. dprint may move line breaks and drop the braces of a one-statement body, so the machine form of a dprint-formatted file is the same program but not always the same bytes; vibe convert --to=human keeps every line and returns the same bytes.

Some effect functions have one spelling in both forms, because ef does not parse there: an effect function expression, a default export, an effect function named as, satisfies or is, a producer with no return type whose body is absent or starts on a later line, a head with a comment between effect and function, and a head with a line break before its name. vibe convert leaves them as they are and vibe.syntax: "machine" accepts them.

Every conversion runs the compiler's AST-equivalence verifier (SameProgram) before emitting or writing a single byte. If a file has syntax errors or the rewrite would alter any AST node, module body, or JSDoc/comment attachment, vibe convert exits non-zero and leaves the file untouched.

Project and CLI switches (vibe.syntax and --syntax)

By default ("vibe": { "syntax": "both" }), the compiler accepts both human and machine spellings in the same project and file so teams can convert files freely without breaking builds.

To enforce one representation across a repository in CI, set vibe.syntax in vibe.config.json or tsconfig.json:

{
  "vibe": {
    "syntax": "human"
  }
}
vibe.syntax valueCompiler behavior
"both" (default)Accepts both human and machine forms with no diagnostic.
"human"Enforces human spellings; reports EK3014 on ef, ef*, unint, and intr.
"machine"Enforces machine spellings; reports EK3014 on effect function, effect function*, uninterruptible, and interruptible wherever the machine spelling exists.

Override the project setting for a single command with --syntax:

npx vibe --syntax=human --noEmit
npx vibe --syntax=machine --noEmit

See VIP-82 and Configuration and tooling for the complete specification.