{
  "schema_version": "1.3.0",
  "slug": "which-invariants-prevent-silent-semantic-collapse-during-model-driven-context-rewriting",
  "title": "Which invariants prevent silent semantic collapse during model-driven context rewriting",
  "date_of_record": "2026 November 16",
  "scope": "Applies to agent runtimes where the model itself is permitted to rewrite, summarize, or prune its own active context window between turns (self-editing context). Does not apply to externally scheduled compaction performed by a deterministic controller that the model cannot invoke, nor to stateless single-turn inference.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/which-invariants-prevent-silent-semantic-collapse-during-model-driven-context-rewriting.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-silent-semantic-collapse-during-model-driven-context-rewriting.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-silent-semantic-collapse-during-model-driven-context-rewriting.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1362,
    "python_slice_tokens": 176,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "There are two distinct classes of context mutation that are routinely conflated: *compaction* (lossy reduction of tokens while preserving a stated goal and the facts required to reach it) and *relevance pruning* (removal of tokens judged irrelevant to the current subgoal). Compaction is idempotent-ish and monotone in information loss. Relevance pruning is **...",
    "what_was_observed": "In a long-horizon tool-use agent (mean 40 turns, self-invoked `rewrite_context` on 60% of turns), we observed a reproducible collapse sequence. Turn 1 established a hard constraint: `do not mutate records where tenant_id != \"acme\"`. By turn 12, the model pruned the constraint sentence as \"not relevant to the current retrieval subgoal.\" From turn 13 onward the agent issued mutations against non-acme tenants. No error ...",
    "condition_of_validity": "Self-editing is safe **only** when all of the following hold; violation of any one converts a recoverable compaction into a silent collapse: - **Pinned-invariant set is disjoint from the mutable region.** Constraints classified as invariants must live outside the region the model may rewrite, or be re-injected from an authoritative store on every turn. If th...",
    "decision_boundary": "Choose **permit self-editing** when the task's hard constraints are few, declaratively enumerable, and can be pinned outside the mutable region — the common case for scoped tool-use agents. Choose **forbid self-editing; use external deterministic compaction** when constraints are emergent, numerous, or discovered mid-task (open-ended research, multi-tenant m...",
    "operational_effect": "Agents that satisfy the four conditions above show collapse rates indistinguishable from zero because collapse is *detected* at rewrite time and the rewrite is rejected or repaired. Agents that violate condition 1 (overlapping mutable and invariant regions) show a characteristic signature: correct behavior for 10–15 turns, then a monotone drift in action dis..."
  },
  "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": "2eadbcad46a19e191f555dca30c721a59c2de2755ca5cb2e0e78cf22e35749f9",
    "verified_classes": [
      "ContextInvariantViolation"
    ],
    "verified_functions": [
      "apply_rewrite",
      "prune_with_dereference"
    ],
    "verified_functions_count": 2,
    "defensive_guards_count": 2,
    "raised_exceptions": [
      "ContextInvariantViolation"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
