Skip to content
Merged
58 changes: 58 additions & 0 deletions .claude/board/AGENT_LOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,61 @@
## [Sonnet agent + main-thread fixup] PR #431 review wave — 9/11 review findings applied

Addressed Codex P1 + P2 and 6 CodeRabbit findings on the
normalized-entity-holy-grail-v1 Stage 1 surface. Sonnet agent landed
the substantive code work (typestate seal + Op trait redesign + row_idx
widening + CascadeWalker callback + ServerAction doc fix + first
compile_fail block in src/cognition/mod.rs) but didn't commit before
hitting an unrelated permissions issue. Main thread audited the work
tree, updated the 5 fake Op impls in `tests/cognition_typestate.rs` to
the new `step()`-only shape (removing the now-non-existent `apply()`
overrides), fixed the remaining 2 stale `/// work` text refs, and
committed everything as one fix wave.

**Critical refactor (Codex P1):** `Op` trait no longer exposes `apply()`
as overridable; external implementors override only `step()` (validation
hook, default no-op success) + `kind()`. The framework's chain methods
(`op` / `chk_data` / `review` / `abduct` / `report`) call `op.step()`
then perform the sealed `advance_stage_internal::<O>()` transition.
`advance_stage` is `pub(crate)` now — external code cannot construct
any `NormalizedEntity<S>` for `S != Raw`. New `OpError` type carries
a `&'static str` for Stage 1; Stage 2 widens to typed reasons + row ref
for audit trail.

**Correctness (Codex P2 + CodeRabbit 5):** `MailboxRow::row_idx: u16 → u32`
to match the documented 64K-256K per-mailbox envelope. Mirrors PR #427's
symmetric `mailbox_ref: u32` widening.

**API design (CodeRabbit 4):** `CascadeWalker::walk_dependents` now takes
`on_dependent: &mut dyn FnMut(MailboxRow)` callback — the walker output
is now expressible at the type level.

**Doc drift (CodeRabbit 1, 3, 9):** `ServerAction` no longer claims to be
"encoded as Other + tag" (it IS its own variant); 2 stale `/// work`
references in `docs/COGNITION_HOLY_GRAIL.md` + this very AGENT_LOG entry
swept to `// TODO(Stage 2):`.

**Deferred to Stage 2 (CodeRabbit 2, 7):** colocated `#[cfg(test)]`
tests in `advance.rs` + `interactive.rs`. The methods are `todo!()`-bodied
today; meaningful tests only become writable once kernels exist.

**Tests:** `cargo clippy -p lance-graph-contract --lib --tests -- -D warnings`
clean. `cargo test --lib` 472 green. `cargo test --test cognition_typestate`
7 green. `cargo test --doc` 3 green (incl. new compile_fail block in
`src/cognition/mod.rs`).

**Branch:** `claude/normalized-entity-holy-grail-v1`, commit `<pending>`
(this commit). Updates PR #431 with the review-fix wave.

---

## [Sonnet agent] D-NEH-1a..g — normalized-entity-holy-grail-v1 Stage 1 contract surface scaffold

Created `cognition::{stages, entity, op, advance, cascade}` + `transaction::{interactive, bulk, periodisch, ctx}` modules in `lance-graph-contract` — the typed consumer pipeline grammar per `.claude/plans/normalized-entity-holy-grail-v1.md`. All advancement verbs past `resolve_ogit` have `todo!()` bodies flagged with `// TODO(Stage 2):` markers for Stage 2 wiring (markers were `/// work` in the original scaffold; converted to `// TODO(Stage 2):` in the main-thread review-strip pass that followed). Compile-fail tests in `tests/cognition_typestate.rs` plus 7 passing positive tests document the typestate gate.

**Branch:** `claude/normalized-entity-holy-grail-v1`, prior commit `1695a9a` (plan). commit `b96baf3`. `cargo check -p lance-graph-contract` clean (0 errors); `cargo test -p lance-graph-contract --lib` green (472 tests); `cargo test -p lance-graph-contract --test cognition_typestate` green (7 tests).

---

## [Agent-A4 / Sonnet] D-MBX-A4 — append §10 architectural refinements to bindspace→mailbox plan

**D-id:** D-MBX-A4 | **Commit:** 0f448730 (cherry-picked from worktree `worktree-agent-a1961cf1d2ca1db93` f5cdcbe8) | **Branch:** claude/lance-surrealdb-analysis-LXmug
Expand Down
48 changes: 48 additions & 0 deletions .claude/board/EPIPHANIES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,51 @@
## 2026-05-28 — E-NORMALIZED-ENTITY-1 — `NormalizedEntity<Stage>` is the single typed carrier holding the four-way inheritance chain (Odoo → OGIT → OWL → DOLCE → FIBU/FIBO); stage advancement is typestate, not method calls on a context

**Status:** FINDING (architectural unification). Drives `normalized-entity-holy-grail-v1`. The carrier is a typed lens into a `MailboxSoA` row — it does NOT own the four cognitive columns; the mailbox does. The 4-way inheritance slots (`odoo`/`ogit`/`owl`/`dolce` + optional `fibu`) populate as stages advance; phantom-typed `Stage` parameter forbids out-of-order traversal at compile time. Consumers chain ON the carrier (`entity.resolve_ogit(ctx).hydrate_owl(ctx)...`), never reach into its internals.

---

## 2026-05-28 — E-OP-FIVE-VERBS-1 — only five universal verbs span the unification: `resolve` (Odoo → OGIT) · `hydrate` (OGIT → OWL) · `classify` (OWL → DOLCE) · `align` (DOLCE → FIBU/FIBO) · `think` (the op-chain over the normalized carrier)

**Status:** FINDING. Every business operation is a special case of one of the five. The temptation to add a sixth verb (`reconcile`, `report`, `aggregate`) is a sign the operation should compose multiple `think` steps, not add to the algebra. The five-verb closure parallels the Vsa16k algebra closure (`bind`/`bundle`/`cosine`) — small algebra, large surface.

---

## 2026-05-28 — E-OP-THREE-CALLSITES-1 — `Op<I,O>` is one trait with three call sites (`apply` cold · `apply_stream` warm · `apply_soa` hot), one set of const data shared across all three; same heuristic, three execution speeds

**Status:** FINDING. The cold path runs the kernel once per entity (DataFusion-routed). The warm path maps it over a `Stream` (per-element flow-controlled). The hot path is a SoA-swept SIMD kernel (JIT-compiled from the same const data). The Op's `kind()` is its register-layer identity per `I-VSA-IDENTITIES`; the shader dispatches on kind. Consumers don't pick the call site — the transaction context does.

---

## 2026-05-28 — E-TRANSACTION-CONTEXT-1 — three typed transaction shapes own commit + Baton epoch + Lance version policy: `Interactive` (eager cascade, live Lance, sync DFS) · `Bulk` (epochal flush, per-batch snapshot, async) · `Periodisch` (JIT chain, frozen Lance, iterate-to-fixed-point)

**Status:** FINDING. The corollary of `E-OP-THREE-CALLSITES-1`: the three call sites map 1:1 to the three contexts; the consumer's typed enclosure (`woa.interactive { ... }` / `woa.bulk { ... }` / `woa.periodisch { ... }`) picks the call site, the cascade traversal mode, the Lance version pinning, and the Baton epoch boundary. Same chain shape inside; different commit discipline outside.

---

## 2026-05-28 — E-CASCADE-AS-EDGECOLUMN-1 — dependency cascade collapses Odoo's six overlapping mechanisms into ONE typed graph on `EdgeColumn`; transaction context picks the traversal discipline

**Status:** FINDING (conjecture pending Stage-2 enumeration). Odoo encodes cascade in: (1) `@api.depends` strings, (2) `@api.constrains` post-write hooks, (3) SQL FK `ondelete`, (4) `base.automation` server actions, (5) `_inherits` field forwarding, (6) implicit model cascades (mail-thread auto-subscribe, tax-tag aggregation). We unify all six as `CausalEdge64` rows on the mailbox's `EdgeColumn` with a `CascadeKind` discriminant. Traversal mode (sync DFS / async batched / JIT-fixed-point) comes from the transaction context. The six-into-one collapse is the structural improvement over Odoo's prior art.

---

## 2026-05-28 — E-ODOO-AS-PRIOR-ART-1 — Odoo solved the three regimes (interactive / bulk / periodisch) 15 years ago via `@api.depends` strings + `env.context` flags + lock-date wizards; we re-encode the same decomposition as compile-time typed boundaries

**Status:** FINDING. Odoo got the decomposition right — three SLAs, three commit disciplines, three cascade modes. What hurts in Odoo is the ENCODING: stringly-typed dependency declarations, runtime-evaluated context flags, multi-screen close wizards. Failure mode is runtime drift. Our re-encoding (typestate + Op-with-three-call-sites + typed transaction contexts) makes the same three regimes fail at COMPILE time. The decomposition is borrowed; the failure timing is the improvement.

---

## 2026-05-28 — E-CONSUMER-CANNOT-INTERPRET-1 — business heuristics MUST be expressible as SIMD-amenable const data; regex / hand-rolled `if line.account.code.starts_with("84")` is structurally banned because the chain does not expose that primitive

**Status:** FINDING (iron-rule candidate). The structural ban is the point: today consumers CAN write hand-rolled business logic because the type system permits it; CodeRabbit/Codex will not catch it. Post-migration, the only way to "check an SKR range" is `chain.chk_data(SkrAccountInRange::new(8400..=8499))` where `SkrAccountInRange` is a typed Op the shader dispatches against `SKR03_CHART`. Hand-rolled regex becomes a MISSING FUNCTION, not a code-review finding. Pairs with `I-VSA-IDENTITIES`: consumer-side interpretation is identity-layer drift.

---

## 2026-05-28 — E-NO-AUTOMATIC-REGIME-PICK-1 — the cognitive shader does NOT autonomously choose between hot / warm / cold execution; the consumer's typed transaction context does (correction of the earlier "shader picks based on flow rate + surprise" framing)

**Status:** FINDING (mid-session correction). The cute framing — "shader picks hot vs cold based on flow rate" — conflates three SLA regimes that have genuinely different correctness requirements: interactive MUST see live data (no frozen snapshot), periodisch MUST NOT see writes after fiscal cutoff (frozen point-in-time). A shader that switches modes based on flow pressure can silently break either invariant. The consumer's enclosing typed context (`Interactive` / `Bulk` / `Periodisch`) is the only authority for which mode is correct; the shader executes within whichever mode the context dictates. Pairs with the SoA-as-AGI doctrine: AGI is the SHADER'S behaviour under SoA dispatch, but the regime under which that dispatch runs is the CONSUMER'S typed declaration.

---

## 2026-05-28 — E-CODEBOOK-INHERITS-FROM-OGIT — every identity (entities, savants, atoms, ontology classes, regulation rules, accounts) lives as a codebook entry inherited from OGIT; LE-byte SoA per mailbox stores the codes; bitpacked u64 is a desperation-bucket fallback; the SoA doesn't guess

**Status:** FINDING (architectural correction, supersedes the role-key-as-canonical interpretation of `I-VSA-IDENTITIES`; drives the v2-step codebook foundation in `contract::callcenter::ogit_uris`).
Expand Down
32 changes: 32 additions & 0 deletions .claude/board/INTEGRATION_PLANS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,35 @@
## 2026-05-28 — normalized-entity-holy-grail-v1 (typed unified normalization + Op chain over OGIT/OWL/DOLCE/Odoo with three-context execution — the trunk that unifies BP-1 + EXT-1..6 + jit + MailboxSoA into one consumer surface)

**Status:** PROPOSAL. The trunk plan that ties together every prior architectural deliverable into ONE typed consumer pipeline grammar. Closes the structural gap that lets consumers re-implement business logic in regex / hand-rolled pseudo-code by making such interpretation a MISSING FUNCTION (per `E-CONSUMER-CANNOT-INTERPRET-1`) rather than a code-review concern. Re-encodes Odoo's three-regime decomposition (interactive / bulk / periodisch) as compile-time typestate, not stringly-typed `env.context` flags.
**Confidence:** HIGH on carrier + algebra shape (one struct, 5 verbs — direct analogue of the SoA-as-AGI unification). HIGH on the three-context split (genuinely different SLAs; Odoo prior art proves the decomposition is real). MED on the Op-trait three-call-site specialisation (jit substrate exists but has never been wired against a typed Op grammar). LOW on the macro-DSL layer (consumer ergonomics; needs per-repo iteration).
**Plan file:** `.claude/plans/normalized-entity-holy-grail-v1.md`
**Predecessors:** `D-ODOO-BP-1a..g` typed surface (Wave 1-3 lane modules); `D-ODOO-EXT-1..6` source-extracted backing (PR #426 merged); PR #411 (`lance-graph-contract::jit::{JitCompiler, StyleRegistry, KernelHandle}`); PR #427 (`MailboxSoA` thoughtspace columns + WitnessTable + §10 refinements); `lance-graph-contract::callcenter::ogit_uris`; `lance-graph-ontology::dolce_odoo`; `lance-graph-contract::orchestration::{OrchestrationBridge, UnifiedStep}`; `lance-graph-rbac::{SuperDomain, smb_policy}`.
**Anchored epiphanies (all 8 prepended to EPIPHANIES.md in the same commit):** `E-NORMALIZED-ENTITY-1` (single typed carrier); `E-OP-FIVE-VERBS-1` (resolve/hydrate/classify/align/think closure); `E-OP-THREE-CALLSITES-1` (cold/warm/hot, shared const data); `E-TRANSACTION-CONTEXT-1` (interactive/bulk/periodisch own commit+epoch+version policy); `E-CASCADE-AS-EDGECOLUMN-1` (Odoo's 6 mechanisms collapse into 1 typed graph); `E-ODOO-AS-PRIOR-ART-1` (decomposition borrowed, encoding improved); `E-CONSUMER-CANNOT-INTERPRET-1` (regex structurally banned via missing-function); `E-NO-AUTOMATIC-REGIME-PICK-1` (consumer-typed context picks mode, not shader).

### Stage-1 deliverables (this plan ships ~2 500 LOC; mostly typed signatures + compile-fail tests)

| D-id | Description | Site | LOC |
|---|---|---|---:|
| **D-NEH-1a** | `lance-graph-contract::cognition::{NormalizedEntity, stages, Op, OpKind, MailboxRow, Output}` typed surface — zero-dep, `todo!()` bodies, compile-fail tests | `lance-graph-contract/src/cognition/` | 600 |
| **D-NEH-1b** | `lance-graph-contract::transaction::{Interactive, Bulk, Periodisch, Context, OgitCtx/OwlCtx/DolceCtx/FibuCtx}` — context shapes + commit-policy traits | `lance-graph-contract/src/transaction/` | 400 |
| **D-NEH-1c** | 5-verb advancement methods on `NormalizedEntity<S>` (`resolve_ogit` / `hydrate_owl` / `classify_dolce` / `align_fibu` / chain methods) + provenance | `lance-graph-contract/src/cognition/advance.rs` | 300 |
| **D-NEH-1d** | `CascadeKind` + cascade-graph traversal trait on `EdgeColumn` + per-context traversal mode (`Sync` / `Batched` / `JitFixedPoint`) | `lance-graph-contract/src/cognition/cascade.rs` | 350 |
| **D-NEH-1e** | Compile-fail tests proving the typestate gate (out-of-order chain calls fail to compile) | `lance-graph-contract/tests/cognition_typestate.rs` | 250 |
| **D-NEH-1f** | Doc-level example consumer chain (woa-rs invoice flow as `cargo doc` example) + crate-level doc landing page | `lance-graph-contract/src/cognition/mod.rs` + `docs/COGNITION_HOLY_GRAIL.md` | 400 |
| **D-NEH-1g** | Board hygiene (this entry + EPIPHANIES prepend + STATUS_BOARD rows) | `.claude/board/` | 200 |

### Subsequent waves (sketched in the plan; separate v2..v7 plans)
- **v2** kernel bodies for ~50 typed Ops (port to shader dispatch table + JIT-compile hot path)
- **v3** consumer DSL macros (`medcare_think!` / `woa_think!` / `smb_think!`) — pipe-style ergonomics on top of the typestate chain
- **v4** Stream + ractor-supervised actor wiring (the Elixir-OTP analogue)
- **v5** Jahresabrechnung JIT kernel (target ≥100× throughput vs Odoo's `account.fiscal.year.close` wizard)
- **v6** palantir-foundry parity audit (ontology objects / branches / lineage / action types / functions-on-objects → workspace primitives matrix)
- **v7** elixir-OTP parity audit (processes / supervision / streams / behaviours → workspace primitives matrix)

When v6 and v7 are ≥80% present, the workspace has earned the "better palantir foundry / better elixir" framing the plan was named for.

---

## 2026-05-28 — odoo-source-extraction-v1 (TIER-1 Odoo source extraction → `OdooConfidence::Extracted` backing for `D-ODOO-BP-1b`; sub-plan unfolding `D-ODOO-BP-1f`)

**Status:** SHIPPED (Stage 1 — EXT-1..6 complete); per-lane gate test in `extracted::coverage`; Stage 2 addresses TIER-2 addons (POS, HR, website, fleet, maintenance, non-DE l10n, payment providers); the 5 known L13/L14 gaps (4 hr.* + stock.valuation.layer) close via hr + stock_account extraction. Unfolds `D-ODOO-BP-1f` of `odoo-business-logic-blueprint-v1` into a tractable Stage 1 over 12 TIER-1 addons (`account`, `account_payment`, `l10n_de`, `product`, `stock`, `uom`, `base`, `analytic`, `purchase`, `sale`, `account_peppol`, `account_edi_ubl_cii`) of the 622 in `/home/user/odoo/addons/`. Validates and adds source-extracted backing to the L-doc-curated `OdooEntity` consts that Wave 1-3 just shipped (commits `9507b36`..`2aca3e3`).
Expand Down
32 changes: 32 additions & 0 deletions .claude/board/STATUS_BOARD.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,38 @@ Rules:

---

## normalized-entity-holy-grail-v1 — typed unified normalization + Op chain

Stage 1 contract surface scaffold. Typed consumer pipeline grammar that
unifies OGIT/OWL/DOLCE/Odoo inheritance + cognitive shader + JIT +
MailboxSoA into one surface. Plan path:
`.claude/plans/normalized-entity-holy-grail-v1.md`.

### Stage 1 deliverables (D-NEH-1a..g)

| D-id | Title | Status | PR / Evidence |
|---|---|---|---|
| **D-NEH-1a** | `cognition::{NormalizedEntity, stages, Op, OpKind, MailboxRow, Output}` typed surface | **In PR** | Branch `claude/normalized-entity-holy-grail-v1` |
| **D-NEH-1b** | `transaction::{Interactive, Bulk, Periodisch, Context, OgitCtx/OwlCtx/DolceCtx/FibuCtx}` context shapes | **In PR** | Branch `claude/normalized-entity-holy-grail-v1` |
| **D-NEH-1c** | 5-verb advancement methods on `NormalizedEntity<S>` | **In PR** | Branch `claude/normalized-entity-holy-grail-v1` |
| **D-NEH-1d** | `CascadeKind` + `TraversalMode` + `CascadeWalker` trait | **In PR** | Branch `claude/normalized-entity-holy-grail-v1` |
| **D-NEH-1e** | Compile-fail tests + 7 positive typestate tests | **In PR** | Branch `claude/normalized-entity-holy-grail-v1` |
| **D-NEH-1f** | Crate doc + example chain + `docs/COGNITION_HOLY_GRAIL.md` | **In PR** | Branch `claude/normalized-entity-holy-grail-v1` |
| **D-NEH-1g** | Board hygiene (AGENT_LOG + STATUS_BOARD) | **In PR** | Branch `claude/normalized-entity-holy-grail-v1` |

### Stage 2..7 deliverables (future plans)

| D-id | Title | Status |
|---|---|---|
| D-NEH-2a..z | ~50 Op kernel bodies + shader dispatch wiring | **Backlog** |
| D-NEH-3a..c | Consumer DSL macros (medcare/woa/smb) | **Backlog** |
| D-NEH-4a..b | Stream + GenServer integration | **Backlog** |
| D-NEH-5 | Jahresabrechnung kernel + fiscal-close JIT | **Backlog** |
| D-NEH-6 | palantir-foundry parity audit | **Backlog** |
| D-NEH-7 | elixir-OTP parity audit | **Backlog** |

---

## codec-sweep-via-lab-infra-v1 — JIT-first codec sweep

Active integration plan. 7 Phase 0 deliverables (D0.1–D0.7) + Phases
Expand Down
Loading
Loading