← all repositories
KirtiRamchandani/memory.cpp

A compiler for what your coding agent sees

memory.cpp treats agent context as a compilation problem — deciding what's stable, fresh, or banned before the model ever reads it.

memory.cpp
Collecting fresh signals — velocity needs a few days of history.
collecting data…
star history

What it does It’s a local-first Rust CLI that turns repository history — decisions, fixes, traces, tests, prior agent work — into typed context packs before inference. Durable repo knowledge goes into a byte-stable, blake3-hashed prefix; volatile task state goes into a fresh suffix; stale docs, contradictions, and secrets get excluded outright. Everything lands in a SQLite vault under .memory.cpp/, fully offline, with a ledger recording exactly what was sent and why.

The interesting bit The framing is the trick: this is a compiler, not a retrieval system. Facts pass through a MemoryIR with source anchors, trust, freshness, and sensitivity metadata, then optimizer passes score them by utility-per-token (volatility counts as cost). Negative memory — remembering what not to include — is a first-class feature, which is rare and genuinely sensible.

Key highlights

  • Byte-stable cacheable prefix means the same repo state produces the same prefix across tasks, so provider prompt caching actually hits
  • Freshness proofs tie memories to files, commits, or tests; unsupported memories are rejected before the prompt
  • Rehydratable mem://file/...#L10-L50 handles ship compact facts and defer exact code until needed
  • CAMC-Bench ablation: full pipeline sends 266 tokens vs 638 raw, blocks all stale/contradiction/secret leaks, passes the task oracle where raw, grep, BM25, and embeddings all fail
  • Dogfooded on its own repo: 854 tokens vs 7,961 for pasting the docs (~89% smaller)

Caveats

  • The benchmark corpus is synthetic — it measures the mechanism, not real-world win rates; the README says so plainly, to its credit
  • It does not compress a provider’s KV cache; it reduces KV pressure by keeping tokens out of the prompt, and the README is explicit about this distinction
  • The command surface is enormous (compile, prove, autopsy, fuzz-context, poison…) — expect a learning curve

Verdict Worth a look if you run long-horizon coding agents and are paying for repeated prefill or debugging stale-context patches. If you just want a memory store your agent can query, simpler tools exist — this one is for people who care about cache layout and provenance.

Frequently asked

What is KirtiRamchandani/memory.cpp?
memory.cpp treats agent context as a compilation problem — deciding what's stable, fresh, or banned before the model ever reads it.
Is memory.cpp open source?
Yes — KirtiRamchandani/memory.cpp is open source, released under the MIT license.
What language is memory.cpp written in?
KirtiRamchandani/memory.cpp is primarily written in Rust.
How popular is memory.cpp?
KirtiRamchandani/memory.cpp has 673 stars on GitHub.
Where can I find memory.cpp?
KirtiRamchandani/memory.cpp is on GitHub at https://github.com/KirtiRamchandani/memory.cpp.

heatdrop uses Google Analytics to see which pages get read — nothing else. Your call. How we handle data.