Freight runs on tribal knowledge. Laine makes it transactional.
A freight-dispatch copilot whose entire memory is CockroachDB: geo-pinned lane and site knowledge recalled because a shipment is there, dock-appointment bookings that cannot double-book under SERIALIZABLE, and every reroute sealed — in the same transaction — with the memories and live road events it rested on.
Shipments, trucks, docks, and carriers are a simulated exercise, disclosed in the UI — over real infrastructure: Overture logistics facilities for the Greater Toronto Area and live Ontario 511 road events (every on-screen event carries its real fetch timestamp).
Status: under active build for the CockroachDB × AWS "Build with Agentic Memory" hackathon. Full README (architecture, the Slot Race, verification) lands with the submission.
Running on AWS: two ECS Fargate services behind one Application Load Balancer — the Next.js app and a Valhalla truck-routing engine serving prebuilt Ontario tiles — with CloudFront terminating TLS. Persistent memory is a CockroachDB Cloud cluster (crdb-hackathon, database lanememory) reached over the internet; there is no local database in the deployment.
One command shows the database is genuinely behind it rather than fixtures:
curl -s https://d3op2859bj6dr9.cloudfront.net/api/operations \
| jq '{facilities: .stats.facilities, shipments: (.shipments|length), memories: (.memories|length), stack: [.stack[] | {label, live}]}'At the time of writing that returns 1,461 facilities, 11 shipments and 21 memories, and every entry in the on-screen stack strip — CockroachDB, Amazon Bedrock (Titan Text Embeddings V2), Ontario 511, Overture Maps, Valhalla and Bedrock Guardrails — reporting live: true. The strip is derived from the switches the server actually reads, so it cannot credit a service that is not running.
Demo timing note: the exposure and reroute beats need a full closure in force inside the routable area. Ontario 511 reliably has one on the HWY 401 Express nightly closures, roughly 21:00–05:00 Toronto time; outside that window the corridor may be clear and those panels legitimately render empty.
One database holds the vector, the geography, the transcript, the booking ledger and the decision journal. There is no side cache and no separate vector store. The diagram's two coloured paths are the two claims worth checking: memory recalled because a truck is near it, and a dock booking that CockroachDB itself refuses at commit.
The hackathon requires two of four. Laine uses all four, and each one is used for real rather than cited:
| Tool | How it is used here | Where to look |
|---|---|---|
| Distributed Vector Indexing | A C-SPANN vector index with a session_id prefix, so a dispatcher's personal memory and the organization's institutional memory are recalled in one indexed scan (WHERE session_id IN ($me, $org)). CockroachDB has no spatial KNN, so geo-semantic recall is a hinted vector top-k over-fetch with an ST_DWithin bound applied outside it — the mechanism, not a workaround. Plan-guarded in CI. |
db/migrations/0004_memory.sql · web/src/server/memory.ts · scripts/verify-plans.mjs |
| ccloud CLI | scripts/40_ccloud_bootstrap.sh provisions the whole cloud footprint reproducibly: the Basic cluster, a service account + API key (the CLI's documented auth path, and what authenticates the MCP server non-interactively), the application role, and the two carrier SQL identities the Slot Race proof authenticates as — with least-privilege GRANTs and per-role statement_timeout. |
scripts/40_ccloud_bootstrap.sh |
| Managed MCP Server | .mcp.json connects the Cloud MCP server (OAuth, cluster-scoped — no secret in the repo) so schema inspection, EXPLAIN checks, and row-level verification were driven through the MCP server during development rather than a psql shell. |
.mcp.json |
| Agent Skills | We consumed the official skills (npx skills add cockroachlabs/cockroachdb-skills) — designing-application-transactions directly produced three fixes in this repo: exponential backoff with jitter on 40001 retries, explicit non-retry of ambiguous 40003 commits, and pool lifetime/timeout guardrails. We also authored a skill in the same specification and ship it in this repo. |
skills/cockroachdb-application-development/geo-semantic-agent-memory/SKILL.md |
The authored skill, geo-semantic-agent-memory, generalizes what this project learned into a reusable capability: the prefix-scoped vector index for multi-tenant recall, the spatial-bound-outside-vector-order query shape, promotion of personal memory into institutional memory on human approval, row-level TTL as a forgetting curve, and the optimistic SERIALIZABLE interlock that refuses two agents competing for one resource.
Two different questions get confused in demos like this one, so they are answered separately.
| Layer | Status | Provenance |
|---|---|---|
| Logistics facilities | Real — 1,458 sites | Overture Maps places, freight/warehouse/distribution categories · scripts/32_load_facilities.mjs |
| Road events, construction, truck rest areas, inspection stations | Real and live | Ontario 511, re-fetched on demand and stored with source, source_id and fetched_at; every event carries its fetch timestamp on screen · scripts/33_ingest_511.mjs |
| Road network and truck routing | Real | OpenStreetMap extracts served by Valhalla, 4-axle tractor-trailer costing |
| Shipments, trucks, carriers, docks and dock windows | Simulated — a seeded exercise | scripts/seed-lanes.mts, deterministic. Disclosed on screen in the app, not only here. The three demo DCs sit at facility-cluster centroids and are never a named real business. |
| Lane memories | Written by us as an exercise corpus, then embedded and recalled for real | 21 seeded org memories; anything a dispatcher teaches at runtime is genuinely theirs |
Nothing simulated is presented as real anywhere in the product. The agent will also tell you when a provider is mocked rather than letting a beat imply otherwise.
Everything below is real code on the shipped path, exercised by the tests in web/scripts/:
- Geo-semantic recall — one CockroachDB statement ranking a C-SPANN vector index bounded by
ST_DWithin, across a dispatcher's own memory and the organisation's in a single indexed scan.scripts/verify-plans.mjsfails the build if the planner stops using the index. - The booking interlock — a genuine
SQLSTATE 40001underSERIALIZABLE, with noSELECT FOR UPDATEanywhere in that path.web/scripts/test-slot-race.mtsfails if the conflict stops happening. - Sealed decisions — the action and the exact evidence it rested on commit in one transaction.
- Memory promotion — personal becomes institutional only on human approval, exactly once,
enforced by a unique partial index.
web/scripts/test-promotion.mts, 9 assertions. - Schema —
db/migrations/0006_freight.sqland0007_promotion.sql; indock_bookingsthe probe index is the interlock.
docker compose up -d # CockroachDB v26.2, single node, :26257
npm install
./scripts/10_extract_places.sh toronto && ./scripts/11_extract_population.sh CA
node scripts/20_enrich.mjs places toronto && node scripts/20_enrich.mjs population toronto
./scripts/23_build_districts.sh toronto
export DATABASE_URL='postgresql://root@localhost:26257/lane?sslmode=disable'
node scripts/30_load.mjs toronto # base load + migrations
node scripts/32_load_facilities.mjs toronto # real logistics facilities
node scripts/33_ingest_511.mjs # live Ontario 511 snapshotOverture Maps (CDLA Permissive 2.0 / ODbL) · Kontur Population (CC BY 4.0) · OpenStreetMap contributors (ODbL) · Ontario 511 (Government of Ontario, Open Government Licence – Ontario) · basemap © CARTO.
Built on our open regenerative-map foundation (CockroachDB-backed geo-semantic agent memory with a map that assembles itself as the agent reasons).
