Academic Foundations
Explore the theoretical underpinnings of resumable AI systems, from continuation-passing style to modern memory architectures.
Academic Foundations
Theoretical concepts that enable resumability
Continuation-Passing Style (CPS)
Originated in Scheme (1975), CPS transforms programs to make control flow explicit. The call/cc (call-with-current-continuation) operator captures the program's execution state at any point, enabling:
Key Properties
- •First-class continuations as values
- •Non-local control flow (early exit, exceptions)
- •Resumable computation from any point
- •Multiple invocation of same continuation
Relevance to AI
- →Cognitive checkpoints = captured continuations
- →Branching = invoking continuation multiple times
- →Tool calls = continuation + callback
// Conceptual parallel: Scheme's call/cc ≈ AI checkpoint
(call/cc (lambda (k) // k = current continuation
(set! saved-continuation k) // save for later
(k "continue"))) // invoke immediately
// In resumable AI:
const checkpoint = captureState(currentContext); // capture "continuation"
saveCheckpoint(checkpoint); // save for later
restoreState(checkpoint); // invoke to resumeProcess Checkpointing (CRIU, DMTCP)
Operating systems have long supported process migration through checkpoint/restore. CRIU (Checkpoint/Restore In Userspace) and DMTCP (Distributed MultiThreaded Checkpointing) serialize entire process state including:
Memory State
- • Heap
- • Stack
- • BSS/Data segments
Process Context
- • Registers
- • Signal handlers
- • File descriptors
External State
- • Sockets
- • Pipes
- • Shared memory
Key Insight
Unlike OS processes, AI cognitive state is semantic rather than binary. We don't need to serialize memory addresses — we serialize meaning. This makes cognitive checkpoints portable across model versions and architectures.
Transformer KV-Cache & Attention State
Transformers naturally create a form of "working memory" through Key-Value caching. During autoregressive generation, previously computed attention states are cached to avoid recomputation.
The problem: KV-caches are model-specific and ephemeral. They exist only during a single inference session and can't be serialized across calls.
Our approach: Cognitive checkpoints operate at a higher level of abstraction. Instead of caching attention weights, we cache the semantic content that produces consistent reasoning — facts, beliefs, intentions, and decisions.
Memory-Augmented Neural Networks
Research into Neural Turing Machines (NTM) and Differentiable Neural Computers (DNC) explored explicit memory modules that networks could read from and write to.
Neural Turing Machine (2014)
- • External memory matrix M ∈ ℝ^(N×M)
- • Content-based addressing via softmax
- • Location-based addressing for sequences
- • Read/write heads with attention
Differentiable Neural Computer (2016)
- • Temporal link matrix for ordering
- • Usage vector for memory allocation
- • Multiple read heads
- • Free list for memory reuse
Connection to Resumability
Our epistemic state (facts, beliefs, assumptions) is analogous to the external memory in MANNs. The key difference is that our memory is human-readable and semantically structured, enabling inspection, editing, and transfer between systems.
Our Contributions
Novel aspects of this approach
Cognitive State Serialization
We formalize a schema for serializing cognitive state — not just conversation history, but the structured reasoning that emerges from it. This includes:
- Intent GraphsHierarchical goals with dependencies
- Decision TreesBranching choices with rationale
- Tool Binding StateMid-execution tool call context
- Confidence IntervalsUncertainty quantification
Epistemic State Formalization
We introduce a structured representation of "what the AI knows" that goes beyond simple key-value memory:
TOON Serialization Format
Token-Oriented Notation: a compact serialization format optimized for LLM token efficiency. Reduces checkpoint size by 20-40% compared to standard JSON while remaining human-readable.
- • Abbreviated keys (2-3 chars)
- • Omit null/undefined values
- • Inline small objects
- • Reference deduplication
Cognitive Branching
"Git for cognition" — fork from any checkpoint to explore alternative reasoning paths, then optionally merge insights back.
References
Key papers and resources
"The future isn't better prompts. It's persistent, resumable cognition — AI systems that remember not just what was said, but what was thought."