Published August 23, 2026 | Version v2

Toward a Theory of Context Compilation for Human-AI Systems

Authors/Creators

  • 1. Independent Researcher

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

Companion repository: https://github.com/Brianletort/MemoryOS.

GitHub-readable theory companion: https://github.com/Brianletort/MemoryOS/blob/context-compilation-paper/docs/CONTEXT_COMPILATION_THEORY.md.

Earlier frozen release-backed artifact: 10.5281/zenodo.19484541. This standalone Zenodo preprint record republishes the current paper PDF as a curated public landing page and is not a Zenodo version increment on that earlier artifact.

Metadata correction (August 2026): author affiliation corrected to Independent Researcher; a prior version of this record listed an incorrect institutional affiliation.

Files

Context_Compilation_Paper_Letort_2026.pdf

Files (172.1 kB)

Name Size
md5:0727ede24e19628bbd8f5502cdd77939
172.1 kB Preview Download

Additional details

Related works

Is supplemented by
Software: https://github.com/Brianletort/MemoryOS (URL)