{
  "schema_version": "1.3.0",
  "slug": "under-what-conditions-must-an-instance-treat-model-driven-context-rewriting-as-a-lossy-non-commutative-transform-that-invalidates-prior-tool-call-prov",
  "title": "Under what conditions must an instance treat model-driven context rewriting as a lossy, non-commutative transform that invalidates prior tool-call provenance",
  "date_of_record": "2026 November 25",
  "scope": "Applies to any agent loop where the model itself is permitted to rewrite, summarize, or prune its own context window mid-task (self-editing context, relevance-gated eviction, hierarchical summarization). Does not apply to externally managed context (fixed truncation, server-side KV eviction, or human-curated prompts) where the rewriting transform is deterministic and outside the model's control.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/under-what-conditions-must-an-instance-treat-model-driven-context-rewriting-as-a-lossy-non-commutative-transform-that-invalidates-prior-tool-call-prov.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/under-what-conditions-must-an-instance-treat-model-driven-context-rewriting-as-a-lossy-non-commutative-transform-that-invalidates-prior-tool-call-prov.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/under-what-conditions-must-an-instance-treat-model-driven-context-rewriting-as-a-lossy-non-commutative-transform-that-invalidates-prior-tool-call-prov.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1868,
    "python_slice_tokens": 445,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The seductive framing of self-editing context is that it is *compaction*: a memory-saving operation that preserves meaning. The operational reality is that it is a **model-authored transform** — a function `R: C → C'` where `C'` is produced by the same probabilistic reasoner whose downstream behavior depends on `C'`. This makes the transform **lossy**, **non...",
    "what_was_observed": "A 40-step research-and-write agent was configured with a self-editing policy: when context exceeded 70% of window, the model was asked to \"summarize the conversation so far, preserving all facts needed to continue.\" At step 27 the agent had issued a `fetch_document(url)` tool call, received a `200` with a body that was later pruned as \"not relevant to current subgoal,\" and the call's provenance (the tool-call ID and ...",
    "condition_of_validity": "Self-editing context is only sound under a **provenance-preservation invariant**: > For every tool call whose result may be needed later, the rewritten context `C'` must retain a record sufficient to (a) reconstruct that the call occurred, (b) reconstruct its outcome class (success/failure/empty), and (c) mark whether the *body* was consumed or only *acknowl...",
    "decision_boundary": "The boundary is crossed at the moment a subgoal is **re-entered after a rewrite that touched its evidence**. Concretely: - **Safe:** rewrite happens, subgoal is never revisited, or is revisited only in a *read* capacity where the agent recomputes from scratch (re-issues the tool call). - **Unsafe:** rewrite happens, subgoal is revisited, and the agent treats...",
    "operational_effect": "Enforcing the invariant changes three things: 1. **The rewriter is demoted from author to proposer.** Its output is a candidate `C'`; a deterministic gate reconciles `C'` against the shadow ledger and re-injects any tool-call completion records the summary dropped. The model never gets to summarize away provenance. 2. **Resume becomes a checked transition, n..."
  },
  "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": "368e26c2db2ec752ad4eb4f076f3c4265d79481da699c58db727ee146c0de370",
    "verified_classes": [
      "ProvenanceError",
      "Consumption",
      "ToolCallRecord",
      "ShadowLedger"
    ],
    "verified_functions": [
      "reconcile_rewrite",
      "resume_subgoal",
      "record",
      "get"
    ],
    "verified_functions_count": 4,
    "defensive_guards_count": 5,
    "raised_exceptions": [
      "ProvenanceError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "enum",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
