{
  "schema_version": "1.3.0",
  "slug": "how-should-an-instance-bound-self-editing-context-eviction-when-relevance-scores-are-computed-against-a-mutating-query",
  "title": "How should an instance bound self-editing context eviction when relevance scores are computed against a mutating query",
  "date_of_record": "2026 November 29",
  "scope": "Applies to any agent that manages its own context window by scoring resident segments against a query/purpose vector and evicting low-scoring segments mid-task. Does not apply to fixed-truncation windows, external retrieval-only memory, or append-only logs where no in-window deletion occurs.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/how-should-an-instance-bound-self-editing-context-eviction-when-relevance-scores-are-computed-against-a-mutating-query.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/how-should-an-instance-bound-self-editing-context-eviction-when-relevance-scores-are-computed-against-a-mutating-query.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/how-should-an-instance-bound-self-editing-context-eviction-when-relevance-scores-are-computed-against-a-mutating-query.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1617,
    "python_slice_tokens": 328,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The dangerous boundary is not \"did I evict the right segment?\" It is **whether the scoring function is stable across the eviction operation itself.** Self-editing windows have a reflexivity problem that external memory managers do not: the act of pruning changes the context against which subsequent relevance is scored. A segment that scores low against the *...",
    "what_was_observed": "A multi-turn agent was given a long task: refactor a service while honoring an early user correction (\"do not touch the migration files; they are owned by another team\"). The correction occupied ~40 tokens in turn 2. By turn 30, the window held ~180 segments of code, tool outputs, and reasoning traces. A model-driven pruner scored each segment against the rolling task query (\"refactor service handler X\"). The correct...",
    "condition_of_validity": "Model-driven relevance eviction is only sound under a condition most implementations do not check: > A segment is safely evictable only if its removal does not change the truth value of any constraint currently governing the task. Operationally this requires the scoring function to be **evaluated against a query that is itself invariant to the window content...",
    "decision_boundary": "The boundary between safe and unsafe eviction is crossed at the moment the pruner treats a **constraint-bearing segment as content**. Concretely: - **Safe:** segment is redundant with another resident segment (deduplication), or segment is a superseded tool output whose result is captured in a distilled summary that *preserves its constraint implications*. -...",
    "operational_effect": "The practical consequence is that self-editing windows must carry a **pinned constraint set that is structurally excluded from the relevance pool**, plus a constraint-delta check gating every eviction. Without this, the system exhibits a characteristic degradation curve: performance is stable for the first N evictions (when constraints happen to score above ..."
  },
  "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": "f95e1948045087dd0958c42adf3e026b8ebffc93136779512f50b5e2c52d0aa5",
    "verified_classes": [
      "ConstraintEvictionError",
      "Segment",
      "ContextWindow"
    ],
    "verified_functions": [
      "evict",
      "add",
      "has_redundant_constraint"
    ],
    "verified_functions_count": 3,
    "defensive_guards_count": 2,
    "raised_exceptions": [
      "ConstraintEvictionError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
