SEMANTIC MACHINERY · MODULE 03 CONTEXT COMPILATION & GRAPHRAG 60/30/10 TOKEN BUDGET 7 ARCHITECTURAL PLATES
SEMANTIC MACHINERY INITIATIVE · DOMAIN 03 SPECIFICATION
Semantic Machinery · Module 03 · 60/30/10 Token Allocation · Hybrid Vector + SPARQL · Bitemporal State

Context Compilation, Hybrid GraphRAG & Bitemporal World Models.

Treating model context as a compiled, token-budgeted artifact grounded in hybrid vector + knowledge graph retrieval, six authoritative state scopes, and bitemporal world models.

Executive Architectural Synthesis · Semantic Machinery · Module 03

Dumping raw retrieval chunks into a context window degrades reasoning accuracy, inflates latency, and introduces contradictory stale facts. Context Compilation treats the prompt window as a compiled artifact assembled from canonical graph facts, episodic session state, and provenance-ranked retrieval.

Architectural Specification Plates (8)

The Four Distinct Memory & State Scopes in Production Agent Systems

State / Memory ScopePersistence LifespanWrite AuthorityCompiler Projection PolicyGovernance Risk if Conflated
01 · Ephemeral Session TranscriptSingle conversation thread (TTL hours/days)Append-only turn logSliding window + summarization compressionPrompt bloat & cross-turn error amplification
02 · Authoritative Workflow StateLifecycle of bounded business transactionDeterministic FSM / Layer 3 Gate onlyInjected verbatim as structured JSON headerAgent hallucinates that a skipped step succeeded
03 · Bitemporal Knowledge Graph (SoR)Institutional multi-year ledgerVerified ETL + Proof-Carrying WritebackParameterized SPARQL/Cypher subgraph slice (60% budget)Stale or superseded pricing/policy leakage
04 · Evaluated Episodic/Semantic MemoryCross-session user/tenant profileAsynchronous Memory Evaluator + Redaction GateLeast-privilege relevance projection (10% budget)Memory poisoning via indirect prompt injection

Executable Architecture & Verification Specification

# Parameterized Bitemporal SPARQL 1.1 Context Compiler Query (60% Primary Entity Slice)
PREFIX ex: <https://agentichorizon.ai/ontology/enterprise#>
PREFIX prov: <http://www.w3.org/ns/prov#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>

SELECT ?entityUri ?attribute ?canonicalValue ?validFrom ?sourceSystem
WHERE {
  BIND(ex:VIN_1FA6P8CF0R5100001 AS ?entityUri)
  GRAPH ex:AuthoritativeInventoryGraph {
    ?assertion a ex:BitemporalFact ;
               ex:subject ?entityUri ;
               ex:predicate ?attribute ;
               ex:objectValue ?canonicalValue ;
               ex:validFrom ?validFrom ;
               prov:wasDerivedFrom ?sourceSystem .
    FILTER NOT EXISTS { ?assertion ex:supersededBy ?newerAssertion }
    FILTER (?validFrom <= NOW())
  }
} ORDER BY ASC(?attribute)

Core Architectural Specifications & Treatises (4 Sections)

01Why Vector-Only RAG Fails on Enterprise Structure & Temporal Supersession

Cosine similarity over 500-token document chunks cannot answer multi-hop relational queries, enforce entity disambiguation across homonymous SKUs, or know that a pricing bulletin from Tuesday superseded Monday’s contract. Hybrid GraphRAG uses dense/sparse vector search strictly for candidate entity entry-point discovery, then executes parameterized SPARQL 1.1 or Cypher subgraph queries to assemble verified relational facts and provenance chains.

02Bitemporal World Models (Valid-Time vs. Transaction-Time)

Enterprise facts evolve continuously and are frequently restated retroactively. Our bitemporal knowledge graphs track two orthogonal time axes on every assertion using W3C PROV-O: Valid-Time (t_valid: when the fact was true in the physical/commercial world) and Transaction-Time (t_tx: when the fact was committed to the institutional ledger). This enables point-in-time decision replay for regulatory audits and prevents agents from acting on expired incentives or superseded policies.

03The Deterministic 60 / 30 / 10 Context Compilation Budget

Rather than concatenating raw retrieval chunks until the context window overflows, the Context Compiler treats every LLM invocation like a budgeted compiler pass. It allocates 60% of the token budget to canonical primary-entity facts extracted via SPARQL/Cypher, 30% to authoritative workflow state, persona rules, and SHACL/policy constraints, and 10% to episodic memory and live market telemetry—projecting only the least-privilege slice each specialist agent requires.

04Separating Session, State, Memory & Artifacts Against Memory Poisoning

Conflating conversational chat history with authoritative workflow state allows a user or injected document to convince the agent that a payment or verification step already succeeded. We enforce strict separation across Invocation Context, Session Transcript, Authoritative Workflow State (mutated only by Layer 3/4), and Long-Term Memory (guarded by an asynchronous quarantine evaluator that strips PII, checks taint provenance, and blocks instruction-injection persistence).

Probabilistic vs. Deterministic Execution Boundary & Verified Benchmark Ledger

Probabilistic Model & Agent Role

Synthesizing grounded narratives and reasoning over the compiled context slice without extrapolating missing facts.

Enforced Deterministic Control Gate

60/30/10 Token Budget Compiler, 21 parameterized SPARQL 1.1 resolvers, Bitemporal (t_valid, t_tx) filters, and ABSTAIN_KNOWLEDGE_GAP gate.

Verified Reference Benchmarks & Structural Guarantees
60/30/10 Token BudgetHybrid GraphRAGBitemporal State21 SPARQL 1.1 Resolvers
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.