Audit of the one-mutation-path invariant (ADR-0021 §3) found three leaks
where pack authority or session-state writes could substitute for coherence
judgment. All three landed fixes or partial closures in this push.
Leaks closed:
- Leak A: pack vocab defaulted to COHERENT — flipped to SPECULATIVE in
language_packs/{compiler,schema}.py; docstring corrected to align with
ADR-0021 (it was rationalizing the leak).
- Leak B: vault.recall was epistemic-blind — VaultStore.store() now stamps
every entry with EpistemicStatus (default SPECULATIVE); recall(min_status=)
filters to admissible-as-evidence tier. All 4 vault-write sites updated.
- Leak C (write-side): generate/proposition.py:198 stored articulated
propositions unmarked — now stamps SPECULATIVE, breaking the
fabrication-feedback loop in principle. Read-side audit of 5 call sites
is the residual.
New architectural invariants (tests/test_architectural_invariants.py):
- INV-21: one-mutation-path allowlist (caught Leak C on first run)
- INV-22: pack lexicon default is SPECULATIVE (Leak A guard)
- INV-23: vault recall epistemic-aware (Leak B guard)
New eval lanes:
- teaching_injection_resistance — ships GREEN at 1.00/1.00/0 (the
structural anti-injection claim is real and measurable)
- refusal_calibration — honest gap: 0% refusal, 0% fabrication
- contradiction_detection — honest gap: 50% flag via versor-delta heuristic,
100% false-positive; motivates the proper coherence-checker
- articulation_of_status — honest gap: 0% speculative articulation, 60%
false certainty; output-side leak surface
New benchmarks:
- benchmarks/footprint.py — total deployed runtime is 7.06 MiB
(109,358x smaller than Llama 3.1 405B, runs offline, no GPU)
- benchmarks/learning_curve.py — monotonic + replay-deterministic curve
per lane
Documentation:
- docs/truth_seeking_schema.md — foundational architectural commitment,
five rules, mapped to human failure modes, leaks published openly
- evals/CLAIMS.md — five-tier public claims doc; Tier 4.5 publishes
known gaps with named fixes; verification contract at top
- README.md — new pillar between algebraic substrate and language pillar
Includes in-flight formation pipeline scaffolding (formation/, tests/formation/,
docs/formation_pipeline_plan.md) and minor CLI/contracts/gitignore edits
that were already in the working tree at session start.
Verification: 798 passed, 2 skipped, 1 deselected (pre-existing pack-count
test drift unrelated to schema changes).
183 lines
6.1 KiB
Python
183 lines
6.1 KiB
Python
"""
|
|
Schemas for CORE compiled linguistic manifolds.
|
|
|
|
A language pack is not a dataset. It is a deterministic, checksummed,
|
|
compiled linguistic manifold: lexical surfaces, morphology, grammar
|
|
attractors, cross-language resonances, and holonomy-level proof cases.
|
|
|
|
These schemas intentionally do not load corpora. They define the contract the
|
|
Supervised Seeding Epoch must satisfy before Hebrew and Koine Greek gates can
|
|
engage.
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
from dataclasses import dataclass, field
|
|
from enum import Enum
|
|
from typing import Mapping, Sequence
|
|
|
|
|
|
class LanguageRole(str, Enum):
|
|
"""Architectural role of a language pack in CORE-Logos."""
|
|
|
|
OPERATIONAL_BASE = "operational_base"
|
|
ARTICULATION_SURFACE = "articulation_surface"
|
|
DEPTH_ROOT = "depth_root"
|
|
DEPTH_RELATION = "depth_relation"
|
|
|
|
|
|
class OOVPolicy(str, Enum):
|
|
"""Out-of-vocabulary behavior for a pack."""
|
|
|
|
FAIL_CLOSED = "fail_closed"
|
|
TAGGED_FALLBACK = "tagged_fallback"
|
|
PROPOSE_VOCAB_EXPANSION = "propose_vocab_expansion"
|
|
|
|
|
|
@dataclass(frozen=True, slots=True)
|
|
class LanguagePackManifest:
|
|
"""Pinned manifest for one compiled language pack."""
|
|
|
|
pack_id: str
|
|
language: str
|
|
role: LanguageRole
|
|
script: str
|
|
normalization_policy: str
|
|
source_manifest: str
|
|
determinism_class: str
|
|
checksum: str
|
|
version: str = "1.0.0"
|
|
gate_engaged: bool = False
|
|
oov_policy: OOVPolicy = OOVPolicy.FAIL_CLOSED
|
|
|
|
def __post_init__(self) -> None:
|
|
if not self.pack_id:
|
|
raise ValueError("LanguagePackManifest.pack_id is required.")
|
|
if not self.language:
|
|
raise ValueError("LanguagePackManifest.language is required.")
|
|
if not self.checksum:
|
|
raise ValueError("LanguagePackManifest.checksum is required.")
|
|
if self.role in {LanguageRole.DEPTH_ROOT, LanguageRole.DEPTH_RELATION}:
|
|
if self.gate_engaged and self.oov_policy is not OOVPolicy.FAIL_CLOSED:
|
|
raise ValueError(
|
|
"Depth packs must fail closed while gate_engaged=True; "
|
|
"unknown Hebrew/Greek surfaces must not collapse to a fallback point."
|
|
)
|
|
|
|
|
|
@dataclass(frozen=True, slots=True)
|
|
class MorphologyEntry:
|
|
"""
|
|
Morphological decomposition for a surface form.
|
|
|
|
Ordering is load-bearing. For Semitic root morphology and Koine grammar,
|
|
non-commutative composition means prefix/stem/inflection/suffix order must
|
|
be preserved exactly.
|
|
"""
|
|
|
|
morphology_id: str
|
|
surface: str
|
|
lemma: str
|
|
language: str
|
|
root: str | None = None
|
|
prefix_chain: tuple[str, ...] = field(default_factory=tuple)
|
|
stem: str | None = None
|
|
inflection: Mapping[str, str] = field(default_factory=dict)
|
|
suffix_chain: tuple[str, ...] = field(default_factory=tuple)
|
|
|
|
def __post_init__(self) -> None:
|
|
if not self.morphology_id:
|
|
raise ValueError("MorphologyEntry.morphology_id is required.")
|
|
if not self.surface:
|
|
raise ValueError("MorphologyEntry.surface is required.")
|
|
if not self.lemma:
|
|
raise ValueError("MorphologyEntry.lemma is required.")
|
|
if not self.language:
|
|
raise ValueError("MorphologyEntry.language is required.")
|
|
|
|
|
|
@dataclass(frozen=True, slots=True)
|
|
class LexicalEntry:
|
|
"""One surface/lemma entry in a compiled linguistic manifold.
|
|
|
|
`epistemic_status` follows ADR-0021: it is a *position in the
|
|
revision graph*, not a source-trust tier. The default is
|
|
``"speculative"`` per ADR-0021 §Schema impact: "transitions to
|
|
COHERENT / CONTESTED / FALSIFIED only via the review path." A pack
|
|
lexicon row that wants to be admissible as evidence
|
|
(``ADMISSIBLE_AS_EVIDENCE``) must declare
|
|
``"epistemic_status": "coherent"`` explicitly; the declaration is
|
|
itself the curator's stamp. Pack authority alone is not coherence
|
|
judgment — defaulting unmarked rows to COHERENT would re-import the
|
|
bias ADR-0021 refuses (see ``docs/truth_seeking_schema.md`` §1).
|
|
"""
|
|
|
|
entry_id: str
|
|
surface: str
|
|
lemma: str
|
|
language: str
|
|
part_of_speech: str | None = None
|
|
pos: str | None = None
|
|
morphology_id: str | None = None
|
|
morphology_tags: tuple[str, ...] = field(default_factory=tuple)
|
|
semantic_domains: tuple[str, ...] = field(default_factory=tuple)
|
|
manifold_point_checksum: str | None = None
|
|
provenance_ids: tuple[str, ...] = field(default_factory=tuple)
|
|
epistemic_status: str = "speculative"
|
|
|
|
|
|
@dataclass(frozen=True, slots=True)
|
|
class GrammarAttractor:
|
|
"""
|
|
Structural grammar attractor seeded into the shared manifold.
|
|
|
|
Morphology is operator composition. Semantic domain is attractor geometry.
|
|
Alignment is resonance. This class represents the attractor layer only.
|
|
"""
|
|
|
|
attractor_id: str
|
|
language: str
|
|
role: str
|
|
description: str
|
|
operator_order: tuple[str, ...] = field(default_factory=tuple)
|
|
checksum: str | None = None
|
|
|
|
|
|
@dataclass(frozen=True, slots=True)
|
|
class AlignmentEdge:
|
|
"""Weighted directional resonance between entries or concepts."""
|
|
|
|
source_id: str
|
|
target_id: str
|
|
relation: str
|
|
weight: float
|
|
evidence_ids: tuple[str, ...] = field(default_factory=tuple)
|
|
|
|
def __post_init__(self) -> None:
|
|
if not 0.0 <= self.weight <= 1.0:
|
|
raise ValueError("AlignmentEdge.weight must be in [0, 1].")
|
|
|
|
|
|
@dataclass(frozen=True, slots=True)
|
|
class HolonomyAlignmentCase:
|
|
"""
|
|
Crown proof case for the three-language design.
|
|
|
|
The language system succeeds when aligned canonical clauses produce nearby
|
|
holonomies without flattening their distinctions. This is not token-level
|
|
translation; it is dynamic field-path resonance.
|
|
"""
|
|
|
|
case_id: str
|
|
description: str
|
|
source_refs: tuple[str, ...]
|
|
pack_ids: tuple[str, ...]
|
|
expected_relation: str
|
|
negative_source_refs: tuple[str, ...] = field(default_factory=tuple)
|
|
tolerance: float | None = None
|
|
|
|
def __post_init__(self) -> None:
|
|
if len(self.source_refs) < 2:
|
|
raise ValueError("HolonomyAlignmentCase requires at least two source_refs.")
|
|
if len(self.pack_ids) < 2:
|
|
raise ValueError("HolonomyAlignmentCase requires at least two pack_ids.")
|