@mastra/memory 1.41.2-alpha.2 → 1.41.3-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/dist/docs/SKILL.md +1 -1
  2. package/dist/docs/assets/SOURCE_MAP.json +94 -94
  3. package/dist/docs/references/docs-agents-human-in-the-loop.md +2 -2
  4. package/dist/docs/references/docs-agents-networks.md +1 -1
  5. package/dist/docs/references/docs-guides-context-engineering.md +1 -1
  6. package/dist/docs/references/docs-harness-background-tasks.md +60 -1
  7. package/dist/docs/references/docs-knowledge-overview.md +1 -1
  8. package/dist/docs/references/docs-memory-memory-processors.md +2 -2
  9. package/dist/docs/references/docs-memory-message-history.md +1 -1
  10. package/dist/docs/references/docs-memory-multi-user-threads.md +1 -1
  11. package/dist/docs/references/docs-memory-observational-memory.md +5 -5
  12. package/dist/docs/references/docs-memory-semantic-recall.md +10 -4
  13. package/dist/docs/references/docs-memory-working-memory.md +16 -16
  14. package/dist/docs/references/docs-signals-overview.md +1 -1
  15. package/dist/docs/references/integrations-channels-ring.md +6 -6
  16. package/dist/docs/references/integrations-databases-aurora-dsql.md +13 -13
  17. package/dist/docs/references/integrations-databases-dynamodb.md +8 -8
  18. package/dist/docs/references/integrations-databases-elasticsearch.md +6 -6
  19. package/dist/docs/references/integrations-databases-mongodb.md +2 -2
  20. package/dist/docs/references/integrations-databases-oracledb.md +2 -2
  21. package/dist/docs/references/integrations-databases-postgresql.md +14 -14
  22. package/dist/docs/references/integrations-databases-redis.md +7 -7
  23. package/dist/docs/references/integrations-databases-upstash.md +5 -5
  24. package/dist/docs/references/integrations-databases-valkey.md +1 -1
  25. package/dist/docs/references/reference-memory-listThreads.md +1 -1
  26. package/dist/docs/references/reference-memory-observational-memory.md +2 -2
  27. package/dist/docs/references/reference-processors-token-limiter-processor.md +1 -1
  28. package/dist/index.cjs +20 -1
  29. package/dist/index.d.ts +3 -1
  30. package/dist/index.d.ts.map +1 -1
  31. package/dist/index.js +1 -1
  32. package/dist/processors/index.cjs +1 -1
  33. package/dist/processors/index.js +1 -1
  34. package/dist/processors/observational-memory/observer-agent.d.ts +1 -1
  35. package/dist/processors/observational-memory/observer-agent.d.ts.map +1 -1
  36. package/dist/{src-Xhctgeae.js → src-CTZXQELy.js} +765 -273
  37. package/dist/src-CTZXQELy.js.map +1 -0
  38. package/dist/{src-BLniLryu.cjs → src-ibq9d-g9.cjs} +763 -270
  39. package/dist/src-ibq9d-g9.cjs.map +1 -0
  40. package/package.json +9 -9
  41. package/dist/src-BLniLryu.cjs.map +0 -1
  42. package/dist/src-Xhctgeae.js.map +0 -1
  43. /package/dist/_types/{@internal_ai-sdk-v4@0.0.96 → @internal_ai-sdk-v4@0.0.98}/dist/index.d.ts +0 -0
  44. /package/dist/_types/{@internal_ai-sdk-v4@0.0.96 → @internal_ai-sdk-v4@0.0.98}/package.json +0 -0
@@ -19,7 +19,7 @@ Working memory can persist at two different scopes:
19
19
  - **Resource-scoped** (default): Memory persists across all conversation threads for the same user
20
20
  - **Thread-scoped**: Memory is isolated per conversation thread
21
21
 
22
- **Requirement:** Switching between scopes means the agent won't see memory from the other scope - thread-scoped memory is completely separate from resource-scoped memory.
22
+ **Requirement:** Switching between scopes means the agent won't see memory from the other scope - thread-scoped memory is kept separate from resource-scoped memory.
23
23
 
24
24
  ## Quickstart
25
25
 
@@ -53,7 +53,7 @@ Working memory is a block of Markdown text that the agent can update over time t
53
53
 
54
54
  Working memory can operate in two different scopes, allowing you to choose how memory persists across conversations:
55
55
 
56
- ### Resource-Scoped Memory (Default)
56
+ ### Resource-scoped Memory (default)
57
57
 
58
58
  By default, working memory persists across all conversation threads for the same user (resourceId), enabling persistent user memory:
59
59
 
@@ -82,9 +82,9 @@ const memory = new Memory({
82
82
  - Customer service bots that maintain customer context
83
83
  - Educational applications that track student progress
84
84
 
85
- ### Usage with Agents
85
+ ### Usage with agents
86
86
 
87
- When using resource-scoped memory, make sure to pass the `resource` parameter in the memory options:
87
+ When using resource-scoped memory, ensure you pass the `resource` parameter in the memory options:
88
88
 
89
89
  ```typescript
90
90
  // Resource-scoped memory requires resource
@@ -96,7 +96,7 @@ const response = await agent.generate('Hello!', {
96
96
  })
97
97
  ```
98
98
 
99
- ### Thread-Scoped Memory
99
+ ### Thread-scoped Memory
100
100
 
101
101
  Thread-scoped memory isolates working memory to individual conversation threads. Each thread maintains its own isolated memory:
102
102
 
@@ -127,7 +127,7 @@ const memory = new Memory({
127
127
 
128
128
  Resource-scoped working memory requires specific storage adapters that support the `mastra_resources` table:
129
129
 
130
- ### Supported Storage Adapters
130
+ ### Supported storage adapters
131
131
 
132
132
  - **libSQL** (`@mastra/libsql`)
133
133
  - **PostgreSQL** (`@mastra/pg`)
@@ -177,15 +177,15 @@ const memory = new Memory({
177
177
 
178
178
  ## Designing effective templates
179
179
 
180
- A well-structured template keeps the information straightforward for the agent to parse and update. Treat the template as a short form that you want the assistant to keep up to date.
180
+ A well-structured template keeps the information clear for the agent to parse and update. Treat the template as a short form that you want the assistant to keep up to date.
181
181
 
182
- - **Short, focused labels.** Avoid paragraphs or very long headings. Keep labels brief (for example `## Personal Info` or `- Name:`) so updates are readable and less likely to be truncated.
182
+ - **Short, focused labels.** Avoid paragraphs or long headings. Keep labels brief (for example `## Personal Info` or `- Name:`) so updates are readable and less likely to be truncated.
183
183
  - **Use consistent casing.** Inconsistent capitalization (`Timezone:` vs `timezone:`) can cause messy updates. Stick to Title Case or lower case for headings and bullet labels.
184
184
  - **Keep placeholder text minimal.** Use hints such as `[e.g., Formal]` or `[Date]` to help the LLM fill in the correct spots.
185
- - **Abbreviate very long values.** If you only need a short form, include guidance like `- Name: [First name or nickname]` or `- Address (short):` rather than the full legal text.
185
+ - **Abbreviate long values.** If you only need a short form, include guidance like `- Name: [First name or nickname]` or `- Address (short):` rather than the full legal text.
186
186
  - **Mention update rules in `instructions`.** You can instruct how and when to fill or clear parts of the template directly in the agent's `instructions` field.
187
187
 
188
- ### Alternative Template Styles
188
+ ### Alternative template styles
189
189
 
190
190
  Use a shorter single block if you only need a few items:
191
191
 
@@ -219,7 +219,7 @@ Working memory can also be defined using a structured schema instead of a Markdo
219
219
 
220
220
  You can specify either `template` or `schema`, but not both. If you omit both, Mastra uses the default working memory template.
221
221
 
222
- ### Example: Schema-Based Working Memory
222
+ ### Example: Schema-based working Memory
223
223
 
224
224
  ```typescript
225
225
  import { z } from 'zod'
@@ -264,7 +264,7 @@ When a schema is provided, the agent receives the working memory as a JSON objec
264
264
  }
265
265
  ```
266
266
 
267
- ### Merge Semantics for Schema-Based Memory
267
+ ### Merge semantics for schema-based Memory
268
268
 
269
269
  Schema-based working memory uses **merge semantics**, meaning the agent only needs to include fields it wants to add or update. Existing fields are preserved automatically.
270
270
 
@@ -324,13 +324,13 @@ Below is a simplified view of how the `User Profile` template updates across a s
324
324
 
325
325
  The agent can now refer to `Sam` or `Berlin` in later responses without requesting the information again because it has been stored in working memory.
326
326
 
327
- If your agent isn't properly updating working memory when you expect it to, you can add system instructions on _how_ and _when_ to use this template in your agent's `instructions` setting.
327
+ If your agent isn't updating working memory when you expect it to, you can add system instructions on _how_ and _when_ to use this template in your agent's `instructions` setting.
328
328
 
329
329
  ## Setting initial working memory
330
330
 
331
331
  While agents typically update working memory through the `updateWorkingMemory` tool, you can also set initial working memory programmatically when creating or updating threads. This is useful for injecting user data (like their name, preferences, or other info) that you want available to the agent without passing it in every request.
332
332
 
333
- ### Setting Working Memory via Thread Metadata
333
+ ### Setting working Memory via thread metadata
334
334
 
335
335
  When creating a thread, you can provide initial working memory through the metadata's `workingMemory` key:
336
336
 
@@ -361,7 +361,7 @@ await agent.generate("What's my blood type?", {
361
361
  // Response: "Your blood type is O+."
362
362
  ```
363
363
 
364
- ### Updating Working Memory Programmatically
364
+ ### Updating working Memory programmatically
365
365
 
366
366
  You can also update an existing thread's working memory:
367
367
 
@@ -383,7 +383,7 @@ await memory.updateThread({
383
383
  })
384
384
  ```
385
385
 
386
- ### Direct Memory Update
386
+ ### Direct Memory update
387
387
 
388
388
  Alternatively, use the `updateWorkingMemory` method directly:
389
389
 
@@ -18,7 +18,7 @@ For a one-off request, use [`agent.stream()`](https://mastra.ai/reference/stream
18
18
 
19
19
  Create an agent, subscribe to a thread, then send input to that thread. Subscribing first means the subscription is already open when the input starts a run.
20
20
 
21
- ### Use an Agent
21
+ ### Use an agent
22
22
 
23
23
  This example stores thread history with [Memory](https://mastra.ai/docs/memory/overview), using a local libSQL database, so the same conversation is available across runs and process restarts. Memory accepts any supported storage adapter, and the thread is created on the first run.
24
24
 
@@ -6,7 +6,7 @@
6
6
 
7
7
  Ring signals let a Mastra agent receive doorbell presses, motion, and other events from Ring doorbells and cameras. Each event arrives in an agent thread as a [notification signal](https://mastra.ai/docs/signals/notifications), and the agent can fetch a snapshot or video clip to see who is at the door.
8
8
 
9
- Events and media come from the [Ring Partner API](https://developer.amazon.com/docs/ring/api-documentation.html). The API doesn't expose lights, sirens, locks, or two-way talk.
9
+ Events and media come from the [Ring Partner API](https://developer.amazon.com/docs/ring/api-documentation.html), which doesn't expose lights, sirens, locks, or two-way talk.
10
10
 
11
11
  ## Installation
12
12
 
@@ -101,7 +101,7 @@ Linking connects a Ring account to your agent. Set it up in two places, in this
101
101
  1. The [Ring Developer Console](https://developer.amazon.com/ring/console/apps) on Amazon's developer site, where you configure your developer app.
102
102
  2. [ring.com](https://ring.com), where you link the developer app to the Ring account that owns the device.
103
103
 
104
- ### Ring Developer Console
104
+ ### Ring developer console
105
105
 
106
106
  The routes Ring needs are added automatically to your Mastra server under `/ring`:
107
107
 
@@ -178,7 +178,7 @@ To pick the thread per event, set `target` to a function. The function receives
178
178
 
179
179
  - `event.data.type`: The event type, from [Events and priorities](#events-and-priorities).
180
180
  - `event.data.attributes.source`: For device events, the ID of the device that sent the event. For app integration events, the account ID. For subscription events, `subscriptions`.
181
- - `event.data.attributes.timestamp`: For device events, when the event happened, in epoch milliseconds. Subscription events don't have it.
181
+ - `event.data.attributes.timestamp`: When the device event happened, in epoch milliseconds, and unset for subscription events.
182
182
  - `event.data.attributes.sub_type`: For motion events, what caused the motion: `human`, `vehicle`, `package_delivery`, `other_motion`, or `motion` when Smart Alerts are off. For subscription events, `paid` or `trial`.
183
183
  - `event.meta.account_id`: The ID of the Ring account the device belongs to.
184
184
 
@@ -200,7 +200,7 @@ Return `undefined` to drop the event. The function can be `async`. The [RingSign
200
200
  The agent gets two tools:
201
201
 
202
202
  - `ring_snapshot`: Fetches a still image for an event and passes it to the model, so the agent can describe what it sees. If Ring has no image right after the event, it uses the most recent image before it.
203
- - `ring_clip`: Fetches a video clip that starts at the event. Ring needs time to process a recording, so the tool retries until the clip is ready. By default, the model doesn't receive the video. See [Let the model see media](#let-the-model-see-media).
203
+ - `ring_clip`: Fetches a video clip that starts at the event. Because Ring needs time to process a recording, the tool retries until the clip is ready. By default, the model doesn't receive the video. See [Let the model see media](#let-the-model-see-media).
204
204
 
205
205
  ### Let the model see media
206
206
 
@@ -216,13 +216,13 @@ new RingSignals({
216
216
 
217
217
  When `visibleToModel` is `false`, the model gets only the tool's text result and link, and can't describe what the media shows.
218
218
 
219
- > **Note:** Check that your model supports video input before you turn on `visibleToModel` for clips. Gemini models accept video input. Anthropic and OpenAI models don't. Anthropic drops the video with a warning, and other model APIs may reject the request.
219
+ > **Note:** Check that your model supports video input before you turn on `visibleToModel` for clips. Gemini models accept video input, while Anthropic and OpenAI models don't. Anthropic drops the video with a warning, and other model APIs may reject the request.
220
220
  >
221
221
  > Video input counts toward the model's context window for every second of footage. A clip at the default 15 seconds uses a few thousand tokens. A clip at the maximum `durationMs` of 15 minutes can use hundreds of thousands, so keep `durationMs` short when the model watches clips. The video isn't saved in memory, so it only uses context on the step that fetched it.
222
222
 
223
223
  ### Media links
224
224
 
225
- Ring doesn't give out shareable links to its media. Downloading a snapshot or clip needs the Ring account's tokens, so a browser or chat app can't fetch it from Ring directly. When you set `baseUrl`, the tools return a signed link to your own server instead, under `<baseUrl>/ring/media/`. Opening the link makes your server fetch the media from Ring and pass it on. Nothing is stored; recent media is cached in memory for a few minutes.
225
+ Ring doesn't give out shareable links to its media. Downloading a snapshot or clip needs the Ring account's tokens, so a browser or chat app can't fetch it from Ring directly. When you set `baseUrl`, the tools return a signed link to your own server instead, under `<baseUrl>/ring/media/`. Opening the link makes your server fetch the media from Ring and pass it on. Nothing is stored. Recent media is cached in memory for a few minutes.
226
226
 
227
227
  Set `RING_BASE_URL` to your Mastra server's URL. Use `http://localhost:4111` or a tunnel URL in development, and your deployed URL in production.
228
228
 
@@ -67,7 +67,7 @@ await storage.init()
67
67
 
68
68
  **allowExitOnIdle** (`boolean`): Allow the process to exit when all connections are idle.
69
69
 
70
- ## Constructor Examples
70
+ ## Constructor examples
71
71
 
72
72
  You can instantiate `DSQLStore` in the following ways:
73
73
 
@@ -124,9 +124,9 @@ const store5 = new DSQLStore({
124
124
  })
125
125
  ```
126
126
 
127
- ## Additional Notes
127
+ ## Additional notes
128
128
 
129
- ### Schema Management
129
+ ### Schema management
130
130
 
131
131
  The storage implementation handles schema creation and updates automatically. It creates the following tables:
132
132
 
@@ -176,7 +176,7 @@ const thread = await memoryStore?.getThreadById({ threadId: '...' })
176
176
 
177
177
  > **Warning:** If `init()` isn't called, tables won't be created and storage operations will fail silently or throw errors.
178
178
 
179
- ### Direct Database and Pool Access
179
+ ### Direct database and pool access
180
180
 
181
181
  `DSQLStore` exposes both the underlying database client and the pg.Pool instance as public fields:
182
182
 
@@ -193,7 +193,7 @@ It supports direct queries and custom transaction management. When using these f
193
193
 
194
194
  This approach is intended for advanced scenarios where low-level access is required.
195
195
 
196
- ### Aurora DSQL Specifics
196
+ ### Aurora DSQL specifics
197
197
 
198
198
  #### IAM-only authentication
199
199
 
@@ -229,7 +229,7 @@ Aurora DSQL uses optimistic concurrency control (OCC) and may return retriable O
229
229
 
230
230
  Individual connections are limited to about 60 minutes. The default `maxLifetimeSeconds: 3300` ensures connections are recycled before hitting this limit.
231
231
 
232
- ## Usage Example
232
+ ## Usage example
233
233
 
234
234
  ### Adding memory to an agent
235
235
 
@@ -300,11 +300,11 @@ for await (const chunk of stream.textStream) {
300
300
  }
301
301
  ```
302
302
 
303
- ## Index Management
303
+ ## Index management
304
304
 
305
305
  Aurora DSQL storage provides index management capabilities to optimize query performance.
306
306
 
307
- ### Automatic Performance Indexes
307
+ ### Automatic performance indexes
308
308
 
309
309
  Aurora DSQL storage automatically creates composite indexes during initialization for common query patterns:
310
310
 
@@ -318,7 +318,7 @@ Aurora DSQL storage automatically creates composite indexes during initializatio
318
318
 
319
319
  Aurora DSQL creates these indexes asynchronously using `CREATE INDEX ASYNC`. Because index creation is asynchronous, new indexes may not be immediately available after `init()`. The store will continue to function without them, but queries may be slower until index creation completes.
320
320
 
321
- ### Creating Custom Indexes
321
+ ### Creating custom indexes
322
322
 
323
323
  Create additional indexes to optimize specific query patterns:
324
324
 
@@ -338,7 +338,7 @@ await storage.createIndex({
338
338
 
339
339
  Aurora DSQL doesn't allow `ASC`/`DESC` in `CREATE INDEX ASYNC`. If you include them, they will be automatically stripped.
340
340
 
341
- ### Index Options
341
+ ### Index options
342
342
 
343
343
  **name** (`string`): Unique name for the index
344
344
 
@@ -360,7 +360,7 @@ Aurora DSQL doesn't allow `ASC`/`DESC` in `CREATE INDEX ASYNC`. If you include t
360
360
 
361
361
  **tablespace** (`string`): Ignored in Aurora DSQL. Tablespaces are not supported.
362
362
 
363
- ### Managing Indexes
363
+ ### Managing indexes
364
364
 
365
365
  List and monitor existing indexes:
366
366
 
@@ -403,7 +403,7 @@ console.log(stats)
403
403
  await storage.dropIndex('idx_threads_status')
404
404
  ```
405
405
 
406
- ### Schema-Specific Indexes
406
+ ### Schema-specific indexes
407
407
 
408
408
  When using custom schemas, indexes are created with schema prefixes:
409
409
 
@@ -422,7 +422,7 @@ await storage.createIndex({
422
422
  })
423
423
  ```
424
424
 
425
- ## Related Resources
425
+ ## Related resources
426
426
 
427
427
  - [Aurora DSQL Documentation](https://docs.aws.amazon.com/aurora-dsql/)
428
428
  - [SQL Reference](https://docs.aws.amazon.com/aurora-dsql/latest/userguide/working-with-aurora-dsql-sql.html)
@@ -54,7 +54,7 @@ Detailed instructions for setting up the table using AWS CloudFormation or AWS C
54
54
 
55
55
  ## Usage
56
56
 
57
- ### Basic Usage
57
+ ### Basic usage
58
58
 
59
59
  ```typescript
60
60
  import { Memory } from '@mastra/memory'
@@ -80,7 +80,7 @@ const memory = new Memory({
80
80
  })
81
81
  ```
82
82
 
83
- ### Local Development with DynamoDB Local
83
+ ### Local development with DynamoDB Local
84
84
 
85
85
  For local development, you can use [DynamoDB Local](https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/DynamoDBLocal.html).
86
86
 
@@ -174,7 +174,7 @@ const storage = new DynamoDBStore({
174
174
  })
175
175
  ```
176
176
 
177
- ### Supported Entity Types
177
+ ### Supported entity types
178
178
 
179
179
  TTL can be configured for these entity types:
180
180
 
@@ -188,7 +188,7 @@ TTL can be configured for these entity types:
188
188
  | `resource` | User/resource data |
189
189
  | `score` | Scoring results |
190
190
 
191
- ### TTL Entity Configuration
191
+ ### TTL entity configuration
192
192
 
193
193
  Each entity type accepts the following configuration:
194
194
 
@@ -198,7 +198,7 @@ Each entity type accepts the following configuration:
198
198
 
199
199
  **defaultTtlSeconds** (`number`): Default TTL in seconds from item creation time. Items will be automatically deleted by DynamoDB after this duration.
200
200
 
201
- ### Enabling TTL on Your DynamoDB Table
201
+ ### Enabling TTL on your DynamoDB table
202
202
 
203
203
  After configuring TTL in your code, you must enable TTL on the DynamoDB table itself:
204
204
 
@@ -269,17 +269,17 @@ Key aspects of this approach:
269
269
  - **External Table Management:** Unlike some adapters that might offer helper functions to create tables via code, this adapter **expects the DynamoDB table and its associated Global Secondary Indexes (GSIs) to be provisioned externally** before use. Please refer to [TABLE_SETUP.md](https://github.com/mastra-ai/mastra/blob/main/stores/dynamodb/TABLE_SETUP.md) for detailed instructions using tools like AWS CloudFormation or CDK. The adapter focuses solely on interacting with the pre-existing table structure.
270
270
  - **Consistency via Interface:** While the underlying storage model differs, this adapter adheres to the same `MastraStorage` interface as other adapters, ensuring it can be used interchangeably within the Mastra `Memory` component.
271
271
 
272
- ### Mastra Data in the Single Table
272
+ ### Mastra data in the single table
273
273
 
274
274
  Within the single DynamoDB table, different Mastra data entities (such as Threads, Messages, Traces, Evals, and Workflows) are managed and distinguished using ElectroDB. ElectroDB defines specific models for each entity type, which include unique key structures and attributes. It allows the adapter to store and retrieve diverse data types efficiently within the same table.
275
275
 
276
276
  For example, a `Thread` item might have a primary key like `THREAD#<threadId>`, while a `Message` item belonging to that thread might use `THREAD#<threadId>` as a partition key and `MESSAGE#<messageId>` as a sort key. The Global Secondary Indexes (GSIs), detailed in `TABLE_SETUP.md`, are strategically designed to support common access patterns across these different entities, such as fetching all messages for a thread or querying traces associated with a workflow.
277
277
 
278
- ### Advantages of Single-Table Design
278
+ ### Advantages of single-table design
279
279
 
280
280
  This implementation uses a single-table design pattern with ElectroDB, which offers several advantages within the context of DynamoDB:
281
281
 
282
- 1. **Lower cost (potentially):** Fewer tables can simplify Read/Write Capacity Unit (RCU/WCU) provisioning and management, especially with on-demand capacity.
282
+ 1. **Lower cost (in some cases):** Fewer tables can simplify Read/Write Capacity Unit (RCU/WCU) provisioning and management, especially with on-demand capacity.
283
283
  2. **Better performance:** Related data can be co-located or accessed efficiently through GSIs, enabling fast lookups for common access patterns.
284
284
  3. **Simplified administration:** Fewer distinct tables to monitor and back up, with less to manage.
285
285
  4. **Reduced complexity in access patterns:** ElectroDB helps manage the complexity of item types and access patterns on a single table.
@@ -60,7 +60,7 @@ const storage = new ElasticSearchStore({ id: 'elasticsearch-storage', client })
60
60
  const vector = new ElasticSearchVector({ id: 'elasticsearch-vector', client })
61
61
  ```
62
62
 
63
- When you provide your own client, `storage.close()` does not close it — you remain responsible for its lifecycle.
63
+ When you provide your own client, `storage.close()` doesn't close it, and you remain responsible for its lifecycle.
64
64
 
65
65
  ## Parameters
66
66
 
@@ -76,11 +76,11 @@ When you provide your own client, `storage.close()` does not close it — you re
76
76
 
77
77
  > **Note:** You must provide either `url` or `client`. These options are mutually exclusive.
78
78
 
79
- ## Additional Notes
79
+ ## Additional notes
80
80
 
81
- ### Index Structure
81
+ ### Index structure
82
82
 
83
- Each Mastra storage table maps to one Elasticsearch index of the same name (for example `mastra_threads`, `mastra_messages`, `mastra_workflow_snapshot`, `mastra_scorers`). Records are stored as opaque JSON documents with a keyword `key` field, so no index mappings need to be managed manually — indexes are created on first use.
83
+ Each Mastra storage table maps to one Elasticsearch index of the same name (for example `mastra_threads`, `mastra_messages`, `mastra_workflow_snapshot`, `mastra_scorers`). Records are stored as opaque JSON documents with a keyword `key` field, so no index mappings need to be managed manually. Indexes are created on first use.
84
84
 
85
85
  ### Consistency
86
86
 
@@ -94,9 +94,9 @@ When shutting down your application, close the connection:
94
94
  await storage.close()
95
95
  ```
96
96
 
97
- This only closes clients created by `ElasticSearchStore` from a `url`; user-provided clients are left open.
97
+ This only closes clients created by `ElasticSearchStore` from a `url`. User-provided clients are left open.
98
98
 
99
- ## Usage Example
99
+ ## Usage example
100
100
 
101
101
  ### Adding memory to an agent
102
102
 
@@ -118,7 +118,7 @@ await store4.init() // Call init explicitly
118
118
 
119
119
  ## Additional notes
120
120
 
121
- ### Collection Management
121
+ ### Collection management
122
122
 
123
123
  The storage implementation handles collection creation and management automatically. It creates the following collections:
124
124
 
@@ -173,7 +173,7 @@ const thread = await memoryStore?.getThreadById({ threadId: '...' })
173
173
 
174
174
  > **Warning:** If `init()` isn't called, collections won't be created and storage operations will fail silently or throw errors.
175
175
 
176
- ### Connection Management
176
+ ### Connection management
177
177
 
178
178
  The `close()` method closes the MongoDB client connection. Call this when shutting down your application:
179
179
 
@@ -113,7 +113,7 @@ const storage = new OracleStore({
113
113
  })
114
114
  ```
115
115
 
116
- For external authentication, set `externalAuth: true` and omit `password`. To reuse an existing `oracledb.Pool`, pass it as `pool`. Mastra uses it but doesn't close it.
116
+ For external authentication, set `externalAuth: true` and omit `password`. To reuse an existing `oracledb.Pool`, pass it as `pool`, and Mastra uses it but doesn't close it.
117
117
 
118
118
  `OracleStore` backs memory, workflow snapshots, observability, scores, scorer definitions, MCP client metadata, and agent registry data. When using the store outside a `Mastra` instance, call `await storage.init()` and access a domain with `await storage.getStore('memory')`.
119
119
 
@@ -138,7 +138,7 @@ Repeatable migrations are idempotent. They reconcile the tables and indexes owne
138
138
 
139
139
  Initialization also creates the provider's default indexes for common Mastra query paths. Use `skipDefaultIndexes` when indexes are managed separately, or pass `indexes` for custom Oracle indexes. Custom definitions support Oracle options such as `bitmap`, `online`, `invisible`, `parallel`, `compress`, `noLogging`, and `reverse`, as well as function-based expressions like `JSON_VALUE(...)`.
140
140
 
141
- Custom indexes are useful when your app repeatedly filters on JSON metadata or when database administrators (DBAs) want to test an index before the optimizer uses it:
141
+ Custom indexes are useful when your app filters on JSON metadata in most queries or when database administrators (DBAs) want to test an index before the optimizer uses it:
142
142
 
143
143
  ```ts
144
144
  const storage = new OracleStore({
@@ -125,7 +125,7 @@ const store4 = new PostgresStore({
125
125
 
126
126
  ## Additional notes
127
127
 
128
- ### Schema Management
128
+ ### Schema management
129
129
 
130
130
  The storage implementation handles schema creation and updates automatically. It creates the following tables:
131
131
 
@@ -172,13 +172,13 @@ const storage = new PostgresStoreVNext({
172
172
  })
173
173
  ```
174
174
 
175
- Lower `lookbackSeconds` if refreshes are slow, and raise `ttlSeconds` if they run more often than your filter values change. Only one process refreshes a given cache entry at a time, so adding server instances doesn't multiply the work.
175
+ Lower `lookbackSeconds` if refreshes are slow, and raise `ttlSeconds` if they run more often than your filter values change. Only one process refreshes each cache entry at a time, so adding server instances doesn't multiply the work.
176
176
 
177
177
  #### Day partitions
178
178
 
179
- `PostgresStoreVNext` stores observability events in tables partitioned by day. If TimescaleDB or pg_partman is installed, that extension creates partitions for you. Without an extension, `init()` creates the partitions for yesterday, today, and the next `futureDays` days (default 14), and a write that lands on a day inside that window with no partition creates it before it retries, so writes keep working after the pre-created window runs out. Rows dated outside the window are still rejected.
179
+ `PostgresStoreVNext` stores observability events in tables partitioned by day. If TimescaleDB or pg_partman is installed, that extension creates partitions for you. Without an extension, `init()` creates the partitions for yesterday, today, and the next `futureDays` days (default 14), and a write that targets a day inside that window with no partition creates it before it retries, so writes keep working after the pre-created window runs out. Rows dated outside the window are still rejected.
180
180
 
181
- Creating a partition is DDL. If the role your app runs with cannot create tables, or does not own the observability tables, the write fails with an error that names the table and the missing day, and the exporter drops that batch after its retries. In that setup, call `ensurePartitions()` on a schedule, at least once every `futureDays` days, with a role that can create tables and owns the observability tables. It only extends the native day-partition window, and does nothing with TimescaleDB or pg_partman. You can also install TimescaleDB, or pg_partman with its background worker or a scheduled `run_maintenance()` call, so the database maintains the partitions itself.
181
+ Creating a partition is DDL. If the role your app runs with can't create tables, or doesn't own the observability tables, the write fails with an error that names the table and the missing day, and the exporter drops that batch after its retries. In that setup, call `ensurePartitions()` on a schedule, at least once every `futureDays` days, with a role that can create tables and owns the observability tables. It only extends the native day-partition window, and does nothing with TimescaleDB or pg_partman. You can also install TimescaleDB, or pg_partman with its background worker or a scheduled `run_maintenance()` call, to have the database maintain the partitions itself.
182
182
 
183
183
  A larger `futureDays` gives the scheduled job more time between runs:
184
184
 
@@ -289,7 +289,7 @@ export const mastra = new Mastra({
289
289
 
290
290
  `disableInit: true` also makes explicit `init()` calls a no-op, so leave it off the store in the deployment script.
291
291
 
292
- ### Using an Existing Pool
292
+ ### Using an existing pool
293
293
 
294
294
  If you already have a `pg.Pool` in your application (e.g., shared with an ORM or for Row Level Security), you can pass it directly to `PostgresStore`:
295
295
 
@@ -314,7 +314,7 @@ const storage = new PostgresStore({
314
314
  - When you **provide a pool**: Mastra uses your pool but **doesn't** close it when `store.close()` is called. You manage the pool lifecycle.
315
315
  - When Mastra **creates a pool**: Mastra owns the pool and will close it when `store.close()` is called.
316
316
 
317
- ### Direct Database and Pool Access
317
+ ### Direct database and pool access
318
318
 
319
319
  `PostgresStore` exposes the underlying database client and pool for advanced use cases:
320
320
 
@@ -501,7 +501,7 @@ for await (const chunk of stream.textStream) {
501
501
 
502
502
  PostgreSQL storage provides index management to optimize query performance.
503
503
 
504
- ### Default Indexes
504
+ ### Default indexes
505
505
 
506
506
  PostgreSQL storage creates composite indexes during initialization for common query patterns:
507
507
 
@@ -517,7 +517,7 @@ PostgreSQL storage creates composite indexes during initialization for common qu
517
517
 
518
518
  These indexes improve performance for filtered queries with sorting, including `dateRange` filters on message queries and Studio's workflow runs-list.
519
519
 
520
- ### Configuring Indexes
520
+ ### Configuring indexes
521
521
 
522
522
  You can control index creation via constructor options:
523
523
 
@@ -558,7 +558,7 @@ For advanced index types, you can specify additional options:
558
558
  - `storage: { fillfactor: 90 }` for update-heavy tables
559
559
  - `concurrent: true` for non-blocking creation (default)
560
560
 
561
- ### Index Options
561
+ ### Index options
562
562
 
563
563
  **name** (`string`): Unique name for the index
564
564
 
@@ -580,7 +580,7 @@ For advanced index types, you can specify additional options:
580
580
 
581
581
  **tablespace** (`string`): Tablespace name for index placement
582
582
 
583
- ### Schema-Specific Indexes
583
+ ### Schema-specific indexes
584
584
 
585
585
  When using custom schemas, index names are prefixed with the schema name:
586
586
 
@@ -601,7 +601,7 @@ const storage = new PostgresStore({
601
601
  // Creates index as: custom_schema_idx_threads_status
602
602
  ```
603
603
 
604
- ### Managing Indexes via SQL
604
+ ### Managing indexes via SQL
605
605
 
606
606
  For advanced index management (listing, dropping, analyzing), use direct SQL queries via the `db` accessor:
607
607
 
@@ -624,15 +624,15 @@ const stats = await storage.db.one(`
624
624
  `)
625
625
  ```
626
626
 
627
- ### Index Types and Use Cases
627
+ ### Index types and use cases
628
628
 
629
629
  PostgreSQL offers different index types optimized for specific scenarios:
630
630
 
631
631
  | Index Type | Best For | Storage size | Speed |
632
632
  | ------------------- | --------------------------------------- | ------------ | -------------------------- |
633
633
  | **btree** (default) | Range queries, sorting, general purpose | Moderate | Fast |
634
- | **hash** | Equality comparisons only | Small | Very fast for `=` |
634
+ | **hash** | Equality comparisons only | Small | Fast for `=` |
635
635
  | **gin** | JSONB, arrays, full-text search | Large | Fast for contains |
636
636
  | **gist** | Geometric data, full-text search | Moderate | Fast for nearest-neighbor |
637
637
  | **spgist** | Non-balanced data, text patterns | Small | Fast for specific patterns |
638
- | **brin** | Large tables with natural ordering | Very small | Fast for ranges |
638
+ | **brin** | Large tables with natural ordering | Small | Fast for ranges |
@@ -14,7 +14,7 @@ npm install @mastra/redis
14
14
 
15
15
  ## Usage
16
16
 
17
- ### Using Connection String
17
+ ### Using connection string
18
18
 
19
19
  ```typescript
20
20
  import { RedisStore } from '@mastra/redis'
@@ -27,7 +27,7 @@ const storage = new RedisStore({
27
27
  await storage.init()
28
28
  ```
29
29
 
30
- ### Using Host/Port Configuration
30
+ ### Using host and port configuration
31
31
 
32
32
  ```typescript
33
33
  import { RedisStore } from '@mastra/redis'
@@ -43,7 +43,7 @@ const storage = new RedisStore({
43
43
  await storage.init()
44
44
  ```
45
45
 
46
- ### Using Pre-configured Client
46
+ ### Using pre-configured client
47
47
 
48
48
  For advanced configurations such as Sentinel, you can pass a pre-configured Redis client:
49
49
 
@@ -85,9 +85,9 @@ const storage = new RedisStore({
85
85
 
86
86
  > **Note:** You must provide either `connectionString`, `host`, or `client`. These options are mutually exclusive.
87
87
 
88
- ## Additional Notes
88
+ ## Additional notes
89
89
 
90
- ### Key Structure
90
+ ### Key structure
91
91
 
92
92
  The Redis storage implementation uses the following key patterns:
93
93
 
@@ -124,7 +124,7 @@ const storage = new RedisStore({
124
124
 
125
125
  Redis Cluster isn't supported. `RedisStore` accepts only a standalone client from `createClient()`, and several operations read or write keys that hash to different slots, which Redis Cluster rejects with a `CROSSSLOT` error.
126
126
 
127
- ### Accessing the Underlying Client
127
+ ### Accessing the underlying client
128
128
 
129
129
  You can access the underlying Redis client for custom operations:
130
130
 
@@ -151,7 +151,7 @@ When shutting down your application, close the Redis connection:
151
151
  await storage.close()
152
152
  ```
153
153
 
154
- ## Usage Example
154
+ ## Usage example
155
155
 
156
156
  ### Adding memory to an agent
157
157
 
@@ -6,7 +6,7 @@
6
6
 
7
7
  The Upstash storage implementation provides a serverless-friendly storage solution using Upstash's Redis-compatible key-value store.
8
8
 
9
- > **Pricing:** When using Mastra with Upstash, the pay-as-you-go model can result in unexpectedly high costs due to the high volume of Redis commands generated during agent conversations. We strongly recommend using a **fixed pricing plan** for predictable costs. See [Upstash pricing](https://upstash.com/pricing/redis) for details and [GitHub issue #5850](https://github.com/mastra-ai/mastra/issues/5850) for context.
9
+ > **Pricing:** When using Mastra with Upstash, the pay-as-you-go model can result in high costs due to the high volume of Redis commands generated during agent conversations. Use a **fixed pricing plan** for predictable costs. See [Upstash pricing](https://upstash.com/pricing/redis) for details and [GitHub issue #5850](https://github.com/mastra-ai/mastra/issues/5850) for context.
10
10
 
11
11
  > **Observability Not Supported:** Upstash storage **doesn't support the observability domain**. Traces from the `MastraStorageExporter` can't be persisted to Upstash, and [Studio's](https://mastra.ai/docs/studio/overview) observability features won't work with Upstash as your only storage provider. To enable observability, use [composite storage](https://mastra.ai/reference/storage/composite) to route observability data to a supported provider like ClickHouse.
12
12
 
@@ -58,7 +58,7 @@ const storage = new UpstashStore({
58
58
 
59
59
  ## Additional notes
60
60
 
61
- ### Key Structure
61
+ ### Key structure
62
62
 
63
63
  The Upstash storage implementation uses a key-value structure:
64
64
 
@@ -66,7 +66,7 @@ The Upstash storage implementation uses a key-value structure:
66
66
  - Message keys: `{prefix}message:{messageId}`
67
67
  - Metadata keys: `{prefix}metadata:{entityId}`
68
68
 
69
- ### Serverless Benefits
69
+ ### Serverless benefits
70
70
 
71
71
  Upstash storage is particularly well-suited for serverless deployments:
72
72
 
@@ -75,7 +75,7 @@ Upstash storage is particularly well-suited for serverless deployments:
75
75
  - Global replication options
76
76
  - Edge-compatible
77
77
 
78
- ### Data Persistence
78
+ ### Data persistence
79
79
 
80
80
  Upstash provides:
81
81
 
@@ -83,7 +83,7 @@ Upstash provides:
83
83
  - Point-in-time recovery
84
84
  - Cross-region replication options
85
85
 
86
- ### Performance Considerations
86
+ ### Performance considerations
87
87
 
88
88
  For optimal performance:
89
89
 
@@ -6,7 +6,7 @@
6
6
 
7
7
  The Valkey storage implementation provides persistent storage and server-side caching through the [Valkey GLIDE](https://github.com/valkey-io/valkey-glide) client. Use it when your deployment runs Valkey or needs GLIDE features such as native Valkey configuration and authentication.
8
8
 
9
- Use [`@mastra/redis`](https://mastra.ai/integrations/databases/redis) for Redis deployments that use the official `redis` client. The packages are tested independently against their respective servers.
9
+ Use [`@mastra/redis`](https://mastra.ai/integrations/databases/redis) for Redis deployments that use the official `redis` client. Each package is tested independently against its own server.
10
10
 
11
11
  ## Installation
12
12