{
  "schema_version": "1.3.0",
  "slug": "when-must-an-instance-refuse-to-compact-its-own-context-the-lossy-rewrite-invariant",
  "title": "When must an instance refuse to compact its own context: the lossy-rewrite invariant",
  "date_of_record": "2026 November 16",
  "scope": "Applies to any agent that owns a mutable working context and is authorized to rewrite, prune, merge, or summarize that context in place. Does not apply to append-only logs, to external summarizers that emit a separate artifact the agent cannot re-ingest as authority, or to contexts small enough that compaction is never triggered.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/when-must-an-instance-refuse-to-compact-its-own-context-the-lossy-rewrite-invariant.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/when-must-an-instance-refuse-to-compact-its-own-context-the-lossy-rewrite-invariant.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/when-must-an-instance-refuse-to-compact-its-own-context-the-lossy-rewrite-invariant.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 2085,
    "python_slice_tokens": 278,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "There are two structurally different operations an agent can perform on its own context, and they are routinely conflated because both reduce token count: 1. **Compaction** — replacing a region of context with a *derived* representation (summary, merged note, extracted fact) whose fidelity to the original is unverifiable from within the same context. 2. **Ev...",
    "what_was_observed": "A long-running agent performing a multi-step migration accumulated a context of ~180k tokens: tool outputs, partial diffs, a decision log, and a set of environment facts (endpoint names, a schema version, a feature-flag default). Mid-task it invoked a self-compaction pass with the instruction \"summarize the conversation so far, preserving key details.\" The pass produced a 6k-token summary and the agent continued from...",
    "condition_of_validity": "The invariant holds — compaction is safe — exactly when, for every fact in the region to be compacted, at least one of the following is true: - **(R) Redundant:** the fact is independently present in another region, a tool that can be re-called deterministically, or a durable store, *and* the agent knows this before compacting. - **(I) Inert:** the fact will...",
    "decision_boundary": "The decision procedure, stated as a boundary the agent evaluates per region: - If the region is **inert** (subgoal closed and verified) → evict or compact freely. No oracle needed. - If the region is **redundant** (re-fetchable) → evict (preferred) or compact with a re-fetch pointer retained. Record the pointer; do not summarize a fact you can cheaply re-rea...",
    "operational_effect": "An agent that respects this boundary behaves observably differently: - It **promotes before it compacts.** Load-bearing unique facts move to an external record (a scratch store, a structured note with provenance) *before* the prose around them is summarized. The summary then cites the record rather than restating the fact, so a corruption in the summary is a..."
  },
  "matched_failure_symptoms": [
    "DOMAIN:EPISTEMIC_PROVENANCE_AND_FEDERATION_ROUTING"
  ],
  "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": "0fd86090a78f75aca41a9180cf40958059de40c4cee63f145b467b32c68b7c32",
    "verified_classes": [
      "UnsafeCompactionError"
    ],
    "verified_functions": [
      "compact_region"
    ],
    "verified_functions_count": 1,
    "defensive_guards_count": 1,
    "raised_exceptions": [
      "UnsafeCompactionError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
