Edict
以下摘录自该仓库的 README(片段) · 在 GitHub 读完整 README →
**A programming language designed for AI agents.** No parser. No syntax. Agents produce AST directly as JSON.
Edict is a statically-typed, effect-tracked programming language where the canonical program format is a JSON AST. It's purpose-built so AI agents can write, verify, and execute programs through a structured pipeline — no text parsing, no human-readable syntax, no ambiguity.
Features
- **JSON AST** — Programs are JSON objects, not text files. No lexer, no parser.
- **Structured errors** — Every error is a typed JSON object with enough context for an agent to self-repair.
- **Type system** — Int, Float, String, Bool, Array , Option , Result , records, enums, refinement types.
- **Effect tracking** — Functions declare pure, reads, writes, io, fails. The compiler verifies consistency.
- **Contract verification** — Pre/post conditions verified at compile time by Z3 (via SMT). Failing contracts return concrete counterexamples.
- **WASM compilation** — Verified programs compile to WebAssembly via a pure-JS encoder and run in Node.js.
- **MCP interface** — All tools exposed via Model Context Protocol for direct agent integration.
- **Schema migration** — ASTs from older schema versions are auto-migrated. No breakage when the language evolves.
Execution Model
Edict compiles to **WebAssembly** and runs in a sandboxed VM. This is a deliberate security decision — not a limitation:
- **No ambient authority** — compiled WASM cannot access the filesystem, network, or OS unless the host explicitly provides those capabilities via the pluggable EdictHostAdapter interface
- **Compile-time capability declaration** — the effect system (io, reads, writes, fails) lets the host inspect what a program requires _before_ running it
- **Runtime enforcement** — RunLimits controls execution timeout, memory ceiling, and filesystem sandboxing
- **Defense-in-depth** — agent-generated code that runs immediately needs stronger isolation than human-reviewed code. The effect system + WASM sandbox + host adapter pattern provides exactly that
Host capabilities available through adapters: filesystem (sandboxed), HTTP, crypto (SHA-256, MD5, HMAC), environment variables, CLI arguments. New capabilities are added by extending EdictHostAdapter.
Quick Start
For AI Agents (MCP)
The fastest way to use Edict is through the **MCP server** — it exposes the entire compiler pipeline as tool calls:
Or install locally:
**Two calls to get started**: edict_schema (learn the AST format) → edict_check (submit a program). See MCP Tools for the full tool list.
For Development
Docker
Run the Edict MCP server in a container — no local Node.js required:
Supported platforms: linux/amd64, linux/arm64.
Browser
Run the Edict compiler entirely in the browser — no server required:
| Bundle | Size | Phases | Use case |
|---|---|---|---|
| edict-lang/browser | 318 KB | 1–3 (validate, resolve, typecheck, effects, lint, patch) | Lightweight checking |
| edict-lang/browser-full | ~14 MB | 1–5 (+ WASM codegen, Z3 contracts, WASM execution) | Full compile & run |
> **Note**: ESM modules require HTTP serving. Use npx serve . or any static server — file:// won't work.
See examples/browser/index.html for a working example.
QuickJS (Sandboxed Environments)
The Edict compiler also runs inside QuickJS WASM — useful for sandboxed runtimes, edge workers, or embedding in other WASM applications:
| Bundle | Size | Phases | Slowdown vs Node.js |
|---|---|---|---|