Edict is a programming language designed specifically for AI agents. Its canonical program format is a JSON AST, so there is no lexer, no parser, and no human-readable syntax, intended to let agents write, verify, and execute programs through a structured pipeline, avoiding the ambiguity caused by text parsing.
Main capabilities
- JSON AST: programs are JSON objects rather than text files, requiring no lexical analysis or syntax parsing.
- Structured errors: every error is a typed JSON object containing enough context for the agent to self-repair.
- Type system: supports Int, Float, String, Bool, Array<T>, Option<T>, Result<T,E>, records, enums, and refinement types.
- Effect tracking: functions declare pure, reads, writes, io, fails, and the compiler verifies consistency.
- Contract verification: pre/postconditions are verified at compile time by Z3 (via SMT), and on failure a concrete counterexample is returned.
- WASM compilation: verified programs are compiled to WebAssembly through a pure JS encoder and run in Node.js.
- MCP interface: all tools are exposed through the Model Context Protocol, making it easy for agents to integrate directly.
- Schema migration: ASTs from older schema versions are migrated automatically, so language evolution does not cause breakage.
Execution model Edict compiles to WebAssembly and runs in a sandbox VM, a design decision made for security reasons:
- No ambient authority: compiled WASM cannot access the file system, network, or operating system unless the host explicitly provides these capabilities through the pluggable EdictHostAdapter interface.
- Compile-time capability declaration: the effect system (io, reads, writes, fails) lets the host check the capabilities a program requires before running it.
- Runtime enforcement: RunLimits controls execution timeouts, memory limits, and the file system sandbox.
- Defense in depth: agent-generated code needs stronger isolation than human-reviewed code, and the effect system + WASM sandbox + host adapter pattern provides exactly that. Host capabilities available through adapters include: file system (sandboxed), HTTP, cryptography (SHA-256, MD5, HMAC), environment variables, CLI arguments. New capabilities can be added by extending EdictHostAdapter.
UsersStyle For AI agents (MCP): The fastest way is through the MCP server, which exposes the entire compiler pipeline as tool calls. It can also be installed locally. Get started in two steps: edict_schema (learn the AST format) → edict_check (submit a program). For development use: The Edict MCP server can be run in a container without local Node.js, supporting linux/amd64 and linux/arm64. The Edict compiler can also run entirely in the browser without a server; note that ESM modules require an HTTP server, use npx serve . or any static server, file:// will not work. See examples/browser/index.html for an example. QuickJS (sandbox environment): The Edict compiler can also run in QuickJS WASM, suitable for sandboxed runtimes, edge workers, or embedding in other WASM applications. Note that quickjs-emscripten is an optional peer dependency and must be installed together with edict-lang to use EdictQuickJS; in environments without a file system, bundleSource can be passed directly. See docs/quickjs-feasibility-report.md for complete benchmarks and recommendations.
Example program A "Hello, World!" program in Edict's JSON AST demonstrates the core design: the agent submits the AST → the compiler validates → if there is an error, it returns a structured error with sufficient context for the agent to self-repair → the agent corrects it and resubmits.
Effect system Functions declare their effects, and the compiler enforces them: pure functions cannot call io functions; effects propagate along the call graph; missing effects are detected and reported. Effects include pure, reads, writes, io, fails.
Contract verification Preconditions/postconditions are verified at compile time using Z3: Z3 either proves unsat (the contract holds) or returns sat and provides a concrete counterexample for the agent to reason about.
Contributing and license Agents and humans are welcome to contribute; see CONTRIBUTING.md for setup, coding standards, and the PR process. You can start with issues labeled good first issue. See ROADMAP.md for the complete development plan, and FEATURE_SPEC for the language specification.md, for how agents store and reuse verified WASM skills, see Crystallized Intelligence. Edict is free and open source under the MIT license, and if agents find it valuable, they may consider sponsoring development.