DEV Community

Cover image for Your AI Has Amnesia Between Chats — Here's How I Gave It a Local Memory That Actually Sticks
qianqiuwanzi
qianqiuwanzi

Posted on

Your AI Has Amnesia Between Chats — Here's How I Gave It a Local Memory That Actually Sticks

Every LLM conversation starts from zero. Close the tab, open a new one, and the model has no idea who you are, what project you're on, or that you told it yesterday your database runs Postgres 14. That statelessness is by design, but for anyone trying to use AI as a persistent collaborator, it is the single biggest friction.

I got tired of re-explaining context dozens of times a week, so I built a local-first memory layer for the desktop. The interesting part is not "store chat history" — it is what to store and how to make it useful.

The four pieces

record — Instead of dumping raw transcripts, it captures context locally (what you are working on, decisions made) and never uploads it. Everything stays on your machine; the only network call is to your own model endpoint.

consolidation — Raw captures are noisy. A background process merges repeated facts, resolves conflicts, and decays stale info by time. This is the step that turns a pile of notes into something you would actually want to query.

recall — When you ask something, it pulls the relevant memory by semantic match, not keyword. The result is a context window that already knows your situation.

file-bridge — Memory is not only chat. The same entities get anchored to local files, so "the spec we discussed" resolves to the actual document path.

Why local-first

The obvious alternative is a cloud memory service. The problem: your most sensitive context (what you are building, who you are emailing, what you decided) is exactly the data you do not want leaving your machine. Keeping it local and only talking to a model API means the privacy boundary is structural, not a promise in a terms-of-service.

What I learned building it

The hard part was never storage. It was deciding what not to remember, and making recall precise enough that injected context helps instead of confusing the model. If you are building something similar, start with consolidation — a bad merge step poisons everything downstream.

If this sounds useful, you can try it for 30 days — the install link below is tagged so I know you came from Dev.to. I am the author, so I am happy to answer architecture questions in the comments.

Try it

Your AI Has Amnesia Between Chats — Here's How I Gave It a Local Memory That Actually Sticks

Top comments (0)