How liliang-cn/cortexdb works
CortexDB is an embedded AI-memory and knowledge-graph product, usable locally or through shared gRPC. A typical workflow captures or imports material, stores searchable memories and graph knowledge, then retrieves context for an agent. The graph also preserves major documented capabilities: graph/RAG, ontology governance, connectors, live exploration, and multiple access surfaces. Relationships are limited to explicit README statements and shown call sites; several subsystems are represented by their exact directory because their implementation was not sampled.
Main entry points: cortexdb.go CortexDB facade · store_query.go Embedding store · graphrag_tool_ingest.go Graph RAG ingest · connector Source connectors
Components 21
Capture and ingest
- Memory workflows
pkg/memoryflow/service.go - Data import
pkg/importflow - Source connectors
pkg/connector - Graph RAG ingest
pkg/cortexdb/graphrag_tool_ingest.go
Memory and knowledge
- Agent memory search
pkg/agentmem/search.go - Knowledge and memory API
pkg/cortexdb/knowledge_api.go - Ontology governance
pkg/cortexdb/ontology_storage.go - Graph extraction flow
pkg/graphflow/pipeline.go - Graph and RDF engine
pkg/graph
Search and reasoning
- Graph RAG search
pkg/cortexdb/graphrag_tool_search.go - Semantic routing
pkg/semantic-router/router.go - Vector indexes
pkg/index
Persistence
- Embedding store
pkg/core/store_query.go - CortexDB facade
pkg/cortexdb/cortexdb.go
Product interfaces
- MCP tools
cmd/cortexdb-mcp-stdio/main.go - Shared gRPC API
pkg/rpcserver/server.go - Live graph view
pkg/liveview/server.go - HTTP API
pkg/httpapi/server.go - Obsidian plugin
plugins/obsidian-cortexdb/src/main.js
Other components
- AI agent
- External data sources
Connections 22
- External data sources → Source connectors: supplies data
- Source connectors → CortexDB facade: imports knowledge
- Data import → CortexDB facade: imports material
- Memory workflows → CortexDB facade: saves memories
pkg/memoryflow/service.go - AI agent → MCP tools: uses tools
README.md - MCP tools → CortexDB facade: serves tools
cmd/cortexdb-mcp-stdio/main.go - AI agent → Shared gRPC API: calls services
README.md - Shared gRPC API → CortexDB facade: delegates calls
pkg/rpcserver/server.go - AI agent → Knowledge and memory API: requests memory
README.md - Knowledge and memory API → Embedding store: stores embeddings
- CortexDB facade → Embedding store: persists data
- Graph RAG ingest → Graph and RDF engine: writes graph
pkg/cortexdb/graphrag_tool_ingest.go - Graph RAG ingest → Embedding store: stores chunks
pkg/cortexdb/graphrag_tool_ingest.go - Graph extraction flow → CortexDB facade: builds graph
pkg/graphflow/pipeline.go - Graph RAG search → Graph and RDF engine: retrieves graph
pkg/cortexdb/graphrag_tool_search.go - Agent memory search → Embedding store: searches vectors
pkg/agentmem/search.go - Semantic routing → Embedding store: routes search
- Vector indexes → Embedding store: accelerates retrieval
- Ontology governance → Embedding store: stores schemas
pkg/cortexdb/ontology_storage.go - Live graph view → CortexDB facade: reads graph data
pkg/liveview/server.go - HTTP API → CortexDB facade: delegates requests
pkg/httpapi/server.go - Obsidian plugin → AI agent: offers brain tools
README.md