diff --git a/.claude/board/INTEGRATION_PLANS.md b/.claude/board/INTEGRATION_PLANS.md index f904b9214..afcfefe55 100644 --- a/.claude/board/INTEGRATION_PLANS.md +++ b/.claude/board/INTEGRATION_PLANS.md @@ -1,3 +1,11 @@ +## 2026-10-17 — thought-git-api-v1 — a git-like API over thought tables → `.claude/plans/thought-git-api-v1.md` + +**Status:** D-TGA-0..6 PROPOSAL, test-first; nothing built. + +- Thoughts `1..=63` branch off main (thought 0, the givens); `land` squashes into the next sealed version through the revision gate; `squash_into` keeps a partial squash as an intermediate thought; `rebase` is four masks and moves no data. +- A thought's delta is the alpha overlay (the attention saccade), carried to 64 thoughts; the alpha doc's rule against reference data in the overlay is met because `land` writes the next sealed version. +- Missing piece: a read plane R per thought (D-TGA-2). + ## 2026-10-16 (5) — ce64-grammar-wiring-v1 — every CE64 upper-half field of a parsed triple from its source → `.claude/plans/ce64-grammar-wiring-v1.md` **Status:** D-CGW-0 in PR; D-CGW-1..12 PROPOSAL, test-first. diff --git a/.claude/board/LATEST_STATE.md b/.claude/board/LATEST_STATE.md index 856029e00..9b4068c3d 100644 --- a/.claude/board/LATEST_STATE.md +++ b/.claude/board/LATEST_STATE.md @@ -1,3 +1,8 @@ +## 2026-10-17 — main after #1597; thinking-tables wiring in PR + +- **On main since #1594:** #1592 (ledger revision c), #1595 (CE64 one layout), #1596 (Simpson co-research, P-pool test), #1598 (Haiku cards read in full, output capped), #1597 (epistemic frontier capstone; 46..49 activation, W = thought layer). +- **In PR:** `.claude/knowledge/thinking-tables-wiring.md` and entry `2026-10-17-thinking-tables-wiring.md`; arc entries for #1592, #1595, #1596, #1597, #1598. + ## 2026-10-17 — CE64 one layout; Moore tenant as synapse, membrane and local NARS (board, #1595 in PR) - Entry `2026-10-17-ce64-one-layout-moore-synapse-membrane.md`: eleven decisions with their basis (CE64 = 64-bit ISA contract in three regions, one layout aligned by migration, Moore reuses it minus what locality answers, the witness is two neighbours agreeing on a membrane, Hebbian wiring = SPOFC evidence with local NARS), the CE64 reader catalog, open items. No code. diff --git a/.claude/board/PR_ARC_INVENTORY.md b/.claude/board/PR_ARC_INVENTORY.md index d40a60197..b46e01cab 100644 --- a/.claude/board/PR_ARC_INVENTORY.md +++ b/.claude/board/PR_ARC_INVENTORY.md @@ -1,3 +1,38 @@ +## 2026-10-17 — lance-graph PR #1597 (merged `dd00245b`, branch `ccr-9f3b8075-74u47l-epistemic-capstone`, head `134a4d29`, 7 commits) — epistemic frontier capstone; O1/O3 decisions + +- **Added:** `.claude/knowledge/epistemic-frontier-capstone.md`; entry `2026-10-17-epistemic-frontier-clicks.md`; D-HL-1 note in `ce64-hypothesis-layers-v1.md`, plateau §4 note, STATUS_BOARD row; CLAUDE.md links to `docs/architecture/` and the capstone. +- **Locked:** CE64 46..49 is the activation; W (53..58) is the thought layer (0 givens, `1..=63` hypotheses). The reading "W = classid of the thinking lane" was committed and reverted in the same PR. +- **Deferred / open:** the capstone's open points; session vs storage for thought tables (see `thinking-tables-wiring.md` O2). +- **Confidence:** decisions recorded; a VIOLATION banner on the unwired `witness_table.rs` (foreign key; kept until its removal PR), no behaviour change. + +## 2026-10-17 — lance-graph PR #1598 (merged `c90549ec`, branch `ccr-9f3b8075-74u47l-haiku-read-in-full`, head `b2a5cfc5`, 4 commits) — Haiku cards: read in full, output capped + +- **Added:** on all six Haiku cards: every file in the brief is read in full (a brief may cap the search space, never the reading depth); output is capped (128k tokens, thinking included) while reading is not; past about 10,000 words a result is split into parts or reported PARTIAL with a `remaining:` line; `tiered-agent-execution-protocol.md` cites the Haiku 5.5 limits from the platform docs. +- **Locked:** none (agent cards and protocol only). +- **Deferred / open:** none. +- **Confidence:** medium (rules written after a measured 12,255-word single write and two PARTIAL maps). + +## 2026-10-17 — lance-graph PR #1596 (merged `4680ba8f`, branch `ccr-9f3b8075-74u47l-simpson`, head `4241f541`, 2 commits) — co-research: Simpson's paradox as an epistemic signal + +- **Added:** entry `2026-10-17-coresearch-simpson-epistemic.md` (premise split into four concepts; 14-row crosswalk; seams SEAM-C2M, SEAM-STRATUM-PROVENANCE, SEAM-ADMISSIBLE-MASK, SEAM-PROPOSE-RESEAL; probes with silence twins); test `lance-graph-planner/tests/simpson_revision_pooling.rs` (P-pool: NAL revision of stratum beliefs equals the union recount and reverses the stratified direction). +- **Locked:** none; the map ratifies nothing. +- **Deferred / open:** rows 1–8 are PROBE or PARK; rows 9 (rename) and 10 (strata declared before the seal) ADOPT-NOW, not done. +- **Confidence:** P-pool measured; the rest is an exploration map. + +## 2026-10-17 — lance-graph PR #1595 (merged `3443b3f3`, branch `ccr-9f3b8075-74u47l-ce64-layout-canon`, head `a868112c`, 6 commits) — CE64 one layout; Moore tenant as synapse, membrane and local NARS + +- **Added:** entry `2026-10-17-ce64-one-layout-moore-synapse-membrane.md` (eleven decisions with their basis); STATUS_BOARD rows. +- **Locked:** CE64 is one 64-bit layout aligned by migration; 59..63 is one field, `EpistemicState5`. +- **Deferred / open:** the migration work the decisions name. +- **Confidence:** decisions recorded; no code in this PR. + +## 2026-10-16 — lance-graph PR #1592 (merged `a5c5d353`, branch `ccr-b2e415d9-4jfvyk`, head `7cb43b31`, 1 commit) — recovery ledger revision (c) against #1582–#1591 + +- **Added:** `.claude/research/2026-10-recovery/LEDGER-REVISION-2026-10-16c.md`; entry `2026-10-16-ledger-revision-1582-1591.md`; arc entries for #1549 and #1581. +- **Locked:** none (research document). +- **Deferred / open:** the ledger's open rows. +- **Confidence:** medium. + ## 2026-10-17 — lance-graph PR #1594 (merged `8f50cd9e`, branch `ccr-9f3b8075-74u47l-cgw1`, head `0ee072cb`, 10 commits) — D-CGW-1: CE64 bits 43..45 are the orientation - **Added:** `causal_edge::Orientation` (Core + seven Haspelmath dative functions) as the one meaning of 43..45; `orientation()` / `set_orientation()`; `pack` / `pack_v2` take an `Orientation`; contract `MooreDirection { slot, polarity }` and `MooreRefusal::Oriented` (`lift_ce64` refuses an oriented edge and writes nothing); `causal-edge/tests/orientation_contract.rs`; ~85 call sites migrated across 8 crates; entry `2026-10-16-d-cgw-1-orientation-contract.md`; arc entry for #1593. diff --git a/.claude/board/STATUS_BOARD.md b/.claude/board/STATUS_BOARD.md index 4e275eba6..70b9f1d3c 100644 --- a/.claude/board/STATUS_BOARD.md +++ b/.claude/board/STATUS_BOARD.md @@ -258,6 +258,13 @@ Plan: `.claude/plans/ce64-hypothesis-layers-v1.md`. Plateau: `.claude/knowledge/ | **D-HL-6** | Read mask ∧ thinking mask before decode, via an explicit alpha-ordinal → Lance row-address projection | Queued | projection pinned (keys match, fragment boundary covered); equal answers; fewer rows decoded than the read mask alone | | **D-HL-7** | SparseDelta record through the split-tunnel append | Queued | replay composite = in-memory composite; dropping one delta changes only its rows | | **D-HL-8** | Validation ladder: when a layer may commit | Queued | some rung beats "commit everything" on oracle agreement, with a no-meta control | +| **D-TGA-0** | Thought git API: pre-registration (fixtures, from-scratch oracle, disables) — `.claude/plans/thought-git-api-v1.md` | Queued | written before any code | +| **D-TGA-1** | Thought type, branch/discard/write/diff, 63-branch limit (64 thoughts with main), givens refusal | Queued | 63rd branch accepted, 64th refused, slot 0 never handed out; a new value on a given records a contradiction and changes nothing | +| **D-TGA-2** | Read plane R and status | Queued | a read outside R is never reported stale | +| **D-TGA-3** | rebase (four masks, no data moved) | Queued | rebase-then-squash == from-scratch re-run on v+1, including a deletion in main (retract then re-derive); disables: no stale re-run, no conflict check, no retraction | +| **D-TGA-4** | land through the revision gate into the next Lance version (D-HL-8) | Queued | landing a thought that is behind is refused | +| **D-TGA-5** | squash_into (partial squash) and blame | Queued | blame returns original sources after slot reuse | +| **D-TGA-6** | MergeQueue | Queued | independent thoughts == landed by hand in FIFO order; a thought reading another negated lands after it; a cycle through negation refused at enqueue | | **D-HL-9** | Hydration budget split sweep | Queued | agreement not flat in k | | **D-HL-10** | NAL inference ISA: `ogar-nal` loco vocabulary + mask-risc dialect (a vocabulary on the existing IR, ledger R18); detailed as D-NALP | Queued (design; after D-HL-4) | per-op parity with the CE64 register method of the same name; agreement with OpenNARS within D-HL-4's tolerance; no second IR | diff --git a/.claude/board/entries/2026-10-17-thinking-tables-wiring.md b/.claude/board/entries/2026-10-17-thinking-tables-wiring.md new file mode 100644 index 000000000..bd70702fd --- /dev/null +++ b/.claude/board/entries/2026-10-17-thinking-tables-wiring.md @@ -0,0 +1,27 @@ +# 2026-10-17 — Thinking tables wired to PRs #1447–#1596 + +**Status:** WORKING-MODEL (documentation only; no code changed). + +`.claude/knowledge/thinking-tables-wiring.md` checks a model of thought tables +element by element against the plans, entries and crates of PRs #1447–#1596. +The model: 64 tables over one NodeGuid identity, writes isolated per table, +reads across tables by presence bits at one coordinate, provenance as the +written-by word, set algebra as the AST, a Datalog fixpoint inside a table, +FIFO order as the stratum order, and written-by queries as metacognition. + +- **Carried (WIRED):** the 64 tables, write isolation, presence reads, + written-by provenance (D-HL-5, D-HOLO H14c/H14d); independence by source + bits (D-HL-3, pre-registered, not run). +- **Partly carried:** the set AST (one algebra in four spellings, hinge D-RA-2), + the fixpoint (operand reuse and an external d′ driver; residue fixed point + measured), the wave scheduler (`schedule_depth.md`), uses, metacognition. +- **New:** FIFO order as stratum order, a fixpoint inside one table, the + written-by queries named as the metacognition surface, the table lifecycle as + one unit. + +DECISION: the unit is a thought (`0..=63`, 64 in all); "lane" stays the SoA lane. +DECISION: a thought table is compute and storage; it is squash-committed to +main like a git branch (64 thoughts = main + 63 branches), freeing its slot. +OPEN: precedence vs fold on merged reads; derived writes vs split-tunnel rule 7 and +law A1; tables as strata under revision (Simpson); D-RA-2. Coverage gaps are +listed in the document (O8). diff --git a/.claude/board/entries/README.md b/.claude/board/entries/README.md index 95ba1a129..76a7f0c33 100644 --- a/.claude/board/entries/README.md +++ b/.claude/board/entries/README.md @@ -25,10 +25,11 @@ index row, (3) no duplicate entry id. Checks 1 and 2 are deliberately opposite directions; the stranding this convention prevents shows up in exactly one of them, never both. -366 entries, 2026-08-06 .. 2026-10-17. +367 entries, 2026-08-06 .. 2026-10-17. | date | entry id | finding | file | |---|---|---|---| +| 2026-10-17 | `thinking-tables-wiring` | | [2026-10-17-thinking-tables-wiring.md](2026-10-17-thinking-tables-wiring.md) | | 2026-10-17 | `epistemic-frontier-clicks` | | [2026-10-17-epistemic-frontier-clicks.md](2026-10-17-epistemic-frontier-clicks.md) | | 2026-10-17 | `coresearch-simpson-epistemic` | | [2026-10-17-coresearch-simpson-epistemic.md](2026-10-17-coresearch-simpson-epistemic.md) | | 2026-10-17 | `ce64-one-layout-moore-synapse-membrane` | | [2026-10-17-ce64-one-layout-moore-synapse-membrane.md](2026-10-17-ce64-one-layout-moore-synapse-membrane.md) | diff --git a/.claude/handovers/2026-10-17-thinking-tables-pgring-session-to-next.md b/.claude/handovers/2026-10-17-thinking-tables-pgring-session-to-next.md new file mode 100644 index 000000000..16fc14ca8 --- /dev/null +++ b/.claude/handovers/2026-10-17-thinking-tables-pgring-session-to-next.md @@ -0,0 +1,108 @@ +# Handover 2026-10-17 — thinking-tables wiring, PG-Ring catalogue + +Written so the next session starts with the state, the open decisions and the +standing rules in the repo, not in a container that may be gone. + +## 1. Where things stand + +| item | state | where | +|---|---|---| +| Thinking-tables wiring (64 thought tables × set AST × presence folds × FIFO strata × metacognition) | done, in PR | lance-graph #1599, branch `ccr-9f3b8075-74u47l-thinking-tables-wiring`; `.claude/knowledge/thinking-tables-wiring.md`, entry `2026-10-17-thinking-tables-wiring.md` | +| Epistemic frontier capstone | merged | #1597 (`dd00245b`); `.claude/knowledge/epistemic-frontier-capstone.md` | +| Haiku cards: read in full, output capped | merged | #1598 | +| Board arc entries #1592, #1595, #1596, #1597, #1598 | in #1599 | `PR_ARC_INVENTORY.md`, `LATEST_STATE.md` | +| PG-Ring harvester | committed locally only, NOT pushed (ruff push needs the user's approval) | ruff branch `ccr-9f3b8075-74u47l-pgring-harvest`, commit `d2f4c2dcfb`, file `crates/ruff_cpp_spo/examples/harvest_pgring.rs` | +| Thought git API (D-TGA-0..6) | proposal, in #1599; next step D-TGA-0 pre-registration | `.claude/plans/thought-git-api-v1.md` | +| PG-Ring idea catalogue | done, in PR (22 rows: 11 HAVE, 7 ADOPT, 1 REFUSED, 3 OPEN) | lance-graph #1600, branch `ccr-9f3b8075-74u47l-pgring-catalogue`; `.claude/research/2026-10-17-pgring-idea-catalogue.md` | + +## 1b. Decisions taken late on 2026-10-17 (all in `thought-git-api-v1.md` and the wiring doc row 11) + +- The unit is a **thought**, `0..=63` (64 in all; ranges inclusive); "lane" is the SoA lane only. +- A thought table is compute and storage, run like a git branch off main + (thought 0, the givens); 64 thoughts = main + at most 63 branches; partial squash into a kept intermediate. +- The full git model applies; rebase is designed (four masks, no data moved), + needs a read plane R. +- A thought's delta IS the alpha overlay (the attention saccade). +- A sealed version is a PR entry: blame/revert/checkout/merge-base point at + versions, never at reused thought slots. +- Verbs execute as range fold, presence masks, leapfrog seek or ordered merge + by operand density; relalg for non-recursive verbs, Datalog for fixpoints. + +## 2. Decisions the user still owes + +| # | Decision | Recommendation | Why | Caveats | Needs from you | +|---|---|---|---|---|---| +| 1 | ~~"Thoughts" or "lanes"~~ DECIDED 2026-10-17 | "thought", numbered `0..=63`; "lane" stays the SoA lane | — | — | — | +| 2 | ~~Session or storage~~ DECIDED 2026-10-17 | both: compute and storage, squash-committed to main like a git branch, max 64 | — | open design points in the wiring doc row 11 (squash lands as the next sealed version through the revision gate, provenance through the squash, Simpson) | — | +| 3 | ~~Thought table as loop state~~ ANSWERED by #2 | a thought holds its own loop state in its branch until the squash | — | law A1 amendment still to be written for the squash | — | +| 4 | Push the ruff PG-Ring harvester | push + draft PR | it is the only durable copy of the harvest method | PG-Ring is GPL-3.0: the example reads structure only, never vendors code | approval to push to ruff | + +Older open items carry over unchanged: D-ARG-1..4; ndarray PR C (CE64 compat); +lance-graph `edge.rs` conformance; the "bits 61..63" comment in +cognitive-shader-driver's `Cargo.toml` (must name `EpistemicState5`, bits +59..63, as one field). + +## 3. PG-Ring catalogue — how it was built, and how to redo it + +The catalogue is written (#1600). Next steps it names: the dense-AND vs +sparse-seek probe (catalogue §3.3) and the three OPEN rows. The paper text +was read via alphaXiv (`get_paper_content`, arXiv 2608.03840, 2,145 lines +with appendices). What follows is how to rebuild the structural harvest. + +Goal: a clean-room idea catalogue of PG-Ring (Gómez-Brandón, Hogan, Navarro, +ISWC 2026, arXiv 2608.03840; ring index over BWT for property graphs) as prior +art to LEARN FROM for D-ASM-11 (leapfrog triejoin). Ideas and structure only; +no PG-Ring code enters any AdaWorldAPI repo. D-ASM-11 and 11A/11B carry +VIOLATION banners (gather); a catalogue item that needs a data-indexed read is +recorded as such and mapped to presence-bit / range-intersection form +(D-HOLO H14c/H14d), never designed as a gather. + +Inputs (clone if the container is fresh): + +```sh +mkdir -p /home/user/adaworldapi && cd /home/user/adaworldapi +git clone https://github.com/AdaWorldAPI/pg-ring # at ce012ba +git clone https://github.com/adriangbrandon/sdsl-lite # at 8a1e8be +cd /home/user/ruff-pgring # or re-create from the local commit if it survived +PGRING_SRC=/home/user/adaworldapi/pg-ring \ +SDSL_INCLUDE=/home/user/adaworldapi/sdsl-lite/include \ +LIBCLANG_PATH=/usr/lib/llvm-18/lib OUT_DIR=/pgring_harvest \ +CARGO_PROFILE_DEV_DEBUG=0 CARGO_INCREMENTAL=0 \ + cargo run -p ruff_cpp_spo --features libclang --example harvest_pgring +``` + +Known harvest noise: most headers report `divsufsort.h` not found and the +`register` storage-class error from sdsl; classes and call graphs are still +emitted (63 summary files last run). If the local ruff commit is gone and +was never pushed, rewrite the example from the shape of `harvest_textord.rs` (same directory). + +Method (the first attempt lost seven Haiku maps that never wrote output): +one file group per chunk, written to the catalogue file immediately with +`tee -a`, committed after each chunk. Each catalogue row: PG-Ring component +→ what it does (from the paper and the harvested signatures) → our +counterpart or gap (sealed ordered lanes, `seek_from`, `fold_ranges`, +presence-bit rank) → verdict (adopt idea / already have / refused shape). + +## 4. Standing rules a fresh session must know + +The full set lives in session memory, which does not survive a new +container; these are the ones that bit this session. + +- Read before concluding: search finds candidates, a full Read decides. +- Vocabulary: the 64 hypothesis tables are **thoughts** (`0..=63`, 0 = givens); + "lane" means an SoA lane only. +- No foreign keys, no gather, no foreign lanes: a join is a layout that + co-locates the pair at one coordinate; hops are range intersections, + computed symbolically and folded into one mask before any plane AND. +- CE64 bits 59..63 are one field, `EpistemicState5`; never name a sub-range. + S/P/O (bits 0..23) hold palette256 codes only. +- A user's mental model is not canon (e.g. "W = classid of the table" is not + recorded; W is the thought layer, #1597). +- Do not write "operator-ruled/-pinned/-locked/-confirmed" as a status here. +- cargo always with debug 0; v4 timings only, printed tier, ns per element. +- Pushes outside ndarray need the user's approval per case; branches are + `ccr-9f3b8075-74u47l[-slug]`; PRs as drafts, then subscribe. +- Never `git add -A`; stage by name. On an `entries/README.md` conflict take + main's file and rerun `entries_index.py --write`. +- Decisions for the user go in a table: #, Decision, Recommendation, Why, + Caveats, Needs from you. diff --git a/.claude/knowledge/thinking-tables-wiring.md b/.claude/knowledge/thinking-tables-wiring.md new file mode 100644 index 000000000..dbc76779b --- /dev/null +++ b/.claude/knowledge/thinking-tables-wiring.md @@ -0,0 +1,387 @@ +# Thinking tables: wiring to prior plans (PRs #1447–#1596) + +STATUS: WORKING-MODEL. Each row is WIRED (a plan, entry or crate carries it), +PARTIAL (parts are carried, the gap is named) or NEW (nothing prior carries +it). Every cited line was read in its source. + +**Result.** The 64 tables themselves are the most thoroughly carried part: +D-HL decided, placed and measured them (budget, slot placement, identity table, +written-by word, both coverage orientations, givens layer), and D-HOLO H14c/H14d +measured the cross-table reads. What no prior work carries: FIFO order as the +stratum order (N1), a fixpoint run inside one thought table (N2, N3), naming the +written-by queries as the metacognition surface (N4), and the table's lifecycle +as one unit (N5). + +## Why this document exists + +The model below was stated in session on 2026-10-17, with the observation +that everything in it already exists in the work merged as PRs #1447–#1596, +except the 64 layers themselves. This document checks that claim element by +element. It does not introduce a mechanism; it points each element at the +plan, entry or crate that already carries it, and isolates what is new. + +Method: Haiku substrate-mapper runs read every plan, knowledge note, +board entry and crate `lib.rs` changed by those PRs, in full, and copied the +lines that define, decide or measure something. Each wiring claim below is +then verified against the source itself, never against the map alone. + +Separate input, same session: a ruff_cpp_spo harvest of PG-Ring (leapfrog +triejoin over compact ring indexes); its idea catalogue is +`.claude/research/2026-10-17-pgring-idea-catalogue.md` (#1600). It feeds D-ASM-11 +(leapfrog as prior art to learn from, arm A seek over sealed lanes vs arm B +trie zipper), clean-room, and is cited here only where it bears on row 6/7. + +## The model, element by element + +| # | Element | Claim to verify | Candidate prior work | Status | +|---|---|---|---|---| +| 1 | 64 thoughts are 64 tables over one identity | each thought is a whole table over the shared NodeGuid rows; sparse write, merge on read | D-HL (ce64-hypothesis-layers-v1), D-HL-5 thought lanes, D-HOLO H14c | WIRED | +| 2 | Writes are isolated per thought | a thought writes only its own dirty bytes; no thought writes another | D-HL, D-WAL (cycle writer), sparse-write rulings | WIRED | +| 3 | Reads cross thoughts by presence-bit folds | `T_a[i] : T_b[i]` at the same coordinate, never a gather or foreign key | D-HOLO H14d `Thought(t)[T_a[i] : T_b[i]]`, presence planes P_l | WIRED | +| 4 | Provenance is the written-by word | per row, which thoughts wrote it, as presence bits | D-HL-3 evidential base, H14c/H14d presence planes | WIRED | +| 5 | Independence for revision is decided by source bits | per-delta source bitset, not the thought number | D-HL-3, revision layer invariants (G1–G7), isa::truth | WIRED (probe not run) | +| 6 | Set theory is the AST | ∩ AND, ∪ OR, − AND NOT, σ aperture, π table/field choice, ⋈ layout, μ fixpoint | relalg-v1 (D-RA-1..4), metta-datalog-assimilation (D-ASM), D-TELEPORT fold_ranges | PARTIAL | +| 7 | Datalog fixpoint inside a thought | semi-naive: Δ = new AND NOT old, done when popcount(Δ) = 0 | D-RA-3/4 (rules as algebra values, μ via the d′ driver), D-MTP-1 | PARTIAL | +| 8 | FIFO scheduling is stratification | a thought frees at fixpoint; FIFO order is the stratum order negation needs | D-ASM schedule, NAL schedule-depth audit, D-NALP | PARTIAL | +| 9 | Uses: time series, lenses, parallel NAL rules | one thought per year, per lens, or per NAL rule | D-WAL-6/7 temporal, nal-polyfill-v1, NAL audit inventory | PARTIAL | +| 10 | Foreign-key-shaped queries are native metacognition | who wrote it, who agrees (AND + popcount), who disagrees, as plane algebra | NAL-9 inventory, epistemic-frontier capstone (#1597), Simpson coresearch (#1596) | PARTIAL | +| 11 | The 64-layer table itself | 64 tables as the unit of thought, with its lifecycle | none expected | NEW (as a unit) | + +## Wiring (each cited line read in source) + +Paths are relative to the repository root. `#1597` is the epistemic-frontier +capstone, `.claude/knowledge/epistemic-frontier-capstone.md` (merged as +#1597); its lines are cited as `(#1597)`. + +**Vocabulary (DECISION 2026-10-17).** The unit is a **thought**, numbered +`0..=63`, 64 in all (thought 0 = givens, `1..=63` = the 63 hypotheses; the +W field, CE64 bits 53..=58). Ranges are written inclusive (`..=`) so no +reader takes them as Rust's half-open `0..63`, which stops at 62. "Lane" is +reserved for SoA lanes: each thought owns up to 32 lane-tables (lane 0 +identity, 1 edge, 2..31 value), so up to 2,048 lane-tables +(`.claude/plans/ce64-hypothesis-layers-v1.md:386-391`). The model's +"64 lanes = 64 tables" reads as 64 thought tables. BASIS: "lanes is already +used for SoA lanes". SCOPE: docs, code and PR text from here on. + +### 1. 64 thought tables over one identity — WIRED + +- `ce64-hypothesis-layers-v1.md:16-19`: "up to 64 parallel hypothesis layers + over an immutable address space. Each layer is a sparse delta … keyed by + `NodeGuid` / row id, merged on read." +- `:290-295` DECISION 2026-10-14: up to 64 tables; each writes only its delta; + a thought is placed globally (a table of its own) or locally (one 16-byte slot + of a shared table). `:301-302`: the key slot never changes; the 65th table is + refused. +- `:470-476` identity table: 64k rows × 32 lanes, addressed by NodeGuid rank; + `:484-488` chosen arm M: one 64-bit written-by word per row, overlays per + (row, thought). `:576-577`: dense tiles use the Morton code as the row. +- `.claude/plans/d-holo-h14c-thought-first-v1.md:145-147`: one table per + (thought, lane), indexed by the address, plus a presence plane per table. +- `.claude/board/entries/2026-10-11-photo-probe-64-populations.md:40-43` + (D-PHOTO-0): with 64 resident populations over 1,048,576 addresses, + bit-sliced planes win on every regime but one; they touch only the planes an + expression names. + +### 2. Writes isolated per table — WIRED + +- `ce64-hypothesis-layers-v1.md:118-120` (D-HL-5): one writer per lane; + `run_wave` and `run_wave_parallel` byte-identical. +- `:301-302`: a slot-placed thought may write and read only its own slot. +- `.claude/knowledge/split-tunnel-sparse-append-resident-fold.md` rule 1 + (sparse records, never a full row image) and rule 2 (one batch = one Lance + version, one writer per mailbox; a racing writer is detected, not refused). +- Givens: only hydration writes layer 0; a conflicting hypothesis write is + refused and recorded as a contradiction (`ce64-hypothesis-layers-v1.md:692-701`). + +### 3. Reads cross tables at one coordinate, by presence — WIRED + +- `d-holo-h14c-thought-first-v1.md:29-41`: `Thought(t)[Table(a)[i] : Table(b)[i]]`; + "presence says whether a value is there, never where it is." +- `:107-122`: presence planes of 65,536 bits per (thought, lane); population, + shared occupancy `popcount(Pa & Pb)`, Hamming `popcount(Pa ^ Pb)`, joint + availability `A & Pa & Pb`, all as mask-risc programs. +- `:409-413` measured: 0.9–1.2 ns per 64-address word; session OR over 64 + thoughts 19–32 ns per word. +- `.claude/board/entries/2026-10-16-synergy-map-since-1579.md:282-303` (H4): + a triangle is `R[a][b] ∧ S[b][c] ∧ T[a][c]`, each plane read at the + coordinate itself; the work is the symbolic run intersection that chooses + which coordinates to visit. +- `.claude/plans/d-holo-h14d-logic-mask-read-v1.md`: the four stages (logic, + address mask R over presence planes and aperture, Lance 13 masked read, + terminal); 34 % of 2,000 programs decided symbolically. + +### 4. Provenance is the written-by word — WIRED + +- `ce64-hypothesis-layers-v1.md:596-609`: R = one 64-bit written-by word per + row, C = per-thought masks; queries Q-ID, Q-TH, Q-PAIR, Q-PERSP. +- `:643-660` measured: Q-PERSP 1.1 ns on the row words; aperture queries at most + 0.40 ns per row; both orientations kept, each query routed to its faster one. +- `d-holo-h14c-thought-first-v1.md:93-95`: "a read reports which thought + supplied the value, so their evidence is not conflated." +- `#1597` capstone `:148`: W and the written-by word name the lane; they point + nowhere. Its D-HL-1 note records W (CE64 53..58) as the thought layer + (0 givens, `1..=63` hypotheses). + +### 5. Independence decided by source bits, not by the table — WIRED (probe not run) + +- `ce64-hypothesis-layers-v1.md:73-90` (D-HL-3): each delta carries + `(layer, seq, evidential base)`, a source bitset; the fixture separates layer + from provenance (one observation in two layers counts once; two independents + in one layer count twice); the layer-keyed rule is the disable. Not yet run. +- `.claude/plans/nal-polyfill-v1.md:366-375`: `Beliefs::seal_evidence` classes + each piece (independent / duplicate / overlapping / no stamp); revision + refuses overlap and missing provenance. +- `.claude/board/entries/2026-10-14-revision-layer-invariants.md:15-16`: G1 an + echo earns zero weight; G2 a synthesis needs a new independent root. +- `.claude/board/entries/2026-10-12-nars-self-evidence-literature.md:15`: the + same test from the literature side (Wang, Li & Hammer 2018). + +### 6. Set theory as the AST — PARTIAL + +- `.claude/plans/d-cmr-concept-chain-normalization-v1.md:80-118`: the set IR + (`Runs`, `Res`, `∩ ∪ ∖`, complement over a universe, measures), describing + only, never executing; `:110-113` home in the contract. +- `.claude/plans/relalg-v1.md:14-28`: D-RA-1 built `Rel` + `normalize` over one + table; `:68-72`: no joins, no recursion. +- `.claude/board/entries/2026-10-16-synergy-map-since-1011.md:101-107` (D1): + one set algebra in four spellings (relalg `Rel`, contract `Runs`, D-HOLO + interval sets, quack `fold_ranges`); the hinge is D-RA-2. +- σ (aperture): `nal-polyfill-v1.md:322-328`, `SealedFacetLane::bound_aperture`. + π (field choice): `:174-186`, the binder's `WideFieldMask`. +- ⋈: no operator. The join is the layout (H14c/H14d; the 2026-10-16 rulings + that put VIOLATION banners on D-CMR-5 `:216`, relalg-v1 `:70` and the D-ASM + entries). +- μ: not in relalg; see row 7. + +### 7. Fixpoint inside a table — PARTIAL + +- `.claude/board/entries/2026-10-03-coresearch-chained-hop.md:44-46`: the step + `f ← Aᵀf .∗ ¬v` is Datalog semi-naive, DBSP and BFS alike; operand reuse + carries one mask. That is the model's Δ = new AND NOT old. +- `:63`: the two-population semi-naive form (Δ and I) was SKIPPED as an extra + undemanded population that bought nothing span-bound. +- `:51-53`: law A1 allows only demanded population-sized writes, so loop state + needs an amendment; `:144`, `:171-175`: recursion lives in an external d′ + driver; full loop state inside mask-risc is held. +- `relalg-v1.md:63` (D-RA-4): bounded recursion as a frontier fixpoint in that + driver. Its preimage step is gather-bannered (`:70`). +- `.claude/board/entries/2026-10-11-residue-fixed-point.md:10-19` + (D-RESIDUE-FP-0, MEASURED): the reasoning loop runs to a fixed point; extra + passes over the same evidence move no bit; only new evidence lowers the + residue. That is the termination test the model's "done when popcount(Δ) = 0" + needs, pinned for hydration. + +### 8. FIFO scheduling as stratification — PARTIAL + +- Stratification exists as rungs: `.claude/plans/self-reasoning-substrate-v1.md:100-109` + (Layer 3, rungs = Tarski stratification) and `:254-266` (D-SRS-2, enforcement + as a test). +- FIFO exists only as a scheduler baseline: `.claude/board/entries/2026-10-07-ce64-cycle-0-cross-cycle-executor.md:7` + (a FIFO worklist that reads no entropy), `:47-48` (FIFO yields about twice + the productive folds per second at 1M; informative work is front-loaded); + `.claude/plans/sag-reflexive-cognition-from-1509-v1.md:76` (D-SAG-5-5 + scheduler factorial); `.claude/plans/sag-wisdom-frontier-hard-problems-v1.md:94`. +- A wave scheduler exists: `.claude/knowledge/nal-recipe-audit/schedule_depth.md:20-23`. + A recipe is ready iff its `requires` are known; one wave runs; `known |= + writes`; repeat until none is ready. Each wave is a stratum. +- Its limit is the model's point: `:72-80` the scheduler tracks one grounded + bit per field, so a read after another recipe's write is invisible; `:89-98` + a second wave needs produced objects with an identity and an input channel + for them. A thought table's written-by bits are such an identity. +- `:133-135`: `AlphaTunnel` merges its 10 rung lanes in (rung, seq) order, and + `:79-80` each rung lane gets its own seed copy. +- Nothing ties FIFO order to negation strata or to a table freeing at + fixpoint. Search space for that negative: `grep -i fifo` over `.claude/plans`, + `.claude/knowledge`, `.claude/board/entries` and `crates` (`*.md`, `*.rs`), + 19 files; every plan, knowledge and entry hit was read at its line. The 9 + crate hits (`onebrc-probe`, `holograph`, `lance-graph-ontology`, + `lance-graph-archetype`, `lance-graph-planner` example, contract `savants.rs`, + `deepnsm`) were not read. + +### 9. Uses — PARTIAL + +- One table per NAL strategy: `#1597` capstone `:221-225` ("A thought = + (strategy, front end) compiled once into one program, running in one lane"). +- Time: `d-holo-h14c-thought-first-v1.md:281-283` (`VersionClock`, D-WAL-6); + `.claude/board/entries/2026-10-16-synergy-map-since-1011.md:79` (WAL arc; the + version clock is not yet wired to a reader). +- Snapshot condition: `.claude/board/entries/2026-10-12-nars-self-evidence-literature.md:18`, + a pinned Lance version k must replay identically while k+1 appends. +- Lenses: no source in the mapped range names a lens table. +- Caution from `.claude/board/entries/2026-10-17-coresearch-simpson-epistemic.md:28-33`: + NAL revision of stratum beliefs equals the union recount, so revising across + per-year or per-lens tables is the amalgamation Simpson's paradox warns about. + +### 10. Foreign-key-shaped questions as metacognition — PARTIAL + +- Who wrote it: Q-PERSP / Q-TH (row 4). Who agrees: `popcount(Pa & Pb)` + (H14c `:112-118`). Who disagrees with the givens: the contradiction records + (`ce64-hypothesis-layers-v1.md:696-699`). +- `d-holo-h14c-thought-first-v1.md:124-128`: presence agreement, value equality, + semantic agreement, evidential independence and causal confidence are five + different things. A popcount answers the first two only. +- NAL-9 steps 1–4 are covered by the saccade, hypothesis layer, givens and + written-by words; steps 5–6 are what a NAL-9 thought must show (`#1597` `:227-233`). +- Simpson map `:72-75` (SEAM-STRATUM-PROVENANCE): stratum of origin is a fourth + axis, separate from evidential independence. + +### 11. The 64-table unit with its lifecycle — NEW as a unit + +The parts exist (budget, placement, written-by word, givens, sessions, +validation ladder), but no plan treats "open a thought table, run a fixpoint in +it, commit or free it" as one lifecycle. The commit step is D-HL-8, unbuilt +(`ce64-hypothesis-layers-v1.md:36`). + +**DECISION 2026-10-17 — the lifecycle is git branching.** A thought table is +both compute and storage. Thoughts are branches over main (thought 0, the +givens); at most 64 exist at once. A thought computes and stores in its own +table; when it is done it is flattened (squash-committed) into main, which +frees its slot so a new thought branch can open. BASIS: "A thought table is +compute and storage. It just needs to flatten/flush/squash the commit to the +main to open new thought branches. Same as if you use GitHub and max 64 +branches." The 64 are thought 0 (main) plus 63 branches, so at most 63 +branches are open at once. The squash is the D-HL-8 commit. Consequences for the open +points: O2 is closed (both), N2 is answered (a thought holds its own loop +state; its writes stay in its branch until the squash), and O4 narrows to +the squash itself (derived facts live in the branch; only the squash writes +main). + +**Partial squash (same day).** A selection of thoughts can also be squashed +into an intermediate thought that is kept as a thought of its own, like +merging several branches into an integration branch. The selected slots are +freed except the one the intermediate occupies; the intermediate can later +be squashed to main, or combined again. BASIS: "You could also squash a +selection of the 64 thoughts and keep the squashed intermediate." Two +consequences follow from slots being reused: + +- **Provenance cannot be the thought number.** After a squash a freed number + is reused by an unrelated thought, so the written-by word only says which + slot wrote a row now. What survives a squash, partial or to main, is each + fact's source bitset (D-HL-3), which is why D-HL-3 decides independence by + source bits and not by the thought. +- **A partial squash is where strata can be kept.** Squashing per-year or + per-lens thoughts into one intermediate per stratum, instead of into main, + keeps the stratum axis the Simpson map asks for (O5). + +**The full git model applies (same day).** BASIS: "In principle everything +you already know from GitHub." The mapping below is a design reading of that +ruling; the third column says what in the substrate already plays the part, +and nothing in it is built for this purpose yet. + +| git | thought tables | already in the substrate | +|---|---|---| +| main | thought 0, the givens of the current sealed version | givens table per (classid, sealed version), D-HL `:702-725` | +| commit on main | a new sealed version | a Lance version | +| branch | thought `1..=63`, a sparse delta over main | the per-thought delta, D-HL `:16-19` | +| diff | the thought's written rows | presence plane and written-by word | +| merge-base | the sealed version the thought branched from | Lance version number | +| squash merge | flatten a thought into the next sealed version | D-HL `:19-20` ("a layer that clears a validation ladder is composited into the base"); the D-HL-8 commit, unbuilt | +| merge conflict | a thought's value against a given or against main's newer value | contradiction record, D-HL `:706-709` | +| review before merge | the revision gate deciding whether a squash may land | Gadamer gate G1–G7 (`2026-10-14-revision-layer-invariants.md`) | +| rebase | replay a thought's delta onto a newer main when main advanced since its merge-base | none yet | +| integration branch | partial squash into a kept intermediate thought | none yet | +| blame | which source supplied a fact | per-fact source bitset, D-HL-3 | +| revert | a new sealed version that undoes a squash | none yet; Lance time travel reads old versions | +| checkout of an old commit | read main as of an earlier sealed version | Lance version read; D-WAL-6 version clock | +| branch limit | 64 open thoughts including main | the thought budget, D-HL `:386-391` | + +Rebase is the one with no counterpart: a thought opened on version v and +squashed after main reached v+1 must be compared against v+1, not v, or it +squashes against stale givens. + +### Rebase — design proposal from git prior art (HYPOTHESIS, not built) + +Asked for 2026-10-17 ("I don't mind a rebase … I presume GitHub prior art +will help"). Git replays a branch's commits onto the new tip of main and +stops on each conflict; GitHub's "require branches to be up to date" makes +that a precondition of merging. Carried over: + +1. **Rule (branch protection).** A thought may squash only when its + merge-base is the current sealed version of main. Otherwise it rebases + first. Rebase happens lazily, at squash time, not every time main moves. +2. **A rebase moves no data.** A thought is a sparse delta keyed by the + immutable address, so replaying it onto v+1 rewrites nothing: the + merge-base advances and four masks decide what else happens. Let `M` be + the cells main changed between v and v+1 (the written-by plane of the + squash that made v+1), `W` the cells the thought wrote, `R` the cells it + read: + - `W ∧ ¬M` and `R ∧ M = ∅`: clean; fast-forward the merge-base. + - `W ∧ M`, same value as main: agreement; the cell leaves the delta + (git drops an empty commit). + - `W ∧ M`, different value: conflict; the existing contradiction record + (row, thought, lanes, offered cell), never an overwrite. + - `R ∧ M ∧ ¬W`: nothing collides textually, but facts the thought derived + from those cells may be stale (git's "rebased cleanly, tests fail"). + The thought re-runs its fixpoint with `R ∧ M` as the delta, the same + semi-naive step as row 7 (`f ← Aᵀf ∧ ¬v`). +3. **What is missing is `R`.** The written-by word gives `W` and the squash + gives `M`; no plan records what a thought read. `R` would be one more + presence plane per thought, the shape H14c already uses for writes. +4. **Merge queue.** When several thoughts are ready, GitHub's merge queue + squashes them one at a time, each rebased on the result of the one + before. That order is a FIFO of squashes, which is where row 8's + "FIFO order as the stratum order" would live. +5. **rerere.** Git can reuse a recorded conflict resolution. The + contradiction records already persist, so a repeated conflict on the same + (row, lanes, offered value) can be resolved the same way without a second + revision pass. + +**Falsifier.** For any thought T opened on v and any main advance v→v+1: +`squash(rebase(T, v+1))` equals `squash(T re-run from scratch on v+1)`, cell +for cell, contradiction records included. Fixture cases: clean, agreement, +conflict, stale read, and a merge queue of three thoughts. Disables: drop the +`R ∧ M` re-run (the stale-read case must fail), and squash without rebasing +(the conflict case must fail). + +Open: whether `R` is recorded per cell or per aperture (a range over the +address is cheaper and may suffice, since reads are apertures); where in +D-HL-8 the rule sits; whether a long-lived thought should rebase eagerly to +keep its conflicts small. + +Points this ruling leaves to design, not yet decided: + +- **The squash writes the next version, not the givens table.** Only + hydration writes thought 0, and a given is never overwritten; the givens + table is read-only per (classid, sealed version) + (`ce64-hypothesis-layers-v1.md:702-725`). So the squash lands as the next + sealed version of main, whose givens are rebuilt at seal; it must pass + the revision gate (G1–G7), and a conflict with a given stays the existing + contradiction record, never an overwrite. +- **Provenance through the squash.** Flattening a branch must keep each + fact's source bitset (D-HL-3); otherwise revision in main cannot tell an + echo from an independent confirmation (G1). +- **Branch count.** Main is thought 0 (the givens), so 63 hypothesis + branches (`1..=63`) can be open at once beside it (`:702-705`). +- **Simpson.** Squashing several per-stratum branches into one main is the + amalgamation the Simpson map warns about (O5); strata need to survive the + squash as a declared axis. + +The nearest lifecycle prior is the goal state machine of +`.claude/plans/rubicon-volition-v1.md:24-50` (open, candidate, committed, +acting, evaluating, released), and the revision invariants R1–R4. It is for +goals, not thoughts, and its boundary ruling (`:106`) keeps volition out of +CE64 and mask-risc; a thought-table lifecycle can borrow its shape (explicit, +replayable transitions) but not its records. + +## What is new + +| # | item | evidence of absence | where it would land | +|---|---|---|---| +| N1 | FIFO order as the stratum order: a table frees at its fixpoint, and the next stratum may read it negated. The wave scheduler exists; what it lacks is produced objects with identity (schedule_depth `:89-98`) | row 8 search space | `self-reasoning-substrate-v1` D-SRS-2 or a new D-HL item; needs a test that a negated read of an unfinished table is refused | +| N2 | A thought table as the bracketed loop state the chained-hop round 2 asked for (one owner, branch lifetime, squash to main only through the ladder; answered by the row-11 DECISION) | chained-hop `:51-53` holds loop state pending an amendment; D-HL `:474` sessions are temporary | a decision on chained-hop option (b)/b-lite, recorded against D-HL-5 | +| N3 | Fixpoint (μ) inside one thought table | relalg `:68-72` (no recursion); D-RA-4 `:63` driver only | D-RA-4, once its step is rewritten without the gather-bannered preimage | +| N4 | The written-by / presence queries named as the metacognition surface | rows 4 and 10: the queries exist and are measured; no front end exposes them | NAL-9 strategy table (`#1597` §6) | +| N5 | The lifecycle as one unit | row 11 | D-HL-8 | + +## Open points + +| # | point | sources | +|---|---|---| +| O1 | CLOSED 2026-10-17: the word is **thought** (`0..=63`); "lane" stays the SoA lane. | D-HL `:386-391`; vocabulary paragraph above | +| O2 | CLOSED 2026-10-17: both — a thought table is compute and storage, squash-committed to main like a git branch (row 11). Was: session or storage: D-HL says the 64 thoughts are session addresses, not storage; the capstone says a thought's materialization is its table's sparse storage layer. If kept, a cached population needs its own type over the same word layout, never `AlphaMask`. | D-HL `:474`; `#1597` `:148`; photo-probe `:57-63` | +| O3 | Precedence or fold: a merged read uses "higher thought index wins a shared lane", an overwrite rule; set questions use presence folds. Which reads use which is not written down. | D-HL `:412`, `:491`; H14c `:93-95` | +| O4 | NARROWED 2026-10-17: derived facts live in the thought's branch; only the squash writes main (row 11). Was: derived facts written into a table versus split-tunnel rule 7 (derived reads write nothing) and law A1 (only demanded population writes). | split-tunnel rule 7; chained-hop `:51` | +| O5 | Tables as strata: folding per-year or per-lens tables for revision reproduces Simpson's amalgamation; the stratum guard is only a probe. | Simpson map rows 1, 4 | +| O6 | The relalg absorption defect and the home of the set IR wait on D-RA-2. | synergy map D1; ledger N17 | +| O7 | The model's reading "W = the classid of the table" is not in any plan and is not recorded here as canon; `#1597` records W as the thought layer, and its classid commit was reverted. | `#1597` D-HL-1 note | +| O8 | Coverage: PRs #1447–#1496, #1504–#1591 mapped by Haiku (two items per map checked in source); #1499, #1500, #1593 and #1596 read directly; #1497, #1498, #1501–#1503, #1592, #1594 and #1595 not mapped. | maps in the session scratchpad | diff --git a/.claude/plans/thought-git-api-v1.md b/.claude/plans/thought-git-api-v1.md new file mode 100644 index 000000000..b23dd4eb5 --- /dev/null +++ b/.claude/plans/thought-git-api-v1.md @@ -0,0 +1,233 @@ +# Thought git API (D-TGA) — v1 + +**Status:** PROPOSAL, 2026-10-17. Test-first; nothing built. +**Asked for:** "What would be genuinely valuable would be a git like API." +**Model (decided 2026-10-17, `.claude/knowledge/thinking-tables-wiring.md` +row 11):** a thought table is compute and storage. Thoughts `1..=63` branch off +main (thought 0, the givens of the current sealed version); a finished thought +is squash-committed into the next sealed version, freeing its slot; a +selection of thoughts can be squashed into a kept intermediate thought; the +rest of git applies. + +## Overview + +One small surface over pieces that exist, so a caller reasons about thoughts +the way they reason about branches, and every verb lowers to mask algebra and +Lance versions. No new algebra, no interpreter, no strings as addresses: +a thought is its number (`0..=63`, 64 in all), a version is a Lance version, a cell is a +coordinate; names are labels resolved once through the label codebook. + +## What exists and is reused + +| git verb | existing piece | file | +|---|---|---| +| reserve the address space once, share it | `AlphaAllocation` borrowed by many overlays (`over_shared`) | `crates/lance-graph-contract/src/alpha.rs` | +| one writer per branch, no lock | `AlphaTunnel` lanes, each with its own `&mut` | `crates/lance-graph-contract/src/alpha_tunnel.rs` | +| deterministic merge order | `AlphaTunnel::merge`, ordered by `(rung, seq)`, never by completion | same | +| diff between two branches | `AlphaOverlay::only_in` | `alpha.rs` | +| delete a branch | `AlphaOverlay::discard` (consumes self) | `alpha.rs` | +| mask set algebra | `AlphaMask::{and, or, and_not, xor, not}` | `alpha.rs` | +| givens, contradiction records | D-HL givens layer | `ce64-hypothesis-layers-v1.md` section "Givens layer: hydration is thought 0" | +| written-by word, coverage orientations | D-HL arm M, R/C | same plan, section "Coverage orientation: per-thought masks or per-row words" | +| source bitset (blame) | D-HL-3 evidential base | same plan, under D-HL-3 | +| review before merge | revision gate G1–G7 | `.claude/board/entries/2026-10-14-revision-layer-invariants.md` | + +**The delta is the attention saccade (DECISION 2026-10-17).** A thought's +delta is not a second kind of thing beside the alpha overlay: it *is* the +overlay, the record of where attention went, the way a PR is the attention +of a code update. BASIS: "The delta IS the attention saccade. The same way a +PR is the attention of a code update." So the thought type is the alpha +overlay, carried to 64 thoughts. This is consistent with the overlay's own +doc: what it forbids is *reference* data (a value a bake measured, +calibration, coverage) living in the overlay, and it says a changed reference +value is a new reference version, never an overlay write. That is exactly +`land`: a squash writes the next sealed version, never into the overlay or +the current givens. + +(Superseded first reading, same day: this paragraph previously kept a +separate thought type because "alpha holds attention, thoughts hold values". +The distinction the alpha doc draws is attention vs reference, not attention +vs value.) + +What changes in the overlay to carry it: + +- **Axis.** `AlphaTunnel` has 10 lanes, one per rung; D-HL places up to 64 + thoughts beside the 10 rung lanes. The thought axis is a second index over + the same shared allocation, not a re-use of the rung index. +- **Lookup.** `AlphaOverlay` finds a claimed row through a `HashMap`; under + the rule against key reads, positions become the rank in the overlay's own + presence plane (see "No hash lookups" below). +- **Values (Codex review on #1599).** Today a claimed overlay row carries + only its `AlphaStamp` in value slot 0 and zeroes the rest of the value + slab and the edge block (`alpha.rs`, `claim`). That records where + attention went, not what the thought wrote there, so `diff`, the rebase + value comparison, `blame` and `land` have nothing to read. Carrying the + overlay to thoughts therefore needs the written cells (lane, value, + source bits) at the same coordinate as the claim. Two layouts keep that + rule: (a) the claimed row's own value slab, after the stamp; (b) a sparse + value plane per thought indexed by the same presence rank. The choice is + D-TGA-1's first decision; either one changes a stored layout and needs + the field-isolation tests (I-LEGACY-API-FEATURE-GATED). The values a + thought writes are its own derivations, not reference data, so neither + layout conflicts with the alpha doc's rule. + +## The surface (methods on carriers) + +```text +Main (sealed version v, givens table thought 0) + .branch() -> Result // takes a free slot in 1..=63 + .version() -> LanceVersion + .checkout(v) -> Main // read-only, Lance version read + .log() -> versions with the squash that made each + .blame(addr, lane) -> SourceBits // D-HL-3 + +Thought (slot 1..=63, merge_base = the version it branched from) + .write(addr, lane, cell, source) // W; givens refuse, contradiction recorded + .read(aperture) -> mask // R, recorded (new plane) + .diff() -> mask // W + .status(&main) -> {behind, clean, agreed, conflicts, stale} + .rebase(&main) -> RebaseReport // four masks, no data moved + .squash_into(self, others) -> Thought // partial squash, kept intermediate + .discard(self) // frees the slot + +MergeQueue (FIFO of thoughts ready to land) + .enqueue(Thought) + .land(&mut main) -> Result // up-to-date rule, gate, squash +``` + +`squash_into`, `discard` and `enqueue` take the thought by value, so a +squashed or discarded thought cannot be written again: slot freeing is a +compile-time property, as `discard` already is for overlays. + +## How the verbs are executed (the optimisation) + +Every verb is one of four existing executions; which one is chosen by the +shape and density of its operands, never per verb by hand. + +| execution | what it is | verbs that use it | +|---|---|---| +| **range fold** (Schnittpunkt, `fold_ranges`) | intersect apertures symbolically before anything runs; most reads are apertures, so `R ∧ M` is often a range intersection with no plane touched | `read`, `status`, `rebase` (stale check), `checkout` bounds | +| **presence-bit masks** | word-wise AND / AND-NOT / popcount over the 65,536-bit planes, dense and branch-free; measured 0.9–1.2 ns per 64-address word (H14c) | `diff`, `status`, `rebase` when W, R, M are dense | +| **leapfrog seek** (`OrderedLane::seek_from`, galloping) | intersect sorted sparse address lists in time proportional to their alternation, not to the plane size | `rebase` and `status` when W, R, M are sparse; `blame` lookups | +| **ordered merge / fold** | k-way merge of sorted sparse deltas by address in a fixed order, as `AlphaTunnel::merge` does by `(rung, seq)` | `squash_into`, `land`, `MergeQueue` (FIFO), the stale-read fixpoint re-run (semi-naive fold) | + +Above the four executions sits the choice of IR, by whether the verb +recurses: + +| IR | used for | why | +|---|---|---| +| **relalg** (`Rel` + `normalize`, D-RA-1; proven rewrites) | the non-recursive verbs: `diff`, `status`, the four rebase masks, `land`'s up-to-date check | each is a fixed set expression over W, R, M and the givens; `normalize` simplifies it (absorption, range merging) before it lowers to one of the executions above | +| **Datalog** (semi-naive fixpoint; recursion in the external d′ driver, D-RA-4) | the stale-read re-run, any rule a thought derives with | recursion needs μ, which relalg does not have; Δ = new AND NOT old is the same step as row 7 of the wiring doc | +| **stratification** | `MergeQueue` order, squashes that read another thought's result negated | a negated read of a thought that has not reached its fixpoint is unsafe. FIFO order alone does not give strata (Codex review on #1599): a caller can enqueue B, which reads A negated, before A. So each thought records which thoughts it reads negated; `land` refuses B while A is unlanded, the queue orders by that dependency and keeps FIFO only among independent thoughts, and a cycle through negation is refused at `enqueue` (wiring doc row 8, N1) | + +The relalg path waits on D-RA-2 (the absorption defect and where the set IR +lives, synergy map D1); the Datalog path on D-RA-4's step being rewritten +without the gather-bannered preimage. + +Two consequences: + +- **Dense vs sparse is the open measurement.** A thought usually writes few + cells of a 64k table, so its W is sparse while M after a big squash may be + dense. The crossover between mask AND and leapfrog seek is exactly the + OPEN rows P3/P11 of the PG-Ring catalogue (#1600); the rebase verb is that + probe's first real consumer. +- **No hash lookups.** Positions inside a thought's sparse storage are the + rank of the address in the thought's own presence plane (popcount of the + bits before it). `AlphaOverlay` keeps a `HashMap` from address to slot + today; carrying it to thoughts replaces that with the rank. + +## A sealed version is a PR entry (DECISION 2026-10-17) + +BASIS: "If we use sealed version as PR entries it would make versions +cheaper and cleaner reference." Each `land` produces exactly one sealed +version, and that version *is* the record of the landed thought: what it +changed (its delta), which sources it carried (source bitsets), what the +revision gate decided, which conflicts were recorded, which version it was +rebased onto. `Main::log()` is then the PR history. + +Why it is cheaper: a version holds only the squashed delta, so it costs the +cells the thought changed, not a rewrite of the table. The split-tunnel +pattern already asks for one batch = one Lance version from one writer +(`split-tunnel-sparse-append-resident-fold.md`, rule 2); a landed thought is +that batch. + +Why it is a cleaner reference: a version number is never reused, while a +thought number is (slots are freed by squash). So: + +- **blame** returns `(landing version, source bitset)`: which PR brought a + fact in, and from what evidence; +- **revert** is a new version that undoes one PR entry; +- **checkout** reads main as of a PR entry; +- **merge-base** is a PR entry, so rebase compares against a named, fixed + reference; +- a citation, a contradiction record or a NAL stamp can point at the + version that landed a fact, a stable address, instead of at a slot. + +Open: where the PR record lives (alongside the version as its metadata, or +as rows of a small log table keyed by version); what Lance 13 lets a commit +carry has to be checked before choosing. + +## Rules + +1. **Up to date before landing.** `land` refuses a thought whose + `merge_base` is not main's current version; the caller rebases first. +2. **Rebase moves no data.** Four masks over `W`, `R` and `M` (main's change + since `merge_base`): clean → fast-forward; same value → drop the cell; + different value → contradiction record; `R ∧ M ∧ ¬W` → re-run the + thought's fixpoint from that delta. + A semi-naive re-run only adds facts, so a deletion or changed value in + `M` would leave conclusions derived from the old value behind (Codex + review on #1599). Before the re-run, every derived cell whose derivation + read a cell in `R ∧ M` is retracted, then re-derived if it still follows + (delete-and-rederive, DRed: Gupta, Mumick, Subrahmanian 1993). This + needs, per derived cell, the cells it was derived from: the per-fact + source bitset (D-HL-3) or a read-provenance plane, decided in D-TGA-3. +3. **Landing writes the next version.** A given is never overwritten and the + givens table is read-only per sealed version; `land` produces version + v+1 and the givens are rebuilt at its seal. +4. **Blame survives the squash.** Every squashed cell keeps its source + bitset and the version that landed it; the thought number does not + survive (slots are reused), the version number does. +5. **Strata survive.** A partial squash per stratum keeps the stratum axis; + squashing strata straight into main is refused unless the caller declares + the pooling (Simpson map). + +## Work items (test-first; each lands with its falsifier first) + +- [ ] **D-TGA-0** Pre-registration: fixtures (clean, agreement, conflict, + stale read, partial squash, merge queue of three), the oracle (a thought + re-run from scratch on the new version), and the disables, written before + any code. +- [ ] **D-TGA-1** The alpha overlay carried to 64 thoughts (a thought axis + beside the rung lanes, presence-rank lookup instead of `HashMap`); `branch` / + `discard` / `write` / `diff`; limit of 63 branches (64 thoughts with + main); givens refusal with a contradiction record. Falsifiers at both + edges: with 62 branches open the 63rd `branch()` succeeds and gets the + last free slot; with 63 open the 64th is refused; slot 0 is never handed + out; a write to a given's lane with a new value records a contradiction + and changes nothing. +- [ ] **D-TGA-2** Read plane `R` and `status`. Falsifier: a read outside + `R` is never reported stale. +- [ ] **D-TGA-3** `rebase`. Falsifier: rebase-then-squash equals a + from-scratch re-run on v+1, cell for cell, records included, on fixtures + that include a deletion in main (the thought derived B from A, main + deletes A: B must be gone after rebase). Disables: drop the stale-read + re-run; skip the conflict check; skip the retraction step. +- [ ] **D-TGA-4** `land` through the revision gate into the next Lance + version (D-HL-8). Falsifier: landing a thought that is behind is refused. +- [ ] **D-TGA-5** `squash_into` and `blame`. Falsifier: after a partial + squash and slot reuse, `blame` still returns the original sources. +- [ ] **D-TGA-6** `MergeQueue`. Falsifiers: three independent thoughts + landed through the queue equal the same three landed by hand in FIFO + order, rebasing each; B enqueued before A, with B reading A negated, + lands after A; a cycle through negation is refused at `enqueue`. + Disable: order by FIFO only. + +## Open + +- Whether `R` is per cell or per aperture. +- Where the thought type lives: contract (types only) with execution in + mask-risc / quack, as every other carrier. +- Timings: v4 only, ns per cell, tier printed by the program. +- The dense/sparse crossover that picks presence masks or leapfrog seek per + operand (catalogue P3/P11); measured, not assumed.