DEV Community

Cover image for Your AI Agent Forgets You Every Time? Meet memento-context
Fran Bar Instance
Fran Bar Instance

Posted on

Your AI Agent Forgets You Every Time? Meet memento-context

If you use any AI Agent (like Claude, Cursor, Windsurf, or similar) for coding, this has definitely happened to you:

"I prefer concise answers in Spanish, please."

"Sure, I'll keep that in mind."

The next day (or even in another conversation the same day):

"Here is a detailed explanation in English…"

No memory between sessions. You waste time repeating the same things over and over.

memento-context solves this problem. Here is an MCP (Model Context Protocol) server that gives your agent persistent, scoped memory, completely local and no-nonsense.

What does it actually do? It injects small notes and reminders at the start of every conversation. Short notes, one or two lines, to avoid saturating the agent's context. Just enough so it remembers your preferences or the rules of each project without becoming annoying.

And yes, it's open source and on GitHub:

https://github.com/FranBarInstance/memento-context

What is MCP and why does it matter?

MCP is an emerging standard that allows AI applications to connect to context servers running on your machine. These servers expose tools that the agent can call, just like it uses a browser or a code interpreter.

What does MCP solve? Until now, every conversation with an AI agent was its own isolated world. The agent didn't know who you were, what your preferences were, or how you work on each project. MCP creates a bridge: the agent can call these tools to read and write memory in a structured way.

memento-context is one such server, specialised in long-term memory. It does it cleanly, without cloud, without magic.


How it works: three levels of memory (the second one is coming)

The design is very deliberate. No "dump all tokens and see what happens". Right now you have two operational levels, and a third one on the way:

Level 1: Notes – fully operational

  • Short, high‑signal statements (1-2 lines).
  • Automatically injected at the start of every session.
  • Two scopes:
    • global: follows you across all projects.
    • repo: only for the current repository.

Example (global):

"I prefer direct answers in Spanish, without explaining basic concepts unless I ask."

Example (repo):

"This project uses DDD with hexagonal architecture. Tests are written before the code."

Level 2: Skills – coming soon

(Complete procedures, like "how to deploy to production". Not implemented yet, but it will come.)

Level 3: References + Conversation attachments – operational

  • For large content: entire conversations, architectural decisions, long documents.
  • Only a lightweight pointer lives in active memory.
  • The full content is loaded on demand only when the agent needs the detail.

The most powerful part: conversation attachments. When you explicitly tell the agent "Remember this conversation" or "Save this chat", it creates a memento and stores the dialogue and any files you indicate. You don't need to know how it's saved, just ask for it.


What it deliberately does NOT do (just as important)

  • It is not a RAG system → no vector search, no external API calls. Retrieval is deterministic and context‑driven.
  • It does not save conversations automatically → privacy first. It only saves when you ask.
  • It is not a document dump → philosophy: "small, high‑impact context".
  • It is not cloud‑basedeverything lives on your machine, in ~/.memento-context/. No remote requests of any kind.

Real‑world use cases (no technical jargon)

Personal preferences (global)

  • "Never use any in TypeScript unless strictly necessary."
  • "I like functional programming patterns when reasonable."
  • "Always answer with code examples first, then explanation."

Project conventions (repo)

  • "All API endpoints must have proper error handling with concrete exception types."
  • "We use pytest with fixtures; not unittest."
  • "Database migrations are generated with Alembic."

Architectural decisions and saved conversations

Imagine you've had a long discussion about redesigning the cache system. You say: "Save this conversation, and attach the diagram I uploaded."

Days later, you simply ask: "Do you remember what we talked about regarding the cache system?" and the agent retrieves all the context (including attachments) without you having to repeat anything.

Memory that travels between agents (this is key)

The best part: you can switch agents (for example, from Claude to Cursor) and, because everything is stored locally in the same format, the new agent can also read the mementos. The memory is not tied to a single assistant. Just ask: "Do you remember my global preferences?" and it will retrieve them instantly. That easy.


How to get started

1. Visit the repository

All the up‑to‑date information, installation scripts and documentation is at:

https://github.com/FranBarInstance/memento-context

There you will find the quick method (curl for Linux/Mac, PowerShell for Windows) as well as manual installation from source.

2. Configure your MCP client

Heads up: each agent or assistant has its own quirks when it comes to configuring MCP servers. The syntax of the configuration file may vary from one to another. For example, in some cases you can install the server globally (available for any project) and also locally (only for a specific project), while in other assistants only global installation is available.

Consult your agent's documentation (Claude Desktop, Cursor, VS Code with MCP extension, etc.) to know exactly where and how to add the configuration. In most cases, editing an mcp.json or similar file with this content will suffice:

{
  "mcpServers": {
    "memento-context": {
      "command": "memento-context",
      "args": []
    }
  }
}
Enter fullscreen mode Exit fullscreen mode

If your agent allows local configurations, you can put that block in the project's configuration; otherwise, you will have to put it in the agent's global configuration.

3. Use natural language, forget about the internal tools

You don't need to know that save_memento, get_memento_attachments or similar exist. That is the agent's job. You just speak normally:

  • "Remember that in this repository we always use FastAPI and SQLAlchemy."
  • "Remember that for all my repositories I prefer answers in Spanish."
  • "Save this conversation about the new architecture."
  • "Do you remember what we talked about yesterday regarding tests?"

The agent automatically detects the context (whether you are in a repository or not) and decides whether to save the memento as global or repo. You can also be explicit: "this only for this project" or "this for all projects".


Everything is on your disk, visible and editable

~/.memento-context/
├── global/
│   └── mementos.json
└── repos/
    └── my-project__hash/
        └── mementos.json
Enter fullscreen mode Exit fullscreen mode

When you save a conversation with files, a folder with the attachments is created. But you don't have to worry about that: the agent manages it on its own. If you want, you can open the JSON files and see what has been saved.


When does this pattern shine?

  • You work on multiple long‑running projects.
  • You have strong personal coding preferences.
  • You want your agent to evolve with you over months.
  • You often switch between different assistants (Claude, Cursor, etc.) and don't want to repeat yourself.
  • You value privacy and everything staying local, with no external API calls.

Links and resources


What about you?

Have you already tried any memory system for your AI agent? Do you suffer from the "every conversation starts from zero" syndrome? Do you like the idea of memory travelling between agents? Tell me in the comments.

And if you try memento-context, I would love to hear about your experience!


Top comments (0)