0
Fork 0
mirror of https://github.com/mastra-ai/mastra.git synced 2026-11-17 08:44:46 +00:00
mastra/packages/memory
dane-ai-mastra[bot] a5859ee2b9
chore: version packages (alpha) (#30430)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
History 2026-11-16 14:09:31 +01:00
..
__recordings__ Knowledge alpha: standalone Knowledge for agents, Subconscious removed (#28353) 2026-10-30 22:24:20 -07:00
integration-tests chore(deps): update better-auth monorepo to v1.7.22 (#30464) 2026-11-15 17:48:36 -08:00
scripts ci: delete the Changed Test Gate (#29099) 2026-11-05 19:42:33 +00:00
src fix(libsql): stop background task writes stalling shutdown, and fix backend timing flakes (#30504) 2026-11-16 13:18:29 +01: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 packages (alpha) (#30430) 2026-11-16 14:09:31 +01: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 packages (alpha) (#30430) 2026-11-16 14:09:31 +01: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.