tinygate
v1.0.0
Published
Proof-gated task queue: done = a fresh green exit code, or it stays claimed. The gate refuses pretending.
Maintainers
Readme
tinygate — an automatic performance chip for coding agents
Install it once. Keep using your coding agent exactly as you do today. Underneath, tinygate makes every
session cheaper and more reliable — automatically, hook-driven, with nothing to run and nothing
to manage. The savings fire whether or not you ever type a tinygate command. One engine file (tiny.mjs,
zero dependencies), any agent.

Status: private beta — a walkthrough or access is available on request. Once you have it, the whole runbook is one line:
node tiny.mjs installThen keep talking to your agent as you already do. Everything below explains what the chip does in the background — there is no new workflow to learn.
The receipt
The cleanest number is a controlled one: across a 100-task ungameable benchmark — graded on random inputs the agent never sees, so it can't memorize answers — the same agent on the same model uses ~a third fewer tokens through tinygate (−32%, cheaper on 76 of 99 tasks), at equal reliability (raw 100/100, tinygate 99/100 solved). It is not faster — wall time is a wash. The win is lean context + turn discipline; the honest caveats are inline in the benchmark.
The visceral number is a real day: an $862 workday (2026-07-02) replayed under tinygate's mechanisms
comes out at $40 — 95.7% saved on the tokens-per-day ruler, 95.3% on price (counterfactual replay,
bench/ctxbench/today-replay.mjs; construction in docs/THESIS.md). Four days later, a production day
with a larger workload than that reference day cost $63 real dollars = 7.3% of it (operator-measured,
2026-07-06, n=1).
The honest caveats, up front: the replay is a simulation over a real transcript, not a re-lived day;
the gauge judges against the worst day on record (un-cherry-pickable by construction, but percentages
against a bad day flatter); and the dollar receipt is one real day, not a controlled trial. Check your own
week with tiny gauge (optional, read-only) — it isn't required for any of the automatic savings below.
How it saves money — five automatic mechanisms
You invoke none of these. Each is hook- or code-driven and fires on its own, every turn.
- Waste is refused before it bills. A pre-tool-call check refuses re-reading an unchanged file (it's already in context) and refuses commands that dump long output until they're redirected. Every refusal logs the bytes it saved — 234 KB refused in the last 7 days on the reference machine.
- Long output leaves the conversation. Long tails are vaulted to disk behind a ticket; the agent sees a short head. Nothing is lost — it just stops re-billing every message.
- Repeats replay with zero model. A finished job's command sequence and its resulting file-state are cached; a matching repeat replays them with no model call (~15,400 tokens → ~0; a solved coding task re-runs at 0 model tokens, ~108× faster), and a real proof still arbitrates the result.
- Common questions are answered by code. A deterministic router recognizes recurring whole-prompt phrasings and answers them itself — zero tokens, zero latency, no model call.
- Mechanical work is routed to cheap models. Background jobs run on a cheap-model default under hard token/time budgets: −71.7% total tokens per job vs interactive on identical work (acceptance-gated A/B, medians of 3, 2026-07-02).
How it stays honest, and deterministic
Nothing false-completes: a unit of background work is "done" only when its stored proof command exits green — run fresh, at that moment, with no other path to done. And the gate validates its own sensor: a born-green proof (one that passes before the work exists, so it proves nothing) is refused at authoring, unless a regression guard is explicitly declared. Commits are blocked without a recent passing check. Saved rulings expire and must re-pass their own check before they're shown again, so the system never acts on stale information. And routing, verdicts, and session boot are deterministic code — zero model latency where a rule suffices (a recognized prompt or a cached repeat answers instantly — the one place it is faster). Automatic reliability; nothing to turn on.
Works with any agent — which harness gets what
| Harness | Automatic pre-tool governance | How |
|---|---|---|
| Claude Code | Full | Native PreToolUse/SessionStart/UserPromptSubmit hooks refuse re-reads and unredirected verbose commands before they bill, every turn (install --harness claude, the default). |
| Codex / Gemini CLI / any MCP harness | Full | tiny mcp — a zero-dependency stdio MCP server exposing tinygate-owned read/grep/bash; policy runs inside each tool, so refusal happens before any content bills — no harness hooks needed (install --harness codex\|gemini registers it). |
| Generic CLI (no hooks, no MCP) | None automatic | Core engine + a prompt-layer wrapper (tiny chat --agent <cli>): identity, routing, tax nudges. No tool-call interception. |
The boundary, plainly: a plain CLI wrapper can't intercept an agent's internal tool calls before they bill — only native hooks or the MCP broker reach that layer. Claude Code gets full automatic hooks today; Codex/Gemini get the core engine today and full control through the MCP tools.
Optional extras (defaults already deliver everything above)
- Tuning: nothing needs configuring.
tiny configprints the dial in plain language;tiny config gauge onis the one knob you might touch (it persists a live dollar meter). Full keys live inconfig.json; the internal agent surface is documented inAGENTS.md.
Measured constants (provenance inline; re-measurement only)
- today-replay 2026-07-02: 95.7% saved (gauge ruler) · 95.3% price ($862→$40) · 94.0% raw floor
- production receipt 2026-07-06: a larger day than the reference = $63 = 7.3% (operator-measured, n=1)
- background vs interactive: −71.7% total tokens, acceptance-gated (medians of 3, 2026-07-02)
- controlled 100-task ungameable benchmark, matched model+effort (raw haiku-low vs tinygate haiku-low): −32% tokens (0.68×), cheaper on 76/99 tasks, reliability tied (100/100 vs 99/100) — not faster (wall tied); 2026-07-08, n=100
- model-routing lever, raw sonnet vs tinygate→haiku on one hard task: $0.23 → $0.06 (−73%), identical verified result (both 61/61; n=2, 2026-07-07) — cheap-model routing made safe by the proof gate
- replay: ~15.4k tokens → ~0 on a cache hit · governor: 234 KB refused in 7d (evidence receipts, live 2026-07-07)
- per-turn fresh floor ≈ 16K tokens (system prompt + tool schemas; irreducible)
- gauge: metered tokens/day ≤ 10% of the recorded worst day (591M on 2026-06-11, reference machine)
- REJECTED & recorded: prose-only contract (115%) · no-self-verify (0/3 accepted) · batch missions (B/A 96.5%)
Files
tiny.mjs engine · tiny.test.mjs + tiny.invariants.test.mjs two-battery spec suite (engine line cap
self-gated — delete before you add; proof: node --test tiny.test.mjs tiny.invariants.test.mjs) ·
AGENTS.md agent contract · hooks/route.mjs prompt router · docs/THESIS.md why this exists, with the
receipts and their criticism · bench/ctxbench/ the measured benchmarks.
Sponsor. tinygate measures the money it saves you (tiny tax). If it earned it, sponsoring keeps it
maintained and independent — the button is on the repo. No pressure, and it never nags from inside the tool.
License: MIT.
