Edict Lang
@Sowiedu
Agent-first programming language designed exclusively for AI agents. Programs are JSON ASTs — no text syntax, no parser. The compiler validates structure, resolves names, checks types and effects, verifies contracts via Z3/SMT, and compiles to WebAssembly. 19 MCP tools cover the
Overview
What is Edict Lang?
Edict Lang is a statically-typed, effect-tracked programming language purpose-built for AI agents. Its canonical program format is a JSON AST—no text parsing, no human-readable syntax. The language integrates with the Model Context Protocol (MCP) to provide a structured compiler pipeline (validation, type checking, effect tracking, contract verification with Z3, and WebAssembly compilation) directly as tool calls for agents.
How to use Edict Lang?
The fastest way is to start the MCP server via npx edict-lang (no install needed) or install the package locally. Agents then interact through MCP tools such as edict_schema (to learn the AST format) and edict_check (to submit a program). The compiler can also be used in the browser or inside QuickJS for sandboxed environments.
Key features of Edict Lang
- Programs are JSON objects—no lexer or parser required.
- Structured errors returned as typed JSON with self-repair context.
- Rich type system including refinement types,
Option, andResult. - Effect tracking: functions declare
pure,reads,writes,io,fails. - Compile-time contract verification via Z3/SMT with concrete counterexamples.
- Verified programs compile to WebAssembly for sandboxed execution.
Use cases of Edict Lang
- AI agents that generate, verify, and execute code autonomously.
- Running untrusted code in a sandboxed WASM environment with no ambient authority.
- Building deterministic, replayable execution pipelines for testing or auditing.
- Deploying verified programs to edge runtimes (e.g., Cloudflare Workers).
FAQ from Edict Lang
What is the canonical program format?
Edict Lang programs are JSON ASTs. The compiler never parses text; agents produce the AST directly via MCP tool calls.
How does Edict Lang enforce safety?
The effect system (io, reads, writes, fails) lets the host inspect a program’s capabilities before execution. Compilation targets WebAssembly, which runs in a sandboxed VM with no ambient authority. Runtime limits (timeout, memory, filesystem) are enforced by the host adapter.
Can I run Edict Lang in the browser?
Yes. The compiler is available as an ESM bundle (edict-lang/browser for checking, edict-lang/browser-full for full compile-and-run). No server needed beyond a static HTTP server for ESM modules.
What transports does the MCP server support?
The MCP server supports stdio transport by default and HTTP transport when run with EDICT_TRANSPORT=http. Docker images are available for both modes.
Does Edict Lang support contract verification?
Yes. Pre‑ and post‑conditions are verified at compile time using Z3 via SMT. Failing contracts return structured errors with concrete counterexamples, enabling agents to self‑repair.