Miaomory

AI Doesn't Remember, Yet Gets to Know You BetterHow Top-Tier Personal Assistant Memory Is Designed

Watch the 24-second demo

The Codex hook saves “When reviewing code, show user-facing issues first.” In a separate process, the Claude Code adapter searches for “code review” and “user-facing issues”. It finds message m1 and retrieves the original sentence by ID. Both processes use the same temporary store with the background model disabled.

View Miaomory on GitHub
Contents

A personal assistant agent's "aha moment" depends on memory

Personal assistant agents are all the rage lately. Examples include Muse, Duet, Instinct and ByteDance's Xiaodou. Compared with agents like Codex, Claude Code and WorkBuddy, two parts of the experience really stand out.

Personal assistant agents are all the rage

First, they're more in tune with you. I told a personal assistant agent I wanted to practise spoken English. It wasn't for an exam: I wanted to do a better job hosting foreign visitors at work. An agent like Codex treats a request like this as a standalone project: it draws up a business-English small-talk plan, then asks what topics you'd like to cover. The assistant agent instead took things I'd discussed with it day to day, such as AI return-on-investment analysis, AI infrastructure and AI application development, and turned them into one practice topic a day. It even matched the "broken English" I like to sprinkle into our chats, with terms such as AI Infra, MaaS, Personal Agent and PMF (product-market fit).

Second, they show more initiative. This doesn't come from preset scheduled tasks. They do something for you based on what you've been caring about lately. I never told Muse anything about it, but once it learned from Apple Health that I follow a regular running plan, it began checking the air quality where I am before each run. When the air is bad, it asks whether I need help. It's more like a report who understands your goals and vision and comes to ask whether you need support. Codex and WorkBuddy are more like colleagues who execute very well, but you have to break a task down clearly before handing it to them.

Both depend on tens of millions of words of everyday conversation, built up day after day. In all those words the agent has to find a needle in a haystack. It must remember a precise number you mentioned months ago, and work out the changes, joys and frustrations in your life from a few chats that seem unrelated.

Miaomory, built while learning: memory scores in the top tier, at about 1/4 the cost

I develop an office assistant agent at my company. Partly out of interest and partly for work, I read a large number of papers and analysed many rounds of conversation with personal assistant agents such as Instinct and Muse. Out of that I built Miaomory, a memory system for personal assistants. It is fully open source (github.com/eggypi/miaomory) and supports Claude Code and Codex. Here's a look at its features and early results:

Everything is about you. The memory is designed to support the agent's initiative. For example, it tracks which things you want the agent to handle or explore on its own, and which things it should stay quiet about so it doesn't become annoying. It also lets the agent think about what it could do for you, and what value it could create, based on your recent work. We often talk to assistants casually, saying things like "next week" or "the day after tomorrow". The memory converts these into exact dates. It also tracks whether something that came due actually got resolved, so a model with a weak sense of time doesn't mix things up. It also maps out your relationships, the responsibilities of the departments you work with, and the projects you're driving. It builds a profile for each important person around you, noting what the people you care about like, ready to look up at any time. In short, everything is about you.

Top-tier score at about 1/4 the cost. LongMemEval is a 500-question memory exam for agents. Behind each question are dozens of chat sessions and well over 100,000 tokens of history. It tests whether the agent can remember an exact number mentioned long ago, infer changes in your life, and honestly say it doesn't know when nothing in memory covers the question. On these 500 questions, we answered 93.4% correctly. That puts us in the same top tier as open- and closed-source projects from excellent labs such as Mem0, Mastra and Zep, whose scores range from 90 to 95. The agent I built before scored only 61 in English, so the new architecture is a big step up. On cost, comparing price per million tokens, this project costs about 1/4 as much as the Supermemory memory plugin.

Top-tier score at about 1/4 the cost

Note: Projects differ in question count, answering model and scoring method, so this is only an approximate comparison, and a gap of a few points is closer to noise. Averaging accuracy by question type, we get 94.8%. The questions are answered by the working agent. We tested the memory curator agent with GLM 5.3 Flash (thinking off) and GPT-6 Luna (low reasoning effort), and the results showed no significant difference.

Memory stays entirely on your machine, and you can view, edit or delete it at any time. Some projects call external APIs and upload your memory so it can be organized remotely. Miaomory keeps the organized memory entirely in a folder on your own computer. You can view, edit or delete it whenever you like, so your privacy is better protected.

Claude Code and Codex share one memory. You may switch between the two clients often. If the plugin is installed in both, your work in both is organized into the same memory: Codex knows what you did in Claude Code, and vice versa. This helps the agent see how your recent work is changing across projects, and makes "in tune" replies more likely.

What follows are my study notes. Don't worry: I only share the ideas and the fun discoveries, and you can follow them easily without a technical background. If you're interested in the algorithms and implementation, take a look in the project (in Chinese). That part is just as fun.

Counterintuitive: AI doesn't actually "remember" anything

We deal with agents every day, and it feels as if they have excellent memories. Some friends have even asked me whether the agent memorizes your information during the conversation and then repeats it to other users.

In fact, an AI model can't "remember" anything on its own.

A model is fixed the moment its training ends. You can tell it about your knowledge, your life or your work, and nothing in its head changes. Read a model vendor's release notes carefully and you'll find the phrase "knowledge cutoff". Anything that happened in the world after that date, the model doesn't "know" and can't "remember".

What we call remembering is the model rereading the whole chat history every time, by brute force. Every sentence you've said, every reply it's given and every step it's taken on your computer has to be fed back in before it answers your next question. The longer you chat, the more it has to read before each answer. Every time, the model takes this history of up to a million words and predicts what to say next. At heart, it's brute force.

Remembering means rereading the whole chat history every time

Brute force has its limits. The model has to read the whole history before each answer, but there's a ceiling on how much it can read. Even the strongest model can only read a limited number of tokens at once (think of tokens roughly as words). You may have heard the term "context window", and the metaphor is apt. The history a model can read each time is like the view through a window. The stronger the model, the bigger the window and the more it can see, but no window is infinitely large. Today's leading models can see roughly 600,000 to 1.6 million Chinese characters' worth of text through the window per answer. The vendor's own prompts, safety requirements and so on take up part of that. The longer a personal assistant stays with you, the more chat and work records pile up, until they reach tens of millions of words. Suppose you then ask about the weight you mentioned six months ago. How does the memory system find that chat among tens of millions of words and place it accurately where the model can see it through its "window"? That's the core challenge.

Miaomory's memory design

Hire a memory curator agent that clocks in on schedule

There are broadly two approaches to agent memory design.

The first has the working agent keep its own notes. The working agent is the one that chats with you and gets things done for you, such as WorkBuddy. Suppose you tell it, "Of all cats, I like Chinese field cats best, because they…". It creates a local note called Cat preferences and writes "The user's favourite cat is the Chinese field cat". Then it adds an entry to an "index": "Which cats the user likes and why: see Cat preferences". Each chat loads only the index into the model, not the full Cat preferences note, to lighten the model's load. The next time cats come up, a clever enough agent follows the index to that note and pulls the specific reasons you like field cats into the window it can see. Claude Code and my previous agent project mainly work this way. The approach is simple and elegant, but it has three main limitations:

  • The model decides on its own when to take notes, so things slip through. Whether the model decides to take a note is a bit of a mood thing, and that's also why my earlier agent scored low overall. With today's open-source models, many specific numbers and preferences that users mention don't seem worth noting to the model. Once the chat history outgrows the window, anything that never made it into a note is simply lost.
  • The working agent's attention is limited, and its notes can get messier over time. Models, like people, tend to go off track when too many to-dos are crammed into their heads (the window) at once. Say a user has the agent working on a complex spreadsheet. Meanwhile, the developer's system prompt also tells it to watch for the user's preferences, write any it finds into a dedicated note and register that note in the index. The model usually puts the spreadsheet first and sets the memory instructions aside. I've watched users of our internal agent at work. The agent often ignores the instruction to "write only brief entries in the index and point to the note that holds the details", and dumps every lesson it learns straight into the index. The index keeps growing, the model has more to read each time, and its attention gets worse in turn. It becomes a vicious circle.
  • The cost is high. The working agent usually runs on an expensive flagship model, while organizing memory isn't a very complex task. Using a pricey model for simple work adds up over time. In normal use you might spend an extra 100-plus yuan (about US$20) a month on memory organization alone.

That makes the new approach clear: hire a dedicated "memory curator agent". The two divide the work cleanly. The working agent has no permission to record or change any memory: it only reads memory and focuses on your tasks. The memory curator agent is dedicated to organizing your memory. It uses a very cost-effective model, sometimes one that's free at night, such as models in the Flash, Luna and Haiku series. Its schedule is clear too. It clocks in when the system says so: 10 minutes after you stop chatting with the agent, every hour, and every night at 23:30. Code guarantees that it shows up for work, and because its task is single and focused, it's easier to balance quality against cost. Supermemory, Instinct and others belong to this school. As for the working agent, it can simply read the memory and get on with the work.

Hire a memory curator agent that clocks in on schedule

What the memory curator agent records

When the working agent talks with you, the "chat record" it produces is far larger than what you see. Besides your instructions and its replies, there are many records of it operating your computer, sometimes more than 90% of the total, such as what code it ran and what results came back. Before every reply, it has to reread all of this from the top, along with your instructions, so what to record needs careful thought. Overall, the files we keep are organized like this:

What the memory curator agent records

  1. A daily log (the curator starts writing once you've stopped chatting for 10 minutes): it records what happened that day, such as "14:10 synced with Xiao Zhou; new product roadshow next Tuesday". It also pulls out long-term facts, such as that you love little cakes, or when the weekly product meeting is held. Each fact is recorded in a fixed format: it is tagged with a type and an importance level, your exact words are attached, and a few keywords are added. For example:

    Fact | Preference | Importance: medium
    The user loves little cakes.
    Exact words: "A little cake in the afternoon keeps me happy all day."
    Keywords: dessert, afternoon tea, snacks

    The types are event, fact, preference and correction, and importance has three levels: high, medium and low.

  2. A long-term preference card (added to or rewritten at each logging pass): your preferences and your most important items, such as the product team meeting every Wednesday afternoon, or work that's due soon.

  3. Who you are (recorded when you first meet; your recent status is updated every night): your time zone, your job and what you've been busy with lately.

  4. Who the agent is (set when you first meet, and whenever you ask for changes later): the working agent's name and speaking style. For example, I named mine "Naitang No. 1" (Milk Candy No. 1) and asked it to be "like a reliable colleague of few words: conclusion first, then the necessary details".

  5. The people, departments and projects you deal with (organized every hour): every person, every department and every project has its own detailed profile. Each profile covers who or what they are, how they relate to you, the key facts, and what they've been busy with lately. For example, colleague Dario's profile looks roughly like this:

    Dario
    Relationship to you: security lead, based in the US; you often go to him about user violations.
    Key facts: good at banning violating users by every means available; handles issues cautiously.
    Lately busy with: rolling out a new set of violation-detection rules.

    Likewise, the Finance Department profile says what the department is in charge of. It also says that for irregular corporate expense claims on a project, or payment problems, you should go to its payments team. The Miaomory project profile says it's an open-source personal assistant memory project, already released on GitHub and currently focused on being integrated into the company's office agent.

  6. How the agent understands you (written at the nightly review): what kind of person you are, what you value, where your bottom lines are, and how it can create value for you on its own initiative.

  7. A to-improve list (recorded when you express dissatisfaction): things you've complained about that aren't resolved yet. At each nightly review the curator checks again whether they've been resolved. For example, ByteDance's personal assistant product is called "Xiaodou", but the agent changed the name to "Doubao" in my draft without asking, and I corrected it: "It's Xiaodou, not Doubao."

  8. A lessons notebook (recorded at logging passes): reusable lessons, so that mistakes aren't repeated. For example: "When editing the user's draft, keep product names and people's names exactly as the user wrote them; don't replace them on your own."

  9. Your exact words, every one (saved in real time): a word-for-word archive. Every memory can ultimately be checked against it as evidence.

Some overlap between records is deliberate: it helps the working agent find things

You may have noticed that some documents overlap. Say one day you mention that you love little cakes. This shows up in that day's log as both an "event" and a "fact", and on the long-term preference card as a "preference". At first I wanted everything neatly separated. Later I found that a little overlap and repetition of key facts actually makes it easier for the working agent to find what it needs. When I later analysed Muse's memory, I found a similar design with deliberate overlap.

Change your mind, and the curator adjusts right away

For example, I first named my assistant "Mianhua Miao" (Cotton Meow) and later renamed it "Naitang No. 1". At the next logging pass, the memory curator agent marks the old name as void on the preference card and writes the new one. The old entry isn't deleted, so the working agent knows that this changed, which makes the backstory easier to follow.

Every night at 23:30, the memory curator agent reviews the whole day

When work quiets down at night, the memory curator agent reviews the day: what you're following up on, the people you've just met, and how your projects are progressing. It updates How the agent understands you, infers preferences and changes you haven't put into words, and thinks about how it could create value for you on its own initiative. It also goes through the to-improve list and checks whether the working agent really fixed each item. If something isn't fixed, it keeps pushing the next day. For example, one day's review said: "Last night we said several test results would be confirmed first thing today, but today's log has no record of that. Follow up tomorrow." If the computer is off at that time, the review catches up the next day. So the longer you use the agent, the better it knows you, and the better it reads between the lines.

Find the right content at the right time for the working agent

The last step comes when you ask a specific question. The relevant content has to be found among tens of millions of words of chat history and handed to the working agent for reference. To make this easy to grasp, think of two ways to find content.

The first is semantic search, and the typical technique is called "RAG". Roughly speaking, all kinds of text are first converted into a mathematical form that captures their "meaning" for a model. Then the few passages closest in meaning to the question are picked and given to the model. Suppose you ask for "that deck from the last time I reported to the boss on how much we spent on AI and how much it earned back". In memory it is recorded as "the PPT discussing generative AI ROI with the leadership". The two sentences share almost no words but are close in meaning, so semantic search can still find it. This sounds perfect, but it needs a dedicated model to process the entire chat history in advance, so the architecture is heavy, and every match takes extra time. Besides, a personal assistant mostly handles everyday chat. It rarely needs to find similar content among hundreds of millions of items. AI customer service leans toward this approach, because a company's body of knowledge is huge, often hundreds of millions of items.

The other mainstream approach ignores meaning. It's more like searching for a keyword in Word to find the matching paragraph. Its strength is that it's lighter and faster: a keyword hit gives a result right away. But it doesn't understand meaning at all, so if the keywords don't match, it finds nothing.

Two ways to find content

Today's personal assistant agents and memory projects use both approaches. Instinct, Muse, Claude Code, Codex and others mainly use "keyword" search, while Supermemory combines "keywords" with semantics. For speed, ease of deployment and privacy (storage stays local), Miaomory takes a pure keyword approach, with a few key designs.

Memory files are brought to the working agent as needed

Memory files are brought to the working agent as needed

  • The most important content comes along every time: the long-term preference card, Who you are, Who the agent is, How the agent understands you, the lessons notebook, your exact words (only the most recent when there are too many), and an index. The index lists the documents for the colleagues you deal with, the departments related to you and the projects you're driving. When it needs to, the agent can follow the index and look things up itself.

  • Auto-retrieved from your question and handed to the agent: code guarantees this part. Every time you ask something, the code searches all of memory with your question and pulls out the few most relevant passages. Remember that our search is essentially the same as searching for keywords in Word. So when several passages all hit the keywords, how do we pick the ones most relevant to your question? We use "rarity". First your sentence is split into individual words, and each word is scored by how often it appears across all of memory: the fewer times it appears, the rarer it is and the higher it scores. Next, every passage containing these words is found (yes, just like a Word search that turns up several paragraphs). Finally, the rarity scores of the words each passage hits are added up and the passages are ranked. The higher the score, the more relevant the passage is to your question.

    For example, you ask, "What's the latest edit to the PPT's first slide?" In my daily log of over a thousand lines, "edit" appears 10-plus times, "PPT" 5 times, and "first slide" only 3 times. So "first slide" carries the most weight and "edit" the least. Ranked by score:

    • First place: "21:45 User asked to edit the PPT: first slide…" hits "edit", "PPT" and "first slide", so it goes to the agent first;
    • Further down: "21:55 User asked to shrink first-slide captions…" hits only the rare "first slide";
    • Further down still: "23:02 User agreed to the edit" hits only the common "edit".

    When two passages each hit just one word, the one that hits the rarer word ranks higher.

Auto-retrieved from your question and handed to the agent

  • The working agent gets a memory search tool: it can also decide for itself which keywords to search for, based on your chat. In practice, we have it search with several different phrasings at once to raise the odds of a hit. To make its own searches even more successful, the memory curator agent attaches a few extra keywords to certain long-term key facts as it logs them, such as your long-term views on a project or basic business decisions. That makes them easier for the working agent to find later. For example, I once said, "Tomorrow I'm going to discuss with my boss a PPT on how to measure the costs and benefits of investing in generative AI." When the curator recorded this fact, it added three keywords: "management briefing, business value, slide deck". Later, if the working agent searches for "slide deck for the boss briefing", the keywords let it find this fact, even though my original words never contained "slide deck".

    To judge how relevant a found passage is to the search query, we look at the overlap. The more words the passage shares with the query, the more relevant it is, and the more likely it is to help answer your question. For example, if the agent searches for "boss briefing PPT", the fact above matches all three words and ranks at the top.

Miaomory's memory design: an overview

Memory may be winner-take-all for agents, and it's worth exploring further

Personal assistant AI startups command sky-high valuations. Instinct was valued at US$10 billion when its user count had only just passed 100,000. One basic logic behind this is that agent memory may have a winner-take-all effect. If an agent has built up enough memories of a user and understands their life deeply enough, the user will find it hard to leave, because memory itself is hard to migrate. Think of an assistant or a friend you've known for years. You understand each other without words, and naturally there's a deep emotional bond. So the products that launch earlier and handle memory better stand a better chance later on, and may take it all. That's why memory is worth exploring further, especially the long-term memory that helps an agent take initiative, connect details from everywhere and infer changes in the user's life.

Project: https://github.com/eggypi/miaomory

References

LongMemEval

Mem0

Supermemory

Instinct

Mastra

Muse

OpenClaw

Zep

Anthropic


← Back to the Miaomory home page