hn.today

What Is Codemode

lucumr.pocoo.org19 points0 comments
Screenshot of What Is Codemode

Codemode is a lightweight scripting layer added to Pi that lets an LLM orchestrate complex, harness-side operations in a sandboxed language runtime instead of stuffing everything into tool calls or the model context. It treats the harness as the "brain" and the execution environment as the "hands," acknowledging the trust and filesystem boundary between them. Because some capabilities (for example reading images, spawning subagents, or calling internal model APIs) cannot be expressed well as simple CLI tools, Codemode runs JavaScript in a QuickJS/WASM sandbox with strict limits (no network, no host filesystem access, no timers, limited RAM). That environment issues structured tool calls, supports concurrency and basic workflows, and can persist transient state into the session transcript so subsequent Codemode invocations can load it.

Practically, Codemode lets agents call internal AI SDK features that would otherwise waste or overflow context: generate images and send them back as image content and temporary artifacts; run classifier models like Jev to batch-process GitHub issues and store sentiment results; or orchestrate a 30-step game-debugging loop that queries the engine, classifies state, and issues commands. Pi constrains actual parallel tool runs to four and exposes Codemode when MCP is enabled (or via "defaultTools": "+codemode"). The result is more expressive, structured, and efficient agent workflows without exposing unsafe host capabilities.

Read on lucumr.pocoo.org0 comments on Hacker News

Summary generated by AI from the linked article. hn.today is not affiliated with Hacker News or Y Combinator.

More in AI

Nano Banana 2.1

Nano Banana 2.1

Google AI Studio announced Nano Banana 2.1, an improved image generation model with better visual design, mask-based editing, and natural-looking images. The model outperforms previous versions across all metrics and is available for testing at ai.studio. (twitter.com)

EmbeddingGemma 2

EmbeddingGemma 2

EmbeddingGemma 2 is a new multimodal embedding model developed by Google, capable of handling both text and vision data. It offers a moderate size of 270 million parameters for text and 440 million for combined text and vision, aiming to improve how large language models and AI agents work. (blog.google)

The daily digest

Today's best Hacker News stories, summarized and screenshotted, one email a day.