Context IR and Compiler Passes for Enterprise AI
Description
Enterprise AI systems depend on external context, yet the dominant paradigm remains retrieval-augmented prompt stuffing: retrieve candidates, pack them into a prompt, and hope the model reasons correctly. We argue that this pipeline is structurally underpowered. The correct abstraction is compiled context: a structured, transformed, and constrained semantic artifact produced through staged lowering from heterogeneous source evidence.
This paper introduces a four-level Context Intermediate Representation (Context IR) spanning Source IR, Semantic IR, Task IR, and Execution IR, and defines a taxonomy of six compiler pass categories that transform context through canonicalization, semantic enrichment, relevance conditioning, governance enforcement, compression, and execution shaping. It formalizes context graph breaks as points where optimization-critical structure is lost, proposes policy-as-a-type-system to make governance intrinsic to compilation, and specifies a Context ABI for portability across models, agents, tools, and sessions.
This is Part 1 of the Context Compilation Trilogy, defining the representation and semantics layer for enterprise AI context systems.