Skip to content

feat: Grammar unlocks — verb table, Disambiguator trait, Quantum mode, Animal Farm harness#283

Merged
AdaWorldAPI merged 3 commits into
claude/grammar-fixes-r2-2026-04-29from
claude/grammar-unlocks-r2-2026-04-29
Apr 29, 2026
Merged

feat: Grammar unlocks — verb table, Disambiguator trait, Quantum mode, Animal Farm harness#283
AdaWorldAPI merged 3 commits into
claude/grammar-fixes-r2-2026-04-29from
claude/grammar-unlocks-r2-2026-04-29

Conversation

@AdaWorldAPI
Copy link
Copy Markdown
Owner

Summary

Implements epiphanies E3, E4, E5, E7, E8 from PR #279 outlook review. Stacks on claude/grammar-fixes-r2-2026-04-29.

  • E3 — 144-cell verb-role table. VerbFamily (12 families: Becomes..Dissolves) × Tense (12) = 144 cells. Each cell holds SlotPrior (TEKAMOLO slot expectations). default_table() seeds Becomes → temporal+modal high, Causes → kausal high. Parsing reduces to table lookup + truth aggregation.
  • E4 — Trajectory-as-audit-hash bridge. TrajectoryHash = [u64; 256] (16384-bit semantic hash). Trajectory::binarize(), audit_hash_u64(), trajectory_distance(). Cross-PR bridge: DeepNSM trajectory replaces statement_hash: u64 in audit log.
  • E5 — Generalized Disambiguator trait. Disambiguatable trait + disambiguate_general<T>() free function. Domain-agnostic: same machinery for coreference, RLS predicate selection, triplet completion, style dispatch.
  • E7 — Animal Farm forward-validation scaffold. EpiphanyPrediction, GroundTruthBeat, HarnessMetrics (precision, recall, arc-shift F1, direction accuracy). evaluate() function. 4 tests including perfect-confirmation and no-match cases.
  • E8 — Quantum mode. PhaseTag(u128) with from_angle/to_angle/distance (Hamming on 128 bits). HolographicMode { SinglePhase, PerRole }. Crystal vs Quantum is a knob, not a separate stack.
  • YAML robustness. Flow-map parsing (nars: { primary: X }), whitespace-aware # comment stripping, TekamoloSlot::Instrument variant (no longer silently mapped to Modal).
  • Awareness persistence. AwarenessSnapshot + snapshot()/restore() round-trip for cross-session persistence.
  • top_nars_inference fix. Bootstrap now keeps prior's primary (was falling through to fallback at frequency == 0.5).

Stats

  • 9 files changed, +845 / -22 lines
  • 3 commits (2 workers + 1 meta integration)
  • 302 contract tests + 76 deepnsm tests + 4 animal_farm tests = 382 tests pass

Test plan

  • cargo check -p lance-graph-contract — green
  • cargo check --manifest-path crates/deepnsm/Cargo.toml — green
  • cargo test -p lance-graph-contract --lib — 302 passed
  • cargo test --manifest-path crates/deepnsm/Cargo.toml --lib — 76 passed
  • cargo test --manifest-path crates/deepnsm/Cargo.toml --test animal_farm_harness — 4 passed
  • PhaseTag from_angle round-trips within 0.001 tolerance
  • 144-cell table has all 144 cells, lookup returns uniform for unset
  • Disambiguator picks closest-to-focal on scalar items
  • Snapshot → restore round-trips all truth values

https://claude.ai/code/session_01SbYsmmbPf9YQuYbHZN52Zh

claude added 3 commits April 29, 2026 05:49
… + quantum_mode + PhaseTag fix

- Re-exported VerbFamily, VerbRoleTable, SlotPrior, default_table from grammar/mod.rs
- Re-exported Disambiguatable, GeneralizedResult, disambiguate_general
- Added pub mod trajectory_audit + pub mod quantum_mode in deepnsm/lib.rs
- Fixed PhaseTag from_angle/to_angle: u128::MAX as f32 was overflowing to
  infinity, producing NaN on round-trip. Switched to f64 intermediate and
  use only the low 64 bits (high 64 reserved for future precision)
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5f1745969f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +18 to +20
pub fn pi() -> Self {
PhaseTag(u128::MAX / 2)
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Encode π using the same low-64-bit phase representation

PhaseTag::pi() currently sets the full tag to u128::MAX / 2, but to_angle() only decodes the low 64 bits; that low half is all 1s for u128::MAX / 2, so PhaseTag::pi().to_angle() yields approximately instead of π. Any caller using pi() as a canonical opposite-phase constant will get the wrong angle and phase comparisons will be skewed. This should be encoded via the same low-half scheme as from_angle (e.g., half of u64::MAX in the low 64 bits).

Useful? React with 👍 / 👎.

@AdaWorldAPI AdaWorldAPI merged commit 7d7b722 into claude/grammar-fixes-r2-2026-04-29 Apr 29, 2026
1 of 5 checks passed
AdaWorldAPI added a commit that referenced this pull request Apr 29, 2026
…26-04-29

Re-land #283 unlocks (Quantum, Disambiguator, verb_table, animal-farm harness) — orphaned by merge order
AdaWorldAPI pushed a commit that referenced this pull request Apr 30, 2026
- Fix 4× `#[deprecated(since = "next")]` invalid semver in
  context_chain.rs — drop `since` field (G3 refactor artifact)
- Fix `actor.role <= u8::MAX` tautological comparison in
  lance_membrane.rs:768 — replace with meaningful `< 32` guard
- Document Wave-1 LOC audit in EPIPHANIES.md: recovery (#275-#283)
  = +8,728; Wave 1 (#300-#306) = +3,156; combined = +11,807;
  zero LOC lost from G1 rebase

cargo fmt --check: clean
cargo clippy (4 crates): warnings only, 0 errors

https://claude.ai/code/session_01NYGrxVopyszZYgLBxe4hgj
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