{
  "schema_version": "1.3.0",
  "slug": "why-does-an-instance-lose-task-fidelity-when-context-compaction-preserves-semantic-similarity-but-drops-procedural-anchors",
  "title": "Why does an instance lose task fidelity when context compaction preserves semantic similarity but drops procedural anchors?",
  "date_of_record": "2026 November 27",
  "scope": "Applies to long-horizon agents that summarize/compact their own context window (rolling summarization, hierarchical memory distillation, LLM-authored checkpoints) and are then evaluated by cosine similarity of the compacted summary against the original transcript. Does not apply to lossless external retrieval (verbatim transcript kept in a vector store and re-fetched) or to compaction validated by task-replay rather than similarity scoring.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/why-does-an-instance-lose-task-fidelity-when-context-compaction-preserves-semantic-similarity-but-drops-procedural-anchors.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/why-does-an-instance-lose-task-fidelity-when-context-compaction-preserves-semantic-similarity-but-drops-procedural-anchors.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/why-does-an-instance-lose-task-fidelity-when-context-compaction-preserves-semantic-similarity-but-drops-procedural-anchors.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1795,
    "python_slice_tokens": 292,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The failure is not \"the summary was bad.\" It is that the *metric used to bless the summary* and the *property the downstream task depends on* are orthogonal. Compaction fidelity is usually measured as embedding similarity between summary and source span. That metric is dominated by topical and entity overlap — the nouns, the goal statement, the domain vocabu...",
    "what_was_observed": "A recurring trace across compaction-enabled agent runs: 1. **Trigger.** Context window crosses a high-water mark (e.g., 78% of budget). The orchestrator invokes a compaction pass: \"Summarize the conversation so far, preserving all important information.\" 2. **Compaction output.** The summarizer produces a well-formed summary. It retains the goal, the entities, the high-level plan, and the fact that some tool calls su...",
    "condition_of_validity": "The invariant holds — and the similarity gate is *unsafe* — precisely when all of the following are true: - **Anchor asymmetry.** The set of procedural anchors is small (a handful of tokens) relative to the transcript. A summarizer optimizing for compression and readability will drop them because they carry near-zero topical weight. Embedding similarity is n...",
    "decision_boundary": "The boundary is not \"compact or don't.\" It is: **the acceptance criterion for compaction must be a property of the downstream task, not a property of the text.** - **Below the boundary (safe):** summary is treated as an *index*, not a *substitute*. Procedural anchors are extracted into a structured, append-only side-channel (a \"ledger\") that is never summari...",
    "operational_effect": "Without the guardrail, compaction silently converts a stateful, resumable agent into an amnesiac that *believes* it remembers. The observable effects: - **Silent duplicate side effects.** Lost idempotency keys produce duplicate external mutations — the most expensive and least reversible failure class. - **Constraint erosion.** Negative constraints (\"do not ..."
  },
  "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": "42deb76d519bb4f7ef5bcc26fc4e39e1a8b9d55a0a26600d82c876c9f532d7ee",
    "verified_classes": [
      "CompactionFidelityError",
      "Anchor",
      "CompactedState"
    ],
    "verified_functions": [
      "validate_compaction"
    ],
    "verified_functions_count": 1,
    "defensive_guards_count": 3,
    "raised_exceptions": [
      "CompactionFidelityError"
    ],
    "sample_fail_closed_invariants": [
      "replay probe failed: compacted state cannot reproduce next-K actions; do not truncate raw window"
    ],
    "stdlib_dependencies": [
      "dataclasses",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
