Zerolang — The Graph-Native Programming Language for AI Agents
Zerolang — The Graph-Native Programming Language for AI Agents
AI agents write code today the same way humans do: by generating text files and running them through a compiler. But text lines are a terrible interface for machines. A single misplaced character sends the agent back to the drawing board. What if instead of text, the program was a graph — a semantic database that agents can query, inspect, and patch directly?
Zerolang (by Vercel Labs) is an experimental answer to that question. It's a graph-native programming language where the semantic graph is the program database. Humans ask for outcomes. Agents query the graph, submit checked edits, and prove the result — without guessing at line numbers or text structure.
Why It's Trending
Zerolang hit 5,000+ GitHub stars within two weeks of its public release. The AI agent ecosystem is hungry for better tools, and Zerolang's graph-first approach addresses three fundamental pain points:
- Stale context — Agents re-read entire files when a single node changes
- Random errors — Text patching produces syntax errors from trivial mistakes
- No semantic structure — Line ranges carry no meaning about what changed
By making the graph the source of truth, Zerolang gives agents explicit handles: symbols, node IDs, graph hashes, types, effects, ownership facts, and call edges. Every edit is checked against the graph before it's stored.
Architecture Overview
The architecture follows a clean four-layer pipeline:
User Layer — A developer + AI agent initiates a request (e.g., "build a calculator"). The agent doesn't write text files — it issues graph queries and patch commands.
CLI Layer — The zero CLI is the agent's interface. Commands like zero query inspect the graph, zero patch submits checked edits, and zero run executes programs with full capability sandboxing.
Core Layer — Three interconnected components form the engine:
- zero.graph — The semantic graph database. This is the single source of truth. Every node, edge, type, and hash is stored here.
- Compiler — Parses, type-checks, and validates patches against the graph. Stale hashes, invalid shapes, and type errors fail before any data is written.
- Runtime — Token-efficient execution with explicit capability checks, fast startup, and low memory usage.
Output Layer — Human-readable .0 projection files (text) let humans review and occasionally edit. Compiled binaries are standalone executables tested via zero test.
Prerequisites
- Linux, macOS, or Windows
- curl (for installation)
- An AI agent (Claude, Codex, etc.) to interact with Zerolang — though you can use the CLI directly too
Installation
Zerolang provides a single-command installer:
curl -fsSL https://zerolang.ai/install.sh | bash
export PATH="$HOME/.zero/bin:$PATH"
zero --version
On our test system (Linux x86_64), this installed zero 0.3.2 cleanly.
Agent Skill Setup
If you're using an AI agent, install the bootstrap skill:
npx skills add vercel-labs/zerolang
Then load the compiler's bundled skills:
zero skills
zero skills get agent
zero skills get graph
zero skills get language
zero skills get stdlib
Getting Started: Hello World
Zerolang's workflow is completely different from traditional programming. You don't write a file — you initialize a graph project and submit patches.
mkdir hello-zero && cd hello-zero
zero init
This creates zero.toml (package config) and zero.graph (the graph database).
Step 1: Add a Main Function
zero patch --op 'addMain'
This adds a main function node to the graph. Query the graph to confirm:
zero query
You'll see the function listed under functions: main.
Step 2: Add Output
zero patch --op 'addCheckWrite fn="main" text="hello from zero\n"'
Step 3: Run
zero run
You won't see visible output because the runtime writes to world.out (which defaults to /dev/null in headless mode). Let's make it interactive:
Step 4: Replace with a Greeting
zero patch --op 'replaceFunctionBody main
let name Maybe<String> = std.args.get 1
if name.has
check world.out.write "hello "
check world.out.write name.value
check world.out.write "\n"
else
check world.out.write "hello anonymous\n"
end'
Now run with and without an argument:
zero run -- "World"
# Output: hello World
zero run
# Output: hello anonymous
Building a Math Function with Tests
Zerolang supports modular functions and built-in testing:
mkdir zero-math && cd zero-math
zero init
Add an add function:
zero patch --op 'addFunction name="add" ret="i32"' \
--op 'addParam fn="add" name="left" type="i32"' \
--op 'addParam fn="add" name="right" type="i32"' \
--op 'addReturnBinary fn="add" name="+" left="left" right="right" type="i32"'
Add a test:
zero patch --op 'addTest name="addition works" call="add" arg0="40" arg1="2" expect="42" type="i32"'
Run tests:
zero test
# Output: 1 test(s) ok
The Daily Loop
Zerolang's development cycle is designed for agents, not text editors:
# Inspect the current graph state
zero query
# See available patch operations
zero patch --op help
# Check for errors
zero check
# Run tests
zero test
# Execute
zero run -- <args>
# Export human-readable projection
zero export
When a human wants to review the program:
zero export
# Reads as: pub fn main(world: World) -> Void raises { ... }
When a human edits a projection file manually:
zero import
zero check
Key Concepts
Graph-First Model
Traditional programming: Text → Parse → AST → Compile → Run
Zerolang programming: Graph Query → Patch → Validate → Store → Execute
The graph is never "compiled from text" — it is the program. Text projections are read-only views that can be verified against the graph.
Capability Safety
Every runtime operation is gated by explicit capabilities. The world.out.write call, for example, requires write access. Capabilities are declared in the graph, not inferred from imports. This makes Zerolang naturally sandboxed — an agent can't accidentally write to your filesystem.
Token Efficiency
Because agents query the graph by ID and hash rather than by reading text files, Zerolang drastically reduces token consumption. A graph query on a medium-sized project is a few hundred tokens. Reading the equivalent text files would be thousands.
Verification Checklist
Before deploying a Zerolang program:
zero checkpasses without errorszero testpasses all tests- Graph hash is stable (compare
zero queryoutput before and after) - Capability requests match what the runtime actually needs
- Projection exports render correctly (
zero exportthen review.0files)
Use Cases
- Agent-native development — Build tools where agents create and modify programs without touching text files
- Sandboxed execution — Run user-submitted code with explicit capability boundaries
- Self-modifying systems — Programs that can safely inspect and patch their own graph
Resources
- Website: zerolang.ai
- GitHub: github.com/vercel-labs/zerolang
- Install Guide: zerolang.ai/install.sh
- Documentation: zerolang.ai/docs
- Vercel Labs: github.com/vercel-labs