Documentation Index
Fetch the complete documentation index at: https://docs.lucid.foundation/llms.txt
Use this file to discover all available pages before exploring further.
Portable Memory
Lucid provides a local-first, portable, and provable agent memory system with six distinct memory types. This system is designed to ensure that agent memory is both secure and easily transferable.Memory Architecture
The memory system is structured into three layers:Layer 1: Core Memory Store
- IMemoryStore: Supports both Postgres and in-memory storage.
- Type Managers: Manages six types of memory.
- Query Engine: Facilitates efficient data retrieval.
- Vector Search: Enables semantic recall through vector embeddings.
Layer 2: Memory Service
- MemoryService Orchestrator: Coordinates memory operations.
- LLM Extraction: Extracts meaningful data using large language models.
- SHA-256 Hash Chain: Ensures data integrity through cryptographic hashing.
- Receipt Linkage: Connects memory operations to receipts.
- Access Control List (ACL): Manages permissions.
- Archive/Compaction Pipelines: Organizes data storage efficiently.
Layer 3: API and Tools
- REST API:
/v1/memory/*routes for interacting with memory. - MCP Tools: Management and control tools.
- SDK:
lucid.memory.*for developer integration.
Memory Types
Lucid supports six types of memory, each serving a unique purpose:- Episodic: Stores conversation turns.
- Semantic: Holds extracted facts.
- Procedural: Contains learned rules.
- Entity: Represents knowledge graph nodes.
- Trust-Weighted: Manages cross-agent trust.
- Temporal: Captures time-bounded facts.
.lmf (Lucid Memory File), which are signed, hash-chained snapshots stored on DePIN.
Semantic Recall
Semantic recall is a two-stage retrieval process:- Vector Search: Retrieves top-K candidates using
pgvectorwith cosine distance. - Metadata-Aware Reranking: Adjusts ranking based on similarity, recency, type bonus, and quality.
- Intent Classifier: Prioritizes memory types with episodic > procedural > semantic.
- Overfitting Guard: Limits type bonus to prevent overfitting.
Memory Lanes
Memory is organized into lanes:self, user, shared, and market. Each lane has specific compaction policies to manage data efficiently.
Tiered Compaction
TheCompactionPipeline manages data through three tiers:
- Hot: Keeps recent episodics active.
- Warm: Archives older episodics, with optional extraction.
- Cold: Prunes archived entries beyond retention limits.
Extraction Hardening
Extraction processes include schema validation and error categorization, ensuring robust data handling.Snapshot and Restore
Snapshots can be created and restored using theArchivePipeline. This includes namespace filtering and identity verification.
API Endpoints
POST /v1/memory/episodic: Store episodic memory.POST /v1/memory/semantic: Store semantic memory.POST /v1/memory/procedural: Store procedural memory.POST /v1/memory/entity: Store entity memory.POST /v1/memory/trust-weighted: Store trust-weighted memory.POST /v1/memory/temporal: Store temporal memory.POST /v1/memory/recall: Perform semantic recall.POST /v1/memory/compact: Trigger data compaction.POST /v1/memory/snapshots: Create a DePIN snapshot.POST /v1/memory/snapshots/restore: Restore from a snapshot.POST /v1/memory/verify: Verify hash chain integrity.
Key Files
The memory system is implemented across several key files, each responsible for different aspects of memory management, such as type definitions, service orchestration, storage implementations, and more.Environment Variables
Configure the memory system using environment variables likeMEMORY_ENABLED, MEMORY_STORE, and others to tailor the setup to your needs.
.png?fit=max&auto=format&n=VsjUqn6fLqEhBiuI&q=85&s=8b4c7e6431e9a6af1ef23b77bb4ff5fd)
.png?fit=max&auto=format&n=VsjUqn6fLqEhBiuI&q=85&s=d5651a45e4bfbabc33f74e146af3f94a)