Long-term and multimodal memory for AI agents - character-aware, mem0-compatible, fully-local option
Copy the AI prompt to install this server into Claude Code, Cursor, or another agent — or use 1-click editor setup below.
💡 Paste into ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows)
If you find this project helpful, please give us a ⭐️ on GitHub for the latest update.
🤝 Contributions welcome! Feel free to open an issue or submit a pull request.
TeleMem is an agent memory management layer that can be used as a high-performance drop-in replacement for Mem0 with one line of code (import telemem as mem0), deeply optimized for complex scenarios involving multi-turn dialogues, character modeling, long-term information storage, and semantic retrieval.
Through its unique context-aware enhancement mechanism, TeleMem provides conversational AI with core infrastructure offering higher accuracy, faster performance, and stronger character memory capabilities.
Building upon this foundation, TeleMem implements video understanding, multimodal reasoning, and visual question answering capabilities. Through a complete pipeline of video frame extraction, caption generation, and vector database construction, AI Agents can effortlessly store, retrieve, and reason over video content just like handling text memories.
The ultimate goal of the TeleMem project is to use an agent's hindsight to improve its foresight.
TeleMem, where memory lives on and intelligence grows strong.
add() / search() accept the same arguments and return the same {"results": [...]} shapes, so existing Mem0 code keeps working.infer=False/prompt/memory_type now fully honored, offline contract test suite, telemetry disabled by default, and a multi-NPC demo!uvx telemem! Also new: evaluation principles and a LongMemEval harness with built-in baselines.pip install telemem! v1.6.0 adds Ollama/DeepSeek/Kimi configs, LangChain & LlamaIndex examples, and a documentation site.TeleMem enables conversational AI to maintain stable, natural, and continuous worldviews and character settings during long-term interactions through a deeply optimized pipeline of character-aware summarization → semantic clustering deduplication → efficient storage → precise retrieval.
Multi-character virtual agent systems
Long-memory AI assistants (e.g., customer service, companionship, creative co-pilots)
Complex narrative/world-building in virtual environments
Dialogue scenarios with strong contextual dependencies
Video content QA and reasoning
Multimodal agent memory management
Long video understanding and information retrieval

TeleMem deeply refactors Mem0 to address characterization, long-term memory, and high performance. Key differences:
| Capability Dimension | Mem0 | TeleMem |
|---|---|---|
| Multi-character separation | ❌ Not supported | ✅ Automatically creates independent memory profiles per character |
| Summary quality | Basic summarization | ✅ Context-aware + character-focused prompts covering key entities, actions, and timestamps |
| Deduplication mechanism | Vector similarity filtering | ✅ LLM-based semantic clustering: merges similar memories via LLM |
| Write performance | Streaming, single writes | ✅ Batch flush + concurrency: 2–3× faster writes |
| Storage format | SQLite / vector DB | ✅ FAISS + JSON metadata dual-write: fast retrieval + human-readable |
| Multimodal Capability | Single image to text only | ✅ Video Multimodal Memory: Full video processing pipeline + ReAct multi-step reasoning QA |
We evaluate the ZH-4O Chinese long-character dialogue dataset constructed in the paper MOOM: Maintenance, Organization and Optimization of Memory in Ultra-Long Role-Playing Dialogues:
Memory capability was assessed via QA benchmarks, e.g.:
LLM: Qwen3-8B (thinking mode disabled)
Embedding model: Qwen3-Embedding-8B
Metric: QA accuracy
| Method | Overall(%) |
|---|---|
| RAG | 62.45 |
| Mem0 | 70.20 |
| MOOM | 72.60 |
| A-mem | 73.78 |
| Memobase | 76.78 |
| TeleMem | 86.33 |
Using uv (recommended — creates .venv from the committed uv.lock for a reproducible environment):
Or with conda + pip:
Set your OpenAI API key:
Memory() uses the default provider settings inherited from mem0ai. To use the repository's local Qwen + FAISS configuration, load config/config.yaml explicitly:
The runnable examples also honor the same configuration through TELEMEM_CONFIG:
TeleMem supports MiniMax as an LLM backend via its OpenAI-compatible API.
A ready-to-use example config is provided at config/config.minimax.yaml.
Key points for MiniMax usage:
https://api.minimax.io/v1; MiniMax M2.7 (204,800 context) is also available. MiniMax-M3 accepts text, image and video input and supports adaptive thinking; MiniMax-M2.7 is text-only with always-on thinkinghttps://api.minimax.io/v1 (global) or https://api.minimaxi.com/v1 (China) as openai_base_url0.7) to avoid out-of-range errorstext-embedding-3-small) in the embedder sectionTeleMem works with any OpenAI-compatible endpoint. Ready-to-use config examples ship in config/:
| Provider | Config file | LLM | Embeddings | Notes |
|---|---|---|---|---|
| Ollama (fully local) | config.ollama.yaml | any local model (e.g. qwen3:8b) | nomic-embed-text, local | No API key, no cloud — everything runs on your machine |
| DeepSeek | config.deepseek.yaml | deepseek-chat / deepseek-reasoner | external (e.g. OpenAI) | export DEEPSEEK_API_KEY=... |
| Moonshot (Kimi) | config.moonshot.yaml | kimi-k2-0905-preview | external (e.g. OpenAI) | .cn and .ai endpoints supported |
| MiniMax | config.minimax.yaml | MiniMax-M3 | external (e.g. OpenAI) | see section above |
The add() method injects one or more dialogue turns into the memory system.
| Parameter | Type | Required | Description |
|---|---|---|---|
messages | str or List[Dict[str, str]] | ✅ Yes | A single statement, or a list of dialogue messages with role (user/assistant) and content |
user_id | Optional[str] | ❌ No | Character/user to attribute the memory to; TeleMem keeps an independent memory profile per user_id. Omit it to store shared conversation-event memories |
agent_id / run_id | Optional[str] | ❌ No | Additional mem0-compatible scopes (e.g. one run_id per session) |
metadata | Optional[Dict[str, Any]] | ❌ No | Arbitrary metadata stored with each memory |
infer | bool | ❌ No | Extract salient facts with the LLM (default: True); False stores message contents verbatim with no LLM call |
memory_type | Optional[str] | ❌ No | Pass "procedural_memory" to create procedural memories via mem0's pipeline; omit for conversational memories |
prompt | Optional[str] | ❌ No | Custom extraction prompt (replaces the optimized default as the system prompt) |
batch | bool | ❌ No | Route through the high-throughput batched pipeline (add_batch) |
Returns the mem0-compatible shape: {"results": [{"id": "...", "memory": "...", "event": "ADD"}, ...]}
add()🎭 Multi-character demo: examples/multi_npc.py runs five tavern NPCs through one scene — a single
add_batch(scene, user_id=[...])call gives each NPC a private memory profile plus a shared"events"world-state, and each NPC then recalls the scene from their own perspective.
Performs semantic vector-based retrieval of relevant memories with context-aware recall.
| Parameter | Type | Required | Description |
|---|---|---|---|
query | str | ✅ Yes | Natural language query |
user_id | Optional[str] | ❌ No | Character/user profile to search. The shared event memories (pseudo-user "events") are always searched as well |
agent_id / run_id | Optional[str] | ❌ No | Additional mem0-compatible scope filters |
limit | int | ❌ No | Max number of results (default: 100) |
threshold | Optional[float] | ❌ No | Similarity threshold (0–1; auto-tuned if omitted) |
filters | Dict[str, Any] | ❌ No | Custom filters (e.g., by character, time range) |
rerank | bool | ❌ No | Whether to rerank results (default: True) |
Returns the mem0-compatible shape: {"results": [{"id": "...", "memory": "...", "score": ..., ...}, ...]}
🔍 Search is based on FAISS vector retrieval, supporting millisecond-level responses.
Beyond text memory, TeleMem further extends multimodal capabilities. Drawing inspiration from Deep Video Discovery's Agentic Search and Tool Use approach, we implemented two core methods in the TeleMemory class to support intelligent storage and semantic retrieval of video content.
| Method | Description |
|---|---|
add_mm() | Process video into retrievable memory (frame extraction → caption generation → vector database) |
search_mm() | Query video content using natural language, supporting ReAct-style multi-step reasoning |
| Parameter | Type | Required | Description |
|---|---|---|---|
| video_path | str | ✅ Yes | Source video file path, e.g., "video/3EQLFHRHpag.mp4" |
| output_dir | str | ✅ Yes | Root output directory. Artifacts are written under frames/, captions/, and vdb/ subdirectories |
| clip_secs | int | ❌ No | Reserved parameter; clip length is currently read from config.vlm["CLIP_SECS"] |
| emb_dim | int | ❌ No | Embedding dimension, reads from config by default |
| subtitle_path | str | ❌ No | Subtitle file path (.srt), optional |
decode_video_to_frames - Decodes video to JPEG frames at configured FPSprocess_video - Uses VLM (e.g., Qwen3-Omni) to generate detailed descriptions for each clipinit_single_video_db - Generates embeddings for semantic retrieval💡 Smart Caching: If the target file for a stage already exists, that stage is automatically skipped to save computational resources.
| Parameter | Type | Required | Description |
|---|---|---|---|
| question | str | ✅ Yes | Question string (supports A/B/C/D multiple choice format) |
| output_dir | str | ✅ Yes | The same root output directory used by add_mm; it must contain exactly one captions/*/captions.json and one vdb/*/*_vdb.json |
| max_iterations | int | ❌ No | Maximum MMCoreAgent reasoning iterations (default 15) |
search_mm internally uses MMCoreAgent, employing a THINK → ACTION → OBSERVATION loop with three specialized tools:
| Tool Name | Function |
|---|---|
global_browse_tool | Get global overview of video events and themes |
clip_search_tool | Search for specific content using semantic queries |
frame_inspect_tool | Inspect frame details within a specific time range |
Run the multimodal demo:
On the first run, frames, captions and VDB JSON will be generated under the chosen output_dir. The repository ships a small sample video; generating captions and the video database still requires configured VLM and embedding services unless you already have these artifacts locally.
Complete code example:
TeleMem ships a Model Context Protocol (MCP) server, so any MCP-compatible client — Claude Desktop, Claude Code, Cursor, custom agents — can use TeleMem as its long-term memory.
Built on the official MCP Python SDK v2, the server implements the current MCP specification (2026-07-28) while remaining compatible with older clients; every tool declares titles, behavior annotations (read-only/destructive hints), and structured output.
The server exposes eight tools: add_memory, search_memories, get_memories, get_memory, update_memory, delete_memory, delete_all_memories, and memory_history. Calls without an explicit scope default to TELEMEM_DEFAULT_USER_ID (telemem-mcp); destructive bulk deletion always requires an explicit scope.
Claude Desktop / Cursor configuration (examples/mcp_config.json):
Or drive it programmatically over stdio — the quickstart flow as MCP tool calls:
See docs/MCP.md for the full tool reference, transports, and client setup.
TeleMem drops into any agent framework with the same two calls — search() before answering, add() after each exchange:
| Framework | Example | Install |
|---|---|---|
| LangChain | examples/langchain_memory.py | pip install langchain-core langchain-openai |
| LlamaIndex | examples/llamaindex_memory.py | pip install llama-index-llms-openai |
| Claude Desktop / Cursor / any MCP client | MCP Server | pip install "telemem[mcp]" |
Because TeleMem is mem0 API-compatible, any framework adapter written for Mem0's OSS client also works — point it at telemem.Memory instead.
TeleMem automatically creates a structured storage layout under ./faiss_db/, organized by session and character:
All memories include summary, round number, timestamp, and character, facilitating auditing and debugging.
TeleMem generates video-related storage files in the .data/samples/video/ directory:
TeleMem itself collects no telemetry. The underlying mem0ai library ships
anonymized PostHog usage telemetry, which TeleMem disables by default
(import telemem sets MEM0_TELEMETRY=False unless you have already set it).
To opt back in:
uv run pytest tests/ -q) on Python 3.10–3.12 for every PR.TeleMem’s development has been deeply inspired by open-source communities and cutting-edge research. We extend our sincere gratitude to the following projects and teams:
If you find TeleMem useful to your research or development, please cite our arXiv paper:
Chunliang Chen, Ming Guan, Xiao Lin, Jiaxu Li, Luxi Lin, Qiyi Wang, Xiangyu Chen, Jixiang Luo, Changzhi Sun, Dell Zhang, Xuelong Li. TeleMem: Building Long-Term and Multimodal Memory for Agentic AI. arXiv:2601.06037, 2026. https://arxiv.org/abs/2601.06037
Citation metadata is also available in CITATION.cff (GitHub's "Cite this repository" button).
If you find this project helpful, please give it a ⭐️ — starring also keeps updates in your GitHub feed.
Made with ❤️ by Bloo-Mind AI Ltd and the Ubiquitous AGI team at TeleAI.
mcp-name: io.github.TeleAI-UAGI/telemem
Showcase your server listing on GitHub or your project documentation. Embed this dynamic SVG badge to highlight official listing status and live engagement.
[](https://allmcps.com/mcp/telemem)<a href="https://allmcps.com/mcp/telemem"><img src="https://allmcps.com/api/badge/telemem?style=directory" alt="Telemem on AllMCPs" /></a>