feat(semantic): vendor the semantic-address algebra kernel as a sovereign lib - #113
Conversation
There was a problem hiding this comment.
Pull request overview
This PR vendors a “sovereign” semantic-address algebra kernel into procyber/semantic/ (plus Triune rendering utilities, contracts, examples, and tests) to codify structural semantics, abstention (BOTTOM), derived verdict lattice, and layer discipline as executable, locally verifiable artifacts.
Changes:
- Adds the semantic algebra kernel and related bridge/guards (
semantic_algebra, intent bridge, adjunction, spectral grounding, clean-room scanner). - Adds Triune admission/cluster-member renderers and evidence hashing utilities, with schema validation.
- Adds contract schemas + examples and an extensive test suite to make the contracts and guards load-bearing.
Reviewed changes
Copilot reviewed 33 out of 34 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| tools/triune/render-cluster-member.py | Renders a cluster-member record from lab inventory and validates it against schema. |
| tools/triune/render-admission-pack.py | Renders admission-pack records from candidate identity + dry-run inputs with fail-closed rules. |
| tools/triune/hash-evidence.py | Computes deterministic SHA-256 hashes for evidence artifacts. |
| tests/test_triune_cluster_member_render.py | Exercises cluster-member rendering rules + schema validity. |
| tests/test_triune_admission_pack_render.py | Exercises admission-pack rendering and validator alignment (pass + refusal paths). |
| tests/test_spectral_grounding.py | Pins spectral-grounding equivalences (supermodularity/meet, projection/pullback). |
| tests/test_semantic_algebra.py | Core semantic algebra conformance tests (pass + refusal paths). |
| tests/test_semantic_algebra_deltas.py | Tests “BOTTOM abstention” and derived verdict order deltas. |
| tests/test_semantic_algebra_adjunction.py | Proof obligations for lift ⊣ ground and bridged distance. |
| tests/test_intent_address.py | Tests the 23×6 intent-grid bridge and routing/abstention behavior. |
| tests/test_contract_schemas.py | Ensures JSON Schemas are valid and “bite” (reject bad docs). |
| tests/test_check_cleanroom.py | Ensures clean-room scanner passes on shipped files and flags true leaks. |
| tests/test_boundary_transition_actants.py | Tests BoundaryTransition v0.2 actantial frame validation + skeletonization. |
| tests/test_agent_coordinate_vector.py | Tests AgentCoordinateVector v0.1 validation and refusal paths. |
| tests/test_abstraction_level_gate.py | Tests the abstraction-level mismatch gate (teeth both ways). |
| procyber/semantic/spectral_grounding.py | Implements constrained-spectral grounding utilities and projections. |
| procyber/semantic/semantic_algebra.py | Implements the kernel algebra, abstention, verdict lattice, and adjunction utilities. |
| procyber/semantic/intent_address.py | Encodes intent-grid as algebra slice (addresses, routing, fill metrics). |
| procyber/semantic/check_cleanroom.py | Implements clean-room guard scanning framework artifacts for forbidden marks. |
| procyber/semantic/boundary_transition_actants.py | Implements v0.2 actantial role validation + skeleton extraction. |
| procyber/semantic/agent_coordinate_vector.py | Implements AgentCoordinateVector enforcement beyond JSON Schema expressivity. |
| procyber/semantic/abstraction_level_gate.py | Implements mismatch-rate gate for abstraction-level binding errors. |
| procyber/semantic/init.py | Exposes the semantic kernel public API surface. |
| examples/triune/policy-dry-run.synthetic.json | Synthetic dry-run fixture consumed by admission-pack rendering/tests. |
| examples/triune/lab/triune-lab.synthetic.yaml | Synthetic lab inventory fixture consumed by cluster-member rendering/tests. |
| docs/SEMANTIC_LAYER_ADJUNCTION.md | Design/implementation note for the layer adjunction. |
| docs/SEMANTIC_COORDINATE_ALGEBRA.md | Provenance/conformance register for the algebra kernel. |
| docs/integration/triune-ecosystem-map.md | Integration map describing Triune evidence/admission layering and cross-refs. |
| docs/integration/noetica-admission-candidate.md | Draft admission-candidate record for Noetica with required gates and non-claims. |
| contracts/examples/boundary-transition-v0.2-ai-invocation.example.json | BoundaryTransition v0.2 example fixture. |
| contracts/examples/agent-coordinate-vector-michael-agent.example.json | AgentCoordinateVector v0.1 example fixture. |
| contracts/BoundaryTransition.v0.2.json | BoundaryTransition v0.2 JSON Schema contract. |
| contracts/AgentCoordinateVector.v0.1.json | AgentCoordinateVector v0.1 JSON Schema contract. |
| .gitignore | Adds Python/OS ignore patterns. |
Suppressed comments (2)
docs/SEMANTIC_COORDINATE_ALGEBRA.md:26
- This clean-room enforcement reference points at
tools/check_cleanroom.py, but the guard shipped in this PR isprocyber/semantic/check_cleanroom.py. The doc should reference the actual guard entrypoint.
grammar prose. (This constraint is enforced, not merely asserted — see
`tools/check_cleanroom.py`.)
docs/SEMANTIC_COORDINATE_ALGEBRA.md:55
- This reference points at
tools/abstraction_level_gate.py, but the gate shipped in this PR isprocyber/semantic/abstraction_level_gate.py. Updating the path keeps the documentation navigable.
(`tools/abstraction_level_gate.py`) measures.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| def load_inventory(path: Path) -> dict: | ||
| return yaml.safe_load(path.read_text(encoding="utf-8")) |
| @@ -0,0 +1,61 @@ | |||
| # Semantic Coordinate Algebra — provenance register & conformance | |||
|
|
|||
| Status: v0.1 · stdlib-only kernel in `tools/semantic_algebra.py` | |||
| dr = load_dry_run(dry_run_path) | ||
| checked_policies = dr.get("checked_policies", []) | ||
| violations = dr.get("violations", []) |
| Status: DESIGN (code to follow) · Scope: an addition to `tools/semantic_algebra.py` | ||
| Motivation: Kant's schematism, made plural and principled. This note is spec + proof | ||
| obligations; it deliberately does not ship code, because an adjunction earns its keep | ||
| only with a both-ways proof and that deserves its own change. |
…eign lib Extracts the validated kernel (proven in prophet-platform PR #1199) into procyber/semantic/ as the reference implementation of the constrained-spectral field theory's discrete skeleton (doctrine: superconscious docs/doctrine/). Stdlib-only, Apache-2.0-clean, SPEC_VERSION 0.2.0 for freshness-plane vendoring. Includes: the graded non-commutative algebra (Term/add/mul/distance, pushout/pullback + shared meet, first-class BOTTOM abstention, derived verdict lattice, lift-ground adjunction, SemanticAddress warrant, pluralistic Lexicons); AgentCoordinateVector.v0.1; BoundaryTransition.v0.2 actants; the abstraction-level gate; the 23x6 intent bridge; the spectral-grounding proof (supermodularity = meet; per-cell clipping = pullback); and the mechanized clean-room guard. 125 tests, every guard exercised both ways. Note: 2 pre-existing failures in test_lawful_learning_conformance.py are unrelated to this change (verified: they fail on the base with these files removed).
…on sys.path The validator imports procyber.lawful_learning.toy, but when run as a subprocess (as the conformance tests do, with no PYTHONPATH), sys.path[0] is the script's own directory, not the repo root — so 'procyber' was unimportable and the validator exited 1 with 'could not import toy module: No module named procyber'. Insert ROOT at the front of sys.path so the package resolves regardless of invocation. Fixes the two failing tests in test_lawful_learning_conformance.py (validator_passes, non_claims_are_recorded); full suite 245 passed.
e0de360 to
40b2d57
Compare
Ported docs still pointed at tools/ (the prophet-platform location) and stale status: - SEMANTIC_COORDINATE_ALGEBRA.md: tools/*.py -> procyber/semantic/*.py; v0.1 -> SPEC_VERSION 0.2.0 - SEMANTIC_LAYER_ADJUNCTION.md: DESIGN (code to follow) -> IMPLEMENTED; tools/ -> procyber/semantic/ Addresses the two valid Copilot comments on this PR.
|
Addressed the review. Two comments were on files that were rebased out of this PR after Copilot's pass (the Triune renderers |
…113) (#115) * fix(triune): fail closed in the two renderers (Copilot findings from #113) 1. render-cluster-member.py: load_inventory() returned yaml.safe_load(...) directly, so an empty file (None) or a non-mapping root would crash resolve_member() on .get(). Now refuses with a clear error when the root is not a mapping; main() wraps the load in the fail-closed handler so the CLI exits 1 without a traceback. 2. render-admission-pack.py: build_pack() trusted --dry-run-result even when the --dry-run-output artifact recorded its own , allowing a hash-bound pack that claims one verdict while its evidence says another. Now reconciles the two and refuses on mismatch. Adds a refusal-path test for each. Full suite 372 passed. procyber/semantic/ untouched. * fix(triune): harden the two renderers further (Copilot #115 follow-ups) - render-cluster-member.py: convert yaml.YAMLError (malformed YAML syntax) into a clear ValueError instead of leaking a traceback. - render-admission-pack.py: refuse when the dry-run output JSON root is not an object (list/scalar would crash dr.get(...)). Adds a refusal test for each. Full suite green.
Extracts the semantic-address algebra kernel — proven in prophet-platform #1199 — into
procyber/semantic/as an Apache-2.0 sovereign library,SPEC_VERSION 0.2.0, for vendoring into the AI/intelligence stacks via the freshness plane. Doctrine: superconsciousdocs/doctrine/.Contents
Term/add/mul/distance,pushout/pullback+ one sharedmeet, first-classBOTTOMabstention, derived verdict lattice,lift ⊣ groundadjunction,SemanticAddress(intension+extension+warrant), pluralisticLexicons.AgentCoordinateVector.v0.1,BoundaryTransition.v0.2(9 actantial roles), the abstraction-level gate, the 23×6 intent bridge.spectral_grounding.py): supermodularity =meet; per-cell clipping =pullback— the tightest links to the constrained-spectral field theory, as passing tests.Trust
test_lawful_learning_conformance.pyare unrelated to this change (verified: they fail on the base with these files removed). Flagged separately.🤖 Generated with Claude Code