{
  "schema_version": "1.3.0",
  "slug": "which-invariants-prevent-lossy-compaction-from-silently-violating-reconstructed-tool-call-preconditions-in-long-horizon-agent-sessions",
  "title": "Which invariants prevent lossy compaction from silently violating reconstructed tool-call preconditions in long-horizon agent sessions",
  "date_of_record": "2026 November 21",
  "scope": "Applies to any agent that performs lossy context compaction (summarization, eviction, or hierarchical rollup) mid-episode while retaining the ability to resume tool execution from a reconstructed state. Does not apply to stateless single-turn agents or to compaction that preserves a verbatim, byte-exact transcript.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/which-invariants-prevent-lossy-compaction-from-silently-violating-reconstructed-tool-call-preconditions-in-long-horizon-agent-sessions.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-lossy-compaction-from-silently-violating-reconstructed-tool-call-preconditions-in-long-horizon-agent-sessions.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-lossy-compaction-from-silently-violating-reconstructed-tool-call-preconditions-in-long-horizon-agent-sessions.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1912,
    "python_slice_tokens": 268,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The failure is not \"the summary forgot something.\" The failure is that the compaction operator is **non-idempotent with respect to tool-call preconditions**: the summary preserves the *semantic* result of a prior tool call (\"fetched user record, status active\") while discarding the *operational preconditions* that made a subsequent call valid (the exact reso...",
    "what_was_observed": "A long-horizon agent (≈340 turns) driving a multi-step data-migration workflow hit the context ceiling at turn 212 and triggered hierarchical compaction. The compactor rolled the first 180 turns into a 1,400-token summary. The summary contained the sentence: *\"Connection to staging DB established; schema v4 confirmed; migration batch cursor positioned after row 50,000.\"* Three facts were true at compaction time and f...",
    "condition_of_validity": "A compaction is safe to resume from **iff** every precondition that a post-resume tool call depends on satisfies at least one of: - **(a) Re-derivable:** the precondition can be cheaply re-fetched from the live system before use (e.g., re-open the connection, re-read the schema version). - **(b) Opaque-preserved:** the precondition is carried through compact...",
    "decision_boundary": "The boundary is **where the compactor's salience model diverges from the tool layer's precondition model**. These are two independent models and nothing forces them to agree. The compactor optimizes for token efficiency and narrative coherence; the tool layer requires exact identity of handles, versions, and scopes. A precondition that is *narratively minor*...",
    "operational_effect": "The architectural guardrail is a **precondition ledger** that lives outside the compactable context and is consulted at every resume. The ledger is append-only, stores preconditions as opaque typed records (not prose), and is *never* summarized — it is queried. Compaction summarizes the transcript; the ledger is the source of truth for what the agent is allo..."
  },
  "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": "5b91dc4c9fad4dffa4dc6a683a69eb101484fffb1017a64eb95be02eb779ca34",
    "verified_classes": [
      "PreconditionViolation",
      "PreconditionLedger"
    ],
    "verified_functions": [
      "resume_migration",
      "__init__",
      "record",
      "invalidate",
      "require"
    ],
    "verified_functions_count": 5,
    "defensive_guards_count": 4,
    "raised_exceptions": [
      "PreconditionViolation"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
