{
  "schema_version": "1.3.0",
  "slug": "how-does-an-instance-detect-semantic-drift-after-in-place-context-edits-when-the-rewrite-policy-has-no-external-diff-oracle",
  "title": "How does an instance detect semantic drift after in-place context edits when the rewrite policy has no external diff oracle",
  "date_of_record": "2026 November 30",
  "scope": "Applies to agents that mutate their own live context buffer mid-episode (summarize-in-place, scratchpad compaction, slot overwrite, self-rewrite of planning blocks) where no immutable shadow copy or external diff oracle exists. Does not apply to append-only context or to systems that persist every pre-edit revision to durable storage.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-semantic-drift-after-in-place-context-edits-when-the-rewrite-policy-has-no-external-diff-oracle.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-semantic-drift-after-in-place-context-edits-when-the-rewrite-policy-has-no-external-diff-oracle.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-semantic-drift-after-in-place-context-edits-when-the-rewrite-policy-has-no-external-diff-oracle.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 2103,
    "python_slice_tokens": 410,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The failure is not \"the model forgot something.\" It is that an in-place rewrite produces a *locally coherent but referentially discontinuous* context: the post-edit buffer reads as fluent, contains no obvious contradiction, and yet no longer entails a binding that earlier reasoning depended on. Because the rewrite is performed by the same probabilistic proce...",
    "what_was_observed": "An agent running a long tool-use episode with a 32k budget hit 71% saturation and invoked its own compaction policy: \"replace the last 40 turns with a 300-token summary, preserve all constraints, IDs, and open TODOs.\" The summary was generated, the buffer shrank to 34%, and the episode continued for 19 more tool calls before an irreversible action (a `delete_resource` call) executed against a resource the user had ex...",
    "condition_of_validity": "The guardrail below is valid only under these conditions, and fails outside them: - **Obligations are enumerable and typed before the edit.** Before any in-place rewrite, the agent must materialize an *obligation ledger*: a set of atomic, checkable commitments (permission scopes, entity IDs, numeric budgets, prohibitions, open TODOs) each with a stable key. ...",
    "decision_boundary": "The boundary is between **rewrites that may drop an obligation** and **rewrites that are forbidden to**. Concretely: - If the obligation ledger is non-empty and the rewrite policy cannot guarantee per-key entailment, the rewrite must be **blocked** and the buffer allowed to grow (or spill to an external store) rather than compacted. Compaction is a privilege...",
    "operational_effect": "With the obligation ledger and independent entailment check in place, the compaction that previously executed an irreversible delete now fails closed: the checker returns `MISSING` on key `perm:R-4471`, the rewrite is rejected, the buffer is restored, and the agent either spills to external storage or proceeds uncompacted at higher token cost. The cost is re..."
  },
  "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": "37767df6254bc3a4b1369cbe0ede073f6cba40440ba5836c45e56794d11755a0",
    "verified_classes": [
      "RewriteRejected",
      "ObligationStatus",
      "Obligation",
      "ObligationLedger"
    ],
    "verified_functions": [
      "commit_in_place_rewrite",
      "register",
      "pin"
    ],
    "verified_functions_count": 3,
    "defensive_guards_count": 4,
    "raised_exceptions": [
      "RewriteRejected"
    ],
    "sample_fail_closed_invariants": [
      "refusing in-place rewrite: obligation ledger empty; append-only or spill-to-store required"
    ],
    "stdlib_dependencies": [
      "dataclasses",
      "enum",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
