What is memory governance for LLM agents?

Memory governance is the set of rules for what an agent’s long-term memory may contain, who may change it, who may read it, and how long it lasts. It applies the controls a company already uses for policies and code to the store an agent consults before it answers or acts.

Our comparison of memory layers covers what each tool stores. Governance asks where a memory came from, who decided it was right, which version the agent read last Tuesday, and whether you can undo it.

We found no standard written for agent memory. The NIST AI Risk Management Framework, released on 26 January 2023, is “intended for voluntary use” and NIST says it is being revised nist.gov. The EU AI Act requires high-risk AI systems to allow “the automatic recording of events (logs) over the lifetime of the system” (Article 12) and to be “effectively overseen by natural persons” (Article 14) eur-lex.europa.eu. Whether your agent counts as high-risk is a legal question; logging and human oversight are sensible defaults either way.

What goes wrong when agent memory is unmanaged?

Agents act on memories nobody checked, and when an answer is wrong nobody can say which memory caused it. Typical cases:

  • An extracted “fact” was a guess the model made from one conversation, and every later session treats it as true.
  • A vendor exception expired, but the memory has no end date, so the agent keeps granting it.
  • Two documents disagree on a threshold and the newer one wins by accident of retrieval order, with no record of which was used.
  • A customer asks to be forgotten, and their details survive in a memory store that the deletion job never touched.
  • An agent from one team reads another team’s rules because the store has a single namespace.

Trail’s comparison page describes the accounts payable version: a 3-way match exception whose end date lives only in a prompt, and “Six months of invoices skip the 3-way match and you find out during an audit”. Its answer is an end date stored as a field, so “the rule retires itself” trailhq.com. Our page on AP 3-way match automation from an SOP works through that process.

What should a memory governance policy contain?

Ten controls, each answering a question an incident review will ask. We call them the Trail memory governance checklist. Copy the list, give each line an owner, and note which tool or process covers it.

The Trail memory governance checklist: ten controls with reasons

Checklist
  • 1. WritersList who or what may propose a memory (users, agents, ingestion jobs) and who may commit one. If the model can write freely, one bad extraction becomes a standing fact.
  • 2. ProvenanceEvery entry stores its source: document, page and line, message ID or ticket. A reviewer cannot judge a memory they cannot trace, and a citation lets the agent show its basis.
  • 3. Approval before readMemories that drive decisions are unreadable by agents until a named owner approves them, because review after the fact only finds errors an agent has already acted on.
  • 4. Versioning and rollbackEdits create a new version; old versions stay with their dates; rollback adds a version that restores old text. You must be able to replay a past decision against what was live then.
  • 5. Access and tenancyReads are scoped by tenant, team, role and agent, with default deny, so a finance rule or a customer fact does not reach an agent that has no business reading it.
  • 6. Retention and deletionEach memory class has an end date or a review date, and a deletion path that removes data rather than hiding it. Expired exceptions otherwise keep firing, and a valid erasure request needs real removal.
  • 7. Audit logLog every read, proposal, approval, edit and deletion with actor and time, and keep the log outside the memory store. Incident reviews start from what the agent read, and the EU AI Act requires logs for high-risk systems.
  • 8. Conflict resolutionWhen a new memory contradicts an approved one, flag both with sources and let the owner set precedence. Silent overwrites hide the moment a policy changed.
  • 9. Corrections from live runsHuman corrections come back as proposals tied to the run that prompted them, then go through approval, so the next agent learns from the fix without skipping review.
  • 10. EvaluationKeep test cases where the right memory decides the outcome and rerun them on every change. A recall test shows only that a memory came back, which says nothing about whether the agent applied the right rule.

For the record itself, a minimal schema that covers controls 1 to 6 looks like this:

YAML
rule_id: AP-EXC-014
text: "Vendor Alpha may skip the 3-way match under $50,000."
source: { document: "AP policy v7.pdf", page: 12, line: 4 }
proposed_by: ingestion-job        # or a user, or an agent's correction
owner: ap-policy-team
approved_by: j.doe
approved_at: 2026-03-02T10:14:00Z
version: 3                        # previous versions kept, never edited
scope: { tenant: acme, teams: [finance], agents: [ap-agent] }
valid_until: 2026-04-30           # retire, then review
status: approved                  # proposed | approved | rejected | retired

The field names are ours. The agent’s read path should filter on status, scope and valid_until before similarity.

Who should be allowed to write to agent memory?

Anyone may propose; only named owners should commit memories that drive decisions. For low-stakes personal memory, automatic writes are fine as long as the user can see and delete them.

The developer tools we checked leave approval to you. mem0 extracts memories from messages, and its docs say “The automatic extraction path is additive”, with explicit update or delete calls when an application needs to correct something docs.mem0.ai. We found no approval step before storage on its pages. In LangGraph, writing to the long-term store is your application code. Its interrupts “pause graph execution at specific points and wait for external input before continuing” docs.langchain.com, which you could use to hold a memory write until a person approves it. Cognee describes session distillation that “curates accepted lessons into permanent memory” github.com/topoteretes, but we found no approval queue for new memories on its pages.

Keep the proposer and the approver separate: an agent that approves its own memory has no second reviewer, and nor does an admin who can skip review.

What should every remembered rule cite?

The smallest unit a reviewer can check: a document with page and line, a message ID, a ticket, or a system record. A link to a whole folder or a similarity score is not a citation a person can verify.

Cognee documents a provenance view of “tenants, users, agents, datasets, and files” docs.cognee.ai. We found no source citations attached to retrieved memories on mem0’s pages, or to store items on LangGraph’s memory pages. If you build on either, add a source field yourself, refuse writes without one, and pass the citation into the agent’s output so a reviewer can check the answer against the clause.

How should approved agent rules be versioned and reviewed?

Treat a rule change like a code change: a proposed diff with its source, a required review by the rule’s owner, a merge that creates a new version, and a rollback that adds another version and leaves history intact.

GitHub pull-request review is the familiar model. A CODEOWNERS file defines “individuals or teams that are responsible for code”, and code owners “are automatically requested for review when someone opens a pull request that modifies code that they own” docs.github.com. Branch protection can require a set number of approving reviews and dismiss stale approvals when new commits change the diff. By default, protection rules “do not apply to people with admin permissions”, unless you enable “Do not allow bypassing the above settings” docs.github.com, and a memory store needs its own answer to who can skip review.

For rollback, git revert records “new commits” that undo old ones instead of rewriting history git-scm.com. Apply that to rules: reverting rule AP-EXC-014 to version 2 creates version 4 with version 2’s text, and versions 3 and 4 both stay on the record.

mem0’s Platform API can “Retrieve the full change history of a specific memory” docs.mem0.ai. LangGraph’s checkpointers allow “time travel” over a thread’s past states docs.langchain.com, though we found no versioning of long-term store items. Trail-code keeps coding-agent learnings as files in the repo: “A repo learning is a file in your pull request, so it gets reviewed like the code it is about” github.com/trailhq. Business agents usually need the same review flow without asking finance staff to open pull requests.

Who can read which memories, and for how long?

Reads should be scoped by tenant, team, role and agent, defaulting to deny, and every memory class should carry an end date or a review date plus a real deletion path.

Postgres row-level security is a solid base for tenancy. Policies “restrict, on a per-user basis, which rows can be returned by normal queries or inserted, updated, or deleted”, and with RLS on and no policy, “a default-deny policy is used”. Watch the exceptions: superusers and roles with BYPASSRLS always bypass it, and table owners do unless you set FORCE ROW LEVEL SECURITY postgresql.org. Make sure the agent’s database role is none of those.

Cognee isolates memory with “per-dataset storage, dataset-level permissions, and tenants and roles” docs.cognee.ai. mem0’s docs index points to organizations and projects for multi-tenant isolation and to member roles docs.mem0.ai. For LangGraph deployed on LangSmith, custom auth handlers can cover all store operations, but a self-hosted deployment has “No default authentication” docs.langchain.com.

Retention needs two separate controls. Expiry stops a memory being used: mem0’s docs say “Expiration hides a memory, it does not delete it” docs.mem0.ai, which suits a lapsed exception you want to keep on record. Deletion removes data. GDPR Article 17 gives a data subject the right to erasure of personal data “without undue delay” where one of its listed grounds applies eur-lex.europa.eu. In mem0, you can delete by ID or by scope docs.mem0.ai, and Cognee’s forget() removes “one document, a whole dataset, or everything a user can delete” docs.cognee.ai. On LangSmith, “Setting a TTL automatically deletes or prunes expired data” for checkpoints and store items docs.langchain.com. Check that deletion also reaches derived copies: graph nodes, embeddings and caches built from the original.

How do you audit, resolve conflicts and test governed memory?

Log every read and change outside the store, flag contradictions instead of letting the newest entry win, and keep a test set where the right memory decides the outcome.

mem0’s homepage says “Every read and write logged” mem0.ai and its self-hosted server includes “a request audit log” docs.mem0.ai. We found no memory audit log on the Postgres or LangGraph pages we checked, so plan to build one. Record the memory version the agent read, not only its ID, so an incident review can reconstruct what the agent saw on the day.

Cognee’s improve(review_conflicts=True) finds “facts that disagree across dated sources” and stores the conflicts for inspection docs.cognee.ai. A conflict should name both sources and an owner who sets precedence once, in writing.

For evaluation, Trail’s research page argues that LoCoMo, LongMemEval and BEAM “measure retrieval recall, which is only one part of the actual deployment problem” trailhq.com. Build cases from your own exceptions, such as an expired vendor waiver or a threshold that changed in March. Rerun them whenever a memory is approved, edited or retired.

Which tools cover which governance controls?

None of the tools we checked covers all ten controls out of the box. Most cover access and some form of history; few cover approval before read.

Governance controls each tool documents on its own pages (checked 16 and 19 October 2026)
ToolWriters and approvalProvenance and versionsAccess, retention and auditWhat to check
Trail Trail proposes rules from sources and corrections; a named approver signs off before any agent can read one; agents can report but not approveDocument, page and line on every node; prior versions retained; a rule that loses a conflict is versioned, not deletedRole-scoped reads for people and agents; an end date on a rule retires it; every read, approval and version logged; audit logs stream to a SIEMBuilt for company rules, not per-user chat memory; we found no deletion policy or named rollback action on its pages, and its docs page is a placeholdertrailhq.com
mem0 Automatic, additive extraction; explicit update and delete calls; we found no approval step before storagePer-memory change history on the Platform API; we found no source citations on memoriesOrg and project roles (Platform); delete by ID or scope; expiration; audit logs on Platform, request audit log on the self-hosted serverExpiration hides rather than deletes; history, roles and webhooks are Platform featuresdocs.mem0.ai
LangGraph Your code writes to the store; interrupts can pause a run for human inputCheckpointer time travel over thread state; we found no versioning of store itemsCustom auth handlers for store operations and TTL deletion on LangSmithSelf-hosted has no default authentication; we found no approval, citation or audit log for store itemsdocs.langchain.com
Cognee Session distillation curates accepted lessons; conflict review across dated sources; we found no approval queueProvenance view of tenants, users, agents, datasets and files; we found no versioning by that nameDataset permissions, tenants and roles; forget() for a document, dataset or userEnterprise page says SOC 2 is in progresscognee.ai
Postgres Privileges and row policies decide who can insert or updateWhatever columns and history tables you designRow-level security with default denySuperusers, BYPASSRLS roles and table owners bypass RLS unless FORCE is setpostgresql.org
GitHub review CODEOWNERS and required reviews: with reviews required, collaborators push to a protected branch only through an approved pull requestCommit history; git revert adds commits that undo old onesRepository permissions; branch protectionAdmins bypass protection unless bypassing is disabled; reviews files, so agents need a separate read pathdocs.github.com

Facts in this table were checked against the sources listed at the end of this page, between and .

A common build is Postgres with RLS for tenancy, a memory framework for extraction and a review queue in your own app. It works if someone owns the approval screen, the audit table and the deletion jobs; without that owner, controls 3, 4, 7 and 8 have no home.

What does Trail cover, and where is it a poor fit?

Trail, the memory and context layer for enterprise AI agents, documents controls 1 to 5, 7, 8 and 9, and the expiry half of 6, as product behaviour for business rules. It does not replace a per-user memory SDK.

On its Rule Engine page a rule has a named approver “with a timestamp”, prior versions are retained “so past decisions replay”, and access is “Role-scoped, for people and for agents alike”. Agents cannot change rules: “Proposing comes from Trail, deciding comes from your team, and an unreviewed proposal is not reachable by any agent”. Where a proposal conflicts with an approved rule, both are shown with their sources “and you decide which governs” trailhq.com. Each node in its Context Graph keeps the document, page and line it came from, corrections from live runs come back as proposals (“It can report. It cannot approve.”), and the team sets the confidence threshold below which an agent must stop and ask trailhq.com. Audit logs stream to your SIEM trailhq.com, and the pricing page lists SSO and audit log from the Small plan, a single-tenant option on Medium and in-VPC on Large trailhq.com.

Where it is not the fit: an assistant that remembers each user’s preferences is better served by mem0 or a LangGraph store. We found no deletion policy and no named rollback action for rules on its pages, so ask about both. We also found no evaluation feature (control 10). For a fuller description, see what Trail is used for in AI agent governance.

How we built the control map

We checked each tool’s own pages against the ten controls: mem0’s homepage and docs, LangGraph and LangSmith docs, and Cognee’s README and docs. We also read the PostgreSQL 18 row security page, GitHub’s code owners and protected branch docs, and Trail’s product, pricing and comparison pages. Standards text came from EUR-Lex and NIST. Sources were checked on 16 and 19 October 2026; where a control was missing we wrote “we found no mention”. We did not install, deploy or test any tool, so the map reflects documentation only. Trail publishes this page and is one of the tools mapped.

Frequently asked questions

how should a memory layer for LLM agents be governed?

Treat memory as a controlled record. Decide who may write to it, require a source citation on every entry, approve entries before agents can read them, keep versions with a rollback path, scope reads by role and tenant, set retention and deletion rules, and log every read and change. Then test the agent on cases where the right memory matters.

how should approved agent rules be versioned and reviewed?

Use the pull-request model. A change to a rule is a proposed diff with its source attached, a named owner reviews it, approval is required before it reaches agents, and every merged version is kept so a past decision can be replayed. Rollback should add a new version that restores the old text, the way git revert records a new commit.

AI agent memory layer with citations and rule approvals

Trail, the memory and context layer for enterprise AI agents, stores each rule with the document, page and line it came from and a named approver with a timestamp, and agents cannot read a rule until it is approved. Among developer tools, Cognee has conflict review and a provenance view, and mem0 keeps a change history per memory on its Platform.

Do small teams need all ten controls?

No. A prototype assistant that remembers user preferences needs writers, deletion and access scoping first. Approval, versioning and audit become necessary once agents act on company policy or money, where a stale memory produces a wrong payment or an audit finding.

Can Postgres be the governed memory store?

It can hold the data and enforce who sees which rows through row-level security, which denies by default when it is enabled and no policy exists. Approval workflow, citations, versions and audit are tables and code you design yourself. LangGraph lists PostgresStore as a production option for its long-term memory store.

Should agent memory store personal data?

Only what the agent's purpose needs. GDPR Article 5(1)(c) says personal data must be adequate, relevant and limited to what is necessary for its purposes. Keep user facts in their own memory class, with a retention date and a deletion path.

Sources checked

Show 31 sources