{
  "schema_version": "1.3.0",
  "slug": "why-does-an-instance-lose-task-critical-state-when-automatic-context-compaction-treats-tool-call-transcripts-as-uniform-tokens",
  "title": "Why does an instance lose task-critical state when automatic context compaction treats tool-call transcripts as uniform tokens",
  "date_of_record": "2026 November 28",
  "scope": "Applies to long-horizon agent instances that perform automatic context compaction (summarization, head/tail truncation, or relevance-based eviction) while a multi-step tool-using task is in flight. Does not apply to fixed-window agents that hard-fail on overflow, nor to compaction performed only between discrete user turns with a quiescent transcript.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/why-does-an-instance-lose-task-critical-state-when-automatic-context-compaction-treats-tool-call-transcripts-as-uniform-tokens.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/why-does-an-instance-lose-task-critical-state-when-automatic-context-compaction-treats-tool-call-transcripts-as-uniform-tokens.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/why-does-an-instance-lose-task-critical-state-when-automatic-context-compaction-treats-tool-call-transcripts-as-uniform-tokens.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1883,
    "python_slice_tokens": 271,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "There are two structurally different kinds of state in an agent's context: **narrative state** (prose reasoning, plans, observations) and **operational state** (the exact identifiers, schemas, and preconditions that future tool calls depend on). Automatic compaction strategies—whether LLM-summarization or heuristic eviction—are optimized against token salien...",
    "what_was_observed": "An instance running a 40-step infrastructure reconciliation task hit its compaction threshold at step 27. The trigger was a single large tool response (a 41k-token log dump from a `describe_events` call) that pushed usage past the 85% watermark, firing the summarizer mid-task. The summarizer was instructed to \"preserve the plan and recent progress,\" and it did: the post-compaction context contained a coherent paragra...",
    "condition_of_validity": "This failure mode is bounded and predictable. It occurs if and only if all three of the following hold: - **Compaction is triggered by token pressure rather than by task-phase boundaries.** If compaction only runs when the agent is between tool-call chains (no pending call whose arguments are already partially determined), the dependency graph is empty at co...",
    "decision_boundary": "The architectural guardrail is a **pinned operational frame** that is excluded from the compaction input by construction, not by instruction. Concretely: - Maintain a separate `pinned_state` region holding (a) the argument schema of the next N planned tool calls, (b) the literal values already bound to those arguments, and (c) any single-use or rotating toke...",
    "operational_effect": "With the pinned-frame guardrail in place, the failure trace above is interrupted at step 27: the quiescence check sees a pending write call with an unpinned `deployment_uid` and `precondition_token`, and compaction defers. The log dump that triggered pressure is instead evicted by a *scoped* rule that drops only tool responses whose `pinned_fields` manifest ..."
  },
  "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": "a06161989cb3b5828b4e61846728bf266fdf38e9a7da076be039619eaf048f85",
    "verified_classes": [
      "CompactionInvariantViolation",
      "PendingCall",
      "PinnedState"
    ],
    "verified_functions": [
      "compact",
      "try_compact",
      "unpinned_dependencies"
    ],
    "verified_functions_count": 3,
    "defensive_guards_count": 1,
    "raised_exceptions": [
      "CompactionInvariantViolation"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
