Vibe a Lang: Vibe Your Own Language
VibeLang is about vibing your own language — building a programming language shaped around your domain so domain code reads like a concise spec, compiles to Effect JavaScript, and keeps the entire TypeScript ecosystem intact.
The built-in .vibe language (typed errors, services, structured concurrency, brand types, schemas, exhaustive match, and experimental durable workflows) is the base layer and first built-in DSL, not the ceiling. It solves the universal reliability problems once so your own domain language can spend its syntax purely on your domain.
Want help designing or shipping a custom domain or ontology language for your organization? See VibeLang for your team.
Why people and codebases invent languages
People who work together naturally invent shared vocabulary. Communities develop slang; professions develop terminology; engineering teams invent internal nouns for their systems; even families have private words that compress ten sentences into two.
Every serious codebase does the same thing. A billing platform talks in invoices, tenants, ledgers, and settlements. An Ethereum stack talks in addresses, slots, contracts, and forks. An editorial workflow talks in voices, thoughts, rubrics, and threads. Yet in general-purpose TypeScript, that vocabulary stays trapped in prose docs (AGENTS.md, architecture RFCs, PR checklists) and ad-hoc helper conventions.
Coding agents change the economics of language design in both directions:
- Building and maintaining a tailored language is now cheap. A small, focused compiler front end or language extension that used to require a dedicated compiler team can now be designed, tested, and evolved alongside the product.
- Every fresh agent session needs compiler backpressure, not longer prose. A coding agent starts each session cold. It can forget a rule buried on line 300 of a markdown doc, skip a tenant check, or drift from a naming convention. Put that rule in the language and the compiler checks it in ~120 ms at the exact line where the agent writes code.
The ultimate goal of a domain language is a programming model that reads like a concise spec.
The four-layer stack: TypeScript -> Effect -> Vibe -> Your Lang
Traditionally, teams avoided building a domain-specific language because a custom language meant giving up shared tooling — broken IDE hover and go-to-definition, custom build pipelines, no linters or formatters, broken source maps, and painful npm interop.
VibeLang eliminates that tradeoff by layering cleanly on TypeScript and Effect:
| Layer | Responsibility | What it gives every layer above |
|---|---|---|
| TypeScript | Host ecosystem | .ts files, npm packages, bundlers, debuggers, type definitions, and developer familiarity |
| Effect | Reliability runtime | Typed success/error/service channels (Effect<A, E, R>), structured concurrency, interruption, resource safety, Schema, and TestClock |
Vibe (.vibe) | Base language & compiler | Forked TypeScript 7 Go compiler, flat Effect syntax, brand declarations, .d.vibe.ts sidecars, v3 source maps, LSP, formatter, and ESLint/Oxlint/Knip/Vite adapters |
| Your Lang | Domain vocabulary & invariants | Domain nouns, state graphs, policies, compile-time validation, and custom browser playgrounds lowered to typed .vibe |
Every layer compiles down to the layer below it:
- One compiler checks mixed programs:
.vibeand.tsfiles typecheck in a single program and emit ordinary Effect JavaScript, standard v3 source maps, and.d.vibe.tsdeclarations. - Zero runtime reinvention: Your dialect inherits Effect's fiber scheduler, retries, tracing, and durable workflows without maintaining a custom runtime.
- Full escape hatch: Wherever a domain form doesn't fit, write ordinary
.vibeor import an ordinary.tspackage right beside it.
Real languages already built on Vibe
"Vibe your own language" is not theoretical. Real, working domain languages already build on top of Vibe using two complementary mechanisms: line-for-line front-end lowering to .vibe and stackable base primitives such as brand (VIP-83).
1. onto — domain ontology language (smithersai/t3code)
In smithersai/t3code, .onto files declare a product's domain model using seven contextual forms — object, shape, link, lifecycle, action, derive, and event — plus screen and storage bindings, lowering line-for-line to typed .vibe:
// Example .onto declaration lowered to typed .vibe
object Thread {
id: ThreadId
title: string
status: ThreadStatus
}
lifecycle ThreadStatus {
Draft -> Active -> Archived
}
action archiveThread(thread: Thread<Active>) -> Thread<Archived> emits ThreadArchived {
return { ...thread, status: "Archived" }
}Every .onto line lowers to the exact same line number in .vibe, so vibe type errors and exhaustiveness failures point directly back to the .onto declaration.
2. fucorytweetlang — editorial & publishing language (roninjin10/fucorytweetlang)
fucorytweetlang defines .tweet files with six domain forms — voice, thought, rubric, tweet, thread, and schedule — lowered line-for-line into typed .vibe modules. Voice rules, rubric scoring, and thread structure live in one readable spec instead of scattered scripts and prompt templates.
3. Composable Ethereum language stacks (voltairelang -> evmlang -> tevmlang)
Dialects can also stack on top of each other like packages. An Ethereum language tree built on Vibe + brand declarations (VIP-83) layers five focused dialects:
- Base Vibe +
brand(VIP-83): nominal, refined, and global types (Address,Hash,Slot) checked withisnarrowing and zero runtime wrapper overhead. - Crypto primitives (
voltairelang): compile-time validated hex, keccak, ABI, and signature brands. - EVM execution (
evmlang): local sandboxedevmblocks and typed calls. - Protocol & contract imports (
tevmlang): native.sol/.vycontract imports and typed storage reads. - App-specific ontologies (
enslang,erc20lang): protocol-level objects, rules, and queries compiled down to the layers beneath.
Even inside core .vibe today, VIP-83 brand declarations let any project establish nominal and refined domain primitives right away:
export brand Address = string where (s) => /^0x[0-9a-fA-F]{40}$/.test(s)
export brand BasisPoints = number where (n) => Number.isInteger(n) && n >= 0 && n <= 10_000
function feeOf(amount: number, bps: BasisPoints): number {
return Math.round((amount * bps) / 10_000)
}
export function applyFee(rawBps: number, amount: number): number | undefined {
if (rawBps is BasisPoints) {
return feeOf(amount, rawBps)
}
return undefined
}Three ways to build your language on Vibe
Pick the lightest mechanism that enforces your domain's invariants:
Way 1: Model directly in .vibe (available today)
Start with Vibe's built-in brand, schema, data, error, service, match, and experimental task / workflow declarations. Most teams get 80% of the benefit before writing a single line of parser code:
schema LineItem { readonly sku: string; readonly cents: number }
data Order {
Draft { items: readonly LineItem[] }
Paid { items: readonly LineItem[]; chargeId: string }
Shipped { items: readonly LineItem[]; trackingNumber: string }
}
error EmptyOrder {}
error InvalidOrderState { current: Order["_tag"] }
effect function payOrder(order: Order, chargeId: string): Order!(EmptyOrder | InvalidOrderState) {
return match (order) {
when { _tag: "Draft", let items } and if (items.length === 0): throw new EmptyOrder();
when { _tag: "Draft", let items }: Order.Paid({ items, chargeId });
when { _tag: "Paid" or "Shipped", let _tag }: throw new InvalidOrderState({ current: _tag });
}
}Way 2: Write a line-for-line front end that lowers to .vibe (available today; native registration proposed in VIP-84)
Write a small lowering module (in .vibe or .ts) that transforms your domain extension (.onto, .tweet, .evm, .acme) into typed .vibe on the exact line where each declaration started, leaving ordinary expressions untouched.
Because onto and fucorytweetlang both converged on this exact architecture, VIP-84: Project file types (currently open for review) proposes registering custom file extensions directly in tsconfig.json:
{
"vibe": {
"fileTypes": {
".onto": { "lower": "@t3tools/onto/lower" },
".tweet": { "lower": "fucorytweetlang/lower" }
}
}
}Under VIP-84, vibe compiles registered extensions in memory, maps diagnostics and editor hover back to the original file, and passes them through Vite, loaders, and test runners with zero checked-in generated .vibe files. Today, you can run the same lowering function as a build step or CLI (onto compile / fucory build) while VIP-84 is finalized.
Way 3: Extend the Apache-2.0 TypeScript 7 compiler directly (available today)
When your domain requires deep type-checker rules — such as taint analysis across @pii fields, multi-tenant scoping guarantees, or static conservation laws — fork the Apache-2.0 VibeLang compiler (github.com/smithersai/vibelang) and wire all six compiler surfaces together so editors, formatters, and linters stay in lockstep:
| Compiler surface | Responsibility |
|---|---|
Parser (internal/parser/) | Contextual lookahead + AST lowering into TypeScript-shaped nodes + surface-syntax record |
Binder & Checker (internal/vibelang/) | Domain type rules, taint/policy/graph checks, and actionable diagnostics |
Emitter & Declarations (internal/vibelang/) | Ordinary Effect JS + .d.vibe.ts sidecars + accurate v3 source maps |
Formatter & Converter (internal/vibelangfmt/) | Round-trip projection for dprint/Prettier + SameProgram AST equivalence verification |
Lint & Search Adapters (internal/vibelangestree/, --ts-projection, Tree-sitter) | ESLint, Oxlint, Knip, and ast-grep compatibility |
Language Server (internal/ls/) | Hover types, completions, rename, and go-to-definition across custom and .ts files |
You can also ship a customizable browser playground for your dialect on top of Vibe's WASM compiler (cmd/vibelang-wasm) so teammates and users can explore your domain spec interactively in the browser.
What an ontology-based company DSL looks like
Below are three recurring business patterns showing how domain rules move from scattered conventions into concise, spec-like declarations.
1. Multi-tenant authorization, PII boundaries, and mandatory auditing
In plain VibeLang, tenant checks, role checks, audit logging, and PII hygiene are separate imperative statements — easy for an engineer or agent to forget in 1 of 50 endpoints:
// fragment
effect function refundInvoice(req: RefundReq) {
const actor = try Auth.currentActor()
const invoice = try Db.findInvoice(req.invoiceId)
if (invoice.tenantId !== actor.tenantId) throw new Forbidden({ reason: "cross-tenant" })
if (!actor.hasRole("billing.refund")) throw new Forbidden({ reason: "missing-role" })
const receipt = try Payments.refund(invoice.chargeId, req.amount)
try Audit.record({
actorId: actor.id,
tenantId: actor.tenantId,
action: "invoice.refund",
targetId: invoice.id,
})
return { id: receipt.id, amount: receipt.amount }
}In a thin company superset, policy and data classification move into the declaration header while the body stays ordinary VibeLang:
// Illustrative company superset (e.g., AcmeVibe)
entity Invoice scoped by tenant {
id: InvoiceId
chargeId: ChargeId
amount: Cents
@pii customerEmail: string
}
action refundInvoice(invoice: Invoice, amount: Cents)
requires role "billing.refund"
audited as "invoice.refund"
{
// Compile error: @pii field cannot cross an unredacted log sink
// try Console.log(invoice.customerEmail)
return try Payments.refund(invoice.chargeId, amount)
}Every action declares requires (or explicit public) and audited (or explicit unaudited), tenant-scoped loads enforce ownership before the body runs, @pii fields cannot cross unredacted sinks, and .ts / .vibe callers still import refundInvoice as an ordinary typed Effect function.
2. Business entity ontologies and legal state transitions
// Illustrative ontology superset
ontology Order {
state Draft { items: LineItem[] }
state Paid { items: LineItem[]; paidAt: Date; chargeId: ChargeId }
state Shipped { items: LineItem[]; trackingNumber: string }
state Cancelled { reason: string }
transition pay(from Draft -> Paid) when items.length > 0 emits OrderPaid {
const charge = try Payments.charge(items)
return { items, paidAt: try Clock.now(), chargeId: charge.id }
}
transition ship(from Paid -> Shipped, trackingNumber: string) emits OrderShipped {
return { items, trackingNumber }
}
transition cancel(from Draft | Paid -> Cancelled, reason: string) emits OrderCancelled {
return { reason }
}
}Illegal transitions fail at compile time (Expected Order<Paid>, got Order<Draft>), every state carries only its valid payload fields, and a human or coding agent reads 20 lines instead of grepping 8 service modules to see the complete lifecycle of Order.
3. Domain conservation laws and transactional ledgers
// Illustrative fintech superset
ledger entry settlePayout<C: Currency>(idempotencyKey: PayoutId, amount: Money<C>, fee: Money<C>) {
debit MerchantClearing<C> amount
credit MerchantPayable<C> amount - fee
credit PlatformRevenue<C> fee
}Currency homogeneity (C) and ledger balance (amount == (amount - fee) + fee) are checked statically, then lowered into an atomic Effect transaction with idempotency-key enforcement and typed failure channels.
Six rules for designing a great domain language
Our agent and human syntax benchmarks (30 verified Effect 4 programs, 342 live cached-skill trials) uncovered concrete engineering laws for domain extensions that work well for both humans and coding agents:
- Extend declarations and invariants — never expression syntax. Keep function bodies, control flow, and expressions 100% standard VibeLang/TypeScript (
if,for,try,catch,match,{ ... }). In our benchmarks, alien expression syntaxes (vibe-toonindentation blocks andvibe-sexprLisp forms) triggered up to +412.5% more hidden thinking tokens and cut small-model pass@1 from 90.9% to 40.9%. Keeping expressions TypeScript-shaped preserves pretrained model intuition so agents pay zero syntax-translation tax. - Keep every keyword strictly contextual. Follow VibeLang's parser rule: a new declaration keyword (
entity,action,object,lifecycle,tweet,ledger) is recognized only in unambiguous declaration positions (for example, keyword + identifier on the same line, which is always a TypeScript syntax error). Local variables, parameters, and properties with the same names (const action = ...,obj.entity) continue to work untouched. - Lower cleanly to typed
.vibeand Effect primitives. Every domain form should have a clear, inspectable lowering into ordinary Vibe/Effect building blocks (brand,schema,data,error,service,Layer,effect function). You inherit Effect's runtime, keep emitted.jsand.d.vibe.tsreadable, and always keep an escape hatch to.vibeor.ts. - Preserve source positions and make diagnostics actionable and fast. An agent loop improves dramatically when violations fail in ~120 ms at compile time with an exact diagnostic code, source span, and concrete repair message — instead of failing 45 seconds later in an integration test or silently in production.
- Keep the full tooling pipeline intact. Preserve declarations, source maps, formatting, linting, and language-server navigation so adopting your language never strands your team outside the TypeScript ecosystem.
- Promote only stable, high-stakes, repeating invariants to syntax. Start in core
.vibewithbrand,schema,data,error,service, andmatch. Once a pattern repeats across dozens of modules and mistakes carry real correctness, security, or compliance cost, promote it into a domain declaration so the compiler enforces it everywhere automatically.
How to start today
- Start with
.vibeandbrand: Model your domain types and lifecycles withbrand,schema,data,error,service,match, and durable workflows. - Read the project file types proposal: VIP-84: Project file types documents the lowering-module architecture drawn from
ontoandfucorytweetlang. - Pair with human ↔ machine mode: Combine your domain syntax with VibeLang's lossless human ↔ machine representation mode so humans review clean formatted files while agents can work in token-compact syntax without changing a single AST node.
- Need help designing or shipping a domain language? See VibeLang for your team to book a 30-minute technical scoping call.