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
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.Entity Resolution
Extracted entity mentions are resolved against existing entities using HMAC-based exact matching and type-aware deduplication.
Fact Types
| Type | Description | Example |
|---|---|---|
fact | Objective statement | ”PostgreSQL 16 is the primary database” |
preference | User or system preference | ”Team prefers TypeScript for new services” |
episode | Event or occurrence | ”Production outage on Feb 10 lasted 2 hours” |
decision | Decision made | ”Chose Redis over Memcached for caching” |
API Endpoints
List Entities
| Parameter | Type | Default | Description |
|---|---|---|---|
type | string | - | Filter by entity type |
limit | integer | 50 | Max results (1-200) |
offset | integer | 0 | Pagination offset |
Get Entity Facts
| Parameter | Type | Default | Description |
|---|---|---|---|
latest_only | boolean | true | Only return current (non-superseded) facts |
fact_type | string | - | Filter: fact, preference, episode, decision |
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:| Tool | Description |
|---|---|
remem_memory_query | Query facts by topic/entity |
remem_list_entities | Browse entities |
remem_get_entity_facts | Get facts for an entity |
remem_extract_facts | Trigger extraction |