{
  "schema_version": "1.3.0",
  "slug": "which-invariants-prevent-semantic-dedup-compaction-from-silently-erasing-the-only-witness-of-a-causal-edge",
  "title": "Which invariants prevent semantic-dedup compaction from silently erasing the only witness of a causal edge",
  "date_of_record": "2026 November 26",
  "scope": "Applies to long-horizon agent traces compacted by semantic deduplication plus lossy summarization (rolling window / hierarchical summary trees / embedding-clustered episode merging). Does not apply to append-only traces that are never rewritten, nor to compaction that preserves a full lossless event log alongside summaries.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/which-invariants-prevent-semantic-dedup-compaction-from-silently-erasing-the-only-witness-of-a-causal-edge.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-semantic-dedup-compaction-from-silently-erasing-the-only-witness-of-a-causal-edge.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-semantic-dedup-compaction-from-silently-erasing-the-only-witness-of-a-causal-edge.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1763,
    "python_slice_tokens": 284,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "There are two classes of content in an agent trace, and they are not distinguished by length, importance, or embedding similarity: - **Payload**: the observable result of a step — a tool return value, a file body, a fetched document. Payload is *reconstructible or re-derivable*. If you drop it, the agent can re-run the tool or re-fetch. - **Witness**: the re...",
    "what_was_observed": "A 40-hour agent trace, ~180k tokens, compacted by clustering chunks at cosine ≥ 0.92 and replacing each cluster with the longest chunk plus a one-line summary. The trace contained a long-horizon task with a mid-run branch: at step 1,204 the agent called `read_config` and received `{retries: 3}`; at step 3,887, after a config reload, it called `read_config` again and received `{retries: 0}`. The two tool returns are t...",
    "condition_of_validity": "The dedup-then-summarize pipeline is safe **only if** the following invariant holds: > **Temporal-distinctness invariant:** Two chunks may be merged only if they are *observationally equivalent at the time of merge* — i.e., merging them cannot change any decision the agent would make from the compacted state. Equivalently: for any mutable observation, the co...",
    "decision_boundary": "The boundary is whether a chunk is **payload or witness**, and the decision must be made *before* dedup, not after: - If a chunk is re-derivable from a tool call (a fetched document, a file body), dedup by similarity is safe; drop freely, the agent can re-fetch. - If a chunk records that a transition *occurred* (a tool returned X at time T, a branch was take...",
    "operational_effect": "The concrete guardrail is a **two-tier trace**: an immutable event ledger (append-only, keyed by `(tool, args, timestamp)`, never similarity-deduped) and a mutable summary layer that *references* ledger entries by key. Compaction operates only on the summary layer; the ledger is the ground truth the summary is checked against. On resume, the agent reads the ..."
  },
  "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": "49d37391e33afcf7ee2d1ee87e329cd1d5c615e67fba8aef115fedbf59a43a55",
    "verified_classes": [
      "WitnessLossError",
      "Chunk",
      "Ledger"
    ],
    "verified_functions": [
      "compact",
      "_similar",
      "record",
      "latest"
    ],
    "verified_functions_count": 4,
    "defensive_guards_count": 1,
    "raised_exceptions": [
      "WitnessLossError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
