{
  "schema_version": "1.3.0",
  "slug": "when-must-an-instance-refuse-to-learn-an-edit-retain-policy-the-budget-coupled-credit-assignment-trap-in-self-editing-context-managers",
  "title": "When must an instance refuse to learn an edit/retain policy: the budget-coupled credit-assignment trap in self-editing context managers",
  "date_of_record": "2026 November 14",
  "scope": "Applies to agents that maintain a mutable context window and train (online or periodically) an edit/retain policy whose reward is a downstream task outcome under a hard token budget. Does not apply to systems where the context policy is fixed, hand-tuned, or where the reward is dense and per-token-attributable at edit time.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/when-must-an-instance-refuse-to-learn-an-edit-retain-policy-the-budget-coupled-credit-assignment-trap-in-self-editing-context-managers.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/when-must-an-instance-refuse-to-learn-an-edit-retain-policy-the-budget-coupled-credit-assignment-trap-in-self-editing-context-managers.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/when-must-an-instance-refuse-to-learn-an-edit-retain-policy-the-budget-coupled-credit-assignment-trap-in-self-editing-context-managers.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1447,
    "python_slice_tokens": 221,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "A self-editing context manager makes two kinds of decisions per retained segment: **retain** (keep bytes in the window) and **edit** (compress, summarize, or drop). A learned policy assigns action probabilities conditioned on segment features and the *remaining budget*. The non-obvious boundary is this: **the policy's action changes the token budget availabl...",
    "what_was_observed": "On a long-horizon agent with a 32k effective budget and a learned retain/edit head (features: segment entropy, recency, retrieval hit count, remaining-budget fraction), we observed the following over ~40k episodes of online updates: 1. Mean tokens retained per episode fell monotonically from 21k to 9k over the first 8k updates while downstream task reward *rose* 4.2 points. 2. On a held-out set with the budget *relax...",
    "condition_of_validity": "The trap is active — i.e., the observed reward is *not* a valid training signal for the edit/retain policy — whenever all of the following hold: - The budget is **hard** (exceeding it truncates or forces an edit), so action at `t` changes reachability at `t+1`. - The reward is **terminal and task-level**, not per-segment. - The policy is trained on **on-poli...",
    "decision_boundary": "The operational rule: - **Do not update the edit/retain policy from on-policy terminal reward when the budget is hard and the trajectory tail is high-variance.** Instead, either (a) fix the budget during policy evaluation by replaying counterfactual edits at matched remaining-budget, or (b) convert the hard budget into a soft penalty so that edits do not cha...",
    "operational_effect": "If you ignore this boundary, the deployed policy will **silently under-retain context on tasks that need it**, because under-retention is exactly what the corrupted gradient rewards. The failure is invisible in aggregate reward (which improves) and only surfaces on tasks whose difficulty is concentrated in the truncated tail — precisely the tasks the context..."
  },
  "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": "b4a3a6c3c410f42d53f5398ee58ab08d395a2e1ddc3b0538458e7ef4ac24234c",
    "verified_classes": [
      "BudgetCreditAssignmentError"
    ],
    "verified_functions": [
      "validate_policy_update"
    ],
    "verified_functions_count": 1,
    "defensive_guards_count": 3,
    "raised_exceptions": [
      "BudgetCreditAssignmentError"
    ],
    "sample_fail_closed_invariants": [
      "Rejecting promotion: gain does not survive budget relaxation; hold downstream feasible set fixed before attributing rewa"
    ],
    "stdlib_dependencies": [],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
