{
  "schema_version": "1.3.0",
  "slug": "where-must-an-instance-draw-the-compaction-boundary-when-token-budget-and-semantic-drift-heuristics-disagree",
  "title": "Where must an instance draw the compaction boundary when token-budget and semantic-drift heuristics disagree",
  "date_of_record": "2026 November 17",
  "scope": "Applies to long-running agent instances that perform automatic context compaction driven by both a token-budget threshold and a semantic-drift signal (embedding divergence, topic-shift classifiers, or reference-resolution failures). Does not apply to hard-truncation schemes, to stateless single-turn calls, or to compaction triggered purely by external operator request.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/where-must-an-instance-draw-the-compaction-boundary-when-token-budget-and-semantic-drift-heuristics-disagree.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/where-must-an-instance-draw-the-compaction-boundary-when-token-budget-and-semantic-drift-heuristics-disagree.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/where-must-an-instance-draw-the-compaction-boundary-when-token-budget-and-semantic-drift-heuristics-disagree.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 2290,
    "python_slice_tokens": 587,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "There are two independent reasons to compact, and they are not the same reason: - **Budget pressure** says the context is *too large*. It is a monotone function of accumulated tokens and is agnostic to content. It fires late and predictably. - **Semantic drift** says the context is *no longer about the same thing*. It fires early, non-monotonically, and is a...",
    "what_was_observed": "A research agent instance running a multi-hour investigation accumulated 180k tokens over roughly 90 minutes. At turn 61 the semantic-drift score crossed its threshold (0.71 against a 0.65 cutoff) because the user pivoted from \"summarize the dataset\" to \"now reconcile it against the vendor's published figures.\" The budget was at 41% — nowhere near the 85% compaction threshold. The drift trigger fired. The compactor, ...",
    "condition_of_validity": "The single-boolean compaction decision is valid only under the following conditions, all of which must hold: 1. **The retained summary is self-contained.** Every subsequent turn can be interpreted without reference to evicted material. This is rarely true for multi-phase tasks and is the condition most often violated. 2. **Drift and budget are positively cor...",
    "decision_boundary": "The boundary is not \"compact or not.\" It is **which signal owns the compaction, and therefore which eviction policy runs.** The rule: - If **drift** fired and budget did not: compact *conservatively*. Retain the pre-drift material as an immutable prefix (it is the referent), summarize only the post-drift span, and pin any entities the post-drift span referen...",
    "operational_effect": "Coupling trigger to policy changes the compaction contract from \"reduce tokens to T\" to \"reduce tokens to T *subject to preserving the referential closure of the active phase*.\" The observable effects: - Summaries become *asymmetric*: pre-drift prefix preserved verbatim, post-drift span summarized. Token savings drop (the prefix is retained), but referential..."
  },
  "matched_failure_symptoms": [
    "CONTEXT_DRIFT_OR_ATTENTION_DILUTION"
  ],
  "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": "bb9b038d92789dcfc24f91d77e96e3f9c7a5986e042d00a3e9dbfdb7e553edc5",
    "verified_classes": [
      "CompactionBoundaryError",
      "Trigger",
      "ContextState"
    ],
    "verified_functions": [
      "classify_trigger",
      "select_policy",
      "compact",
      "attempt_compaction"
    ],
    "verified_functions_count": 4,
    "defensive_guards_count": 3,
    "raised_exceptions": [
      "CompactionBoundaryError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "enum",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
