core/AGENTS.md
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

2.4 KiB

CORE-AI Agent Instructions

The Invariant (Read Before Touching Any Code)

Every field state F must satisfy:

||F * reverse(F) - 1||_F < 1e-6

This is checked by algebra/versor.py::versor_condition().

What You Must Never Add

  • Any normalization call outside ingest/gate.py
  • Grade guards, grade monitors, or grade projection in the hot path
  • Drift correction, correction thresholds, or correction timers
  • ANN indexes, HNSW, cosine similarity, or approximate distance
  • Field energy measurement or pseudoscalar accumulation checks
  • Any function whose only job is to watch or repair another function

If you think you need one of these, you have an unclosed operation upstream. Find it and close it.

The Two Allowed Primitives

Field transition: algebra/versor.py::versor_apply(V, F) -> VFreverse(V) 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.

  1. algebra/cl41.py
  2. algebra/versor.py -> tests/test_versor_closure.py must pass
  3. algebra/cga.py -> tests/test_null_cone.py must pass
  4. algebra/holonomy.py -> tests/test_holonomy.py must pass
  5. ingest/gate.py
  6. vocab/manifold.py
  7. field/state.py + field/propagate.py
  8. vault/store.py -> tests/test_vault_recall.py must pass
  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

Raw input -> inject once -> versor on the manifold -> versor_apply every step -> CGA inner product for recall and decoding -> persona motor for voicing -> done.