Home/Tools/@tpmjs/official-memory

createMemoryTool

@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.

Official
agent
v0.1.3
MIT

Interactive Playground

Test @tpmjs/official-memory (createMemoryTool) with AI-powered execution

0/2000 characters

Installation & Usage

Install this tool and use it with the AI SDK

1. Install the package

npm install @tpmjs/official-memory
pnpm add @tpmjs/official-memory
yarn add @tpmjs/official-memory
bun add @tpmjs/official-memory
deno add npm:@tpmjs/official-memory

2. Import the tool

import { createMemoryTool } from '@tpmjs/official-memory';

3. Use with AI SDK

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);

Signature

(content: Record<string, unknown>, tags?: string[], summary?: string, expiresAt?: string, namespace?: string) => Promise<unknown>

Tags

agent
ai
context
create
embeddings
later
memory
official
persistent
retrieved
saving
search
semantic
semantic-search
store
tpmjs
via

Parameters

Available configuration options

Auto-extracted
content
Required
Type: object

The 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.

summary
Optional
Type: string

Human-readable summary of the memory (max 500 chars). Auto-generated if not provided.

namespace
Optional
Type: string

Optional grouping namespace (e.g., 'project-x', 'personal')

tags
Optional
Type: array

Tags for categorization

expiresAt
Optional
Type: string

ISO 8601 datetime for automatic expiration (TTL)

Schema extracted: 3/1/2026, 4:25:54 AM

README

@tpmjs/official-memory

Persistent, semantically-searchable memory tools for AI agents. Create and search memories across sessions using embedding-based semantic search.

Installation

npm install @tpmjs/official-memory

Setup

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).

Usage

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',
});

Tools

createMemoryTool

Store a persistent memory that can be retrieved later via semantic search.

Parameters

NameTypeRequiredDescription
contentobjectYesArbitrary JSON payload to store
summarystringNoHuman-readable summary (max 500 chars)
namespacestringNoGrouping namespace (e.g., 'project-x', 'personal')
tagsstring[]NoTags for categorization
expiresAtstringNoISO 8601 datetime for automatic expiration

Output

FieldTypeDescription
idstringUnique memory ID
contentobjectThe stored JSON payload
summarystringMemory summary
namespacestring/nullGrouping namespace
tagsstring[]Categorization tags
sourcestringCreation source ('createMemoryTool')
sourceAgentstring/nullAgent name
contentSizeBytesnumberSize of content in bytes
expiresAtstring/nullExpiration datetime
createdAtstringCreation timestamp
updatedAtstringLast update timestamp

searchMemoryTool

Search memories using natural language semantic search.

Parameters

NameTypeRequiredDescription
querystringYesNatural language search query
namespacestringNoFilter to a specific namespace
tagsstring[]NoFilter to memories with any of these tags
limitnumberNoMax results (default: 10, max: 50)
thresholdnumberNoMin similarity threshold 0-1 (default: 0.7)

Output

FieldTypeDescription
idstringMemory ID
contentobjectThe stored JSON payload
summarystringMemory summary
namespacestring/nullGrouping namespace
tagsstring[]Categorization tags
similaritynumberCosine similarity score 0-1
createdAtstringCreation timestamp

License

MIT

Statistics

Downloads/month

389

GitHub Stars

15

Executions

5

Quality Score

91%

Bundle Size

NPM Keywords

tpmjs
memory
ai
semantic-search
embeddings

Maintainers

thomasdavis(thomasalwyndavis@gmail.com)

Frameworks

vercel-ai