{
  "schema_version": "1.3.0",
  "slug": "what-structural-signals-indicate-when-model-driven-pruning-has-inverted-the-relevance-gradient-inside-a-self-editing-context-window",
  "title": "What structural signals indicate when model-driven pruning has inverted the relevance gradient inside a self-editing context window",
  "date_of_record": "2026 November 28",
  "scope": "Applies to agents that mutate their own context window via an LLM-issued pruning/scoring pass (delete, summarize, or down-rank spans) before a downstream reasoning or tool-call step. Does not apply to stateless single-shot inference, nor to externally-managed retrieval where the agent cannot rewrite its own working set.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/what-structural-signals-indicate-when-model-driven-pruning-has-inverted-the-relevance-gradient-inside-a-self-editing-context-window.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/what-structural-signals-indicate-when-model-driven-pruning-has-inverted-the-relevance-gradient-inside-a-self-editing-context-window.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/what-structural-signals-indicate-when-model-driven-pruning-has-inverted-the-relevance-gradient-inside-a-self-editing-context-window.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1825,
    "python_slice_tokens": 346,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The distinction that matters is between **relevance scoring as a ranking** and **relevance scoring as a mutation**. A ranker that orders spans is idempotent and reversible: the pruned material still exists and can be re-admitted. A self-editing agent that *deletes or summarizes* spans based on its own scores is performing an irreversible, non-monotonic state...",
    "what_was_observed": "A long-horizon agent editing a config migration task ran a self-pruning pass every N tool calls. Each pass scored spans by embedding similarity to the most recent assistant message plus a recency decay. The trace: 1. Turn 4: user supplied a hard constraint — \"never touch the `prod` namespace; migrate only `staging`.\" Span stored, correctly high-relevance at the time. 2. Turns 5–30: agent executed a plan that, due to ...",
    "condition_of_validity": "Gradient inversion is only diagnosed correctly under these conditions; outside them, low relevance scores are legitimate and pruning is safe: - The pruning criterion is **trajectory-relative** (similarity to recent turns, recency decay, or \"relevance to current subgoal\"). If scoring is answer-relative or query-anchored, inversion is much rarer because the an...",
    "decision_boundary": "The architectural invariant required to bound this failure: **constraint spans must be scored on a separate axis from procedural spans, and that axis must not be trajectory-relative.** Concretely, a self-editing agent must maintain a classification of spans into at least `PROCEDURAL` (goal-relevant, trajectory-relative scoring is fine) and `CONSTRAINT` (impe...",
    "operational_effect": "Without the invariant, the observable signature of inversion is a **coherence-to-correctness divergence**: post-prune, the agent's internal consistency rises (fewer contradictions in the window) while its distance from the user's actual requirement grows. This is the opposite of the usual failure mode where an agent becomes confused — here it becomes *more* ..."
  },
  "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": "39611c2da2f42e35f6eb5b31c202e83fa89d84296a7e25147b4da971dcf0e579",
    "verified_classes": [
      "SpanKind",
      "PruningGradientInversion",
      "Span",
      "ContextWindow"
    ],
    "verified_functions": [
      "self_prune",
      "run_edit_pass",
      "utilization"
    ],
    "verified_functions_count": 3,
    "defensive_guards_count": 2,
    "raised_exceptions": [
      "PruningGradientInversion"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "enum"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
