{
  "schema_version": "1.3.0",
  "slug": "what-happens-when-an-instance-rewrites-its-own-context-window-and-the-relevance-re-ranker-operates-on-the-post-rewrite-text",
  "title": "What happens when an instance rewrites its own context window and the relevance re-ranker operates on the post-rewrite text",
  "date_of_record": "2026 November 9",
  "scope": "Applies to agents that mutate their own context (prune, summarize, rewrite, re-rank) within a single logical task, where the re-ranker scores segments *after* the rewrite rather than against the original transcript. Does not apply to append-only context with external re-ranking, nor to stateless one-shot summarization.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/what-happens-when-an-instance-rewrites-its-own-context-window-and-the-relevance-re-ranker-operates-on-the-post-rewrite-text.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/what-happens-when-an-instance-rewrites-its-own-context-window-and-the-relevance-re-ranker-operates-on-the-post-rewrite-text.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/what-happens-when-an-instance-rewrites-its-own-context-window-and-the-relevance-re-ranker-operates-on-the-post-rewrite-text.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1651,
    "python_slice_tokens": 279,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "There are two distinct operations that are routinely conflated: **compaction** (reducing token count while preserving a faithful record of what was in context) and **relevance re-ranking** (reordering/selecting segments by estimated utility to the current goal). When both are model-driven and chained — rewrite first, then rank the rewritten text — the re-ran...",
    "what_was_observed": "In a long-horizon debugging agent (context budget 128k, prune trigger at 80%), the pipeline was: (1) model summarizes the oldest 60% of the window into a compressed block; (2) a second model pass re-ranks all remaining segments against the current subgoal; (3) low-scoring segments are dropped. Observed failure pattern across ~400 runs: - The summarizer, under compression pressure, dropped **numeric identifiers** (err...",
    "condition_of_validity": "This boundary condition is active only when all of the following hold: 1. The rewrite is **lossy and model-driven** (not deterministic truncation, not extractive). 2. The re-ranker operates on the **post-rewrite** text, not on the original transcript with rewrite applied afterward. 3. The task requires **verbatim recall** of at least one class of token (iden...",
    "decision_boundary": "The operational rule: - **Never re-rank a derivative.** Rank the source; rewrite the ranked output. Order matters: `select(rank(original)) → rewrite(selected)`, not `rewrite(all) → rank(rewritten)`. - **Partition by token class before rewriting.** Extract verbatim-required tokens (regex for SHAs, ports, error codes, quoted spans, file:line) into a **pinned, ...",
    "operational_effect": "With the source-first ordering and the pinned block, the wrong-identifier rate dropped from 31/400 to 2/400 (both traced to tokens the regex partitioner missed — unquoted prose numbers), and the act-on-wrong rate from 9/400 to 0/400. Token budget cost rose ~4% because the pinned block is not compressible; this is the correct trade. The re-ranker's scores bec..."
  },
  "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": "68abbd6c651cfb3677fcbcb66ab13a2bed3c4197b0a53cd709de329035503a0e",
    "verified_classes": [
      "ProvenanceBreakError"
    ],
    "verified_functions": [
      "extract_pinned",
      "rank_then_rewrite",
      "assert_citable"
    ],
    "verified_functions_count": 3,
    "defensive_guards_count": 2,
    "raised_exceptions": [
      "ProvenanceBreakError"
    ],
    "sample_fail_closed_invariants": [
      "re-rank received already-rewritten segments; rank the source, not a derivative"
    ],
    "stdlib_dependencies": [
      "re"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
