Like a lot of people here, I wanted long-term memory for my agents without shipping my conversations to someone’s cloud API. The existing memory frameworks mostly assume a hosted LLM doing constant summarization: expensive, non-reproducible, and your data leaves your machine. So I built MemLedger. The whole thing runs locally: single SQLite file, CPU-friendly, and the “memory brain” (fact extraction, reranking, contradiction resolution) is any model you point it at. I’ve been running Qwen3 4B through Ollama and it’s honestly enough — extraction is a constrained JSON task at temp 0, not creative writing. You could go smaller. The part I care most about: every memory has a provenance chain. The whole thing is an append-only event log, so you can do: $ memledger why tu_01J9ZKM3 “The user prefers Python” (instinct, active) └─ promoted: impact 5.5 across 4 sessions, approved by me └─ extracted by qwen3:4b, prompt extract@v1, confidence 0.95 └─ raw turn, session 88: “please, always Python — I don’t read Go” When your agent believes something dumb, you trace it to the exact sentence and nuke it with delete --cascade (takes out everything derived from it too). Stuff this community might specifically care about: Token thrift by design. A pure-CPU lexical scorer (stopword ratio + entity proxies + cue regexes, no NLP models — adapted from the DMF paper) triages every turn before extraction. “ok thanks lol” never reaches the LLM. Only signal-dense turns cost inference. Your memory survives model swaps — and improves with them. Raw turns are the canonical record. Swap in a better model next month, run regenerate , and your entire memory gets re-extracted from the original history. Embeddings are treated as a disposable index: change embedding models, rebuild the index, nothing lost. Every LLM call is cached deterministically (hash of model + prompt version + input). Replaying/debugging your memory state costs zero inference. Anti-poisoning: new facts are quarantined until confirmed across sessions, and nothing gets permanently pinned without your approval by default. No LangChain dependency, no server, MIT license. The ledger format is a documented spec, so other-language clients are possible. Known limitations before you find them yourselves: single writer per DB (no shared multi-agent memory yet), triage cue patterns are English-only right now (other languages fall back to density signals — adapters are just a forkable regex file), and while all the rule-based parts are byte-reproducible, LLM extraction is obviously only deterministic per model+prompt+input via the cache. Repo: https://github.com/riktar/memledger Questions for you all: what’s the smallest model you’d trust for structured fact extraction? And has anyone dealt with memory poisoning in long-running local agents? Curious what you’ve seen in the wild. submitted by /u/riktar89
Originally posted by u/riktar89 on r/ArtificialInteligence

