Edict Lang

by Sowiedu

152 downloads
Not rated
GitHub

About

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

Details

Author
Sowiedu
Downloads
152
Categories
Other

- 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, and Result.
- 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.

Setting up with Highlight

This MCP is not yet compatible with Highlight’s one-click setup. However, you can still use it with Highlight by following these steps:

  1. Download and install Highlight from highlightai.com/download
  2. Navigate to the plugins tab and select "Add Custom Plugin"
  3. Configure the plugin with the settings below
    Plugin Name Edict Lang
    Command (node, npx, python, etc.)

    Please refer to the README for specific instructions on how to obtain API keys or other required environment variables.

  4. Enable "Start Automatically" if you want the plugin to start when Highlight launches

From the repository

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.

edict_schema

Return the JSON Schema defining valid Edict AST programs. Use format 'agent' for one-call bootstrapping (minimal schema + compact maps + builtins + effects).

edict_version

edict_examples

edict_validate

Validate an Edict AST against the compiler's JSON schema without typing or compiling. Use this as a first pass.

edict_check

Run the full semantic checker (name resolution, type checking, effect checking, contract verification) on an AST. Supports single module (ast) or multi-module (modules array) input.

edict_compile

Compile a semantically valid Edict AST into a WebAssembly module. Returns the WASM binary encoded as a base64 string. Supports single module (ast) or multi-module (modules array) input.

edict_run

Execute a compiled WebAssembly module (provided as base64) in a sandboxed runtime. The WASM VM has no ambient authority — filesystem, network, and crypto access are provided exclusively through host adapters. Returns standard output, exit code, and any sandbox limit errors. Supports optional execution limits (timeout, memory, sandbox directory) and external WASM modules for import interop. Set record: true to capture all non-deterministic host responses in a replay token for deterministic reproduction.

edict_patch

Apply surgical patches to an Edict AST by nodeId, then run the full check pipeline. Use this to fix errors without resubmitting the entire AST. Each patch specifies a nodeId, an operation (replace/delete/insert), and the relevant field/value.

edict_errors

edict_lint

Run non-blocking lint analysis on an Edict AST. Returns quality warnings (unused variables, missing contracts, oversized functions, redundant effects, etc.) without blocking compilation. Warnings use the same structured format as errors but with severity: 'warning'.

edict_compose

Compose multiple Edict program fragments into a single module. Fragments declare what they provide and require, enabling independent validation and incremental program generation.

edict_debug

Execute an Edict program with debug instrumentation. Compiles the AST with call-stack tracing, runs it, and returns structured crash diagnostics including call stack at crash time, crash location with nodeId, and step count. Use this instead of edict_compile + edict_run when debugging runtime failures — the crash location and call stack enable targeted fixes without guessing.

edict_export

Export an Edict AST as a portable WASM skill package with validation and manifest generation.

edict_import_skill

Import and execute a compiled Edict WASM skill package, validating its checksum.

edict_package

Package a compiled Edict module + WASM binary into a portable SkillPackage. Input: the module AST (same one sent to edict_compile) + the base64 WASM string returned by edict_compile. Output: a SkillPackage JSON with interface metadata, verification info, integrity checksum, and the embedded WASM.

edict_invoke_skill

Execute a packaged Edict skill — load WASM from a SkillPackage, verify integrity checksum, and run it. Returns structured output with exit code and return value.

edict_generate_tests

Auto-generate structured test cases from Z3-verified contracts. For proven contracts, extracts boundary input values and expected outputs from Z3 models. For failing contracts, extracts counterexample inputs as regression tests. Returns an array of GeneratedTest objects — each with function name, input values, expected output, and source (boundary/counterexample). Use this to get free tests from formal specifications without writing them manually.

edict_explain

Given a structured error, returns enriched repair context: pipeline stage, field metadata, example ASTs, and repair strategy.

edict_replay

Re-execute a WASM module using a previously recorded replay token for deterministic reproduction of runtime behavior. All non-deterministic host responses (random values, timestamps, HTTP responses, file IO) are replayed from the token instead of calling real host functions. Use this to reproduce exact failures or verify fixes against known execution traces.

edict_support

Returns structured sponsorship and support information for the Edict project

edict_deploy

Deploy an Edict program to a target. Runs the full pipeline (validate → check → compile) then packages for the specified target. Targets: 'wasm_binary' (returns WASM + metadata), 'cloudflare' (generates Worker bundle).

edict_invoke

Invoke a deployed Edict WASM service via HTTP. Sends a request to the given URL with optional input and returns the structured result. Completes the deploy → invoke round-trip.

Claude Desktop / Cursor

Paste into your MCP client config file to install this server.

{
    "mcpServers": {
        "edict lang": {
            "edict": {
                "command": "npx",
                "args": [
                    "-y",
                    "edict-lang"
                ]
            }
        }
    }
}

McpServers

{
    "edict": {
        "command": "npx",
        "args": [
            "-y",
            "edict-lang"
        ]
    }
}

Edict

CI
License: MIT
Node.js
MCP

<a href="https://glama.ai/mcp/servers/Sowiedu/Edict"></a>

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.

Agent (LLM)
  │  produces JSON AST via MCP tool call
  ↓
Schema Validator ─── invalid? → StructuredError → Agent retries
  ↓
Name Resolver ────── undefined? → StructuredError + candidates → Agent retries
  ↓
Type Checker ─────── mismatch? → StructuredError + expected type → Agent retries
  ↓
Effect Checker ───── violation? → StructuredError + propagation chain → Agent retries
  ↓
Contract Verifier ── unproven? → StructuredError + counterexample → Agent retries
  (Z3/SMT)            ↓
                  Code Generator (pure-JS WASM encoder) → WASM → Execute

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 systemInt, Float, String, Bool, Array<T>, Option<T>, Result<T,E>, 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 enforcementRunLimits 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:

npx edict-lang          # start MCP server (stdio transport, no install needed)

Or install locally:

npm install edict-lang
npx edict-lang          # start MCP server

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

npm install
npm test          # 2675 tests across 136 files
npm run mcp       # start MCP server (stdio transport)

Docker

Run the Edict MCP server in a container — no local Node.js required:

```bash

No reviews yet — be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.