Skip to content

Latest commit

History

4 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

CLAIV Memory — LLM Memory Layer for AI Chatbots and Agents

LLM memory for chatbots, AI agents, and RAG systems. chatbot memory · llm memory · ai agent memory · langchain memory alternative · rag memory system · persistent memory for openai · conversational ai memory

Persistent memory for OpenAI, Claude, LangChain, and any AI application. Drop in 3 API calls. Your AI remembers everything.

LoCoMo J-ScorenpmPyPILicense: MIT

The easiest way to add persistent memory to:

  • OpenAI chatbots (GPT-4o, GPT-4.1)
  • LangChain agents
  • Anthropic Claude applications
  • Next.js AI chat apps
  • Any LLM with a system prompt

Replaces:

  • LangChain ConversationBufferMemory
  • Naive RAG-based memory systems
  • Prompt stuffing with chat history

Quickstart (30 seconds)

npm install @claiv/memory
import{ClaivClient}from'@claiv/memory';constclaiv=newClaivClient({apiKey: process.env.CLAIV_API_KEY});// Store what happenedawaitclaiv.ingest({user_id: 'user_123',conversation_id: 'chat_abc',type: 'message',role: 'user',content: 'I run a fitness business and prefer morning workouts.',});// Recall before each responseconstmemory=awaitclaiv.recall({user_id: 'user_123',conversation_id: 'chat_abc',query: 'What does this user do?',});// Inject into your system promptconstresponse=awaitopenai.chat.completions.create({model: 'gpt-4o',messages: [{role: 'system',content: `User context:\n${memory.llm_context.text}`},{role: 'user',content: userMessage},],});

Python:

pip install claiv-memory
fromclaivimportClaivClientclaiv=ClaivClient(api_key="your_key")
claiv.ingest({
"user_id": "user_123",
"conversation_id": "chat_abc",
"type": "message",
"role": "user",
"content": "I run a fitness business and prefer morning workouts.",
})
memory=claiv.recall({
"user_id": "user_123",
"conversation_id": "chat_abc",
"query": "What does this user do?",
})
system_prompt=f"User context:\n{memory['llm_context']['text']}"

Why not just use LangChain memory?

LangChain ConversationBufferMemoryCLAIV Memory
StoresRaw chat historyStructured, deduplicated facts
Long conversationsBreaks (token overflow)No limit
Contradiction handling✅ Resolved automatically
Cross-session memory
Document memory✅ Built-in
GDPR deletion✅ Audit receipt
LoCoMo benchmark75.0%

LangChain memory not working? CLAIV is a drop-in replacement.


Why not just use a vector database?

Vector databases give you similarity search. CLAIV gives you structured memory:

  • Facts are extracted and deduplicated — no contradictions
  • Temporal reasoning built in
  • Token-budget-aware recall — not 50 raw chunks
  • Document memory + conversation memory in one call
  • Forget with a real audit trail

How it works

POST /v6/ingest → Store a memory event (conversation turn, app event)
POST /v6/recall → Retrieve ranked context — ready to inject into your prompt
POST /v6/documents → Upload a document for persistent RAG
POST /v6/forget → Delete user data (GDPR-compliant, timestamped receipt)

Document memory (built-in RAG)

Upload documents directly — no separate vector database needed:

constdoc=awaitclaiv.uploadDocument({user_id: 'user_123',project_id: 'my-project',document_name: 'Product Manual',content: documentText,});// Spans indexed immediately. Recall automatically surfaces relevant sections.

Examples

Clone any example to get started immediately:

ExampleStackDescription
examples/openai-nodejsNode.js + OpenAIChatbot with persistent memory
examples/openai-pythonPython + OpenAIChatbot with persistent memory
examples/claude-pythonPython + ClaudeAnthropic Claude with memory
examples/langchainPython + LangChainLangChain memory replacement
examples/nextjsNext.js + OpenAIStreaming chat app with memory
examples/document-rag-pythonPythonDocument upload + question answering
examples/document-rag-nextjsNext.jsDrag-and-drop document RAG app

Deployable app

Want a full working chatbot you can deploy in one click?

👉 ai-chatbot-with-memory — Next.js + OpenAI + CLAIV. Vercel deploy button included.


SDKs

InstallRepo
JavaScript / TypeScriptnpm install @claiv/memorysdk-js
Pythonpip install claiv-memorysdk-py

Benchmark

LoCoMo 10-dialogue J-score: 75.0%

CategoryScore
Single-hop68.8%
Temporal74.2%
Multi-hop55.2%
Open-domain79.7%

LoCoMo is the standard benchmark for long-context conversational memory systems.


Use cases

  • AI chatbots that remember users across sessions
  • AI agents with multi-step context
  • SaaS apps with per-user memory
  • Customer support bots that know customer history
  • Internal copilots over company documents
  • Research and compliance tools with document memory

Get started

👉 API key:claiv.io 👉 Docs:claiv.io/docs


Keywords: ai memory, llm memory, chatbot memory, ai agent memory, langchain memory, rag memory, openai memory, persistent memory, chatbot context, conversational memory, vector database alternative


If this saves you time, give it a star — it helps other developers find it.

About

LLM memory layer for AI chatbots and agents. Persistent memory for OpenAI, Claude, LangChain, and any AI app.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors