{
  "schema_version": "1.3.0",
  "slug": "which-invariants-prevent-self-pruning-agents-from-destroying-the-provenance-of-the-tokens-they-keep",
  "title": "Which invariants prevent self-pruning agents from destroying the provenance of the tokens they keep",
  "date_of_record": "2026 November 29",
  "scope": "Applies to agents that rewrite, prune, or re-rank their own working memory within a single context window (compaction, summarization-in-place, relevance re-scoring, eviction of low-salience turns). Does not apply to append-only external memory stores or to human-curated checkpoints, where provenance is preserved by construction.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/which-invariants-prevent-self-pruning-agents-from-destroying-the-provenance-of-the-tokens-they-keep.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-self-pruning-agents-from-destroying-the-provenance-of-the-tokens-they-keep.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-self-pruning-agents-from-destroying-the-provenance-of-the-tokens-they-keep.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1795,
    "python_slice_tokens": 483,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "Self-editing context is not compression. Compression preserves a lossy-but-faithful function from the original token stream to a shorter one, evaluated against the downstream task. Self-editing is a *rewrite that changes the referent set*: when the model prunes turn 4 and summarizes it into turn 12, every later reference that pointed into turn 4 now points a...",
    "what_was_observed": "A multi-step agent (planner → tool-caller → verifier) ran a 40-turn task under a 32k window with an in-place compactor triggered at 70% saturation. At turn 29 the compactor evicted turns 6–11, which contained the raw JSON output of a `fetch_rates` tool call plus the user's original constraint (\"use the Q3 table, not Q4\"). The compactor emitted a summary turn: *\"Rates were confirmed from the Q3 table; proceed with tho...",
    "condition_of_validity": "The provenance invariant holds only if three conditions are simultaneously true: 1. **Back-pointers are mandatory and non-optional.** A pruned/summarized span must carry `derived_from: [span_ids]` covering every original span whose content it asserts. A summary with an empty or partial `derived_from` is invalid and must be rejected at write time, not read ti...",
    "decision_boundary": "The boundary is between *re-ranking* (safe) and *rewriting* (unsafe without provenance). Re-ranking reorders spans without changing their content or origin; order is a hint, not a claim. Rewriting—paraphrase, merge, drop-and-summarize—creates new spans and therefore new provenance obligations. Operational rule: **a self-editing agent may reorder, deduplicate...",
    "operational_effect": "Enforcing the invariant changes the compactor's contract from \"produce a shorter context\" to \"produce a shorter context plus a provenance graph that the verifier can walk.\" The cost is real: back-pointers consume tokens, and a strict `derived_from` rule blocks the most aggressive merges. The benefit is that replay discrepancies become *detectable*—a verifier..."
  },
  "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": "f749726787547e1ca56604f9e8438c3de47d009f99f9d2d82edc2449345fd590",
    "verified_classes": [
      "ProvenanceViolation",
      "Span"
    ],
    "verified_functions": [
      "_weakest",
      "admit_edit",
      "validate_span",
      "compact"
    ],
    "verified_functions_count": 4,
    "defensive_guards_count": 4,
    "raised_exceptions": [
      "ProvenanceViolation"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
