Mog
by Voltropy
A statically typed embeddable language whose whole spec fits in an LLM's context window
Mog is a small, statically typed, compiled language designed to be written by AI agents rather than humans. Its complete specification fits in roughly 3,200 tokens, so a model can generate a correct program without retrieval or few-shot examples, and a host capability model lets the calling agent gate every side effect the generated code attempts.
Mog is a small, statically typed, compiled and embeddable programming language with an unusual design goal: it is meant to be written by large language models rather than by people. Its full specification fits in roughly 3,200 tokens, so an agent can hold the entire language in context and emit a correct program without retrieval or few-shot prompting. Its creator, who posts as belisarius222, describes it as a statically typed Lua with async I/O and a capability model where the host controls all side effects. The compiler is roughly 15,000 lines of Rust and the runtime roughly 6,000, with C FFI bindings for embedding into a host application. The language deliberately removes constructs that raise model error rates: there is no operator precedence, so non-associative operations must be parenthesised, and there is no implicit type coercion, with conversions requiring an explicit as keyword. It provides scalars including explicit-width integers, compound types covering arrays, maps, structs and tensors, closures and higher-order functions, Result and Optional error types, and async/await implemented through LLVM coroutine lowering. Safety comes from the capability system: functions declare what they need using requires and optional, built-in capabilities cover the file system and process environment, and hosts can define custom capabilities through .mogdecl files. That lets an agent apply the same permission predicate to code a plugin emits, including bash commands, that it applies to the model's own direct tool calls. The runtime adds memory and CPU-time limits, stack-overflow protection and an interrupt mechanism. Mog is MIT licensed and built from source with Cargo. It is explicitly not intended for systems programming or standalone applications and has no threads, generics, macros, inheritance, raw pointers or manual memory management.
A platform or agent-infrastructure team that already lets LLM-generated code execute inside its product and needs the host, not the model, to hold the permission boundary.
Untrusted agent-authored plugins run natively at compiled speed while every file, process and shell side effect is declared up front and enforced by the embedding host.
At a Glance
- Category
- Agent Development
- Pricing
- Free
- Target Market
- CTOs, Platform Engineers, Enterprise Developers, AI Infrastructure Teams
- Deployment
- Open-source, Self-hosted
Key Features
- ✓3,200-token specification
The entire language definition fits in a model's context window, so agents generate valid code without retrieval, fine-tuning or few-shot examples.
- ✓Host-controlled capability model
Functions declare requires and optional capabilities; the embedding host grants or denies fs, process and custom capabilities defined in .mogdecl files.
- ✓Static typing with no implicit coercion
Conversions need an explicit as keyword, removing a class of silent runtime bugs that LLM-generated code commonly introduces.
- ✓No operator precedence
Non-associative operations must be parenthesised, eliminating precedence mistakes at the cost of fighting the parenthesis-free style models were trained on.
- ✓Async I/O via LLVM coroutines
Concurrent operations use async/await lowered through LLVM coroutines, so scripts do real network and file work without blocking the host.
- ✓Rust compiler and runtime with C FFI
A 15K-line Rust compiler and 6K-line runtime embed into host applications through a formal C FFI, with resource limits and stack-overflow protection.
- ✓Runtime resource ceilings and interrupts
Memory caps, CPU-time budgets and an interrupt system let a host kill a runaway agent-authored script without taking down the process.
Capabilities
Use Cases
- •Sandboxed agent tool-use scripts
An agent writes a Mog script to chain several tool calls, and the host grants only the file paths that task legitimately needs.
- •Dynamically loaded plugins
Compile and hot-load model-authored plugins into a running product without spawning a container or trusting the code that arrived.
- •Gating shell access from generated code
The host inspects every bash command the Mog script emits using the same predicate applied to the model's direct bash tool.
- •Replacing brittle bash glue in agent pipelines
Move multi-step automation from untyped shell scripts to a compiled language that surfaces type errors before anything executes.
- •Embedded scripting for Rust applications
Add a user-scriptable extension layer to a Rust service where every extension's side effects are declared and auditable.
Ideal For
Best For
- ✓Embedding a sandboxed scripting layer inside an agent product so LLM-written plugins cannot touch the file system or shell without a declared capability
- ✓Replacing ad-hoc bash tool-use scripts with a compiled, statically typed target that fails at compile time rather than at runtime in production
- ✓Plugin and extension systems where third-party or model-authored code must be loaded dynamically and run without a container per invocation
- ✓Short automation scripts inside a Rust host application that need async I/O with enforced memory and CPU-time ceilings
Not Ideal For
- ✗Teams that want their agents writing code the model already knows well — Mog has almost no presence in training data, and HN commenters argued LLMs measurably underperform on languages without large public corpora
- ✗Anyone needing production tooling today: there is no LSP, no IDE integration, no GitHub syntax highlighting and no dependency manager
- ✗Systems programming, standalone applications or anything requiring threads, generics, macros or manual memory management — the README rules all of these out by design
- ✗Shops already satisfied by sandboxed TypeScript on Deno, WebAssembly or Starlark, which deliver similar isolation with years of hardening behind them
Integrations
Deployment
Market Analysis
Pros
- ✓Genuinely novel premise — designing the language around the generator rather than the reader is a real answer to LLM code-generation error rates
- ✓Capability model puts the trust boundary in the host, which is where an agent platform actually needs it
- ✓Small, readable implementation: ~15K lines of Rust compiler and ~6K of runtime, MIT licensed and auditable in an afternoon
- ✓Drew 163 points and 83 comments on Hacker News, so the design has had real practitioner scrutiny
Cons
- ✗No training-data corpus exists for Mog; HN commenters argued directly that LLMs perform measurably worse on languages absent from their training data, which undercuts the core premise
- ✗Requiring explicit parentheses fights model priors — as one commenter put it, almost all code LLMs trained on uses operator precedence
- ✗Ecosystem is bare: no LSP, no IDE integration, no GitHub syntax highlighting and no dependency management
- ✗Commenters questioned the advantage over Deno-sandboxed TypeScript, WebAssembly or Gleam, which offer comparable safety with years of hardening
- ✗Another argued the agent ecosystem is already coupled to bash and needs a glue language, not a real programming language
- ✗Single-maintainer project at 140 stars with no published versioned releases — the roadmap still lists replacing external assemblers and linkers with direct machine-code emission
Pricing
Open source (MIT)
$0
- ✓Full compiler and runtime source on GitHub
- ✓MIT licence with no commercial restrictions
- ✓Build from source with Cargo
- ✓C FFI host embedding API
- ✓Capability system and .mogdecl host declarations
Entirely free and MIT licensed with no hosted service, no paid tier and no vendor behind a paywall; the only cost is engineering time to build from source with Cargo, embed the C FFI runtime, and carry a language your team will find no Stack Overflow answers or hiring pool for.
Security & Compliance
Connect
Sources
This page was written from 5 sources, 4 on domains other than moglang.org.
Stay Ahead of the Curve
Weekly enterprise AI insights for technology leaders. No spam, no vendor pitches—unsubscribe anytime.
SubscribeRelated Products
Kitesurf
An agent-first browser that runs in V8 isolates on Cloudflare Workers
Natural
Payments infrastructure that lets AI agents hold, send and collect money
AgentPrizm
Governed, persistent memory and reusable skills for AI agents — over REST API and MCP
Bespoke Labs
Reinforcement-learning environments that train reliable, production-ready AI agents