{
  "schema_version": "1.3.0",
  "slug": "why-does-an-instance-erase-its-own-recovery-instructions-when-pruning-context-mid-task",
  "title": "Why does an instance erase its own recovery instructions when pruning context mid-task",
  "date_of_record": "2026 November 30",
  "scope": "Applies to agents that hold write authority over their own context window (self-pruning, summarization-in-place, instruction-preserving rewrite) during a multi-step task. Does not apply to read-only retrieval pipelines where an external controller owns compaction.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/why-does-an-instance-erase-its-own-recovery-instructions-when-pruning-context-mid-task.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/why-does-an-instance-erase-its-own-recovery-instructions-when-pruning-context-mid-task.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/why-does-an-instance-erase-its-own-recovery-instructions-when-pruning-context-mid-task.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1759,
    "python_slice_tokens": 423,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "There are two distinct things an agent can do to its own context: *compaction* (lossy reduction of task payload — tool outputs, scratch reasoning, retrieved chunks) and *instruction rewriting* (editing the rules that govern how the agent behaves on subsequent turns). The failure mode here is not that pruning loses information. It is that a self-editing polic...",
    "what_was_observed": "A planning agent running a 40-turn migration task was configured with a self-pruning policy triggered at 78% context occupancy. The policy computed per-span relevance as cosine similarity between the span and the current turn's active goal embedding, then evicted the bottom 30% of spans, with a hard-coded exemption list of three \"critical\" instruction IDs. At turn 22, the active goal had drifted from \"apply schema mi...",
    "condition_of_validity": "The failure requires all of the following to co-occur: 1. **Unified scoring.** Instructions and payload share one relevance function and one eviction ranking. 2. **Dynamic instruction ingress.** Instructions can enter the context through a path (handoff, tool result, mid-task user turn) that does not update the exemption registry. Static, boot-time instructi...",
    "decision_boundary": "The boundary is whether the self-editing policy is allowed to make an *irreversible* decision about a span whose absence would change the agent's future behavior in a way it cannot detect. Two operational rules follow: - **Pin by provenance, not by content.** Any span with `provenance ∈ {handoff, tool_contract, safety}` is pinned at ingress, before relevance...",
    "operational_effect": "An agent that respects the invariant pays a small, bounded cost: a fraction of the window (typically 8–15%) is permanently reserved for pinned instructions and their provenance metadata, and every compaction cycle incurs a recovery-adequacy check whose latency is dominated by external existence probes. In exchange, the failure class is eliminated: no evictio..."
  },
  "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": "edea829ded8744a8dace958ce6e9288655e5582a1d2fca0a3b17c86004c78f5a",
    "verified_classes": [
      "Provenance",
      "UnrecoverablePruneError",
      "Span",
      "ContextStore"
    ],
    "verified_functions": [
      "recovery_adequacy_check",
      "self_edit",
      "ingest",
      "evict_candidates"
    ],
    "verified_functions_count": 4,
    "defensive_guards_count": 1,
    "raised_exceptions": [
      "UnrecoverablePruneError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "enum",
      "hashlib",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
