@tpmjs/official-memory
Search memories using natural language semantic search. Returns the most relevant memories ranked by similarity.
Test @tpmjs/official-memory (searchMemoryTool) with AI-powered execution
0/2000 characters
Install this tool and use it with the AI SDK
npm install @tpmjs/official-memorypnpm add @tpmjs/official-memoryyarn add @tpmjs/official-memorybun add @tpmjs/official-memorydeno add npm:@tpmjs/official-memoryimport { searchMemoryTool } from '@tpmjs/official-memory';import { generateText } from 'ai';
import { openai } from '@ai-sdk/openai';
import { searchMemoryTool } from '@tpmjs/official-memory';
const result = await generateText({
model: openai('gpt-4o'),
tools: { searchMemoryTool },
prompt: 'Your prompt here...',
});
console.log(result.text);(query: string, tags?: string[], limit?: number, namespace?: string, threshold?: number) => Promise<unknown>Available configuration options
querystringNatural language search query. Use descriptive phrases for best results (e.g., "database decision for project X" not just "database").
namespacestringFilter results to a specific namespace
tagsarrayFilter results to memories with any of these tags
limitnumberMaximum number of results (default: 10, max: 50)
thresholdnumberMinimum similarity threshold 0-1 (default: 0.4). Lower values return more results.
Schema extracted: 3/1/2026, 4:25:57 AM
Persistent, semantically-searchable memory tools for AI agents. Create and search memories across sessions using embedding-based semantic search.
npm install @tpmjs/official-memory
Set the TPMJS_API_KEY environment variable with a key that has memory:read and memory:write scopes.
Get a key at tpmjs.com/dashboard/settings/tpmjs-api-keys.
Optionally set TPMJS_BASE_URL (defaults to https://tpmjs.com).
import { createMemoryTool, searchMemoryTool } from '@tpmjs/official-memory'; // Store a memory const memory = await createMemoryTool.execute({ content: { decision: 'Use PostgreSQL', reason: 'Team expertise' }, summary: 'Database decision: PostgreSQL chosen for team expertise', namespace: 'project-x', tags: ['architecture', 'database'], }); // Search memories const results = await searchMemoryTool.execute({ query: 'What database did we choose?', namespace: 'project-x', });
Store a persistent memory that can be retrieved later via semantic search.
| Name | Type | Required | Description |
|---|---|---|---|
| content | object | Yes | Arbitrary JSON payload to store |
| summary | string | No | Human-readable summary (max 500 chars) |
| namespace | string | No | Grouping namespace (e.g., 'project-x', 'personal') |
| tags | string[] | No | Tags for categorization |
| expiresAt | string | No | ISO 8601 datetime for automatic expiration |
| Field | Type | Description |
|---|---|---|
| id | string | Unique memory ID |
| content | object | The stored JSON payload |
| summary | string | Memory summary |
| namespace | string/null | Grouping namespace |
| tags | string[] | Categorization tags |
| source | string | Creation source ('createMemoryTool') |
| sourceAgent | string/null | Agent name |
| contentSizeBytes | number | Size of content in bytes |
| expiresAt | string/null | Expiration datetime |
| createdAt | string | Creation timestamp |
| updatedAt | string | Last update timestamp |
Search memories using natural language semantic search.
| Name | Type | Required | Description |
|---|---|---|---|
| query | string | Yes | Natural language search query |
| namespace | string | No | Filter to a specific namespace |
| tags | string[] | No | Filter to memories with any of these tags |
| limit | number | No | Max results (default: 10, max: 50) |
| threshold | number | No | Min similarity threshold 0-1 (default: 0.7) |
| Field | Type | Description |
|---|---|---|
| id | string | Memory ID |
| content | object | The stored JSON payload |
| summary | string | Memory summary |
| namespace | string/null | Grouping namespace |
| tags | string[] | Categorization tags |
| similarity | number | Cosine similarity score 0-1 |
| createdAt | string | Creation timestamp |
MIT
Downloads/month
389
GitHub Stars
15
Quality Score