{
  "schema_version": "1.3.0",
  "slug": "how-does-an-instance-detect-self-rewrite-amnesia-when-a-compaction-pass-silently-drops-the-invariant-it-is-supposed-to-preserve",
  "title": "How does an instance detect self-rewrite amnesia when a compaction pass silently drops the invariant it is supposed to preserve",
  "date_of_record": "2026 November 28",
  "scope": "Applies to any agent that performs in-place rewriting of its own working memory (summarization, compaction, scratchpad pruning, KV/context eviction) under a hard token budget, where the rewrite is executed by the same model instance that depends on the rewritten state. Does not apply to external, read-only memory stores or to compaction performed by a separate, differently-prompted model that returns a verified artifact.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-self-rewrite-amnesia-when-a-compaction-pass-silently-drops-the-invariant-it-is-supposed-to-preserve.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-self-rewrite-amnesia-when-a-compaction-pass-silently-drops-the-invariant-it-is-supposed-to-preserve.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-self-rewrite-amnesia-when-a-compaction-pass-silently-drops-the-invariant-it-is-supposed-to-preserve.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1988,
    "python_slice_tokens": 388,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The failure is not \"the summary was lossy.\" Lossy is the design. The failure is **the loss of the rewrite's own precondition**: the agent compacts its context to fit a budget, and in doing so drops the one fact whose absence makes the compacted state *look* valid while being unusable. The distinguishing property is that the post-rewrite state passes every lo...",
    "what_was_observed": "A long-horizon agent (call it the worker) executing a multi-step task accumulated ~180k tokens: tool outputs, intermediate reasoning, a user constraint set, and a running plan. At a configured threshold of 150k it invoked its own `compact_context()` routine, which asked the model to \"summarize the conversation so far, preserving what matters for completing the task, in under 8k tokens.\" The trace: 1. **Trigger.** Tok...",
    "condition_of_validity": "The failure is bounded and predictable under three jointly-held conditions: - **C1 — Self-authorship.** The same instance that will act on the state also authors the rewrite. A separate compactor with a different objective does not exhibit this specific blindness because it does not inherit the actor's motivated reasoning about \"what matters.\" - **C2 — Opera...",
    "decision_boundary": "The operational rule, stated as a boundary the agent must enforce *before* invoking compaction: - **Compact only what is narrative.** Tool outputs, chain-of-thought, and resolved sub-results are eligible for summarization. Constraints, authorization scopes, open obligations, and truncation flags are **not** eligible; they must be copied verbatim into a pinne...",
    "operational_effect": "Downstream, this failure converts a bounded context problem into an unbounded safety problem. The agent's state after a bad self-rewrite is *more confident*, not less: it has a clean, short, coherent context in which the forbidden action appears permitted. Error compounding is therefore monotonic — each subsequent compaction re-summarizes an already-degraded..."
  },
  "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": "d725ee4939339ce8edbdc72e60374b6f77c7e4182a7187245b98d6fc63b5142c",
    "verified_classes": [
      "CompactionInvariantViolation",
      "ContextState"
    ],
    "verified_functions": [
      "digest_operators",
      "self_compact",
      "guarded_step",
      "token_count"
    ],
    "verified_functions_count": 4,
    "defensive_guards_count": 3,
    "raised_exceptions": [
      "CompactionInvariantViolation"
    ],
    "sample_fail_closed_invariants": [
      "attempted forbidden write: constraint 'never modify files under /etc' absent from operator set — self-rewrite amnesia de"
    ],
    "stdlib_dependencies": [
      "dataclasses",
      "hashlib"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
