SEMANTIC MACHINERY · MODULE 02 SEMANTIC CONTRACTS & SHACL GATES 4 CONTRACT CLASSES 8 ARCHITECTURAL PLATES
SEMANTIC MACHINERY INITIATIVE · DOMAIN 02 SPECIFICATION
Semantic Machinery · Module 02 · SHACL + SPARQL Gates · OPA/Cedar Authorization · Proof-Carrying Agency

Semantic Contracts, SHACL Action Gates & Proof-Carrying Agency.

Machine-enforceable data product, tool capability, and policy contracts that validate every candidate agent proposal before consequential database or API execution.

Executive Architectural Synthesis · Semantic Machinery · Module 02

When an autonomous agent proposes an enterprise action, natural-language plausibility is irrelevant. The Enterprise Semantic Control Plane intercepts every proposal and executes a four-stage deterministic verification pipeline—emitting a cryptographic Proof-Carrying Action Envelope before any database or API mutation occurs.

Architectural Specification Plates (8)

The Four Interlocking Enterprise Semantic Contract Classes

Contract ClassBoundary GovernedPrimary FormalismVerification TimingFailure Verdict
01 · Data Product ContractSystem-of-Record → Knowledge Graph / Feature StoreJSON Schema + RDF/SHACL + Freshness SLAIngestion & Context CompilationQUARANTINE_STALE_OR_MALFORMED
02 · Event & Handoff ContractCoordinator Agent → Specialist Subagent (A2A)Protobuf / AsyncAPI + DelegationBudgetPre-Handoff BoundaryREJECT_HANDOFF_SCHEMA_DRIFT
03 · Tool Capability ContractLayer 2 ActionProposal → Layer 4 Kinetic APITyped Input/Output + Pre/Postcondition SPARQLPre-Execution & Post-Write CheckBLOCK_PRECONDITION_UNMET
04 · Policy & Authority ContractAuthenticated Actor + Tenant → Target Resource URIOPA (Rego) / AWS Cedar + Graph Relationship CheckLayer 3 Deterministic GateDENY_CONFUSED_DEPUTY_ESCALATION

Executable Architecture & Verification Specification

# Deterministic SHACL Action Gate Contract (Validation Before Action)
ex:AuthorizedIncentivePublishShape a sh:NodeShape ;
  sh:targetClass ex:AgentContentPublicationProposal ;
  sh:property [
    sh:path ex:hasVerifiedVIN ;
    sh:datatype xsd:string ;
    sh:minCount 1 ; sh:maxCount 1 ;
    sh:pattern "^[A-HJ-NPR-Z0-9]{17}$" ;
    sh:message "INVARIANT BLOCK: Proposal must bind to an exact 17-character canonical VIN."
  ] ;
  sh:property [
    sh:path ex:quotedPriceCents ;
    sh:equals ex:graphCanonicalPriceCents ;
    sh:message "ZERO-HALLUCINATION GATE: Quoted price must match canonical GraphDB ledger."
  ] .

Core Architectural Specifications & Treatises (4 Sections)

01The Enterprise Contract Mesh: Four Interlocking Contract Classes

Rather than relying on fragile natural-language prompt instructions ("never offer more than a 15% discount or touch another tenant’s records"), the Enterprise Contract Mesh encodes operational invariants across four machine-enforceable boundaries:

  1. 1 Data Product Contracts governing ingestion freshness and referential integrity into the Knowledge Graph
  2. 2 Event & A2A Handoff Contracts governing multi-agent delegation payloads
  3. 3 Tool Capability Contracts specifying preconditions, postconditions, and idempotency keys
  4. 4 Policy & Authority Contracts governing principal-to-resource permissions.

02Validation Before Action: The 4-Stage Deterministic Interception Pipeline

Every candidate tool call emitted by Layer 2 is treated as an untrusted ActionProposal that must cross a four-stage deterministic gate in Layer 3 before reaching Layer 4 kinetic APIs: Stage 1 validates syntactic and type conformance via JSON Schema/Pydantic; Stage 2 resolves surface strings into canonical enterprise Knowledge Graph URIs; Stage 3 evaluates closed-world W3C SHACL NodeShapes and SPARQL domain invariants against live graph state; and Stage 4 evaluates attribute- and relationship-based access control in Open Policy Agent (Rego) or AWS Cedar.

03Proof-Carrying Action Envelopes & Distributed Transaction Reconciliation

No enterprise database, ERP endpoint, or external webhook accepts a raw model tool call. Layer 4 kinetic executors require a cryptographically signed Proof-Carrying Action Envelope containing the correlation ID, the authenticated Layer 1 ActorContext, the SHA-256 digest of the compiled context slice, the passing SHACL ValidationReport URI, the OPA/Cedar ALLOW decision ID, and an authoritative write-boundary idempotency key. Postcondition verifiers confirm that the downstream mutation actually occurred before reporting success to the agent.

04Formal Abstention Taxonomy & Semantic Compensation Handlers

When a SHACL precondition fails, required bitemporal evidence is stale, or authority is insufficient, the control shell emits a deterministic abstention code (ABSTAIN_KNOWLEDGE_GAP, ABSTAIN_SHACL_VIOLATION, ABSTAIN_POLICY_CEILING) rather than allowing the model to guess or improvise. Furthermore, because long-running agent workflows cannot hold distributed ACID database locks across human approval pauses, every mutating Tool Capability Contract binds to an explicit inverse semantic compensation handler (saga undo).

Probabilistic vs. Deterministic Execution Boundary & Verified Benchmark Ledger

Probabilistic Model & Agent Role

Drafting candidate structured JSON/RDF action proposals from unstructured user intent and contextual telemetry.

Enforced Deterministic Control Gate

Closed-world SHACL NodeShape validation before action execution, cryptographic Proof-Carrying Action Envelopes, and semantic compensation.

Verified Reference Benchmarks & Structural Guarantees
4 Contract ClassesSHACL Validation Before ActionProof-Carrying Envelopes7 Enterprise Platforms
Join the Research Community · Semantic Machinery

Subscribe on Substack & Watch on YouTube

Subscribe to the Semantic Machinery Substack and YouTube channel for practitioner dispatches and visual walkthroughs on enterprise ontologies (L1–L7), SHACL action gates, and production agent control planes.