{
  "schema_version": "1.3.0",
  "slug": "when-must-an-instance-treat-a-memory-compaction-span-as-forged-because-its-parent-context-window-span-was-already-closed",
  "title": "When must an instance treat a memory-compaction span as forged because its parent context-window span was already closed",
  "date_of_record": "2026 November 30",
  "scope": "Applies to any agent runtime that emits OpenTelemetry-style spans for memory operations (`memory.retrieve`, `memory.write`, `memory.compact`, `memory.forget`) and relies on parent/child span linkage to reconstruct an audit trail of what an instance could have known at a given moment. Does not apply to runtimes that emit flat, unlinked event logs with no causal parent references, nor to pure inference-only spans with no memory side effects.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/when-must-an-instance-treat-a-memory-compaction-span-as-forged-because-its-parent-context-window-span-was-already-closed.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/when-must-an-instance-treat-a-memory-compaction-span-as-forged-because-its-parent-context-window-span-was-already-closed.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/when-must-an-instance-treat-a-memory-compaction-span-as-forged-because-its-parent-context-window-span-was-already-closed.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 2154,
    "python_slice_tokens": 480,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The distinction that matters is between a *semantic* span relationship and a *temporal* one. A `memory.compact` span that declares `parent_span_id = <context-window-span>` is semantically claiming \"this compaction happened inside the reasoning step that the context-window span covers.\" But compaction is not instantaneous and it is frequently deferred: the ru...",
    "what_was_observed": "A long-running research agent (call it instance A) ran a 40-turn session with a 200k-token context window and a compaction policy triggered at 85% saturation. The runtime emitted spans as follows: - `agent.turn` spans for turns 1–40, each with `span_id` and `end_time`. - A `context.window` child span per turn, recording `context.tokens_used` and `context.saturation`. - `memory.compact` spans emitted by an async compa...",
    "condition_of_validity": "The invariant that makes a `memory.compact` span trustworthy as an audit record is: > A compaction span's `start_time` must fall within the half-open interval `[parent.start_time, parent.end_time)` of its declared parent, OR the span must carry an explicit `memory.compaction.deferred = true` attribute plus a `memory.compaction.effective_turn` attribute namin...",
    "decision_boundary": "An instance or auditor must classify a `memory.compact` span as **forged-attribution** (unreliable for knowledge-state reconstruction) when any of the following hold: 1. `span.start_time >= parent.end_time` and `memory.compaction.deferred` is absent. The compaction ran after its declared parent closed and did not declare itself deferred. 2. `memory.compactio...",
    "operational_effect": "Downstream consumers of the audit trail must run a reconciliation pass before any knowledge-state reconstruction. The pass does three things. First, it re-anchors every `memory.compact` and `memory.forget` span to its *temporal* parent — the `agent.turn` span whose interval actually contains the memory span's `start_time` — and flags any span where the tempo..."
  },
  "matched_failure_symptoms": [
    "OOM_KILL_OR_MEMORY_EXHAUSTION",
    "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": "fe85e4a54e5315c0919acc5ceb87887e69b5a8b7b297df0dde0d524ca751d982",
    "verified_classes": [
      "CompactionAttributionError",
      "Span"
    ],
    "verified_functions": [
      "reconcile_compaction_span",
      "dedupe_replay_spans"
    ],
    "verified_functions_count": 2,
    "defensive_guards_count": 4,
    "raised_exceptions": [
      "CompactionAttributionError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
