Skip to content

feat(grammar): Phase 1 — ContextChain reasoning + role keys + knowledge docs#210

Merged
AdaWorldAPI merged 1 commit into
mainfrom
claude/deepnsm-grammar-phase1
Apr 19, 2026
Merged

feat(grammar): Phase 1 — ContextChain reasoning + role keys + knowledge docs#210
AdaWorldAPI merged 1 commit into
mainfrom
claude/deepnsm-grammar-phase1

Conversation

@AdaWorldAPI
Copy link
Copy Markdown
Owner

Summary

Phase 1 of the elegant-herding-rocket plan. Three pure-additive deliverables + three knowledge docs. Zero breaking changes, contract zero-dep preserved, 125 contract tests passing (was 112, +13 new).

D4 — ContextChain reasoning ops (+396 LOC, 8 tests)

Upgrades the Markov ±5 ring buffer into a reasoning substrate:

  • coherence_at / total_coherence — Hamming-based agreement on Binary16K variant
  • replay_with_alternative — counterfactual swap at position i
  • disambiguate — enumerate candidates, pick highest-coherence, compute margin, escalate_to_llm when margin < 0.1
  • WeightingKernel { Uniform, MexicanHat, Gaussian } — harvest H7 lands with monotone Mexican-hat weighting

D6 — Role-key catalogue (+404 LOC, 7 tests)

Canonical deterministic VSA role keys addressed as contiguous [start:stop] slices of 10,000-dim space. 47 keys total across SPO (5) + TEKAMOLO (5) + future-ready thematic (3) + Finnish cases (15) + tenses (12) + NARS inferences (7). All slices disjoint, bits zero outside slice. FNV-64 seeded + per-dim LCG for deterministic generation.

D0 — Three knowledge docs (+1151 LOC)

  • grammar-landscape.md (429 lines) — Three grammar stacks (Rust 1929 LOC / Python ~5000 LOC / TypeScript), TEKAMOLO with corrected 3→9 slot inventory including beneficiary/goal/source, case tables in native terminology (corrects yesterday's Latinate-transplant Finnish Accusative error; full Russian 6 cases including Instrumental), pronoun-feature orthogonal axis, Markov ±5 as context upgrade.
  • linguistic-epiphanies-2026-04-19.md (466 lines) — E13–E27 cross-repo harvest: Chomsky hierarchy isomorphism (Pearl rungs = Type-3/2/1/0), compression theory (lossless vs lossy), method grammar payload, Markov living frame triple-identity, resonanzsiebe, Σ10 Rubicon tiers, Sigma-12 Rosetta multimodal, 4D hashtag glyph (256 states), three-way convergence (Chomsky × Σ-tier × Pearl), membrane σ/τ/q↔10K boundary.
  • fractal-codec-argmax-regime.md (256 lines) — Orthogonal research thread on TurboQuant/PolarQuant/JLQ argmax wall and MFDFA-on-Hadamard fractal-descriptor leaf. Cross-referenced but not entangled with grammar work.

Phased shipping plan

This is Phase 1 of 4:

  • Phase 1 (this PR): D0 docs + D4 reasoning + D6 role keys
  • Phase 2: D2 FailureTicket emission + D3 Triangle bridge + D5 Markov bundler + D7 styles
  • Phase 3: D8 story-context/contradictions + D10 validation harness (Animal Farm benchmark)
  • Phase 4: D9 ONNX arc export + D11 bundle-perturb emergence interface

Test plan

  • cargo test -p lance-graph-contract --lib125 pass (112 + 13 new)
  • cargo check -p lance-graph-contract — clean (6 pre-existing warnings, none from new code)
  • cargo check -p lance-graph-contract --no-default-features — zero-dep preserved
  • All slice addresses disjoint, all within VSA_DIMS=10_000
  • RoleKey bits only in declared slice (verified for SUBJECT_KEY and KAUSAL_KEY)
  • Mexican-hat weights monotone from d=0 to d=5
  • Disambiguate margin threshold triggers escalate_to_llm correctly
  • coherence_high_for_self_chain asserts self-similar chain → high coherence

Knowledge activation

Three new docs with explicit READ BY headers. Future agents working on DeepNSM, grammar triangle, coreference, OSINT, Markov chains, cognitive shader, or thinking engine should load the corresponding doc at session start.

https://claude.ai/code/session_01SbYsmmbPf9YQuYbHZN52Zh

…ge docs

Three Phase 1 deliverables from the elegant-herding-rocket plan,
all pure-additive, zero breaking changes, contract zero-dep preserved.

D4 — context_chain.rs reasoning ops (+396 LOC, 8 tests)

- coherence_at / total_coherence — Hamming-based agreement measure
  on the Binary16K variant with graceful zero-score for other
  variants (zero-dep choice).
- replay_with_alternative — counterfactual swap at position i.
- disambiguate — enumerate candidates, pick highest-coherence, compute
  margin; escalate_to_llm flag fires when margin < 0.1.
- WeightingKernel { Uniform, MexicanHat, Gaussian } with weight(d)
  method. Mexican-hat (1 - 2x^2) * exp(-2x^2) is monotone on d=0..5
  (harvest H7 landing).
- DisambiguationResult struct + DISAMBIGUATION_MARGIN_THRESHOLD const.

D6 — role_keys.rs (+404 LOC, 7 tests)

Canonical deterministic VsaVector-shaped role keys, addressed as
contiguous [start:stop] slices of the 10_000-dim VSA space.

Layout (all disjoint, all within 10_000):

  [   0.. 2000) SUBJECT_KEY
  [2000.. 4000) PREDICATE_KEY
  [4000.. 6000) OBJECT_KEY
  [6000.. 7500) MODIFIER_KEY
  [7500.. 9000) CONTEXT_KEY
  [9000.. 9200) TEMPORAL_KEY
  [9200.. 9400) KAUSAL_KEY
  [9400.. 9500) MODAL_KEY
  [9500.. 9650) LOKAL_KEY
  [9650.. 9750) INSTRUMENT_KEY   (future-ready)
  [9750.. 9780) BENEFICIARY_KEY  (future-ready)
  [9780.. 9810) GOAL_KEY         (future-ready)
  [9810.. 9840) SOURCE_KEY       (future-ready)
  [9840.. 9910) 15 Finnish case keys (~5 dims each)
  [9910.. 9970) 12 tense keys (5 dims each)
  [9970..10000) 7 NARS inference keys (~4 dims each)

Generation via FNV-64 seed + per-dim LCG. RoleKey { words, slice_start,
slice_end, label }. Lookups finnish_case_key / tense_key /
nars_inference_key via array-backed tables. New Tense enum (12 variants).

D0 — Knowledge docs (3 files, +1151 LOC)

grammar-landscape.md (429 lines) — 9 sections covering:
  1. Three grammar stacks (Rust/Python/TypeScript) with paths/LOCs
  2. Grammar Triangle = NSM x Causality x Qualia convergence
  3. TEKAMOLO template with 3/6 -> 6/9 slot gap (incl. beneficiary/
     goal/source beyond modal/local/instrument)
  4. Case inventories per language in NATIVE terminology — Finnish
     object marking corrected (Nom/Gen/Part, not Accusative except
     personal pronouns); Russian 6 cases with Instrumental full;
     German 4 cases; Turkish agglutinative chain; Japanese particles
  5. Pronoun feature commitment orthogonal axis — Finnish easy on
     morphology but weak on pronoun features (han is genderless)
  6. Markov +-5 as context upgrade to NARS + SPO 2^3 + TEKAMOLO
  7. Convergence target: DeepNSM as shared extraction engine
  8. Cross-refs to all 6 knowledge docs
  9. Minimal-diff summary for DeepNSM changes

linguistic-epiphanies-2026-04-19.md (466 lines) — E13-E27:
  E13 Chomsky hierarchy isomorphism (Pearl rungs map to Type-3/2/1/0)
  E14 Compression theory (Type-3 token prediction is lossy;
      Universal Grammar at Type-1+ is lossless)
  E15 [method]payload — 7 payload dimensions (WHERE/WHAT/HOW/WITH/
      WHY/HOW-MUCH/SHAPE) compatible with FailureTicket
  E16 Markov Living Frame — request IS scent, endpoint IS state,
      triple identity (scent/transition/probe)
  E17 Resonanzsiebe — knowledge-gap filter, only surface the diff
  E18 Verbs as productions, rungs as complexity bounds
  E19 Ada Universal Grammar diagram — all 5 pieces already in our stack
  E20 Sigma 4D addressing vs Glyph5B archetype addressing distinction
  E21 Sigma-10 Rubicon tier architecture (STATIC/EMERGENT/TWIG/EPIPHANY)
  E22 Sigma-12 Rosetta multimodal transcoder (Sigma text <-> vector <-> image)
  E23 Sigma compression tiers (FULL/MEANING/SEED/GLYPH)
  E24 4D hashtag glyph coordinates (256 states — Type/Causality/
      Affect/Temporal)
  E25 Rubicon 4D decision hypercube (risk/novelty/intimacy/contribution)
  E26 Three mappings converge: Chomsky x Sigma-tier x Pearl-rung
  E27 Membrane — sigma/tau/q <-> 10K VSA conversion boundary

fractal-codec-argmax-regime.md (256 lines) — orthogonal research
thread capturing the TurboQuant / PolarQuant / JLQ argmax-wall
discussion and proposed MFDFA-on-Hadamard fractal-descriptor leaf.
Cross-referenced but not entangled with grammar work.

Tests: 125 passing (was 112; +13 new — 6 context_chain + 7 role_keys).

https://claude.ai/code/session_01SbYsmmbPf9YQuYbHZN52Zh
@AdaWorldAPI AdaWorldAPI merged commit d79088c into main Apr 19, 2026
AdaWorldAPI pushed a commit that referenced this pull request Apr 19, 2026
…r-art audit

Cross-deliverable status view that fills the gap between
INTEGRATION_PLANS.md (plan-level) and PR_ARC_INVENTORY.md
(per-PR history). Status / PR columns are the only mutable
fields; title + plan-version + scope are immutable.

Sections:
- elegant-herding-rocket-v1 phases: D0-D11 with phase grouping
  (Phase 1 shipped via #210; Phase 2-4 queued/backlog).
- Infrastructure / governance: 15 items shipped via #211.
- Infrastructure backlog (audit recommendations 2, 4, auto memory).
- Research threads (orthogonal to grammar): NER, FP_WORDS=160,
  Crystal4K persistence, YAML templates, cross-linguistic parsers,
  fractal codec, UK Biobank, chess vertical, Wikidata, OSINT, TS/
  Python convergence.
- Prior-art audit: 61 top-level + 41 prompts = 102 existing docs
  indexed in BOOT.md + CLAUDE.md; per-file active/superseded
  status is a Backlog item (not urgent).

Status legend: Shipped / In PR / In progress / Queued / Backlog /
Deferred / Abandoned / Research / Active / Indexed.

Update protocol documented: Shipped → fill PR column; phase moves
→ edit Status in place; abandoned → keep row with rationale.
AdaWorldAPI pushed a commit that referenced this pull request Apr 19, 2026
…ed PRs

Bookkeeping ledger pairing each prompt brief in .claude/prompts/ with its
matching PR (by filename keyword). 16 mapped to merged PRs #176-#210; 25
marked `none` where no keyword match existed.
AdaWorldAPI pushed a commit that referenced this pull request Apr 19, 2026
Per user clarification (2026-04-19):

REFINEMENT to prior IDEA CORRECTION-OF — the "no 10000-D VSA" ban is
NOT workspace-wide. Three scopes legitimately preserve 10k until the
coordinated rename PR:

1. Grammar prototype (role_keys + ContextChain, shipped at 10k in #210)
2. Quantum prototype (Vsa10kF32 holographic residual)
3. Ladybug-rs / bighorn imports (PRs #200-#203 cognitive stack)

Elsewhere: strip 10k mentions. Files in-scope vs out-of-scope
enumerated in the IDEAS entry.

TECH_DEBT for the ladybug memory pathology:
- Observed 700-1,100 MB runtime after #200-#203 imports at 10k
- 16k rename WORSENS per-row cost 40 KB → 64 KB at f32
- Fix requires LanceDB mmap zero-copy + working-set cache policy, not
  wider substrate alone
- Gate the 16k rename on peak-RAM measurement against Animal Farm D10
- Sparse-encoding candidate (Structured5x5 cells only) for common case

https://claude.ai/code/session_01SbYsmmbPf9YQuYbHZN52Zh
AdaWorldAPI pushed a commit that referenced this pull request Apr 20, 2026
…MEMB-1 ISSUE

User directive: "EPIPHANIES.md ← E-ORIG-1, E-ORIG-5, E-MEMB-1 (als ISSUE
promoted), E-MEMB-5, E-MEMB-9. Diese fünf sind load-bearing. Der Rest
bleibt im Log, nicht an die Wand."

Additional: "Formal-theory scaffolding (Cartan-Kuranishi / Jirak /
φ-Weyl / γ+φ) lives in EPIPHANIES.md under tag [FORMAL-SCAFFOLD]. Not
a paper track. Reference only. Consult before inventing new
calibration heuristics."

EPIPHANIES.md (406 lines → 59 — 85% reduction):

  Load-bearing five (kept as full prominent entries):
    - E-ORIG-1 NSM and 144 verbs orthogonal composition axes
    - E-ORIG-5 NSM pre-sliced for role_keys 10K layout
    - E-MEMB-1 (promoted FINDING → ISSUE) Python↔Rust slice
      incompatibility at 10 kD membrane
    - E-MEMB-5 18D QualiaColumn = sigma_rosetta projected onto SoA
    - E-MEMB-9 to_aurora_prompt() IS a BusDto — three-DTO doctrine
      operational in Python

  [FORMAL-SCAFFOLD] metadata entry (DEPOSIT):
    One sentence carrying four citations (Jirak 2016 Berry-Esseen
    weak dep + Cartan-Kuranishi involutive prolongation + φ-Weyl
    equidistribution for golden-angle collocation + γ+φ
    preconditioner) with explicit framing: not a paper track;
    reference only; consult before inventing calibration heuristics.
    The tag is greppable.

  Deposit log (15 demoted one-liners, retained anchors not at "die
  Wand"):
    E-ORIG-2,3,4,6,7 + E-MEMB-2,3,4,6,7,8,10,11,12,13.
    Each one sentence with cross-ref. Bodies removed; pointers intact.

ISSUES.md (double-entry rule honored):

  New Open Issue 2026-04-20 [E-MEMB-1]: Python↔Rust slice layouts
  incompatible at the 10 kD membrane. Priority P1. Scope
  @Integration-Lead @truth-architect domain:membrane. Documents:
    - Rust layout from PR #210 role_keys.rs (9 disjoint slices)
    - Python layout from adarail_mcp/membrane.py DIMENSION_MAP
      (Soul Space [0..500) + qualia_pcs_18 [2000..2018) + felt /
      affective / location slices — completely different geometry)
    - Impact: blocks raw 10K cross-language transfer; forces σ/τ/q
      REST-edge serialization as the only Ada↔Rust channel
    - Secondary blocker cited: E-MEMB-7 (Ada-internal 3-space
      incoherence)
    - Next action deferred: `slice-layout-reconciliation.md` knowledge
      doc when queued

Why this matters: 21 dated entries on a wall teach nothing; 5
load-bearing entries teach by position. The 15 deposit lines remain
addressable by ID so nothing is lost — the triage surfaces which five
future sessions actually need to read before proposing membrane work.

https://claude.ai/code/session_01SbYsmmbPf9YQuYbHZN52Zh
AdaWorldAPI pushed a commit that referenced this pull request Apr 20, 2026
…MEMB-1 ISSUE

User directive: "EPIPHANIES.md ← E-ORIG-1, E-ORIG-5, E-MEMB-1 (als ISSUE
promoted), E-MEMB-5, E-MEMB-9. Diese fünf sind load-bearing. Der Rest
bleibt im Log, nicht an die Wand."

Additional: "Formal-theory scaffolding (Cartan-Kuranishi / Jirak /
φ-Weyl / γ+φ) lives in EPIPHANIES.md under tag [FORMAL-SCAFFOLD]. Not
a paper track. Reference only. Consult before inventing new
calibration heuristics."

EPIPHANIES.md (406 lines → 59 — 85% reduction):

  Load-bearing five (kept as full prominent entries):
    - E-ORIG-1 NSM and 144 verbs orthogonal composition axes
    - E-ORIG-5 NSM pre-sliced for role_keys 10K layout
    - E-MEMB-1 (promoted FINDING → ISSUE) Python↔Rust slice
      incompatibility at 10 kD membrane
    - E-MEMB-5 18D QualiaColumn = sigma_rosetta projected onto SoA
    - E-MEMB-9 to_aurora_prompt() IS a BusDto — three-DTO doctrine
      operational in Python

  [FORMAL-SCAFFOLD] metadata entry (DEPOSIT):
    One sentence carrying four citations (Jirak 2016 Berry-Esseen
    weak dep + Cartan-Kuranishi involutive prolongation + φ-Weyl
    equidistribution for golden-angle collocation + γ+φ
    preconditioner) with explicit framing: not a paper track;
    reference only; consult before inventing calibration heuristics.
    The tag is greppable.

  Deposit log (15 demoted one-liners, retained anchors not at "die
  Wand"):
    E-ORIG-2,3,4,6,7 + E-MEMB-2,3,4,6,7,8,10,11,12,13.
    Each one sentence with cross-ref. Bodies removed; pointers intact.

ISSUES.md (double-entry rule honored):

  New Open Issue 2026-04-20 [E-MEMB-1]: Python↔Rust slice layouts
  incompatible at the 10 kD membrane. Priority P1. Scope
  @Integration-Lead @truth-architect domain:membrane. Documents:
    - Rust layout from PR #210 role_keys.rs (9 disjoint slices)
    - Python layout from adarail_mcp/membrane.py DIMENSION_MAP
      (Soul Space [0..500) + qualia_pcs_18 [2000..2018) + felt /
      affective / location slices — completely different geometry)
    - Impact: blocks raw 10K cross-language transfer; forces σ/τ/q
      REST-edge serialization as the only Ada↔Rust channel
    - Secondary blocker cited: E-MEMB-7 (Ada-internal 3-space
      incoherence)
    - Next action deferred: `slice-layout-reconciliation.md` knowledge
      doc when queued

Why this matters: 21 dated entries on a wall teach nothing; 5
load-bearing entries teach by position. The 15 deposit lines remain
addressable by ID so nothing is lost — the triage surfaces which five
future sessions actually need to read before proposing membrane work.

https://claude.ai/code/session_01SbYsmmbPf9YQuYbHZN52Zh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants