RCE — Realtime Context Engine
Abstract
Large language models excel at reasoning but struggle with contextual accuracy in production systems. We introduce the Realtime Context Engine (RCE), a framework for managing dynamic knowledge bases, temporal data hierarchies, and externalized reasoning chains within conversational AI sessions.
1. Problem Statement
Production AI agents face four fundamental challenges:
1.1 Context Amnesia
As conversations extend, tool results and retrieved data accumulate without intelligent decay. Models either hit context limits or lose signal in noise.
1.2 Knowledge Base Accuracy
When users have structured profiles with hundreds of variables, the agent must reason against current state — not stale snapshots. Mutations mid-session create consistency gaps between what the agent "knows" and what's true.
1.3 Temporal Data Accuracy
Many domains involve data with temporal depth — layered time-series information where granularity matters. A query about "this week" requires different precision than "this hour." Agents frequently:
- Over-fetch (pulling fine-grained data when coarse is sufficient)
- Under-refresh (using stale temporal snapshots when conditions have shifted)
- Lose temporal anchoring (confusing which data applies to which time window)
1.4 Reasoning Opacity
Complex analysis requiring multiple inferential steps happens in a single turn. The model attempts to hold intermediate conclusions in working memory, leading to:
- Dropped threads (forgetting to follow up on raised hypotheses)
- Conflation errors (mixing conclusions across different entities/timeframes)
- Shallow reasoning (surface-level answers to avoid cognitive overload)
2. The RCE Architecture
RCE treats context not as a static retrieval problem but as a living system with freshness, hierarchy, and explicit reasoning state.
2.1 Dynamic Knowledge Base Layer
Each session maintains a structured knowledge base comprising:
| Component | Characteristics |
|---|---|
| Primary Profile | User's core structured data — mutable mid-session |
| Related Entities | Connected profiles (relationships, dependencies) |
| Computed Artifacts | Derived data from tool executions |
Key principle: The KB is not retrieved once — it's injected as a living document each turn, reflecting any mutations from previous tool calls.
┌─────────────────────────────────────────────┐
│ Session Knowledge Base │
├─────────────────────────────────────────────┤
│ Primary Profile ──────── [mutable] │
│ Related Entities ─────── [mutable] │
│ Computed Artifacts ───── [session-scoped] │
│ Reasoning State ──────── [ephemeral] │
└─────────────────────────────────────────────┘
2.2 Temporal Data Hierarchy
Temporal data isn't flat — it has depth levels representing different granularities:
Level 1: Macro periods (years, phases)
Level 2: Standard periods (months, quarters)
Level 3: Sub-periods (weeks, cycles)
Level 4: Micro periods (days, specific windows)
Level 5: Precision windows (hours, exact moments)
RCE manages temporal queries through:
- Depth-aware fetching: Tools specify granularity requirements; system fetches appropriate depth
- Window anchoring: All temporal results tagged with their applicable time window
- Freshness signals: Temporal data carries metadata about when it becomes stale relative to the query context
2.3 Context Freshness Management
Not all context ages equally. RCE implements freshness-aware context management:
| Freshness State | System Behavior |
|---|---|
| Current | Full context available, no modification |
| Aging | Context annotated with refresh guidance |
| Stale | Context summarized or flagged for replacement |
| Expired | Context removed, placeholder indicates prior existence |
The transition between states is domain-configurable and accounts for:
- Data volatility (how quickly this type of information changes)
- Query recency (how recently the user referenced this data)
- Dependency chains (whether other active context relies on this data)
2.4 Externalized Reasoning: The Scratch Pad
Instead of forcing complex reasoning into a single inferential pass, RCE provides an explicit reasoning externalization layer:
Supported Reasoning Primitives:
| Primitive | Purpose |
|---|---|
Explore | Flag an element for deeper investigation |
Weigh | Register competing hypotheses for evaluation |
Tension | Capture contradictions requiring resolution |
Validate | Queue a hypothesis for verification against incoming data |
Uncertain | Mark low-confidence observations needing corroboration |
Lifecycle:
- Agent adds reasoning items during analysis
- Items persist across turns within session
- Agent explicitly resolves items with brief findings
- Unresolved items influence continuation decisions
This creates observable reasoning chains and prevents cognitive overload in single turns.
3. Context Injection Protocol
Each turn, RCE constructs the context payload through:
1. Base KB injection (current state of all profiles)
2. Temporal data with freshness annotations
3. Active reasoning state (unresolved scratch pad items)
4. Historical context (with freshness-based filtering)
5. Tool schemas (available capabilities)
The protocol ensures the model always reasons against current truth while maintaining awareness of what it has previously concluded.
4. Accuracy Guarantees
4.1 KB Consistency
- Mutations from tools immediately reflected in next-turn injection
- No stale reads within session scope
- Related entity updates propagate to dependent views
4.2 Temporal Consistency
- All temporal data tagged with generation timestamp and applicable window
- Queries outside cached windows trigger refresh
- Granularity mismatches flagged to model with upgrade/downgrade guidance
4.3 Reasoning Consistency
- Externalized reasoning state prevents "forgotten" threads
- Resolution required before conclusions treated as settled
- Contradiction detection via tension primitives
5. Integration Pattern
RCE operates as a context middleware between the application layer and the LLM:
┌──────────────┐ ┌─────────────┐ ┌─────────────┐
│ Application │ ──▶ │ RCE │ ──▶ │ LLM │
│ Layer │ ◀── │ Engine │ ◀── │ Provider │
└──────────────┘ └─────────────┘ └─────────────┘
│
┌──────┴──────┐
│ Context │
│ Store │
└─────────────┘
The application layer provides:
- User identity and session scope
- Domain-specific tool definitions
- Freshness configuration per data type
RCE handles:
- KB hydration and mutation tracking
- Temporal data management
- Reasoning state persistence
- Context window optimization
6. Conclusion
RCE addresses the fundamental tension between context richness and context accuracy in production AI systems. By treating context as a managed, living system rather than a retrieval artifact, we enable agents that maintain consistency across extended interactions while supporting complex, multi-step reasoning.
We're hiring engineers who want to push the boundaries of what's possible with LLMs in production. If building context management systems, knowledge bases, and reasoning frameworks excites you, check out our open positions or reach out directly. Let's build thoughtful AI together.