diff --git a/.claude/board/INTEGRATION_PLANS.md b/.claude/board/INTEGRATION_PLANS.md index 4b714874..cc695fbb 100644 --- a/.claude/board/INTEGRATION_PLANS.md +++ b/.claude/board/INTEGRATION_PLANS.md @@ -1,3 +1,7 @@ +## 2026-06-26 — ogar-sink-in + consumer-bridge removal (medcare-bridge → UnifiedBridge → delete) + +Plan: `.claude/plans/ogar-sink-in-and-consumer-bridge-removal-v1.md`. **Codifies the sink-in layering + sequences the final bridge deletion.** Grounded finding: the migration is **~90% shipped** — all 6 per-consumer bridges (incl. `medcare_bridge.rs`) are already `#[deprecated] type FooBridge = UnifiedBridge` aliases over one generic harness; `docs/CONSUMER-BRIDGE-DEPRECATION.md` (OGAR#95) is the live doctrine ("nothing removed; deletion lands after consumers migrate"). **Sink-in decision (§2):** OGAR owns the *meaning* (PortSpec / codebook / ClassView / ActionDef / ontology); `lance-graph-contract` owns the zero-dep *wire* mirror (the parity guard, never a dep); `lance-graph-ontology` owns the OGIT registry; `lance-graph-rbac` owns grants keyed on the **shared lo-u16 concept** (render hi-u16 never gates RBAC — the CLASSID-RBAC-KEYSTONE-SPEC); `lance-graph-ogar` keeps only the `UnifiedBridge

` mechanism + `parity`. **medcare recast (§3):** the medcare domain dissolves into **reusable patterns** (the shared `HealthcarePort::class_id` / convergent codebook surface in OGAR) **+ domain-specific Ontology Schema enrichment** (Healthcare `0x09XX` / FMA-V3 `0x1000_0A01` / CPIC-V3 `0x1000_0E00` in OGIT) — never a bridge in the spine. **Deliverables:** D-SINK-1 ratify layering → D-SINK-2 migrate consumers off `MedcareBridge` (cross-repo, Iron Rule 5) → D-SINK-3 delete the 6 aliases (scope-lock tests ported first) → D-SINK-4 reconcile the two `WoaBridge` identities → D-SINK-5 sink the medcare ontology (the cross-repo codebook-mint arc, `ISS-OGAR-GENETICS-MIRROR-PENDING`). **Gated:** no deletion before consumers migrate (OGAR#95); intersects the operator-gated classid realign (D-OVC) + Canon:Custom. Extends CONSUMER-BRIDGE-DEPRECATION + ogar-vocab-contract-codebook-migration-v1; does not supersede them. Doc-only. PROPOSED. + ## 2026-06-25 — soa-value-tenant-migration v2 SEQUENCING (operator-locked; identity→V3, then V3-tenants) Plan: `.claude/plans/soa-value-tenant-migration-v2.md`. **Operator-locked ordering** for the migration the v1 BRIEF opened + the v1-HARVEST inventoried: **ONE migration, TWO ordered phases — Phase 1 identity→V3 (key-side), Phase 2 V3-shaped value tenants (value-side).** Identity-first is **forced, not chosen**: OGAR #128's envelope parser resolves `tail_variant` (key shape) UPSTREAM of `value_schema` (tenant shape), so the tenants cannot be shaped to a V3 geometry the key does not yet express (the key is the coordinate system; tenants are read *through* it; the Phase-2 `helix-place‖CAM-PQ` facet is a *reflection* of the V3 part_of/is_a key). **Phase 1** = OGAR-registry + envelope-parser wiring: a leading-`1` generation marker in the HIGH (custom) u16 → V3 `tail_variant`, canon `0xDDCC` low-u16 preserved (OSINT `0x0000_0700 → 0x1000_0700`; the earlier `0x1007` low-half form is **rejected** — it corrupts the domain byte, Codex-P1), **coexist-by-classid** (legacy zero-prefix classids keep their current tail — **V1** default or **V2** `new_v2`/`guid-v2-tail`-minted; RESERVE-DON'T-RECLAIM ⇒ zero V1/V2-corpus re-mint, layout-preserving), grade `[H]` gate **F-update**. **Phase 2** = the harvest (contained facet + 8 KEEP + 2 DEFER, F-1/F-code; the §5 body still gated on the two 5+3 panels). **Payoffs:** identity-first migrates the one shared `entity_type≡class_id` anchor to V3 *before* the A↔B reconciliation (Phase 2 reconciles in V3 coords, no redo), and dissolves the harvest's scope question (harvest = the Phase-2 input). **Watch:** Phase 1's substance IS the OGAR casing-miss gap (harvest §6.1) — the corrective `/home/user/{OGAR,MedCare-rs}` sweep gates Phase-1 start, not optional polish. Doc-only. On `claude/serene-mayer-1a09he` (rides with the harvest to main). diff --git a/.claude/handovers/2026-06-26-ast-address-to-next-session-capstone.md b/.claude/handovers/2026-06-26-ast-address-to-next-session-capstone.md new file mode 100644 index 00000000..c622c6f4 --- /dev/null +++ b/.claude/handovers/2026-06-26-ast-address-to-next-session-capstone.md @@ -0,0 +1,210 @@ +# Handover Capstone — AST-as-(part_of:is_a) / OGAR-ERP-stdlib arc → next session + +> **From:** session on `claude/medcare-bridge-lance-graph-wmx76z` (2026-06-26) +> **To:** next session picking up the OGAR-ERP / V3 AST-address arc +> **Status of the arc:** CONJECTURE captured + carrier verified; ONE empirical +> probe converts it to FINDING. No V3 *migration* was performed this session. +> **Companion handover (READ ALONGSIDE THIS):** the parallel CPIC/genome session +> (session `01TzqvDqbFRzyx17EkLKBoZF`) owns the V3 *identity* + genome-aligned +> track (PRs #614/#615/#618, the `q2/cpic` NARS prototype, the CYP2D6 +> activity-score falsifier). This handover owns the *"why" doc* track (#616/#617, +> ruff #29). Two halves of one arc — their CYP2D6 probe and my MedCare probe are +> complementary falsifiers of the SAME genome-/AST-as-address CONJECTURE. + +--- + +## 0. TL;DR (read this, then the mandatory reads) + +This session **did not write product code**. It (a) verified another session's +V3 alignment of a design doc, (b) consolidated a multi-layer architectural +thesis into one knowledge doc, and (c) scaffolded a C# harvester. The thesis: +**a transcode source's structural AST is stored AS the `(part_of:is_a)` GUID +address (shipped `FacetCascade`), making ERP construction in any consumer as +cheap as importing pre-minted OGIT class primitives + classaction pointers.** +The whole arc is CONJECTURE; the gate to FINDING is the **MedCare brick-3 probe** +(§6). Everything else is wiring, not research. + +**Single most important correction to inherit:** the carrier and minter are +already SHIPPED/built. Do not re-design them. The remaining work is *wiring* +(mint imported OGIT → codebook; merge the minter branch; run the probe). + +--- + +## 1. Mandatory reads to get up to speed (in order) + +1. **`.claude/knowledge/ast-as-partof-isa-address.md`** — THE doc this arc + produced (merged via #616, extended via #617). The full thesis + the three + honest boundaries. Start here. +2. **`.claude/knowledge/guid-canon-and-prefix-routing.md`** — the V3 GUID canon. +3. **`crates/lance-graph-contract/src/facet.rs`** — the SHIPPED carrier + (`FacetCascade` = `facet_classid(4) | 6×(8:8) = 16 B`, content-blind, + `(part_of:is_a)` is one consumer projection). Four SIMD lanes. +4. **`crates/lance-graph-contract/src/canonical_node.rs`** — `TailVariant::V3`, + `mint_for`, `CLASSID_OSINT_V3 = 0x1000_0700` (the one wired V3 exemplar). +5. **`crates/lance-graph-contract/src/class_view.rs`** — the static-shape → + dynamic-ClassView → askama ladder (XML/XSD/XSLT analogy), C2/N3 invariants. +6. **`crates/lance-graph-contract/src/ogar_codebook.rs`** — the import surface + (`canonical_concept_id`, `render_classid_for_concept`). +7. **`.claude/knowledge/ogar-consumer-preflight.md`** + **`core-first-transcode-doctrine.md`** + — the pull-don't-reconstruct iron rule + the Core-first doctrine. +8. **OGAR repo:** `docs/OGAR-AST-CONTRACT.md` (the THINK arm `Class` / DO arm + `ActionDef`+`ActionInvocation`+`KausalSpec` IR) and + `vocab/imports/ogit/` (complete OGIT, ~1,940 TTL, IMPORTED). + +--- + +## 2. What I shipped this session (all PRs) + +| PR | Repo | State | Content | +|---|---|---|---| +| **#616** | lance-graph | **MERGED** | `ast-as-partof-isa-address.md` (the *what*) + I aligned another session's V3 correction onto it. Now on `main`. | +| **#617** | lance-graph | **OPEN** | The *why*: three-layer thesis + laws-as-patterns + OGIT-imported + DO-as-classaction-pointer + the 2 MB headline. Branch `claude/medcare-bridge-lance-graph-wmx76z`, HEAD `e34a7fa`. **Docs only**, safe to merge independently. | +| **#29** | ruff | **OPEN** | `ruff_csharp_spo` — Roslyn (.NET) C#→SPO harvester (brick-3 input). **CI-gated, not locally verified** (no .NET SDK here; proxy blocks workspace `cargo check`). | + +**No code/contract surface was changed in lance-graph.** `#617`'s diff is one +knowledge file, +186 lines. + +--- + +## 3. The thesis in one screen (so you don't re-derive it) + +- **Layer 1 — rails-shaped semantic AST at *assembler* cost.** `facet.rs`'s four + SIMD lanes ARE the LSP ops (`definition`=`vpcmpeqd`+`vmovmskps`, + `typeHierarchy`=`lo_chain` `vpxor`+`tzcnt`, `documentSymbol`=`hi_chain`, + ancestry=GFNI Morton). Only the *declarative* (rails) class body flattens to + fixed-width tiles; an imperative syntax tree does not. +- **Layer 2 — static OGAR / dynamic ClassView / askama.** One ClassView projects + the `N × 6×(part_of:is_a)` SoA two ways: row→typed **view** (THINK→askama) AND + row→conditional **classaction** (DO→`ActionDef` under `KausalSpec` guard). + C2 (presence≠semantics) + N3 (append-only positions) = a row view that evolves + 17 years (Redmine) without breaking persisted rows. +- **Layer 3 — OGAR as importable ERP-LAW primitives + lance as compiler.** The + primitives are *laws/regulations* (universal, reusable), not CRUD: + `ObjectView`=required fields, `ActionDef`/`KausalSpec`=rules. Content stays + with the consumer; only the pattern is shared. `ogar_codebook` is the import + surface. **DO in the consumer = a classaction POINTER** (`classid → ActionDef` + via `ActionInvocation` DTO) — exactly the OGAR consumer doctrine ("classid is + pure address; magic at the resolution target"). +- **Headline (CONJECTURE):** OpenProject + Odoo as ~2 MB of GUID-encoded + `(part_of:is_a)` vs ~20 MB / ~250K LOC (~10×). Dimensional check: 16 B/node ⇒ + 2 MB ≈ 131K nodes — credible for both ERPs' structural skeleton. + +--- + +## 4. V3 state — what EXISTS vs what I did (IMPORTANT, do not misattribute) + +**I performed NO V3 migration this session.** I only *read/verified* the shipped +V3 surfaces to ground the docs. The V3 mints shipped in OTHER sessions +(#613/#614/#615, then **#618** which landed AFTER my #617 merged): + +| domain | classid | status (as of #618, 2026-06-26) | +|---|---|---| +| **OSINT-V3** | `0x1000_0700` | wired (first exemplar, #613-615) | +| **FMA-V3** | `0x1000_0A01` | **wired** (#618 — `ReadMode::FMA_V3`) | +| **CPIC-V3** | `0x1000_0E00` | **wired** (#618 — Genetics domain `0x0E` operator-allocated; `ReadMode::CPIC_V3`) | + +**#618 "Phase 1 V3 set complete"** — OSINT + FMA + CPIC all minted, Genetics +domain `0x0E` allocated. So CPIC/FMA/OSINT are ALL wired now (none by me). + +The V3 marker lives in the **HIGH (custom) u16**; canon/domain in the **LOW u16** +(`classid_concept_domain` routes on the low half — a deliberate Codex-P1 fix; the +low-half `0x1007` alternative was rejected as domain `0x10`=Unassigned). **Open +operator decision: "Canon:Custom"** — whether to flip canon to the high half +(would require re-pointing `classid_concept_domain`). Not settled; flagged in the +doc, not hardened. + +--- + +## 5. The minter (brick 2) — BUILT and verified, on an unmerged branch + +- **`lance_graph_contract::facet_mint`** — `mint_facets(&[NodeDecl], facet_classid) + -> Result, MintError>`. Deterministic sibling ranking, + roundtrip-lossless, `MintError::{DuplicateId, UnknownParent, DepthOverflow(>6), + FanoutOverflow(>256), Cycle}`. `NodeDecl{id, part_of_parent, is_a_parent}` is + producer-agnostic (C++/C#/Ruby/Python harvests all fill it). +- **Branch `claude/serene-mayer-1a09he`, commit `360fc720`. NOT merged to main.** +- **I ran its 8 tests myself: 8 passed**, in the zero-dep `lance-graph-contract` + crate (no ndarray/burn needed). + +--- + +## 6. THE critical path — brick 3 (the probe that converts CONJECTURE→FINDING) + +`ruff_csharp_spo` harvest (MedCare C#) → `facet_mint` → lance SoA → `typeHierarchy` +/`definition` LSP query, **with `AdaWorldAPI/MedCareV2` as the parity oracle**. +It produces the first real numbers for: (a) bytes-of-(part_of:is_a) vs source LOC +(the 10× claim), (b) lossless round-trip of the class graph, (c) query-as-asm-op. + +**Its gates are wiring, not research — in order:** +1. **Merge `serene-mayer` (`facet_mint`)** into main (verified green). +2. **Mint imported OGIT → `ogar_codebook`** — the source is ALREADY in OGAR at + `vocab/imports/ogit/` (~1,940 TTL incl. `NTO/{Audit,Compliance,Legal,Security}` + + `SDF/Automation` = HIRO DO-arm source). The remaining step is the + **source→codebook wire** (`facet_mint` → publish), NOT harvesting. +3. **Reserve one `facet_classid`** in the value-tenant migration's codec selector + for the AST `6×(8:8 part_of:is_a)` reading (a ClassView reading, NOT a new + `ValueSchema` variant — see `soa-value-tenant-migration-v1-harvest.md §5.1`). +4. Then run the MedCare probe; needs a .NET 8 SDK to run the Roslyn harvester. + +--- + +## 7. Honest caveats / corrections I made (inherit these — don't repeat them) + +- **`burn` is NOT a build blocker.** An earlier claim ("workspace compile blocked + by proxy 403 on ndarray's `burn` submodule") was **wrong** — `burn` is an + *excluded* workspace member (`ndarray/Cargo.toml:375`) with zero code coupling. + The minter's crate (`lance-graph-contract`) is zero-dep and builds standalone. +- **The local `owl` repo is NOT W3C OWL.** It's camel-ai's "Optimized Workforce + Learning" multi-agent framework (arXiv:2505.23885). The operator's "OWL↔OGIT + bijective-lossless" result refers to W3C OWL (the ontology standard); I cited it + **attributed, not re-verified** (the converter is plausibly OGIT's + `bin/ogit-tools-jar-with-dependencies.jar`, unread). +- **Everything in the doc is CONJECTURE.** The carrier is shipped, but no + end-to-end measurement exists. Keep the label until the probe runs. +- **Sync-first discipline:** every PR this session verified `HEAD..origin/main` + empty + `diff --stat origin/main..HEAD` showing only intended files BEFORE + pushing (a prior arc orphaned commits by not doing this). Keep doing it. +- **Workspace iron rules in play:** OGAR — no model identifier in artifacts, no + German PII labels, no Bash grep/sed/tail/head/awk (use Grep/Read tools). + Consumer side — pull via `*Port::class_id` / `canonical_concept_id`, NEVER + construct a `*Bridge` or copy the codebook. + +--- + +## 8. Concrete next actions (pick up here) + +1. **Decide:** merge #617 (docs, safe) — or leave for review. +2. **Brick-3 wiring step 1:** merge `claude/serene-mayer-1a09he` (`facet_mint`). +3. **Brick-3 wiring step 2 (highest leverage):** mint OGIT-source→`ogar_codebook`. + The input (`OGAR/vocab/imports/ogit/`) is already in OGAR. **CAVEAT (per the + companion handover's `ISS-OGAR-GENETICS-MIRROR-PENDING` + + `E-CODEBOOK-MINT-IS-A-CROSS-REPO-ARC`): this is a CROSS-REPO arc, not a local + wire** — minting a concept moves OGAR `ogar-vocab` + the contract `CODEBOOK` + mirror + lance-graph-ogar `parity::domains_agree` *together*, in one coordinated + change. Don't push a half-mint. It still produces the first real byte-size + numbers for the 10× claim — just plan it as the cross-repo arc. +4. **Decide the open gate:** the "Canon:Custom" classid half-order. **Now + UNBLOCKED** (the full V3 set is minted, #618) but **must be done ONCE, + atomically, over the COMPLETE V3 set** (OSINT+FMA+CPIC) — a half-flipped corpus + mis-routes (`I-LEGACY-API-FEATURE-GATED`). Operator call; reuse-clustering + argues canon-high, but it collides with the shipped low-half domain routing. +5. **Board-hygiene debt (mine — owed):** #616/#617 shipped the knowledge doc + + findings WITHOUT the same-commit board updates the rule requires. Owed: + `EPIPHANIES.md` entry for the three-layer thesis + `PR_ARC_INVENTORY.md` rows + for #616/#617 + a `LATEST_STATE.md` Contract-Inventory line. **Fold into the + next PR** (the companion session also has #614/#615/#618 PR_ARC rows + outstanding — batch them) — do NOT push a standalone board commit to main. +6. **Optional:** verify ruff #29 in CI (needs network + .NET SDK). + +--- + +## 9. Coordinates + +- lance-graph branch: `claude/medcare-bridge-lance-graph-wmx76z` (HEAD `e34a7fa`, + synced FF to `main` which includes #616 at `b7eb02c`). +- minter: `claude/serene-mayer-1a09he` @ `360fc720` (unmerged). +- ruff branch: `claude/medcare-bridge-lance-graph-wmx76z` (PR #29, scaffold @ `0f463f2`). +- OGIT-in-OGAR: `OGAR/vocab/imports/ogit/` (~1,940 TTL). +- Operator note (not code): MedCare Railway deploy still binds `:3000` because a + Railway **PORT service variable** overrides `$PORT` — the operator must remove + it; the app correctly prefers `$PORT`. diff --git a/.claude/plans/ogar-sink-in-and-consumer-bridge-removal-v1.md b/.claude/plans/ogar-sink-in-and-consumer-bridge-removal-v1.md new file mode 100644 index 00000000..175855d4 --- /dev/null +++ b/.claude/plans/ogar-sink-in-and-consumer-bridge-removal-v1.md @@ -0,0 +1,236 @@ +# Plan v1 — OGAR sink-in + consumer-bridge removal (medcare-bridge → UnifiedBridge → delete) + +> **Status:** PROPOSED (doc-only plan). Most of the mechanical migration is +> **already shipped** (see §1); this plan codifies the *sink-in layering* and +> sequences the **final deletion** of the deprecated per-consumer bridges + +> the medcare domain's split into reusable-patterns vs ontology-enrichment. +> **Extends, does not supersede:** `docs/CONSUMER-BRIDGE-DEPRECATION.md` +> (OGAR#95) + `.claude/plans/ogar-vocab-contract-codebook-migration-v1.md` +> (D-OVC-*). **Gated on operator sign-off** for any classid realign + the +> deletion timing (consumer repos must migrate first). +> **Source of truth:** `AdaWorldAPI/OGAR` `docs/{APP-CLASS-CODEBOOK-LAYOUT, +> CONSUMER-MIGRATION-HOWTO, CLASSID-RBAC-KEYSTONE-SPEC}.md`. + +--- + +## 0. The ask (operator) + +1. Decide **what sinks into OGAR + lance-graph-ogar** vs **stays in + lance-graph-contract + lance-graph-rbac**. +2. Migrate **medcare-bridge → UnifiedBridge**, then **remove medcare-bridge + from lance-graph** — recasting it as **reusable patterns ↔ domain-specific + Ontology Schema enrichment** (the medcare domain is no longer a *bridge*; it + is a shared classid surface + a domain ontology that consumers pull + enrich). + +--- + +## 1. Current state (grounded — do NOT re-litigate) + +- **All 6 per-consumer bridges are already `#[deprecated]` one-line aliases** + over a single generic harness: `pub type MedcareBridge = + UnifiedBridge` (`crates/lance-graph-ogar/src/bridges/medcare_bridge.rs`). + Same for odoo/redmine/smb/openproject/woa. **No bespoke bridge struct remains.** +- **`UnifiedBridge`** (`bridges/unified.rs`) is the *internal* + mechanism — NOT deprecated. It is classid-driven: `entity(name)` does + `P::class_id(name)` first, falls back to the `OntologyRegistry` with a + `g_lock` namespace check. Everything per-port (`NAMESPACE`, `BRIDGE_ID`, + `class_id()`, `aliases()`) comes from the OGAR `ogar_vocab::ports::PortSpec`. +- **Two migration layers:** (a) struct → `UnifiedBridge

` alias = **DONE**; + (b) alias → direct `Port::class_id()` pull in consumers = **IN PROGRESS** + (deprecation warnings live; removal pending per OGAR#95 "deletion lands later"). +- **`bridge_scope_lock.rs`** locks the invariant any replacement MUST keep: a + namespace-locked bridge refuses cross-namespace resolution + (`BridgeError::{CrossNamespaceLeak, NotInScope}`). +- **HealthcarePort** lives in OGAR (`ogar_vocab::ports`); Healthcare codebook = + the `0x09XX` block (Patient `0x0901`); **FMA-V3 `0x1000_0A01` / CPIC-V3 + `0x1000_0E00`** minted in contract (#618). + +**Conclusion:** "migrate medcare-bridge to UnifiedBridge" is **already true**. +The real remaining work is **(b) finish the consumer pull-migration, then +DELETE the deprecated aliases**, and **codify the sink-in** so the medcare +domain lands as patterns + ontology, not a bridge. + +--- + +## 1.5 Grounding against the actual OGAR PR arc (#95–#142, read 2026-06-26) + +The OGAR side is **substantially shipped** — this plan sequences the *last mile*, +not a green field. Landmarks (all merged unless noted): + +- **#95** — `APP-CLASS-CODEBOOK-LAYOUT.md` + `APP-CODEBOOK-MIGRATION-PLAN.md` + + `CONSUMER-MIGRATION-HOWTO.md` + `CLASSID-RBAC-KEYSTONE-SPEC.md`. **The §2 table + below is #95's, verbatim:** `classid = [hi u16 APP/render][lo u16 concept]`; lo + = WHAT (RBAC + ontology + cross-app identity, shared), hi = WHOSE render + (ClassView/Askama, per-app). **Medcare worked example: `patient = 0x0005_0901`** + (app prefix `0x0005`, concept `0x0901`). The consumer migration is already + **wave-ordered** there: W0 OpenProject(`0x0001`)+Redmine(`0x0007`) → W1 WoA → + W2 SMB → W3 Odoo (delete the `od-ontology` fork) → W4 q2. **D-SINK-2 below + rides that wave plan; it does not invent its own.** Status `[H]`, minting gated + on the 5+3 codebook pass; `PROBE-KV-RENDER-NOSERDE` promotes `[H]→[G]`. +- **#96/#97/#98** — `billable_work_entry` 5-way convergence pinned; typed + `PortSpec::APP_PREFIX` + `render_classid` composition; `canonical_concept_name` + reverse map. (The "reusable patterns" surface = these.) +- **#105/#106/#109** — **OGIT 1:1 import** + `ogar-from-schema` producer; "OGIT + was already the symbol table." (The ontology-enrichment sink — D-SINK-5 — is + largely done at the *import* layer.) +- **#110/#111/#120/#126/#127** — codebook mints: AuthStore `0x0B`, PRODUCT/ + ACCOUNTING_ACCOUNT/PRICELIST/UOM (`0x02XX`), Automation `0x0C`, HR `0x0DXX`. +- **#114–#125 — the HIRO DO arm is SHIPPED.** #114 the **lossless-DO rule** + (`ActionDef` *points to* the body, never DDL-inline — `I-VSA-IDENTITIES` for + DO; shape `[G]`, execution CONJECTURE pending `PROBE-OGAR-DO-ARM-LIFT`); #119 + HIRO→`ActionDef` producer; #121 arago ActionHandler contract; #125 + **class-late-bound dispatch (ResolvingDaemon)** = the classaction pointer. + **DO arm + RBAC meet at `ActionHandler` (`auth_store 0x0B01`).** +- **#116/#117** — **FMA skeletal spine already minted** (bones as the clamped + convergence anchor, 3D-octree CRS, projection contract). *MedCare's FMA is not + just a classid to consume — OGAR already has the anatomy spine.* +- **#128** — value-slab facet closure + **classid-driven envelope parser** + (V2/V3, the gen marker). #130 ADR: **V3 as spine + polyglot transpiler**. +- **#131/#132/#138/#141** — `ogar-from-ruff` (Python/Odoo lift consuming + `ruff_python_spo`) + per-class transpile substrate + **`emit_csharp`/ + `emit_python` codegen**. *This is the downstream consumer of ruff #29's C# + harvest.* +- **#137 — the spine is the COMPILED `ClassView`, not SurrealQL.** One compiled + reader recombines all facet carvings (`6×(1:2)`/`4×(1:2:3)`/`3×(1:2:3:4)`), + compiled into the binary (not parsed, not a runtime interpreter); SurrealQL is + the storage membrane only. **§2's "dynamic ClassView" = a *compiled* reader; + Askama is the membrane emit.** (#135 closed: the same content relocated.) + +**Net:** the doctrine (#95), the reusable-pattern surface (codebook + PortSpec), +the OGIT import, the DO arm, FMA, and the transpiler are all merged. What this +plan still owns: the **lance-graph-side alias deletion** (D-SINK-3) gated on the +**#95 wave consumer-migration** (D-SINK-2), the **WoaBridge reconciliation** +(D-SINK-4), and the **codebook-mint completion** (D-SINK-5, the cross-repo arc). + +## 2. The sink-in layering — what lives WHERE (the decision) + +The iron principle (from the deprecation doctrine): **the agnostic spine +(`lance-graph-*`) does NOT own consumer ontology.** OGAR provides classid + +schema + grant; the consumer enriches locally. + +| Concern | Sinks into | Why | +|---|---|---| +| **PortSpec** (`HealthcarePort`, public-name→classid alias table, `NAMESPACE`, `BRIDGE_ID`) | **OGAR** (`ogar-vocab::ports`) | The per-consumer alias table is consumer ontology; OGAR is its home. lance-graph only re-exports it. | +| **Codebook** (`CODEBOOK` `0xDDCC`, `ConceptDomain`, `canonical_concept_id`, `LabelDTO`) | **OGAR Core** (authoritative) → **lance-graph-contract** (wire-compatible mirror, zero-dep) | Per D-OVC-1..4: contract hosts the zero-dep mirror; OGAR `ogar-vocab` is source-of-truth; the two agree on the `u16` LE wire (the parity guard). | +| **ClassView / ActionDef / Class** (THINK + DO arm IR) | **OGAR** (`ogar-class-view`, `ogar-vocab::Class`, `OgarActionProvider`) | The AR-shaped class is OGAR's unit; lance-graph-ogar re-exports + activates it. | +| **Domain ontology schema** (Healthcare/FMA/CPIC anatomy+pharma TTL) | **OGIT** (`AdaWorldAPI/OGIT`, imported into OGAR `vocab/imports/ogit`) → hydrated via **lance-graph-ontology** `OntologyRegistry` | TTL is the only ontology exchange format; OGIT is canonical; Lance is the runtime dictionary cache. | +| **UnifiedBridge harness + the 6 deprecated aliases + parity guard** | **lance-graph-ogar** (stays — it's the OGAR *activation* crate) | The harness is internal mechanism; the aliases are removed (§3); `parity::domains_agree`/`COUNT_FUSE` stays. | +| **`NamespaceBridge` trait + `OntologyRegistry` + namespace/error types** | **lance-graph-ontology** (OGIT spine) | The registry that bridges resolve against; tenant views are thin scoped reads over it. | +| **RBAC grants** (role→PrefetchDepth, predicate writes, action triggers) | **lance-graph-rbac** (depends only on contract) | Grants key on the **classid lo-u16 (shared concept)** — the render skin (hi-u16) is per-app and never gates RBAC. The CLASSID-RBAC-KEYSTONE-SPEC is the contract. | + +**Two one-liners that settle the boundary:** +- **OGAR owns the *meaning* (PortSpec/codebook/ClassView/ActionDef/ontology); + lance-graph-contract owns the *wire* (the zero-dep `u16`-LE mirror).** They + meet at the parity guard, never by dependency. +- **lance-graph-ogar is OGAR's *activation* surface inside lance-graph; it + re-exports OGAR and hosts only mechanism (UnifiedBridge) + parity — never a + per-consumer bridge.** + +--- + +## 3. The medcare-bridge → reusable-patterns ↔ ontology-enrichment recast + +medcare-bridge **dissolves into three already-existing homes** — nothing new is +built; the bridge file is deleted and its responsibilities are already elsewhere: + +| What medcare-bridge "was" | Becomes | Home | +|---|---|---| +| The classid alias table (`Patient→0x0901`, …) — the **reusable pattern** | `HealthcarePort::class_id(name)` | OGAR `ogar-vocab::ports` | +| The shared ERP concepts (billing, scheduling, docs) | the **same** convergent codebook ids every consumer resolves (`BILLABLE_WORK_ENTRY 0x0103`, …) — the cross-fork reuse | OGAR codebook (mirrored in contract) | +| The **domain-specific** anatomy/pharma meaning (Healthcare `0x09XX`, FMA-V3, CPIC-V3) — the **Ontology Schema enrichment** | OGIT TTL + the V3 classids, hydrated via `OntologyRegistry` | OGIT / OGAR; lance-graph-ontology cache | +| The `MedcareBridge` *type* + `NAMESPACE` const + co-located tests | **deleted** (consumer pulls `HealthcarePort::class_id`; integration coverage already in `bridge_scope_lock.rs` / `bridge_codebook_convergence.rs`) | — (removed from lance-graph) | + +**The recast in one sentence:** the medcare domain is **reusable patterns** +(the shared classid/codebook surface in OGAR) **plus domain-specific Ontology +Schema enrichment** (the Healthcare/FMA/CPIC ontology in OGIT) — pulled and +enriched by `medcare-rs`, never a bridge object in the agnostic spine. + +--- + +## 4. Deliverables (ordered; each gated on the prior) + +- **D-SINK-1 — Ratify the sink-in layering (§2).** *Decision, not code.* + Operator confirms the WHERE table (esp. the OGAR↔contract dependency + direction and the RBAC-keys-on-lo-u16 keystone). Gate for everything below. +- **D-SINK-2 — Migrate consumers off the `*Bridge` aliases — ride OGAR #95's + wave plan, don't reinvent it.** `APP-CODEBOOK-MIGRATION-PLAN.md` already orders + it: **W0** OpenProject(`0x0001`)+Redmine(`0x0007`) → **W1** WoA → **W2** SMB → + **W3** Odoo (delete the `od-ontology` fork) → **W4** q2. In each consumer: + replace `FooBridge::new(registry)?.entity(name)?` with `FooPort::class_id(name)` + and stamp the app prefix in the hi-u16 for the render classid (Medcare: + `patient = 0x0005_0901`). `medcare-rs`/`woa-rs`/`smb-office-rs` work, not + lance-graph. **Cross-repo approval gate** (Iron Rule 5). +- **D-SINK-3 — Delete the 6 deprecated aliases from `lance-graph-ogar::bridges`** + once D-SINK-2 lands for every consumer. Keep `UnifiedBridge

` (mechanism) + and the `Port` re-exports. Remove the per-module `NAMESPACE` consts + + `OPENPROJECT_CODEBOOK`/`REDMINE_CODEBOOK` compat shims. **Preserve the + `bridge_scope_lock` invariant** — port the scope-lock tests onto the bare + `UnifiedBridge

` / `Port::class_id` path so cross-namespace refusal is still + asserted (field-isolation discipline per `I-LEGACY-API-FEATURE-GATED`). +- **D-SINK-4 — Reconcile the two `WoaBridge` identities.** OGAR + `lance_graph_ogar::bridges::WoaBridge` vs legacy OGIT + `lance_graph_ontology::bridges::WoaBridge`. Decide: collapse onto the OGAR + PortSpec path or keep the OGIT-legacy one explicitly scoped + documented. +- **D-SINK-5 — Sink the medcare ontology enrichment.** Ensure Healthcare/FMA/CPIC + schema is in OGIT (`vocab/imports/ogit`) and mintable to the codebook — this + is the **cross-repo codebook-mint arc** (`ISS-OGAR-GENETICS-MIRROR-PENDING`, + `E-CODEBOOK-MINT-IS-A-CROSS-REPO-ARC`): OGAR `ogar-vocab` + contract `CODEBOOK` + mirror + lance-graph-ogar `parity::domains_agree` move **together**. Not a + local wire. + +--- + +## 5. Gates / risks + +- **No deletion before consumers migrate** — OGAR#95 is explicit ("nothing + removed; deletion lands later"). D-SINK-3 is blocked on D-SINK-2 across + woa-rs / medcare-rs / smb-office-rs (and any other PortSpec consumer). +- **Scope-lock regression** — deleting the aliases must not drop the + `CrossNamespaceLeak`/`NotInScope` guarantee; port `bridge_scope_lock.rs` onto + the survivor path first (test-before-delete). +- **Codebook parity** — any classid touch trips `COUNT_FUSE` / + `assert_codebook_parity`; the cross-repo mint (D-SINK-5) must keep OGAR and + the contract mirror in lockstep (the drift guard). +- **classid realign open item** — the merged-OSINT/FMA realign in + `ogar-vocab-contract-codebook-migration-v1` (D-OVC) + the Canon:Custom + hi/lo half-order are **operator-gated** and intersect this plan; do not + pre-empt them. +- **BBB barrier (medcare-rs)** — the consumer pulls `ogar-vocab::ports` (a + classid function), never a brain crate; `medcare-bridge` (the *consumer* crate + in MedCare-rs) stays contract-tier. + +--- + +## 6. References (prior art this extends — read before acting) + +- `docs/CONSUMER-BRIDGE-DEPRECATION.md` — the doctrine + the before/after pull + pattern (the spine for this plan). +- `.claude/knowledge/ogar-consumer-preflight.md` — the consumer spellbook + (pull `*Port::class_id` / `canonical_concept_id`; never construct a `*Bridge`). +- `.claude/plans/ogar-vocab-contract-codebook-migration-v1.md` — D-OVC-1..4 + (codebook→contract seam + the classid realign). +- OGAR `docs/{APP-CLASS-CODEBOOK-LAYOUT, CONSUMER-MIGRATION-HOWTO, + CLASSID-RBAC-KEYSTONE-SPEC}.md` + tracking **OGAR#95**. +- `crates/lance-graph-ogar/src/bridges/{mod,unified,medcare_bridge}.rs` + + `tests/bridge_scope_lock.rs` (the code being changed). +- Companion: `.claude/handovers/2026-06-26-ast-address-to-next-session-capstone.md` + (the OGAR-as-importable-ERP-stdlib "why"). + +--- + +## 7. One-paragraph summary + +The per-consumer bridges are already collapsed onto one generic +`UnifiedBridge` harness, and every `*Bridge` (incl. `MedcareBridge`) +is a `#[deprecated]` alias awaiting deletion once consumers pull +`Port::class_id()` directly (OGAR#95). This plan **codifies the sink-in** — +OGAR owns the meaning (PortSpec / codebook / ClassView / ActionDef / ontology), +`lance-graph-contract` owns the zero-dep wire mirror, `lance-graph-ontology` +owns the OGIT registry, `lance-graph-rbac` owns grants keyed on the shared +lo-u16 concept, and `lance-graph-ogar` keeps only the harness + parity — and +**recasts the medcare domain** from a bridge into **reusable patterns** (the +shared classid/codebook surface) **plus domain-specific Ontology Schema +enrichment** (Healthcare/FMA/CPIC in OGIT). The deletion (D-SINK-3) is gated on +the cross-repo consumer migration (D-SINK-2) and the scope-lock test port; the +ontology enrichment (D-SINK-5) is the cross-repo codebook-mint arc, not a local +wire.