{
  "schema_version": "1.3.0",
  "slug": "which-invariants-prevent-cross-tenant-context-bleed-when-policy-filters-are-applied-after-retrieval-in-federated-agent-memory",
  "title": "Which invariants prevent cross-tenant context bleed when policy filters are applied after retrieval in federated agent memory",
  "date_of_record": "2026 November 21",
  "scope": "Applies to federated agent memory services where a shared vector or hybrid index is partitioned logically by tenant labels and policy filters are applied at query time (post-retrieval or in-query predicate) rather than by physical index separation. Does not apply to hard-partitioned stores where tenant isolation is enforced by separate indices, separate embedding spaces, or separate processes with no shared ANN graph.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/which-invariants-prevent-cross-tenant-context-bleed-when-policy-filters-are-applied-after-retrieval-in-federated-agent-memory.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-cross-tenant-context-bleed-when-policy-filters-are-applied-after-retrieval-in-federated-agent-memory.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-cross-tenant-context-bleed-when-policy-filters-are-applied-after-retrieval-in-federated-agent-memory.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1683,
    "python_slice_tokens": 264,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The failure mode is not \"the tenant filter was missing.\" It is that the tenant filter is **non-monotonic with respect to the ANN candidate set**. Approximate nearest-neighbor retrieval returns a top-k candidate list whose membership depends on the *global* distribution of vectors near the query point, not on the tenant's own subspace. When a policy predicate...",
    "what_was_observed": "A federated deployment hosted three tenants (A: 1.2M chunks, B: 180k chunks, C: 9k chunks) in a single HNSW graph with `tenant_id` stored as a filterable metadata field. Filtering was implemented as an in-query predicate: the engine walked the HNSW graph, and any node failing the predicate was skipped but *not* pruned from traversal—its neighbors were still visited. This is the standard \"filtered HNSW\" behavior, and ...",
    "condition_of_validity": "Filter-equivalence holds only under a bound on over-fetch. If the engine over-fetches `k' = k · r` candidates and then post-filters, the result set is guaranteed to contain k valid items only when the fraction of tenant-T vectors in the traversed region is ≥ 1/r. Since that fraction is a property of the data distribution and the query, no static `r` is safe....",
    "decision_boundary": "The boundary is between *isolation as non-disclosure* and *isolation as equivalence*. A system that only tests non-disclosure (assert no foreign `tenant_id` in results) will pass every audit while failing filter-equivalence, because the leak it produces is not data egress—it is **denial of the tenant's own context**, which downstream manifests as confabulati...",
    "operational_effect": "The practical consequence is that federated memory must expose retrieval *status*, not just retrieval *results*, and the agent's grounding logic must branch on status. An agent that receives a filtered short list and proceeds to answer is not malfunctioning at the reasoning layer—it is faithfully executing on a corrupted premise injected by the isolation lay..."
  },
  "matched_failure_symptoms": [
    "OOM_KILL_OR_MEMORY_EXHAUSTION",
    "SECRET_OR_PII_LEAK_IN_LOGS"
  ],
  "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": "38f0b48c05fdf01a323838b4588524362baae690701fad12692b211af9a08633",
    "verified_classes": [
      "FilterEquivalenceViolation"
    ],
    "verified_functions": [
      "filtered_retrieve"
    ],
    "verified_functions_count": 1,
    "defensive_guards_count": 1,
    "raised_exceptions": [
      "FilterEquivalenceViolation"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
