Mog is a statically typed, compiled language designed for AI agents to safely modify themselves. It enables agents to write, compile, and dynamically load plugins with capability-based permissions, providing both performance and security for extending agent functionality.
Mog: A Programming Language for AI Agents
Overview
Mog is a statically typed, compiled, embedded language designed specifically for AI agents to modify themselves quickly, easily, and safely. The full specification fits in just 3200 tokens, making it ideal for LLM-generated code. An AI agent writes a Mog program, compiles it, and dynamically loads it as a plugin, script, or hook within the host environment.
Key Features
Performance and Safety
- Compiled to native code for low-latency plugin execution with no interpreter overhead
- Capability-based permissions - the host controls exactly which functions a Mog program can call
- Safe Rust compiler - the entire toolchain can be audited for security
- No process startup cost - plugins load directly into the running agent
Language Design
- Statically typed with no implicit coercion
- No operator precedence - all binary operators are flat, requiring explicit grouping
- No exceptions - errors use Result and the ? propagation operator
- No raw pointers or manual memory management - all memory is garbage-collected
- No standalone execution - Mog scripts run inside a host application
AI Agent Integration
- Self-modification - agents can write and load their own code at runtime
- Hot-swappable plugins - compile .mog files into shared libraries for dynamic loading
- Async/await support for non-blocking operations
- Tensor support for ML workloads with n-dimensional arrays
How Mog Works
Basic Workflow
- An AI agent generates Mog source code
- The code is compiled to native machine code
- The compiled code is dynamically loaded as a plugin
- The host controls execution through capability permissions
- The agent can now execute the new functionality
Capability System
Mog's security model is built on capabilities:
- Scripts declare required capabilities with
requires fs, process; - Optional capabilities can be declared with
optional log; - The host provides implementations for these capabilities
- Scripts can only perform operations explicitly permitted by the host
Comments
Please log in or register to join the discussion