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.
This commit is contained in:
Shay 2026-05-13 14:18:08 -07:00
parent e6bf8ade5e
commit 52de2218b7
3 changed files with 22 additions and 5 deletions

View file

@ -27,6 +27,21 @@ Distance metric: algebra/cga.py::cga_inner(X, Y) -> -d^2 / 2
These are the only primitives. Everything else is built from them.
## Language Pack Checksum Rule (Critical)
Manifest checksums MUST be computed by reading back the bytes actually
written to disk — never from an in-memory string before serialization:
# CORRECT — hash what disk holds
checksum = hashlib.sha256(Path(lexicon_path).read_bytes()).hexdigest()
# WRONG — Python str != unicode-escaped JSON bytes on disk
checksum = hashlib.sha256(content_str.encode('utf-8')).hexdigest()
The GitHub API (and git) store JSON with unicode escapes (\u05d3, not ד).
Python json.dumps() with ensure_ascii=False produces different bytes.
Always write the file first, then read_bytes() to get the checksum.
## Implementation Order
Do not skip steps. Run the invariant test after each step before writing the next.
@ -42,6 +57,7 @@ Do not skip steps. Run the invariant test after each step before writing the nex
9. persona/motor.py -> tests/test_motor.py must pass
10. generate/stream.py
11. session/context.py
12. language_packs/compiler.py -> tests/test_holonomy_resonance.py must pass
## Architecture in One Sentence

View file

@ -19,7 +19,7 @@ Software should understand the machine it runs on, not fight it. CORE is designe
### II. Semantic Rigor
Every term used in this system has a precise, non-negotiable meaning. A versor is a versor — not an approximation of one, not a vector that behaves like one under certain conditions. CGA distance is exact. Vault recall is exact. The vocabulary projection is exact. There are no thresholds tuned for "good enough." Rigor is not a style; it is what separates an engine from a heuristic.
Every term used in this system has a precise, non-negotiable meaning. A versor is a versor — not an approximation of one, not a vector that behaves like one under certain conditions. CGA distance is exact. Vault recall is exact. The vocabulary projection is exact. There are no thresholds tuned for “good enough.” Rigor is not a style; it is what separates an engine from a heuristic.
### III. Third Door
@ -35,9 +35,9 @@ CORE is rooted in three human languages. This is a philosophical and architectur
|---|---|
| **English** | The default base language of the current model. Any natural language could serve this function in a custom CORE instance — English is the chosen starting point, not a requirement. |
| **Hebrew** | One of two depth languages. Hebrew carries a density of meaning in its root structures, prefixes, and suffixes that Euclidean string matching cannot capture. The field representation is designed to hold this depth. |
| **Koine Greek** | One of two depth languages. The language of the New Testament, particularly John's Gospel — the document that opens with the most precise and consequential statement about language and reality ever written. |
| **Koine Greek** | One of two depth languages. The language of the New Testament, particularly Johns Gospel — the document that opens with the most precise and consequential statement about language and reality ever written. |
> *"In the beginning was the Logos, and the Logos was with God, and the Logos was God."*
> *“In the beginning was the Logos, and the Logos was with God, and the Logos was God.”*
> — John 1:1
The choice of Hebrew and Koine Greek is not incidental. John 1:12 articulates the Logos in Greek while grounding it in the Hebrew creation account — the universe spoken into existence, word by word. This is not metaphor. It is the claim that language is not a layer on top of reality; language **is** the structuring principle of reality made manifest. CORE-Logos is built on that claim.
@ -76,7 +76,7 @@ raw input -> ingest/gate.py (normalize once)
| `algebra/` | Cl(4,1) multivector math, versor ops, CGA, holonomy |
| `ingest/` | Single injection gate — the only normalization site |
| `field/` | FieldState dataclass and propagation loop |
| `vocab/` | Word-to-versor manifold, edge rotors |
| `vocab/` | Surface-token manifold points; indexed access for algebraic transition construction |
| `vault/` | Exact CGA inner product memory store |
| `persona/` | Persona as CGA motor (screw motion) |
| `generate/` | Token streaming loop |

View file

@ -17,7 +17,7 @@ import numpy as np
_EXPECTED_COMPONENTS = 32
@dataclass(frozen=True)
@dataclass(frozen=True, slots=True)
class FieldState:
F: np.ndarray # shape (32,) float32 — Cl(4,1) multivector on the versor manifold
node: int = 0 # current node index in the vocabulary manifold
@ -28,6 +28,7 @@ class FieldState:
# Enforce copy + dtype + shape at the construction boundary.
# frozen=True prevents reassignment, but ndarray contents are still
# mutable via the array object; copy() here is the defence.
# slots=True closes __dict__ so no incidental attributes can be added.
F = np.array(self.F, dtype=np.float32).copy()
if F.shape != (_EXPECTED_COMPONENTS,):
raise ValueError(