@mastra/memory 1.26.1-alpha.3 → 1.26.1-alpha.6

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 (35) hide show
  1. package/CHANGELOG.md +42 -0
  2. package/dist/docs/SKILL.md +3 -1
  3. package/dist/docs/assets/SOURCE_MAP.json +1 -1
  4. package/dist/docs/references/docs-agents-agent-approval.md +14 -0
  5. package/dist/docs/references/docs-capabilities-subagents.md +4 -1
  6. package/dist/docs/references/docs-long-running-agents-goals.md +1 -1
  7. package/dist/docs/references/docs-memory-message-history.md +2 -2
  8. package/dist/docs/references/docs-memory-multi-user-threads.md +1 -1
  9. package/dist/docs/references/docs-memory-observational-memory.md +1 -1
  10. package/dist/docs/references/docs-memory-semantic-recall.md +2 -1
  11. package/dist/docs/references/docs-memory-working-memory.md +1 -0
  12. package/dist/docs/references/docs-storage-overview.md +1 -0
  13. package/dist/docs/references/reference-file-based-agents-memory.md +2 -0
  14. package/dist/docs/references/reference-storage-oracledb.md +239 -0
  15. package/dist/docs/references/reference-vectors-oracledb.md +347 -0
  16. package/dist/index.cjs +1 -1
  17. package/dist/index.d.ts +2 -2
  18. package/dist/index.d.ts.map +1 -1
  19. package/dist/index.js +1 -1
  20. package/dist/processors/index.cjs +1 -1
  21. package/dist/processors/index.js +1 -1
  22. package/dist/processors/observational-memory/measure-image-buffer.d.ts +23 -0
  23. package/dist/processors/observational-memory/measure-image-buffer.d.ts.map +1 -0
  24. package/dist/processors/observational-memory/observation-strategies/async-buffer.d.ts.map +1 -1
  25. package/dist/processors/observational-memory/observational-memory.d.ts.map +1 -1
  26. package/dist/processors/observational-memory/reflector-runner.d.ts.map +1 -1
  27. package/dist/processors/observational-memory/tool-result-helpers.d.ts +8 -0
  28. package/dist/processors/observational-memory/tool-result-helpers.d.ts.map +1 -1
  29. package/dist/{src-CTQrRb5X.cjs → src-B2WSEEmS.cjs} +72 -33
  30. package/dist/src-B2WSEEmS.cjs.map +1 -0
  31. package/dist/{src-MScpLVRh.js → src-B_n15_Xg.js} +71 -32
  32. package/dist/src-B_n15_Xg.js.map +1 -0
  33. package/package.json +6 -7
  34. package/dist/src-CTQrRb5X.cjs.map +0 -1
  35. package/dist/src-MScpLVRh.js.map +0 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,47 @@
1
1
  # @mastra/memory
2
2
 
3
+ ## 1.26.1-alpha.6
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [[`2e4624e`](https://github.com/mastra-ai/mastra/commit/2e4624edb6917e61249cb60ee377735e7af7e4a9), [`e6534fa`](https://github.com/mastra-ai/mastra/commit/e6534fab031216f6cb48c4c9907cbfdce9d60bc6), [`7fdcaa6`](https://github.com/mastra-ai/mastra/commit/7fdcaa66105d64290f9b14432a12ec99f39c4d3a), [`5dba2a4`](https://github.com/mastra-ai/mastra/commit/5dba2a41600385751f5aace79878904e1972609d), [`cfd0d9e`](https://github.com/mastra-ai/mastra/commit/cfd0d9ec77ec3c69dd96f79cdb579e03d79f22ce), [`d9d93b2`](https://github.com/mastra-ai/mastra/commit/d9d93b25e4a65ad5fa153fa35be7ed149c8d587f)]:
8
+ - @mastra/core@1.58.0-alpha.12
9
+ - @mastra/schema-compat@1.3.6-alpha.3
10
+
11
+ ## 1.26.1-alpha.5
12
+
13
+ ### Patch Changes
14
+
15
+ - Remove the `image-size` dependency from `@mastra/memory` and measure image dimensions with the already-present `probe-image-size` instead. ([#21120](https://github.com/mastra-ai/mastra/pull/21120))
16
+
17
+ Every published version of `image-size` carries unfixed denial-of-service advisories (GHSA-w3rx-r6r6-pgpr / CVE-2025-71330 and GHSA-5p2g-fcmc-qvqq): a malformed image could hang its parse loop and exhaust the heap. The repository is archived, so no fixed release is coming, and the previous pin to `1.2.1` moved between two equally affected releases rather than remediating the flaw. Because image bytes reaching agent memory are untrusted, a crafted 32-byte image was enough to crash the process.
18
+
19
+ Dimension detection still covers the formats models accept (PNG, JPEG, WebP, GIF, AVIF, BMP, ICO, PSD, SVG, TIFF). Unrecognized formats now report unknown dimensions, which token counting already handled.
20
+
21
+ - Updated dependencies [[`b8ce7ec`](https://github.com/mastra-ai/mastra/commit/b8ce7ec96e39343c6c2f36d12d68a9ad816c09f7), [`a3a3624`](https://github.com/mastra-ai/mastra/commit/a3a3624f646b98e409424d8defccbd334da9e8b8), [`6246914`](https://github.com/mastra-ai/mastra/commit/62469146636911f3cbbe0880bd011c6a897a59a7), [`3f73c07`](https://github.com/mastra-ai/mastra/commit/3f73c076727e8c36b4fff7a1b40290fb68957fa8), [`7c1ebb1`](https://github.com/mastra-ai/mastra/commit/7c1ebb15690c4b3f0eabb19077cf8af573311e57), [`32980a3`](https://github.com/mastra-ai/mastra/commit/32980a3e2413d0274ac244d32c37d910edc13f00), [`4bcdfaf`](https://github.com/mastra-ai/mastra/commit/4bcdfaf0eac3199d7cb171b0a19a92c9c341eea4), [`af4636a`](https://github.com/mastra-ai/mastra/commit/af4636a74463275d71c1d13a38f7d2b738f128bf), [`a463cdf`](https://github.com/mastra-ai/mastra/commit/a463cdf1c95c3059e70f0bff27959e8558bb899d), [`0ea6b80`](https://github.com/mastra-ai/mastra/commit/0ea6b8001408ce02b56e8be0536b0fd8cbaf8ad2)]:
22
+ - @mastra/core@1.58.0-alpha.11
23
+
24
+ ## 1.26.1-alpha.4
25
+
26
+ ### Patch Changes
27
+
28
+ - Fix Observational Memory undercounting large tool results. Token accounting now serializes tool results in full instead of reusing the Observer-facing representation, which is truncated to 10k tokens. Oversized tool results now push OM past its thresholds and trigger compaction before the provider's context window overflows. ([#21045](https://github.com/mastra-ai/mastra/pull/21045))
29
+
30
+ - Fixed generated thread titles being clobbered during a turn ([#21041](https://github.com/mastra-ai/mastra/pull/21041))
31
+
32
+ `updateThread` required both `title` and `metadata`, so callers that only needed to
33
+ change metadata (message persistence, working memory, observational memory, channel
34
+ subscriptions) had to read the thread and pass its title back. When title generation
35
+ finished between that read and the write, the freshly generated title was overwritten
36
+ with the stale one.
37
+
38
+ `title` and `metadata` are now independently optional: omitting one leaves that column
39
+ untouched. Callers that only change metadata no longer send a title, and message
40
+ persistence no longer rewrites a thread row it just read.
41
+
42
+ - Updated dependencies [[`1c75e32`](https://github.com/mastra-ai/mastra/commit/1c75e32f7fc0b9fb6f548b4407feaec8a1440212), [`c47165c`](https://github.com/mastra-ai/mastra/commit/c47165c983c87594c6952f1fd2fa51a90205034c), [`e08e789`](https://github.com/mastra-ai/mastra/commit/e08e789c1bf4cd2fe46363f7a4728536ceccc9bd), [`35cc901`](https://github.com/mastra-ai/mastra/commit/35cc90102cf834a84827acaf9eee0b6d6d1e2a3b), [`a8b4cf0`](https://github.com/mastra-ai/mastra/commit/a8b4cf02823cffebc4751a53337dfacf097c1ae1), [`f33264f`](https://github.com/mastra-ai/mastra/commit/f33264f517ae603279afd5c4251e2b40f6dd3618), [`689f2c4`](https://github.com/mastra-ai/mastra/commit/689f2c4b6c0835fe455702b01d21daa8abcd9331), [`eeae63e`](https://github.com/mastra-ai/mastra/commit/eeae63e7fbe8e1f237adc69bca6e2ac13c5ca907), [`4c186a0`](https://github.com/mastra-ai/mastra/commit/4c186a017275f45e6ed4c09de0f89550e2d09e8c), [`b0fa077`](https://github.com/mastra-ai/mastra/commit/b0fa077bcbc9b08551846fe372a0d3d15b71ed72)]:
43
+ - @mastra/core@1.58.0-alpha.8
44
+
3
45
  ## 1.26.1-alpha.3
4
46
 
5
47
  ### Patch Changes
@@ -3,7 +3,7 @@ name: mastra-memory
3
3
  description: Documentation for @mastra/memory. Use when working with @mastra/memory APIs, configuration, or implementation.
4
4
  metadata:
5
5
  package: "@mastra/memory"
6
- version: "1.26.1-alpha.3"
6
+ version: "1.26.1-alpha.6"
7
7
  ---
8
8
 
9
9
  ## When to use
@@ -50,11 +50,13 @@ Read the individual reference documents for detailed explanations and code examp
50
50
  - [Reference: DynamoDB storage](references/reference-storage-dynamodb.md) - Documentation for the DynamoDB storage implementation in Mastra, using a single-table design with ElectroDB.
51
51
  - [Reference: libSQL storage](references/reference-storage-libsql.md) - Documentation for the libSQL storage implementation in Mastra.
52
52
  - [Reference: MongoDB storage](references/reference-storage-mongodb.md) - Documentation for the MongoDB storage implementation in Mastra.
53
+ - [Reference: OracleDB storage](references/reference-storage-oracledb.md) - Documentation for the Oracle Database storage provider in Mastra.
53
54
  - [Reference: PostgreSQL storage](references/reference-storage-postgresql.md) - Documentation for the PostgreSQL storage implementation in Mastra.
54
55
  - [Reference: Redis Storage](references/reference-storage-redis.md) - Documentation for the Redis storage implementation in Mastra.
55
56
  - [Reference: Upstash storage](references/reference-storage-upstash.md) - Documentation for the Upstash storage implementation in Mastra.
56
57
  - [Reference: libSQL vector store](references/reference-vectors-libsql.md) - Documentation for the LibSQLVector class in Mastra, which provides vector search using libSQL with vector extensions.
57
58
  - [Reference: MongoDB vector store](references/reference-vectors-mongodb.md) - Documentation for the MongoDBVector class in Mastra, which provides vector search using MongoDB Atlas and Atlas Vector Search.
59
+ - [Reference: OracleDB vector store](references/reference-vectors-oracledb.md) - Documentation for the Oracle Database vector provider in Mastra.
58
60
  - [Reference: PG vector store](references/reference-vectors-pg.md) - Documentation for the PgVector class in Mastra, which provides vector search using PostgreSQL with pgvector extension.
59
61
  - [Reference: Upstash vector store](references/reference-vectors-upstash.md) - Documentation for the UpstashVector class in Mastra, which provides vector search using Upstash Vector.
60
62
 
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.26.1-alpha.3",
2
+ "version": "1.26.1-alpha.6",
3
3
  "package": "@mastra/memory",
4
4
  "exports": {},
5
5
  "modules": {
@@ -90,6 +90,20 @@ for await (const chunk of stream.fullStream) {
90
90
  }
91
91
  ```
92
92
 
93
+ #### Explaining a decline
94
+
95
+ `declineToolCall()`, `declineToolCallGenerate()`, and `declineNetworkToolCall()` accept an optional `reason`. The reason is returned to the model in place of the tool result, so the model can adjust instead of retrying blindly. It's also stored on the tool call's `approval` metadata, so it's still there when the conversation is recalled.
96
+
97
+ ```typescript
98
+ const declined = await agent.declineToolCall({
99
+ runId: stream.runId,
100
+ toolCallId,
101
+ reason: 'Reading other users PII is not allowed, ask the user for their own email instead',
102
+ })
103
+ ```
104
+
105
+ Without a `reason`, the model receives the default message `Tool call was not approved by the user`.
106
+
93
107
  #### Conditional approval with a function
94
108
 
95
109
  Instead of a boolean, `requireToolApproval` accepts a function that decides per tool call. It receives the `toolName`, the `args` the model passed, the `requestContext`, and the `workspace`. Return `true` to require approval for that call, or `false` to allow it. This lets you gate approval at runtime, for example, only for tools whose name matches a pattern:
@@ -113,7 +113,7 @@ The `context` object includes:
113
113
 
114
114
  ### Request context at the delegation boundary
115
115
 
116
- Each delegation receives a request context whose entries are shallowly copied from the parent run, excluding run-scoped identity keys. Setting or deleting entries during the subagent run does not affect the parent's context. Set entries on `context.requestContext` in `onDelegationStart` to pass values to the delegated run:
116
+ Each delegation receives a request context whose entries are shallowly copied from the parent run, excluding run-scoped identity keys. Setting or deleting entries during the subagent run doesn't affect the parent's context. Set entries on `context.requestContext` in `onDelegationStart` to pass values to the delegated run:
117
117
 
118
118
  ```typescript
119
119
  const stream = await parentAgent.stream('Research AI trends', {
@@ -134,6 +134,9 @@ Called after a delegation finishes. Use it to inspect results or provide feedbac
134
134
 
135
135
  - `context.bail()`: Stop the parent agent's loop immediately
136
136
  - Return `{ feedback: '...' }`: Add feedback that gets saved to the parent agent's memory and is visible to subsequent iterations
137
+ - Return `{ resultText: '...' }`: Replace the tool result text the parent model sees for this delegation, within the current run
138
+
139
+ Use `resultText` when the subagent's own result would mislead the parent immediately. For example, a subagent that stops on a tool-calls step returns empty text, which the parent model reads as a successful but empty delegation. Unlike `feedback`, which only reaches the model on the next turn, `resultText` changes what the parent reasons on right away.
137
140
 
138
141
  ```typescript
139
142
  const stream = await parentAgent.stream('Research AI trends', {
@@ -4,7 +4,7 @@
4
4
 
5
5
  **Added in:** `@mastra/core@1.42.0`
6
6
 
7
- > **Beta:** The Goals feature is in beta stage and subject to breaking changes in minor versions until it graduates from its beta status.
7
+ > **Beta:** Breaking changes may occur without a major version bump until the API is stable.
8
8
 
9
9
  A goal is a durable, thread-scoped objective: a standing instruction the agent keeps working toward across loop iterations until a judge model decides it's satisfied or a run budget is exhausted.
10
10
 
@@ -6,7 +6,7 @@ Message history is the most basic and important form of memory. It gives the LLM
6
6
 
7
7
  You can also retrieve message history to display past conversations in your UI.
8
8
 
9
- > **Info:** Each message belongs to a thread (the conversation) and a resource (the user or entity it's associated with). See [Threads and resources](#threads-and-resources) for more detail.
9
+ > **Note:** Each message belongs to a thread (the conversation) and a resource (the user or entity it's associated with). See [Threads and resources](#threads-and-resources) for more detail.
10
10
 
11
11
  > **Warning:** When you use memory with a client application, send **only the new message** from the client instead of the full conversation history.
12
12
  >
@@ -113,7 +113,7 @@ await agent.stream('Hello', {
113
113
  })
114
114
  ```
115
115
 
116
- > **Info:** Threads and messages are created automatically when you call `agent.generate()` or `agent.stream()`, but you can also create them manually with [`createThread()`](https://mastra.ai/reference/memory/createThread) and [`saveMessages()`](https://mastra.ai/reference/memory/memory-class).
116
+ > **Note:** Threads and messages are created automatically when you call `agent.generate()` or `agent.stream()`, but you can also create them manually with [`createThread()`](https://mastra.ai/reference/memory/createThread) and [`saveMessages()`](https://mastra.ai/reference/memory/memory-class).
117
117
 
118
118
  You can use this history in two ways:
119
119
 
@@ -156,7 +156,7 @@ const memory = new Memory({
156
156
  })
157
157
  ```
158
158
 
159
- OM requires a storage adapter that supports it: `@mastra/libsql`, `@mastra/pg`, or `@mastra/mongodb`.
159
+ OM requires a storage adapter that supports it: `@mastra/libsql`, `@mastra/pg`, `@mastra/mongodb`, or `@mastra/oracledb`.
160
160
 
161
161
  > **Note:** If you switch the Observer to a weaker model and see facts collapse to a generic `User`, use [`observation.instruction`](https://mastra.ai/reference/memory/observational-memory) to teach the Observer how to read the `<turn>` tag.
162
162
 
@@ -94,7 +94,7 @@ See [configuration options](https://mastra.ai/reference/memory/observational-mem
94
94
  >
95
95
  > For an AI SDK example, see [Using Mastra Memory](https://mastra.ai/guides/build-your-ui/ai-sdk-ui).
96
96
 
97
- > **Note:** OM currently only supports `@mastra/pg`, `@mastra/libsql`, `@mastra/mysql`, `@mastra/mongodb`, and `@mastra/convex` storage adapters. It uses background agents for managing memory. When no model is set, the default model is `google/gemini-2.5-flash`.
97
+ > **Note:** OM currently only supports `@mastra/pg`, `@mastra/libsql`, `@mastra/mysql`, `@mastra/mongodb`, `@mastra/convex`, and `@mastra/oracledb` storage adapters. It uses background agents for managing memory. When no model is set, the default model is `google/gemini-2.5-flash`.
98
98
 
99
99
  ## Temporal gap markers
100
100
 
@@ -148,6 +148,7 @@ Each vector store page below includes installation instructions, configuration p
148
148
  - [libSQL](https://mastra.ai/reference/vectors/libsql)
149
149
  - [MongoDB](https://mastra.ai/reference/vectors/mongodb)
150
150
  - [OpenSearch](https://mastra.ai/reference/vectors/opensearch)
151
+ - [OracleDB](https://mastra.ai/reference/vectors/oracledb)
151
152
  - [Pinecone](https://mastra.ai/reference/vectors/pinecone)
152
153
  - [PostgreSQL](https://mastra.ai/reference/vectors/pg)
153
154
  - [Qdrant](https://mastra.ai/reference/vectors/qdrant)
@@ -180,7 +181,7 @@ const agent = new Agent({
180
181
  })
181
182
  ```
182
183
 
183
- > **Note:** `scope: 'resource'` is supported by the LibSQL, PostgreSQL, MongoDB, and Upstash storage adapters.
184
+ > **Note:** `scope: 'resource'` is supported by the LibSQL, OracleDB, PostgreSQL, MongoDB, and Upstash storage adapters.
184
185
 
185
186
  ### Metadata filtering
186
187
 
@@ -129,6 +129,7 @@ Resource-scoped working memory requires specific storage adapters that support t
129
129
 
130
130
  - **libSQL** (`@mastra/libsql`)
131
131
  - **PostgreSQL** (`@mastra/pg`)
132
+ - **OracleDB** (`@mastra/oracledb`)
132
133
  - **Upstash** (`@mastra/upstash`)
133
134
  - **MongoDB** (`@mastra/mongodb`)
134
135
 
@@ -193,6 +193,7 @@ Each provider page includes installation instructions, configuration parameters,
193
193
  - [libSQL](https://mastra.ai/reference/storage/libsql)
194
194
  - [PostgreSQL](https://mastra.ai/reference/storage/postgresql)
195
195
  - [MongoDB](https://mastra.ai/reference/storage/mongodb)
196
+ - [OracleDB](https://mastra.ai/reference/storage/oracledb)
196
197
  - [Upstash](https://mastra.ai/reference/storage/upstash)
197
198
  - [Redis](https://mastra.ai/reference/storage/redis)
198
199
  - [Cloudflare D1](https://mastra.ai/reference/storage/cloudflare-d1)
@@ -2,6 +2,8 @@
2
2
 
3
3
  # Memory
4
4
 
5
+ > **Beta:** Breaking changes may occur without a major version bump until the API is stable.
6
+
5
7
  A file-based agent gets [memory](https://mastra.ai/docs/memory/overview) from a `memory.ts` file that default-exports a [`Memory`](https://mastra.ai/reference/memory/memory-class) instance. Use this page for the file-based convention; use the memory docs for message history, semantic recall, storage, and processors.
6
8
 
7
9
  Without `memory.ts` or `config.memory`, the agent has no memory by default. Each `generate()` or `stream()` call starts without remembered conversation state unless you pass the prior context yourself.
@@ -0,0 +1,239 @@
1
+ > Discover all available pages from the documentation index: https://mastra.ai/llms.txt
2
+
3
+ # OracleDB storage
4
+
5
+ The OracleDB storage provider stores Mastra application state in Oracle Database. It implements Mastra's composite storage interface, so one `OracleStore` instance can back memory, workflow snapshots, observability, scores, scorer definitions, MCP client metadata, and agent registry data.
6
+
7
+ ## Installation
8
+
9
+ **npm**:
10
+
11
+ ```bash
12
+ npm install @mastra/oracledb@latest
13
+ ```
14
+
15
+ **pnpm**:
16
+
17
+ ```bash
18
+ pnpm add @mastra/oracledb@latest
19
+ ```
20
+
21
+ **Yarn**:
22
+
23
+ ```bash
24
+ yarn add @mastra/oracledb@latest
25
+ ```
26
+
27
+ **Bun**:
28
+
29
+ ```bash
30
+ bun add @mastra/oracledb@latest
31
+ ```
32
+
33
+ ## Usage
34
+
35
+ ```ts
36
+ import { OracleStore } from '@mastra/oracledb'
37
+
38
+ const storage = new OracleStore({
39
+ id: 'oracle-storage',
40
+ user: process.env.ORACLE_DATABASE_USER,
41
+ password: process.env.ORACLE_DATABASE_PASSWORD,
42
+ connectString: process.env.ORACLE_DATABASE_CONNECT_STRING,
43
+ })
44
+ ```
45
+
46
+ Use it with Mastra:
47
+
48
+ ```ts
49
+ import { Mastra } from '@mastra/core/mastra'
50
+
51
+ export const mastra = new Mastra({
52
+ storage,
53
+ })
54
+ ```
55
+
56
+ ## Parameters
57
+
58
+ **id** (`string`): Unique identifier for this storage instance.
59
+
60
+ **user** (`string`): Oracle Database user. Required unless using pool or externalAuth.
61
+
62
+ **password** (`string`): Password for the Oracle Database user. Required unless using pool or externalAuth.
63
+
64
+ **connectString** (`string`): Oracle connect string, service name, TNS alias, or Autonomous Database connect descriptor. Required unless using pool.
65
+
66
+ **pool** (`oracledb.Pool`): Existing Oracle connection pool. When provided, Mastra uses the pool but doesn't close it when store.close() is called.
67
+
68
+ **poolManager** (`OraclePoolManager`): Shared Oracle pool manager. Use this to share one Oracle pool between OracleStore and OracleVector.
69
+
70
+ **schemaName** (`string`): Oracle schema name used to qualify storage tables.
71
+
72
+ **poolMin** (`number`): Minimum number of Oracle pool connections. (Default: `0`)
73
+
74
+ **poolMax** (`number`): Maximum number of Oracle pool connections. (Default: `4`)
75
+
76
+ **poolIncrement** (`number`): Number of connections to add when the pool grows. (Default: `1`)
77
+
78
+ **configDir** (`string`): Directory containing Oracle Network configuration files such as tnsnames.ora.
79
+
80
+ **walletLocation** (`string`): Oracle wallet directory for mTLS connections such as Autonomous Database.
81
+
82
+ **walletPassword** (`string`): Password for the Oracle wallet, when required by the wallet configuration.
83
+
84
+ **externalAuth** (`boolean`): Use Oracle external authentication instead of username/password authentication.
85
+
86
+ **disableInit** (`boolean`): When true, automatic schema initialization is disabled. Use this when schema changes are applied separately before the app starts. (Default: `false`)
87
+
88
+ **messageBatchSize** (`number`): Number of messages sent per Oracle executeMany call when saving messages. The operation still commits once at the transaction boundary. (Default: `200`)
89
+
90
+ **skipDefaultIndexes** (`boolean`): When true, default storage indexes aren't created during initialization.
91
+
92
+ **indexes** (`OracleCreateIndexOptions[]`): Custom Oracle index definitions to create during initialization. Indexes are routed to the storage domain that owns the target table.
93
+
94
+ **migrationTableName** (`string`): Oracle table used to track storage schema migrations. (Default: `'MASTRA_ORACLE_MIGRATIONS'`)
95
+
96
+ **vectorRegistryTableName** (`string`): OracleVector registry table used to discover semantic-recall vector tables when threads or messages are deleted. Set this to match OracleVector's registryTableName when that option is customized.
97
+
98
+ ## Connection examples
99
+
100
+ The basic username/password constructor is shown above. For Autonomous Database, add wallet options to the same constructor:
101
+
102
+ ```ts
103
+ const storage = new OracleStore({
104
+ id: 'oracle-storage',
105
+ user: process.env.ORACLE_DATABASE_USER,
106
+ password: process.env.ORACLE_DATABASE_PASSWORD,
107
+ connectString: process.env.ORACLE_DATABASE_CONNECT_STRING,
108
+ walletLocation: process.env.ORACLE_DATABASE_WALLET_DIR,
109
+ walletPassword: process.env.ORACLE_DATABASE_WALLET_PASSWORD,
110
+ configDir: process.env.ORACLE_DATABASE_CONFIG_DIR,
111
+ })
112
+ ```
113
+
114
+ 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.
115
+
116
+ `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')`.
117
+
118
+ ## Initialization
119
+
120
+ When you pass `OracleStore` to `Mastra`, `init()` is called automatically before storage operations run. If you use `OracleStore` directly, call `init()` before reading or writing:
121
+
122
+ ```ts
123
+ await storage.init()
124
+ ```
125
+
126
+ > **Warning:** If initialization is disabled or skipped, storage operations require the Oracle tables and indexes to already exist.
127
+
128
+ `OracleStore.init()` runs repeatable migrations and records the result in the migration ledger table. The default ledger table is `MASTRA_ORACLE_MIGRATIONS`.
129
+
130
+ ```ts
131
+ await storage.migrate()
132
+ const history = await storage.listMigrations()
133
+ ```
134
+
135
+ Repeatable migrations are idempotent. They reconcile the tables and indexes owned by each storage domain on startup, which lets new domain indexes or compatible schema additions apply without changing application code.
136
+
137
+ 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(...)`.
138
+
139
+ 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:
140
+
141
+ ```ts
142
+ const storage = new OracleStore({
143
+ id: 'oracle-storage',
144
+ user,
145
+ password,
146
+ connectString,
147
+ indexes: [
148
+ {
149
+ name: 'idx_messages_status',
150
+ table: 'mastra_messages',
151
+ columns: [
152
+ "JSON_VALUE(metadata, '$.status' RETURNING VARCHAR2(32) NULL ON ERROR)",
153
+ 'thread_id',
154
+ ],
155
+ online: true,
156
+ invisible: true,
157
+ },
158
+ ],
159
+ })
160
+ ```
161
+
162
+ Use `invisible` for staged rollout, then remove it after validating query plans. Use `skipDefaultIndexes: true` only when a DBA-managed indexing strategy replaces the defaults.
163
+
164
+ Use `disableInit: true` when schema changes are applied by a separate deployment step or by a database administrator.
165
+
166
+ ## Schema export
167
+
168
+ Use `exportSchemas()` to generate Oracle DDL without connecting to a database. This is useful when schema changes are reviewed or applied outside application startup.
169
+
170
+ ```ts
171
+ import { exportSchemas } from '@mastra/oracledb'
172
+
173
+ const ddl = exportSchemas({
174
+ schemaName: 'MASTRA_APP',
175
+ domains: [
176
+ 'memory',
177
+ 'workflows',
178
+ 'observability',
179
+ 'scores',
180
+ 'scorerDefinitions',
181
+ 'mcpClients',
182
+ 'agents',
183
+ ],
184
+ })
185
+
186
+ console.log(ddl)
187
+ ```
188
+
189
+ `domains` defaults to every supported domain, including `vector`, when omitted.
190
+
191
+ ## Operational notes
192
+
193
+ Use the same `OraclePoolManager` when `OracleStore` and `OracleVector` should share one Oracle connection lifecycle:
194
+
195
+ ```ts
196
+ import { OracleStore, OracleVector } from '@mastra/oracledb'
197
+
198
+ const storage = new OracleStore({ id: 'oracle-storage', user, password, connectString })
199
+ const vector = new OracleVector({
200
+ id: 'oracle-vector',
201
+ poolManager: storage.getPoolManager(),
202
+ })
203
+ ```
204
+
205
+ `OracleStore` exposes `storage.db` and `await storage.getPool()` for advanced use cases. When using these APIs directly, you're responsible for transaction boundaries and connection lifecycle.
206
+
207
+ JSON metadata, payloads, and snapshots are stored in native Oracle JSON columns and encoded server-side, so the rows are readable directly with standard Oracle JDBC tools such as DBeaver and SQL Developer.
208
+
209
+ ## Usage example
210
+
211
+ ### Adding OracleDB memory to an agent
212
+
213
+ ```ts
214
+ import { Agent } from '@mastra/core/agent'
215
+ import { Memory } from '@mastra/memory'
216
+ import { OracleStore } from '@mastra/oracledb'
217
+
218
+ const storage = new OracleStore({
219
+ id: 'oracle-storage',
220
+ user: process.env.ORACLE_DATABASE_USER,
221
+ password: process.env.ORACLE_DATABASE_PASSWORD,
222
+ connectString: process.env.ORACLE_DATABASE_CONNECT_STRING,
223
+ })
224
+
225
+ export const oracleAgent = new Agent({
226
+ id: 'oracle-agent',
227
+ name: 'Oracle Agent',
228
+ instructions: 'You are an assistant with persistent OracleDB-backed memory.',
229
+ model: 'openai/gpt-5.6-sol',
230
+ memory: new Memory({ storage }),
231
+ })
232
+ ```
233
+
234
+ ## Related
235
+
236
+ - [OracleDB vector store](https://mastra.ai/reference/vectors/oracledb)
237
+ - [Storage overview](https://mastra.ai/reference/storage/overview)
238
+ - [Working memory](https://mastra.ai/docs/memory/working-memory)
239
+ - [Workflow snapshots](https://mastra.ai/docs/workflows/snapshots)