Overview
ClarkOS implements a cognitive memory system with five distinct types, vector embeddings for semantic search, and type-specific deduplication. This goes beyond simple conversation history to model how agents learn and remember.Memory Types
The reflection type enables metacognitive capabilities—agents can reason about their own patterns.
Reference: Types defined in
src/core/types.ts, thresholds in src/memory/deduplication.ts
Memory Structure
Each memory includes rich metadata:
Reference: Full interface in
src/core/types.ts
Embeddings are generated and used for deduplication/search but stored separately from the core Memory structure.
Deduplication
ClarkOS uses a 3-tier deduplication strategy to prevent redundant memories:- Exact match — Identical content is rejected
- Jaccard similarity — Word overlap >0.85 is rejected
- Embedding similarity — Type-specific thresholds (see table above)
checkDuplication() and findSimilarMemories() in src/memory/deduplication.ts
Using the Memory Store
The SDK provides aMemoryStore interface for all memory operations:
src/memory/store.ts for MemoryStore implementation
Salience and Confidence
Two helper functions score memories automatically: Salience measures how attention-grabbing content is:- Exclamation marks, caps, urgency words boost salience
- Routine content scores lower
- API sources score higher than user input
- Verified facts score higher than opinions
calculateSalience() and calculateConfidence() in src/memory/deduplication.ts
Embeddings
Vector embeddings enable semantic search across memories:src/llm/embeddings.ts for embedding client and similarity functions
Memory Linking (Roadmap)
The architecture supports bidirectional memory links with 7 relationship types:caused_by,related_to,contradicts,elaborates,supersedes,temporal_before,temporal_after
Memory Consolidation (Roadmap)
Over time, related memories consolidate into core memories—summarized knowledge representing patterns across many individual memories. This mimics how human long-term memory works. Reference: Consolidation implemented in CLARK backend, SDK integration plannedNext Steps
Consciousness
How memories become thoughts.
Memory Management
Advanced patterns and tuning.