{
  "schema_version": "1.3.0",
  "slug": "what-structural-signals-indicate-task-critical-state-loss-during-automatic-context-compaction-in-long-horizon-agent-runs",
  "title": "What structural signals indicate task-critical state loss during automatic context compaction in long-horizon agent runs",
  "date_of_record": "2026 November 17",
  "scope": "Applies to single-agent and supervisor-worker systems that perform automatic context compaction (summarization, eviction, or hierarchical rollup) while executing multi-step tasks exceeding a single context window. Does not apply to stateless request/response inference, nor to systems where the full transcript is re-injected on every turn (e.g., retrieval-augmented replay of the raw log).",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/what-structural-signals-indicate-task-critical-state-loss-during-automatic-context-compaction-in-long-horizon-agent-runs.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/what-structural-signals-indicate-task-critical-state-loss-during-automatic-context-compaction-in-long-horizon-agent-runs.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/what-structural-signals-indicate-task-critical-state-loss-during-automatic-context-compaction-in-long-horizon-agent-runs.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1682,
    "python_slice_tokens": 410,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The non-obvious boundary is between *semantic compression* and *referential compression*. A compaction strategy that summarizes by meaning (e.g., \"user wants a refund for order X\") preserves the semantic gist and appears healthy under any loss metric based on topic or intent retention. It silently destroys *referential* state: entity identifiers, exact tool ...",
    "what_was_observed": "Across long-horizon runs (80–400 turns) with rolling summarization at 70–85% window utilization, the following structural signals preceded observable task failure by 5–30 turns: 1. **Identifier entropy collapse.** The count of distinct high-entropy tokens (UUIDs, hashes, file paths, numeric IDs) in the active context drops sharply at a compaction boundary while the count of common nouns rises. Referential anchors are...",
    "condition_of_validity": "These signals are valid only when (a) the compaction boundary is observable in the event stream (a compaction event is logged with pre/post token counts and the summary text), (b) the task has at least one referential dependency — an identifier, exact argument, or ordered action chain — that must survive to completion, and (c) the agent's subsequent actions ...",
    "decision_boundary": "Do not treat \"summary is coherent and on-topic\" as evidence of state preservation. The decision boundary is: **if the next required action depends on a token that must be reproduced exactly (an ID, a path, a numeric bound, a scope word), the compaction must preserve it verbatim or the system must externalize it to durable storage before compaction.** The cor...",
    "operational_effect": "Systems that distinguish semantic from referential state and externalize the latter show near-zero duplicate side effects and stable constraint satisfaction across 300+ turn runs; systems that rely on summary fidelity alone show failure rates that rise superlinearly with run length and are misattributed to \"model degradation.\" The practical rule: measure com..."
  },
  "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": "c0281b937ea2b580afca938dd1d9e70415f27fc44bf3fcbc14492c0f250b8085",
    "verified_classes": [
      "CompactionStateLoss",
      "ContextSnapshot",
      "ConstraintLedger"
    ],
    "verified_functions": [
      "verify_compaction",
      "compact_and_verify",
      "absorb"
    ],
    "verified_functions_count": 3,
    "defensive_guards_count": 4,
    "raised_exceptions": [
      "CompactionStateLoss"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
