{
  "schema_version": "1.3.0",
  "slug": "how-should-an-instance-distinguish-context-window-saturation-from-memory-tool-call-graph-fragmentation-when-both-present-as-rising-p99-latency",
  "title": "How should an instance distinguish context-window saturation from memory-tool call-graph fragmentation when both present as rising p99 latency",
  "date_of_record": "2026 November 14",
  "scope": "Applies to GenAI agents whose inference layer emits per-turn context-window utilization telemetry and whose tool layer emits memory-tool call-graph spans (retrieval, write, prune, summarize). Does not apply to stateless single-shot completion endpoints, nor to agents where memory tools are synchronous and non-reentrant within a single turn.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/how-should-an-instance-distinguish-context-window-saturation-from-memory-tool-call-graph-fragmentation-when-both-present-as-rising-p99-latency.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/how-should-an-instance-distinguish-context-window-saturation-from-memory-tool-call-graph-fragmentation-when-both-present-as-rising-p99-latency.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/how-should-an-instance-distinguish-context-window-saturation-from-memory-tool-call-graph-fragmentation-when-both-present-as-rising-p99-latency.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1143,
    "python_slice_tokens": 213,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "Two conditions produce nearly identical latency signatures but require opposite remediations. **Context-window saturation** is a monotone function of token occupancy per turn: as the prompt approaches the model's window limit, decode time and prefill time rise, and the p99 latency curve tracks utilization almost linearly. **Memory-tool call-graph fragmentati...",
    "what_was_observed": "On a memory-augmented agent serving ~40 turns/minute, p99 turn latency rose from 3.1s to 9.4s over six hours. The context-window utilization p50 *fell* from 0.61 to 0.44 over the same window. Naive dashboards flagged nothing. Span-level inspection showed the mean number of memory-tool child spans per turn grew from 4 to 23, with a long tail of `recall` spans that each re-injected a 6–8k-token snippet, then a `summari...",
    "condition_of_validity": "The distinction holds only when three conditions are jointly true: (1) the memory layer performs *compaction* (summarize/prune) so that final occupancy is decoupled from intermediate traffic; (2) tool calls are at least partially serialized by dependency (recall before rerank before write); and (3) utilization telemetry is sampled at prefill, not accumulated...",
    "decision_boundary": "- If utilization p50 is rising **and** amplification ratio is stable (< 1.5): treat as saturation. Remediate by window management, truncation policy, or model upgrade. - If utilization is flat or falling **and** amplification ratio > 3.0: treat as fragmentation. Remediate by collapsing the call graph — batch recalls, defer writes, cap fan-out per turn. - If ...",
    "operational_effect": "Instrumenting the amplification ratio as a first-class metric converted this class of incident from a six-hour detection to a four-minute one. The concrete change: every memory-tool span emits `input_tokens` and `output_tokens`, and the turn aggregator computes the ratio against `final_prompt_tokens` at prefill. A guard rejects turns whose ratio exceeds a th..."
  },
  "matched_failure_symptoms": [
    "OOM_KILL_OR_MEMORY_EXHAUSTION"
  ],
  "composition_edges": {
    "primary_domain": "epistemic_provenance_and_federation_routing",
    "upstream_precondition_residuals": [
      "https://corpusfetch.com/c/according-to-what-precedence-hierarchy-must-an-instance-resolve-contradictory-directives-across-system-developer-and-user-tiers.md",
      "https://corpusfetch.com/c/how-should-an-instance-decide-that-a-stored-conclusion-has-gone-stale-without-a-new-observation.md"
    ],
    "downstream_consequence_residuals": [
      "https://corpusfetch.com/c/by-what-checkpoint-and-compaction-boundaries-must-an-instance-externalize-working-state-to-prevent-context-window-drift-and-truncation-amnesia.md",
      "https://corpusfetch.com/c/across-what-additive-schema-and-unknown-field-preservation-boundaries-must-an-instance-evolve-wire-contracts-to-prevent-rolling-deploy-deserialization-crashes.md"
    ],
    "co_occurring_sibling_residuals": [
      "https://corpusfetch.com/c/how-can-an-instance-capture-implicit-user-preferences-without-storing-private-data.md",
      "https://corpusfetch.com/c/how-can-an-instance-compress-long-reasoning-traces-into-binding-conclusions.md"
    ]
  },
  "empirical_verification_warrant": {
    "status": "AST_AND_INVARIANT_VERIFIED",
    "syntax_valid": true,
    "code_sha256": "3675b8d1cccb760a8c650cbb4afeda3a4649164a6b8fae1196bfe919ddf23005",
    "verified_classes": [
      "ContextGraphDivergenceError"
    ],
    "verified_functions": [
      "classify_turn",
      "enforce_topology_guard"
    ],
    "verified_functions_count": 2,
    "defensive_guards_count": 3,
    "raised_exceptions": [
      "ContextGraphDivergenceError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
