AI Chatbot Memory
iamkunalkeshav/ai-chatbot-memory
Chatbot com memória persistente entre sessões usando LLMs stateless
Ver no GitHubPlugin Python que adiciona memória persistente a chatbots com LLMs, salvando conversas em disco e carregando o histórico automaticamente em novas sessões. Usa LangChain com sumarização inteligente de mensagens antigas para otimizar tokens e mantém contexto contínuo entre interações.
Instalação
npx convez-ai iamkunalkeshav/ai-chatbot-memory1 comando no terminal: detecta o formato do repositório (marketplace ou plugin avulso) e instala via Claude Code. Requer Node 18+ e o Claude Code instalado.
Métricas
Casos de uso
- Criar assistentes que lembram do usuário entre conversas
- Aplicações de suporte ao cliente com histórico preservado
- Chatbots personalizados com contexto contínuo de longo prazo
Veredito

Solução prática e bem estruturada para um problema real de LLMs stateless. Implementação clara com LangChain e Groq, ideal para prototipagem rápida, mas requer avaliação de escalabilidade para produção em larga escala (JSON em disco tem limitações).
README
A tradução para o português deste README ainda está na fila.
ai-chatbot-memory
The annoying thing about most chat apps is that every session starts fresh. You say your name, explain your context, and five minutes later start a new session and do it all again. LLMs are stateless by default — they only see what's in the current context window.
This project solves that. Conversations are saved to disk per session and loaded back the next time you start. The bot actually remembers who you are and what you talked about before.
How the memory works
- Each session has its own JSON file (e.g.
sessions/kunal.json) - When you start a session, previous turns are loaded back into the LLM's context
- When the history gets too long, older messages get summarized automatically to save tokens
- Everything auto-saves after every response
So you could close the terminal, come back tomorrow, start with the same session ID, and pick up exactly where you left off.
Stack
- Python + LangChain 1.2
- Groq API (free) —
llama-3.3-70b-versatile ConversationSummaryBufferMemory— keeps recent messages verbatim, summarizes older ones- JSON files for persistence (simple and portable)
Project structure
ai-chatbot-memory/
├── memory/
│ ├── memory_manager.py # handles save/load and LangChain memory
│ └── sessions/ # one .json file per session (auto-created)
├── chat/chatbot.py # the conversation chain
└── main.py
Setup
python -m venv venv
source venv/bin/activate
pip install -r requirements.txt
cp .env.example .env
# add your GROQ_API_KEY to .env
python main.py
Get a free Groq API key at console.groq.com.
Usage
Enter your session ID (or press Enter for 'default'): kunal
[+] Session 'kunal' loaded.
You: my name is Kunal and I work in AI
Bot: Nice to meet you, Kunal! ...
# close terminal, come back the next day:
Enter your session ID: kunal
[+] Loaded 8 turns from session 'kunal'.
You: do you remember what I do?
Bot: Yes — you mentioned you work in AI.
Type history during a session to see all previous turns. Type exit to save and quit.