The Native-Backed Harness

what happens when a fork replaces the shell-out layer with Rust

can1357/oh-my-piView the repository
LANGUAGE
TypeScript + Rust · Bun
SOURCE LOC
1.41M TS · 171k Rust
PACKAGES
17 packages · 8 crates
BUILT-IN TOOLS
32 (29 visible)
PROVIDERS
64 · 4,367 models
OS SANDBOX
none — CoW worktrees
All 29 blocks

Surfaces & entry

The turn

Tools

Context & memory

Model layer

Safety

Extensibility

State

Isometric plate: the 29 subsystems of OMP (Oh My Pi)Blocks are grouped into districts by hatching and tint; block height is a rough proxy for code mass. Lines trace the data flow of a single turn. The block index beside this diagram carries the same information as text.ABCDEPFQRZSGHTAAJIUVABKMWLNOXACY

Hover to read · drag to pan · ⌘/ctrl + scroll to zoom

How to read this plate

Each block is one subsystem of OMP (Oh My Pi). Its height is a rough proxy for code mass, calibrated the same way across every harness so the plates are comparable. Hatching and tint group blocks into districts — surfaces, the turn, tools, context, the model layer, safety, extensibility and state.

Lines trace the real data flow of a single turn plus the major supporting links. Pick any block for a plain description and the files it was read from, or trace the turn to walk the path a request actually takes.

What this is

OMP is a fork of Pi that grew five times larger than its parent and changed almost every architectural decision. Pi's loop is 796 lines; OMP's is 2,935. Pi has zero Rust; OMP has 145,000 lines of it. Pi presents one uniform 7-tool surface; OMP computes a different surface per model, per session, per capability probe.

The signature invention is hashline: an edit language where every section is anchored to a 16-bit hash of the whole file, minted by the read that produced the line numbers. The body carries only new content — no retyped context, no -old lines. It tracks which lines the model actually saw and refuses edits over elided regions, and on drift it tries a provably-safe line remap before failing closed.

Underneath, a vendored bash engine runs as a persistent in-process shell and about 58 CLI utilities (grep, sed, jq, fd, ls, xargs, ps, top…) are Rust modules resolved without fork/exec — on macOS, Linux and Windows without WSL. Search, glob, diff, PDF, PTY, syntax highlighting, tokenization and copy-on-write filesystem isolation are all native too.

It also ships things nothing else here has: a real DAP debugger across 14 adapters, persistent REPL kernels for Python/JS/Ruby/Julia that can call back into the agent's own tools, Chromium automation plus host desktop control, and snapcompact — compaction that rasterises discarded history into bitmap-font PNGs for vision models instead of paying for a summary call.

Implementation

Interrupts. Four distinct signals coexist: hard external abort; a steering abort that only kills tools declaring interruptible; a peer-subagent abort that never preempts queued work; and a purely cooperative signal handed to every tool, which bash uses to background itself so the user's message lands promptly. Steering detection is deliberately non-consuming so a message is never stranded.

Tool surface. xdev virtual tool devices unmount non-essential tools from the wire schema entirely and expose them as xd:// URLs driven through read/write — one schema instead of N. Eleven textual tool-calling dialects (harmony, hermes, qwen3, glm, kimi, xml…) cover models without reliable native tool calling.

Compaction pipeline. Five strategies in order: prune superseded tool results, "shake" large blocks into placeholders, LLM summarization (or provider-native remote compaction for OpenAI/Codex), snapcompact rasterisation, and branch summarization. Frame geometry for snapcompact is tuned per provider by SQuAD-recall evals against real billing.

Isolation. No OS sandbox at all — the default approval mode is yolo. What exists instead is crates/pi-iso: copy-on-write worktrees via APFS clone, btrfs, zfs, reflink, overlayfs, Windows block-clone or ProjFS, so each isolated subagent works on its own snapshot and its changes are merged back as a branch or patch.