4.7

What is Codemode

Developer ToolsSoftware EngineeringIndustry

Armin explains Codemode, a JavaScript execution layer in the Pi AI harness that runs on the harness side rather than in the sandboxed execution environment. While bash handles most agent tasks well, it fundamentally cannot compose native LLM operations like image injection, sub-agent orchestration, or classifier invocations—Codemode fills this gap. It runs in QuickJS/WASM with intentional restrictions (no network, no filesystem), using tool calls as its only side effect, and enables concurrent operations, state persistence across sessions, and access to APIs not exposed as regular tools. The post frames this not as a reversal of his earlier 'code is all you need' thesis but as an extension of it into the harness layer, while acknowledging current MCP friction and open challenges around durability and binary data.

Codemode is not a retreat from 'code is all you need' but a recognition that the harness itself needs a programmable orchestration layer distinct from bash—one that can compose concurrent tool calls, manage state, and invoke native LLM APIs without touching the sandboxed execution environment.
  • 7

    bash has one fundamental limitation which is that it can only compose programs that run.

  • 3

    Codemode runs in the harness, in its own sandbox. In case of Pi it's running in QuickJS within a WASM runtime with intentional limitations: no network, no file system, no timers, limited RAM. The only way is to call more tools.

  • 5

    Codemode in Codemode which is pretty bad. It means double JSON escaping, easy for smaller models to get confused by and the inner code cannot call the outer tools.

  • 7

    The MCP ecosystem from my perspective picked up on exactly what we pointed out a year ago works: code.

  • 3

    Codemode also allows you to throw state into the transcript! That means that one Codemode invocation can stash away data, that the next call in the session can load again.

  • 4

    If you for instance use a sandboxing solution like Gondolin your bash stuff will be sandboxed just fine, but the harness itself will not be.

  • 4

    Maybe something like Starlark is a better composition language than JavaScript given its deterministic nature.

technical, opinionated