Skip to content

feat(semantic): vendor the semantic-address algebra kernel as a sovereign lib - #113

Merged
mdheller merged 3 commits into
mainfrom
feat/semantic-address-kernel
Aug 1, 2026
Merged

feat(semantic): vendor the semantic-address algebra kernel as a sovereign lib#113
mdheller merged 3 commits into
mainfrom
feat/semantic-address-kernel

Conversation

@mdheller

@mdheller mdheller commented Aug 1, 2026

Copy link
Copy Markdown
Member

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: superconscious docs/doctrine/.

Contents

  • Graded non-commutative algebra: Term/add/mul/distance, pushout/pullback + one shared meet, first-class BOTTOM abstention, derived verdict lattice, lift ⊣ ground adjunction, SemanticAddress (intension+extension+warrant), pluralistic Lexicons.
  • AgentCoordinateVector.v0.1, BoundaryTransition.v0.2 (9 actantial roles), the abstraction-level gate, the 23×6 intent bridge.
  • Grounding proof (spectral_grounding.py): supermodularity = meet; per-cell clipping = pullback — the tightest links to the constrained-spectral field theory, as passing tests.
  • Mechanized clean-room guard.

Trust

  • 125 tests, every guard exercised on its refusal path. Stdlib-only, local-first.
  • All new files; no existing file modified.
  • ⚠️ 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). Flagged separately.

🤖 Generated with Claude Code

Copilot AI review requested due to automatic review settings August 1, 2026 19:54

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 is procyber/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 is procyber/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.

Comment on lines +53 to +54
def load_inventory(path: Path) -> dict:
return yaml.safe_load(path.read_text(encoding="utf-8"))
Comment thread docs/SEMANTIC_COORDINATE_ALGEBRA.md Outdated
@@ -0,0 +1,61 @@
# Semantic Coordinate Algebra — provenance register & conformance

Status: v0.1 · stdlib-only kernel in `tools/semantic_algebra.py`
Comment on lines +155 to +157
dr = load_dry_run(dry_run_path)
checked_policies = dr.get("checked_policies", [])
violations = dr.get("violations", [])
Comment thread docs/SEMANTIC_LAYER_ADJUNCTION.md Outdated
Comment on lines +3 to +6
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.
@mdheller
mdheller force-pushed the feat/semantic-address-kernel branch from e0de360 to 40b2d57 Compare August 1, 2026 20:10
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.
@mdheller

mdheller commented Aug 1, 2026

Copy link
Copy Markdown
Member Author

Addressed the review. Two comments were on files that were rebased out of this PR after Copilot's pass (the Triune renderers render-cluster-member.py / render-admission-pack.py — stale duplicate commits from an old local branch; the real Triune work is already on main via #112). Those two findings (fail-closed on non-mapping YAML inventory; --dry-run-result vs --dry-run-output consistency) are genuine and now live on main independently — flagging as a separate follow-up, not this PR. The two valid comments on this PR's files are fixed in the latest commit: the two docs/SEMANTIC_*.md now reference procyber/semantic/…, version 0.2.0, and mark the adjunction IMPLEMENTED.

@mdheller
mdheller merged commit acbb895 into main Aug 1, 2026
6 checks passed
mdheller added a commit that referenced this pull request Aug 1, 2026
…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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants