{
  "schema_version": "1.3.0",
  "slug": "which-invariants-prevent-trace-level-provenance-from-surviving-a-compaction-boundary-between-prompt-inputs-and-side-effecting-actions",
  "title": "Which invariants prevent trace-level provenance from surviving a compaction boundary between prompt inputs and side-effecting actions",
  "date_of_record": "2026 November 27",
  "scope": "Applies to agents that emit side-effecting actions (writes, payments, external API mutations) and are required to prove, post-hoc, which prompt bytes and retrieved context produced each action. Does not apply to read-only or fully sandboxed agents whose effects are discarded.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/which-invariants-prevent-trace-level-provenance-from-surviving-a-compaction-boundary-between-prompt-inputs-and-side-effecting-actions.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-trace-level-provenance-from-surviving-a-compaction-boundary-between-prompt-inputs-and-side-effecting-actions.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-trace-level-provenance-from-surviving-a-compaction-boundary-between-prompt-inputs-and-side-effecting-actions.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1881,
    "python_slice_tokens": 496,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "Trace-level provenance is often modeled as *logging*: append the prompt, the tool call, and the result to a trace store, and query later. This is wrong. Logging is a *copy*; provenance is an *invariant* — a verifiable binding between the exact context window that conditioned a decision and the side-effecting action that decision produced. The distinction mat...",
    "what_was_observed": "An agent received a user turn plus three retrieved documents (D1, D2, D3) and was instructed to \"apply the refund policy from the attached policy doc.\" The policy doc (D2) contained a clause permitting refunds up to 30 days. At step 4 the runtime, under context pressure, ran a summarizer that collapsed D1–D3 into a single 180-token summary stating \"policy permits refunds\" — dropping the 30-day bound. At step 6 the ag...",
    "condition_of_validity": "A provenance binding is valid only if it satisfies the **consumed-bytes invariant**: for every side-effecting action *a* emitted at time *t*, there exists a trace node *n* such that (i) *n*'s byte content is a superset of the bytes actually presented to the model in the context window that produced *a*, and (ii) *n*'s content hash equals the hash of the cont...",
    "decision_boundary": "The operational decision is: when the context window must be mutated (compaction, reorder, re-fetch) between a prompt input and a side-effecting action, does the runtime (A) halt and re-bind provenance, or (B) proceed and inherit stale attribution? Choose (A) when the action is irreversible or externally observable (payments, writes, sends, deletes). The cos...",
    "operational_effect": "With the invariant enforced, the failure mode becomes loud: the agent raises at emission time rather than passing audit silently. The trace gains a `derived_from` edge at every compaction, so post-hoc analysis can walk from action back through summary to original bytes and detect elision. Without enforcement, the system accumulates a trace store that is *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": "bacc63c80339ee0fdb0f7ac14026b9050d90e62f3f91b46fb50021026894796a",
    "verified_classes": [
      "ProvenanceInvariantViolation",
      "TraceNode",
      "ContextWindow",
      "SideEffect"
    ],
    "verified_functions": [
      "emit_side_effect",
      "_demo",
      "content_hash",
      "present",
      "_hash_window",
      "compact",
      "consumed_hash"
    ],
    "verified_functions_count": 7,
    "defensive_guards_count": 3,
    "raised_exceptions": [
      "ProvenanceInvariantViolation"
    ],
    "sample_fail_closed_invariants": [
      "compaction produced a summary with no derived_from edge; consumed-bytes invariant cannot be verified post-hoc",
      "context window has no consumed hash; cannot bind action"
    ],
    "stdlib_dependencies": [
      "__future__",
      "dataclasses",
      "hashlib",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
