Gateway Runtime Spike — 5-Way Evaluation Plan

Issue #30 · Option C · Forgejo: gaem/nagato-game-assist · Created 2026-07-23

Goal

Build the same thin gateway adapter against 5 candidate runtimes, score each against the 6 decision gates from docs/gateway-contract.md, and produce a recommendation for human decision. No production changes — all spikes are throwaway prototypes in isolated worktrees.

The 5 Candidates

1. pi TypeScript

earendil-works/pi

Minimal agent toolkit with RPC mode / SDK for process embedding. "Adapt pi to your workflows without forking pi internals." First-class steering semantics. TypeScript (no #71 entanglement).

2. Open Agent Loops TypeScript

featherless-ai/open-agent-loops

Provider-agnostic agent loop SDK from Featherless. Plug-and-play seams: ModelClient, Memory, Tools, StopConditions. Single zod dep. Runs in Node/Bun/Deno/browser. Very new (v1.0.0, 2 weeks old).

3. Turnstone Python

turnstonelabs/turnstone

Self-hosted, local-first orchestration. Built-in shell/files/search/web tools. Explicit no-telemetry posture. Python (matches bridge language). Closest to Nagato's privacy posture. Previously read as "not a decision" — re-evaluating.

4. Stripped Hermes Fork Fork

Hermes 0.19.0 local fork

Take the existing version-locked Hermes fork and strip it to the Nagato gateway contract. Remove unused tools, harden defaults, delete surface area. Option B from issue #30 — own repo, patches as commits, periodic upstream merges.

5. Ground-Up New

Custom Python gateway

Build a minimal gateway from scratch that implements exactly the contract in docs/gateway-contract.md. No upstream to track. Maximum control, maximum maintenance. Python to match the bridge (avoids #71 language split).

The 6 Decision Gates

From docs/gateway-contract.md — every candidate must be scored against all 6.

Gate 1: Trace fidelity — Emit the exact trace-event contract (schema, SSE framing, seq/session correlation, artifact descriptors with sha256/size, redaction_status).
Gate 2: Research tooling — Host/route GTC tools (gtc_search/scrape/crawl/...). The runtime doesn't implement scraping; it hosts the tool registrations.
Gate 3: Session + memory — Stable per-game sessions (gamebar-<game_id>) and memory-context injection.
Gate 4: Tool governance — Expose ONLY the allowlisted tool subset. Minimal runtime configured up to our needs, not maximal fenced down.
Gate 5: Local-first / no-telemetry — Hard requirement. No phone-home, no analytics, all persistence local.
Gate 6: Maintenance economics — Patch-set size per upstream release vs. extension-code size. Measured, not vibes.

Scoring Matrix

Gate pi OAL Turnstone Hermes Fork Ground-Up
1. Trace fidelity ? ? ? ✅ (current) ✅ (by def)
2. Research tooling ? ? ? ✅ (current) ?
3. Session + memory ? ? ? ✅ (current) ✅ (by def)
4. Tool governance ✅ strong ✅ strongest ? ❌ maximal ✅ (by def)
5. Local-first ❌ bleeding-edge ✅ (by def)
6. Maintenance ? ? ? ❌ 17 patches all ours

? = unknown until spike. ✅ = known pass. ❌ = known fail. The spike fills every ?.

Execution Plan

0

Phase 0: Shared Adapter Contract (1 day)

Before touching any candidate, extract the thin adapter interface from docs/gateway-contract.md. This is the single contract every spike must implement.

1

Phase 1: pi Spike (2 days)

TypeScript earendil-works/pi

2

Phase 2: Open Agent Loops Spike (2 days)

TypeScript featherless-ai/open-agent-loops

3

Phase 3: Turnstone Spike (2 days)

Python turnstonelabs/turnstone

4

Phase 4: Stripped Hermes Fork (2 days)

Fork Hermes 0.19.0 local fork at head 86892b5c5

5

Phase 5: Ground-Up (3 days)

New Custom Python gateway

6

Phase 6: Comparison + Recommendation (1 day)

Parallelization Strategy

Phases 1-5 can run in parallel (up to 3 concurrent subagents per the ERR_NO_BUFFER_SPACE limit). Recommended batching:

Kill wrangler/browser/computer_use before dispatching subagents. ERR_NO_BUFFER_SPACE with 3+ subagents + wrangler SSE + browser + computer_use for 20+ min.

Timeline

PhaseDurationDependency
0. Shared adapter1 dayNone
1. pi spike2 daysPhase 0
2. OAL spike2 daysPhase 0
3. Turnstone spike2 daysPhase 0
4. Hermes stripped2 daysPhase 0
5. Ground-up3 daysPhase 0
6. Comparison1 dayAll above
Total (parallel)~5 days
Total (sequential)~13 days

Risks

Deliverables