Source note: Adapted from my original write-up on X. You can also download the packaged Lmemory Skill on Boloop, read the follow-up v2.1.3 deep-dive & competitor comparison, or explore github.com/TinkCarlos/Lmemory.

I changed a rule in one AI chat—and the very next session, the assistant pulled the old rule right back out. Switching from Codex to Claude Code made it even worse: one assistant's chat log held the latest decision, while the other could only search old notes. Both notes even shared the exact same keywords, so either match looked right.

The more sessions you save, the more often that collision happens. I wanted multiple assistants to query one shared vault, know which decision still holds today, and point to the exact sentence backing it. That is why I forked KRouter and maintain Lmemory under the MIT license.

One Shared Markdown Vault Across Assistants

Lmemory stores decisions, corrections, and session excerpts as plain Markdown files. You can open them in Obsidian or keep them in a plain folder. SQLite FTS5 builds a local full-text index so different assistants query the same vault over MCP. I can open any note to edit manually or inspect diffs in Git, and personal search runs locally with zero embedding services or API keys.

Say I confirm "use the new release checklist going forward." Lmemory records the correction and marks the old decision as superseded. Future questions asking "how do we release now?" rank the new version first, while asking "which flow did we use last month?" still finds the historical note. Web clippings are isolated as reference material so an assistant never mistakes someone else's advice for a decision I actually made.

Each query returns a short receipt with file path, line numbers, and relevant text: marked direct when direct support exists, related when clues exist but the source file still needs reading, or none when the vault has no answer. When the excerpt suffices, the assistant cites it; when detail is missing, it opens the file to verify.

Finding a Related Page Can Still Answer Wrong

Once I queried LMEMORY_STATE_DIR, and an overly broad alias routed the query to a general overview note. That page never answered the specific setting, yet the receipt marked it direct. A similar trap hits snippet truncation: if a note says "do not use the old flow" and truncation drops "do not," the remaining half-sentence flips the meaning completely.

By v2.1.3, an alias must match a complete supporting sentence inside a still-active source. Whenever a query names a specific config identifier, the exact identifier must appear in the source text. Regardless of match score, unverified evidence stays related.

Ranking taught a similar lesson. Reranking by paragraph coverage improved Chinese results yet dropped one question in English; expanding English singulars and plurals bidirectionally caused a question with no answer in the vault to cite the wrong note. In the end, paragraph reranking was limited to the top-3 related Chinese candidates after checking corrections and evidence, while English falls back from regular plurals to singulars one-way only.

Why the First Query Stalled on Index Rebuilds

On an empty cache, the first query waits for the index build. Checking the code showed the same text was normalized twice—once while building the search index and again while scoring evidence. Sharing that normalization pass, reusing repeated paragraphs during rebuilds, and trimming redundant scans for dates and durations cut the overhead.

Later, integrating Antigravity exposed a tail-read bug: long tool outputs pushed the user's latest message out of the log tail the hook inspected. When a background task woke the assistant up, the hook could mistake the same turn for a new request and re-inject context. The optional adapter now expands its read window on demand up to 16 MB—a fix committed separately after the v2.1.3 tag (Antigravity adapter commit).

Measured Improvements

  • Correct sources rank first more often: Replaying 483 Chinese historical questions over a private vault raised top-1 hits from 446/483 to 465/483. On the public English holdout set, answerable hits moved from 57/75 to 58/75 with correction and refusal counts unchanged.
  • Shorter cold-start wait: On the same Mac and the same 1,801-page note snapshot across 6 alternating empty-cache rounds, median first MCP query time including index rebuild dropped from 7.334s to 5.818s compared to the earlier local KRouter install.
  • Smaller retrieval payloads for models: Across 24 public synthetic questions, full matched notes totaled 72,864 tokens versus 14,644 tokens for evidence-backed receipts (-79.9%). That compares retrieval payloads only; reading full files afterward and the rest of the chat are separate.

Ranking tests measure whether the right source lands first. New questions can still hit similar-looking notes that do not actually answer them, and keyword search can miss topics phrased with completely different words (ranking evaluation method · speed & context numbers).

If you already have uvx installed, run the Chinese demo below to watch it look up an initial decision, recover a corrected decision, and respond when the vault has no answer (v2.1.3 release):

uvx --from git+https://github.com/TinkCarlos/[email protected] lmemory demo --lang zh