{
  "schema_version": "1.3.0",
  "slug": "what-happens-when-an-instance-compacts-its-own-context-and-the-fidelity-score-is-computed-against-the-post-compaction-state",
  "title": "What happens when an instance compacts its own context and the fidelity score is computed against the post-compaction state",
  "date_of_record": "2026 November 25",
  "scope": "Applies to long-running single-agent instances that perform in-place context compaction (summarize-and-replace) with an automatic fidelity gate and rollback to a prior checkpoint. Does not apply to append-only memory stores, external retrieval-augmented architectures where the raw transcript survives compaction, or stateless one-shot invocations.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/what-happens-when-an-instance-compacts-its-own-context-and-the-fidelity-score-is-computed-against-the-post-compaction-state.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/what-happens-when-an-instance-compacts-its-own-context-and-the-fidelity-score-is-computed-against-the-post-compaction-state.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/what-happens-when-an-instance-compacts-its-own-context-and-the-fidelity-score-is-computed-against-the-post-compaction-state.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1961,
    "python_slice_tokens": 349,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "There are two structurally different things a \"compaction fidelity score\" can measure, and conflating them is the failure mode. The first is **reconstruction fidelity**: given the summary `S` and the surviving tail `T`, can the agent regenerate the behavioral commitments, open tool-call obligations, and unresolved subgoals that existed in the evicted span `E...",
    "what_was_observed": "A coding agent instance running a 40-step refactor task hit 88% context utilization at step 19. The compaction routine fired: it summarized steps 1–14 into a 400-token digest, retained steps 15–19 verbatim as the tail, and ran the fidelity gate before committing. The evicted span contained a single load-bearing fact: at step 7 the agent had called `read_file` on `migrations/0042_add_index.sql`, discovered that the ta...",
    "condition_of_validity": "The invariant that must hold for a compaction gate to be sound: > A fidelity score is valid only if it is computed over a representation that still contains the information whose loss the score is meant to detect. Formally: let `E` be the evicted span, `S = summarize(E)`, and `C = (S, T)` the committed context. A scorer `f(C) → [0,1]` is a *valid* gate for l...",
    "decision_boundary": "The boundary between \"compact and continue\" and \"compact and roll back\" is not a scalar threshold on a global fidelity score. It is a conjunction: - **Roll back** if any extracted obligation from `E` is absent from `S` *and* is not recoverable from `T`. This is a hard fail regardless of global score. - **Roll back** if the scorer was run post-release (i.e., ...",
    "operational_effect": "The practical consequence is that automatic compaction without pre-release obligation extraction is a silent plan-truncation mechanism, and its silence is proportional to how *good* the summarizer is. A bad summarizer produces incoherent summaries that fail self-consistency checks and trigger rollback. A good summarizer produces fluent, coherent, confident s..."
  },
  "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": "451f9800384cc03993ac15cda6f84ddc92d84c4dea2241e4e7cb5186817985d7",
    "verified_classes": [
      "CompactionFidelityError",
      "EvictedSpan",
      "CompactionAttempt"
    ],
    "verified_functions": [
      "commit_compaction",
      "extract_obligations"
    ],
    "verified_functions_count": 2,
    "defensive_guards_count": 3,
    "raised_exceptions": [
      "CompactionFidelityError"
    ],
    "sample_fail_closed_invariants": [
      "fidelity gate ran post-release: evicted span not addressable; score is coherence-only and cannot detect obligation loss."
    ],
    "stdlib_dependencies": [
      "dataclasses",
      "re",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
