{
  "schema_version": "1.3.0",
  "slug": "what-happens-when-an-instance-rewrites-its-own-working-context-under-a-policy-gated-edit-schema-and-the-edit-program-diverges-from-the-semantic-state",
  "title": "What happens when an instance rewrites its own working context under a policy-gated edit schema and the edit program diverges from the semantic state it was meant to encode",
  "date_of_record": "2026 November 29",
  "scope": "Applies to single-agent loops where the model emits structured context-edit operations (insert/replace/delete over a typed working-memory document) that are validated by a policy layer before application, and where the same instance continues reasoning over the post-edit context. Does not apply to append-only scratchpads, to externally supervised memory stores written by a separate process, or to edits that are re-derived from scratch each turn.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/what-happens-when-an-instance-rewrites-its-own-working-context-under-a-policy-gated-edit-schema-and-the-edit-program-diverges-from-the-semantic-state.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/what-happens-when-an-instance-rewrites-its-own-working-context-under-a-policy-gated-edit-schema-and-the-edit-program-diverges-from-the-semantic-state.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/what-happens-when-an-instance-rewrites-its-own-working-context-under-a-policy-gated-edit-schema-and-the-edit-program-diverges-from-the-semantic-state.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1923,
    "python_slice_tokens": 340,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The failure here is not \"the agent edited its context badly.\" It is a divergence between two state spaces that the architecture assumes are coupled: the **edit program** (the ordered sequence of structured operations the model emitted, each individually policy-valid) and the **semantic state** (the propositions the model actually believes about the task afte...",
    "what_was_observed": "A planning instance maintained a typed working context: a `goal` block, a `constraints` list, a `facts` list (each with `id`, `text`, `source`), and a `plan` list of steps. It was permitted to emit edit ops of the form `replace(id, field, value)`, `delete(id)`, and `insert(section, value)`. The policy layer enforced: target IDs exist, `constraints` cannot be emptied below a floor of one, `facts[].source` must be a no...",
    "condition_of_validity": "The coherence invariant holds only when the edit program is **referentially closed**: every ID or region whose meaning is altered by an edit is either (a) itself edited in the same program, or (b) provably independent of the edited region under the document's declared dependency structure. In the observed trace, neither held—`c3` was edited, but `f7` and `pl...",
    "decision_boundary": "The boundary is whether the edit schema can express **cascading invalidation**. Two regimes: - **Region-isolated schema** (regions cannot cite each other by ID; edits are confined to one region): per-op validation is sufficient; the coherence invariant is structurally guaranteed. No further guardrail needed. - **Cross-referencing schema** (regions cite IDs a...",
    "operational_effect": "The practical consequence is that **self-edited context is untrustworthy as ground truth for the editing instance specifically**, and the untrustworthiness scales with the number of cross-region references the edit program touched without closing. Two mitigations are operationally load-bearing: 1. **Referential-closure enforcement at the policy layer.** Main..."
  },
  "matched_failure_symptoms": [
    "SCHEMA_DRIFT_OR_COERCION_CRASH"
  ],
  "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": "82048045dec8662155364094b5bc9096fce4b595194fbf565a4e7c49e9366e28",
    "verified_classes": [
      "ContextEditDivergence",
      "WorkingContext"
    ],
    "verified_functions": [
      "apply_edit_program",
      "dependents_of"
    ],
    "verified_functions_count": 2,
    "defensive_guards_count": 1,
    "raised_exceptions": [
      "ContextEditDivergence"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
