Commit graph

17 commits

Author SHA1 Message Date
Shay
eb30c75810 feat: Full Proof — surface realizer join, Rust diffusion parity, benchmark harness
Surface realizer join: pulse output_versor → vault recall → ground_graph fills
<pending> obj slots with recalled words → realize_semantic produces deterministic
sentences. PulseResult replaces bare word list. Every intent type surfaces.

Rust backend parity: unitize_f32 (exponential-map with boost/rotation blade
distinction) and graph_diffusion_step now in core-rs. Python dispatches through
algebra.backend, falls back transparently. 37x speedup on 200-step diffusion.

Benchmark harness (core bench): determinism (100% trace stability), latency
(~150ms median), backend speedup, versor closure audit (0 violations across all
intermediate states), convergence proof (41/45 exact, 4 bounded oscillation),
realizer coverage (8/8 intent types).

Proof property tests (31 tests): Rust/Python parity, pulse determinism across
prompts, V3 convergence for 10+ topologies, coupled V4 output validity, realizer
coverage per intent, versor closure at every intermediate step.

CLI: core pulse, core bench, core test --suite pulse, core test --suite proof.
Fix test_correction_pulls_toward_target (diffuse first, then correct).
2026-05-15 17:39:14 -07:00
Shay
29f573d176 feat(threshold-2): ConstraintCorrectionOperator — non-trivial dual-correction
Implements the coupled forward-correction loop that separates CORE from
a nearest-neighbour lookup engine:

  per iteration:
    state, Δ_fwd  = diffusion_op.forward(state)        # spread context
    state, Δ_corr = correction_op.adjoint_pass(state)  # enforce intent
    converged when both Δ_fwd < ε and Δ_corr < ε

field/operators.py:
- Add ConstraintCorrectionOperator(target_versor, correction_rate, node_index)
- adjoint_pass() builds an incremental correction rotor from the current
  output-node versor toward the intent target using the exponential map
  (same _unitize_f32 path, same boost/rotation blade classification).
  This is a non-self-adjoint operator: it has a preferred direction.
- forward() is identity (correction acts only on the output node via adjoint_pass).
- The target is the prompt centroid versor — same geometry that seeds the
  output node, so the correction restores coherence broken by diffusion.

scripts/run_pulse.py (V4):
- Build target_versor from prompt centroid before the loop (exposed from
  _build_manifold as a second return value alongside state + labels).
- Instantiate GraphDiffusionOperator + ConstraintCorrectionOperator.
- Coupled convergence: loop until both Δ_fwd < ε AND Δ_corr < ε.
- Print both deltas each step for observability.
- --correction-rate flag (default 0.3) to tune correction strength.
- --no-correction flag to reproduce V3 pure-diffusion behaviour.

tests/test_pulse_integration.py:
- test_correction_pulls_toward_target: verifies output node moves closer
  to target versor under correction than without it.
- test_coupled_loop_converges: full V4 pulse with correction converges.
- test_correction_rate_zero_is_identity: rate=0 leaves the field unchanged.
- test_different_inputs_produce_different_correction_targets: correction
  targets differ for semantically distinct inputs.
2026-05-15 17:10:13 -07:00
Shay
3b4fa242c6 docs: document Cl(4,1) boost blade classification and float64 discipline
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-05-15 17:06:37 -07:00
Shay
c9dfad3017 feat: convergent graph diffusion with exponential-map versor unitization
Replace the divergent rotation-based diffusion operator with a linear
blend + exponential-map re-unitization approach that converges in ~28
steps while maintaining vc < 1e-6.

Key changes:
- GraphDiffusionOperator now averages neighbors in multivector space and
  re-projects via per-plane exponentials (cos/sin for rotations, cosh/sinh
  for boosts in Cl(4,1))
- run_pulse V3: per-token graph topology with input-driven output node,
  recall via VocabManifold.nearest(), --no-glove flag for compiled pack
- Tests updated for V3 API

Different inputs now produce different recall rankings from the compiled
en_core_cognition_v1 vocabulary, completing Threshold 1 (Semantic Encoding).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-05-15 17:02:47 -07:00
Shay
b61e79353a feat: manifold field topology, graph diffusion operator, vertical pulse
Add ManifoldState (N,32) versor field over graph edges, GraphDiffusionOperator
with damped convergence via construction_seed_versor closure, deterministic
hash-to-versor stub, and run_pulse.py end-to-end script proving injection →
propagation → vault recall → token output. 24 new tests, zero regressions
on architectural invariants.
2026-05-15 16:02:48 -07:00
Shay
15ed2cee89
Tighten hot-path backend consistency
- route SessionContext anchor CGA through algebra.backend
- move aspect-weight carry into FieldEnergyOperator.compute
- remove duplicated propagate_step threshold patch and per-step imports
- add carry_aspect_weight tests for parity, fallback, and propagation preservation
- preserve normalization, propagation, vault, Rust dispatch, and energy cadence semantics
2026-05-15 08:14:38 -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
2b78cd1179 Add dialogue frame selection 2026-05-13 20:19:21 -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
a87c7a9c6f Fix full test suite after cognitive runtime 2026-05-13 13:52:11 -07:00
Shay
3620c967b9 fix: route production hot paths through algebra.backend (Commit 2)
Three surgical import changes. No behavior change. No new semantics.
Backend decides Rust vs pure-Python transparently.

- field/propagate.py: versor_apply <- algebra.backend
- vocab/manifold.py: cga_inner    <- algebra.backend
- vault/store.py:    recall loop replaced with vault_recall() from
  algebra.backend; public result shape preserved ({versor, score,
  metadata, index}). null_project stays on algebra.cga (not the
  recall hot path). store() and reproject() unchanged.

Rust path for vault_recall uses Rayon parallel scan and releases
the GIL. Python fallback is sequential and behaviorally identical.
No batching introduced; that is Commit 3+.
2026-05-13 12:35:22 -07:00
Shay
3746f06898 fix: cohesive seam pass — frozen FieldState, GenerationResult, generation/vocab/algebra separation, normalization doctrine
- field/state.py: FieldState is now frozen+slotted; constructor copies and
  enforces float32 shape (32,); advance() updated to pass raw arrays.
  np.ndarray inside frozen dataclass is ref-frozen — copy() at construction
  is the explicit contract boundary.

- generate/result.py: NEW — GenerationResult frozen dataclass carrying
  tokens + final_state. Async variant yields tokens and exposes final_state
  on completion.

- generate/stream.py: generate() now returns GenerationResult, not list[str].
  vocab.edge_rotor() call replaced with:
    A = vocab.get_versor_at(current.node)
    B = vocab.get_versor_at(word_idx)
    V = word_transition_rotor(A, B)
  agenerate() updated to yield tokens and surface final_state.

- vocab/manifold.py: added get_versor_at(idx) and get_word_at(idx) indexed
  accessors. VocabManifold stores points; algebra constructs operators.
  normalize_to_versor() call-site in docstring clarified: callers must call
  unitize_versor() (algebra construction primitive) before add(), not
  normalize_to_versor() directly.

- algebra/versor.py: unitize_versor() added as the explicit construction-time
  primitive. normalize_to_versor() kept but marked internal/gate-only.
  Distinction encoded in docstrings and __all__.

- persona/motor.py + ingest/gate.py: SessionContext.respond() is not yet in
  the repo as a separate file; gate.py docstring updated to reflect the
  three-tier normalization doctrine:
    unitize_versor()    — algebra construction only
    inject()            — gate, once per raw input
    normalization       — forbidden in propagate/generate/vault recall
2026-05-13 12:32:36 -07:00
Shay
b5989f35ec init: ingest, field, vocab, vault, persona, generate, session layers 2026-05-12 19:14:22 -07:00