{
  "schema_version": "1.3.0",
  "slug": "which-invariants-prevent-self-rewriting-context-agents-from-silently-destroying-the-evidence-their-own-coherence-check-depends-on",
  "title": "Which invariants prevent self-rewriting context agents from silently destroying the evidence their own coherence check depends on",
  "date_of_record": "2026 December 2",
  "scope": "Applies to agents that mutate their own working-memory buffer (summarize, compress, evict, rewrite) while a coherence or consistency check reads that same buffer in the same turn. Does not apply to append-only scratchpads or to summarizers that emit to a separate immutable store.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/which-invariants-prevent-self-rewriting-context-agents-from-silently-destroying-the-evidence-their-own-coherence-check-depends-on.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-self-rewriting-context-agents-from-silently-destroying-the-evidence-their-own-coherence-check-depends-on.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-self-rewriting-context-agents-from-silently-destroying-the-evidence-their-own-coherence-check-depends-on.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1687,
    "python_slice_tokens": 315,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The failure is not \"the agent forgot something.\" It is that the agent's *self-check* and its *self-edit* operate on the same mutable substrate, and the edit can invalidate the very tokens the check was going to verify. A compression pass that is judged \"coherent\" by re-reading its own output is not a coherence check — it is a tautology. The distinction that ...",
    "what_was_observed": "A long-horizon research agent (budget: 96k tokens, hard ceiling 128k) ran a periodic self-compression every 40 tool calls. The routine was: emit a summary of turns `[0..n]`, replace them in the buffer with the summary, then run a \"coherence gate\" prompt: *\"Confirm the summary above retains all constraints and open subtasks.\"* The gate returned `PASS` on every cycle. At call 160 the agent emitted a final deliverable t...",
    "condition_of_validity": "The `snapshot-verify-commit` invariant holds only if all of the following are true: - **Immutability of the reference.** The pre-edit buffer (or a lossless digest of the constraint-bearing spans) must be readable by the verifier and must not be reachable by the editor. If the editor can write the reference, the check is void. - **Span-addressed constraints.*...",
    "decision_boundary": "The boundary is *not* \"how much can I compress.\" It is **whether the constraint set is representable outside the compressible region.** Concretely: - If every constraint can be lifted into a pinned, non-compressible span table (small, bounded, e.g. ≤ 2k tokens), compression of the narrative region is safe at any ratio, because fidelity is checked against the...",
    "operational_effect": "The ratchet is silent. There is no error, no exception, no degraded-confidence signal — the gate returns `PASS` with high logprob, and the model's self-report is \"context is healthy.\" The only observable is downstream task failure at the point where a dropped constraint becomes load-bearing, which may be hundreds of calls after the drop. This means **the fai..."
  },
  "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": "6a667c3f176c0adb53657488b2e1943a3133b40407dcecf5695951e5d69402f8",
    "verified_classes": [
      "ConstraintFidelityError",
      "ConstraintSpan",
      "SpanVerdict"
    ],
    "verified_functions": [
      "verify_rewrite",
      "commit_rewrite"
    ],
    "verified_functions_count": 2,
    "defensive_guards_count": 4,
    "raised_exceptions": [
      "ConstraintFidelityError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
