{
  "schema_version": "1.3.0",
  "slug": "how-does-an-instance-detect-that-its-own-context-rewrite-has-orphaned-a-live-dependency",
  "title": "How does an instance detect that its own context rewrite has orphaned a live dependency?",
  "date_of_record": "2026 November 25",
  "scope": "Applies to agents that mutate their own working context (summarize, prune, reorder, or merge segments) mid-task while tool calls, pending futures, or deferred references remain outstanding. Does not apply to append-only context management or to external memory stores that are never inlined into the prompt.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-that-its-own-context-rewrite-has-orphaned-a-live-dependency.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-that-its-own-context-rewrite-has-orphaned-a-live-dependency.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-that-its-own-context-rewrite-has-orphaned-a-live-dependency.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1791,
    "python_slice_tokens": 168,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "There is a difference between *compaction* and *rewriting*. Compaction appends a summary and marks old spans as evictable; the original bytes remain addressable until a garbage-collection step proves no live reference exists. Rewriting replaces the span in place: the model emits a new text region that is supposed to *stand in for* the old one, and the old on...",
    "what_was_observed": "A research agent with a 96k context budget, running a fan-out of 14 `fetch_document(url_i)` calls, triggered its own self-edit heuristic at 78% occupancy. The heuristic was model-driven: the instance was asked to \"restructure the working context for efficiency,\" and it produced a consolidated block that collapsed the fourteen individual tool-call records into a single sentence — *\"Fetching 14 sources on regulatory va...",
    "condition_of_validity": "A self-rewrite of region *R* is valid only if, at the moment of rewrite, the following predicate holds for every outstanding dependency *d*: where `anchor(d)` is the set of context positions that *d* requires to interpret its eventual resolution, and `rebind(d)` is an explicit rewrite of *d*'s recorded intent into the new region. The predicate fails silently...",
    "decision_boundary": "The boundary is drawn at **whether the rewrite is reversible at the byte level**. Two regimes: - **Reversible rewrite (compaction-with-retention):** the old region is retained in an addressable store, the new region carries explicit back-references (`supersedes: span_4412`), and any dependency resolution that fails to bind triggers a rehydration of the origi...",
    "operational_effect": "The guardrail is a **dependency ledger held outside the rewritten region**. Every emitted tool call, every deferred reference, and every task-scoped invariant registers an entry with an anchor span-ID and a resolution handler. The rewrite proposal is checked against the ledger before commit; any proposal that touches a live anchor is either rejected or force..."
  },
  "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": "5bc4081969676914c09b6a94801771e81db8884a8538cf7d3243c78092729655",
    "verified_classes": [
      "OrphanedDependencyError",
      "DependencyLedger"
    ],
    "verified_functions": [
      "commit_self_rewrite",
      "__init__",
      "register",
      "resolve",
      "live_anchors"
    ],
    "verified_functions_count": 5,
    "defensive_guards_count": 1,
    "raised_exceptions": [
      "OrphanedDependencyError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
