Source note: Adapted from my original write-up on X. You can also inspect and download the packaged Lmemory Skill on Boloop or browse the GitHub repository.

“Switch the release process to the new checklist; the old one is retired.”

I finalized that rule in Codex one day—and the very next morning, opening a fresh Claude Code window, the agent cheerfully pulled out the old checklist again.

Anyone who writes code, edits articles, or ships projects with AI knows that sinking feeling. Rules settled yesterday vanish in a new window. Explain a constraint in Codex in the morning, switch to Claude Code or Cursor in the afternoon, and you are back to being a human tape recorder. Worse still, some memory plugins pull a few vaguely similar old notes from a vector store when asked something you never recorded—and confidently improvise from there.

I got tired of goldfish memory, and even more tired of retired rules sneaking back at midnight. That is why I forked KRouter and began maintaining Lmemory under the MIT license.

Why local Markdown and SQLite FTS5 instead of a cloud black box

There is no shortage of AI memory projects, yet Lmemory deliberately takes a low-tech, inspectable path: no cloud black box, no mandatory vector database, and zero API keys spent on personal retrieval. Every decision, correction, session excerpt, and experience card sits inside a plain Markdown folder on your own disk. You can open it directly in Obsidian and query it locally with a SQLite FTS5 index.

If something is written wrong, you open the note and edit two lines. If an automated session import ever goes sideways, one Git command or import_sessions.py --undo rolls it back cleanly—no guessing what a remote service actually stored.

After open-sourcing Lmemory on November 19, 2026, I ran it daily against my own ~2,000-page knowledge base across Codex, Claude Code, and Antigravity. Real load quickly exposed issues you only hit in actual production work—leading up to v2.1.3 and the Antigravity adapter commit 9c12ec2.

Letting new decisions override old ones without losing history

In ordinary keyword or similarity search, an old workflow doc and a new replacement doc share the exact same keywords—so opening a new session often still puts the obsolete doc first.

In Lmemory, confirming a change such as “switch to…” writes a correction record and marks the old page superseded. New sessions asking “which release process do we follow now?” automatically push the retired doc aside and rank the latest decision first. Yet if you ever need to audit “what did we decide on the 15th last month?”, querying by date still finds the historical record intact.

Meanwhile, clipped web articles and third-party research notes go into a separate knowledge_base: reference layer—never allowed to impersonate a decision you made yourself.

v2.1.3: Tightening the gate for memory: direct

Preventing old rules from resurfacing wasn’t enough. A subtler bug is finding a related page and still answering wrong.

Right before v2.1.3, querying LMEMORY_STATE_DIR matched an overly broad shortcut alias pointing at a general overview note that never explained the configuration variable—yet the receipt proudly opened with memory: direct. Even worse, an excerpt truncation once sliced the word “not” off a sentence saying “do not use the old flow”, flipping the meaning completely.

In v2.1.3, we tightened every gate around direct locking:

  • An exact alias can trigger memory: direct only when a complete supporting statement exists in a currently active note, preventing negation truncation.
  • Queries naming uppercase underscore identifiers like LMEMORY_STATE_DIR cannot lock onto a page unless that exact identifier appears in its text.
  • Superseded lines, secret/credential notes, session excerpts, and external clippings are strictly barred from asserting direct.

Every lmemory_ask receipt returns exact coordinates—file path and line range such as L8 (passage L6-L8)—stamped with one of three states: memory: direct (verified active support), memory: related (clues only; the agent must read the source file before answering), or memory: none (not in the vault—refuse to guess).

Antigravity 512 KB tail-read bug (9c12ec2) and bilingual ranking lessons

Wiring SessionStart, PreInvocation, and Stop hooks into Antigravity worked smoothly in short chats—until a multi-dozen-step tool task pushed a single turn’s output past 525 KB. When a background job woke the main agent up, the hook scanned only the trailing 512 KB of the conversation log to locate the turn’s starting user prompt, missed it completely, and re-injected memories from scratch.

Commit `9c12ec2` replaced the fixed tail read with tiered expansion (512 KB -> 2 MB -> 8 MB -> 16 MB) until the real turn boundary is aligned, and stripped personal paths into a reusable extras/antigravity/lmemory-agy.py adapter.

Bilingual ranking taught a similar lesson in restraint. Applying paragraph-coverage reranking across both Chinese and English improved Chinese historical hits, but dropped one question on the English holdout set; adding bidirectional singular/plural expansion in English turned a question that should have refused into a false citation. In the end, we restricted paragraph reranking to the top-3 related Chinese candidates and allowed only one-way plural-to-singular fallback in English—preserving Chinese gains with zero regression in English.

How Lmemory compares to cloud and local alternatives

To be fair to cloud and graph-based systems: Mem0, Hindsight, MemOS, Supermemory, and Graphiti are strong when you want managed multi-tenant infrastructure, LLM-extracted facts, Neo4j + Qdrant memory cubes, or multimodal ingestion across Google Drive, Notion, and PDFs. But for a solo developer switching between Codex, Claude Code, and Cursor on local repos, spinning up Docker graph databases or locking project decisions inside an opaque SaaS isn’t what you want just to share a rule across editors.

For local agent tools, the repo and recent runs leave concrete numbers on the same 200-question heldout3 benchmark (80 near-miss trap questions, 60 updated/corrected rules, 60 active facts) with default settings:

  • basic-memory 0.23.2: 78% false citation rate (155/200), 0/80 near-miss traps refused, 16/60 corrected decisions answered correctly (treats notes as flat docs without superseded semantics).
  • claude-mem 13.39.0: 64% false citation rate (128/200), 0/80 near-miss traps refused, 34/60 corrected decisions answered correctly (designed to passively record session observations without replacement or refusal gates).
  • Lmemory baseline design: 27% false citation rate (37/139), 46/80 near-miss traps blocked, 50/60 corrected decisions answered correctly.
  • Codebase Memory MCP v0.12.1 (tested Nov 21 on 25 cross-session memory questions): builds code call graphs with Tree-sitter in 1.51s, yet answered 0/10 unanswerable trap questions (it guessed on all 10) and ranked retired pages first on 2/9 updated-rule questions—code topology and decision memory are different rulers.

Measured accuracy, cold-start latency, and context savings

  • Chinese & English precision (v2.1.3): Across 483 real Chinese historical questions over a sanitized 1,913-page vault via isolated stdio MCP replay, top-1 source hits rose from 446/483 (92.3%) to 465/483 (96.3%)—recovering 19 questions with zero regressions. English public holdout answerable hits moved from 57/75 to 58/75. (Note: this measures retrieving historical sources already in notes; blind tests on brand-new questions are ongoing.)
  • Cold lookup speed: By sharing a single text normalization pass, caching repeated paragraphs, and trimming redundant numeric regex scans on a 1,801-page snapshot on the same Mac across 6 alternating cold rounds, median first lookup including index rebuild dropped from 7.334s to `5.818s` (-20.7%), with 3,090 timestamp-stripped receipt pairs identical byte-for-byte. On a 10,017-page synthetic vault, median cold first lookup hit 6.159s (-17.7% vs upstream base). Warm cache medians across three 120-query runs stayed at 2.56–2.96 ms.
  • Context token savings: Across 24 public synthetic tasks measured with o200k_base, stuffing full matched notes took 72,864 tokens versus `14,644 tokens` using Lmemory structured receipts—a `79.9%` payload reduction (the agent opens full files only when excerpts aren’t enough). End-to-end LongMemEval S (500 questions) upstream reference with ~5.6 default pages reached 449/500 (89.8%) on Sonnet 5.5.

Clone TinkCarlos/Lmemory or grab the Lmemory Skill on Boloop, wire it into Codex or Antigravity, and see whether your assistant stops fabricating answers or resurrecting yesterday’s retired checklist.