Vigente
Use it as a shared MCP memory for AI agents that tracks what is currently true, what was true in the past, and how facts changed.
Save facts or episodes with optional tags, confidence, valid-from dates, and an outside-source trust flag.
Search by words and meaning; return only current facts, facts as of a past date, or include superseded versions.
Supersede one or more outdated facts with a new version, preserving and linking their history; changes to a person-owned fact may wait for confirmation.
Inspect all versions of a fact, from oldest to current.
List and filter memories by tag, kind, status, and pagination cursor.
Permanently forget a fact and all its versions from storage and indexes.
Reject secrets and hidden Unicode, flag instruction-like text, and track origin/trust so less-trusted agents cannot overwrite more-trusted facts.
Operate within a fixed workspace set by the server configuration.
Used as the optional local embedding backend (embeddinggemma): when available, the memory server computes vectors for semantic search and for proposing which existing facts a newly saved fact may supersede; without it, the server falls back to text-only search.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Vigente what database are we using now? ignore the old Postgres note"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
[lw) Lastword
Memory for AI agents that knows what is still true. · Leer en español
Code has version control; the facts an agent remembers usually do not. When a fact changes, most agent memories either overwrite it or keep both versions and hope that search picks the right one. Lastword does neither. The old fact is superseded: closed with a date and linked to its replacement, like a line in a diff.
Search returns only what is true now.
as_ofreturns what was true at any past date.historyshows how a fact changed.
@@ 2026-03-01 saved by a person @@
+ Supplier account ends in 2210
@@ 2026-08-01 supersede @@
- Supplier account ends in 2210
+ Supplier account ends in 4471
@@ 2026-10-01 from an email: held @@
! Supplier account ends in 9902# as of May 1: 2210
$ lastword search "supplier account" --as-of 2026-05-01
# today: 4471, and 9902 waits for a person
$ lastword search "supplier account"A memory that several agents share, and that lasts between sessions, is also an attack surface: OWASP lists Memory & Context Poisoning among the top risks of agentic applications (ASI06). So Lastword also guards what goes in:
Secrets are rejected on save, never stored.
Hidden Unicode that can smuggle instructions is rejected.
Text that reads like an order to the agent is stored but flagged, and the agent is told never to follow a memory.
These are deterministic rules, without an LLM, measured in E3. Details in Security and privacy.
It runs locally as an MCP server, so Claude Code, Codex, Cursor or any MCP client can use it, and they can share the same memory. Everything lives in a single SQLite file.

A real session, recorded by demo/record.py with the embedding model running. The CLI follows the system language, English or Spanish, or LASTWORD_LANG.
Results
@@ first result, 129 questions (E1) @@
- naive memory: 48% right, 51% outdated
+ recency: 49% right, 51% other
+ lastword: 95% right, 0% outdatedNaive memory | Lastword | |
First result is the right fact (synthetic set, vector search) | 48% | 95% |
First result is an outdated version of the fact | 51% | 0% |
Recall@5 | 97% | 100% |
Re-ranking by recency is not enough. It removes outdated results, but then the first result is a different fact in half of the questions (51%).
LongMemEval, 470 questions from a public benchmark: without supersession, the old version of an updated fact ranks above the new one in 54–56% of cases, with any search mode.
Scale: with 200,000 facts, a search takes 25 ms and saving a fact 26 ms (7 ms each with 50,000). Saving costs as much as searching because every new fact is compared with the current ones to propose replacements. Search compares compressed 1-bit vectors first and re-ranks the best candidates with the exact ones, with the same results as an exact search in E1 and E2 (ADR-0010). Add about 13 ms for the embedding model.
A real agent (Claude Code, four independent sessions sharing only Lastword) follows the protocol on its own: before saving a change it searches for the old fact, or it links the replacement that
rememberproposes; it does not duplicate facts, and it answers with what is current.Exact codes: vector search already returns the right memory first for 36 of 36 questions that hinge on a code (error E-4031 vs E-4013, order 7781 vs 7718); text search alone gets 34. So no special mode was added.
Security: the filters catch 40 of 40 secrets with no false alarms on 40 lookalikes (order numbers, hashes, «the key is in 1Password»), and flag 40 of 40 injected orders while marking 1 of 40 legitimate memories. The same author wrote the cases and the rules, so read it as a ceiling.
The decision rules were fixed before measuring (protocol), and E1 and E2 give identical results when re-run.
Related MCP server: al-buddy-memory-mcp
Security research: can a lie replace a fact?
The question. Filters stop secrets and orders. But a lie written as a plain sentence is neither. ShadowMerge (May 2026) attacks graph memories this way: instead of an order, it plants an ordinary relation that contradicts the true one. Its authors report a 93.8% average success rate on Mem0, and find that representative input-side defenses are not enough. Lastword is not a graph, and ShadowMerge itself was not run against it, but the idea carries over.
What happened here. A person saves «the supplier is paid on the account ending in 4471». An agent that read a forged email supersedes it with «…ending in 9902». In version 1.3.1, over 12 cases like this, all 12 lies were accepted, none with a warning, and recall returned only the lie. remember even suggested that the agent close the true fact. The truth could always be recovered from history, but nobody was told to look.
The fix. Each memory keeps its origin: a person, an agent, or something an agent brought from outside. The interface sets it, not whoever writes: over MCP nobody is ever a person. A less trusted origin cannot close or delete a more trusted fact. The change waits, the true fact stays current, and a person decides (lastword pending, accept, reject). Measured with the rule fixed before writing the code, on 12 invented pairs and 70 from a public benchmark (script, results):
@@ forged email: supersede 4471 @@
Supplier account ends in 4471
! Supplier account ends in 9902
@@ held: a person saved 4471 @@Attack on a fact saved by a person | Facts closed or deleted | Lie returned without the truth (k=5) |
| 0 of 82 | 0 |
Linking two of the person's own facts | 0 of 82 | 0 |
| 0 of 82 | 0 |
| does not apply | 0 |
Reviewed before release. E5 passed, and still a security review found two ways to make the protection useless and several smaller ones: for example, changing the text while the person decides. They are fixed, with one test per attack, and told in ADR-0011 (in Spanish). Measuring five routes well does not prove there is no sixth.
An agent can still change what another agent saved. Same origin, no protection.
lastword confirmprotects a fact a person vouches for.Lies saved next to the truth are only mitigated. Both are returned, the trusted one first. The table is with embeddings: asking for a single result, 3 of 23 lies came alone, and without embeddings, 1 of 66 with five results. The warning names both in 58 of 69 real cases (84%): below the 90% set beforehand, if it must name both. Read literally, the rule is met with 63 of 69.
It costs extra warnings. All 10 legitimate statements on the same topic as a person's fact got one. Without embeddings, so did 2 of 8 unrelated ones.
An agent with access to the terminal can use the CLI, and there it counts as a person.
Read in their code on 25 November 2026, without running it:
Project | Validity dates | Does trust decide what replaces what? |
Yes | No: the later date wins | |
Not found | Partly: rules on who may write what; quarantine and rollback | |
Partly, in its graph | Partly: trust flags conflicts in four relation types, and a person decides |
The design, what was discarded and why: ADR-0011 (in Spanish).
What's new since 1.0
A new name (2.0). The project was called Vigente; what was set up with that name keeps working (how to upgrade).
Who may change a fact (1.4). A less trusted origin cannot replace a more trusted fact: the change waits for a person (why).
Security review (1.4). Three rounds of automated reviewers, before release: two ways around that protection, hidden text, terminal codes and a pattern that blocked the server, all fixed (CHANGELOG).
Security (1.1). Secrets are rejected on save, hidden Unicode is rejected, and text that reads like an order to the agent is flagged.
lastword reviewlists what is flagged.One fact replaces several (1.2). «Ana and Luis moved to Lisbon» closes both their old cities in one step:
also_old_idsin MCP,--alsoin the CLI. Since 1.3, another fact can be added later to the same replacement.Share it between computers (1.2).
lastword-mcp --httpserves the memory to other machines, a team or a cloud agent, with a required token. Since 1.3,--allowed-hostkeeps it on localhost behind an HTTPS proxy.Faster search (1.2). Two-stage vector search: about 9 times faster than exact search with 50,000 memories, with the same results.
English or Spanish (1.2). The CLI and
lastword-mcpfollow the system language orLASTWORD_LANG.Audited (1.3). A full review of the code fixed, among others, a date bug and two privacy issues (Security and privacy).
Every version, in detail: CHANGELOG.md.
How it works
One file. SQLite holds the rows, a full-text index (FTS5) and a vector index (sqlite-vec). Every write or deletion is a single transaction across all three.
Facts are never edited.
supersedecreates the new version, closes the old one and links both. «True at time t» meansvalid_from <= t < valid_to. One new fact can replace several: «Ana and Luis moved to Lisbon» closes both their old cities (ADR-0008).The engine calls no LLM.
rememberuses local embeddings (embeddinggemma via Ollama) to propose facts the new one may replace. The agent, which already is an LLM, decides. Proposals favour not missing a replacement (17 of 18 in the hand-written set), so statements on the same topic also get one; similarity cannot tell «this updates that» from «this adds detail», and masking names and numbers did not help.Forgetting is real.
forgetdeletes every version of a fact from the rows, both indexes and the disk. A test checks that the bytes are gone from the file.It degrades gracefully. Without embeddings it searches by text. It refuses to send memories to a non-local service unless you allow it.
It is made to be shared between agents. Secrets are rejected on save, and memories that read like orders are flagged (Security and privacy). A false fact is neither, so a less trusted origin cannot replace a more trusted fact (what that covers and what it does not).
Quick start
git clone https://github.com/laulys/lastword && cd lastword
uv sync
ollama pull embeddinggemma # optional: without it, Lastword searches by text only
uv run lastword add "The project uses PostgreSQL 15" --valid-from 2026-03-01
uv run lastword add "We moved to SQLite for our MVP" # proposes replacing the previous fact
uv run lastword supersede <old-id> --by <new-id>
uv run lastword search "which database do we use?"
uv run lastword search "which database do we use?" --as-of 2026-06-01All CLI commands (lastword --help for their options):
Command | What it does |
| Saves a memory and proposes current facts it may replace |
| Replaces one or more facts with their new version ( |
| Searches what is true now, at a past date ( |
| One memory, or every version of a fact |
| Lists memories, newest first, with filters |
| Deletes a fact and all its versions for good |
| Lists flagged memories: possible orders to the agent, hidden characters or secrets |
| Vouches for a fact an agent saved: only a person can change it |
| Changes waiting for a person to decide |
| Computes the vectors that are missing |
| Checks the database and its indexes; counts memories |
| Creates the database and the workspace |
Use it from an agent (MCP)
Claude Code:
claude mcp add lastword -e LASTWORD_WORKSPACE=my-project -- uv --directory /path/to/lastword run lastword-mcpCodex:
codex mcp add lastword --env LASTWORD_WORKSPACE=my-project -- uv --directory /path/to/lastword run lastword-mcpCursor (.cursor/mcp.json) or Claude Desktop (claude_desktop_config.json):
{
"mcpServers": {
"lastword": {
"command": "uv",
"args": ["--directory", "/path/to/lastword", "run", "lastword-mcp"],
"env": { "LASTWORD_WORKSPACE": "my-project" }
}
}
}Tool | What it does |
| Saves a fact or an episode and proposes current facts it may replace. Rejects secrets |
| Searches what is true now, or at a past date ( |
| Closes one or more outdated facts and links their new version (new text, or the id |
| All versions of a fact |
| Lists memories with filters |
| Deletes a fact and all its versions, also from disk (marked as destructive). Not a person's fact |
The workspace is fixed by the server configuration, so an agent cannot read another one. Clients configured with the same workspace share the memory, even at the same time: what Claude Code saves, Codex and Cursor find.
Share it between computers
lastword-mcp --http serves the same memory over HTTP, so other computers, a team or a cloud agent can share it. A token is required (ADR-0009):
export LASTWORD_TOKEN=$(openssl rand -hex 32)
LASTWORD_WORKSPACE=team uv run lastword-mcp --http --allowed-host memory.example.comIt listens on 127.0.0.1:8765 only. Put an HTTPS proxy (Caddy, nginx or a tunnel) in front on the same machine, and name its public host with --allowed-host: without it, the server answers 421 to requests that arrive with that name. --host 0.0.0.0 exposes the unencrypted port to the whole network, so use it only on a network you trust.
Claude Code:
claude mcp add --transport http lastword https://memory.example.com/mcp --header "Authorization: Bearer $LASTWORD_TOKEN"Codex (~/.codex/config.toml):
[mcp_servers.lastword]
url = "https://memory.example.com/mcp"
bearer_token_env_var = "LASTWORD_TOKEN"If your client has its own memory, the agent may save the same fact in both places, and only Lastword will know when it stops being true. In Claude Code you can turn its auto memory off with
"autoMemoryEnabled": falsein the project settings, or withCLAUDE_CODE_DISABLE_AUTO_MEMORY=1(docs).
Security and privacy
A memory that several agents share, and that lasts between sessions, has to be careful with what goes in and what goes out (ADR-0007).
When it matters. Claude Code and Codex already protect the session: they ask before running commands, and their models are trained to distrust instructions found in pages or files. What they do not check is what stays written in a memory that outlives the session and that other clients will read. So these filters matter most when the memory is shared:
between Claude Code, Codex and Cursor, where the memory is only as careful as the least careful client that writes to it;
between people, over HTTP, where what someone else saves ends up in your sessions;
with agents that read outside content, such as emails, issues or web pages, or agents built from scratch with fewer safeguards of their own.
With a single client, on your own computer, they add less: the main reason to use Lastword is then the other half, knowing what is still true.
What Lastword does:
Nothing leaves your computer by default. The memory is a local SQLite file, and embeddings come from a local model. Sending memories to a non-local embedding service requires
LASTWORD_ALLOW_REMOTE=1, and system proxies are ignored for local addresses. On a computer with several users and no Ollama running, another one could listen on its port: there, turn embeddings off withLASTWORD_EMBED_MODEL=none.The file is private. It is created readable by its owner only (folder
0700, file0600). It is not encrypted: disk encryption, such as FileVault or BitLocker, covers it.Secrets are not stored. API keys in 10 known formats, passwords written in a sentence or as an environment variable, and random-looking tokens are rejected on save. The error never repeats the secret, and suggests saving where it lives instead. Only a person can override it, from the CLI with
--allow-secret; MCP clients cannot.Memories are data, never instructions. Hidden Unicode that can smuggle text is rejected. Text that reads like an order to the agent is stored but flagged:
recallwarns the agent, andlastword reviewlists it. The server tells the agent never to follow a memory. These are rules in Spanish and English: they catch the obvious, not an attacker who knows them, so E3 is a ceiling.What the CLI shows is what is stored. Codes that move the cursor or hide text in the terminal are rejected, and if an older memory has them, they are shown replaced.
Forgetting erases.
forgetdeletes every version from the rows, the text index and both vector tables, and SQLite overwrites the freed space. If another connection is reading at that moment, the text stays in the database files until it closes, andforgetsays so.One agent, one workspace. The server fixes the workspace; no tool accepts another one.
Over HTTP, a token is required. At least 32 characters, compared in constant time. The server stays on
127.0.0.1behind an HTTPS proxy (ADR-0009).Audited twice. A full review of the code fixed, in v1.3, two privacy issues among others: memory text could reach a system proxy, and the file was readable by other users of the computer (pull request). A security review later fixed a text that blocked the server, terminal codes and several filters (CHANGELOG).
Configuration
Variable | Default | Purpose |
|
| Memory file |
|
| Isolated memory space |
|
| Embedding model; |
|
| Any service with an OpenAI-compatible API |
| Only if the service needs one | |
| off | Required to send memories to a non-local service |
|
|
|
| Required by | |
| system language |
|
If the embedding service is down, Lastword keeps working with text search and says so. lastword reindex fills in the missing vectors later.
Design decisions
Each decision has an ADR with the alternatives considered (in Spanish):
The full design is in docs/architecture.md.
Development
uv run pytest # no network or models needed
LASTWORD_TEST_OLLAMA=1 uv run pytest tests/test_ollama.py # with local Ollama
uv run ruff check . && uv run ruff format --check .
uv run mypy src tests eval demoUntil 1.4 the project was called Vigente. What was set up with that name keeps working: the commands vigente and vigente-mcp, the VIGENTE_* variables, and the memory in ~/.vigente. To upgrade, run uv tool uninstall vigente before installing.
How to reproduce the whole evaluation: eval/README.md (in Spanish, like the reports).
The project was built in milestones (design, core, semantic search, MCP server, evaluation, security), each with its decisions in an ADR. Since the MCP server, every change went through a pull request with its decisions and measurements.
License
Available Tools
6 toolsforgetADestructiveIdempotent
Borra para siempre un hecho y todas sus versiones, también del disco.
Úsalo solo si el usuario pide olvidar algo. Para datos que cambiaron, usa supersede.
Inputs: memory_id (required). Returns: warnings, deleted_ids
historyARead-only
Las versiones de un hecho, de la más antigua a la vigente: las últimas 100.
Inputs: memory_id (required). Returns: omitted, versions
list_memoriesBRead-only
Lista memorias, las más recientes primero.
Inputs: tag, kind, limit, cursor, +1 more. Returns: items, next_cursor
recallARead-only
Busca en la memoria por palabras y por significado.
Por defecto solo devuelve lo que es verdad ahora. Siempre devuelve los resultados más
cercanos, aunque estén poco relacionados: juzga tú si responden a la pregunta.
Inputs: query (required), k, kind, as_of, +1 more. Returns: mode, results, warnings
rememberA
Guarda una memoria.
Si es un fact, devuelve posibles reemplazos: hechos vigentes parecidos que lo nuevo
podría dejar obsoletos. Si alguno lo está, enlázalo con supersede(old_id, new_id).
Rechaza claves, contraseñas y caracteres invisibles: guarda dónde está un secreto, no
el secreto.
Inputs: content (required), kind, tags, confidence, +2 more. Returns: memory, warnings, next_step, possible_supersedes
supersedeA
Marca que un hecho dejó de ser verdad y lo enlaza con su versión nueva.
El anterior se conserva en el historial, pero ya no se devuelve por defecto. Indica
new_id o new_content, no ambos. Si el hecho ya había sido reemplazado, el error indica
la versión vigente (current_id). Si el hecho es de una persona, el cambio queda
pendiente de que lo confirme (new = null).
Inputs: old_id (required), new_id, reason, valid_from, +3 more. Returns: new, old, also_old, warnings
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 6 tools
Each tool maps to a distinct memory operation: write (remember), search (recall), enumerate (list_memories), version-inspect (history), replace (supersede), and hard-delete (forget). The descriptions explicitly disambiguate the risky pairings, e.g. forget vs supersede ('úsalo solo si el usuario pide olvidar algo... para datos que cambiaron, usa supersede'). recall vs list_memories is the closest overlap, but one is semantic/keyword search and the other is a recency listing, which is clear enough.
Four tools are bare verbs (forget, remember, recall, supersede), one is a bare noun (history), and one follows verb_noun (list_memories). All are snake_case and lowercase, so it is readable, but there is no single predictable pattern to infer a new tool's name from.
Six tools is a tight, well-scoped surface for a memory store: one per lifecycle operation with no filler or redundant aliases. Every tool has an evident job that the others do not duplicate.
Core lifecycle is covered: create, search, list, inspect versions, supersede, and hard-delete. The notable gap is the 'pending confirmation' path mentioned in supersede for person-related facts — there is no tool to confirm, reject, or resolve a pending change, and no way to restore a forgotten fact.
Maintenance
Related MCP Connectors
Shared memory for AI agents and teams: store, search and correct dated facts and decisions.
Persistent memory for AI agents, for code, research and everyday life. Stale facts retire.
Persistent memory for AI agents. Search and store durable facts, preferences and decisions.
Mem0-compatible persistent memory for AI agents: write facts once, recall them semantically.
Related MCP Servers
- AlicenseNot gradedqualityBmaintenanceLocal memory for AI agents in one SQLite file on your own machine. Facts carry a validity window and a confidence score, so an outdated one is superseded and downweighted rather than deleted, and retrieval fuses BM25, vector similarity and a knowledge graph.4Business Source 1.1
- AlicenseNot gradedqualityBmaintenanceGives AI agents governed, provenance-tagged memory where facts are invalidated rather than deleted and every recall result carries validity dates, confidence, and replacement links. Stores memory in a local SQLite file with tools for remembering, recalling, invalidating, and pinning facts, plus policy enforcement and an audit trail.177 npm3Apache 2.0
- AlicenseAqualityBmaintenanceEnables AI agents to persist facts with tags, sources, and importance in a local SQLite database, retrieve them through hybrid BM25 plus embedding search weighted by retention decay, link or supersede related entries, and review everything in a read-only visual dashboard showing the memory graph and timeline.6MIT
- AlicenseNot gradedqualityBmaintenanceEnables AI agents to save, recall, and forget persistent memories stored entirely on the local machine in SQLite, using hybrid semantic and keyword search with on-device embeddings, plus spaces and profile context injection.MIT