Skip to main content
Glama

mesa-lore

mesa-lore is a local, CPU-only memory layer for coding agents. It indexes past session transcripts and short agent notes in one SQLite file, then lets a new session pull back only what it needs, in small pieces, with sources. It makes no LLM calls, uses no embeddings, and needs no network at runtime.

Website: mesamemory.dev/lore · Türkçe

Why

Resuming work usually means replaying a long session or explaining the context again, and both cost tokens. mesa-lore starts a session with a short index and lets the agent search for details only when it needs them.

Related MCP server: engram

Install

Requires Python 3.10 or newer.

git clone https://github.com/Yasou13/MESA_Lore.git
cd MESA_Lore
python3 -m venv .venv
.venv/bin/pip install .
.venv/bin/mesa-lore install
.venv/bin/mesa-lore doctor

install adds the MCP server and hooks to the supported agents and imports existing history. It backs up files it changes to ~/.config/mesa-lore/backup/.

mesa-lore install [--home PATH]    # configure agents and import history
mesa-lore doctor [--home PATH]     # check configuration, schema and ingest warnings
mesa-lore uninstall [--home PATH]  # restore backed-up configs and keep the database

Supported agents

Agent

Memory tools

Automatic capture

Claude Code

MCP

SessionStart, Stop and SessionEnd hooks

Codex CLI

MCP

Same hooks, after you approve them with /hooks in Codex

Antigravity

MCP

Transcripts are scanned when the server starts or on ingest-pending

Claude desktop

MCP

None. Chats on claude.ai and in the desktop chat tab are not captured

CLI

mesa-lore search "why did login fail" --project my-app
mesa-lore index --project my-app
mesa-lore show <id> --before 2 --after 2
mesa-lore export --project my-app --out my-app.md
mesa-lore export --all -o notes/
mesa-lore stats --days 30
mesa-lore purge --older-than 90d

Run mesa-lore --help for all commands.

Memory and handoffs

Agents use four MCP tools: memory_index, memory_search, memory_get and memory_save.

memory_save stores a short note of kind decision, fact, todo, failed_attempt or handoff. A note can replace an older one, which marks the older note as superseded.

A handoff tells the next session what was done, what was decided and what comes next. mesa-lore builds a basic handoff from each ingested session. In agents with a Stop hook, it also asks the agent to write its own at turn 8, then at most once every 20 turns. An agent-written handoff takes precedence.

Search returns the current project plus global notes. research:<topic> scopes are returned only when asked for directly.

Data and privacy

  • Data stays in ~/.local/share/mesa-lore/lore.db. Set MESA_LORE_DB to use another path.

  • Nothing is sent over the network by mesa-lore.

  • Common API keys, tokens, passwords and private keys are masked before storage. Masking is pattern-based, so an unusual secret format can be missed.

  • Text returned to agents is wrapped in <untrusted_memory> tags so it is treated as data.

  • To exclude projects from ingest, add this to ~/.config/mesa-lore/config.toml:

excluded_projects = ["private-client"]

Platform status

  • Linux: tested.

  • macOS: untested.

  • Windows: not supported yet.

Measured results

From the included test suite and benchmark on Linux with Python 3.12:

  • 198 tests pass and all 31 required benchmark categories pass.

  • Keyword search finds 8 of 9 benchmark questions. Turkish search finds 3 of 3.

  • Session startup costs 432 tokens: 163 for the index and 269 for tool definitions.

  • Search p95 was 86 ms on 10,000 chunks in one benchmark run.

From a private evaluation on the author's own transcripts (38,291 entries, 168 MB), which cannot be reproduced from this repository:

  • 51.7% of 120 questions were answered correctly with an 800-token memory budget. Answers and grading used LLMs.

  • The Stop hook has a median runtime of 37.5 ms.

End-to-end token savings when resuming a session have not been measured yet.

Limitations

  • Search is lexical. It has no embeddings or synonym understanding, so queries need words or stems present in the text.

  • Recall is incomplete, so check important answers against the returned source.

Development

python3 -m venv .venv
.venv/bin/pip install -e '.[dev]'
MESA_LORE_DB="$(mktemp -d)/lore.db" .venv/bin/python -m pytest -q
MESA_LORE_DB="$(mktemp -d)/lore.db" .venv/bin/python bench/run.py --require all

License

Apache-2.0. See LICENSE and NOTICE.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      B
      maintenance
      Provides AI agents with persistent, local, and shareable project memory by storing decisions and code context in a searchable SQLite index, supporting keyword and semantic search via MCP.
      3
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables coding agents to store, recall, and manage persistent memory across sessions through MCP tools, with reviewable handoffs and SQLite-backed local storage.
      1
      MIT
    • A
      license
      A
      quality
      B
      maintenance
      Enables coding agents to store, search, and retrieve long-term memory as plain Markdown files with a disposable SQLite index, including note management, decision/bug tracking, and codebase symbol lookup via MCP.
      8
      MIT
    • A
      license
      A
      quality
      B
      maintenance
      Enables MCP-capable coding agents to semantically search, store, and inspect a single local, cross-tool index of session histories and project docs. Agents can retrieve what other tools and prior sessions already discovered.
      3
      1
      MIT