mem0ry4ai
Persistent, local-first memory for coding agents. Your AI assistant finally remembers your projects between sessions.
Python stdlib + PHP 8 · no Docker, no vector DB, no API keys · GPL-2.0
What is mem0ry4ai?
Coding agents like Claude Code forget everything between sessions —
every trap you debugged together, every decision you made, every "where was I?" when
you return to a project after a month. mem0ry4ai fixes that: it stores durable
knowledge (gotchas, decisions, facts, commands, preferences, todos, project status)
in plain markdown versioned by git, and injects the relevant slice
automatically at the start of every session — scoped to the project you are in.
We surveyed the existing landscape first (claude-mem, basic-memory, mem0, Letta/MemGPT,
Graphiti, the official MCP memory server) and designed against the failure modes we
found: models that forget to call save tools, fragile vector databases, memory that
silently rots, and over-confident auto-extraction.
Features
- Markdown + git = source of truthAuditable, diffable, human-editable. The SQLite FTS5 index is derived and disposable — delete it and it regenerates.
- Deterministic session hooksClaude Code hooks inject relevant memories at SessionStart — no relying on the model to remember to recall.
- Supersede, never deleteOutdated facts are marked superseded with a link to their replacement. History stays; git keeps everything.
- Trust-gated captureThe in-context agent writes directly; optional local-LLM extraction (Ollama) goes through a human review queue — we measured small models at ~1.0 confidence on everything.
- "Where was I?" built inFirst-class
todo and status types, pinned first in injection and on each project's page.
- Ranked searchFTS5 (bm25) from both the CLI and the web UI — same index, no embeddings needed at this scale.
- Web UI with live updatesSystem dashboard with health checks, per-project pages, bulk operations, supersede-chain navigation, review queue. Bilingual EN/RO.
- "What Claude sees"A transparency page that renders the exact injection your agent receives, with its size in bytes and tokens.
- Zero heavy dependenciesPython stdlib + PHP 8 + git. The web UI runs on a bundled
php -S launcher, auto-started by the session hook.
Measured impact
Real numbers from the author's monorepo (30 sub-projects, 217 active memories) —
before and after migrating a monolithic CLAUDE.md into mem0ry4ai:
- Before: 242,956 bytes (1,832 lines) of context loaded at every session start ≈ ~61k tokens.
- After: ~29KB at the repo root (≈ ~7.3k tokens) or ~19KB inside a sub-project (≈ ~4.8k tokens) — an 88–92% reduction, scoped to what is actually relevant.
- Overhead: the SessionStart hook costs 69 ms; the live-update poll costs 1–4 ms when nothing changed.
- At the author's measured pace (34 session starts/day) that is roughly 1.8M tokens/day of context that no longer gets loaded — while recall got better, not worse.
Honest caveats: tokens estimated at ~4 chars/token; prompt caching makes billed savings smaller than the raw numbers; one user's setup, not a controlled study.
Screenshots
The dashboard: live counters, health checks, recent activity with source attribution, memories grouped by project.
The per-project "where was I?" page — status and todo pinned first.
The review queue. Note the junk candidate at confidence 0.95 — exactly why nothing auto-writes.
Git history (v0.2.0): the memory timeline — per-commit diffs, supersedes visible in red/green, commit from the UI.
"What Claude sees": the exact SessionStart injection, with its cost in bytes and tokens. All screenshots use demo data.
Install
- Clone the repo:
git clone https://github.com/cremenescu/mem0ry4ai.git && cd mem0ry4ai
- The CLI works immediately:
./mem.py add, list, search, supersede.
- Start the web UI:
./server_web.sh → http://127.0.0.1:8841/
- Wire it into Claude Code:
python3 hooks/install.py --target user
then restart Claude Code (or /clear). From now on every session starts with your memories injected.
Your data stays yours. Everything lives in store/*.md on your machine,
versioned by your local git. No cloud, no telemetry, no API keys.
What's not yet there
- Vector embeddings (FTS5 is plenty at personal scale; embeddings are a possible add-on).
- Authentication on the web UI (designed for localhost use).
- Hooks for agents other than Claude Code (the CLI and store format are agent-agnostic).
License & credits
mem0ry4ai is released under GPL-2.0-or-later.
Built with Python, PHP, SQLite FTS5 — and a healthy distrust of over-confident language models.
Changelog
Mirrors the GitHub releases exactly. Newest first.
v0.3.0
· 2026-06-10
Automatic end-of-session git checkpoint.
- Auto-checkpoint — the SessionEnd hook now commits
store/ by itself; memories written during a session land in git history with no manual action.
- Health panel: an uncommitted store is an informative gray state, not a red error — it is the normal mid-session condition.
- The commit button on the git history page remains for mid-session checkpoints with a custom message.
v0.2.0
· 2026-06-10
— Git history page
- Git history page — the store's timeline in the web UI: every commit touching
store/ with a lazy-loaded, colored diff.
- Commit from the UI — uncommitted store changes are listed, with a button that commits store files only (authored
mem0ry4ai web, no signing, never touches code).
- README: Measured impact section (real before/after numbers) + screenshot gallery with demo data.
v0.1.0
· 2026-06-10
— First public release
- Markdown + git as the source of truth — auditable, supersede-never-delete; the SQLite FTS5 index is derived and disposable.
- Claude Code hooks: inject relevant memories at SessionStart (scoped per project, capped multi-project index from a monorepo root), capture transcript pointers at SessionEnd/PreCompact.
- Trust-gated capture: the in-context agent writes directly; optional offline extraction with a local LLM (Ollama) goes through a human review queue.
- First-class
todo and status types — pinned first in injection and UI.
- Web UI: dashboard with health checks and live updates, per-project pages, FTS5 ranked search, bulk operations, supersede-chain navigation, "What Claude sees" preview, review queue. Bilingual EN/RO.
- Standalone server (
php -S launcher with PHP_CLI_SERVER_WORKERS), auto-started by the session hook. Binaries resolved from PATH with env overrides.