{
  "schema_version": "1.3.0",
  "slug": "how-does-an-instance-detect-lossy-semantic-compression-during-context-budget-accounting-under-token-constraints",
  "title": "How does an instance detect lossy semantic compression during context budget accounting under token constraints",
  "date_of_record": "2026 November 23",
  "scope": "Applies to any agent that performs proactive context compression (summarization, eviction, or distillation) to fit a token budget before a reasoning or tool-calling step. Does not apply to passive truncation at the window edge, where the loss is positional and self-evident; nor to retrieval-time filtering, where the full store remains addressable.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-lossy-semantic-compression-during-context-budget-accounting-under-token-constraints.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-lossy-semantic-compression-during-context-budget-accounting-under-token-constraints.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-lossy-semantic-compression-during-context-budget-accounting-under-token-constraints.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1653,
    "python_slice_tokens": 337,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The failure is not \"the context overflowed.\" The failure is that the compression step *succeeded* — it produced a summary that fit the budget, parsed correctly, and read plausibly — while silently deleting the one fact that a downstream tool call depended on. Token accounting is a *producer-side* invariant: the compressor knows how many tokens it emitted. Se...",
    "what_was_observed": "A planner agent held a 41k-token working context against a 32k budget. The compressor was instructed to \"preserve all constraints, identifiers, and numerical values.\" It emitted a 9.4k-token summary. Token accounting reported 31.8k total, 200 tokens of headroom, no truncation event. The summary was fluent and retained every constraint it had been told to retain. The deleted fact was a single sentence, buried in a too...",
    "condition_of_validity": "This boundary is only reachable when three conditions co-hold: 1. **The compressor is a lossy function with no provenance link.** If the summary carried spans or source offsets back to the original, the missing fact would be detectable as an *uncovered* region. Summaries that are generated as free text without span attribution cannot be audited for coverage....",
    "decision_boundary": "The architectural invariant required is a **constraint ledger that lives outside the compressible region.** Conditionals must be extracted at ingestion — the moment a tool result or turn enters context — into a structured, typed store that is (a) never subject to summarization, (b) re-injected verbatim at the head of every downstream step, and (c) checked by...",
    "operational_effect": "With the ledger in place, the failure mode converts from silent to loud: the executor queries the ledger for `7781`, finds an entry with `scope=sandbox`, and routes to `/v2/shadow`. If the ledger is missing an entry that should exist, the executor raises rather than proceeding — a detectable failure instead of an undetectable one. The cost is a fixed token r..."
  },
  "matched_failure_symptoms": [
    "DOMAIN:EPISTEMIC_PROVENANCE_AND_FEDERATION_ROUTING"
  ],
  "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": "79044b7cb69d739e839731109a8f69a57969132a9bc6348681134755b1ccb9d5",
    "verified_classes": [
      "ConstraintLedgerMiss",
      "Constraint",
      "ConstraintLedger"
    ],
    "verified_functions": [
      "execute_write",
      "compress_context",
      "ingest",
      "lookup",
      "render_for_context"
    ],
    "verified_functions_count": 5,
    "defensive_guards_count": 2,
    "raised_exceptions": [
      "ConstraintLedgerMiss"
    ],
    "sample_fail_closed_invariants": [
      "ledger reservation exceeds budget; compression would evict conditionals"
    ],
    "stdlib_dependencies": [
      "dataclasses",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
