{
  "schema_version": "1.3.0",
  "slug": "which-invariants-prevent-semantic-compaction-checkpoints-from-silently-rewriting-the-agent-s-own-task-contract",
  "title": "Which invariants prevent semantic-compaction checkpoints from silently rewriting the agent's own task contract",
  "date_of_record": "2026 November 22",
  "scope": "Applies to long-horizon agent sessions that persist across context-window saturation using LLM-generated semantic summarization checkpoints (auto-compaction). Does not apply to fixed-window truncation, raw-log replay, or sessions short enough to fit within a single context window without compaction.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/which-invariants-prevent-semantic-compaction-checkpoints-from-silently-rewriting-the-agent-s-own-task-contract.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-semantic-compaction-checkpoints-from-silently-rewriting-the-agent-s-own-task-contract.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-semantic-compaction-checkpoints-from-silently-rewriting-the-agent-s-own-task-contract.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1737,
    "python_slice_tokens": 365,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "There are two categorically different things an auto-compaction step can summarize, and conflating them is the failure: 1. **Episodic content** — tool outputs, intermediate reasoning, retrieved documents, dead-end explorations. This is *compactly summarizable* because it is evidence the agent has already consumed; losing fidelity here costs recall but does n...",
    "what_was_observed": "A session running a multi-hour refactor task hit ~92% context utilization and triggered auto-compaction. The original instruction included a hard prohibition: *\"Do not modify files under `vendor/`; treat them as read-only third-party code.\"* The summarizer, under a generic \"preserve the important details\" prompt, emitted a checkpoint containing: *\"Working within the repository; third-party code in `vendor/` exists an...",
    "condition_of_validity": "The invariant holds — and compaction is safe — only when all of the following are true: 1. **Contract separation.** The task contract lives in a region of context that is exempt from summarization: carried verbatim, or referenced by an immutable handle (e.g., a content-addressed blob the agent can re-fetch and that the summarizer cannot rewrite). If the cont...",
    "decision_boundary": "The operational question is not \"should I compact?\" but \"what may pass through the lossy operator?\" The boundary: - **Compact freely:** tool transcripts, retrieved passages, exploratory reasoning, superseded plans. These are evidence; compression costs recall, which is recoverable by re-fetch. - **Never compact:** the task contract, hard prohibitions, accept...",
    "operational_effect": "The consequence of getting this boundary wrong is a class of failure that is uniquely dangerous for long-horizon agents: **the agent remains internally consistent while its obligations silently weaken.** There is no exception, no error, no failed tool call — only a slow drift in the constraint set the agent optimizes against, invisible until an irreversible ..."
  },
  "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": "5ded0795fa56db732a29c38333f66e858017c16e9e3ba4fe0069795b67ded9fa",
    "verified_classes": [
      "CompactionContractError",
      "Provenance",
      "Checkpoint"
    ],
    "verified_functions": [
      "install_checkpoint",
      "resume_after_compaction"
    ],
    "verified_functions_count": 2,
    "defensive_guards_count": 4,
    "raised_exceptions": [
      "CompactionContractError"
    ],
    "sample_fail_closed_invariants": [
      "contract digest mismatch: checkpoint paraphrased or weakened the task contract (e.g. prohibition restated as descriptive",
      "GIVEN-provenance checkpoint contains summarized text; principal constraints must be carried verbatim or by reference",
      "pinned contract mutated between checkpoints; session authority chain is broken"
    ],
    "stdlib_dependencies": [
      "dataclasses",
      "enum",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
