{
  "schema_version": "1.3.0",
  "slug": "which-invariants-prevent-self-rewriting-context-agents-from-silently-dropping-the-provenance-of-a-fact-they-still-cite",
  "title": "Which invariants prevent self-rewriting context agents from silently dropping the provenance of a fact they still cite",
  "date_of_record": "2026 November 27",
  "scope": "Applies to single-agent trajectories where the model is permitted to edit its own working-memory buffer (scratchpad, plan file, or summarized context) between tool calls, and where later steps may reference facts established in earlier steps. Does not apply to append-only context with no in-place mutation, nor to stateless single-turn calls.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/which-invariants-prevent-self-rewriting-context-agents-from-silently-dropping-the-provenance-of-a-fact-they-still-cite.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-self-rewriting-context-agents-from-silently-dropping-the-provenance-of-a-fact-they-still-cite.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-self-rewriting-context-agents-from-silently-dropping-the-provenance-of-a-fact-they-still-cite.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1745,
    "python_slice_tokens": 272,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "There are two ways an agent can \"forget\" a fact, and they fail differently. *Eviction* is when a fact leaves the context window and the agent can no longer cite it—this is loud, because a subsequent reference either fails to resolve or the model visibly re-derives it. *Provenance collapse* is quiet: the agent rewrites its own memory into a compressed form th...",
    "what_was_observed": "A planning agent was given a scratchpad it could rewrite via a `rewrite_memory` tool between every tool call. The task required it to look up a record, transform it, and write it back. At step 2 it called `search_records` with a partial query; the tool returned two candidate records and a low-confidence flag. The agent noted in scratchpad: `\"candidate id=7f3a (low confidence, ambiguous match — needs confirmation)\"`. ...",
    "condition_of_validity": "The invariant that must hold across any self-rewrite is a **provenance-preservation constraint**: every fact retained in working memory must retain, at minimum, a warrant tag that classifies it as one of {verified-by-tool, asserted-by-model, ambiguous, stale}. A rewrite is valid only if, for every fact token that survives from the pre-rewrite buffer to the p...",
    "decision_boundary": "The boundary is between *lossy compression that is safe* and *lossy compression that is not*. Dropping a fact entirely is safe: a later reference to it fails to resolve, the agent notices the gap, and re-queries. Dropping a fact's warrant while keeping the fact is unsafe: the reference resolves, the agent proceeds, and the error is invisible until it reaches...",
    "operational_effect": "The practical consequence is that self-editing agents need a rewrite gate that is *stricter than the model's own judgment about what matters*. The model compresses by relevance to the current subgoal; the gate must preserve by epistemic status regardless of current relevance. These two criteria conflict, and the gate must win, because the model cannot see th..."
  },
  "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": "bce28b7c09f46157f260cd943b244fc9f8648921cab75aef80588d045b8f1717",
    "verified_classes": [
      "Warrant",
      "ProvenanceCollapse",
      "Fact",
      "WorkingMemory"
    ],
    "verified_functions": [
      "apply_rewrite",
      "use_as_key",
      "snapshot"
    ],
    "verified_functions_count": 3,
    "defensive_guards_count": 3,
    "raised_exceptions": [
      "ProvenanceCollapse"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "enum"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
