apibench

Prove which library stays maintainable after v1.

Same model, same harness, same black-box tests. We build v1 from scratch, fork it cleanly into parallel feature-adding and bugfix tracks, and measure tokens, wall-clock time, and cost across InstantDB, Drizzle + PGlite, and SQLite with zero cloud keys.

Read the essay

Three stages, one held-constant agent

Stage 1 constructs a multi-workspace task board with role permissions from scratch. From that exact passing v1 repo, two fresh sessions fork in parallel: Stage 2a adds comments, @mentions, unread counters, and a read-only viewer role; Stage 2b fixes two planted regressions. Every run holds the model (gemini-4-neon) and harness (opencode) fixed.

Zero cloud keys, zero external databases

All three libraries execute in-process inside Node 22+ with isolated per-test memory stores: InstantDB runs schema, InstaQL, and declarative CEL permissions via @uri/instantdb-mock; Drizzle runs against real embedded PostgreSQL via @electric-sql/pglite; SQLite uses built-in node:sqlite.

Black-box grading only

Hidden tests in bench/tests/ import only the exported createBoard() factory and never touch library internals. In Stage 2b, the runner verifies that both planted bugs actually fail hidden repro tests before handing the repo to a fresh fixer session.

Contained runs via Docker

The repo ships a standalone Dockerfile and runs opencode run --standalone so benchmark runs execute in an isolated container or remote VM without polluting your host sessions or leaking secrets.

More under the hood task spec, planted bugs, caveats

What the task tests

v1 requires user signup, workspace creation, owner-only invites, task CRUD, column counts, and strict cross-workspace isolation. v2 adds a viewer role enforced at the permission boundary, task comments, deduplicated @email mentions, unread mention counts, read-marking, and cascade cleanup on task deletion.

What the planted bugs break

Bug 1 weakens workspace authorization in moveTask so a non-member can mutate another workspace's task. Bug 2 lets a regular member invite users and breaks counts.done in listTasks. The fixer receives only the symptom report, never the test file.

Scope and honest caveats

This is a k=1 proof of concept on a single headless backend task. Because the InstantDB track runs in-process via @uri/instantdb-mock, it exercises schema, queries, and CEL permissions, not real-time multi-tab WebSocket sync or optimistic UI updates where InstantDB saves significant client plumbing.

Proof-of-concept results

gemini-4-neon · opencode · k=1

All numbers below come directly from recorded runs in data/results.json holding the model (google/gemini-4-neon) and harness (opencode) constant across all three libraries.

v1 Build 2a Feature 2b Bugfix
Library Build (v1) Feature (2a) Bugfix (2b) Total v1 LoC