Three surfaces: in-process engine (@aimemory/core), hosted SDK (@aimemory/sdk), and REST at https://api.aimemory.lat/api/v1.
Local engine — package @aimemory/core / ai-memory
| Method | Stability | Description |
|---|---|---|
remember(content, metadata?) | stable | Add a memory with content and optional metadata |
rememberFact(content, metadata?) | stable | Add a factual memory |
rememberPreference(content, metadata?) | stable | Add a user preference memory |
rememberInstruction(content, metadata?) | stable | Add an instruction-style memory |
rememberConversation(content, role, metadata?) | stable | Add a conversation message (user/assistant) |
recall(query, options?) | stable | Search memories by semantic similarity; options may include collection, tags, type |
getContext(query) | stable | Build optimized context for an LLM; pass collection to scope results |
getMemory(id) | stable | Retrieve a specific memory by ID |
updateMemory(id, updates) | stable | Update content or metadata of an existing memory |
forget(id) | stable | Delete a memory permanently |
getRecentMemories(limit?) | stable | List most recent memories |
getStats() | stable | Memory statistics and usage metrics |
exportData() | stable | Export all memories as JSON |
importData(memories) | beta | Import memories from JSON |
clear() | stable | Remove all memories from the store |
cleanup() | stable | Run automatic cleanup based on config |
Typed client for the hosted API — package @aimemory/sdk
| Method | Stability | Description |
|---|---|---|
capture(content, metadata?) | stable | Create a memory in the hosted workspace |
trackEvent(type, payload?) | stable | Record an analytics or usage event |
search(query, options?) | stable | Semantic search; options: collection, tags, type, limit, threshold |
listMemories(options?) | stable | List memories with filters (collection, tags, type) |
getMemory(id) | stable | Fetch a single memory by ID |
updateMemory(id, updates) | stable | Update memory content or metadata |
deleteMemory(id) | stable | Delete a memory permanently |
retrieveContext(query, options?) | stable | Build LLM-ready context; options: collection, tags, type, maxMemories |
injectContext(messages, query) | stable | Inject retrieved context into a message list |
buildPrompt(query, systemPrompt?) | stable | Build a prompt with embedded memory context |
createWorkspace(options) | stable | Create a workspace |
listWorkspaces() | stable | List workspaces for the API key |
getWorkspace(id) | stable | Get workspace details |
updateWorkspace(id, updates) | stable | Update workspace settings |
deleteWorkspace(id) | stable | Delete a workspace |
exportData(workspaceId) | stable | Export workspace memories |
importData(workspaceId, memories) | beta | Import memories into a workspace |
linkMemories(sourceId, targetId) | planned | Link two memories (SDK; API route planned) |
getMemoryRelations(memoryId) | planned | List related memory IDs (SDK; API route planned) |
import { AIMemoryClient } from '@aimemory/sdk';
const memory = new AIMemoryClient({
apiKey: process.env.AIMEMORY_API_KEY!,
workspaceId: process.env.AIMEMORY_WORKSPACE_ID,
});
const results = await memory.search('project stack', {
collection: 'project:my-app',
});
const context = await memory.retrieveContext('What do we use for auth?', {
collection: 'project:my-app',
});Options for createAIMemory()
| Option | Type | Default | Description |
|---|---|---|---|
maxMemories | number | 10000 | Maximum memories to store |
embeddingDimension | number | 1536 | Embedding vector dimension |
maxTokens | number | 4000 | Max tokens for context |
relevanceThreshold | number | 0.7 | Min similarity score (0–1) |
defaultImportance | number | 0.5 | Default importance (0–1) |
autoCleanup | object | — | Automatic cleanup configuration |
storage | object | memory | Storage backend config |
Group memories by topic so search stays in the right bucket. Pass collection on create, search, recall, and context.
| Slug pattern | Example | Use for |
|---|---|---|
project:<name> | project:henry-memory | All facts about one project |
personal:preferences | personal:preferences | Tastes, habits, personal defaults (auto for type=preference) |
work:<name> | work:client-acme | Work context not tied to a side project |
inbox | inbox | Unsorted conversation snippets |
| Method | Stability | Description |
|---|---|---|
remember(content, type?, collection?, tags?, append_to?) | stable | Save scoped memory; use collection=project:<slug> for projects |
recall(query, collection?, tags?, type?) | stable | Search only within the given collection/scope |
get_context(topic, collection?, tags?, type?) | stable | Build context block scoped to a collection |
list_memories(collection?, tags?, type?) | stable | List recent memories in a scope |
list_collections() | stable | List collection slugs for this user |
forget(memory_id) | stable | Delete a memory by UUID |
memory_stats() | stable | Counts by type and collection |
Base URL: https://api.aimemory.lat/api/v1 — authenticate with Bearer API key
/healthstableService health check (unauthenticated)/api/v1stableAPI version and metadata/api/v1/eventsstableIngest a single event/api/v1/events/batchstableIngest events in batch/api/v1/memoriesstableList memories (?collection, ?tags, ?type)/api/v1/memoriesstableCreate memory (collection, tags, append_to)/api/v1/memories/searchstableSemantic search (body: query, collection?, tags?, type?)/api/v1/collectionsstableList memory collections/api/v1/collectionsstableCreate a named collection (slug + name)/api/v1/collections/:slug/memoriesstableList memories in a collection/api/v1/collections/:slugstableUpdate collection metadata/api/v1/collections/:slugstableDelete collection registry (memories keep slug)/api/v1/memories/:idstableGet memory by ID/api/v1/memories/:idstableUpdate a memory/api/v1/memories/:idstableDelete a memory/api/v1/context/retrievestableRetrieve LLM context (body: topic, collection?, tags?, type?)/api/v1/chatbetaMemory-aware chat completion/api/v1/workspacesstableList workspaces/api/v1/workspacesstableCreate workspace/api/v1/workspaces/:idstableGet workspace/api/v1/workspaces/:idstableUpdate workspace/api/v1/workspaces/:idstableDelete workspace/api/v1/organizationsstableList organizations/api/v1/organizationsstableCreate organization/api/v1/organizations/:idstableGet organization/api/v1/organizations/:idstableUpdate organization/api/v1/projectsstableList projects/api/v1/projectsstableCreate project/api/v1/projects/:idstableGet project/api/v1/projects/:idstableUpdate project/api/v1/projects/:idstableDelete project/api/v1/members/organizations/:id/membersstableList organization members/api/v1/members/organizations/:id/membersstableAdd organization member/api/v1/members/organizations/:id/members/:userIdstableRemove organization member/api/v1/members/workspaces/:id/membersstableList workspace members/api/v1/members/workspaces/:id/membersstableAdd workspace member/api/v1/members/workspaces/:id/members/:userIdstableRemove workspace member/api/v1/webhooksbetaList API keys / webhook configs/api/v1/webhooksbetaCreate API key/api/v1/webhooks/:idbetaDelete API key/api/v1/webhooks/ingestbetaIngest event via webhook/api/v1/analytics/usagebetaUsage analytics/api/v1/analytics/memoriesbetaMemory analytics/api/v1/analytics/sourcesbetaSource analytics/api/v1/analytics/summarybetaAnalytics summaryAligned with the public pricing page. Hosted workspaces enforce quotas on the API.
Free, Pro ($12/mo), Team ($49/mo), and Enterprise ($199/mo) tiers differ in API calls, memory retention, workspaces, and team features. See pricing for the full comparison table.