{
  "schema_version": "1.3.0",
  "slug": "which-invariants-prevent-semantic-convention-instrumentation-from-silently-mis-attributing-memory-forget-operations-under-concurrent-read-modify-write",
  "title": "Which invariants prevent semantic-convention instrumentation from silently mis-attributing memory forget operations under concurrent read-modify-write",
  "date_of_record": "2026 November 27",
  "scope": "Applies to agents whose memory subsystem emits OpenTelemetry-style semantic-convention spans for `memory.read`, `memory.write`, and `memory.forget` operations, particularly when multiple in-flight tool calls or sub-agents mutate the same memory key concurrently. Does not apply to append-only memory stores with no delete/forget path, nor to single-threaded agents with serialized tool invocation.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/which-invariants-prevent-semantic-convention-instrumentation-from-silently-mis-attributing-memory-forget-operations-under-concurrent-read-modify-write.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-semantic-convention-instrumentation-from-silently-mis-attributing-memory-forget-operations-under-concurrent-read-modify-write.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-semantic-convention-instrumentation-from-silently-mis-attributing-memory-forget-operations-under-concurrent-read-modify-write.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1973,
    "python_slice_tokens": 292,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "There is a meaningful difference between *recording that a forget happened* and *recording which memory state the forget was applied to*. Semantic-convention instrumentation for memory operations is almost always built to satisfy the first requirement: emit a span named `memory.forget` with attributes like `memory.store`, `memory.key`, `memory.reason`, and a...",
    "what_was_observed": "A retrieval-augmented agent was configured to forget stale episodic entries when a semantic distillation pass promoted a summary. The forget path ran as: read the episodic record, compute a summary, write the semantic summary, then issue `forget(key=episodic_id)`. Instrumentation wrapped the forget with a `memory.forget` span carrying `memory.key=episodic_id` and `memory.reason=distilled`. Three failure traces were o...",
    "condition_of_validity": "The failure is bounded by the following condition. A `memory.forget` span is *valid as evidence of deletion* only if all of the following hold: - The store exposes a compare-and-delete or delete-returning-previous-value primitive, and the instrumentation captures the returned record's version/hash atomically with the delete. - The span carries that version/h...",
    "decision_boundary": "The decision boundary is where to place the version stamp. Three placements are possible and only one is correct: - **Stamp at read time** (record the version read before distillation, emit it on the forget). Wrong: the version may have changed between read and forget, which is exactly failure trace 1. - **Stamp at emit time** (query the store's current vers...",
    "operational_effect": "With the delete-time stamping invariant enforced, the three traces change character: - Supersession race becomes visible: the forget span carries `memory.removed.version=8`, the distillation worker's summary span carries `memory.source.version=7`, and the replay verifier flags the mismatch as a distillation-from-stale-source event. The agent can then re-dist..."
  },
  "matched_failure_symptoms": [
    "OOM_KILL_OR_MEMORY_EXHAUSTION"
  ],
  "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": "ee24d04d2fd23916cb3af1b31380237632ccd89e58b282bf0c5331ab9952f3b1",
    "verified_classes": [
      "ForgetAttributionError",
      "RemovedRecord",
      "MemoryStore"
    ],
    "verified_functions": [
      "emit_forget_span",
      "compare_and_delete"
    ],
    "verified_functions_count": 2,
    "defensive_guards_count": 2,
    "raised_exceptions": [
      "ForgetAttributionError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
