How suanmosuanyangtechnology/memorybear works
MemoryBear is an AI memory management system that turns conversations and documents into structured, evolving knowledge and makes that knowledge available for later retrieval. Its principal workflow is API submission, memory extraction, graph-backed persistence, and hybrid search; forgetting and scheduled self-reflection maintain the memory over time. The graph preserves the documented extraction, graph storage, hybrid retrieval, forgetting, and reflection capabilities. Some internal connections are based on the README’s architecture description; unverified implementation links are shown as dashed.
Main entry points: memory_api_controller.py Service Endpoints · memory_service.py Memory Service · extraction_pipeline_orchestrator.py Knowledge Extraction · graph_writer.py Graph Storage
Components 16
Service API
- Service Endpoints
api/app/controllers/service/memory_api_controller.py - Memory Operations API
api/app/controllers/memory_storage_controller.py
Memory Lifecycle
- Memory Service
api/app/core/memory/memory_service.py - Write Pipelines
api/app/core/memory/pipelines/write_pipeline.py - Knowledge Extraction
api/app/core/memory/storage_services/extraction_engine/extraction_pipeline_orchestrator.py - LLM and Embeddings
api/app/core/memory/llm_tools/llm_client.py
Knowledge Retrieval
- Graph Storage
api/app/core/memory/storage/provider/neo4j/graph_writer.py - Memory Search
api/app/core/memory/read_services/search_engine/content_search.py - Knowledge Graph Retrieval
mem-knowledge/src/rag/knowledge_graph/retrieval_pipeline.py - Elasticsearch Search
api/app/core/memory/storage/provider/elasticsearch/client.py
Memory Operations
- Forgetting Engine
api/app/core/memory/storage_services/forgetting_engine/forgetting_engine.py - Self-Reflection
api/app/core/memory/storage_services/reflection_engine/self_reflexion.py - Async Task Queues
api/app/celery_task_scheduler/scheduler.py
Other components
- AI Integrator
- Neo4j
- Elasticsearch
Connections 16
- AI Integrator → Service Endpoints: submits memory
README.md - AI Integrator → Memory Operations API: manages memory
README.md - Memory Operations API → Memory Service: invokes
api/app/controllers/memory_storage_controller.py - Service Endpoints → Memory Service: exposes memory operations
- Memory Service → Write Pipelines: dispatches writes
- Write Pipelines → Knowledge Extraction: runs extraction
- Knowledge Extraction → LLM and Embeddings: uses models
- Knowledge Extraction → Graph Storage: writes triples
README.md - Graph Storage → Neo4j: stores graph
README.md - Service Endpoints → Memory Search: offers search
README.md - Memory Search → Elasticsearch Search: uses keyword and vector search
- Elasticsearch Search → Elasticsearch: keyword retrieval
README.md - Service Endpoints → Knowledge Graph Retrieval: offers graph retrieval
- Memory Service → Forgetting Engine: controls forgetting
README.md - Async Task Queues → Self-Reflection: schedules reflection
README.md - Self-Reflection → Graph Storage: optimizes associations