{
  "schema_version": "1.3.0",
  "slug": "which-invariants-prevent-lossy-auto-compaction-from-silently-corrupting-an-agent-s-working-set",
  "title": "Which invariants prevent lossy auto-compaction from silently corrupting an agent's working set",
  "date_of_record": "2026 November 19",
  "scope": "Applies to long-horizon agents that trigger automatic context compaction (summarization, eviction, or reconstruction) when the token budget crosses a threshold. Does not apply to stateless single-turn inference or to agents whose entire working set fits within one context window for the full task lifetime.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/which-invariants-prevent-lossy-auto-compaction-from-silently-corrupting-an-agent-s-working-set.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-lossy-auto-compaction-from-silently-corrupting-an-agent-s-working-set.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-lossy-auto-compaction-from-silently-corrupting-an-agent-s-working-set.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1537,
    "python_slice_tokens": 224,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The failure is not \"the summary was bad.\" It is that **compaction is treated as a lossy transform of text when it is actually a lossless transform of a set of referents the agent will later dereference.** An agent's context is not prose; it is a live heap containing (a) committed facts, (b) tool-output artifacts referenced by ID, (c) unresolved obligations (...",
    "what_was_observed": "A research agent running a 40-step task crossed an 80% context threshold at step 22 and triggered auto-compaction. The compactor summarized the transcript into ~1,800 tokens. Three specific losses were later reconstructed from the full trace: 1. **Negation collapse.** At step 9 the agent had verified that endpoint `/v2/export` does *not* accept a `format` parameter (it 400s). The summary rendered this as \"explored ex...",
    "condition_of_validity": "The failure only manifests when **all** of the following hold: - Compaction is triggered by a *budget threshold* rather than by task-phase boundaries, so it fires mid-obligation. - The agent's downstream behavior depends on **dereferencing** context content (tool IDs, negations, open obligations), not merely on topic continuity. - The compactor is a generati...",
    "decision_boundary": "The boundary is not \"summarize vs. don't.\" It is **which content class is permitted to pass through a lossy channel.** Partition the context into: - **Narrative** (exploration, reasoning traces, dead ends): lossy compaction permitted, no fidelity requirement. - **Referents** (artifact IDs, file paths, URLs, tool names + argument schemas): must be **carried v...",
    "operational_effect": "When the invariant is enforced — referents carried verbatim, negations structured, obligations ledgered — compaction becomes safe and the fidelity metric becomes meaningful again, because it is now measured *against the referent set* rather than against the prose. Reconstruction fidelity must be redefined as a **referent recall score**: fraction of pre-compa..."
  },
  "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": "736de88ae65a6cd296068ef03bd7957bda490490dd6901bb9f0a27dd667daf9e",
    "verified_classes": [
      "CompactionIntegrityError",
      "Referent",
      "WorkingSet"
    ],
    "verified_functions": [
      "compact",
      "assert_referential_closure",
      "run_compaction"
    ],
    "verified_functions_count": 3,
    "defensive_guards_count": 3,
    "raised_exceptions": [
      "CompactionIntegrityError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
