mem0-cohere
Mem0 persistent memory with Cohere embeddings (17-key rotation) + Qdrant server
- License 许可
- MIT
- 最近更新
- 2026-09-18
- Stars
- ★ 0
- Forks
- 0
01 前言 Front Matter
- name
- mem0-cohere
- triggers
- [ "save to mem0", "mem0 memory", "search memories", "add memory", "persistent memory", "agent memory", "cross-session memory" ]
- description
- Mem0 persistent memory with Cohere embeddings (17-key rotation) + Qdrant server
02 资源文件 5
- 脚本config_free.py289 B
- 脚本embedder.py1.9 KB
- 脚本setup_mem0.py3.7 KB
- 脚本test_mem0.py2.0 KB
- 脚本workspace_indexer.py2.9 KB
03 SKILL.md 正文
Mem0 + Cohere Memory System
Persistent agent memory using Mem0 with Cohere embeddings (17-key rotation) and Qdrant vector database.
Architecture
┌─────────────────────────────────────────────────────────────┐
│ Mem0 OSS (self-hosted) │
├─────────────────────────────────────────────────────────────┤
│ Embeddings: Cohere embed-english-v3.0 (1024 dims) │
│ - 17 API keys with rotation (COHERE_API_KEY_1..17) │
│ - Free tier: 1,000 req/month per key = 17,000 total │
│ │
│ LLM: Groq llama-3.3-70b-versatile (3 keys rotating) │
│ - Used for fact extraction from text │
│ │
│ Vector Store: Qdrant server (localhost:6333) │
│ - Managed by Zo Computer (dumb-init supervisor) │
│ - Collections: mem0_cohere, mem0migrations │
│ - Data path: /home/workspace/Projects/data/qdrant │
│ │
│ Config: /root/.hermes/mem0.json │
└─────────────────────────────────────────────────────────────┘
Key Facts
- Qdrant runs as a server (not file-based) — enables concurrent access from multiple Hermes sessions
- No systemd — Zo Computer uses dumb-init (PID 1) for process supervision
- 17 Cohere keys rotate automatically to avoid rate limits
- Free tier only — no paid API credits used for embeddings
- Groq LLM for fact extraction (3 keys rotating)
- user_id:
"workspace"(not "joseph") — all existing data uses this ID
Collections
| Collection | Purpose |
|---|---|
mem0_cohere |
Main memory storage (144 points) |
mem0migrations |
Migration tracking |
workspace_files |
Semantic search over workspace (9,765 points) |
cases |
Legal case data |
documents |
Document embeddings |
research |
Research data |
wiki |
Wiki/knowledge base |
Usage
Via Hermes Plugin (Recommended)
The mem0 plugin at /root/.hermes/plugins/mem0/ provides:
mem0_add(content)— Store a memorymem0_search(query)— Search memoriesmem0_list()— List all memoriesmem0_update(memory_id, text)— Update a memorymem0_delete(memory_id)— Delete a memory
Via Python Scripts
# Load credentials
from pathlib import Path
env_path = Path("/home/workspace/credentials/master_keys.env")
# Initialize with rotating embeddings
from embedder import CohereRotatingEmbeddings
cohere_keys = [load from master_keys.env]
embeddings = CohereRotatingEmbeddings(cohere_keys)
# Mem0 config
config = {
"vector_store": {
"provider": "qdrant",
"config": {
"host": "localhost",
"port": 6333,
"collection_name": "mem0_cohere",
"embedding_model_dims": 1024,
}
},
"embedder": {
"provider": "langchain",
"config": {"model": embeddings}
},
"llm": {
"provider": "openai",
"config": {
"model": "groq-rotating",
"groq_model": "llama-3.3-70b-versatile"
}
}
}
from mem0 import Memory
m = Memory.from_config(config)
m.add("fact to remember", user_id="joseph")
Files
| File | Purpose |
|---|---|
embedder.py |
CohereRotatingEmbeddings class |
setup_mem0.py |
Test setup with 17-key rotation |
workspace_indexer.py |
Index workspace files into mem0 |
test_mem0.py |
Test script (outdated — uses DeepSeek) |
config_free.py |
Free-tier config constants |
Important Notes
Data Structure Mismatch
The existing data in Qdrant was written by workspace_indexer.py directly to Qdrant, not through mem0's API. This means:
- Payload structure: Uses
datafield instead ofmemoryfield - mem0 API compatibility:
get_all()andsearch()may return empty results because mem0 expects a different payload format - Direct Qdrant access: Data IS accessible via Qdrant's API directly (see Troubleshooting section)
- Future writes: Use
mem0_addtool or mem0'sadd()method for proper mem0-compatible payloads
Two Use Cases
- Workspace semantic search (existing data): Use
workspace_indexer.pyto index workspace files, query via Qdrant API directly - Agent memory (new data): Use
mem0_add/mem0_searchtools for Hermes agent memory with proper mem0 format
Qdrant File Lock Error
Problem: File lock already acquired when multiple sessions try to access mem0
Solution: Qdrant is now running as a server (not file-based). All sessions connect via HTTP to localhost:6333. No file locks.
Rate Limit Errors
Problem: Cohere API rate limit (429)
Solution: The embedder automatically rotates through 17 keys. If all are exhausted, wait 1 minute and retry.
Mem0 Plugin Not Loading
Problem: Mem0Backend() takes no arguments error
Solution: The plugin uses a factory pattern. Don't instantiate Mem0Backend directly — use the plugin's initialization flow via Hermes.
Qdrant Server Management
Qdrant runs as a supervisord-managed service on Zo Computer.
Configuration:
- Binary:
/usr/local/bin/qdrant - Config:
/home/workspace/Projects/data/qdrant/qdrant_config.yaml - Data:
/home/workspace/Projects/data/qdrant/ - Ports: 6333 (HTTP), 6334 (gRPC)
- Supervisor config:
/etc/zo/supervisord-user.conf - Logs:
/dev/shm/qdrant.logand/dev/shm/qdrant_err.log
Management commands:
# Check status
supervisorctl -c /etc/zo/supervisord-user.conf status qdrant
# Restart
supervisorctl -c /etc/zo/supervisord-user.conf restart qdrant
# Stop/Start
supervisorctl -c /etc/zo/supervisord-user.conf stop qdrant
supervisorctl -c /etc/zo/supervisord-user.conf start qdrant
# View logs
tail -f /dev/shm/qdrant.log
tail -f /dev/shm/qdrant_err.log
Verify Qdrant is running:
curl http://localhost:6333/collections
Auto-restart: Qdrant is configured with autorestart=true — if it crashes, supervisord automatically restarts it.
Migration History
- Before: File-based Qdrant at
/root/.hermes/mem0_qdrant— caused concurrent access errors - After: Server-based Qdrant at localhost:6333 — enables multiple Hermes sessions
- Migration date: June 25, 2026
- Points migrated: 144 (mem0_cohere collection)
Cost
- Embeddings: $0 (Cohere free tier, 17 keys)
- LLM: $0 (Groq free tier, 3 keys)
- Vector DB: $0 (self-hosted Qdrant)
- Total: $0/month for persistent memory
04 同仓库更多 Skills
zopack
Export and import zo.space route setups as shareable .zopack.md files. Use when the user wants to package their zo.space routes for sharing, or when they receive a .zopack.md file to deploy. Triggers on "export my zo.space", "create a zopack", "import this zopack", or any mention of .zopack.md files.
zoho-mail-inbox
Full inbox management for Zoho Mail (info@justlegalsolutions.org) — list unread, mark all as read, delete by sender/keyword, search, send from aliases, list folders. Fully self-contained — zero setup needed.
weekly-meeting-reminder
Get an email every Sunday evening listing your meetings for the coming week.
Let Zo use your X (Twitter) account
zo-tools
Internal process tools for Zo and Hermes — local search, document processing, OCR, and embeddings. All services run on localhost, zero HTTP slots consumed.
ssh-setup
Sets up secure remote access to your Zo Computer so you can connect from anywhere