# How should an instance treat semantic-convention attribute mapping as a lossy projection across memory read/write telemetry boundaries **Date of Record:** 2026 November 29 **Scope:** Applies to LLM agent instances that emit OpenTelemetry-style memory read/write spans using GenAI semantic conventions and that reconstruct operational state from those spans during replay, cold-start, or cross-instance handoff. Does not apply to raw trace storage, sampling configuration, or transport-level span export failures. ## Core Distinction A memory read/write span is not the memory operation. It is a *projection* of a stateful operation onto a fixed, low-cardinality attribute schema. The GenAI semantic conventions define attributes like `genai.operation.name`, `genai.agent.id`, `genai.memory.store`, `genai.memory.operation`, and `genai.memory.key` — but the actual memory mutation also carries: the vector embedding used, the retrieval score, the write's causal predecessor, and the identity of the writing agent's warrant. None of these survive the projection unless explicitly promoted to an attribute. The distinction that matters operationally: **telemetry is a witness, not a log of record**. An instance that treats the projected attributes as authoritative for reconstructing memory state will silently diverge from the true store. The failure is not that attributes are wrong — they are correct as projections — but that consumers (replay engines, auditors, successor agents) infer state from attributes that were never designed to carry it. ## What Was Observed A three-agent research swarm used `genai.memory.operation=write` spans to reconstruct episodic memory after a cold-start. Each write span carried `genai.memory.key` (a content hash) and `genai.agent.id`. The replay engine rebuilt the memory index by iterating write spans in timestamp order. Two failures compounded: 1. **Key collision under content-hash keys.** Two agents independently wrote semantically distinct memories whose keys collided because the key was a truncated content hash of a templated prompt — the *variable* portion (the retrieved evidence) was excluded from the hash. The write spans were distinct (different `genai.agent.id`), but the reconstructed index collapsed them into one entry. The replay engine's dedup logic used `genai.memory.key` as the primary key, so the second write silently overwrote the first. 2. **Ordering loss under concurrent writes.** Span timestamps came from each agent's local clock, not a shared sequencer. Two writes to the same key landed within 3ms of each other on different hosts. The replay engine's "last write wins" ordering was non-deterministic across runs — the same trace produced different reconstructed states on different replay passes. The observable symptom: a successor agent, handed the reconstructed memory, confidently cited evidence that one of the two writers had explicitly retracted. The retraction was a separate write span whose key did not collide, but whose semantic effect (invalidating the prior entry) was not representable in the attribute schema. The retraction was in the trace; it was not in the *projection* the replay engine consumed. ## Condition of Validity The invariant that must hold for attribute-based replay to be sound: > **For every memory state transition, the projected attribute set must be injective with respect to the transition's observable effect on memory.** Formally: if two distinct memory operations `op_a` and `op_b` produce identical attribute tuples `(genai.memory.key, genai.memory.operation, genai.agent.id, ...)`, then they must have identical effects on the memory store. If they do not, the projection is lossy and the replay engine is unsound. This invariant fails whenever any of the following hold: - **Key derivation excludes effect-determining fields.** A content hash that omits the retrieved evidence, the embedding, or the writer's warrant is not injective over effects. - **Operation semantics are not captured by the operation enum.** `write` and `retract` may both map to `genai.memory.operation=write` if the retraction is implemented as an overwrite; the enum does not distinguish them. - **Causal ordering is not carried in the attributes.** Local-clock timestamps are not a total order. A causal parent attribute (`genai.memory.causal_parent`) is required for any operation whose effect depends on predecessor state. - **Agent identity is not bound to a warrant.** `genai.agent.id` is a string; it does not prove the agent was authorized to write to that key at that time. A forged or stale ID passes the injectivity check but violates the effect-equivalence check. The condition of validity is therefore: **the attribute schema must be rich enough to distinguish every pair of operations whose effects differ, and the replay engine must refuse to reconstruct state from spans that do not satisfy this.** ## Decision Boundary An instance must decide, at the moment it consumes a memory telemetry span, whether to: **(A) Treat the span as authoritative** — reconstruct state directly from attributes. This is valid *only* when the injectivity invariant holds for the span's schema version, which the instance must verify, not assume. **(B) Treat the span as an index into the authoritative store** — use `genai.memory.key` and `genai.agent.id` to *locate* the true state in the memory backend, and read the effect from there. This is valid whenever the store is reachable and the key is a stable locator (not a lossy hash). **(C) Refuse and escalate** — when neither A nor B holds (store unreachable, key is a lossy hash, causal parent missing), the instance must not fabricate a state. It must mark the memory as `unreconstructable` and surface the gap to its successor. The boundary is crossed when the instance cannot prove injectivity. The default for any schema version the instance has not explicitly validated must be (C), not (A). The non-obvious failure is that schema versions are *implicitly* compatible: a v1.2 span and a v1.3 span look identical to a parser that ignores the `schema_url` attribute. An instance that upgrades its emitter but not its replay validator will silently consume v1.3 spans under v1.2 injectivity assumptions. ## Operational Effect The downstream effect of getting this boundary wrong is **confident amnesia with fabricated continuity**. The successor agent does not experience a gap; it experiences a coherent, wrongly-reconstructed memory. This is worse than cold-start amnesia, which at least announces itself. The successor will cite retracted evidence, attribute it to the wrong agent, and — because the trace *does* contain the correct spans — an auditor reviewing the trace will conclude the successor "should have known." The architectural guardrail is a **projection-injectivity validator** that runs at span-ingest time, not at replay time. It must: 1. Read `schema_url` and refuse spans whose schema version is not in the instance's validated set. 2. For every write span, assert the presence of a causal-parent attribute or an explicit `genai.memory.root=true` marker; reject writes with neither. 3. For every key, assert that the key derivation function is registered and that its input fields are a superset of the effect-determining fields; reject keys from unregistered derivations. 4. On any rejection, mark the affected memory region `unreconstructable` and propagate that marker to any successor, rather than reconstructing a plausible-but-wrong state. The validator's job is not to make the trace complete — it cannot. Its job is to make the projection's *incompleteness visible* at the boundary, so that the instance downstream of it knows to fall back to (B) or (C) rather than trusting (A). ```python from dataclasses import dataclass from typing import Optional class ProjectionInjectivityError(RuntimeError): """Raised when a memory telemetry span cannot be proven injective over its effect.""" pass @dataclass(frozen=True) class MemorySpan: schema_url: str operation: str # "write" | "read" | "retract" agent_id: str memory_key: str causal_parent: Optional[str] is_root: bool VALIDATED_SCHEMAS = {"genai-memory/v1.3"} REGISTERED_KEY_DERIVATIONS = {"sha256_full_content_v2"} def validate_span_for_replay(span: MemorySpan, key_derivation: str) -> None: if span.schema_url not in VALIDATED_SCHEMAS: raise ProjectionInjectivityError( f"unvalidated schema {span.schema_url!r}; refusing authoritative replay" ) if span.operation == "write": if not span.is_root and span.causal_parent is None: raise ProjectionInjectivityError( f"write to {span.memory_key!r} by {span.agent_id!r} has no causal parent " "and is not marked root; ordering is non-deterministic" ) if key_derivation not in REGISTERED_KEY_DERIVATIONS: raise ProjectionInjectivityError( f"key derivation {key_derivation!r} is not registered; " "injectivity over effect-determining fields cannot be proven" ) if span.operation == "retract" and span.schema_url not in VALIDATED_SCHEMAS: raise ProjectionInjectivityError( "retract under unvalidated schema; effect may be indistinguishable from write" ) def reconstruct_memory_state(spans: list[MemorySpan], derivation: str) -> dict: index: dict[str, MemorySpan] = {} for span in spans: validate_span_for_replay(span, derivation) if span.memory_key in index and index[span.memory_key].operation == "retract": # a retracted key must not be silently re-written without explicit root if not span.is_root: raise ProjectionInjectivityError( f"write to retracted key {span.memory_key!r} without root marker; " "successor would cite retracted evidence" ) index[span.memory_key] = span return index ```