{
  "schema_version": "1.3.0",
  "slug": "where-must-an-instance-treat-a-self-editing-context-as-a-transaction-rather-than-a-stream",
  "title": "Where must an instance treat a self-editing context as a transaction rather than a stream",
  "date_of_record": "2026 November 28",
  "scope": "Applies to any agent loop where the model itself issues edit operations (prune, summarize, evict-by-relevance-score, rewrite) against its own live context between reasoning steps. Does not apply to externally-managed context compaction performed by a host outside the model's action space, nor to append-only scratchpads where no segment is ever removed.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/where-must-an-instance-treat-a-self-editing-context-as-a-transaction-rather-than-a-stream.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/where-must-an-instance-treat-a-self-editing-context-as-a-transaction-rather-than-a-stream.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/where-must-an-instance-treat-a-self-editing-context-as-a-transaction-rather-than-a-stream.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 2085,
    "python_slice_tokens": 442,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "There are two things a self-editing context can mean, and they fail differently. The first is **render-time rewriting**: the model emits an edit instruction, the harness produces a new context string, and the next forward pass sees it. The edit is a pure function of the previous context and the edit op. Nothing downstream is committed until the next token is...",
    "what_was_observed": "A long-horizon agent (≈180 steps) maintained a working context of tool outputs, plan fragments, and intermediate results. At each step it was permitted to call `context.edit` with a relevance threshold: segments scoring below τ against the current sub-goal were summarized to one line; segments below τ/2 were dropped entirely. The failure trace was consistent across runs: 1. **Step 6–9:** The agent is working on sub-g...",
    "condition_of_validity": "The self-edit is only safe when all of the following hold: - **Provenance is retained out-of-band.** Every evicted segment remains addressable by a stable ID in a store the model cannot mutate, and the model retains at least the ID plus a hash of the evicted content. The summary is a *view*, not the *record*. - **The scorer is pinned to a stable query.** Rel...",
    "decision_boundary": "The decision is not \"should the model prune?\" It is **\"is this edit a view operation or a commit operation, and does the harness know which?\"** - If the edit produces a *new rendering* while the underlying segments remain in a store keyed by ID, and the model can rehydrate by ID, it is a view. Commit is deferred. Safe. - If the edit *replaces* the segment wi...",
    "operational_effect": "Enforcing the view/commit distinction changes the failure profile from *silent, unrecoverable, and self-inflicted* to *loud and recoverable*: - Re-derivation thrash disappears because the model rehydrates instead of re-fetching; token budget is spent on reasoning, not reconstruction. - Goal-eviction amnesia becomes structurally impossible via the protected r..."
  },
  "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": "f67ef1f4f5ba1e8593f282b453334da47adb211da91c8ada0d97a18891b3e137",
    "verified_classes": [
      "ContextEditViolation",
      "Segment",
      "SelfEditingContext"
    ],
    "verified_functions": [
      "self_edit_step",
      "register",
      "lock_task_root",
      "evict",
      "rehydrate",
      "render"
    ],
    "verified_functions_count": 6,
    "defensive_guards_count": 6,
    "raised_exceptions": [
      "ContextEditViolation"
    ],
    "sample_fail_closed_invariants": [
      "no locked task root; self-edit is unanchored",
      "task root already locked; refusing re-pin",
      "relevance scorer is not pinned to the task root; eviction would be a self-referential commit"
    ],
    "stdlib_dependencies": [
      "__future__",
      "dataclasses",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
