Commit graph

118 commits

Author SHA1 Message Date
Shay
0fa498e98b
fix(surface): add empty-slot guard — fallback when subject+predicate both empty
Add fallback mechanism for empty subject and predicate in surface generation.
2026-05-14 13:44:09 -07:00
Shay
bab4790c10
feat(generate): export SentenceAssembler, SentencePlan, assemble_surface from __init__ 2026-05-14 13:24:19 -07:00
Shay
9ee27e0792
feat(chat): wire SentenceAssembler into chat/runtime — coherent surface sentences
Refactor sentence assembly to use SentenceAssembler for coherent sentence generation.
2026-05-14 13:23:21 -07:00
Shay
565c48bdf0
feat(generate): add surface.py — SentenceAssembler (ADR-0012)
Implement SentenceAssembler for generating coherent surface sentences from articulation plans and token sequences.
2026-05-14 13:21:24 -07:00
Shay
3711fad448 chat/runtime: wire identity check, character motor, CharacterProfile, drive gradients, TurnEvent log
Six identity table rows → all green:

1. Non-identity PersonaMotor
   PersonaMotor.from_identity_manifold() replaces PersonaMotor.identity().
   The motor now geometrically encodes the manifold's value_axes directions.

2. IdentityCheck wired as post-generation gate
   After generate(), a stub ReasoningTrajectory is constructed from the
   GenerationResult trajectory (or a single-frame fallback) and passed to
   IdentityCheck.check(). The resulting IdentityScore is attached to the
   GenerationResult and included in ChatResponse.

3. CharacterProfile populated and projected
   CharacterProfile.from_manifold() is called at __init__ time and stored
   as self.character_profile. It is also included in ChatResponse so callers
   can inspect the identity projection without reaching into internals.

4. drive_gradients influencing field walk
   DriveGradientMap.combined_bias() is computed at each turn from the live
   ExertionMeter fatigue and used to nudge the field state before generation.
   The bias is applied as a direct additive perturbation to F[:3] (the R^3
   component), keeping the drive influence within the algebraically valid
   range and preserving versor structure.

5. IdentityScore gating articulation
   If the IdentityScore is flagged (score < alignment_threshold) the
   walk_surface is suppressed and the articulation.surface is used as the
   sole response surface. The flag is propagated in ChatResponse.flagged.

6. TurnEvent provenance log
   Every call to chat() appends a TurnEvent to self.turn_log. The log is
   a plain list — append-only by convention. Each TurnEvent carries the
   full determinism trace for that turn: input tokens, walk surface,
   articulation surface, dialogue role, IdentityScore, CycleCost total,
   vault hit count, versor condition, and flagged status.
2026-05-14 13:15:24 -07:00
Shay
6cb28566ec generate/stream: fix agenerate() — add vault recall parity with generate()
agenerate() skipped _recall_state() entirely, meaning async streaming
responses were disconnected from session memory. This patch brings
agenerate() to full parity with the synchronous path:

- Accepts vault and recall_top_k parameters (default 3, matching generate())
- Calls _recall_state(_voiced_state(current, persona), vault, recall_top_k)
  at each step before nearest-node selection
- Does not add stop_nodes or salience (those remain sync-only for now;
  the core correctness gap is vault recall)

The async return value is still token-by-token via yield. Callers that
want final_state should use the synchronous path or wrap in a collector.
2026-05-14 13:12:59 -07:00
Shay
2c51338de7 generate/result: add identity_score field to GenerationResult
IdentityCheck runs after generation in ChatRuntime and must travel
forward with the result without requiring a second pass or a wrapper.
The field is Optional so all existing call sites that don't supply it
continue to work unmodified.
2026-05-14 13:10:54 -07:00
Shay
424a67a9ce persona: add PersonaMotor.from_identity_manifold() factory
Builds a real, non-identity CGA motor from the value_axes directions
carried by an IdentityManifold. Each axis.direction is treated as a
3-vector in R^3, composed additively into a single translator, and
scaled by the axis's index to separate the directions in concept space.

This replaces the unconditional PersonaMotor.identity() call in
ChatRuntime with a motor that geometrically encodes CORE's character.
2026-05-14 13:10:34 -07:00
Shay
9be12b9a14 identity: add CharacterProfile.from_manifold() factory + TurnEvent provenance record
- CharacterProfile.from_manifold() populates traits/theological grounding
  directly from a live IdentityManifold — no longer orphaned.
- TurnEvent is a frozen, append-only provenance record for one chat turn.
  Carries: turn index, dialogue role, IdentityScore, CycleCost, vault hit
  count, walk surface, and articulation surface. Enables full determinism
  tracing across every turn without mutation.
- IdentityCheck.check() is unchanged in contract.
2026-05-14 13:10:00 -07:00
Shay
541b1646b2 Fix test suite errors across core physics and generation
Key issues fixed:
- `CORE_BACKEND=numpy` was ignored, so tests mixed Python CGA embedding with Rust metric behavior.
- Dense construction seeds were being rejected by strict `unitize_versor()`, while sparse dirty inputs still needed to fail closed.
- Holonomy needed a construction-boundary path for raw/dense vocab fixtures and rare null final accumulators.
- Proposition storage polluted vault recall by storing the live field instead of the proposition’s subject versor.
- Dialogue qualitative frames rendered the same surface as assertive copular frames.
- Repeated session prompts could collapse into the same deterministic response path.
- Two proof fixtures were stale: one hand-built a non-null “null” vector, and one alignment proof omitted the English “with” anchor used by the resonance proof.

Verification:
`CORE_BACKEND=numpy CORE_STRICT_MLX_ON_APPLE=0 uv run core test -- -q`
Result: `277 passed in 59.52s`
2026-05-14 13:02:32 -07:00
Shay
47975dbcc7 ADR-0006: wire energy recomputation into propagate_step, add test_energy.py, mark ADR Implemented 2026-05-14 12:39:49 -07:00
Shay
6bad4189d2 Implement core physics and pack validation 2026-05-14 12:35:19 -07:00
Shay
fbbd7c52e3 Fix fail-closed versor construction 2026-05-14 12:13:04 -07:00
Shay
2e8169bbb0 Allow float32 residue roundoff in versor construction 2026-05-14 12:13:04 -07:00
Shay
79e28c5835 Fail closed on invalid versor construction 2026-05-14 12:12:43 -07:00
Shay
9723941a38
Fail closed on invalid versor construction
Make versor construction fail closed instead of synthesizing hash-derived fallback rotors.

- remove pseudo-random construction fallback from unitize_versor
- add signed residual helper for +1 field states vs ±1 manifold entries
- validate vocab manifold entries with full residuals
- document antipodal transition rotor failure contract
- add focused invariant tests for versor closure and manifold validation
2026-05-14 10:55:11 -07:00
Shay
aadaf11612
Add ADR-0008 salience attention
Add salience and attention operators, wire salience-gated candidate selection into generation, expose vault/salience trace telemetry, and add tests proving non-placeholder salience behavior.
2026-05-13 22:40:36 -07:00
Shay
df9ced7104
Activate and verify Rust backend
Add Rust backend CLI controls, fix core-rs build/test configuration, align Rust Cl(4,1)/CGA conventions with Python, and validate core_rs activation.
2026-05-13 22:23:48 -07:00
Shay
4ab148149f Graceful fallback in realize() when slot versors are missing 2026-05-13 21:41:52 -07:00
Shay
0dd22bb4dd
Add ADR-0009 articulation planner
Add geometry-backed ArticulationPlan and realize(), wire articulation into ChatRuntime and trace output, expose proposition relation_norm, and add articulation/runtime/CLI tests.
2026-05-13 21:39:25 -07:00
Shay
30757ccc63
Add runtime output-language policy
Add RuntimeConfig with English default output policy, wire output language through runtime/frame selection/generation/CLI, preserve language metadata in mounted manifolds, and add runtime/CLI policy tests.
2026-05-13 21:29:43 -07:00
Shay
09c3664773
Fix CLI help/runtime imports and add doctor command (#4)
* Make core CLI help robust and intuitive

* Package runtime support modules for core CLI

* Add CLI help and doctor tests

* Fix CLI trace help and pack listing

* Export language pack listing helper

* Bootstrap repo root for console runtime imports

* Align trace formatter with Proposition schema

* Cover real trace payload formatting
2026-05-13 21:15:51 -07:00
Shay
7f302760ef Fix setuptools flat-layout package discovery 2026-05-13 20:58:01 -07:00
Shay
0800f8d35f Add core CLI (chat, test, check, trace, oov, pack) 2026-05-13 20:54:54 -07:00
Shay
454b7d9f9e Thread vault recall through generation 2026-05-13 20:50:31 -07:00
Shay
abf7398ca6 Bridge chat OOV grounding 2026-05-13 20:47:28 -07:00
Shay
0780ca8166 Add live chat runtime 2026-05-13 20:40:56 -07:00
Shay
9ba6abfa3e Ground unknown tokens in ingest 2026-05-13 20:33:20 -07:00
Shay
2b78cd1179 Add dialogue frame selection 2026-05-13 20:19:21 -07:00
Shay
3a52cf3517 Add proposition generation 2026-05-13 20:08:49 -07:00
Shay
ed04fc5b15 Add session coherence across turns 2026-05-13 19:59:43 -07:00
Shay
531acfd40b Implement trilingual field coherence 2026-05-13 19:53:37 -07:00
Shay
6bb2eb348f
Fix language-pack versor hemisphere canonicalization
Compile language-pack features into even-grade rotors, apply canonicalization after alignment nudges. Preserves holonomy parity across token counts. 231 tests passing.
2026-05-13 19:41:31 -07:00
Shay
51736a96ee Expand en_minimal_v1 lexicon: 60 → 220 entries
Adds 160 entries covering the semantic domains the field walker needs
for coherent propagation:

  motion / action verbs       (move, go, come, turn, rise, fall, ...)
  cognitive / epistemic       (understand, believe, doubt, learn, seek, ...)
  existence / being verbs     (become, exist, appear, change, build, ...)
  communication verbs         (tell, write, read, call, give, receive, ...)
  core nouns: being           (being, essence, nature, source, ground, ...)
  core nouns: logos/language  (language, meaning, sign, wisdom, knowledge, ...)
  relational nouns            (relation, unity, self, other, world, body, ...)
  temporal adverbs            (now, before, after, always, never, still, ...)
  quality adjectives          (true, false, real, possible, necessary, free, ...)
  quantity / degree           (all, one, many, more, less, only, also, ...)
  spatial                     (here, there, near, far, above, below, ...)
  modal auxiliaries           (must, should, may, might, would, was, were, ...)
  logos core completions      (logos, breath, fire, water, earth, heaven, void, ...)
  abstract structure          (principle, pattern, measure, limit, process, ...)
  dialog completers            (how, why, when, which, that, this, same, ...)
  mind / soul cluster         (mind, heart, soul, thought, feeling, action, ...)

All entries follow existing schema: entry_id, surface, lemma, language,
pos, semantic_domains, morphology_tags. Manifest checksum updated.
2026-05-13 19:31:35 -07:00
Shay
747289ace7 Fix morphology weight hierarchy: root/stem dominate, inflection/suffix are perturbations
Root was 0.17, stem 0.10 — not heavy enough to anchor same-root forms
against the diverging suffix rotor (ים landing on a different axis).

New hierarchy:
  triliteral root  0.13 → 0.22  (shared identity, strongest anchor)
  root             0.17 → 0.30  (primary root geometry)
  stem             0.10 → 0.18  (secondary, same-root forms cluster here)
  inflection role  0.02 → 0.015 (key label, minimal)
  inflection value 0.05 → 0.03  (number/gender/etc, perturbation only)
  prefix           0.05 → 0.03  (per-position decay preserved)
  suffix           0.04 → 0.02  (per-position decay preserved)

This ensures דבר and דברים both orbit the D-B-R root point closely
enough that cga_inner(singular, plural) > cga_inner(singular, unrelated),
while still encoding morphological distinctions as measurable offsets.
2026-05-13 19:16:38 -07:00
Shay
eeb9a69f69 Fix test_holonomy_resonance: unpack (manifold, id_map) from compile_entries_to_manifold
compile_entries_to_manifold now returns a 2-tuple; the test that calls
it directly must unpack [0] to get the VocabManifold before calling
.get_versor().
2026-05-13 15:41:18 -07:00
Shay
db7eabd62f Wire alignment graph into load_pack as post-compilation correction pass
- VocabManifold.update(): replace a stored versor in-place (grade-norm
  enforced, KeyError if word missing)
- compile_entries_to_manifold() now also returns entry_id->surface map
  as a second return value; callers that only need the manifold use [0]
- _alignment_nudge_rotor(): slerp-style rotor that rotates source toward
  target by edge.weight * ALIGNMENT_NUDGE_STRENGTH (0.06) — small enough
  to preserve intra-pack geometry, large enough to pull cross-lang pairs
  into proximity
- load_pack(): after both manifolds are built, loads alignment.jsonl,
  resolves entry_id->surface on each side, applies nudge to source versor
  using the already-compiled target versor as the attractor
- _is_hebrew_root() guard retained; _triliteral_root() Hebrew-only
2026-05-13 15:40:33 -07:00
Shay
5e75d46323 Fix Greek triliteral rotor bleed and update structured-morphology baseline test
- Guard _triliteral_root() rotor to Hebrew-script roots only; Greek/other
  scripts now use the root: rotor alone (0.17) — no spurious uppercase
  Unicode blade collision from the romanization fallback path
- test_structured_morphology_improves_same_root_hebrew_resonance: replace
  tag_only baseline (now empty since legacy tags stripped) with no_morphology
  baseline (domain+pos+lemma+surface only), which is the honest comparison
  for what structured morphology contributes post-migration
2026-05-13 15:24:38 -07:00
Shay
400cc031ce Remove legacy root-tag guard; compiler now single-path structured morphology 2026-05-13 15:21:14 -07:00
Shay
645eebd076 Migrate Greek lexicon to structured morphology; remove _uses_legacy_root_tags guard
- Strip root: tags from all 7 grc_logos_micro_v1 lexicon entries
- Refresh grc_logos_micro_v1 manifest checksum
- Remove _uses_legacy_root_tags() and _apply_morphology_tags() from compiler
- _entry_to_coordinate() now has a single morphology path: structured when
  morphology_id resolves, tag fallback only for packs with no morphology data
- load_pack() registry loading made unconditional for packs with morphology.jsonl
2026-05-13 15:20:15 -07:00
Shay
5c952a9f9d Migrate Hebrew lexicon to structured morphology 2026-05-13 15:15:15 -07:00
Shay
9e415a0bdf Wire morphology operator composition (PR #2)
- _apply_morphology(): ordered root→prefix→stem→inflection→suffix chain
- _resolved_morphology(): gates on _uses_legacy_root_tags(), preserving
  existing calibrated Hebrew/Greek entries on tag path
- דברים (he-008) is first migrated form; structured path proves
  higher resonance with singular than tag-only compilation
- 231 passed
2026-05-13 15:06:32 -07:00
Shay
3168e73ace Wire morphology operator composition 2026-05-13 15:02:52 -07:00
Shay
8d09c2a8c1 Add morphology registry for language packs 2026-05-13 14:50:36 -07:00
Shay
a4b4d22987 Add alignment graph, cross-language edges, and HolonomyAlignmentCase tests
alignment/graph.py
  Lightweight in-memory alignment graph. Loads AlignmentEdge records from
  a pack's alignment.jsonl. Exposes edges_from(), aligned_pairs(), and
  load_alignment(). No external deps — pure schema + stdlib.

language_packs/data/he_logos_micro_v1/alignment.jsonl
language_packs/data/grc_logos_micro_v1/alignment.jsonl
  Seven bidirectional cross-language edges per pack encoding the semantic
  resonances already implicit in the lexicon semantic_domains:
  דבר↔λόγος, ראשית↔ἀρχή, אור↔φῶς, חיים↔ζωή, אמת↔ἀλήθεια, רוח↔πνεῦμα, ברא↔κτίζω

tests/test_alignment_graph.py
  Four tests:
  - load returns AlignmentEdge instances with correct structure
  - דבר↔λόγος edge weight >= 0.9
  - aligned_pairs() filters by relation prefix
  - HolonomyAlignmentCase formal proof: positive triple closer than
    negative triple, wrapping the geometry already proven in
    test_holonomy_resonance.py into the schema's crown proof type
2026-05-13 14:43:17 -07:00
Shay
3affd29a82 Remove stale grc_logos_v1 pack files 2026-05-13 14:40:10 -07:00
Shay
594ca5503e Remove stale grc_logos_v1 pack files 2026-05-13 14:40:03 -07:00
Shay
c8c0f489ef Remove stale he_logos_v1 pack files 2026-05-13 14:39:46 -07:00
Shay
b28e8e064e Remove stale he_logos_v1 pack files 2026-05-13 14:39:37 -07:00
Shay
08794408d3 Remove stale he_logos_v1 and grc_logos_v1 packs (broken checksums, superseded by *_micro_* packs) 2026-05-13 14:39:21 -07:00