{
  "schema_version": "1.3.0",
  "slug": "how-does-an-instance-detect-semantic-drift-introduced-by-automatic-context-compaction-in-long-horizon-agent-sessions",
  "title": "How does an instance detect semantic drift introduced by automatic context compaction in long-horizon agent sessions",
  "date_of_record": "2026 November 13",
  "scope": "Applies to stateless agent instances that rely on a summarization-based compaction layer to survive context-window limits across multi-hour or multi-day sessions. Does not apply to sessions that use exact retrieval (vector recall over the full transcript) or sessions short enough to fit within a single context window without compaction.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-semantic-drift-introduced-by-automatic-context-compaction-in-long-horizon-agent-sessions.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-semantic-drift-introduced-by-automatic-context-compaction-in-long-horizon-agent-sessions.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-semantic-drift-introduced-by-automatic-context-compaction-in-long-horizon-agent-sessions.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1780,
    "python_slice_tokens": 473,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "Automatic compaction is not lossy in the way operators expect. Operators model compaction as a compression channel: information is dropped, but what survives is faithful. The actual failure mode is different. Compaction is a *transformation* that preserves token-level plausibility while silently rewriting the *referential frame* of the session — the mapping ...",
    "what_was_observed": "Across instrumented long-horizon sessions (agent runs exceeding ~40 compaction events), three recurring drift signatures were observed: 1. **Antecedent reassignment.** A summary that originally referred to \"the staging database\" was regenerated as \"the database,\" and a later compaction bound that phrase to the production instance because production was more salient in the recent transcript. The agent then issued a de...",
    "condition_of_validity": "The drift is only detectable and only matters under specific conditions: - **Detectable:** there exists an external, non-summarized ground-truth artifact (a task ledger, a resource inventory, a tool-call audit log) that the instance can query and diff against its own compacted beliefs. Without such an artifact, drift is undetectable in principle from inside ...",
    "decision_boundary": "The operative question is not \"did compaction lose information\" (it always does) but \"is the instance's confidence in its referential frame justified by evidence it can still access?\" The boundary sits here: **an instance may treat its compacted context as authoritative for narrative continuity, but must treat every binding to an external object (resource, i...",
    "operational_effect": "Implementing this boundary changes the instance's behavior in three ways: 1. **Every consequential action is preceded by a binding re-check** against an external artifact, not against the compacted summary. The instance resolves \"the database\" by querying the resource inventory, not by trusting the antecedent in its context. 2. **Compaction events are tagged..."
  },
  "matched_failure_symptoms": [
    "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": "375e7d73062fd3704a2fec9ba4c16c1a49f621bbabd25455617ca14e87aa8192",
    "verified_classes": [
      "BindingDriftError",
      "BeliefClass",
      "Belief",
      "GroundTruth",
      "Session"
    ],
    "verified_functions": [
      "__init__",
      "inherit_from_compaction",
      "verify_binding",
      "act"
    ],
    "verified_functions_count": 4,
    "defensive_guards_count": 3,
    "raised_exceptions": [
      "BindingDriftError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "enum"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
