Sun, Nov 8, 2026
1 note this week
pi-schema
pi-schema is a JSON Schema validator from the Pi monorepo that never calls
evalornew Function. Mario Zechner says he built it with a single prompt. It compiles each schema into plain closures, so it stays fast in places that block code generation.- The need is real. Cloudflare Workers block
eval()andnew Function. Chrome MV3 extensions cannot allow'unsafe-eval'. Ajv, the default JSON Schema validator in JS, compiles schemas withnew Function. It broke MCP elicitation on Workers (typescript-sdk#689). - How people cope today. Ajv can generate validators at build time, but that only works for schemas you know in advance. The MCP SDK lists @cfworker/json-schema, an interpreter, as a peer dependency. Zod and ArkType have
jitlessflags, and TypeBox falls back to its interpreter. Zod’s flag has to be set before any import that uses Zod (zod#5789). - The numbers. Without eval, the README puts a nested schema at 407 ns for pi-schema, 42 µs for TypeBox and 43 µs for cfworker. pi-schema passes 2,222 of the 2,223 core tests in the official suite.
Agents make this matter. An agent learns its tools from MCP servers while it runs:
tools/listreturns each tool’s JSON Schema. You cannot compile those ahead of time, and the harnesses are moving to the edge. Pi’s Chord design notes plan a Cloudflare Durable Object driver, and Pi Durable already stores agent work as checkpointed tasks. The catches: these are the author’s own benchmarks, Ajv is not in the comparison, the package is not on npm yet, and TypeBox’s JIT still wins on small flat schemas (9 ns vs 31 ns).- The need is real. Cloudflare Workers block