Commit graph

108 commits

Author SHA1 Message Date
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
Shay
966b35efa3 Remove stale he_logos_v1 and grc_logos_v1 packs
These were the pre-rename originals superseded by he_logos_micro_v1 and
grc_logos_micro_v1. Their manifests have checksum mismatches (visible via
`python -m language_packs list`) because the lexicon content was updated
without re-checksumming before the rename.

No tests reference these pack IDs. No code loads them. Leaving broken
packs in data/ creates false noise in `list` output and risks a future
agent loading the wrong pack by prefix match.
2026-05-13 14:38:58 -07:00
Shay
4c447dea81 Add language_packs CLI: python -m language_packs compile/verify/list
Three subcommands:
  compile <pack_id>  — compile a pack, verify checksum, print manifold stats
  verify  <pack_id>  — checksum-only verification without full compilation
  list               — list all available packs with role and entry count

Checksum rule (AGENTS.md) is enforced by design: the CLI reads bytes from
disk via read_bytes() as the single source of truth, never from in-memory
strings. This makes the compiler an auditable D0 instrument — not just an
importable function.

Exit codes: 0 = success, 1 = checksum mismatch or pack not found.
2026-05-13 14:37:36 -07:00
Shay
d997b88d32 Tighten session node tracking and generation selection 2026-05-13 14:35:31 -07:00
Shay
4c3004c73a Improve chat runtime and probe REPL 2026-05-13 14:30:36 -07:00
Shay
f8113a38ba Restore FieldState slots in determinism proof 2026-05-13 14:26:24 -07:00
Shay
4e7c29b84a Fix field state introspection and pack manifold geometry 2026-05-13 14:24:29 -07:00
Shay
52de2218b7 Stabilize contracts: FieldState slots=True; fix README vocab layer; add checksum rule to AGENTS.md
Three items from the post-assessment stabilization slice:

1. field/state.py: restore frozen=True, slots=True
   slots=True closes __dict__ on FieldState instances, preventing
   incidental attribute injection that frozen=True alone does not block.
   The holonomy field works cleanly with slots because ndarray | None
   is a valid slotted field type in Python 3.12.

2. README.md: correct vocab/ layer description
   Was: 'Word-to-versor manifold, edge rotors'
   Now: 'Surface-token manifold points; indexed access for algebraic
         transition construction'
   Edge rotors are constructed by algebra/, not stored in vocab/.
   This exact confusion caused vocab.edge_rotor() drift in earlier work.

3. AGENTS.md: add language-pack checksum rule
   Manifest checksums MUST be computed by reading back the bytes
   written to disk (Path(f).read_bytes()), never from in-memory strings
   before serialization. Unicode-escaped JSON on disk != Python str.
2026-05-13 14:18:08 -07:00
Shay
e6bf8ade5e Fix he/grc micro pack manifest checksums to match actual on-disk bytes
Permanent lesson: checksums must be computed from bytes-on-disk after
git writes the file (unicode-escaped JSON lines), not from in-memory
Python strings before serialization. The compiler CLI must do:
  checksum = hashlib.sha256(Path(lexicon_path).read_bytes()).hexdigest()
after writing the file, not before.

he_logos_micro_v1: ea1ac85d...
grc_logos_micro_v1: 1fea9d9c...
2026-05-13 14:15:55 -07:00
Shay
c7e23c7a97 Fix triple-alignment test: unique first domains per Logos word; rename packs to micro
Root cause: all 7 Logos words shared 'logos.core' as first domain, making
them cluster into a single blob. The misaligned triple (word ↔ ראשית,
word ↔ πνεῦμα, דבר ↔ ἀρχή) scored 0.379 vs aligned 0.299 because
cross-language 'spirit' and 'beginning' were geometrically indistinguishable
from 'word' when logos.core dominated the rotor composition.

Fix: each Logos word now has a UNIQUE leaf domain as its FIRST (highest-
weight) domain that it shares ONLY with its cross-language counterparts:
  word/דבר/λόγος      → logos.utterance.word
  beginning/ראשית/ἀρχή → logos.genesis.origin
  light/אור/φῶς       → logos.illumination.photon
  life/חיים/ζωή       → logos.vitality.animate
  truth/אמת/ἀλήθεια   → logos.aletheia.verity
  spirit/רוח/πνεῦμα   → logos.pneuma.breath
  create/ברא/κτίζω    → logos.ktizo.formation

logos.core retained as second domain (background cohesion, lower weight).
divine.revelation removed from spirit/רוח/πνεῦμא (was polluting alignment).

Packs renamed: he_logos_v1 → he_logos_micro_v1, grc_logos_v1 → grc_logos_micro_v1
(test expects *_micro_* IDs).

All three manifests updated with correct D0 checksums.
2026-05-13 14:13:11 -07:00
Shay
1f5e0eb1a5 Fix en_minimal_v1 manifest checksum; fix probe/repl.py import path
- manifest checksum updated to match actual bytes-on-disk
  (eca36a3d... — line endings differ between Python serialization and git)
- probe/repl.py: add sys.path.insert so it resolves language_packs
  from repo root when run directly
2026-05-13 14:08:58 -07:00