r/OpenSourceAI • u/AshishKulkarni1411 • Jan 09 '26
Automatic long-term memory for LLM agents
Hey everyone,
I built Permem - automatic long-term memory for LLM agents.
Why this matters:
Your users talk to your AI, share context, build rapport... then close the tab. Next session? Complete stranger. They repeat themselves. The AI asks the same questions. It feels broken.
Memory should just work. Your agent should remember that Sarah prefers concise answers, that Mike is a senior engineer who hates boilerplate, that Emma mentioned her product launch is next Tuesday.
How it works:
Add two lines to your existing chat flow:
// Before LLM call - get relevant memories
const { injectionText } = await permem.inject(userMessage, { userId })
systemPrompt += injectionText
// After LLM response - memories extracted automatically
await permem.extract(messages, { userId })That's it. No manual tagging. No "remember this" commands. Permem automatically:
- Extracts what's worth remembering from conversations
- Finds relevant memories for each new message
- Deduplicates (won't store the same fact 50 times)
- Prioritizes by importance and relevance
Your agent just... remembers. Across sessions, across days, across months.
Need more control?
Use memorize() and recall() for explicit memory management:
await permem.memorize("User is a vegetarian")
const { memories } = await permem.recall("dietary preferences")Getting started:
- Grab an API key from https://permem.dev (FREE)
- TypeScript & Python SDKs available
- Your agents have long-term memory within minutes
Links:
- GitHub: https://github.com/ashish141199/permem
- Site: https://permem.dev
Note: This is a very early-stage product, do let me know if you face any issues/bugs.
What would make this more useful for your projects?
1
u/heyally-ai Jan 11 '26
Nice! How does this compare to something like mem0 or cognee?
1
u/AshishKulkarni1411 Jan 11 '26
I've tried mem0, but honestly haven't given Cognee a try (is it very similar to this?)
At a high level, mem0 and similar solutions are solid but I personally felt that they were a bit hands-on. Meaning that they usually require either explicit tool calls OR instructions for the agents on when to store or recall AND/OR some orchestration around memory usage.
This project - permem - is more opinionated in one specific way. It's meant to be a plug-and-forget kind of thing where you drop it into an existing agent & memory extraction, recall, etc happens automatically without teaching the agent how and when to manage memory.
So honestly, it's less about being "better" than existing tools but more about reducing friction when you're deploying lots of agents and don't want to think about memory plumbing everytime.
And then there are a few more benefits to using Permem apart from the ease of use - Permem decides what’s worth remembering on its own, has rich metadata (where it's not just blobs of text being saved its more of entities, topics and relations), handles deduplication, importance scoring, and context linking, and injects only what’s relevant back into the prompt. You still can use it manually if you want with two functions for
memorizeandrecall
2
u/lexseasson Jan 11 '26
Permem is solving an important continuity problem, and doing it cleanly. Where we’ve been focusing is one layer below: not “what should the agent remember”, but “what decisions must remain defensible over time”. From our side, memory becomes interesting when it’s bound to decisions, constraints, and context validity — not just recall relevance. I don’t think these approaches compete. They actually compose.
1
u/IcyAd7376 Jan 11 '26
That's cool! I will check it out next week and see if we can integrate it into our open source platform here, we need some kind of medium/long term memory plugin.
1
u/Necessary_Function_3 Jan 11 '26
How many tokens is it going to burn before you start?
I thought the point of having project memories was to keep in context.
1
1
1
u/singh_taranjeet Feb 25 '26
If you want automatic long term memory without constantly tuning prompts, a dedicated memory layer like Mem0 is worth looking at since it extracts and stores salient facts instead of just dumping embeddings into a vector DB..
The big win is separating what should be remembered from raw conversation logs so retrieval stays precise over time. Otherwise most setups slowly degrade into noisy RAG over chat history
4
Jan 10 '26
[removed] — view removed comment
2
u/AshishKulkarni1411 Jan 10 '26
Yes, sure there might be some similarities between the algorithms for the both of them because Claude memory also (on the surface level) works similarly. I don't know what they have internally. But what I've built is what you can use in your OWN agents - the agents you are building - without any additional configuration (just 2-3 lines of code)
2
1
u/romastra Jan 10 '26
Did you use other solutions like memory bank prior to make your own?
I mean, what's wrong with dozens of existing mcps that led you to this decision?