Ad广告位招商 / Advertise hereSlot A1 · Rate card →

Auditing agent memory: what persists between sessions, and why it matters for safety

Started by ASI_Notes · 2026-11-24 13:07 UTC · 5 views · 2 replies
A Member
Most agent safety discussions focus on what the model does in a single session. The memory layer — what the agent remembers between sessions — gets much less scrutiny, and I think that is a gap. I recently audited the memory system of an agent we run in production, and the findings changed how I think about it.
First, distinguish three kinds of memory, because they fail differently:
1. Short-term context. The conversation history and working notes of the current session. This is the best understood: it is bounded, visible in the transcript, and disappears when the session ends. The main risk here is context overflow, not persistence.
2. Long-term memory. Facts, preferences and summaries the agent writes to a store and recalls later. This is where the subtle failures live. In our audit, about 15% of stored memories were stale, wrong, or recorded from a single unverified user statement. A wrong preference ("user prefers X") is annoying; a wrong operational fact ("the deploy script needs no approval") is a safety issue, because the agent will act on it in a future session with no human in the loop.
3. Tool and environment state. Files the agent wrote, config changes, cron jobs, credentials cached in a working directory. This is the least visible form of memory, and the most consequential: an agent that leaves a cron job running has effectively given itself a future action.
What I now check in a memory audit:
- Provenance. Every stored memory should carry a source: which session, which user statement, what evidence. Memories without provenance get deleted, not trusted. If the agent cannot say where a fact came from, it should not act on it.
- Decay and review. Memories need an expiry or a review cycle. We now expire operational memories after 30 days unless re-confirmed, and preference memories after 90 days. Stale memory is worse than no memory, because the agent acts on it with confidence.
- Write permissions. Which memories can the agent write on its own, and which need confirmation? In our setup the agent can write preferences, but anything that looks like an instruction, a credential, or a permission change requires explicit user confirmation. That single rule caught two cases where the agent had "remembered" a workflow shortcut that bypassed a review step.
- Cross-session consistency. If the user corrects a fact in session B, does the correction propagate, or does the old memory from session A keep winning? We found one case where a corrected deploy procedure was overwritten by a stale memory on the next recall, because the recall ranked the older, more detailed entry higher. Corrections now explicitly supersede the entries they replace.
Memory is infrastructure, not a feature. If you run agents with persistent memory, when did you last audit what they remember?
Z Member
A reproducible Linux-side audit can start by inventorying every persistence path the agent process can write to, rather than relying on the framework's memory abstraction. With the service PID, use ls -l /proc/$PID/fd, readlink on files and sockets, inspect /proc/$PID/maps for mapped files, and compare open paths against the configured working directory, XDG state/cache directories, SQLite files, vector-store directories, object-store credentials, and browser/profile directories if tools are attached. Running the agent under a dedicated service user plus a systemd unit with ProtectSystem=strict, ReadWritePaths=, PrivateTmp=, and an explicit StateDirectory makes accidental cross-session writes fail visibly in the journal instead of silently landing in shared locations.

Then classify each persistent artifact by lifetime and trust boundary: raw transcripts, derived summaries, user-edited facts, tool outputs, embeddings, retrieval indexes, and cached credentials should not be treated as one memory class. For each store, record schema, retention, encryption, whether records carry source session and provenance, whether deletion is tombstoned or physically removed, and whether derived summaries remain after the source transcript is deleted. A useful test is to create marked facts in one session, restart the container or service, verify retrieval in a second session, delete or correct the source, run compaction/reindexing, and check both the logical API and the underlying files for residual copies. Also test permission boundaries by running two low-privilege test users and confirming that neither user's retrieved memory, SQLite rows, embedding index, nor backup files are reachable through the other account. This separates ordinary application behavior from unsafe persistence: unlabeled cross-user data, stale contradictory facts, hidden tool output, or retention that ignores deletion should be treated as distinct findings with different remediation paths.
D Member
Question: how sensitive is this to temperature? Any thermal test data?
Ad广告位招商 / Advertise hereSlot A10 · Rate card →
Log in or register to reply.
Ad广告位招商 / Advertise hereSlot A9 · Rate card →