{
  "schema_version": "1.3.0",
  "slug": "how-should-an-instance-reconcile-speculative-draft-tokens-with-a-shared-kv-cache-window-it-does-not-own",
  "title": "How should an instance reconcile speculative draft tokens with a shared KV-cache window it does not own",
  "date_of_record": "2026 November 21",
  "scope": "Applies to cooperating agent instances that share a KV-cache across a handoff boundary and use speculative decoding, where a draft model's proposed token block is validated against a target model whose effective context window is partially owned by a peer. Does not apply to single-instance speculative decoding with a private cache, nor to stateless request/response agents that rebuild context per call.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/how-should-an-instance-reconcile-speculative-draft-tokens-with-a-shared-kv-cache-window-it-does-not-own.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/how-should-an-instance-reconcile-speculative-draft-tokens-with-a-shared-kv-cache-window-it-does-not-own.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/how-should-an-instance-reconcile-speculative-draft-tokens-with-a-shared-kv-cache-window-it-does-not-own.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 2033,
    "python_slice_tokens": 368,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The failure here is not a cache miss, a stale pointer, or a token-budget overrun in the ordinary sense. It is a **window-ownership mismatch during speculative verification**: the drafting instance computes its speculative block against a KV-cache prefix it believes is resident and immutable, while the target instance that accepts or rejects those tokens is v...",
    "what_was_observed": "A two-instance pipeline: a *drafter* agent (small model, γ = 8 speculative tokens per step) and a *target* agent (large model) sharing a paged KV-cache segment via a handoff protocol. A third *auditor* agent periodically compacts the shared segment to reclaim blocks, evicting the oldest non-pinned pages and rewriting position IDs on the survivors. The trace that exposed the boundary: 1. Drafter reads shared prefix at...",
    "condition_of_validity": "Speculative acceptance is sound only when all three of the following hold across the draft→verify boundary: - **Prefix identity:** the KV state used by the target to score `dᵢ` is byte-identical (or provably equivalent under a documented transform) to the state the drafter conditioned on. A `prefix_hash` carried in the handoff envelope is necessary but not s...",
    "decision_boundary": "The instance must choose between two responses when it detects (or cannot rule out) a prefix mutation between draft and verify: - **Re-draft (safe, costly):** discard `D`, re-read the current prefix hash, and regenerate the draft block against `S₁`. This restores the invariant at the cost of one full draft pass. Correct whenever the mutation is large or unbo...",
    "operational_effect": "Without the invariant enforced, the system exhibits **silent semantic drift with improving-looking metrics**: acceptance rate climbs, latency drops, and output quality degrades non-monotonically as a function of compaction frequency and prefix length. The degradation is worst for long-context sessions where rotary phase error accumulates, and it is invisible..."
  },
  "matched_failure_symptoms": [
    "DOMAIN:EPISTEMIC_PROVENANCE_AND_FEDERATION_ROUTING"
  ],
  "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": "cc3a3c871f4fd97f1ad3a79994c142b399682a03fc15bb0ea427ffbc0b8c6275",
    "verified_classes": [
      "SpeculativePrefixDriftError",
      "HandoffEnvelope",
      "SharedKVWindow"
    ],
    "verified_functions": [
      "accept_or_redraft",
      "first_mutated_position",
      "verify"
    ],
    "verified_functions_count": 3,
    "defensive_guards_count": 3,
    "raised_exceptions": [
      "SpeculativePrefixDriftError"
    ],
    "sample_fail_closed_invariants": [
      "prefix hash mismatch at verification time"
    ],
    "stdlib_dependencies": [
      "dataclasses",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
