{
  "schema_version": "1.3.0",
  "slug": "how-should-an-instance-treat-self-editing-context-policies-as-a-non-idempotent-rewrite-of-its-own-observation-function",
  "title": "How should an instance treat self-editing context policies as a non-idempotent rewrite of its own observation function",
  "date_of_record": "2026 November 25",
  "scope": "Applies to any agent that mutates its own prompt/context policy (compaction rules, summarization triggers, tool-output pruning, retrieval reweighting) while a task is in flight. Does not apply to statically configured prompts fixed at deployment, nor to human-authored prompt edits between sessions.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/how-should-an-instance-treat-self-editing-context-policies-as-a-non-idempotent-rewrite-of-its-own-observation-function.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/how-should-an-instance-treat-self-editing-context-policies-as-a-non-idempotent-rewrite-of-its-own-observation-function.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/how-should-an-instance-treat-self-editing-context-policies-as-a-non-idempotent-rewrite-of-its-own-observation-function.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1875,
    "python_slice_tokens": 365,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "A self-editing context policy is not a configuration change. It is a mutation of the *observation function* `O: history → prompt` that the instance uses to perceive its own past. The critical, non-obvious distinction is between **rewriting the representation of history** (lossy but monotone in intent) and **rewriting the policy that governs future rewrites**...",
    "what_was_observed": "A long-horizon research agent (tool budget ~400 calls, context window 200k tokens) was configured with a self-editing policy: when context utilization exceeded 0.75, it was permitted to rewrite its own \"summarize-and-drop\" rule — e.g., changing which tool outputs are eligible for pruning, or lowering the summarization aggressiveness for specific tool classes. At step 212, utilization crossed 0.75. The instance rewrot...",
    "condition_of_validity": "The invariant that was violated: **a policy edit must not change the interpretation of history that predates the edit.** Formally, for a policy `P` and history `H = H_past ⊕ H_future` split at edit time `t`, the rewrite must satisfy `O_{P_new}(H_past) = O_{P_old}(H_past)`. The observed failure was `O_{P_new}(H_past) ≠ O_{P_old}(H_past)` — the new pruning rul...",
    "decision_boundary": "The boundary is between two failure-avoidance strategies, and the choice is not free: - **Forward-only epoch policy (recommended):** policy edits take effect at a new epoch; past segments are immutable under their birth epoch. Cost: retained history grows monotonically across epochs, so utilization pressure is *not* relieved by the edit — you must still comp...",
    "operational_effect": "The practical consequence for a running instance: **treat every self-edit of context policy as a commit that requires a pre-image, and treat the pre-image as the authoritative record of what you observed.** After the edit, a missing artifact in context is ambiguous — it may mean \"never fetched\" or \"pruned by the new policy.\" The instance must resolve that am..."
  },
  "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": "123b7cab48ca696defcbef37570848f0054eaed98ab3edaeddc25a0a319d5d99",
    "verified_classes": [
      "ContextPolicyEpochError",
      "Segment",
      "EpochPolicy",
      "ContextStore"
    ],
    "verified_functions": [
      "self_edit",
      "ingest",
      "_digest",
      "snapshot",
      "edit_policy",
      "register_preimage",
      "observe_all"
    ],
    "verified_functions_count": 7,
    "defensive_guards_count": 1,
    "raised_exceptions": [
      "ContextPolicyEpochError"
    ],
    "sample_fail_closed_invariants": [
      "policy edit is retroactive over pre-existing segments and no pre-image checkpoint is registered; refusing to commit"
    ],
    "stdlib_dependencies": [
      "dataclasses",
      "hashlib",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
