frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

Open in hackernews

Show HN: The Mog Programming Language

https://moglang.org
63•belisarius222•2h ago
Hi, Ted here, creator of Mog.

- Mog is a statically typed, compiled, embedded language (think statically typed Lua) designed to be written by LLMs -- the full spec fits in 3,200 tokens. - An AI agent writes a Mog program, compiles it, and dynamically loads it as a plugin, script, or hook. - The host controls exactly which functions a Mog program can call (capability-based permissions), so permissions propagate from agent to agent-written code. - Compiled to native code for low-latency plugin execution -- no interpreter overhead, no JIT, no process startup cost. - The compiler is written in safe Rust so the entire toolchain can be audited for security. Even without a full security audit, Mog is already useful for agents extending themselves with their own code. - MIT licensed, contributions welcome.

Motivations for Mog:

1. Syntax Only an AI Could Love: Mog is written for AIs to write, so the spec fits easily in context (~3200 tokens), and it's intended to minimize foot-guns to lower the error rate when generating Mog code. This is why Mog has no operator precedence: non-associative operations have to use parentheses, e.g. (a + b) * c. It's also why there's no implicit type coercion, which I've found over the decades to be an annoying source of runtime bugs. There's also less support in Mog for generics, and there's absolutely no support for metaprogramming, macros, or syntactic abstraction.

When asking people to write code in a language, these restrictions could be onerous. But LLMs don't care, and the less expressivity you trust them with, the better.

2. Capabilities-Based Permissionsl: There's a paradox with existing security models for AI agents. If you give an agent like OpenClaw unfettered access to your data, that's insecure and you'll get pwned. But if you sandbox it, it can't do most of what you want. Worse, if you run scripts the agent wrote, those scripts don't inherit the permissions that constrain the agent's own bash tool calls, which leads to pwnage and other chaos. And that's not even assuming you run one of the many OpenClaw plugins with malware.

Mog tries to solve this by taking inspiration from embedded languages. It compiles all the way to machine code, ahead of time, but the compiler doesn't output any dangerous code (at least it shouldn't -- Mog is quite new, so that could still be buggy). This allows a host program, such as an AI agent, to generate Mog source code, compile it, and load it into itself using dlopen(), while maintaining security guarantees.

The main trick is that a Mog program on its own can't do much. It has no direct access to syscalls, libc, or memory. It can basically call functions, do heap allocations (but only within the arena the host gives it), and return something. If the host wants the Mog program to be able to do I/O, it has to supply the functions that the Mog program will call. A core invariant is that a Mog program should never be able to crash the host program, corrupt its state, or consume more resources than the host allows.

This allows the host to inspect the arguments to any potentially dangerous operation that the Mog program attempts, since it's code that runs in the host. For example, a host agent could give a Mog program a function to run a bash command, then enforce its own session-level permissions on that command, even though the command was dynamically generated by a plugin that was written without prior knowledge of those permission settings.

(There are a couple other tricks that PL people might find interesting. One is that the host can limit the execution time of the guest program. It does this using cooperative interrupt polling, i.e. the compiler inserts runtime checks that check if the host has asked the guest to stop. This causes a roughly 10% drop in performance on extremely tight loops, which are the worst case. It could almost certainly be optimized.)

3. Self Modification Without Restart: When I try to modify my OpenClaw from my phone, I have to restart the whole agent. Mog fixes this: an agent can compile and run new plugins without interrupting a session, which makes it dynamically responsive to user feedback (e.g., you tell it to always ask you before deleting a file and without any interruption it compiles and loads the code to... actually do that).

Async support is built into the language, by adapting LLVM's coroutine lowering to our Rust port of the QBE compiler, which is what Mog uses for compilation. The Mog host library can be slotted into an async event loop (tested with Bun), so Mog async calls get scheduled seamlessly by the agent's event loop. Another trick is that the Mog program uses a stack inside the memory arena that the host provides for it to run in, rather than the system stack. The system tracks a guard page between the stack and heap. This design prevents stack overflow without runtime overhead.

Lots of work still needs to be done to make Mog a "batteries-included" experience like Python. Most of that work involves fleshing out a standard library to include things like JSON, CSV, Sqlite, and HTTP. One high-impact addition would be an `llm` library that allows the guest to make LLM calls through the agent, which should support multiple models and token budgeting, so the host could prevent the plugin from burning too many tokens.

I suspect we'll also want to do more work to make the program lifecycle operations more ergonomic. And finally, there should be a more fully featured library for integrating a Mog host into an AI agent like OpenClaw or OpenAI's Codex CLI.

Comments

shablulman•2h ago
[flagged]
dang•1h ago
If you keep running these bots we will ban your main account as well. Please stop now.

https://news.ycombinator.com/newsguidelines.html#generated

ar_lan•2h ago
Wow, we've brought mogging to the programming world. Nothing is safe from looksmaxxing it seems.
steve_adams_86•2h ago
I like the looks of this, and the idea behind it, but TypeScriot via Deno is an audited language with a good security model, a good type system, and sandboxing in an extremely well-hardened runtime. It's also a language that LLMs are exceptionally well-trained on. What does Mog offer that's meaningfully superior in an agent context?

I see that Deno requires a subprocess which introduces some overhead, and I might be naive to think so, but that doesn't seem like it would matter much when agent round-trip and inference time is way, way longer than any inefficiency a subprocess would introduce. (edit: I realized in some cases the round-trip time may be negligible if the agent is local, but inference is still very slow)

I admittedly do prefer the syntax here, but I'm more so asking these questions from a point of pragmatism over idealism. I already use Deno because it's convenient, practical, and efficient rather than ideal.

andreybaskov•1h ago
It's a legitimate question to ask about any new language post AI - given there is no training dataset, any other language would work better with AI.

The bigger problem is maintainability over the long term, Deno is built by Node.js creator and is maintained for half a decade now, that's hard to compete with. In a way it's much more about social trust rather than particular syntax.

embedding-shape•47m ago
> given there is no training dataset, any other language would work better with AI.

I guess it depends on what "would work better" really means, but I don't think it's always a given. I've made my own languages, there is no available training set on exactly those, but AI with a prompt can figure out how to effectively use them as much as any other language, it seems to me. I guess it helps that most languages are more similar to each other than different, but even experimenting with new syntax seems to work out OK for me.

verdverm•10m ago
I'd also add all the other things that users expect around a language:

- GitHub syntax highlighting

- IDE integrations, LSP

- Modules and dependency management

I don't see an agent first language becoming a thing while humans are still ultimately responsible.

castral•1h ago
I agree with this take. What does this bring to the table that can't be done with pretty much any preexisting toolset? Hell, even bash and chroot jail...
stillpointlab•1h ago
One thing that comes to mind, more of a first reaction than a considered opinion, is the complexity of V8 getting in the way. JavaScript and Typescript present a challenge to language implementors.

There is something to be said about giving AIs a clean foundation on which to build their own language. This allows evolution of such systems to go all the way into the compiler, beyond tooling.

0cf8612b2e1e•48m ago
I cannot comment on the new language, but Typescript is a huge spec. Yes, it has guardrails, but there is a lot of complexity to handle.

Something purpose built to enable embedding allows it to be used in more contexts. Maybe I want a Mog plugin for my latest video game. Embedding JS is possible, but no fun.

belisarius222•34m ago
I generally agree. TypeScript is a great language, and JS runtimes have certainly had a lot of money and effort poured into them for a long time. I would add WASM to this category, as probably the closest thing to Mog. Write a program in some language, compile it to WASM, and load it into the host process. This is (probably) nice and safe, and relatively performant.

Since it's new, Mog will likely not yet beat existing systems at basically anything. Its potential lies in having better performance and a much smaller total system footprint and complexity than the alternatives. WASM is generally interpreted -- you can compile it, but it wasn't really designed for that as far as I know.

More generally, I think new execution environments are good opportunities for new languages that directly address the needs of that environment. The example that comes to mind is JavaScript, which turned webpages into dynamically loaded applications. AI agents have such heavy usage and specific problems that a language designed to be both written and executed by them is worth a shot in my opinion.

sjrd•16m ago
Wasm is definitely designed to be compiled, either ahead of time or JITed. Wasm interpreters are few and far between.
gozzoo•1h ago
How is Mog different than Mojo?
FireInsight•1h ago
I looked at the brainrotty name[1] and instantly assumed AI slop, but I'm glad the website was upfront about that.

[1] https://www.merriam-webster.com/slang/mog

Retr0id•1h ago
> Compiled to native code for low-latency plugin execution – no interpreter overhead, no JIT, no process startup cost.

If you're running the compiled code in-process, how is that not JIT? And isn't that higher-latency than interpreting? Tiered-JIT (a la V8) solves exactly this problem.

Edit: Although the example programs show traditional AOT compile/execute steps, so "no process startup cost" is presumably a lie?

dana321•1h ago
They could have just used cranelift for jit, but no..
belisarius222•45m ago
Mog is AOT-compiled, not JIT'd.

JIT means the code is interpreted until some condition kicks in to trigger compilation. This is obviously common and provides a number of advantages, but it has downsides too: 1) Code might run slowly at first. 2) It can be difficult to predict performance -- when will the JIT kick in? How well will it compile the code?

With Mog, you do have to pay the up-front cost of compiling the program. However, what I said about "no process startup cost" is true: there is no other OS process. The compiler runs in process, and then the compiled machine code is loaded into the process. Trying to do this safely is an unusual goal as far as I can tell. One of the consequences of this security posture is that the compiler and host become part of the trusted computing base. JITs are not the simplest things in the world, and not the easiest things to keep secure either. The Mog compiler is written entirely in safe Rust for this reason.

This up-front compilation cost is paid once, then the compiled code can be reused. If you have a pre-tool-use hook, or some extension to the agent itself, that code runs thousands of times, or more. Ahead-of-time compilation is well-suited for this task.

If this is used for writing a script that agent runs once, then JIT compilation might turn out to be faster. But those scripts are often short, and our compiler is quite fast for them as it is in the benchmarking that I've done -- there are benchmarking scripts in the repo, and it would be interesting to extend them to map out this landscape more.

Also, in my experience, in this scenario, the vast majority of the total latency of waiting for the agent to do what you asked it is due to waiting for an LLM to finish responding, not compiling or executing the script it generated. So I've prioritized the end-to-end performance of Mog code that runs many times.

dana321•1h ago
Its disheartening to see these crop up after spending 25 years through trial and error learning how to write programming languages.

Please think twice before releasing these, if you're going to do it come up with at least one original idea that nobody else has done before.

Why didn't you just call it "bad rust copy"?

Garlef•57m ago
Awesome!

A few questions:

- Is there a list of host languages?

- Can it live in the browser? (= is JS one of the host languages?)

belisarius222•31m ago
The host is written in Rust, with `extern "C"`, which makes it able to be loaded as a C library by programs written in other languages. Most languages have support for this.

It's also designed to be run in an event loop. I've tested this with Bun's event loop that runs TypeScript. I haven't tried it with other async runtimes, but it should be doable.

As for the browser, I haven't tried it, but you might be able to compile it to WASM -- the async stuff would be the hardest part of that, I suspect. Could be cool!

libre-man•29m ago
Don't know if others have this issue, but for me I can't scroll on Firefox.
jjice•11m ago
Firefox 148.0 MacOS Tahoe - I'm able to scroll.
saithound•9m ago
> When asking people to write code in a language, these restrictions could be onerous. But LLMs don't care, and the less expressivity you trust them with, the better.

But LLMs very much do care. They are measurably worse when writing code in languages with non-standard or non-existent operator precedence. This is not surprising given how they learn programmming.

Trump says Iran 'war is complete,' talks to Putin

https://www.cnbc.com/2026/03/09/trump-iran-war-end.html
1•kamaraju•52s ago•0 comments

Feed Palestine

1•alpple•1m ago•0 comments

Skill to slim down your bloated AGENTS.md file

https://mheadd.github.io/agent-slimmer/
1•mjheadd•1m ago•0 comments

I wrote a OpenClaw Operators Field Guide for operating multi-agent AI systems

https://bethegorilla.com/
1•pathowlett•1m ago•1 comments

Snice – 130 web components and a decorator-based framework

1•hedzer•2m ago•0 comments

Some skills become second nature

https://news.mit.edu/2026/how-some-skills-become-second-nature-0304
1•rbanffy•2m ago•0 comments

One Year with Hyprland

https://www.whileforloop.com/en/blog/2026/03/09/one-year-with-hyprland/
1•wookashh•3m ago•0 comments

Oracle is building yesterday's data centers with tomorrow's debt

https://www.cnbc.com/2026/03/09/oracle-is-building-yesterdays-data-centers-with-tomorrows-debt.html
2•spenvo•5m ago•0 comments

Show HN: Making Codex stop rediscovering the same repository over and over

1•oldskultxo•5m ago•1 comments

Setting Up a Debug Environment for QEMU PCI Device Exploitation

https://varik.dev/blog/htb/nftdrm/debug-env-for-qemu-pwn
1•varik77•6m ago•0 comments

Taara Beam

https://taaraconnect.com/product/beam
2•rglover•8m ago•0 comments

Talking Face Animation Using a Learned Kalman Filter on Mobile Devices

https://www.mdpi.com/1424-8220/26/4/1377
2•PaulHoule•8m ago•0 comments

Show HN: DevToolbox – 13 browser-based dev tools, privacy-first

https://geld-verdienen-app-kbpcmxfq.devinapps.com
1•DevToolboxApp•9m ago•0 comments

Thomas Selfridge: The First Airplane Fatality

https://www.amusingplanet.com/2026/03/thomas-selfridge-first-airplane-fatality.html
3•Hooke•9m ago•0 comments

Show HN: MDviewer – native macOS app for opening Markdown as print-ready docs

https://github.com/JackYoung27/mdviewer
1•jacknotold•11m ago•1 comments

'Love Is Strong as Death' Review: Triangles of Life

https://www.wsj.com/arts-culture/books/love-is-strong-as-death-review-a-theologians-triangles-of-...
1•apollinaire•11m ago•0 comments

Closing the verification loop: Observability-driven harnesses for agents

https://www.datadoghq.com/blog/ai/harness-first-agents/
1•alpaylan•11m ago•0 comments

Show HN: Efficient LLM Architectures for 32GB RAM (Ternary and Sparse Inference)

https://github.com/opengraviton/graviton-native
1•fatihturker•11m ago•1 comments

Show HN: SubmitGate – catch mobile submission/compliance issues before release

https://submit-gate.com/
2•drkhannah•13m ago•0 comments

Show HN: Agents.txt – proposed standard for AI agent permissions on the web

https://github.com/jaspervanveen/agents-txt
1•jaspervanveen•14m ago•3 comments

Bluesky CEO Jay Graber will step aside

https://www.theverge.com/tech/891562/bluesky-new-ceo
1•microsoftedging•16m ago•0 comments

Anthropic launches code review tool to check flood of AI-generated code

https://techcrunch.com/2026/03/09/anthropic-launches-code-review-tool-to-check-flood-of-ai-genera...
1•LostMyLogin•18m ago•0 comments

Musk takes the stand at trial for deflating Twitter stock ahead of purchase

https://www.latimes.com/business/story/2026-03-04/musk-takes-stand-in-trial-accusing-him-of-defla...
4•1vuio0pswjnm7•19m ago•0 comments

Forge 4D – a native runtime for building apps without the browser stack -new URL

https://codeberg.org/CrowdWare/Forge4D
2•artanidos•22m ago•1 comments

What I Learned Building Two Large Products with AI

https://medium.com/@pavel.manovich/can-a-non-developer-build-serious-software-with-cursor-0fbf1e3...
1•pavel_man•27m ago•1 comments

Show HN: DopaLoop – Habit tracker for ADHD brains, local-first, no streaks

https://dopaloop.app/de
1•steviee•32m ago•0 comments

NASA's Dart Mission Changed Orbit of Asteroid Didymos Around Sun

https://www.nasa.gov/missions/dart/nasas-dart-mission-changed-orbit-of-asteroid-didymos-around-sun/
3•divbzero•32m ago•1 comments

Show HN: Sales Tracking Agent that doubles up as a CRM

https://auto-crm.com/en
1•bhasinanant•35m ago•0 comments

Show HN: Free open-source churn prediction for SaaS–Stripe and LLM interventions

https://github.com/ShreyasDasari/churnguard-ai
1•ShreyasDasari•35m ago•1 comments

Satellites are exposing weak bridges in America and around the world

https://www.sciencedaily.com/releases/2026/03/260307213350.htm
2•taubek•35m ago•0 comments