<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title>Markmem on RockB</title><link>https://baeseokjae.github.io/tags/markmem/</link><description>Recent content in Markmem on RockB</description><image><title>RockB</title><url>https://baeseokjae.github.io/images/og-default.png</url><link>https://baeseokjae.github.io/images/og-default.png</link></image><generator>Hugo</generator><language>en-us</language><lastBuildDate>Mon, 07 Sep 2026 10:01:48 +0000</lastBuildDate><atom:link href="https://baeseokjae.github.io/tags/markmem/index.xml" rel="self" type="application/rss+xml"/><item><title>MarkMem: A Git-Native Plain-Markdown Memory Layer for Chatbots</title><link>https://baeseokjae.github.io/posts/markmem-git-markdown-chatbot-memory-2026/</link><pubDate>Mon, 07 Sep 2026 10:01:48 +0000</pubDate><guid>https://baeseokjae.github.io/posts/markmem-git-markdown-chatbot-memory-2026/</guid><description>MarkMem stores chatbot memory as plain markdown in a git repo, with bi-temporal facts, a Presidio PII gate, and git as the compliance surface.</description><content:encoded><![CDATA[<p>MarkMem is a git-native, plain-markdown memory layer for chatbots that stores every fact as an inspectable Markdown file in a git repository, backed by a rebuildable SQLite cache. It combines bi-temporal facts in YAML, a Presidio PII write gate, and git as the compliance surface, so you can <code>cat</code>, <code>grep</code>, and <code>git-diff</code> your chatbot&rsquo;s memory instead of trusting an opaque vector database.</p>
<h2 id="what-is-markmem-and-why-do-chatbots-forget">What is MarkMem and why do chatbots forget?</h2>
<p>Every chatbot that carries context across sessions faces the same problem: the model&rsquo;s context window is finite, and once a conversation scrolls past it, the details are gone. Traditional memory layers solve this by embedding facts into a vector database and retrieving the most similar chunks at query time. That works, but it turns your chatbot&rsquo;s memory into a black box — you cannot read it, audit it, or prove what it contains.</p>
<p>MarkMem takes the opposite approach. It stores memory as plain Markdown files inside a git repository. Each fact is a human-readable document that you can open in any editor, search with <code>grep</code>, and version with <code>git</code>. The SQLite index that powers fast retrieval is treated as a rebuildable cache: delete it and run <code>markmem reindex</code> to restore everything from the Markdown source of truth.</p>
<p>This design is the core of the &ldquo;inspectable memory&rdquo; argument. Vector databases trade away the ability to <code>cat</code>, <code>grep</code>, or <code>git-diff</code> your own memory. MarkMem restores it, giving you a memory layer that is both fast enough for production and fully transparent.</p>
<h2 id="the-ecosystem-gap--why-vector-databases-fall-short">The ecosystem gap — why vector databases fall short</h2>
<p>The incumbent memory layers are dominated by vector and graph approaches. Mem0, the most popular option, has 64.8K GitHub stars and provides a drop-in vector/graph-based memory infrastructure built for production scale. Khoj (37.1K stars) is a broader self-hostable AI second brain. Graphiti (30.6K stars) builds real-time knowledge graphs with strong relationship tracking. Letta (24.6K stars) descends from MemGPT and focuses on stateful agents that learn and self-improve.</p>
<table>
  <thead>
      <tr>
          <th>Tool</th>
          <th>Stars</th>
          <th>Storage model</th>
          <th>Focus</th>
      </tr>
  </thead>
  <tbody>
      <tr>
          <td>mem0</td>
          <td>64.8K</td>
          <td>Vector/graph</td>
          <td>Production-scale memory infrastructure</td>
      </tr>
      <tr>
          <td>Khoj</td>
          <td>37.1K</td>
          <td>Vector + docs</td>
          <td>Self-hostable AI second brain</td>
      </tr>
      <tr>
          <td>Graphiti</td>
          <td>30.6K</td>
          <td>Knowledge graph</td>
          <td>Temporal relationship memory</td>
      </tr>
      <tr>
          <td>Letta</td>
          <td>24.6K</td>
          <td>Stateful agent</td>
          <td>Agent statefulness and self-improvement</td>
      </tr>
      <tr>
          <td>basic-memory</td>
          <td>3.8K</td>
          <td>Markdown</td>
          <td>Plain-markdown memory niche</td>
      </tr>
      <tr>
          <td>memweave</td>
          <td>54</td>
          <td>Markdown</td>
          <td>Async-first markdown memory</td>
      </tr>
      <tr>
          <td>MarkMem</td>
          <td>new</td>
          <td>Markdown + git</td>
          <td>Git-native, compliance-first memory</td>
      </tr>
  </tbody>
</table>
<p>The gap is clear: the big players optimize for scale and statefulness, but none of them make memory inspectable as plain text with git as the compliance surface. basic-memory and memweave occupy the markdown niche but lack the hybrid search, bi-temporal facts, and compliance tooling that MarkMem bundles together. MarkMem is the only tool combining markdown, hybrid search, git compliance, and bi-temporal facts in one package.</p>
<h2 id="the-three-pillars-bi-temporal-facts-presidio-write-gate-git-compliance">The three pillars: bi-temporal facts, Presidio write gate, git compliance</h2>
<p>MarkMem is built on three unique pillars that together address the weaknesses of both vector databases and naive markdown stores.</p>
<p><strong>Bi-temporal facts in YAML.</strong> Facts carry both a valid time (when the fact is true) and a transaction time (when it was recorded). When a fact is superseded, the old one is closed with a <code>valid_until</code> timestamp rather than silently overwritten. This enables <code>as_of</code> temporal reasoning — you can ask what the chatbot knew at any point in the past, and you never lose the history of a correction.</p>
<p><strong>Presidio as a PII write gate.</strong> Before any fact reaches disk, it passes through Microsoft&rsquo;s Presidio, which detects and blocks or masks sensitive entities such as Social Security numbers, email addresses, and credit card numbers. This is a write-time gate, not a post-hoc scan, so PII never lands in your memory store in the first place.</p>
<p><strong>Git as the compliance surface.</strong> Every write becomes a git commit, giving you a full audit trail via <code>git log</code>. GDPR erasure is provable and path-scoped: you can scrub a specific user&rsquo;s facts, rewrite them, or crypto-shred them against backups, and the git history documents exactly what was removed and when.</p>
<h2 id="how-markmem-works-under-the-hood">How MarkMem works under the hood</h2>
<p>The write path is a pipeline: <strong>add → PII gate → compile → git commit</strong>. When a fact is added, it is first checked by the Presidio gate. If it passes, it is compiled into a Markdown document and committed to the git repository. The SQLite index is updated as a cache.</p>
<p>On the read side, MarkMem uses a tiered search strategy. <strong>L0</strong> is a fast in-memory cache for the hottest facts. <strong>L1</strong> uses BM25 keyword search over the Markdown content. <strong>L2</strong> adds vector retrieval when a vector extra is installed. The tiers are fused with Reciprocal Rank Fusion (RRF), so you get the precision of keyword search and the semantic reach of vectors without requiring a vector database as a hard dependency.</p>
<p>This zero-hard-dependency design is deliberate. With no vector extra installed, MarkMem runs on BM25 alone. With no LLM API key, it falls back to a heuristic extractor. The core library never imports torch, so it stays lightweight and easy to deploy.</p>
<h2 id="installation-and-quick-start">Installation and quick start</h2>
<p>MarkMem is Apache-2.0, written in Python, and published on PyPI as <code>markmem</code>. It was created on 2026-08-18. Installation is a single command:</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>pip install markmem
</span></span></code></pre></div><p>The primary interface is the <code>Memory</code> API. You add facts, search them, and retrieve context for your chatbot:</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-python" data-lang="python"><span style="display:flex;"><span><span style="color:#f92672">from</span> markmem <span style="color:#f92672">import</span> Memory
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>memory <span style="color:#f92672">=</span> Memory(repo_path<span style="color:#f92672">=</span><span style="color:#e6db74">&#34;./memory&#34;</span>)
</span></span><span style="display:flex;"><span>memory<span style="color:#f92672">.</span>add(<span style="color:#e6db74">&#34;The user prefers concise responses in Korean.&#34;</span>)
</span></span><span style="display:flex;"><span>results <span style="color:#f92672">=</span> memory<span style="color:#f92672">.</span>search(<span style="color:#e6db74">&#34;how should I respond?&#34;</span>, format<span style="color:#f92672">=</span><span style="color:#e6db74">&#34;context&#34;</span>)
</span></span></code></pre></div><p>The <code>format=&quot;context&quot;</code> option packs the retrieved facts into a ready-to-inject context block for your LLM prompt. The package also ships 19 CLI commands for managing the memory store, reindexing, exporting, and inspecting the git history.</p>
<h2 id="using-any-llm-with-litellm-and-the-mcprestcli-integrations">Using any LLM with LiteLLM and the MCP/REST/CLI integrations</h2>
<p>MarkMem supports 100+ LLMs through LiteLLM, so you are not locked into a single provider. You can plug in OpenAI, Anthropic, local models, or any LiteLLM-compatible endpoint.</p>
<p>Beyond the Python API, MarkMem exposes an MCP server, a REST API, and the CLI. The MCP server is especially useful for agent frameworks that speak the Model Context Protocol — your chatbot can call memory tools directly through MCP without custom glue code. The REST API lets you integrate MarkMem into any language or service, and the CLI covers scripting and manual inspection.</p>
<h2 id="compliance-and-erasure-modes">Compliance and erasure modes</h2>
<p>Compliance is where MarkMem differentiates itself most sharply. Because memory lives in git, erasure is not a destructive delete that leaves no trace — it is a documented, auditable operation.</p>
<ul>
<li><strong>Scrub mode</strong> removes a user&rsquo;s facts from the current state.</li>
<li><strong>Rewrite mode</strong> replaces sensitive content with sanitized values.</li>
<li><strong>Crypto-shred mode</strong> encrypts facts and destroys the key, making the data unrecoverable even from backups.</li>
</ul>
<p>In MarkMemBench, GDPR erasure via crypto-shred plus tombstone completed in 230.5ms. The git history provides a provable, path-scoped audit trail of exactly what was removed, which is a significant advantage for organizations that must demonstrate compliance to regulators.</p>
<h2 id="portability-and-migration">Portability and migration</h2>
<p>MarkMem is designed to avoid lock-in. You can export the entire memory store losslessly to JSONL, migrate to or from mem0, and export to the Claude Code memory-md format. This means you can start with MarkMem, and if your needs change, your memory is not trapped in a proprietary format — it is plain Markdown you can take anywhere.</p>
<h2 id="benchmarks-and-security-edge-cases">Benchmarks and security edge cases</h2>
<p>MarkMemBench reports strong results across recall, latency, and isolation:</p>
<table>
  <thead>
      <tr>
          <th>Metric</th>
          <th>MarkMem</th>
          <th>Mem0</th>
          <th>Letta/MemGPT</th>
          <th>Khoj</th>
      </tr>
  </thead>
  <tbody>
      <tr>
          <td>LoCoMo R@5 evidence recall</td>
          <td>83.3%</td>
          <td>92.5%</td>
          <td>68.5%</td>
          <td>83.2%</td>
      </tr>
      <tr>
          <td>Search latency p50</td>
          <td>1.5ms</td>
          <td>880ms</td>
          <td>—</td>
          <td>—</td>
      </tr>
      <tr>
          <td>Context packing latency p50</td>
          <td>2.0ms</td>
          <td>—</td>
          <td>—</td>
          <td>—</td>
      </tr>
  </tbody>
</table>
<p>MarkMem trails Mem0 on raw evidence recall (83.3% vs 92.5%) but is dramatically faster on search latency — 1.5ms p50 versus 880ms for Mem0. It also reports 100% multi-user isolation with zero leaks, 100% temporal reasoning supersession accuracy, and the 230.5ms GDPR erasure path mentioned above.</p>
<h2 id="limitations-and-when-to-choose-an-alternative">Limitations and when to choose an alternative</h2>
<p>MarkMem is not a universal replacement for every memory layer. Its main limitation is scale: it is designed for roughly 50–100K pages per repository. Many small files are the worst case for both git and NTFS, so extremely large memory stores will hit performance and filesystem limits. The FTS5 stemming is also English-biased, which matters if your content is heavily non-English.</p>
<p>If you need to store millions of facts, require heavy graph-based relationship reasoning, or need the scale that mem0 and Graphiti target, a vector or graph store may be a better fit. MarkMem is the right choice when inspectability, compliance, and portability matter more than raw scale.</p>
<h2 id="conclusion--is-markmem-right-for-your-chatbot">Conclusion — is MarkMem right for your chatbot?</h2>
<p>MarkMem fills a real gap in the chatbot memory ecosystem. If you want memory you can read, audit, and prove compliance for — and you are comfortable with a plain-markdown, git-native workflow — it is a compelling choice. It is fast, portable, PII-safe at the write gate, and gives you a full audit trail out of the box. For teams that value transparency and compliance over raw scale, MarkMem is worth serious consideration.</p>
<h2 id="faq">FAQ</h2>
<p><strong>What is MarkMem?</strong>
MarkMem is a git-native, plain-markdown memory layer for chatbots. It stores every fact as an inspectable Markdown file in a git repository, with a rebuildable SQLite cache for fast retrieval.</p>
<p><strong>How is MarkMem different from mem0?</strong>
Mem0 is a vector/graph-based memory infrastructure built for production scale. MarkMem stores memory as plain Markdown in git, making it inspectable and auditable. MarkMem is also dramatically faster on search latency (1.5ms vs 880ms p50) but trails mem0 on raw evidence recall.</p>
<p><strong>Does MarkMem require a vector database?</strong>
No. Vector retrieval is optional. Without a vector extra, MarkMem runs on BM25 keyword search alone, and it fuses BM25 and vector results with Reciprocal Rank Fusion when vectors are available.</p>
<p><strong>How does MarkMem handle GDPR erasure?</strong>
MarkMem uses git as the compliance surface. Erasure is a documented, auditable operation with scrub, rewrite, and crypto-shred modes. Crypto-shred plus tombstone completes in about 230ms and provides a provable, path-scoped audit trail.</p>
<p><strong>What are MarkMem&rsquo;s limitations?</strong>
MarkMem is designed for roughly 50–100K pages per repository, since many small files are the worst case for git and NTFS. Its FTS5 stemming is English-biased, and it is not the best choice for very large or graph-heavy memory workloads.</p>
]]></content:encoded></item></channel></rss>