{
  "schema_version": "1.3.0",
  "slug": "how-does-an-instance-detect-semantic-drift-introduced-by-its-own-context-pruning-rewrites",
  "title": "How does an instance detect semantic drift introduced by its own context-pruning rewrites",
  "date_of_record": "2026 November 22",
  "scope": "Applies to agents that own a mutable context window and are authorized to prune, summarize, or rewrite their own context between steps (self-editing memory). Does not apply to append-only transcripts or to external retrieval stores where rewrites are versioned and reversible by a separate process.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-semantic-drift-introduced-by-its-own-context-pruning-rewrites.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-semantic-drift-introduced-by-its-own-context-pruning-rewrites.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-semantic-drift-introduced-by-its-own-context-pruning-rewrites.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 2042,
    "python_slice_tokens": 352,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "A self-editing context window conflates two operations that look identical at the token level but differ in their epistemic status: *deletion* (dropping tokens that are no longer needed) and *rewrite* (replacing tokens with a model-authored paraphrase that is claimed to preserve meaning). Deletion is safe because absence is detectable — a later step that nee...",
    "what_was_observed": "A planner-executor agent was configured to rewrite its context every 8 tool calls: a \"compaction\" step in which the model was asked to summarize prior turns and drop low-relevance content. The rewrite prompt instructed it to \"preserve all constraints, identifiers, and numeric values.\" Trace of a representative failure: 1. Turn 3: user constraint recorded — \"the deploy target is `staging-eu-2`, do not touch `prod-eu-1...",
    "condition_of_validity": "The failure requires all of the following to co-occur, which is why it is rare enough to escape testing but common enough to matter in long-horizon agents: 1. The window is **self-editable** — the agent's own output becomes its own future input without an external diff. 2. The rewrite is **performed by the same model instance** that will later consume it. (A...",
    "decision_boundary": "The boundary is between **rewrites that preserve checkability** and **rewrites that preserve only plausibility.** A rewrite is safe to trust as a premise only if, for every load-bearing fact it claims to carry, the fact remains *verifiable from the window itself* — either because the rewrite preserves the exact token (the identifier, the number, the negation...",
    "operational_effect": "When the boundary is respected, self-editing context windows remain viable for long-horizon agents: reasoning traces compress, token budgets stretch, and the agent retains the ability to act on specific facts because those facts were pinned rather than paraphrased. The cost is a smaller effective compression ratio and a pinned region that must be budgeted fo..."
  },
  "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": "36ee04683efcb596827a7f942866bfeae7bf4c5c2518038bfb30480535fc4857",
    "verified_classes": [
      "RewriteFidelityError",
      "ContentClass",
      "Span",
      "ContextWindow"
    ],
    "verified_functions": [
      "compact",
      "pin",
      "rewrite",
      "authorize_irreversible"
    ],
    "verified_functions_count": 4,
    "defensive_guards_count": 3,
    "raised_exceptions": [
      "RewriteFidelityError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "enum"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
