-
Pinecone (Short-Term Memory)
- Fast, consistent memory for active context
- User namespace isolation (
user-{userId}) - Automatic cleanup and pruning
- Optimized for real-time retrieval
-
Supabase + PostgreSQL (Long-Term Memory)
- Persistent storage with RLS
- Vector similarity search
- Full audit trail
- Supports memory types: long_term, skill, context
- OpenAI text-embedding-3-small model
- 1536-dimensional vectors
- Batch embedding support
- Cosine similarity calculation
- Namespace-based user isolation
- Upsert, query, delete operations
- Metadata storage
- Namespace management
- RLS-protected vector storage
- Semantic search via match_memories function
- User-scoped queries
- CRUD operations
- PostgreSQL memory table access
- Type-based filtering
- User and task associations
- Score tracking
- Orchestrates all memory operations
- Unified API for short and long-term memory
- Parallel retrieval
- Context-aware storage
POST /api/memory/store- Store memory (short or long-term)POST /api/memory/retrieve- Retrieve memories by queryDELETE /api/memory/:memoryId- Delete specific memoryDELETE /api/memory/short-term/:userId- Clear short-term memoryDELETE /api/memory/long-term/:userId- Clear long-term memory
short_term- Temporary context (Pinecone)long_term- Persistent knowledge (Supabase + PostgreSQL)skill- Learned capabilitiescontext- Situational awareness
Each user has isolated namespace in Pinecone:
user-1, user-2, user-3, etc.
Supabase queries automatically filtered by user_id through RLS policies.
match_memories(
query_embedding vector(1536),
match_threshold float,
match_count int,
user_id_filter int
)const memoryCore = new MemoryCore();
// Store short-term memory
const id = await memoryCore.storeShortTerm(
userId,
'User prefers dark mode',
{ source: 'preference' }
);
// Store long-term memory
const longId = await memoryCore.storeLongTerm(
userId,
'Completed Python tutorial',
'skill',
taskId
);
// Retrieve relevant memories
const result = await memoryCore.retrieve(
userId,
'What programming languages does user know?',
{ shortTermCount: 5, longTermCount: 10 }
);42 tests passing:
- Memory storage (short and long-term)
- Memory retrieval with semantic search
- Embedding generation
- Cosine similarity calculation
- User namespace isolation
- Type filtering
Environment variables:
PINECONE_API_KEY=your_key
PINECONE_INDEX=cortexos-memory
SUPABASE_URL=your_url
SUPABASE_KEY=your_key
OPENAI_API_KEY=your_key
- Task scheduling
- Recurring tasks
- Delayed execution
- Retry logic
- Cron-like scheduling