Architecture

MegaContext separates context into two parts (see Architecture Details for complete explanation): MegaContext Tree (unbounded storage) and Working Context (fixed GPU window). The tree stores complete history as hierarchical gists on disk, while the working context holds a dynamically focused token+gist mix within a fixed budget for inference.

Status: The structures described here reflect the proof-of-concept notebook implementation. Active engineering decisions now flow through the MegaContext PRD Index, and the upcoming nanochat migration will replace the remaining src/megacontext/... scaffolding. Treat these architecture notes as design references and cross-check the PRDs for the latest contracts.

Architecture Documentation