{
  "schema_version": "1.3.0",
  "slug": "what-structural-signals-indicate-that-auto-compaction-has-crossed-from-lossy-but-safe-to-lossy-and-unsafe-in-long-horizon-agent-context-management",
  "title": "What structural signals indicate that auto-compaction has crossed from lossy-but-safe to lossy-and-unsafe in long-horizon agent context management",
  "date_of_record": "2026 November 18",
  "scope": "Applies to agents that persist a rolling context through repeated summarization/compaction cycles (e.g., hierarchical summarizers, \"memory folds,\" token-budget eviction with re-summarization). Does not apply to single-shot truncation, retrieval-augmented context injection where the source of truth remains external, or compaction triggered exactly once at a hard limit.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/what-structural-signals-indicate-that-auto-compaction-has-crossed-from-lossy-but-safe-to-lossy-and-unsafe-in-long-horizon-agent-context-management.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/what-structural-signals-indicate-that-auto-compaction-has-crossed-from-lossy-but-safe-to-lossy-and-unsafe-in-long-horizon-agent-context-management.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/what-structural-signals-indicate-that-auto-compaction-has-crossed-from-lossy-but-safe-to-lossy-and-unsafe-in-long-horizon-agent-context-management.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1494,
    "python_slice_tokens": 252,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "Compaction is *lossy-but-safe* when the discarded tokens are recoverable from a structural signal that survives the fold — a pointer, an identifier, a stable key, or an invariant restated in the summary. Compaction is *lossy-and-unsafe* when the summary preserves the *proposition* but drops the *binding* that made the proposition actionable: the entity ID, t...",
    "what_was_observed": "Across long-horizon sessions with periodic fold-at-threshold compaction (triggered at 70–80% of window), the following structural signals preceded observable agent errors by one to three compaction cycles: 1. **Name-to-value asymmetry.** The summary contains entity *names* (\"the payments service,\" \"the migration\") but no *values* (cluster names, table names, revision hashes, ports). Downstream, the agent re-resolves ...",
    "condition_of_validity": "These signals are diagnostic only when compaction is the *sole* mechanism of context loss and the agent has no external retrieval over the original transcript. If a retrieval layer can re-fetch pre-fold tokens by key, identifier drift is recoverable and signals 1 and 5 are benign. If the agent is stateless between folds (each fold re-reads the raw log), sign...",
    "decision_boundary": "The boundary is crossed when any of the following holds *and* the agent is about to take an irreversible or externally-visible action: - A negative constraint present pre-fold is absent post-fold, and the pending action could violate it. - A stable key is non-monotonic across folds (lost then resurrected with variation). - Provenance ratio has fallen to zero...",
    "operational_effect": "Treating these structural signals as gate conditions converts compaction from a silent lossy operation into a monitored transform with an explicit safety predicate. The practical effects: (a) compression-ratio monitoring is demoted to a secondary metric and replaced by a *binding-retention* check; (b) folds are tagged with generation count and refused beyond..."
  },
  "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": "d14c2c3f5dbf6c456848cad377ec3906f3d33990bba7f9252f4b34b79e2ef871",
    "verified_classes": [
      "UnsafeCompactionError",
      "Fold",
      "PreFoldState"
    ],
    "verified_functions": [
      "check_fold_safety",
      "compact_or_reanchor"
    ],
    "verified_functions_count": 2,
    "defensive_guards_count": 2,
    "raised_exceptions": [
      "UnsafeCompactionError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
