Toward a Theory of Context Compilation for Human-AI Systems
Description
Large language model systems increasingly depend on external context, yet current approaches remain fragmented across retrieval-augmented generation, memory architectures, long-context prompting, and interface-specific prompt assembly.
We propose Context Compilation Theory as a unifying framework and introduce Context Intermediate Representation (Context IR) as the portable internal object that mediates between raw context sources and runtime-specific execution. In this view, context is not merely retrieved or remembered; it is selected, transformed, governed, optimized, and lowered into executable context packs for downstream models, agents, and interfaces.
This paper contributes a constrained-optimization formulation for context compilation, a taxonomy spanning adjacent paradigms, a reference architecture separating source, substrate, compiler, IR, lowering, and runtime layers, a portable Context IR schema with worked example artifacts, and CompileBench as a benchmark specification focused on compilation quality rather than recall alone.
MemoryOS is positioned as a partial reference implementation of this architecture, and the broader claim is that future AI systems will require a portable, inspectable, and governable context layer to preserve continuity of cognition across changing data, models, and experiences.
Notes
Files
Context_Compilation_Paper_Letort_2026.pdf
Additional details
Identifiers
Related works
- Is supplemented by
- Software: https://github.com/Brianletort/MemoryOS (URL)