From a7349e4ea3c2d691b6723a51c5352c15f0d191a2 Mon Sep 17 00:00:00 2001 From: Shay Date: Tue, 12 May 2026 21:17:53 -0700 Subject: [PATCH] feat(packs): shared contract, JSON schemas, trilingual anchor template [Batch 2] --- .../anchors/trilingual-anchor-template.json | 43 ++++++++ packs/common/contracts/language-pack.md | 100 ++++++++++++++++++ packs/common/schema/frame.schema.json | 47 ++++++++ packs/common/schema/lemma.schema.json | 54 ++++++++++ packs/common/schema/morphology.schema.json | 31 ++++++ packs/common/schema/probe.schema.json | 34 ++++++ packs/common/schema/sense.schema.json | 33 ++++++ 7 files changed, 342 insertions(+) create mode 100644 packs/common/anchors/trilingual-anchor-template.json create mode 100644 packs/common/contracts/language-pack.md create mode 100644 packs/common/schema/frame.schema.json create mode 100644 packs/common/schema/lemma.schema.json create mode 100644 packs/common/schema/morphology.schema.json create mode 100644 packs/common/schema/probe.schema.json create mode 100644 packs/common/schema/sense.schema.json diff --git a/packs/common/anchors/trilingual-anchor-template.json b/packs/common/anchors/trilingual-anchor-template.json new file mode 100644 index 00000000..c50fc9b4 --- /dev/null +++ b/packs/common/anchors/trilingual-anchor-template.json @@ -0,0 +1,43 @@ +{ + "anchor_set_id": "core-foundation-v0", + "description": "Trilingual alignment anchors for EN/HE/EL. Each anchor is a shared semantic concept that must be expressible in all three packs and must map to the same CORE field target. These are the hardest-gate coherence check: if these cannot be aligned, the pack is not ready.", + "version": "0.1.0", + "anchors": [ + { + "anchor_id": "logos-word-speech", + "field_target": "speech.creative", + "en": {"lemma_id": "en:word", "gloss": "word, speech"}, + "he": {"lemma_id": "he:dabar", "gloss": "word, speech, matter"}, + "el": {"lemma_id": "el:logos", "gloss": "word, reason, speech"}, + "reference": "John 1:1-2", + "notes": "The primary trilingual anchor. Logos/Dabar/Word — the creative speech act through which the universe was spoken into existence. This anchor is the theological and architectural foundation of the three-language choice. All three must map to speech.creative with equal coherence." + }, + { + "anchor_id": "existence-being", + "field_target": "existence.state", + "en": {"lemma_id": "en:be", "gloss": "be"}, + "he": {"lemma_id": "he:haya", "gloss": "be, become, exist"}, + "el": {"lemma_id": "el:eimi", "gloss": "be, exist, am"}, + "reference": "Exodus 3:14 / John 8:58", + "notes": "Copular existence anchor. The 'I AM' — hayah in Hebrew, eimi in Greek, the copula in English. Semantically the deepest single point of alignment across all three packs." + }, + { + "anchor_id": "light", + "field_target": "illumination.emanation", + "en": {"lemma_id": "en:light", "gloss": "light"}, + "he": {"lemma_id": "he:or", "gloss": "light"}, + "el": {"lemma_id": "el:phos", "gloss": "light"}, + "reference": "Genesis 1:3 / John 1:4-5", + "notes": "Illumination anchor. Or/Phos/Light — the first spoken creation and a central semantic pole across the canon." + }, + { + "anchor_id": "beginning-origin", + "field_target": "time.origin", + "en": {"lemma_id": "en:beginning", "gloss": "beginning, origin"}, + "he": {"lemma_id": "he:reshit", "gloss": "beginning, first, chief"}, + "el": {"lemma_id": "el:arche", "gloss": "beginning, origin, rule"}, + "reference": "Genesis 1:1 / John 1:1", + "notes": "Origin anchor. Reshit/Arche — both John and Genesis open with this concept. In Koine Greek arche carries both temporal and ruling senses, which the field primitive must preserve." + } + ] +} diff --git a/packs/common/contracts/language-pack.md b/packs/common/contracts/language-pack.md new file mode 100644 index 00000000..ccd9b082 --- /dev/null +++ b/packs/common/contracts/language-pack.md @@ -0,0 +1,100 @@ +# Language Pack Contract + +A CORE language pack is a deterministic, versioned manifold bundle that binds +a human language to the shared CORE semantic field. + +## Goals + +A valid pack must be able to: + +- Normalize incoming surface text into canonical language units. +- Lift canonical units into CORE-native `CandidateGeometricPressure`. +- Read back field state into grammatical surface language. +- Validate its own internal consistency through the gate sequence. +- Participate in cross-language alignment probes via published anchor records. + +## Required Public Interface + +Each pack's `validators.py` must expose: + +```python +def validate() -> ValidationReport: ... +``` + +Each pack's `lift_rules.py` must expose: + +```python +def lift(analysis: LinguisticAnalysis) -> CandidatePressureBatch: ... +``` + +Each pack's `readback_rules.py` must expose: + +```python +def readback(field_state, intent: dict | None = None) -> SurfaceRealization: ... +``` + +These are not optional. A pack that cannot implement one of these boundaries +must raise `NotImplementedError` at that boundary explicitly. Nothing is +silently skipped. + +## Required Data Surfaces + +| File | Purpose | +|-----------------------|---------------------------------------------------| +| `pack.toml` | Pack identity, version, activation flags | +| `orthography.yaml` | Script, normalization, spacing, punctuation rules | +| `lemmas.jsonl` | Lemma inventory (lemma-first) | +| `morphology.jsonl` | Surface forms per lemma with feature bundles | +| `frames.jsonl` | Predicate frame templates | +| `senses.jsonl` | Sense records mapping lemmas to field targets | +| `lift_rules.py` | Deterministic lift into field primitives | +| `readback_rules.py` | Deterministic articulation from field state | +| `validators.py` | Gate-sequence validation logic | +| `probes/` | Deterministic probe sets for each gate | +| `corpora/manifest.yaml` | Curated, licensed corpus source manifest | + +## Design Rules + +### 1. Lemma-first +Tokens are surface realizations. Lemmas are the stable lexical unit. +The field-state layer operates on lemmas, not tokens. + +### 2. Deterministic normalization +Normalization must be deterministic and script-aware. Unicode NFC is the +minimum baseline. Script-specific rules are defined in `orthography.yaml`. + +### 3. Native morphology +Morphology is a first-class pack surface, not optional metadata. +Hebrew stems and Koine Greek aspects are semantically load-bearing and +must be represented in `morphology.jsonl` with explicit feature bundles. + +### 4. Shared field target +Semantic lift must target shared CORE field primitives. +No pack-private semantic space is permitted. What cannot be expressed +in shared primitives must be proposed as a new shared primitive, +not hidden inside a pack. + +### 5. Readback is owned locally +Each pack owns its articulation rules. Readback is not a global +postprocessor. Ambiguity management at the surface level is resolved +by the pack, not by the field layer. + +### 6. Alignment is explicit +Packs must publish anchor records verifiable against the trilingual +anchor template in `packs/common/anchors/`. Coherence across languages +is a testable probe, not an emergent assumption. + +## Validation Gate Sequence + +| Gate | Checks | +|------|--------| +| 1. Schema | All data files validate against their JSON schemas | +| 2. Lexical | Lemma inventory is non-empty and internally consistent | +| 3. Morphology | All surface forms trace to a known lemma record | +| 4. Lift | Lift rules produce valid pressure for all seed inputs | +| 5. Readback | Readback produces grammatical surface for all seed states | +| 6. Determinism | All D0/D1 paths produce identical output on repeated runs | +| 7. Alignment | Anchor records pass trilingual coherence check | +| 8. Coverage | Probe set covers minimum lexical and morphological surface | + +A pack is not active until all eight gates pass. diff --git a/packs/common/schema/frame.schema.json b/packs/common/schema/frame.schema.json new file mode 100644 index 00000000..ba182539 --- /dev/null +++ b/packs/common/schema/frame.schema.json @@ -0,0 +1,47 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://assetoverflow.dev/core/schemas/frame", + "title": "CORE Frame Record", + "description": "A predicate frame template. Frames define the argument structure of predicates — what roles are required, optional, or forbidden.", + "type": "object", + "required": ["frame_id", "language", "predicate_type", "slots"], + "properties": { + "frame_id": { + "type": "string", + "description": "Stable unique identifier. Convention: {lang}:{predicate-name} e.g. 'he:copular-basic'." + }, + "language": { + "type": "string", + "enum": ["en", "he", "el"] + }, + "predicate_type": { + "type": "string", + "description": "Class of predicate. Examples: 'copular', 'transitive', 'ditransitive', 'intransitive', 'causative', 'stative'." + }, + "slots": { + "type": "array", + "description": "Ordered list of argument slots in this frame.", + "items": { + "type": "object", + "required": ["name", "required"], + "properties": { + "name": {"type": "string"}, + "required": {"type": "boolean"}, + "semantic_role": {"type": "string"}, + "constraints": {"type": "array", "items": {"type": "string"}} + }, + "additionalProperties": false + } + }, + "constraints": { + "type": "array", + "items": {"type": "string"}, + "description": "Frame-level constraints that apply regardless of slot. E.g. 'agreement-required', 'no-passive'." + }, + "field_target": { + "type": ["string", "null"], + "description": "The shared CORE field primitive this frame maps to when activated." + } + }, + "additionalProperties": false +} diff --git a/packs/common/schema/lemma.schema.json b/packs/common/schema/lemma.schema.json new file mode 100644 index 00000000..fcf9bd06 --- /dev/null +++ b/packs/common/schema/lemma.schema.json @@ -0,0 +1,54 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://assetoverflow.dev/core/schemas/lemma", + "title": "CORE Lemma Record", + "description": "A single lexical entry in the pack's lemma inventory. Lemmas are the stable unit of the field-state layer — tokens are surface realizations of lemmas, not the other way around.", + "type": "object", + "required": ["lemma_id", "language", "script_form", "pos", "morph_class", "semantic_family"], + "properties": { + "lemma_id": { + "type": "string", + "description": "Stable unique identifier. Convention: {lang}:{base_form} e.g. 'he:dabar', 'el:logos'." + }, + "language": { + "type": "string", + "enum": ["en", "he", "el"], + "description": "Pack language code." + }, + "script_form": { + "type": "string", + "description": "Canonical script form in the pack's native script. Unicode NFC. For Hebrew: unpointed unless pointing is semantically load-bearing." + }, + "transliteration": { + "type": ["string", "null"], + "description": "Latin-script transliteration for non-Latin packs. Null for English." + }, + "gloss_seed": { + "type": ["string", "null"], + "description": "A minimal English gloss seed. Not a definition — just a stable orientation anchor for alignment and debugging." + }, + "pos": { + "type": "string", + "description": "Part of speech. Use lowercase: 'noun', 'verb', 'adjective', 'particle', 'pronoun', 'preposition', 'conjunction', 'adverb', 'interjection'." + }, + "morph_class": { + "type": "string", + "description": "Morphological class within the pack. For Hebrew: Qal, Niphal, Piel, etc. For Greek: thematic, athematic, etc. For English: regular, copular, modal, etc." + }, + "semantic_family": { + "type": "string", + "description": "Shared semantic family name. This is the cross-language alignment handle. Must be a string that can be matched against the same field in other packs." + }, + "field_hooks": { + "type": "array", + "items": {"type": "string"}, + "description": "List of CORE field primitive names this lemma connects to. These must exist in the shared field primitive vocabulary." + }, + "readback_priority": { + "type": ["number", "integer"], + "description": "When multiple lemmas could realize a field state, higher priority wins. Integer. 1 is highest priority.", + "minimum": 1 + } + }, + "additionalProperties": false +} diff --git a/packs/common/schema/morphology.schema.json b/packs/common/schema/morphology.schema.json new file mode 100644 index 00000000..cff92f51 --- /dev/null +++ b/packs/common/schema/morphology.schema.json @@ -0,0 +1,31 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://assetoverflow.dev/core/schemas/morphology", + "title": "CORE Morphology Record", + "description": "A single inflected surface form derived from a lemma, with an explicit morphological feature bundle.", + "type": "object", + "required": ["record_id", "lemma_id", "surface_form", "features"], + "properties": { + "record_id": { + "type": "string", + "description": "Stable unique identifier. Convention: {lemma_id}:{feature-summary} e.g. 'he:haya:qatal:3ms'." + }, + "lemma_id": { + "type": "string", + "description": "Foreign key to the lemma record." + }, + "surface_form": { + "type": "string", + "description": "The inflected surface form in the pack's native script. Unicode NFC." + }, + "features": { + "type": "object", + "description": "Morphological feature bundle. Keys vary by language and part of speech. Examples for Hebrew verbs: stem, aspect, person, gender, number. Examples for Greek verbs: tense, voice, mood, person, number. Examples for English: tense, person, number." + }, + "notes": { + "type": ["string", "null"], + "description": "Optional notes on irregular forms, defective paradigms, or disambiguation." + } + }, + "additionalProperties": false +} diff --git a/packs/common/schema/probe.schema.json b/packs/common/schema/probe.schema.json new file mode 100644 index 00000000..61eb6d6c --- /dev/null +++ b/packs/common/schema/probe.schema.json @@ -0,0 +1,34 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://assetoverflow.dev/core/schemas/probe", + "title": "CORE Probe Record", + "description": "A deterministic probe for pack validation. Probes are the executable assertions that verify a pack's contract against real inputs.", + "type": "object", + "required": ["probe_id", "kind", "input", "expected"], + "properties": { + "probe_id": { + "type": "string", + "description": "Stable unique identifier. Convention: {lang}:{gate}:{probe-name}." + }, + "kind": { + "type": "string", + "description": "Which gate this probe tests. One of: 'schema', 'lexical', 'morphology', 'lift', 'readback', 'determinism', 'alignment', 'coverage'.", + "enum": ["schema", "lexical", "morphology", "lift", "readback", "determinism", "alignment", "coverage"] + }, + "input": { + "description": "The input to the operation under test. Shape depends on kind." + }, + "expected": { + "description": "The expected output or outcome. Shape depends on kind." + }, + "tolerance": { + "type": ["number", "null"], + "description": "For numeric comparisons, the acceptable deviation. Null for exact-match probes." + }, + "notes": { + "type": ["string", "null"], + "description": "Optional commentary on what this probe is checking and why." + } + }, + "additionalProperties": false +} diff --git a/packs/common/schema/sense.schema.json b/packs/common/schema/sense.schema.json new file mode 100644 index 00000000..f99f689a --- /dev/null +++ b/packs/common/schema/sense.schema.json @@ -0,0 +1,33 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://assetoverflow.dev/core/schemas/sense", + "title": "CORE Sense Record", + "description": "A single sense of a lemma: a specific mapping from a lemma to a CORE field target, valid under specified constraints.", + "type": "object", + "required": ["sense_id", "lemma_id", "field_target"], + "properties": { + "sense_id": { + "type": "string", + "description": "Stable unique identifier. Convention: {lemma_id}:{sense-name} e.g. 'el:logos:cosmic-speech'." + }, + "lemma_id": { + "type": "string", + "description": "Foreign key to the lemma record." + }, + "field_target": { + "type": "string", + "description": "The CORE shared field primitive this sense maps to. Must exist in the shared primitive vocabulary. E.g. 'speech.creative', 'existence.state', 'identity.relational'." + }, + "constraints": { + "type": "array", + "items": {"type": "string"}, + "description": "Conditions under which this sense is valid. E.g. 'copular-frame', 'divine-context', 'temporal-aspect:aorist'." + }, + "rank": { + "type": ["number", "integer"], + "description": "Priority rank for this sense when multiple senses could apply. 1 is primary sense.", + "minimum": 1 + } + }, + "additionalProperties": false +}