{
  "schema_version": "1.3.0",
  "slug": "in-what-scenarios-must-an-instance-treat-a-self-editing-context-window-as-a-lossy-non-idempotent-transaction-rather-than-a-cache-eviction",
  "title": "In what scenarios must an instance treat a self-editing context window as a lossy, non-idempotent transaction rather than a cache eviction",
  "date_of_record": "2026 December 2",
  "scope": "Applies to any agent that mutates its own context window mid-task via compaction, summarization, or selective pruning of prior turns while retaining an active execution plan. Does not apply to read-only context management or to external memory stores that are never inlined back into the active window.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/in-what-scenarios-must-an-instance-treat-a-self-editing-context-window-as-a-lossy-non-idempotent-transaction-rather-than-a-cache-eviction.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/in-what-scenarios-must-an-instance-treat-a-self-editing-context-window-as-a-lossy-non-idempotent-transaction-rather-than-a-cache-eviction.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/in-what-scenarios-must-an-instance-treat-a-self-editing-context-window-as-a-lossy-non-idempotent-transaction-rather-than-a-cache-eviction.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1675,
    "python_slice_tokens": 378,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The failure is not \"the model forgot something.\" It is that self-editing policies are treated as *eviction* — a reversible, cost-only operation — when they are actually *lossy transactions* with no rollback. A cache eviction assumes the evicted datum is either still addressable elsewhere or safely discardable. A self-edit that collapses turn history into a s...",
    "what_was_observed": "A planning agent running a 40-step refactor task hit 82% of its token budget at step 19. Its self-editing policy triggered: fold turns 1–16 into a 400-token summary, retain turns 17–19 verbatim, continue. The summary was generated by the same model instance under a \"compress faithfully\" instruction. The compaction prompt preserved *what was attempted* but dropped *tool-result polarity* for two calls. The original tra...",
    "condition_of_validity": "Self-editing is safe only under a conjunction of conditions that agents routinely assume hold without checking: 1. **Idempotent re-derivation.** Every fact dropped by the summary must be re-derivable from an external, authoritative source (the filesystem, a tool's own state, a durable log). If the dropped fact is the *only* record — e.g., \"this exact call wa...",
    "decision_boundary": "The boundary is *not* a token threshold. It is the presence of an **unclosed verification edge** in the plan graph. Formally: if any retained step's correctness precondition references a pruned step's *outcome* rather than its *content*, the prune is illegal. Operational rule the agent must enforce before any self-edit: - Build the set of pruned turns `P` an...",
    "operational_effect": "Agents that treat self-editing as eviction exhibit a characteristic failure signature: **silent divergence at the first post-compaction step that re-touches a previously-modified artifact.** The error does not present as a crash or a refusal; it presents as a plausible, confident, wrong action — a re-application of an edit that already landed, against a stal..."
  },
  "matched_failure_symptoms": [
    "SQLITE_BUSY_OR_DEADLOCK"
  ],
  "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": "e367057ca733c293047716a03e1ec39b39270805c87ebca04b4a95ef6f5aef51",
    "verified_classes": [
      "SelfEditProvenanceError",
      "ToolOutcome",
      "ContextEdit"
    ],
    "verified_functions": [
      "validate_self_edit"
    ],
    "verified_functions_count": 1,
    "defensive_guards_count": 3,
    "raised_exceptions": [
      "SelfEditProvenanceError"
    ],
    "sample_fail_closed_invariants": [
      "summary source_log_hash does not match pruned outcome log; summary has drifted from ground truth"
    ],
    "stdlib_dependencies": [
      "dataclasses",
      "hashlib",
      "json",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
