Next-Generation AI Memory Management System · Perceive · Extract · Associate · Forget
中文 | English
Quick Start · Installation · Core Features · Architecture · Benchmarks · Papers
MemoryBear is a next-generation AI memory system developed by RedBear AI. Its core breakthrough lies in moving beyond the limitations of traditional "static knowledge storage". Inspired by the cognitive mechanisms of biological brains, MemoryBear builds an intelligent knowledge-processing framework that spans the full lifecycle of perception → extraction → association → forgetting.
Unlike traditional memory tools that treat knowledge as static data to be retrieved, MemoryBear emulates the hippocampus's memory encoding, the neocortex's knowledge consolidation, and synaptic pruning-based forgetting — enabling knowledge to dynamically evolve with life-like properties. This shifts the relationship between AI and users from passive lookup to proactive cognitive assistance.
| Paper | Description |
|---|---|
| 📄 Memory Bear AI: A Breakthrough from Memory to Cognition | MemoryBear core technical report |
| 📄 Memory Bear AI Memory Science Engine for Multimodal Affective Intelligence | Technical report on multimodal affective intelligence memory engine |
| 📄 A-MBER: Affective Memory Benchmark for Emotion Recognition | Affective memory benchmark dataset |
Performs semantic-level parsing of unstructured conversations and documents to extract:
MemoryBear → core function → knowledge extraction) as atomic units for graph storageGraph-first architecture integrated with Neo4j, overcoming the weak relational modeling of traditional databases:
Keyword retrieval + semantic vector retrieval dual-engine fusion:
Inspired by the brain's synaptic pruning mechanism, using a dual-dimension model of memory strength and time decay:
Scheduled daily reflection process, mimicking human review and retrospection:
Unified service architecture exposing two API surfaces:
| API Type | Path Prefix | Auth | Purpose |
|---|---|---|---|
| Management API | /api |
JWT | System config, permissions, log queries |
| Service API | /v1 |
API Key | Knowledge extraction, graph ops, search, forgetting control |
Celery Three-Queue Async Architecture:
| Queue | Worker Type | Concurrency | Purpose |
|---|---|---|---|
memory_tasks |
threads | 100 | Memory read/write (asyncio-friendly) |
document_tasks |
prefork | 4 | Document parsing (CPU-bound) |
periodic_tasks |
prefork | 2 | Scheduled tasks, reflection engine |
Evaluation metrics include F1 score (F1), BLEU-1 (B1), and LLM-as-a-Judge score (J) — higher values indicate better performance.
MemoryBear consistently outperforms competing systems including Mem0, Zep, and LangMem across all four task categories:
Vector version (non-graph): Achieves substantially improved retrieval efficiency while maintaining high accuracy. Overall accuracy surpasses the best existing full-text retrieval methods (72.90 ± 0.19%), while maintaining low latency at both p50 and p95 for Search Latency and Total Latency.
Graph version: Integrating the knowledge graph architecture pushes overall accuracy to a new benchmark (75.00 ± 0.20%), delivering performance metrics that significantly surpass all other methods.
Prerequisites: Docker Desktop installed.
# 1. Clone the repository
git clone https://github.com/SuanmoSuanyangTechnology/MemoryBear.git
cd MemoryBear/api
# 2. Start base services (PostgreSQL / Neo4j / Redis / Elasticsearch)
# Pull and start these images via Docker Desktop first (see Installation section 3.2)
# 3. Configure environment variables
cp env.example .env
# Edit .env with your database connections and LLM API keys
# 4. Initialize the database
pip install uv && uv sync
alembic upgrade head
# 5. Start API + Celery Workers + Beat scheduler
docker-compose up -d
# 6. Initialize the system and get the admin account
curl -X POST http://127.0.0.1:8002/api/setup
Note:
docker-compose.ymlincludes the API service and Celery Workers only. Base services (PostgreSQL, Neo4j, Redis, Elasticsearch) must be started separately.Port info: Docker Compose defaults to port
8002; manual startup defaults to port8000. The installation guide below uses manual startup (8000) as the example.
After startup: - API docs: http://localhost:8002/docs - Frontend: http://localhost:3000 (after starting the web app)
Default admin credentials:
- Account: admin@example.com
- Password: admin_password
Quick commands below — see Installation for detailed steps.
# Backend
cd api
pip install uv && uv sync
alembic upgrade head
uv run -m app.main
# Frontend (new terminal)
cd web
npm install && npm run dev
| Component | Version | Purpose |
|---|---|---|
| Python | 3.12+ | Backend runtime |
| Node.js | 20.19+ or 22.12+ | Frontend runtime |
| PostgreSQL | 13+ | Primary database |
| Neo4j | 4.4+ | Knowledge graph storage |
| Redis | 6.0+ | Cache and message queue |
| Elasticsearch | 8.x | Hybrid search engine |
git clone https://github.com/SuanmoSuanyangTechnology/MemoryBear.git
# Install uv package manager
pip install uv
# Switch to the API directory
cd api
# Install dependencies
uv sync
# Activate virtual environment
# Windows (PowerShell, inside /api)
.venv\Scripts\Activate.ps1
# Windows (cmd, inside /api)
.venv\Scripts\activate.bat
# macOS / Linux
source .venv/bin/activate
Download Docker Desktop and pull the required images.
PostgreSQL — search → select → pull
Neo4j — pull the same way. When creating the container, map two required ports and set an initial password:
- 7474: Neo4j Browser
- 7687: Bolt protocol
Redis — same steps as above.
Elasticsearch
Pull the Elasticsearch 8.x image and create a container, mapping ports 9200 (HTTP API) and 9300 (cluster communication). For initial setup, disable security to simplify configuration:
docker run -d --name elasticsearch \
-p 9200:9200 -p 9300:9300 \
-e "discovery.type=single-node" \
-e "xpack.security.enabled=false" \
elasticsearch:8.15.0
cp env.example .env
Fill in the core configuration in .env:
# Neo4j Graph Database
NEO4J_URI=bolt://localhost:7687
NEO4J_USERNAME=neo4j
NEO4J_PASSWORD=your-password
# PostgreSQL Database
DB_HOST=127.0.0.1
DB_PORT=5432
DB_USER=postgres
DB_PASSWORD=your-password
DB_NAME=redbear-mem
# Set to true on first startup to auto-migrate the database
DB_AUTO_UPGRADE=true
# Redis
REDIS_HOST=127.0.0.1
REDIS_PORT=6379
REDIS_DB=1
# Celery
REDIS_DB_CELERY_BROKER=1
REDIS_DB_CELERY_BACKEND=2
# Elasticsearch
ELASTICSEARCH_HOST=127.0.0.1
ELASTICSEARCH_PORT=9200
# JWT Secret Key (generate with: openssl rand -hex 32)
SECRET_KEY=your-secret-key-here
$ claude mcp add MemoryBear \
-- python -m otcore.mcp_server <graph>