memory
Persistent memory system for preferences, facts, and notes
What this skill does
# Memory - Complete API Reference
Store and recall user preferences, facts, and notes across conversations. Semantic search powered by vector embeddings.
---
## Chat Commands
### Store Memories
```
/remember preference risk=conservative Save trading preference
/remember fact BTC halving is in April 2028 Store a fact
/remember note Check ETH before market open Save a note
/remember rule Never trade during FOMC Store trading rule
```
### Recall Memories
```
/memory View all memories
/memory preferences View preferences only
/memory facts View facts only
/memory notes View notes only
/memory rules View trading rules
/memory search "bitcoin" Search memories
```
### Forget Memories
```
/forget <key> Delete specific memory
/forget all preferences Clear all preferences
/forget all Clear everything (careful!)
```
---
## TypeScript API Reference
### Create Memory Service
```typescript
import { createMemoryService } from 'clodds/memory';
const memory = createMemoryService({
// Storage backend
backend: 'lancedb', // 'lancedb' | 'sqlite' | 'postgres'
// Embedding model
embeddings: {
provider: 'openai',
model: 'text-embedding-3-small',
},
// Options
encryptionKey: process.env.MEMORY_ENCRYPTION_KEY,
});
```
### Remember (Store)
```typescript
// Store a preference
await memory.remember({
userId: 'user-123',
type: 'preference',
key: 'risk_tolerance',
value: 'conservative',
});
// Store a fact
await memory.remember({
userId: 'user-123',
type: 'fact',
content: 'BTC halving occurs approximately every 4 years',
metadata: { topic: 'crypto', confidence: 0.95 },
});
// Store a note
await memory.remember({
userId: 'user-123',
type: 'note',
content: 'Check Polymarket for election markets before Tuesday',
metadata: { priority: 'high' },
});
// Store a trading rule
await memory.remember({
userId: 'user-123',
type: 'rule',
content: 'Never trade more than 5% of portfolio on single position',
});
```
### Recall (Retrieve)
```typescript
// Get all memories for user
const all = await memory.recall({ userId: 'user-123' });
// Get by type
const preferences = await memory.recall({
userId: 'user-123',
type: 'preference',
});
// Get specific key
const risk = await memory.recall({
userId: 'user-123',
type: 'preference',
key: 'risk_tolerance',
});
```
### Semantic Search
```typescript
// Search by meaning (not just keywords)
const results = await memory.semanticSearch({
userId: 'user-123',
query: 'what is my risk appetite?',
limit: 5,
threshold: 0.7, // Similarity threshold
});
for (const result of results) {
console.log(`${result.type}: ${result.content}`);
console.log(` Similarity: ${result.score}`);
}
```
### Forget (Delete)
```typescript
// Delete specific memory
await memory.forget({
userId: 'user-123',
type: 'preference',
key: 'risk_tolerance',
});
// Delete all of a type
await memory.forgetByType({
userId: 'user-123',
type: 'note',
});
// Delete all memories
await memory.forgetAll({ userId: 'user-123' });
```
### Daily Journal
```typescript
// Log daily activity
await memory.logDaily({
userId: 'user-123',
date: new Date(),
trades: 5,
pnl: 123.45,
notes: 'Good day, caught BTC rally',
});
// Get journal entries
const journal = await memory.getDailyLogs({
userId: 'user-123',
from: '2024-01-01',
to: '2024-01-31',
});
```
---
## Memory Types
| Type | Purpose | Example |
|------|---------|---------|
| **preference** | User settings | `risk=conservative` |
| **fact** | Stored knowledge | "ETH gas is cheaper on weekends" |
| **note** | Reminders/todos | "Check election markets" |
| **rule** | Trading rules | "Max 5% per position" |
| **context** | Conversation context | Auto-saved by system |
---
## Storage Backends
| Backend | Description | Best For |
|---------|-------------|----------|
| **LanceDB** | Vector DB with hybrid search | Production, semantic search |
| **SQLite** | Local file-based | Development, single user |
| **PostgreSQL** | Distributed with pgvector | Multi-user, production |
---
## Best Practices
1. **Be specific with keys** — `max_position_size` not just `size`
2. **Use types correctly** — Preferences for settings, rules for constraints
3. **Semantic search** — Ask questions naturally, embeddings will match
4. **Regular cleanup** — Delete outdated notes and facts
5. **Backup memories** — Export before major changes
Related in General
modeling-omnistudio-epc-catalog
IncludedSalesforce Industries CME EPC product-modeling skill for Product2-based catalog creation. Use when creating EPC products, configuring product attributes, building offer bundles with Product Child Items, or reviewing EPC DataPack JSON metadata for product catalog changes. TRIGGER when: user creates or updates Product2 EPC records, AttributeAssignment payloads, AttributeMetadata/AttributeDefaultValues, Offer bundles, or ProductChildItem relationships. DO NOT TRIGGER when: designing OmniScripts/FlexCards/Integration Procedures (use building-omnistudio-omniscript, building-omnistudio-flexcard, or building-omnistudio-integration-procedure), implementing Apex business logic (use generating-apex), or troubleshooting deployment pipelines (use deploying-metadata).
relationship-science-coach
IncludedUse this skill for direct, practical adult relationship coaching: couples conflict, repair, trust, marriage, dating, flirting, attachment patterns, emotional connection, sex, desire differences, eroticism, kink negotiation, affection, love languages, breakups, and long-term passion. Draw on Gottman, EFT and Hold Me Tight, attachment science, modern sex research, Perel, Nagoski, Kerner, Schnarch, Love and Stosny, and flexible love-language tools. Be concrete and low-hedge. Redirect only for imminent danger, abuse, coercive control, minors, non-consent, self-harm, stalking, or medical/legal/psychiatric decisions.
building-sf-integrations
IncludedSalesforce integration architecture and runtime plumbing with 120-point scoring. Use this skill to set up Named Credentials, External Credentials, External Services, REST/SOAP callout patterns, Platform Events, and Change Data Capture. TRIGGER when: user sets up Named Credentials, External Services, REST/SOAP callouts, Platform Events, CDC, or touches .namedCredential-meta.xml files. DO NOT TRIGGER when: Connected App/OAuth config (use configuring-connected-apps), Apex-only logic (use generating-apex), or data import/export (use handling-sf-data).
venue-templates
IncludedAccess comprehensive LaTeX templates, formatting requirements, and submission guidelines for major scientific publication venues (Nature, Science, PLOS, IEEE, ACM), academic conferences (NeurIPS, ICML, CVPR, CHI), research posters, and grant proposals (NSF, NIH, DOE, DARPA). This skill should be used when preparing manuscripts for journal submission, conference papers, research posters, or grant proposals and need venue-specific formatting requirements and templates.
let-fate-decide
IncludedDraws the 12 Houses of the Zodiac Tarot spread to inject entropy into planning when prompts are vague, ambiguous, or casually delegated. Interprets the spread to guide next steps. Use when the user says 'let fate decide', 'YOLO', 'whatever', 'idk', or other nonchalant phrases, makes Yu-Gi-Oh references, or when you are about to arbitrarily pick between multiple reasonable approaches. Prefer over ask-questions-if-underspecified when the user's tone is casual or playful rather than precision-seeking.
net-ops
IncludedCross-platform network troubleshooting (Windows, macOS, Linux) via local or remote shell. Use for: DNS broken, can't resolve hostnames, nslookup/dig works but apps fail, NRPT, WFP, scutil, /etc/resolver, systemd-resolved, /etc/resolv.conf, NetworkManager, VPN DNS leak residue (ProtonVPN/Mullvad/WireGuard/AnyConnect), AV/firewall blocking DNS or DoH, Tailscale DNS interaction, intermittent connectivity, remote diagnostics over SSH.