0
Fork 0
mirror of https://github.com/mastra-ai/mastra.git synced 2026-11-17 08:44:46 +00:00
mastra/packages/memory
History 2026-11-12 21:12:29 +00:00
..
__recordings__ Knowledge alpha: standalone Knowledge for agents, Subconscious removed (#28353) 2026-10-30 22:24:20 -07:00
integration-tests chore(deps): Vanta 2026-11-12 — raise undici to 8.12.4 / 7.30.2 (#30205) 2026-11-12 07:20:12 -08:00
scripts ci: delete the Changed Test Gate (#29099) 2026-11-05 19:42:33 +00:00
src fix(core): name the agent in the memory missing-storage error (#30164) 2026-11-11 22:50:45 -08:00
type-tests chore(lint): require import type for type-only imports (#27642) 2026-10-19 17:35:21 +04:00
.gitignore redis memory 2024-11-28 16:16:42 -08:00
.npmignore Memory tests + Storage test fixes (#1710) 2025-02-04 18:20:19 -08:00
AGENTS.md chore: enforce AGENTS.md token limits (#15464) 2026-04-18 19:12:37 -07:00
CHANGELOG.md chore: version - exit prerelease mode 2026-11-12 21:12:29 +00:00
lint-staged.config.js refactor(lint): replace ESLint with type-aware oxlint (#27476) 2026-10-18 10:38:35 -07:00
oxlint.config.ts refactor(lint): replace ESLint with type-aware oxlint (#27476) 2026-10-18 10:38:35 -07:00
package.json chore: version - exit prerelease mode 2026-11-12 21:12:29 +00:00
README.md chore(*): Update/unify/add READMEs (#22858) 2026-09-02 14:36:59 +02:00
tsconfig.build.json fix(memory): make observational memory reflection, buffering, and activation lossless across processes (#25906) 2026-10-11 16:17:22 -07:00
tsconfig.json fix(core): restore live signal delivery and AGENTS.md loading (#23554) 2026-09-10 17:14:50 -07:00
tsconfig.scripts.json feat(memory): add an observational memory replay simulator (#22058) 2026-08-31 14:32:38 -04:00
tsdown.config.ts feat: support v4 embedding models in core, memory, and RAG (#27710) 2026-10-19 15:50:54 -07:00
turbo.json chore: migrate package builds to tsdown (#19829) 2026-07-28 12:32:21 +02:00
vitest.config.ts fix(core): restore live signal delivery and AGENTS.md loading (#23554) 2026-09-10 17:14:50 -07:00

@mastra/memory

@mastra/memory gives Mastra agents persistent conversation history, semantic recall, working memory, and observational memory. Attach a Memory instance to an agent when it should retain context across messages and threads.

Installation

npm install @mastra/memory

Usage

Attach memory to an agent and pass a stable thread and resource ID when generating a response.

import { Agent } from '@mastra/core/agent';
import { Memory } from '@mastra/memory';

const agent = new Agent({
  id: 'support-agent',
  name: 'Support agent',
  instructions: 'Answer support questions using the conversation history.',
  model: 'openai/gpt-5.6-sol',
  memory: new Memory(),
});

const response = await agent.generate('What did we discuss last time?', {
  memory: { thread: 'conversation-123', resource: 'user-456' },
});

Documentation

Changelog

See the package changelog for version history and release notes.

Support

We have an open community Discord. Come and say hello and let us know if you have any questions or need any help getting things running.