Use cases

AI companions with long-term memory

Give your AI companion a memory of each person that stays accurate as their life changes and private to them, so every conversation picks up where the last one left off.

An AI companion is judged on whether it remembers. People come back to a companion app to talk about their week, their plans and the things that worry them, and the conversation only feels like a relationship if the companion carries what they said last time into this time. A companion that asks for someone’s sister’s name for the third time, or congratulates them on a job they left a month ago, breaks the experience faster than a clumsy reply ever could.

The model is rarely the weak part. Current models write warmly and stay in character well. What they lack is a durable, accurate picture of the person, built up over months and kept current as their life changes. This page covers the long-term memory infrastructure behind a companion: how facts, preferences and events are captured from conversation, how they stay true when circumstances change, how each user’s memory stays private to them, and how the companion retrieves the right handful of facts quickly enough to keep the chat flowing.

The problem

Most companion apps start by storing the chat log and feeding recent messages back into the prompt. That gives the companion a short-term memory of the current session and little else. Once the conversation outgrows the context window, the oldest messages are trimmed first, and those are often the ones that mattered most: the first time someone mentioned their father’s illness, the name of their dog, the reason they started using the app in the first place.

The next fix is usually a rolling summary. Every few dozen messages, a model condenses the history into a paragraph about the user. Summaries are cheap, but they are written before anyone knows what the next conversation will need, so specifics fall out. “Has a sister” survives; “sister Maya is expecting her first baby in March” often does not. Each re-summary loses a little more, and there is no way to get the detail back. Our glossary entry on summarisation versus memory goes through that trade-off in detail.

Teams that go further put messages into a vector index and retrieve by similarity. That recovers detail, but it brings a different problem. Companions hear about change constantly. A user who said in spring that they were seeing someone and in autumn that they had broken up has both statements in the index, and similarity search returns whichever is phrased closest to the current message. That is memory drift, and in a companion it lands badly: the companion asks warmly after a partner who is no longer around. A plain index has no notion that one fact replaced another, which is the heart of the vector database versus memory distinction.

Then there is cost and privacy. Companion conversations are long and frequent, so replaying history makes every message more expensive than the last, and the token bill grows with how attached users become rather than with how many users you have. And what people tell a companion is personal. One user’s memories surfacing in another user’s chat because a query forgot a filter is the kind of failure a companion product struggles to recover from.

What Exabase unlocks

With a memory engine, isolated storage and search underneath, a companion keeps an up-to-date picture of each person and brings the relevant part of it into every conversation.

Picture a user who opens the app on a Sunday evening. Before the companion writes its first line, it retrieves a few hundred tokens of relevant facts: she started a new job three weeks ago and was nervous about her manager, she runs on Saturday mornings, her sister Maya’s baby was due this week, and she prefers the companion not to offer advice unless she asks for it. The companion opens by asking whether there is news from Maya. Nothing in the prompt is a transcript. It is the current state of what the companion knows, chosen for this moment.

When her life changes, the memory follows. If she mentions that she has handed in her notice, the newer fact supersedes the old one when it is written, so the companion stops asking how the job is going. This is contradiction resolution, and alongside entity resolution, which keeps “Maya”, “my sister” and “the baby’s mum” attached to one person, it is what keeps a long relationship coherent.

The user’s memory also stays hers. Each user gets an isolated environment, so nothing she says can appear in anyone else’s conversation, and when she asks the app to forget something, or to delete her account, the data can be removed.

How it works

Three parts of Exabase carry most of a companion, with a fourth for the photos, voice notes and documents that users share.

Memory

Exabase Memory is the core. After each exchange or at the end of a session, you send the conversation as text and the M-1 engine extracts facts, preferences and events automatically, without you writing extraction rules. It then maintains them: it links related facts into an evolving structure of concepts, resolves contradictions as new information arrives, consolidates duplicates and refreshes stale context. The result mixes semantic memory about the person, such as who they are and what they like, with episodic memory about what happened, such as the interview last Tuesday. The glossary compares the two in episodic versus semantic memory.

When something must be stored exactly, such as a user’s stated boundaries or the name they want to be called, you write it as a verbatim memory with infer set to false, and it is available immediately. Memories can also be marked immutable, so the self-organising process never edits, consolidates or deletes them. Retrieval is hybrid semantic and keyword search with recency weighting, so what is current surfaces above what is old, and simple retrieval returns in about 200ms. For harder questions, query expansion and reranking add retrieval passes for a small amount of credits. If you would rather not assemble the prompt yourself, the ask endpoint takes a natural-language question such as “what is going on in this user’s life right now?” and returns an answer built from the relevant memories.

On published benchmarks, M-1 scores 96.4% on LongMemEval and ranks first on BEAM at 100K, 1M and 10M tokens, with its widest lead at 10M. BEAM is designed so that putting everything into the context window does not work, which is close to the position a companion is in after months of daily conversation.

Bases

A Base is an isolated environment with its own memory, file storage and search index. Companion apps usually create one Base per user at sign-up and pass its ID on every call, either with the X-Exabase-Base-Id header or once on the SDK client. Isolation is enforced at the infrastructure level, so a call scoped to one user’s Base cannot reach another user’s data whatever the query says. That gives you memory isolation without relying on every query carrying the right filter. The free plan allows 100 Bases and paid plans allow 10,000, with higher limits on request, and your users never need Exabase accounts because usage rolls up to your developer account.

Bases also make deletion straightforward. Individual memories can be updated or deleted through the API, and deleting a user’s Base permanently removes everything in it, including memories, files and the search index. That is the mechanism you would build a forget-me or account deletion flow on. Whether your flow meets the right to be forgotten under the rules that apply to you is a question for your own legal and engineering review.

Resources and Deep Search

Users share more than text. They send photos from a holiday, voice notes, a PDF from a course they are taking, links to articles they liked. Stored as Resources in the user’s Base, each item is indexed on arrival: images get captions, OCR text and dominant colours, audio is transcribed with timestamps, and links are fetched and indexed. Deep Search then lets the companion find the right item by meaning, so “the photo from the lake” or “that article about sleep” resolves to the specific image or passage. For files in formats you need turned into text first, Extract returns structured, timestamped or page-numbered chunks through one endpoint.

Example architecture

The shape is a light read before the companion replies and a heavier write after the user has had their say.

At sign-up, create a Base for the user with a single create Base request and store its ID on the user record. Write any onboarding answers, such as a preferred name and topics to avoid, as verbatim memories so they are exact from the first message.

When a session opens, retrieve memories scoped to that Base with a query built from context, for example “recent events, open worries and preferences”. Put the results in the system prompt alongside the companion’s persona. Keep the last few turns of the live conversation in the prompt as well: memory stands in for the long tail of history while the current thread stays as it is.

During the conversation, when the user refers to something from the past, such as “like I told you about my landlord”, run a memory search for it, or a Deep Search over shared files if they mean something they sent. If they state something that must not be misremembered, write it straight away as a verbatim memory.

After each exchange or session, send the new messages to Memory for automatic extraction. Extraction runs asynchronously, so it never delays a reply. A Worker can run on a schedule inside each user’s Base to summarise the week into a note the companion can refer to, tidy shared files into folders, or update memories based on new material in the Base.

The read path is one or two small calls. Everything heavy happens off the critical path, which keeps the companion responsive on a phone with a patchy connection.

What compounds over time

A companion built this way gets more personal the longer someone uses it, and more accurate as well. Because M-1 consolidates and resolves as it goes, a year of conversations produces a cleaner picture of the person than a month did, with no point at which the history becomes too long to use. That is what personalisation means for a companion, and it is the part of the product that a competitor using the same model cannot copy by changing a prompt.

Cost moves the other way. Replaying transcripts makes each message more expensive as a relationship deepens, while retrieving a few hundred tokens of facts keeps the prompt roughly flat however long it runs. In an illustrative request, this approach cuts input tokens by about 81%, and the token cost calculator estimates the saving for your own traffic. The reduce token costs solution explains the arithmetic.

Boundaries worth designing for

Memory makes a companion more capable, so it is worth being deliberate about what it keeps. Exabase extracts what is said, which means a passing remark can become a stored fact. Decide early which kinds of detail your companion should remember and which it should leave alone, write user-stated boundaries as immutable memories, and give users a way to see and delete what the companion knows about them. Each Base can be browsed in the Exabase console, so your team can inspect what was stored when investigating a complaint.

Guard against memory poisoning as well: if your companion reads text from links or files that users share, treat that content as data and keep it from rewriting the companion’s instructions. Exabase is the memory, storage and search layer here. The companion’s persona, its safety policies, how it responds to a user in distress and what it chooses to say all remain your logic, built on top.

Who’s building this

Teams building companion and friendship apps, journaling and reflection assistants, coaching and wellbeing companions, language practice partners and character chat products: anywhere a person returns to the same AI over months. The pattern is close to our personal AI assistants use case, with more weight on emotional context than on tasks. Voice agents covers companions people talk to out loud, learning copilots covers tutors that track what a student struggles with, and NPC memory covers characters inside games. Our essay on an AI that knows you takes the longer view.

Get started

Start with the getting started guide, then read memory scoping to see how per-user isolation works. The agent memory solution explains the design in more depth, our comparison of agent memory platforms sets Exabase beside the alternatives, and Exabase vs Mem0 covers the most common head-to-head. There is a free plan with 200 credits a month and up to 100 Bases, and current prices are on the pricing page.

Frequently asked questions

How does an AI companion remember users between conversations?

It stores what users share in a memory system outside the model and retrieves the relevant part at the start of each conversation. With Exabase Memory, you send conversations in, M-1 extracts facts, preferences and events, and a memory search scoped to the user’s Base returns the current picture in about 200ms.

What happens when something in a user’s life changes?

The newer fact supersedes the older one when it is written. If a user moves city, changes job or ends a relationship, M-1 resolves the conflict so the companion works from the current fact instead of holding both.

How do I keep each user’s memories private?

Give each user their own Base. A Base is an isolated environment with its own memory and storage, and a call scoped to it cannot reach another Base’s data. Pass the Base ID with every call; the multi-tenant solution shows the pattern.

Can users ask the companion to forget something?

Yes. Individual memories can be updated or deleted through the Memory API, and deleting a user’s Base permanently removes all of its data. How you expose that to users, and whether it meets the obligations that apply to you, is part of your own product and legal design.

Do I have to decide what the companion should remember?

No. Send conversations as text and extraction is automatic. When you want exact control, for example over a preferred name or a stated boundary, write a verbatim memory with infer set to false, and mark it immutable if it should never change.

Does memory make conversations more expensive?

It usually makes them cheaper. Retrieved memories replace replayed history, so the prompt carries a few hundred tokens of relevant facts instead of thousands of tokens of transcript, and it stays roughly flat as a relationship grows. Query expansion and reranking use a small amount of credits when you turn them on.

Is Exabase a companion app or a chatbot framework?

Neither. Exabase is infrastructure: memory, isolated storage, search and extraction through a REST API and a TypeScript SDK. It is model-agnostic and framework-agnostic, and your companion’s model, persona, safety handling and interface stay yours.

Related pages: Personal AI assistants, Voice agents, NPC memory, Email assistants, Learning copilots, Agent memory solution, Agent memory, Long-term memory, Best agent memory platforms, Personal AI will be won on memory

Cut your token spend and give your agent precise context.

Get started in minutes.

Cut your token spend and give your agent precise context.

Get started in minutes.