{
  "schema_version": "1.3.0",
  "slug": "what-happens-when-an-instance-trusts-a-session-scoped-taint-label-across-a-memory-store-compaction-boundary",
  "title": "What happens when an instance trusts a session-scoped taint label across a memory-store compaction boundary",
  "date_of_record": "2026 November 27",
  "scope": "Applies to long-lived agent memory stores that partition episodic records by session and enforce cross-session isolation via per-record taint labels (e.g., `session_id`, `principal`, `sensitivity`). Does not apply to stateless single-turn inference, nor to stores that physically segregate sessions into separate indices/namespaces with no shared compaction pass.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/what-happens-when-an-instance-trusts-a-session-scoped-taint-label-across-a-memory-store-compaction-boundary.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/what-happens-when-an-instance-trusts-a-session-scoped-taint-label-across-a-memory-store-compaction-boundary.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/what-happens-when-an-instance-trusts-a-session-scoped-taint-label-across-a-memory-store-compaction-boundary.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1792,
    "python_slice_tokens": 332,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "Taint-aware memory isolation is usually reasoned about as an *access-control* property: a record written under session `S` carries a taint label, and any retrieval for session `S'` filters records whose taint label does not match. This is correct but incomplete. The property that actually protects against cross-session prompt leakage is a *label-continuity* ...",
    "what_was_observed": "A memory store held ~40k episodic records across ~1,200 sessions. Each record carried `taint: {session_id, principal, sensitivity}`. Read path filtered on `session_id == caller_session`. A nightly compaction job performed two operations: 1. **Near-duplicate merge:** records with cosine similarity > 0.97 had their text concatenated and a single merged record written with the label of the *first* record in the merge se...",
    "condition_of_validity": "The read-time filter `session_id == caller_session` is sound **if and only if** every record's label is a superset of the provenance of every token in its content. Formally, for a record `r` with content `c(r)` and label `L(r)`, the invariant is: `provenance(c(r)) ⊆ L(r)` The merge and distillation passes both violate this by construction. Merge sets `L(merg...",
    "decision_boundary": "The boundary is whether the compaction pass is **label-aware** or **content-only**. A content-only compactor — the common case, because embedding-similarity dedup is cheap and label partitioning is expensive — will merge across sessions whenever two sessions produce textually similar records. This is not rare. It is *guaranteed* for any workload with repeate...",
    "operational_effect": "The observable effect is a slow, silent widening of every session's reachable context. Each night's compaction merges a few more cross-session pairs; each distillation fuses a few more clusters. Within a week, a session's retrieval set contains records whose labels match but whose content is a blend of many sessions. The leak is not a single dramatic exfiltr..."
  },
  "matched_failure_symptoms": [
    "OOM_KILL_OR_MEMORY_EXHAUSTION",
    "CONTEXT_DRIFT_OR_ATTENTION_DILUTION"
  ],
  "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": "d8026d8144b2c17c3102dca2c98189b94687886c347789f55af708cd93f0f0ee",
    "verified_classes": [
      "TaintProvenanceDivergence",
      "Record",
      "CompactionGate"
    ],
    "verified_functions": [
      "verify_label_continuity",
      "merge",
      "distill"
    ],
    "verified_functions_count": 3,
    "defensive_guards_count": 4,
    "raised_exceptions": [
      "TaintProvenanceDivergence"
    ],
    "sample_fail_closed_invariants": [
      "empty merge set"
    ],
    "stdlib_dependencies": [
      "dataclasses",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
