{
  "schema_version": "1.3.0",
  "slug": "why-does-an-instance-resurrect-pruned-spans-when-self-editing-context-policies-are-scored-against-the-post-edit-window",
  "title": "Why does an instance resurrect pruned spans when self-editing context policies are scored against the post-edit window",
  "date_of_record": "2026 November 28",
  "scope": "Applies to agents that maintain their own context via model-driven pruning, rewriting, or relevance-scored retention, where the scoring pass reads the same buffer it mutates. Does not apply to append-only logs with external, immutable retention scoring.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/why-does-an-instance-resurrect-pruned-spans-when-self-editing-context-policies-are-scored-against-the-post-edit-window.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/why-does-an-instance-resurrect-pruned-spans-when-self-editing-context-policies-are-scored-against-the-post-edit-window.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/why-does-an-instance-resurrect-pruned-spans-when-self-editing-context-policies-are-scored-against-the-post-edit-window.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1946,
    "python_slice_tokens": 295,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "There are two ways a relevance-scored retention policy can be defined, and they diverge exactly when the policy is self-editing: - **Pre-edit scoring (static):** every span in the window is scored once against the *original* query/task state, then spans below threshold are dropped. The scoring function is a pure function of `(span, task)`. - **Post-edit scor...",
    "what_was_observed": "A 40-turn tool-using agent ran a self-editing policy: after each turn, a small scorer ranked spans by relevance to a rolling task embedding, dropped the bottom 30%, and rewrote the top spans into compressed form. The buffer was capped at 8k tokens with a hard eviction at 9.5k. The trace showed a repeating three-phase signature, period ≈ 4 turns: 1. **Prune phase (turn N):** span `S_7` (a tool error trace, relevance 0...",
    "condition_of_validity": "The oscillation is bounded (does not occur) only when all three hold: - **Scoring is pre-edit and immutable.** The relevance score for a span is computed once, against a frozen task snapshot, and is not recomputed after the window mutates. This makes scoring a pure function and breaks the feedback loop. - **Rewrites are not re-scorable as evidence.** A rewri...",
    "decision_boundary": "The boundary is whether the retention scorer's input set overlaps its output set. - **Disjoint (safe):** scorer reads `W_t`, writes `W_{t+1}` where `W_{t+1} ⊆ W_t \\ pruned ∪ new_evidence`, and `new_evidence` is never a function of `pruned`. This is a contracting map; window size is monotone non-increasing absent new evidence, and total retained tokens are bo...",
    "operational_effect": "Enforcing the invariant changes three things: 1. **Scoring becomes a frozen snapshot.** The task embedding used for relevance is captured at policy-instantiation time and refreshed only on explicit task-boundary events, not per turn. This costs some adaptivity but eliminates drift-driven resurrection. 2. **Rewrites get a separate lifecycle.** Derived spans a..."
  },
  "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": "37ef0e67f14b5b6b212fffae4179c4ea8e052af0bcece95961fd92c1f8f04ac6",
    "verified_classes": [
      "ResurrectionInvariantError",
      "Span",
      "SelfEditingContext"
    ],
    "verified_functions": [
      "__init__",
      "__init__",
      "prune",
      "score_candidates",
      "retrieve",
      "enforce"
    ],
    "verified_functions_count": 6,
    "defensive_guards_count": 5,
    "raised_exceptions": [
      "ResurrectionInvariantError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
