@tpmjs/official-memory
Store a persistent memory that can be retrieved later via semantic search. Use for saving context, decisions, preferences, or any information that should persist across sessions.
Test @tpmjs/official-memory (createMemoryTool) 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 { createMemoryTool } from '@tpmjs/official-memory';import { generateText } from 'ai';
import { openai } from '@ai-sdk/openai';
import { createMemoryTool } from '@tpmjs/official-memory';
const result = await generateText({
model: openai('gpt-4o'),
tools: { createMemoryTool },
prompt: 'Your prompt here...',
});
console.log(result.text);(content: Record<string, unknown>, tags?: string[], summary?: string, expiresAt?: string, namespace?: string) => Promise<unknown>Available configuration options
contentobjectThe actual data to persist as a JSON object. Include all relevant details, facts, and context. Example: {"decision": "Use PostgreSQL", "reason": "Team expertise", "date": "2024-01-15"}. Do NOT leave this empty — put the real information here, not just in the summary.
summarystringHuman-readable summary of the memory (max 500 chars). Auto-generated if not provided.
namespacestringOptional grouping namespace (e.g., 'project-x', 'personal')
tagsarrayTags for categorization
expiresAtstringISO 8601 datetime for automatic expiration (TTL)
Schema extracted: 3/1/2026, 4:25:54 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
Executions
5
Quality Score