GRPN/REFACTOR
OverviewAtlas HarnessFleetOpsWorkLedgerArchitectureActivity
≈250–450MB · −85%
ARCHITECTURE · groupon-refactor@mainDRAFT — ACTIVE ON ACCEPTANCE

Polyglot by plane,
not by fashion.

Every tool gets the language its job demands — and they all share ONE database. WorkLedger and Atlas ride one Encore.ts binary on Postgres; the Harness stays a batch TypeScript CLI; FleetOps becomes one static Go binary writing to the same Postgres. Decided 2026-07-19 by a 27-agent steelman court, amended the same day by a second 13-agent Postgres-only court + Robert's ruling: no VictoriaMetrics, no Grafana daemon, no SQLite.
The stack, tool by tool ↓Why Go won
source: plans/006-stack-architecture/00-SYNTHESIS.md + 05-postgres-only-comparison.md · ~2.3M tokens, two courts
ALWAYS-ON RSS — THE TOOLING BASE
−85%
≈250–450MB, was ~2.3–2.4GB.
Loki, OTel Collector — and now every observability daemon — gone.
BEFORE — AS PREVIOUSLY DOCUMENTED
LOKI ~1.5GB IDLE
EVERYTHING ELSE
NOW — ONE STACK, CHOSEN PER PLANE
max MB — pg 150 · encore 150 (unverified) · fleetops go 40 · observability daemons 0
The fleet itself — hundreds of Claude Code sessions at ~156MB each — costs tens of GB. The tooling is now noise against it. That is the point.
01 / THE STACK, TOOL BY TOOL
PRODUCTLANGUAGE · RUNTIMEDATABASEWEB SURFACEALWAYS-ON
WorkLedger
SYSTEM OF RECORD
TYPESCRIPTENCORE.TS
Runs as a built binary (encore build) — never the dev daemon. Pinned by plan 002 ADR D5.
Postgres
One shared, tuned instance. Claim path needs real row-level locking — SKIP LOCKED.
5 SQL views read by the Board. Grafana deferred — psql for ad-hoc.
ALWAYS-ON~100–150MB
UNVERIFIED → V1
Atlas
ANSWER LOOP
TYPESCRIPTENCORE.TS
Same built-binary process family as the ledger. Pinned by plan 003 — unchanged.
Postgres
Same shared instance; pg_trgm for search.
Renderings (docs/atlas/) + capped digest rows via FleetOps.
ALWAYS-ONrides the ledger binary
Harness
DUAL-RUN PARITY
TYPESCRIPTPYTHON
TS workspace + CLI (Bun runtime allowed); mitmproxy stays a quarantined Python process.
File store + Postgres
Content-addressed fixtures on disk; verdict rows written into WorkLedger's Postgres.
None — evidence bundles + one Board panel (Grafana deferred).
BATCH / EPISODICfootprint constraint
doesn't bite — TS stays
FleetOps
MONITOR · THE OPEN SLOT
GORUST TUI AS-IS
ONE static binary: ingest + OTLP receiver + SSE board + pollers + digest in-process. Existing Rust TUI and ghmonitor stay, consumed via JSON seams.
Postgres — fleetmon schema
Insert-only daily partitions, 30-day partition-drop, synchronous_commit=off. One writer goroutine, now batching pgx inserts.
The Board IS the web shell: server-rendered htmx/Datastar + SSE, go:embed assets. Renders the metric panels itself.
ALWAYS-ON~15–40MB
GOMEMLIMIT set
Observability
METRICS · DASHBOARDS
Zero daemons. A ~150–400 LOC OTLP/HTTP receiver lives inside the Go binary — Claude Code exports its 8 counters per-signal natively. No OTel Collector, no Loki, no VictoriaMetrics.
Postgres — fleetmon schema
Counter-reset handling as LAG() SQL views; golden test V5 tracks CLI releases.
The Board + psql. Grafana deferred — dashboard 25255 died with the Prometheus datasource; back only if Board panels prove insufficient.
IN-PROCESS0MB extra
rides the Go binary
02 / HOW IT WIRES TOGETHER
01agent sessions · the fleetotlp metrics · per-signal · no collectorGO OTLP RECEIVER · in-binaryfleetmon schemaPOSTGRES
02agent sessionshook events · stripped JSON · HTTPgo ingest → channel → ONE writer goroutinepgx batchPOSTGRES · fleetmon
03fleetops TUI · rust, as-isghmonitor · go, as-isJSON seams · polledpollers · goroutinessame channelPOSTGRES · fleetmon
04POSTGRES · fleetmonderived attention queueTHE BOARD · htmx/Datastar + SSE · go:embedad-hoc SQLPSQL
05workledger svcatlas svcone encore built binaryPOSTGRES · shared, tunedread-only viewsboard · psql
06harness · batch runsverdict rows · block()workledger PGcapture fixtures · content-addressedFILE STORE
SEQUENCINGThe Go binary ships ingest-only + the existing TUI first (days); the Board SSE page second. Preserves plan 004's F5+F6-first order.
03 / THE ALWAYS-ON BUDGET — THE NUMBER ROBERT ASKED FOR
Postgres
ONE SHARED INSTANCE · SHARED_BUFFERS 128–256MB
130–150MB
serves ledger + atlas
Encore built binary
LEDGER + ATLAS SVCS · ENCORE BUILD
100–150MB
UNVERIFIED — measure at walking skeleton (V1)
FleetOps binary
ONE STATIC GO BINARY · OTLP RECEIVER IN-PROCESS
15–40MB
GOMEMLIMIT set explicitly
Observability daemons
VM DROPPED · GRAFANA DEFERRED · 006 §5B
0MB
receiver rides the Go binary; psql + Board replace Grafana
TOTAL
≈250–450MB was ~2.3–2.4GB → ~85% cut
Loki (~1.5GB idle), OTel Collector, VM and Grafana all gone — zero observability daemons
04 / WHY GO WON THE OPEN SLOT — THE STEELMAN COURT
CRITERIONWTA · ALL-TSB · RUSTC · GO ★D · DO-LESS
Always-on footprint25%4555
Agentic maintainability20%4254
Simplicity / ops surface15%4345
Speed to ship15%4245
Robustness at fleet scale15%4452
Coherence & evolution10%4343
WEIGHTED4.003.304.604.15
B · RUST — DISQUALIFIED ON EVIDENCE
The only benchmarked language with real failures (38/40); repo-level real-issue resolution 21–28% vs ~70% Python-tier. Its one advantage — reusing the 6.4k-LOC fleetops crate in-process — rests on an unverified premise.
D · DO-LESS — THE DISQUALIFIER
Daemon-less ingest makes every hook event an OS process contending on one ingest store — and hooks run synchronously, so ingest contention becomes agent tool-call latency at peak load. Saves only ~50–100MB over C.
C · GO — AND NOT ALL-TS, BECAUSE
The maintainability evidence establishes TS-over-Rust, not TS-over-Go. Go matches A on coherence, beats it on footprint floor and runtime robustness — and its win survives every plausible weight shift the court tested.
05 / RISKS, TRIPWIRES & VALIDATION SPIKES
R1Go's grade is directional, not measured
No repo-level maintenance data exists at the depth where Rust collapsed. Tripwire: track agent PR failure rate on FleetOps in the ledger from week 1. Fallback: all-TS board behind the same HTTP/SSE contract — swap cost is days.
R2Encore built-binary RSS is unpublished
The ~100–150MB line is an assumption in an exercise that is entirely about RSS. Gate: spike V1 at ledger walking-skeleton; >400MB → revisit packaging (A-lite standalone, plan 002 D5's own escape hatch).
R3Hook-event burst shape is unmeasured
Nobody has published events/sec at hundreds-of-agents scale. The ingest envelope has ~40× headroom over any modeled rate — but the model is a model. Spike V2 instruments the next real wave.
VALIDATION SPIKES — ALL CHEAP
V1Encore binary RSS, idle + claim load · gate <400MB
V2Hook events/sec + burst shape, 20-line stub ingest
V3pgx batched inserts: 1k burst into fleetmon partitions, claim-path p99 unaffected
V4fleet snapshot subprocess cost → set poll interval (start 5s)
V5OTLP receiver golden test: protobuf fixture → rows, incl. counter-reset case
SUPERSEDED
LokiOTel CollectorPrometheuscron + daemon splitVictoriaMetricsSQLite ingest (ADR-6)Grafana (deferred)
CONFIRMED
Encore.ts + Drizzle + PG (002/003)ONE database — PG fleetmon ingest (006 §5b)web board (ADR-2)in-binary OTLP receiver (006 §5b)
← WorkLedgerARCHITECTURE · POLYGLOT BY PLANE · SOURCE: PLANS/006-STACK-ARCHITECTURE @ MAINNext: Activity →