TypeScript plugin for using Neocortex (TinyHuman) memory inside Mastra workflows/agents.
This package is a small adapter that:
- Calls the TinyHuman memory API directly (same contract as
sdk-typescript) - Exposes tools for saving, recalling, deleting, plus newer endpoints like documents, mirrored query/chat, interactions, sync, recall/thoughts, ingestion jobs, and graph snapshots
From the repo root (or within packages/plugin-mastra):
npm installOr, if published:
npm install @neocortex/plugin-mastraimport { MastraNeocortexMemory, createNeocortexMastraTools } from "@neocortex/plugin-mastra";
const memory = new MastraNeocortexMemory({
token: process.env.TINYHUMANS_API_KEY!,
baseUrl: process.env.TINYHUMANS_BASE_URL, // optional
defaultNamespace: "my-app", // optional
});
// Register these tools in Mastra (or any tool-capable agent framework)
const tools = memory.getTools();Mastra-native tools (recommended):
import { Agent } from "@mastra/core/agent";
import { createNeocortexMastraTools } from "@neocortex/plugin-mastra";
const { neocortexSaveMemory, neocortexRecallMemory, neocortexDeleteMemory } = createNeocortexMastraTools({
token: process.env.TINYHUMANS_API_KEY!,
baseUrl: process.env.TINYHUMANS_BASE_URL,
defaultNamespace: "my-app",
});
const agent = new Agent({
id: "my-agent",
name: "My Agent",
model: "openai/gpt-5.1",
instructions: "Use neocortex tools to save and recall user preferences.",
tools: {
[neocortexSaveMemory.id]: neocortexSaveMemory,
[neocortexRecallMemory.id]: neocortexRecallMemory,
},
});createNeocortexMastraTools() returns both the original tools (neocortexSaveMemory, neocortexRecallMemory, neocortexDeleteMemory) and additional tools that map to the newer sdk-typescript endpoints, including:
neocortexInsertDocument,neocortexInsertDocumentsBatch,neocortexListDocuments,neocortexGetDocument,neocortexDeleteDocumentneocortexQueryMemoryContext,neocortexChatMemoryContext,neocortexRecordInteractions,neocortexRecallThoughtsneocortexSyncMemory,neocortexChatMemory,neocortexInteractMemory,neocortexRecallMemoryMaster,neocortexRecallMemoriesneocortexGetIngestionJob,neocortexGetGraphSnapshot
TINYHUMANS_API_KEY(required): Bearer token for the TinyHuman backendTINYHUMANS_BASE_URL(optional): Defaults tohttps://api.tinyhumans.ai