Skip to main content

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:
  1. Exact match — Identical content is rejected
  2. Jaccard similarity — Word overlap >0.85 is rejected
  3. Embedding similarity — Type-specific thresholds (see table above)
Lower thresholds (emotional: 0.88) allow similar feelings to merge. Higher thresholds (procedural: 0.97) require near-exact matches to merge patterns. Reference: checkDuplication() and findSimilarMemories() in src/memory/deduplication.ts

Using the Memory Store

The SDK provides a MemoryStore interface for all memory operations:
Reference: 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
Confidence measures reliability:
  • API sources score higher than user input
  • Verified facts score higher than opinions
Reference: calculateSalience() and calculateConfidence() in src/memory/deduplication.ts

Embeddings

Vector embeddings enable semantic search across memories:
Reference: 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
This enables reasoning about how memories connect. Reference: Link types defined in schema, detection API in development

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 planned

Next Steps

Consciousness

How memories become thoughts.

Memory Management

Advanced patterns and tuning.