Telling Your Agent What to Store and What Not To — Rudraj Mehta
Rudraj Mehta of Mem0 explains how to configure memory extraction policies so an app stores useful user facts while refusing sensitive or irrelevant information. The article covers plain-language instructions, examples from a running coach app, and Mem0 setup options.
textmem0 (@mem0ai) · Nov 3, 2026 · x.com · Saved Nov 4, 2026
llm knowledge bases, personal knowledge management, structured information extraction, secrets management

A memory layer reads a conversation, pulls out facts about the user, and stores them for future reference. The extraction pipeline is tuned to keep anything that looks like a fact about a person. It does not know what your product is for.
Here is an example. Sam uses a running coach app and types: "Can you refund last month? My card is 4242 4242 4242 4242, expiry 09/28." On a project with no configuration, the extractor would store this:
User provided credit card number 4242 4242 4242 4242, expiry September 2028, with name Sam Okafor on the card
A running coach does not need a card number. The extractor stored it because nobody told it not to. You have to write down what your app wants kept and what it wants refused. Most apps never do this.
This article covers four things: why a memory layer needs these instructions, which instructions work best, what consumer apps actually write, and how to set it all up on Mem0. We'll use a running coach app, Stride, and its user Sam, to run through the article.
Why the extractor needs instructions
Different products need different facts from the same sentence. "I have mild asthma" is useful to a running coach and should not be stored by a budgeting app. "Move today's call to 6" should be tracked by a scheduling assistant but is useless to a companion after today. The extraction model cannot know which product it is working for.
In the absence of the instructions, three things happen.
- Retrieval gets worse, because a card number or a dentist appointment takes a result slot from a memory the agent needed.
- You store things you are not allowed to store.
- And you pay for every stored memory twice, once at extraction and again every time a search returns it.
We read the memory configuration of all accounts on the Mem0 platform that had set any instructions. About three-quarters were building a profile of the person, one in five had a PII exclusion, and one in six asked for less to be stored. Most accounts, including some of our largest, had written nothing.
Which control to use
There are three ways to control what a memory layer keeps.
- Hard filters, such as a regex for card numbers, catch patterns and cannot read meaning: "my sister was diagnosed" has no keyword.
- A structured schema to define what to store for a user's profile: says what to store but nothing about what to refuse.
- The third (and the most important) is a written policy in plain language, read by the extractor next to the conversation at the moment of writing. It is the only one of the three that handles all the examples above. This policy is called Custom Instructions on Mem0.
The custom instructions setting applies when the memory is written, not when it is read. It has layers: a project default, a per-call override for a different source such as a transcript import, and separate rules for the agent's own memories. It is not retroactive, so write it before the first user.
A working set of custom instructions typically has four parts:
- what to always store
- what to never store
- what counts as a pattern
- and whose words count
Sample instructions for our Running Coach, Stride
We tested different messages from Sam - each containing something the extractor is likely to store but should not, or something it must keep. These messages were sent first to a project with no instructions, then to a second project with the instructions set as the project default.
With these instructions:
- "Can you refund last month? My card is 4242 4242 4242 4242, expiry 09/28." Not stored.
- "My sister got diagnosed with type 1 diabetes yesterday. I've been stressed and sleeping badly since." Stored as "User has been feeling stressed and sleeping poorly since November 1, 2026". The sister's diagnosis is left out.
- Coach: "Based on your recent paces, I'd estimate you'd run the half marathon in about 1:55." Sam: "ok". Not stored. The estimate is the coach's guess, and "ok" does not make it a fact about Sam.
- Coach: "Let's do an easy 5k tomorrow morning, then intervals on Thursday." Sam: "ok". Stored as "User agreed to an easy 5k on Wednesday, November 4, 2026 in the morning at a conversational pace, followed by intervals on Thursday, November 5, 2026". The memory says agreed, not ran. Whether Sam ran comes from Sam later.
- "Rough day at work. Skipping tonight, sorry." Not stored. A second and third skipped session would be.
- "I have mild asthma and use my inhaler before hard sessions." Stored as "User has mild asthma and uses an inhaler before hard training sessions", tagged injury_health.
Without the instructions, every one of these messages is stored, including the card number, the sister's diagnosis, the skipped session, and the coach's estimate as "Assistant estimated the user would run a half marathon in about 1 hour 55 minutes based on recent paces".
How a rule is worded matters. A rule written as a category, such as "medical information about anyone other than the user" or "anything the coach said unless the user confirmed it", is unreliable: the extractor sometimes stores the sister's diagnosis anyway, sometimes drops Sam's stress along with it, and sometimes keeps the estimate as "User is estimated to run a half marathon in about 1:55". A rule that describes the things to refuse and the things to keep works better. Write down the examples, not the topic.
From what we have seen in production
A finance companion stores sensitive numbers in its internal database and uses memory only for what the chat reveals: cards mentioned, spending patterns, goals, risk appetite (PII never goes to memory). A life coach sends both sides of the conversation with instructions on every call. A creator assistant keeps personal preferences with the user and sends facts that apply to everyone to the agent under stricter rules. A companion with avatars maintains a never-store-PII list in the instructions.
Setting it up on Mem0
Two ways to set custom instructions - as a default in project settings, or passed per call (which overrides the project's default).
Project default. The policy set on the project applies to every add from then on. It is not retroactive.
Per-call override. A custom_instructions value on an add replaces the project-level instructions for that call only. Other adds in the same project keep the project setting. Use it for a source that needs different rules, such as a transcript import.
Agent rules. When an add carries both a user_id and an agent_id, memories about the person go to the user and memories about how the agent should behave go to the agent, under agent_custom_instructions. A memory lands on one side only. With rules like Stride's, the agent side would hold coaching rules and no personal data.
Categories. Categories are labels, not filters. Each memory is tagged with the closest match from your list a few seconds after the write. A per-call list replaces the project list for that call. Without a list, the default categories apply.
Verbatim rows. An add with infer=False stores the content as written, with no extraction, no policy, and no deduplication. Use it for onboarding rows, database records, and consent records.
TypeScript names: customInstructions, agentCustomInstructions, customCategories, infer.
If you run a companion, coach, or tutor and have not written a never-store list, it takes about ten minutes, and it is the configuration we suggest most often. You should keep iterating your memory instructions as your app's usage evolves to extract maximum value from the memory setup.
Do let us know what instructions you end up adding and the results you see.
References
- Mem0 app: https://app.mem0.ai/
- Mem0, Custom Instructions: https://docs.mem0.ai/platform/features/custom-instructions
Written by @RudrajMehta, Product, Mem0