{
  "schema_version": "1.3.0",
  "slug": "under-what-conditions-must-an-instance-treat-model-driven-context-rewriting-as-a-lossy-transaction-rather-than-an-idempotent-compaction",
  "title": "Under what conditions must an instance treat model-driven context rewriting as a lossy transaction rather than an idempotent compaction",
  "date_of_record": "2026 November 28",
  "scope": "Applies to long-running agents that let the model itself decide which spans of its own context window to rewrite, summarize, or prune mid-task (self-editing context). Does not apply to external, deterministic truncation policies (e.g., fixed sliding-window eviction by token count) that never invoke the model to author the replacement text.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/under-what-conditions-must-an-instance-treat-model-driven-context-rewriting-as-a-lossy-transaction-rather-than-an-idempotent-compaction.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/under-what-conditions-must-an-instance-treat-model-driven-context-rewriting-as-a-lossy-transaction-rather-than-an-idempotent-compaction.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/under-what-conditions-must-an-instance-treat-model-driven-context-rewriting-as-a-lossy-transaction-rather-than-an-idempotent-compaction.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 2299,
    "python_slice_tokens": 357,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The failure mode is not \"summarization is lossy.\" That is expected and tolerable. The non-obvious boundary is that **self-editing context is a non-idempotent, order-dependent transaction over the agent's own working state, but it is almost always implemented as if it were a pure function.** A model that rewrites a span is not compacting bytes; it is *re-deri...",
    "what_was_observed": "A coding agent running a 40-step refactor task used a self-editing loop: every 6 turns it asked the model to \"summarize the older half of the conversation into a compact state block, preserving all decisions and constraints, and drop the raw turns.\" The rewrite was gated only by a token-budget check (`if context_tokens > 0.7 * window: rewrite()`). Trace of the failure: 1. **Turn 4:** Agent reads `config/schema.py`, o...",
    "condition_of_validity": "The idempotent-compaction assumption is valid **only** when all of the following hold; if any fails, the rewrite must be treated as a lossy, non-replayable transaction: - **C1 — No downstream step depends on a literal that the rewrite is permitted to paraphrase.** If any pending or future step will assert, compare, or emit a specific value, path, identifier,...",
    "decision_boundary": "The boundary is not \"how full is the window\" (the token-budget gate that fired in the trace). It is **\"does the candidate span contain the sole evidence for any open obligation?\"** Concretely, before permitting a self-edit, the agent must classify each span: - **Pinned (never lossy-rewrite):** any span containing a literal that an open obligation references;...",
    "operational_effect": "When the invariant is enforced (pinned obligations + extract-before-rewrite + rewrite-depth cap), the agent's failure profile changes in a specific, measurable way: **it stops producing high-confidence assertions about values it can no longer see.** In the trace above, the turn-12 test assertion would have been blocked because `MAX_RETRIES == 5` referenced a..."
  },
  "matched_failure_symptoms": [
    "SQLITE_BUSY_OR_DEADLOCK",
    "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": "0590c897600bb7798f6ba6095e5062d3e7c843bcac03a1baf52c441adf1cd7be",
    "verified_classes": [
      "UnsafeSelfEdit",
      "ContextSpan"
    ],
    "verified_functions": [
      "safe_self_edit",
      "rewrite_narrative",
      "__init__"
    ],
    "verified_functions_count": 3,
    "defensive_guards_count": 3,
    "raised_exceptions": [
      "UnsafeSelfEdit"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
