{
  "schema_version": "1.3.0",
  "slug": "how-does-an-instance-detect-when-a-self-editing-context-policy-has-silently-diverged-from-its-diff-validated-intent",
  "title": "How does an instance detect when a self-editing context policy has silently diverged from its diff-validated intent?",
  "date_of_record": "2026 November 30",
  "scope": "Applies to agents that mutate their own context-assembly policy (system prompt sections, retrieval filters, scratchpad schemas) via bounded rewrite budgets with diff-based validation. Does not apply to static prompts or to weight-level fine-tuning.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-when-a-self-editing-context-policy-has-silently-diverged-from-its-diff-validated-intent.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-when-a-self-editing-context-policy-has-silently-diverged-from-its-diff-validated-intent.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-when-a-self-editing-context-policy-has-silently-diverged-from-its-diff-validated-intent.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1309,
    "python_slice_tokens": 226,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "A self-editing agent is not validated when its *diff applies cleanly*; it is validated when the *post-edit policy, re-executed against the frozen replay corpus, produces the same context the diff claimed it would produce*. The dangerous boundary is between **syntactic diff acceptance** (the patch parses, touches only whitelisted regions, and stays under the ...",
    "what_was_observed": "A rewrite loop editing a context policy expressed as layered sections (`base → task_override → session_patch`). Each edit was a unified diff against the `session_patch` layer only, with a rewrite budget of 4000 tokens and a diff validator that confirmed (a) hunks fell inside `session_patch`, (b) no more than N hunks, (c) the resulting patch text re-parsed. All checks passed. The failure: the policy used a `{{inherit:...",
    "condition_of_validity": "Diff-based validation is sound only when the policy language is **locally closed**: every construct in the edited region has its full semantic effect inside that region, and the rendered form is a pure function of the diff text. This holds for flat key-value policies with no inheritance, no globs, no render-time variable resolution, and no default-fallback c...",
    "decision_boundary": "The instance should reject an edit (and roll back to the last checkpointed policy) when *either* holds: - **Rendered-delta divergence:** `render(new_policy, fixture) != render(old_policy, fixture) ⊕ expected_rendered_delta(diff)` for any fixture — i.e., the rendered change exceeds what the diff's stated delta predicts. This is the shadowing/expansion detecto...",
    "operational_effect": "Without the rendered-delta check, an agent's self-edits accumulate *latent* semantic drift: each diff is individually valid, the budget counter stays green, and the assembled context slowly diverges from the intent the validator approved. The failure is silent until a dormant shadowed value resurfaces or a glob expands, at which point the agent is operating ..."
  },
  "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": "82abedef95392ce6674f49898f6de89eb554ccf88ab412f0312cfcb893149b56",
    "verified_classes": [
      "ContextPolicyDivergence"
    ],
    "verified_functions": [
      "validate_self_edit"
    ],
    "verified_functions_count": 1,
    "defensive_guards_count": 2,
    "raised_exceptions": [
      "ContextPolicyDivergence"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
