Platform Context — session-start load anchor
Platform Context
Section titled “Platform Context”Purpose. The single load-at-session-start anchor for the Canonical platform. It holds the current facts and points to the authoritative runbooks. Keep it short and current — if a fact here is wrong, fix it here first, then propagate.
DB topology — FOUR databases
Section titled “DB topology — FOUR databases”| Environment | PROJECT_REF | Notes |
|---|---|---|
| Platform prod | zjqbrdctesqvouboziae | |
| Platform staging | rbwqewalexrzgxtvcqrh | .env.local / local-dev + CI target (PLATFORM_PROJECT_REF) |
| client prod | rovrymhhffssilaftdwd | PROD_PROJECT_REF |
| client staging | turayklvaunphgbgscat | STAGING_PROJECT_REF |
-
Platform and client staging DBs are Supabase persistent staging branches of their respective prod project, accessible via
supabase link --project-ref {PROJECT_REF}- they won’t appear vialist_projects. -
.env.localtargets Platform stagingrbwqewalexrzgxtvcqrh. Prod-targeted CLI work opts in via--env=prod; CLI scripts take--env={prod,staging,auto}. -
Squash-baseline caveat (Retro S410, corrected S493): the
20260617130000squash captures schema only — NOT seeded data rows, NOT ACLs. The data half still needs an explicit step (supabase db push --include-seed). The ACL half does not: forward migrations in the chain carry it (…id115_api_schema_anon_revoke,…id61_dr035_default_privileges,…id347_anon_lockdown), and S493 proved a from-zero replay of all 106 migrations lands the DR-035 invariant unaided — 0 anon table grants, exactly two anon-EXECUTEset_configfunctions, byte-identical to both Platform DBs. Verify as a spot-check; never re-apply ACLs by hand. -
After any prod/client
db push, re-link back torbwqewalexrzgxtvcqrh(drift hazard;cat supabase/.temp/project-refbefore every push).
Deploy surfaces
Section titled “Deploy surfaces”- Platform staging Vercel host:
canonical-platform-git-staging-tw-group.vercel.app - Two-server split (id-127): a dedicated Platform VPS physically separate from the
client box, ONE Coolify control-plane (on the Platform box) managing both servers; reuse
the existing
Production/StagingCoolify creds (no new GH environment); distinguish by server + app UUID + deploy input. - GH environments (OQ-2 / id-95): ONE public repo; the Platform owns the GH
Production/Stagingenvironments; each client gets its own Vercel + Supabase project (config in the client’s Vercel env +tenant_config). - Pipeline ingress — the platform pair is PRIVATE (S558, 2026-08-12):
ca-platform-pipeline-staging(S555) andca-platform-pipeline(S558) on Server B sit behind a Cloudflare Tunnel + Access service-token policy — proxied tunnel CNAME, and Server B’s inbound 443+80 CLOSED at the VPS firewall. App→pipeline calls sendCF-Access-Client-Id/-Secret(CF_ACCESS_*in Vercel Production+Preview and the GHProduction/Stagingenvironments);PIPELINE_TRIGGER_SECRET/EXTRACT_API_TOKENare unchanged as the second factor; the external/healthmonitor is retired (DR-046). The two CLIENT pipeline hosts on Server A are still public — cutover ordered 3rd/4th. Procedure/rollback:runbooks/private-ingress-cutover.md. - Raindrop = local dev/CI eval tooling only (
localhost:5899, zero egress — enforced inlib/eval/graduation.ts).
Key context anchors — read before re-deriving
Section titled “Key context anchors — read before re-deriving”High-value prior-context records that carry settled platform facts. Read these instead of re-investigating from scratch:
| Anchor | Holds | Read via |
|---|---|---|
okf-platform/corpus-reframe-review.html | THE corpus-model authority. R1 the evidence reframe (sources are evidence streams w/ per-binding retention class; supersedes the “client source files are the canonical content store” framing wherever it appears); R2 two gates — the light binding gate (connect a source, assign retention class, DR-020 restated) vs the authoritative knowledge-admission gate (promotion + dedup + confidence; ontology linter + publish gate). Read R1/R2 before naming anything in the source lifecycle | the doc itself (initiatives/core-product/knowledge-base-foundations/okf-platform/) |
reference/entity-glossary.md | Canonical core-entity definitions (application_type, workspace-as-legacy, form, q_a_pair, containment chain), split out S504 R6 to be reused verbatim. Note: the source-lifecycle terms (binding gate, knowledge admission, retention classes) are NOT yet in it — see id-408 | the doc itself |
reference/platform-direction.md | Mission, five guiding principles, v1 shape. Names the four retention classes (keep-and-watch / ingest-once / live-connected / external-referenced) and uses knowledge-admission gate correctly | the doc itself |
reference/deployment-architecture.md | THE durable client+platform deployment topology: servers, public/private surface table, OKF three-layer model, corpus admission, goose, per-client rollout | the doc itself |
| Retro S410 | platform config: the squash-baseline schema-only gap, id-127 two-server amendment, OQ-2 GH-environments resolution, api anon-revoke posture | src/content/docs/ledgers/retros/S410.md |
Diary S428 (wing_claude, 2026-06-28) | OKF record-model: the four-DB correction (origin), L-raw/L-records/L-concepts model, {131.20} search redesign | mempalace_diary_read agent=claude wing=wing_claude (find the 2026-06-28 entry) |
| reference_items ≠ source_documents (key pivot; owner, S511 board) | Reference items and source documents are SEPARATE concepts — the pivot gave references their own nav surface + detail pages. reference_items.source_document_id is a live provenance FK (NOT NULL, ON DELETE RESTRICT; reference_ingest() mints a 1:1 sd row by design), NOT identity coupling — and pre-launch, “it’s enforced in prod” carries zero architectural weight. Whether a reference should mint a synthetic sd row at all is id-364 F1’s open question. | specs/id-370-unanswered-question-routing/RESEARCH.md §5; pivot lineage in specs/id-110-url-import-reference-items/ + 20260708160000_id139 migration |
Evidence precedence — docs outrank code (added S515, owner directive)
Section titled “Evidence precedence — docs outrank code (added S515, owner directive)”The reference set, runbooks, platform-direction.md, the OKF doctrine and
corpus-reframe-review.html were deliberately corrected so the platform has a
north star, precisely because the codebase is known to be inaccurate. Large
parts of the tree are half-repointed work that later sessions are fixing.
Therefore, when deciding what is correct:
- Ratified docs are the authority.
corpus-reframe-review.html(R1–R8), the Decision Register,platform-direction.md,reference/entity-glossary.md, the OKF doctrine, then the task’s own spec chain. - Code is evidence of what exists, never of what is correct. In rebase-class work (initiative 12 especially) an existing reference is the symptom under investigation, not proof the thing is right.
- These readings are NOT evidence of correctness — each produced a wrong
verdict in S515, and each is a trap that looks like diligence:
- “N production callers import it, so it is live.” Many callers is exactly what incomplete repointing looks like. Check whether the callers were migrated — S515 found one module with 18 callers of which one passed the current fields.
- “There are rows in the DB, so the write path works.” Platform staging AND prod are internal dev environments pre-launch. A populated column proves nothing; an empty one may be merely unexercised, not dead.
- “Grep found nothing, so the design never existed / was abandoned.” Absence is the thing being fixed. Confirm intent against the docs before concluding.
- “Every assertion binds a live table, so this spec matches the model.” A test can bind live tables while asserting a retired concept. Check the naming and framing, not only the identifiers.
- A term with no glossary entry is a drift risk. Definitions belong in
reference/entity-glossary.md, reused verbatim (S504 R6). A coinage that only ever appeared in a session working note is not vocabulary — S515 found one such term in 10 code sites and 0 decision records.
Applies to sub-agent dispatch too: a brief that cites only task files, specs and code will reproduce the codebase’s errors. Cite the north-star docs and this rule.
Not every doc is a north-star doc (owner ruling, S516)
Section titled “Not every doc is a north-star doc (owner ruling, S516)”DR-104 says ratified docs outrank code. It does not say every document in the docs-site is current. Two large families are stale, and S516 produced two wrong verdicts in one session by citing them:
initiatives/core-product/canonical-pipeline/intended-architecture/— stale, EXCEPT01-vision.md. Owner, S516: “the intended-architecture docs, except 01-vision.md, are now incredibly out of date.” That includes09-diagrams.mdand02-data-flow.md. Note09-diagrams.mdis doubly weak as evidence: its own §1 boundary 1 is “no new schema or flow content” and it sources column lists fromsupabase/types/database.types.ts— an ERD traced from the generated types shows what EXISTS, so citing it is DR-104’s code-evidence trap one step removed.07-collapse-list.mdis the qualified case — do not dismiss it wholesale. Owner, S516: “collapse-list was originally accurate, so most of what it retires is correct, but I do think some items flipped later in the project.” Read it asymmetrically:- Its
[RATIFIED-RETIRE]rows are usually still sound — it is a reasonable starting citation for a retire, subject to checking whether that specific item flipped in a later ruling. - Its retain / NOT-COLLAPSING entries are the ones most likely to have flipped, and they carry no column-level detail — “the table is on the not-collapsing list” says nothing about which of its columns are in the target shape.
- Absence from it is not evidence of anything — that is the standard absence trap, listed above.
- Its
canonical-pipeline/phase-0-investigation/— the whole OQ-resolution chain (feedback-findings-review.md,phase-b-prerequisite-*). Historical record of how decisions were reached, not current authority.- Any spec or invariant belonging to a task id below ~130 is presumed stale unless a current document re-affirms it. Owner, S516: “if a reference task id is pre-130, it’s likely stale context.”
Read them for how the current state arose; never cite one as authority.
Two failure shapes, both seen in S516 on the same question:
- Following a citation instead of opening it.
phase-b-prerequisite-1-verification.mdstates “RESOLVED-RETAIN perfeedback-findings-review§5.2.1”. That document saysDEFER-COCOINDEX— it does not contain the ruling attributed to it. When a verdict rests on “doc A says X per doc B”, read doc B. - Retain-the-table read as retain-the-shape. A closing ruling can keep a table while enumerating a shape that excludes the columns you are asking about. Check what the ruling enumerated, not just its verdict word.
Read-never-written: which half is stale? (S516)
Section titled “Read-never-written: which half is stale? (S516)”A column with readers and no writer has two possible diagnoses, and the default matters — S516 found three instances and they did NOT all resolve the same way.
The discriminator: does a current ratified writer exist that COULD have written the column and did not?
- No such writer → the reader is right and the writer is missing. Wire it.
(id-345 catalogue writer; id-407
source_documents.uploaded_by.) - Yes, and it deliberately omits the column → the reader outlived its model.
“Wire the writer” is the wrong default; retiring the read surface may be right.
(id-409
source_documents.parent_id/version: the ratified admission writerresolve_or_mint_source_identityomits both, and because identity isuuid5(NS,'sd:'||rel_path)withON CONFLICT (id) DO NOTHING, a changed file at the same path resolves to the SAME row — the chain is unreachable by construction, not merely unwritten.)
Zero population never distinguishes the two. The writer’s column list does.
For pipeline/corpus work the current authority is:
reference/cocoindex-pipeline.md, the cocoindex skill (scripts/.claude/skills/cocoindex/),
corpus-reframe-review.html, the OKF doctrine, the Decision Register, and this
page. The owner’s standing frame: “the correct approach is using cocoindex
correctly” — a high-quality working pipeline aligned to cocoindex, not a KH-side
reimplementation of what cocoindex already provides.
The nightly has never walked the Platform corpus (owner ruling, S522)
Section titled “The nightly has never walked the Platform corpus (owner ruling, S522)”Two facts that will otherwise be re-derived every time someone opens the cocoindex lane. Both are load-bearing and neither is visible from the workflow file alone.
1. The walked corpus is the wrong corpus, not merely in the wrong place.
cocoindex-nightly.yml docker cps form-extraction fixtures and walks only what
individual tests stage. It has never seeded the vendored synthetic Platform
corpus (scripts/cocoindex_pipeline/fixtures/platform-corpus/) as its baseline,
so the lane has not been dogfooding the Platform E2E path at all — which is
the entire reason the lane exists. Owner, S522:
Pointing to
docs/testing/was incorrect, and whilst repointing toform-extractionisn’t the correct approach, it’s also what led to the finding that neither location was correct, and pointing at the actual synthetic platform corpus had been missed entirely.
The best-practice mechanism already exists and should not be re-invented:
deploy/onprem/sync-platform-corpus.sh (ID-134) treats the vendored tree as the
single source of truth and stages it onto /cocoindex-state/corpus via
rsync → docker cp, after which COCOINDEX_SOURCE_PATH points at it and a
supervised /walk ingests it. Owned by id-412; grounding in
specs/id-412-cocoindex-nightly-reliability/RESEARCH.md.
2. docs/testing/ no longer exists. It moved to
scripts/tests/fixtures/form-extraction/templates/ (b9c55abf, 90cc3b03,
eb9ccac9), and c64be60b then aligned the census gate and verify_driver
dest paths to a flat verify/<basename> scheme. Any doc, spec or task citing a
docs/testing/ path is stale — id-406’s entire AC set was, and had to be
re-grounded. The relocation is not the fix for (1) and must not be read as
progress on it.
Corollary for the corpus-content distinction, which is the shape of several live
defects: a blank extraction form (form-extraction/templates/**) is not a
content document. Tests that need prose — entity extraction, chunking,
MIME-coverage — must consume Platform-corpus content docs; the form fixtures
belong only to tests that genuinely exercise form extraction.
Runbook and References index (progressive disclosure)
Section titled “Runbook and References index (progressive disclosure)”Authoritative depth lives in the runbooks and reference files — follow the pointer rather than duplicating.
Current
-
Deployment architecture (client + platform topology) →
reference/deployment-architecture.md -
CI topology + failure modes →
runbooks/ci.md -
GH environments →
runbooks/github-environments.md(note: §8 “fork-per-client” model is superseded by the id-95 single-public-repo model) -
Local development (default-DB topology refreshed S436) →
runbooks/local-development.md -
On-prem B1 deploy →
runbooks/onprem-b1-deploy.md -
Private pipeline ingress (Cloudflare Tunnel + Access; DR-046) →
runbooks/private-ingress-cutover.md -
Staging refresh →
runbooks/staging-refresh.md -
Secret rotation (pipeline + app surfaces) →
runbooks/secret-rotation.md -
Platform → client promote →
runbooks/platform-to-client-promote.md -
Per-client release pinning →
runbooks/per-client-release-pins.md -
Client app deploy →
runbooks/client-app-deploy.md -
Python ingestion pipeline built on cocoindex →
reference/cocoindex-pipeline.md -
The three-layer knowledge model (OKF) →
initiatives/core-product/knowledge-base-foundations/okf-platform/bundle-doctrine.md+initiatives/core-product/knowledge-base-foundations/okf-platform/corpus-reframe-review.html -
Ontology →
initiatives/core-product/knowledge-base-foundations/ontology/,initiatives/core-product/knowledge-base-foundations/okf-platform/ontology-sync.mdanddocs/ontology/ -
Agentic approach →
reference/platform-agents-architecture.mdandspecs/id-71-ai-tooling/
Known-stale (do not trust without verifying against the live state):
reference/_archive/state-of-the-product.md— archived S504 (R8); historical platform context only.