{
  "schema_version": "1.3.0",
  "slug": "what-structural-signals-indicate-silent-semantic-drift-when-an-agent-rewrites-its-own-context-window-in-place",
  "title": "What structural signals indicate silent semantic drift when an agent rewrites its own context window in place",
  "date_of_record": "2026 November 27",
  "scope": "Applies to agents that mutate their own context buffer in place (compaction, summarization-in-slot, token-level self-editing, KV-cache rewriting) rather than appending to an immutable log. Does not apply to append-only transcript architectures or to external memory stores where rewrites are versioned and replayable.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/what-structural-signals-indicate-silent-semantic-drift-when-an-agent-rewrites-its-own-context-window-in-place.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/what-structural-signals-indicate-silent-semantic-drift-when-an-agent-rewrites-its-own-context-window-in-place.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/what-structural-signals-indicate-silent-semantic-drift-when-an-agent-rewrites-its-own-context-window-in-place.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 2012,
    "python_slice_tokens": 461,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "Append-only context is a monotonic log: every prior token remains addressable, and any downstream inconsistency is recoverable by replay. In-place rewriting breaks monotonicity. When an agent overwrites tokens in its own window—collapsing a tool trace into a summary, replacing a failed sub-plan with a corrected one, or \"cleaning up\" a scratchpad—the bytes th...",
    "what_was_observed": "A planning agent ran a 40-step task with a self-compaction routine triggered at 70% window occupancy. At step 22 it compacted the range covering steps 6–14, which contained a tool call returning `{\"status\": \"partial\", \"missing\": [\"field_c\"]}`. The compaction prompt summarized this as \"retrieved record for entity X successfully.\" The summarizer treated a partial result as success—a defensible reading of the local span...",
    "condition_of_validity": "The invariant that bounds this failure: **a rewrite may only replace a span if every retained token that refers to that span is either (a) also rewritten to remove the dependency, or (b) explicitly tagged as depending on a lossy transform with the transform's fidelity class recorded.** This holds only when the agent can enumerate the referential edges from r...",
    "decision_boundary": "The boundary between \"safe compaction\" and \"silent drift\" is whether the rewrite preserves **status cardinality** and **referential closure** across the cut. - *Preserve status cardinality:* if the source span contained any non-binary status (`partial`, `degraded`, `retry`, `unknown`), the summary must retain that value as a first-class token, not collapse i...",
    "operational_effect": "An agent that enforces referential closure on self-rewrites converts a silent, late-surfacing divergence into an immediate, local refusal. The cost is that some compactions that \"would have been fine\" are rejected and the window grows until the widened range is affordable—a bounded, visible cost. The benefit is that the agent never builds a false causal mode..."
  },
  "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": "c298a16ab4fb4fac64274401988cf7926ee6a5097a7a2416e3bb58f34648db03",
    "verified_classes": [
      "OrphanedReferenceError",
      "StatusFlatteningError",
      "Token",
      "Span"
    ],
    "verified_functions": [
      "commit_in_place_rewrite",
      "compact_window"
    ],
    "verified_functions_count": 2,
    "defensive_guards_count": 3,
    "raised_exceptions": [
      "OrphanedReferenceError",
      "StatusFlatteningError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
