Semantic Memory
General world knowledge and facts, stored as a knowledge graph of concepts.
:Fact nodes), Qdrant (Vectors)Purpose
Semantic Memory stores general world knowledge and facts that are not tied to a specific timestamp or session. It represents the "textbook knowledge" of the agent.
Key Features
- Confidence Scoring: Every fact has a confidence score (0.0-1.0). Conflicting facts can coexist, but retrieval favors higher confidence.
- Dynamic Linking: Facts automatically link to related concepts via
:RELATED_TOedges. - Extraction: Uses LLMs to parse unstructured text into atomic Subject-Predicate-Object triples.
Functional Deep Dive
Fact Extraction
The system uses LLMs to parse incoming unstructured text (from documents or high-utility episodes) into atomic facts. For example, "Python is a programming language" becomes (Python)-[:IS_A]->(Programming Language).
Recursive Retrieval
Retrieval isn't just keyword matching. When retrieving a concept (e.g., "Python"), the system also fetches connected nodes (e.g., "Programming Language", "Snake") depending on the context relationships [:RELATED_TO].
Ingestion Workflow
Codebase Interaction
- Invocation:
UnifiedIngestionService.ingest_contentor duringMainOrchestratorretrieval hooks. - Key API:
/api/memory/v1/facts
API Reference
Semantic Memory provides RESTful endpoints for managing knowledge facts.
| Method | Endpoint | Description |
|---|---|---|
| POST | /api/memory/v1/facts | Add a new fact |
| GET | /api/memory/v1/facts | List facts with filters |
| GET | /api/memory/v1/facts/{fact_id} | Get specific fact by ID |
| PUT | /api/memory/v1/facts/{fact_id} | Update fact |
| DELETE | /api/memory/v1/facts/{fact_id} | Delete a fact |
| POST | /api/memory/v1/facts/search | Semantic search for facts |
| GET | /api/memory/v1/facts/kg/{kg_name} | Get facts by knowledge graph |
SDK Reference
The Functor SDK provides a Python interface for semantic memory operations.