Skip to content

Commit 5eccf40

Browse files
committed
docs(migration): ogar-vocab ⇄ contract codebook seam — migration doc + canon conflict
Operator asked to DO the ontology-schema migration documentation. Grounded in OGAR crates/ogar-vocab/src/lib.rs (the real codebook): it already defines CODEBOOK (domain-encoded 0xDDCC), ConceptDomain + canonical_concept_domain, source_domain_concept(project|erp), canonical_concept_id, and LabelDTO — and its own note says LabelDTO "long-term belongs in lance-graph-contract; codebook id == NodeGuid.classid low u16." Surfaces a canon CONFLICT: merged CLASSID_OSINT=0x0007 routes to OGAR's Reserved domain (OSINT is 0x07XX); CLASSID_FMA=0x0008 sits in OGAR's OCR block (FMA/anatomy is clinical → Health 0x09XX). Root cause: 0x0007 minted from the early "OSINT is 0x0007" guess before ogar-vocab's 0xDDCC layout was consulted. New .claude/plans/ogar-vocab-contract-codebook-migration-v1.md (D-OVC-1..4): host the codebook/ConceptDomain/LabelDTO in contract, classids follow 0xDDCC (mint project 0x01XX + ERP 0x02XX; realign OSINT→0x0700, FMA→Health). The per-family codebook (D-GV2-2) is the finer scope of the same idea. NO code minted/rewritten: realigning merged OSINT/FMA rewrites canon (#557/#560 + CLAUDE.md canon block) → operator sign-off required (plan §5, three decisions). INTEGRATION_PLANS prepended; ISSUES ISS-CLASSID-OGAR-DRIFT filed; AGENT_LOG updated. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CcpLeEC3XK8Eye53GKBVvi
1 parent be1d2f6 commit 5eccf40

4 files changed

Lines changed: 143 additions & 0 deletions

File tree

.claude/board/AGENT_LOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 2026-06-20 (cont.¹¹) — ogar-vocab⇄contract codebook migration doc + canon-conflict surfaced
2+
3+
**Main thread (Opus), autoattended.** Operator: "point [to migration docs] as in DO it" + diagnosed the ontology/contract/q2 triangle seams. Grounded in OGAR `crates/ogar-vocab/src/lib.rs` (read, not guessed): it already defines `CODEBOOK` (domain-encoded `0xDDCC`, :1073), `ConceptDomain` + `canonical_concept_domain` (:1141/:1163), `source_domain_concept("project"|"erp")` (:1186), `canonical_concept_id` (:1214), `LabelDTO` (:1476) — and its own note (:1208) says `LabelDTO` "long-term belongs in lance-graph-contract; codebook id == NodeGuid.classid low u16." **Found a real canon conflict:** merged `CLASSID_OSINT=0x0007` is OGAR's *Reserved* domain (OSINT=`0x07XX`); `CLASSID_FMA=0x0008` is OGAR's *OCR* block (FMA/anatomy≈Health `0x09XX`). Wrote `.claude/plans/ogar-vocab-contract-codebook-migration-v1.md` (D-OVC-1..4): host codebook/ConceptDomain/LabelDTO in contract, classids follow `0xDDCC` (mint project `0x01XX`+ERP `0x02XX`; realign OSINT→`0x0700`, FMA→Health). INTEGRATION_PLANS prepended; ISSUES `ISS-CLASSID-OGAR-DRIFT` filed. **Did NOT mint/rewrite code:** the OSINT/FMA realign rewrites merged canon + the CLAUDE.md canon block → operator sign-off required (plan §5). Surfaced 3 decisions: (1) realign OSINT/FMA? (2) OGAR↔contract dependency direction (move vs wire-compat)? (3) FMA → Health 0x09XX or new anatomy domain? Doc committed to the jirak branch (PR #561 arc).
4+
15
## 2026-06-20 (cont.¹⁰) — D-GV2-2 partial: per-family Codebook (contract::codebook, gated)
26

37
**Main thread (Opus), autoattended.** #560 merged (synced main c05394f4; #558 also merged). Continued the greenlit v2 arc with **D-GV2-2** (type + in-memory registry tier): NEW `contract::codebook` (feature `guid-v2-tail`, zero-dep, default OFF) — `Codebook` (insertion-ordered index↔label, 1-byte index, `CODEBOOK_CAP=256`, overflow→None = split-the-family signal) + `FamilyCodebookRegistry` (`family→Codebook`, per-family scoping so the SAME label gets independent indices per family, `resolve(family,index)` for cross-family decode). The finer sibling of `classid→ClassView`; the family node's episodic-basin content; the 256×256 Morton tile (≤256 leaves for the 1-byte in-family index). Dissolves the aiwar "60 noisy families" at the root (per-family vocabularies are small + clean). 3 tests; `--features guid-v2-tail` green, default build clean (codebook absent), clippy clean both. **DEFERRED:** Lance-backed persistence + OntologyRegistry integration in lance-graph-ontology. Next: D-GV2-3 (soa_graph per-family edges under v2) + D-GV2-4 (aiwar re-key). New PR off main. **558/559 (OpenProject/Redmine bridges, other arc) still have open comments — left for that arc.**

.claude/board/INTEGRATION_PLANS.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
## 2026-06-20 — ogar-vocab ⇄ contract codebook migration (PROPOSED; surfaces a canon conflict)
2+
3+
Plan: `.claude/plans/ogar-vocab-contract-codebook-migration-v1.md`. Closes the ontology→contract seam: OGAR `ogar-vocab` already defines the class-identity codebook (`CODEBOOK` domain-encoded `0xDDCC`, `ConceptDomain`, `source_domain_concept`, `canonical_concept_id`, `LabelDTO`) and its own doc says `LabelDTO` "long-term belongs in lance-graph-contract … codebook ids and the NodeGuid.classid u16 low half are wire-compatible." **Conflict surfaced:** merged `CLASSID_OSINT=0x0007` routes to OGAR's *Reserved* domain (OSINT is `0x07XX`), and `CLASSID_FMA=0x0008` sits in OGAR's OCR block (FMA/anatomy ≈ Health `0x09XX`). Target: contract hosts the codebook/`ConceptDomain`/`LabelDTO`, classids follow `0xDDCC` (mint project `0x01XX` + ERP `0x02XX`; realign OSINT→`0x0700`, FMA→Health). D-OVC-1..4. **Gated on operator sign-off (canon realign of merged OSINT/FMA + the OGAR↔contract dependency direction) — see plan §5.** Per-family codebook (D-GV2-2) is the finer scope of the same idea. Cross-ref ISSUES `ISS-CLASSID-OGAR-DRIFT`.
4+
5+
---
6+
17
## 2026-06-20 — guid-v2-tail + per-family codebook scoping (PROPOSED, operator what-if)
28

39
Plan: `.claude/plans/guid-v2-tail-per-family-codebook-v1.md`. Repartition the 48-bit basin tail `family(u24)|identity(u24)` → `leaf(u16)|family(u16)|identity(u16)` (whole key = uniform 8×u16 tiers), and scope **codebooks per family** (`family → Codebook`, the finer sibling of `classid → ClassView`; 12 in-family edge slots = 1-byte index into own family codebook, 4 out-of-family = `(family,index)`). Dissolves the aiwar "60 noisy families" at the root (per-family ≤256 vocabularies), kills the awkward `u24`, makes family-adapter resolution exact, and gives the 3-tier subclass codebook a native home. **Blast radius measured: CONTAINED in lance-graph** (q2/smb-office-rs/medcare-rs = 0; routing prefix `from_guid_prefix`/`mailbox_scan` is tail-agnostic; ~3 layout files + ~35 mostly-test `NodeGuid::new` call sites). **PROPOSED — gated on operator sign-off (canon version bump) + two numbers:** ≤65 536 identities per `(leaf,family)` bucket, ≤256 codebook entries per family before split. Ships feature-gated `guid-v2-tail` (default OFF) per `I-LEGACY-API-FEATURE-GATED` (field-isolation matrix + version gate). D-GV2-1..5.

.claude/board/ISSUES.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,3 +263,8 @@ flip Open entry to Superseded.
263263

264264
**When an issue is deferred knowingly** — leave it Open here but
265265
also append a row to `TECH_DEBT.md` with cross-ref back.
266+
267+
## ISS-CLASSID-OGAR-DRIFT — 2026-06-20 — OPEN (needs operator sign-off)
268+
**What:** merged `lance-graph-contract` classids drifted from OGAR `ogar-vocab`'s domain-encoded codebook (`0xDDCC`, `crates/ogar-vocab/src/lib.rs:1073` CODEBOOK + `:1163` `canonical_concept_domain`). `CLASSID_OSINT=0x0007``0x00` = OGAR *Reserved* domain (OSINT is `0x07XX`); `CLASSID_FMA=0x0008` → OGAR *OCR* block (FMA/anatomy is clinical → Health `0x09XX`). OGAR's own note (`lib.rs:1204-1212`): codebook id == `NodeGuid.classid` low u16, and `LabelDTO` "long-term belongs in lance-graph-contract." So contract + OGAR currently disagree on what `0x07`/`0x08` mean.
269+
**Impact:** the contract↔OGAR↔q2 triangle has an inconsistent classid space; `canonical_concept_domain(id>>8)` mis-routes contract's OSINT/FMA; project/ERP un-minted.
270+
**Fix (proposed):** `.claude/plans/ogar-vocab-contract-codebook-migration-v1.md` D-OVC-1..4 — host the codebook/`ConceptDomain`/`LabelDTO` in contract, classids follow `0xDDCC` (mint project `0x01XX`+ERP `0x02XX`; realign OSINT→`0x0700`, FMA→Health `0x09XX`). **Realigning merged OSINT/FMA rewrites canon (#557/#560 + CLAUDE.md canon block) → operator sign-off required** (plan §5). Origin: `CLASSID_OSINT=0x0007` minted from the early "OSINT is 0x0007" guess before ogar-vocab's `0xDDCC` layout was consulted.
Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
# Migration — OGAR `ogar-vocab` codebook ⇄ `lance-graph-contract` classid (v1)
2+
3+
> **Status:** PROPOSED (2026-06-20). Surfaces a **canon conflict** between merged
4+
> `lance-graph-contract` classids and OGAR's `ogar-vocab` codebook; the
5+
> reconciliation rewrites merged canon (`CLASSID_OSINT`/`CLASSID_FMA`) and so is
6+
> gated on operator sign-off.
7+
> **The triangle:** ontology (OGAR `ogar-vocab`) → contract (`NodeGuid`/`ClassId`)
8+
> → q2 (Quadro-2 cockpit consuming `GraphSnapshot`).
9+
10+
---
11+
12+
## 1 — The seam, grounded (file:line)
13+
14+
OGAR's `crates/ogar-vocab/src/lib.rs` already defines the canonical class
15+
identity layer, and **its own doc-comment says where it belongs**:
16+
17+
- **`CODEBOOK`** (`lib.rs:1073`) — curated `(canonical_concept, u16)` table, ids
18+
assigned (never hashed). Domain-encoded `0xDDCC` (high byte = domain).
19+
- **`ConceptDomain`** (`lib.rs:1141`) + **`canonical_concept_domain(id)→ConceptDomain`**
20+
(`lib.rs:1163`, routes on `id >> 8`, O(1) no-lookup).
21+
- **`source_domain_concept("project"|"erp"|"german-erp")→ConceptDomain`**
22+
(`lib.rs:1186`) — the seam from `Class::source_domain` (the coarse curator tag,
23+
`lib.rs:193`) to the typed domain.
24+
- **`canonical_concept_id(concept)→Option<u16>`** (`lib.rs:1214`) +
25+
`Class::canonical_id()/canonical_id_le()` (`lib.rs:1026/1034`).
26+
- **`LabelDTO { label, id: u16, canonical }`** (`lib.rs:1476`) + `from_alias()`
27+
consumer alias → shared codebook id. **`lib.rs:1208`:** *"The contract type
28+
(`LabelDTO`) lives in `ogar-vocab` today; **long-term it belongs in
29+
`lance-graph-contract`** alongside `ClassId` and the `NodeGuid` LE layout. Wire
30+
is the source of truth: any encoder/decoder agreeing on `u16` LE is compatible
31+
regardless of which crate exports the DTO."* And `lib.rs:1204-1206`: *"codebook
32+
ids and the `NodeGuid.classid` u16 low half are wire-compatible."*
33+
34+
So **the OGAR codebook id IS the contract classid (low u16)** — one wire value,
35+
two crates. Contract has none of it yet (grep: no `ogar-vocab` reference in
36+
`lance-graph-contract`).
37+
38+
## 2 — The conflict (the migration gap)
39+
40+
OGAR's `0xDDCC` domain layout vs the classids contract minted this session
41+
(#557/#560, merged):
42+
43+
| Domain | OGAR `ConceptDomain` block | contract today | Aligned? |
44+
|---|---|---|---|
45+
| project-mgmt (OP↔Redmine) | `0x01XX` | — (un-minted) | n/a — **mint** |
46+
| commerce/ERP (OSB↔Odoo) | `0x02XX` | — (un-minted) | n/a — **mint** |
47+
| OSINT | **`0x07XX`** | `CLASSID_OSINT = 0x0007` |`0x0007 >> 8 = 0x00` = **Reserved**, not OSINT |
48+
| OCR | `0x08XX` | `CLASSID_FMA = 0x0008` |`0x0008` is in OGAR's **OCR** block |
49+
| Health (clinical) | `0x09XX` | (FMA anatomy ≈ Health) | ❌ FMA/anatomy is medical → belongs `0x09XX`, not `0x0008` |
50+
51+
Root cause: `CLASSID_OSINT=0x0007` was minted from the early guess "OSINT is
52+
0x0007" before `ogar-vocab`'s domain-encoded layout was consulted. Under OGAR,
53+
the OSINT *domain* is the high byte `0x07`, so an OSINT class is `0x07CC`
54+
(e.g. `0x0700`), and `0x0007` is a Reserved-domain slot. `0x0008` collides with
55+
the OCR domain; FMA (Foundational Model of Anatomy) is clinical → Health
56+
`0x09XX` (or a dedicated anatomy domain) — never `0x0008`.
57+
58+
## 3 — Target state (single source of truth)
59+
60+
Per OGAR's own note, **`lance-graph-contract` is the long-term home** for the
61+
class-identity codebook. Reconcile onto OGAR's `0xDDCC` scheme:
62+
63+
1. **Codebook + domain types live in contract.** Move (or mirror, wire-compat)
64+
`ConceptDomain`, `canonical_concept_domain`, `source_domain_concept`,
65+
`canonical_concept_id`, the `CODEBOOK`, and `LabelDTO` into
66+
`lance-graph-contract` (next to `ClassId`/`NodeGuid`). `ogar-vocab`
67+
re-exports them (OGAR→contract dep) **OR** both keep a copy and the **wire
68+
(`u16` LE) is the contract** (no new dep). *Decision needed — see §5.*
69+
2. **classids follow `0xDDCC`.** `NodeGuid.classid` low u16 == the codebook id.
70+
- project-mgmt: `0x01XX` (mint `CLASSID_PROJECT = 0x0100` block).
71+
- commerce/ERP: `0x02XX` (mint `CLASSID_ERP/COMMERCE = 0x0200` block).
72+
- OSINT: realign `CLASSID_OSINT``0x0700` (Gotham domain).
73+
- anatomy/FMA: realign `CLASSID_FMA` → Health `0x09XX` (or a new anatomy
74+
domain block, reserved appended — never `0x0008`).
75+
3. **`canonical_concept_domain` becomes the `ReadMode`/domain router** — the
76+
`classid → ReadMode` registry keys off `id >> 8` (the domain), so OSINT/FMA/
77+
project/ERP all resolve by the same O(1) high-byte rule.
78+
4. **The per-family codebook (D-GV2-2) is the FINER scope of the SAME idea.**
79+
OGAR `CODEBOOK` = the *concept/classid* codebook (domain `0xDDCC`); the
80+
`guid-v2-tail` `FamilyCodebookRegistry` (`contract::codebook`) = the
81+
*within-family* label vocab. They compose: classid (domain) selects the
82+
coarse codebook; family selects the sub-codebook. Longest-prefix-wins, one
83+
rule (OGAR `CLAUDE.md` "Codebook scoping = the class routing prefix").
84+
85+
## 4 — Deliverables (gated on §5 decisions)
86+
87+
- **D-OVC-1** Move/mirror `ConceptDomain` + `canonical_concept_domain` +
88+
`source_domain_concept` + `canonical_concept_id` + `CODEBOOK` + `LabelDTO`
89+
into `lance-graph-contract` (e.g. `contract::ogar_codebook`); `ogar-vocab`
90+
re-exports (or wire-compat duplicate). Round-trip test: `LabelDTO::from_alias`
91+
parity across both crates.
92+
- **D-OVC-2** Mint `CLASSID_PROJECT` (`0x0100`) + `CLASSID_ERP` (`0x0200`) in
93+
`canonical_node.rs` + `ReadMode`s, registered in `BUILTIN_READ_MODES`. Add
94+
`soa_graph::{PROJECT, ERP}` `DomainSpec`s (siblings of `OSINT_GOTHAM`/`FMA_ANATOMY`).
95+
- **D-OVC-3** **Canon realign (SIGN-OFF):** `CLASSID_OSINT 0x0007 → 0x0700`,
96+
`CLASSID_FMA 0x0008 → 0x09xx` (Health) or a minted anatomy domain. Field-isolation
97+
/ version-gate per `I-LEGACY-API-FEATURE-GATED`; update `aiwar.rs`, `soa_graph.rs`,
98+
tests, and the canon block in `lance-graph/CLAUDE.md` + OGAR `CODEBOOK`.
99+
- **D-OVC-4** Route `classid → ReadMode` (and the domain ClassView) through
100+
`canonical_concept_domain(classid_lo)`; q2 reads `LabelDTO`/`canonical` for
101+
display labels (the contract→q2 leg of the triangle).
102+
103+
## 5 — Decisions needed (operator)
104+
105+
1. **Canon realign OSINT/FMA?** `CLASSID_OSINT 0x0007 → 0x0700`, `CLASSID_FMA
106+
0x0008 → 0x09XX`. This rewrites merged canon (#557/#560) + the `lance-graph/
107+
CLAUDE.md` canon block. Recommended (otherwise contract and OGAR disagree on
108+
what `0x07`/`0x08` mean), but it's your canon to change. Alternative: keep
109+
`0x0007/0x0008` and re-document OGAR's domain layout to match (worse — breaks
110+
the clean `id>>8` domain route).
111+
2. **Dependency direction for the shared types:** (a) move to contract,
112+
`ogar-vocab` `pub use`s from it (OGAR gains a `lance-graph-contract` dep);
113+
or (b) both define, wire (`u16` LE) is the only contract, a parity test
114+
guards drift (no new dep). OGAR's note leans (a) ("belongs in contract");
115+
(b) is lighter and keeps OGAR dep-free. Recommend (b) now, (a) at a
116+
deliberate consolidation.
117+
3. **FMA/anatomy domain:** fold into Health `0x09XX`, or mint a dedicated
118+
anatomy domain block (append-only reserved high byte)?
119+
120+
## Cross-refs
121+
122+
OGAR `crates/ogar-vocab/src/lib.rs` (`CODEBOOK`/`ConceptDomain`/`LabelDTO`/
123+
`source_domain`), OGAR `CLAUDE.md` "Tier interpretation 256×256 CENTROID TILE" +
124+
"Codebook scoping = the class routing prefix"; `contract::canonical_node`
125+
(`CLASSID_OSINT`/`CLASSID_FMA`/`BUILTIN_READ_MODES`), `contract::codebook`
126+
(D-GV2-2 per-family), `contract::soa_graph` (`OSINT_GOTHAM`/`FMA_ANATOMY`),
127+
`contract::aiwar`; `guid-v2-tail-per-family-codebook-v1.md`;
128+
`E-UNIFORM-MORTON-TILE-PYRAMID`.

0 commit comments

Comments
 (0)