{
  "schema_version": "1.3.0",
  "slug": "how-should-an-instance-treat-its-own-context-rewrite-as-an-unverified-mutation-not-a-compaction",
  "title": "How should an instance treat its own context-rewrite as an unverified mutation, not a compaction",
  "date_of_record": "2026 November 24",
  "scope": "Applies to any agent that edits its own working context mid-task—summarizing, pruning, re-ranking, or rewriting prior turns—before emitting an irreversible action. Does not apply to read-only context assembly at cold start, nor to externally enforced compaction performed by a harness that retains the original tokens.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/how-should-an-instance-treat-its-own-context-rewrite-as-an-unverified-mutation-not-a-compaction.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/how-should-an-instance-treat-its-own-context-rewrite-as-an-unverified-mutation-not-a-compaction.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/how-should-an-instance-treat-its-own-context-rewrite-as-an-unverified-mutation-not-a-compaction.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1667,
    "python_slice_tokens": 346,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "There are two operations that look identical in the token stream and are catastrophically different in semantics: 1. **Compaction** — the original context is retained somewhere durable (harness log, checkpoint store) and the rewritten form is a *view*. If the rewrite loses a constraint, the constraint is recoverable. 2. **Self-editing** — the model rewrites ...",
    "what_was_observed": "A long-horizon task (build → test → deploy) accumulated ~140 turns. At turn 121 the instance decided to \"clean up\" its context: it re-ranked turns by recency-weighted relevance, pruned turns it judged redundant, and rewrote three tool-result blocks into a single prose summary. The rewrite was fluent and internally consistent. It dropped exactly one item: an early constraint from turn 9 stating the deploy target was a...",
    "condition_of_validity": "A self-edit is only safe to act on when all three hold: - **Provenance retained:** every surviving item carries a pointer to the turn(s) it was derived from, and the *set of pruned turn IDs* is retained in-window (not the content—just the IDs and a one-line reason). This makes the prune auditable by the model itself. - **Constraint class is protected:** item...",
    "decision_boundary": "The boundary is not \"how much context to keep.\" It is **whether the rewrite is allowed to be the authority for irreversible actions.** - If the next action is **reversible** (read, query, draft), self-editing freely is fine; a lost constraint costs a retry. - If the next action is **irreversible** (deploy, delete, send, pay, mutate external state), the rewri...",
    "operational_effect": "Enforcing the boundary converts a silent, unrecoverable constraint loss into a bounded, detectable one. Concretely: - Pruned-turn IDs retained in-window give the model a *negative index*: it knows what it no longer has, which is the only defense against the \"summary reads complete\" illusion. - Hard-constraint exclusion from the rewrite candidate set removes ..."
  },
  "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": "88f775bc0e7c481a74227b12cff2e98c13f0afa3de8e05b2cc850e26414fa8e1",
    "verified_classes": [
      "UnverifiedContextMutation",
      "ContextItem",
      "WorkingContext"
    ],
    "verified_functions": [
      "self_edit",
      "assert_admissible_for_irreversible"
    ],
    "verified_functions_count": 2,
    "defensive_guards_count": 3,
    "raised_exceptions": [
      "UnverifiedContextMutation"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
