Memory Layer
The Memory Layer automatically extracts discrete facts from your documents and organizes them into a structured knowledge graph of entities and relationships. Think of it as turning unstructured documents into a queryable knowledge base.Overview
Facts
Atomic statements extracted from documents. Typed, confidence-scored, and temporally aware.Example: “The API rate limit is 100 req/min”
Entities
People, organizations, projects, and concepts referenced by facts. Automatically deduplicated across documents.Example: Acme Corp (resolved from “Acme”, “Acme Corporation”)
How It Works
1
Document Ingested
A document completes normal ingestion (chunking, embedding, classification).
2
Fact Extraction
An async memory worker sends the document content to Grok for fact extraction. Each fact is typed (
fact, preference, episode, decision) and confidence-scored.3
Entity Resolution
Extracted entity mentions are resolved against existing entities using HMAC-based exact matching and type-aware deduplication.
4
Relationship Discovery
New facts are compared against existing facts sharing the same entities. Relationships (
updates, extends, derives, contradicts) are discovered via LLM comparison.Fact Types
API Endpoints
List Entities
Get Entity Facts
Trigger Fact Extraction
Manually re-extract facts from a completed document:202 Accepted with extraction status.
Query with Facts
Include facts in normal query responses:MCP Tools
The following MCP tools are available for the Memory Layer:
See MCP Integration for configuration.