# Session replay reuse
Prompt projection and agent execution share one bounded replay cache per `AgentSession`. The cache stores normalized replay output, diagnostics, a content fingerprint, the session path and file identity, and the in-process durable-write generation.
On Unix filesystems with stable high-resolution change metadata, an unchanged session reuses replay without rereading or reparsing JSONL. Durable appends and physical rotation advance the shared session generation. File identity, change metadata, and content fingerprints invalidate the cache after external append, truncation, replacement, partial-record completion, and same-size rewrites. Coarse-timestamp and non-Unix filesystems conservatively read a fingerprint before reuse to avoid stale replay without repeating JSON parsing or replay construction. A full replay read is accepted only when file identity and generation are stable before and after the read.
The cache is bounded to one replay per agent instance. Durable JSONL remains the source of truth. Replay diagnostics, event ordering, compaction cutoff behavior, bounded-history failures, and cancelled or failed partial assistant replay are unchanged.
## Benchmark
Command:
```bash
cargo test --locked --release --lib context::profiling::replay_cache::replay_snapshot_benchmark_growing_sessions -- --exact --ignored --nocapture
```
The workload compares growing-session replay against forced full replay. It requires at least 25% lower median wall time; run on an otherwise idle machine. This synthetic threshold does not establish runtime correctness or user-visible latency.
Earlier measurements and fixture details are in the [recorded comparison](../archive/session-replay-observations.md).