Compose with Neon

Metrecept — middleware governance. Exact-replay inventory that pairs with Neon’s branch model — including Neon AI Gateway beta — without competing for the database noun.

Neon owns database state (and, in beta, a branch-scoped AI Gateway). Metrecept owns exact-replay inventory. Same CI job. Same PR slug. Clear peers.

Metrecept — middleware governance
  • Dashed = PR-scoped peer, ephemeral for this job
CI job · PR 842Metreceptexact-replay inventoryX-Ohm-Cache-Tree: pr-842Neon previewDB + AI Gateway betapreview branch · PR 842Same slug. Compose peers. Promote on merge.

Neon branches state (and, in beta, the model path). Metrecept branches exact-replay inventory — middleware governance on mechanical repeats.

Fence

ProductBranchesNoun
NeonDatabase state (+ AI Gateway endpoint per branch in beta)Preview connection / branch
MetreceptExact-replay inventoryX-Ohm-Cache-Tree

Neon does not replace Metrecept. Metrecept does not replace Neon. A preview database will not isolate mechanical prompt HITs. A cache tip will not version your schema. Neon AI Gateway routes models on the branch; Metrecept meters exact-replay crossings on the tip.

Ambient note: if you already create a Neon branch per PR, adding X-Ohm-Cache-Tree: pr-$NUMBER is usually the smallest change that stops preview prompts from warming production inventory.

One-slug discipline

Use the same slug for both peers:

pr-${PR_NUMBER}
  • Neon preview branch: pr-842
  • Metrecept tip: pr-842
  • On merge: handle Neon branch lifecycle as you already do; Promote the Metrecept tip into main

Drop-in CI starter

Two workflows cover the loop end to end:

WorkflowWhenWhat
ohm-preview.ymlEvery PREnsure tip pr-N; smoke chat with the tip header
ohm-promote-on-merge.ymlPR mergedPOST /v1/cache/trees/pr-N/promote

Secrets: OHM_API_KEY. Optional var: OHM_API_URL (default https://api.withohm.dev).

Typical CI recipe

  1. Create or select a Neon branch for app schema and data under test (and AI Gateway on that branch if you use the beta).
  2. Fork or select a Metrecept tip named after the PR (pr-842).
  3. Point the app at the Neon connection string; point agents and tests at api.withohm.dev/v1 with X-Ohm-Cache-Tree: pr-842.
  4. On merge: Promote the Metrecept tip; handle Neon branch lifecycle separately.

On green, Promote is inventory hygiene — not a second bill:

export DATABASE_URL="$NEON_PREVIEW_URL"
export OHM_TIP="pr-${PR_NUMBER}"
export OHM_API_URL=https://api.withohm.dev

curl -sS -X POST "$OHM_API_URL/v1/cache/trees" \
  -H "Authorization: Bearer $OHM_KEY" \
  -H "Content-Type: application/json" \
  -d "{\"name\":\"$OHM_TIP\"}"

curl -sS "$OHM_API_URL/v1/chat/completions" \
  -H "Authorization: Bearer $OHM_KEY" \
  -H "Content-Type: application/json" \
  -H "X-Ohm-Cache-Tree: $OHM_TIP" \
  -d @prompt.json
curl -sS -X POST "$OHM_API_URL/v1/cache/trees/${OHM_TIP}/promote" \
  -H "Authorization: Bearer $OHM_KEY" \
  -H "Content-Type: application/json" \
  -d '{}'

Why this is an upgrade alongside AI Gateway beta

Neon AI Gateway already gives one credential and a branch-scoped model path. Metrecept adds a receipted record on repeats: exact-match Redis inventory, tip isolation, Promote-on-merge, HIT meters, and signed receipts. Labs stay labs. Neon stays the backend center. Metrecept rents the pipe on mechanical repetition.

Related