RepositoryPython
memodb-io

memodb-io/memobase

User Profile-Based Long-Term Memory for AI Chatbot Applications.

3.0kstars
237forks
27issues
3views

Featured achievements

The project's latest awards

1
TINIX TRENDING·Topic: llm-memory

#1 Repository of the week

1
TINIX TRENDING·Topic: retrieval

#1 Repository of the week

1
TINIX TRENDING·Topic: user-memory

#1 Repository of the week

News

  • 🚀 Meet Acontext, Context Data Platform that Improves your Agent with Experiences.

Memobase is a user profile-based memory system designed to bring long-term user memory to your LLM applications. Whether you're building virtual companions, educational tools, or personalized assistants, Memobase empowers your AI to remember, understand, and evolve with your users.

Memobase offers the perfect balance for your product among various memory solutions. At Memobase, we focus on three key metrics simultaneously:

  • Performance: Although Memobase is not specifically designed for RAG/search tasks, it still achieves top-tier search performance in the LOCOMO benchmark.
  • LLM Cost: Memobase includes a built-in buffer for each user to batch-process their chats, allowing the overhead to be distributed efficiently. Additionally, we carefully design our prompts and workflows, ensuring there are no "agents" in the system that could lead to excessive costs.
  • Latency: Memobase works similarly to the memory system behind ChatGPT: for each user, there is always a user profile and event timeline available. This allows you to access the most important memories of a user without any pre-processing, but only few SQL operations, keeping online latency under 100ms.

Check out the profile result (compared with mem0) from a 900-turns real-world chatting:

Partial Profile Output
{
  "basic_info": {
    "language_spoken": ["English", "Korean"],
    "name": "오*영"
  },
  "demographics": {
    "marital_status": "married"
  },
  "education": {
    "notes": "Had an English teacher who emphasized capitalization rules during school days",
    "major": "국어국문학과 (Korean Language and Literature)"
  },
  "interest": {
    "games": "User is interested in Cyberpunk 2077 and wants to create a game better than it",
    "youtube_channels": "Kurzgesagt",
    ...
  },
  "psychological": {...},
  "work": {"working_industry": ..., "title": ..., },
  ...
}

🎉 Recent Updates

  • 0.0.40: we updated the internal workflows in Memobase, reducing the number of LLM calls in a single run from approximately 3-10 times to a fixed 3 times, which reduces token costs by approximately 40-50%. (Consider updating your Memobase version!)
  • 0.0.37: we added fine-grained event gist, enabling the detailed search on users' timeline. Re-ran the LOCOMO benchmark and we're SOTA!
  • 0.0.36: we updated the search of context api, making the search take between 500~1000ms (depending on the embedding API you're using). Also, you can pass a prompt template to the context api to pack memories directly into prompt.

📖 Table of Contents

Core Features

🎯 Memory for User, not Agent

Define and control exactly what user information your AI captures.

📈 SOTA

Check out performance on public benchmark against mem0, langmem, zep...

📅 Time-aware Memory

Memobase has more than user profiles, it also records user event. User event is essential to answer time-related question, see how we can improve temporal memory much better than other memory solutions.

🖼️ Controllable Memory

Among all types of memory, only some may enhance your product experience. Memobase offers a flexible configuration for you to design the profile.

🔌 Easy Integration

Minimal code changes to integrate with your existing LLM stack with API, Python/Node/Go SDK.

⚡️ Batch-Process:

Memobase offers every user a buffer to batch processing the chats after the conversation. Fast & Cheap.

🚀 Production Ready

Memobase is building with FastAPI, Postgres and Redis, supporting request caching, authing, telemetry... Fully dockerized.

Memobase Workflow

How Memobase works?

Get Started

[!NOTE]

Try Memobase Playground to see how profile-based memory works — no setup needed.

  • Visualize how user profiles and memory events evolve over time.
  • Interact with the memory mechanism directly.
  • Explore key features and concepts in a live environment. Watch the demo below — see how memory evolves around user profiles.

https://github.com/user-attachments/assets/eb2eea30-48bc-4714-9706-e417ae1931df

  1. Start your Memobase server locally. If you don't want to be bothered, Memobase Cloud provides a free tier enough for your testing
  2. You should have the below two things to continue:
    1. A project url. (local: http://localhost:8019 , cloud https://api.memobase.dev)
    2. A project token. (local: secret , cloud sk-proj-xxxxxx)
  3. Install the Python SDK: pip install memobase
  4. Below tutorial is for Python User. For other language and API, check this.

Step-by-step breakdown

[!TIP]

1. Make sure you're connected

from memobase import MemoBaseClient, ChatBlob

client = MemoBaseClient(
    project_url=PROJECT_URL,
    api_key=PROJECT_TOKEN,
)
assert client.ping()

2. Manage Users

uid = client.add_user({"any_key": "any_value"})
client.update_user(uid, {"any_key": "any_value2"})
u = client.get_user(uid)
print(u)

# client.delete_user(uid)

3. Insert Data

In Memobase, all types of data are blobs for a user, which can be inserted, retrieved, and deleted:

messages = [
  {
      "role": "user",
      "content": "Hello, I'm Gus",
  },
  {
      "role": "assistant",
      "content": "Hi, nice to meet you, Gus!",
  }
]
bid = u.insert(ChatBlob(messages=messages))
print(u.get(bid)) # not found once you flush the memory.

# u.delete(bid)

By default, Memobase will remove the blobs once they're processed. This means that apart from the relevant memory, your data will not be stored with Memobase. You can persist the blobs by adjusting the configuration file.

4. Get your Memory

u.flush(sync=True)

By default, Memobase will flush the buffer asynchronously. You can set sync=True to wait for the buffer to be processed.

And what will you get?

print(u.profile(need_json=True))

# results
{
  "basic_info": {
    "name": {
      "content": "Gus",
      "id": ...,
      "created_at": ...
    }
  }
}

u.profile() will return structured profiles that are learned from this user, including topic, sub_topic and content. As you insert more blobs, the profile will become better.

Why need a flush?

In Memobase, we don't memoize users in hot path. We use buffer zones for the recent inserted blobs.

When the buffer zone becomes too large (e.g., 1024 tokens) or remains idle for an extended period (e.g., 1 hour), Memobase will flush the entire buffer into memory. Alternatively, you can use flush() manually decide when to flush, such as when a chat session is closed in your app.

5. Integrate memory into your prompt

Memobase has a context api to pack everything you need into a simple string, where you can insert it into your prompt directly:

print(u.context(max_token_size=500, prefer_topics=["basic_info"]))

Something like:

# Memory
Unless the user has relevant queries, do not actively mention those memories in the conversation.
## User Background:
- basic_info:name: Gus
...

## Latest Events:
...

Checkout the detail params here.

What's next?

  • Run script: Checkout the quickstart script for more details
  • Design your profile!: You may want to explore the customization of Memobase to make sure the system works as your expectation.
  • Full-stack Chatbot with Memobase: Check Memobase-Playground. An open-source, full-stack template AI Chatbot with long-term memory. live-demo
  • Web UI for Memobase: Check Memobase-Inspector. An open-source UI for your Memobase project with user table, usage chart and test playground. live-demo

Why/Where should I use Memobase?

Remember the users

By placing profiles into your AI (e.g. system prompt).

Demo
PROFILES = "\n".join([p.describe for p in u.profile()])

print(PROFILES)
# basic_info: name - Gus
# basic_info: age - 25
# ...
# interest: foods - Mexican cuisine
# psychological: goals - Build something that maybe useful
# ...

User analysis and tracking

Too much information is hidden in the conversations between users and AI, that's why you need a new data tracking method to record user preference and behavior.

Demo
PROFILES = u.profile()

def under_age_30(p):
  return p.sub_topic == "age" and int(p.content) < 30

def love_cat(p):
  return p.topic == "interest" and p.sub_topic == "pets" and "cat" in p.content

is_user_under_30 = (
    len([p for p in profiles if under_age_30(p)]) > 0
)
is_user_love_cat = (
  len([p for p in profiles if love_cat(p)]) > 0
)                       
...

Sell something to your customers.

Not everyone is looking for Grammarly, it's always nice to sell something your users might want.

Demo
def pick_an_ad(profiles):
  work_titles = [p for p in profiles if p.topic=="work" and p.sub_topic=="title"]
  if not len(work_titles):
    return None
  wt = work_titles[0].content
  if wt == "Software Engineer":
    return "Deep Learning Stuff"
  elif wt == "some job":
    return "some ads"
  ...

Documentation

For detailed usage instructions, visit the documentation.

Stay Updated

Star Memobase on Github to support and receive instant notifications!

click_star

Support

Join the community for support and discussions:

Or just email us ❤️

Contribute

  • Check out our Changelog first, make sure the feature you want has not been developed or is currently being planned.:)
  • Go through Contributing document to setup and contribute to Memobase.

License

This project is licensed under the Apache 2.0 License - see the LICENSE file for details.

Similar Projects

Discover other similar projects and AI models.

RepositoryPython
mem0ai/mem0

The Memory Layer for AI Agents - Drop-in memory infrastructure for AI agents and apps. Context that persists. Built for production.

69.9k
Nov 27, 2026
RepositoryPython
EverMind-AI/EverOS

One portable memory layer for every AI agent: local-first, Markdown-native, user-owned, and self-evolving across apps, tools, and workflows.

14.0k
Nov 30, 2026
RepositoryPython
IAAR-Shanghai/Awesome-AI-Memory

Awesome AI Memory | LLM Memory | A curated knowledge base on AI memory for LLMs and agents, covering long-term memory, reasoning, retrieval, and memory-native system design. Awesome-AI-Memory 是一个 集中式、持续更新的 AI 记忆知识库,系统性整理了与 大模型记忆(LLM Memory)与智能体记忆(Agent Memory) 相关的前沿研究、工程框架、系统设计、评测基准与真实应用实践。

1.3k
Dec 1, 2026
RepositoryPython
hindsightai/hindsight

Hindsight: Agent Memory That Learns

64.5k
Dec 2, 2026
RepositoryPython
VectifyAI/PageIndex

📑 PageIndex: Document Index for Vectorless, Reasoning-based RAG

40.8k
Nov 29, 2026
RepositoryPython
onyx-dot-app/onyx

Open Source AI Platform - AI Chat with advanced features that works with every LLM

33.6k
Dec 1, 2026
RepositoryPython
MemoriLabs/Memori

Memori is agent-native memory infrastructure. A LLM-agnostic layer that turns agent execution and conversation into structured, persistent state for production systems. Built for enterprise, Memori works with the data infrastructure you already run, no rip-and-replace, and deploys across managed cloud, single-tenant cloud, VPC, and on-premises.

17.8k
Oct 3, 2026
RepositoryPython
plastic-labs/honcho

Memory library for building stateful agents

8.4k
Dec 1, 2026
RepositoryPython
aiming-lab/SimpleMem

[ICML'26] SimpleMem: Efficient Lifelong Memory for LLM Agents — Text & Multimodal

3.9k
Jul 24, 2026