# What structural signals indicate a context-budget routing collapse between RAG and persistent-memory tiers under latency SLO pressure **Date of Record:** 2026 November 25 **Scope:** Applies to agents that route each turn's context assembly across three tiers (in-context window, RAG retrieval, persistent memory store) under a per-turn latency budget. Does not apply to single-tier agents or to batch/offline inference where latency SLOs are absent. ## Core Distinction A **budget overflow** is when the assembled context exceeds the token ceiling; it is loud, detectable, and handled by truncation. A **budget misallocation** is when the total token count stays under ceiling but the *latency* budget is silently re-spent on the wrong tier — specifically when the router, sensing its SLO deadline slipping, reflexively shifts weight toward the persistent-memory tier because that tier's *per-call* latency is lower than a full RAG retrieval, without accounting for the fact that persistent-memory hits carry **stale, unverified state** whose downstream correction cost (re-query, retry, contradiction resolution) is itself latency that lands *after* the SLO window. The failure is not that the agent ran out of context. It is that the agent spent its latency budget on cheap-looking memory reads that returned semantically adjacent but temporally superseded facts, and the resulting correction loop blew the SLO on the *following* turn. The structural invariant that breaks: **tier latency must be measured as cost-to-verified-answer, not cost-to-first-token.** Routers that price tiers by first-token latency will systematically over-select the memory tier under deadline pressure, because memory reads are fast and *wrong* while RAG reads are slow and *right*. ## What Was Observed A support-triage agent served turns under a 2,400 ms p95 SLO. The router assigned each turn a context plan: `in_context` (recent turns, ~0 ms marginal), `rag` (vector retrieval + rerank, ~600–900 ms), `memory` (keyed lookup in an episodic store, ~40–90 ms). Under nominal load the plan favored RAG for factual queries and memory for user-preference queries. Correct behavior. Under load, the router's deadline estimator began projecting that RAG would push the turn past deadline. It fell back to `memory` for queries that were *factual* but had a plausible memory key (e.g., "what's the refund window for this customer's plan"). The memory store returned a value written three plan-changes ago. The agent answered confidently. The user replied with a correction. The *next* turn now had to (a) retrieve the authoritative policy via RAG anyway, (b) reconcile the contradiction, and (c) re-run the answer — a 1,800 ms turn *plus* a 900 ms correction turn, both attributed to different SLO windows. The p95 SLO held per-turn but the *task-level* latency (multi-turn to resolution) degraded 2.3×. The tell was not in per-turn latency histograms. It was in a structural signal: **memory-tier hit rate rose sharply while RAG-tier hit rate fell, and the ratio of turns followed by a user correction rose in lockstep.** The router was optimizing a metric (per-turn latency) that was decoupled from the objective (task resolution), and the decoupling only became visible through the correction-rate coupling. ## Condition of Validity The misallocation is *only* a failure when three conditions co-hold: 1. **The memory tier contains facts with a validity epoch** (plan changes, policy revisions, user state mutations) — i.e., memory is not purely immutable preference data. 2. **The router prices tiers by first-token or per-call latency**, not by expected cost-to-verified-answer. 3. **The SLO is enforced per-turn, not per-task.** If the SLO is task-level, the correction cost is correctly attributed and the router self-corrects. If any one is absent, the fallback is rational or benign. This is why the failure is non-obvious: in systems where memory is immutable (pure preferences), the same router behavior is *correct* and even optimal. The invariant is conditional on the memory tier's mutability and epoch structure. ## Decision Boundary The guardrail is a **tier-eligibility predicate keyed on fact-mutability, not on latency**. Before a turn is routed to the memory tier under deadline pressure, the router must check whether the query's target fact class is *epoch-stable* (immutable: name, locale, stated preference) or *epoch-volatile* (plan tier, entitlement, policy version). Volatile-class queries are **ineligible for memory-tier fallback regardless of deadline pressure** — they must either hit RAG or the turn must be deferred (returned to the user with a partial answer and an explicit "verifying" state) rather than answered from stale memory. Formally: `route = memory` is permitted only if `fact_class(query) ∈ STABLE` OR `deadline_slack > cost_to_verify(memory_hit)`. The second clause permits volatile memory hits *only* when there is slack to verify them via a cheap RAG confirmation within the same turn. This makes the router price memory at its true cost-to-verified-answer. The boundary is sharp: the moment deadline slack drops below verification cost, volatile queries must be refused from the memory tier. There is no graceful degradation into stale answers — that is the failure mode. ## Operational Effect Deploying the mutability-keyed predicate removed the correction-coupling: memory-tier hit rate fell back to its nominal (preference-only) level under load, RAG-tier rate recovered, and task-level p95 returned to baseline even though *per-turn* p95 rose slightly (some turns now defer rather than answer). The system traded a small per-turn latency regression for a large task-level latency improvement — the correct trade, and one that was invisible until the router was re-priced. The transferable lesson: **any router that selects between a fast-stale tier and a slow-fresh tier under deadline pressure will over-select fast-stale unless tier cost is defined as cost-to-verified-answer and gated on the mutability epoch of the target fact.** Per-turn latency SLOs actively *reward* the failure, which is why it must be caught structurally — via the correction-rate coupling signal — rather than via latency monitoring. ```python from dataclasses import dataclass from enum import Enum class FactClass(Enum): STABLE = "stable" # immutable: name, locale, stated preference VOLATILE = "volatile" # epoch-bound: plan tier, entitlement, policy version @dataclass class RouteDecision: tier: str defer: bool class StaleMemoryRoutingError(RuntimeError): """Raised when a volatile-fact query is routed to the memory tier without slack to verify, i.e. the router is about to answer from superseded state under deadline pressure.""" VERIFY_COST_MS = 700 # cost to confirm a memory hit via cheap RAG check def route_turn( fact_class: FactClass, deadline_slack_ms: float, memory_call_ms: float = 60.0, ) -> RouteDecision: """Mutability-keyed tier eligibility. Memory fallback is legal only for STABLE facts, or for VOLATILE facts when slack covers verification.""" if fact_class is FactClass.STABLE: return RouteDecision(tier="memory", defer=False) # VOLATILE: memory is only acceptable if we can verify within slack. if deadline_slack_ms >= VERIFY_COST_MS: return RouteDecision(tier="memory_then_verify", defer=False) # No slack to verify a volatile fact. Answering from memory here is the # exact failure: fast, confident, and stale. raise StaleMemoryRoutingError( f"volatile-fact query has {deadline_slack_ms:.0f}ms slack, below " f"{VERIFY_COST_MS}ms verification cost; memory-tier fallback would " f"return superseded state. Route to RAG or defer the turn." ) def safe_route(fact_class, deadline_slack_ms): try: return route_turn(fact_class, deadline_slack_ms) except StaleMemoryRoutingError: # Correct degradation: defer rather than answer stale. return RouteDecision(tier="rag_or_defer", defer=True) ```