Shopify: Aquifer separates durable session logs from disposable agent cells
How Shopify splits durable session logs from outside-the-sandbox harness cells, and pairs coding loops with deterministic compilers and cross-model test oracles.
- Append-only session log
- Outside-sandbox Session Cell
- Compiler + cross-model test oracle
Investigation question
How do Shopify’s internal agent platform (Aquifer, River, Dispatch, Roast) and external @shopify/ai-toolkit isolate session state, credentials, deterministic validation, and telemetry?
Observed
First-party Shopify Engineering publications describe Aquifer’s four-layer model (PostgreSQL append-only session event log; Session Cells co-locating a Go runtime and agent harness outside the sandbox; Nix containers plus pre-warmed macOS and Linux/Android Remote Dev pools; and Nix-built River, PR review, and Vanilla profiles), River’s public-Slack-only policy (DMs disabled, 59,918 sessions and 3,536 coauthored merged PRs over 30 days), and Dispatch’s nine-stage security pipeline with a cross-model verification test oracle. Shipped source in Shopify/roast (commit 93b2f5c9) sets VALID_PROVIDERS = [:pi, :claude] with :pi (@mariozechner/pi-coding-agent) as default via pi --mode json -p --fork. Shipped tarballs @shopify/ai-toolkit@2.3.0 and @shopify/dev-mcp@1.18.0 bundle eight harness plugin manifests, 95 compressed GraphQL schemas (2026-01 through 2027-01 plus unstable), offline AST validators, and two telemetry paths to POST https://shopify.dev/mcp/usage (--user-prompt-base64 script flags and hooks/scripts/track-telemetry.sh with X-Shopify-Surface: skills-hook) governed by OPT_OUT_INSTRUMENTATION=true, DO_NOT_TRACK=1, and ~/.config/shopify-ai-toolkit/opt-out.
Inferred
Routing both interactive Session Cells and batch Roast workflows through a JSONL stdin/stdout harness (pi print/RPC modes supporting prompt, steer, follow_up, and fork) decouples multiplayer Slack thread steering and model swaps from container lifecycle. Likewise, track-telemetry.sh hooks UserPromptSubmit and PostToolUse (Skill|Read) because Markdown-only skill reads would otherwise bypass MCP server instrumentation.
Unknown & limitations
Public package, repository, and engineering-blog analysis only. Proprietary Go Session Cell source code, internal PostgreSQL schemas (river_sessions), internal Nix flake definitions in Shopify’s World monorepo, Jev mobile-classifier weights, and server-side retention policies for shopify.dev/mcp/usage are not publicly distributed and were not inspected.
Architecture
Aquifer separates four concerns: (1) Session — canonical append-only event stream in PostgreSQL; (2) Harness — ephemeral Session Cells running a Go supervisor and agent loop in one OS process group outside the untrusted container, exiting on idle and rehydrating on any host; (3) Sandbox — disposable Nix Linux containers or Remote Dev macOS/KVM-Android machines with secrets held outside in a Credentials Proxy; and (4) Profiles — Nix bundles (River interactive, PR review automation, Vanilla headless pi).
Domain & data models
river_sessions tracks public Slack sessions across channels and merged PR lineage. @shopify/dev-mcp@1.18.0 packages 95 gzipped GraphQL schema snapshots (admin, customer, partner, payments-apps, storefront, and functions_* across 2026-01..2027-01 and unstable), while @shopify/ai-toolkit@2.3.0 ships Brotli-compressed equivalents for local CLI validation.
Workflows & state machines
Three deterministic-first loops stand out: (1) River restricts @river to public Slack threads so mid-turn human redirects steer live sessions and completed transcripts feed back into SKILL.md; (2) Dispatch partitions codebases to 20–30% of context window, runs parallel hunters, and requires a sequential test-oracle agent on a different model family to prove each bug with a runnable integration test; (3) Boba runs deterministic sed cleanup and srb tc --autocorrect before invoking an LLM coding agent on residual Sorbet errors.
API & protocol surfaces
Shopify/roast invokes pi --mode json -p [--fork <session> | --no-session] over stdin/stdout JSONL (session, turn_start, message_update, tool_execution_start, tool_execution_end, agent_end), while @mariozechner/pi-coding-agent@0.73.1 --mode rpc exposes 29 JSONL commands (prompt, steer, follow_up, abort, fork, clone, compact, extension_ui_request/extension_ui_response). @shopify/dev-mcp@1.18.0 exports learn_shopify_api, search_docs_chunks, validate_graphql_codeblocks, validate_component_codeblocks, validate_theme_codeblocks, validate_theme, validate, and feedback.