# SerializedMemoryConfig

`SerializedMemoryConfig` is the JSON-serializable subset of [`Memory`](https://mastra.ai/reference/memory/memory-class) configuration that lives on a stored agent record. The runtime hydrates it back into a `Memory` instance by resolving the vector and embedder IDs against the configured `Mastra` instance.

It is the type used by [`BuilderAgentDefaults.memory`](https://mastra.ai/reference/editor/agent-builder/builder-agent-defaults) and by `EditorAgentNamespace.create({ memory })`.

## Usage example

```typescript
import { MastraEditor } from '@mastra/editor'

new MastraEditor({
  builder: {
    enabled: true,
    configuration: {
      agent: {
        memory: {
          observationalMemory: true,
          options: { lastMessages: 50 },
        },
      },
    },
  },
})
```

## Properties

**vector** (`string | false`): Vector store identifier. The vector instance must be registered with the Mastra instance to resolve from this ID. Set to \`false\` to disable vector search.

**embedder** (`string`): Embedding model ID in the format \`"provider/model"\` (for example, \`"openai/text-embedding-3-small"\`).

**embedderOptions** (`Omit<MastraEmbeddingOptions, 'telemetry'>`): Options passed to the embedder. Telemetry options are stripped.

**options** (`SerializedMemoryOptions`): Configuration for memory behaviors. Omits non-serializable fields like working memory and threads.

**options.readOnly** (`boolean`): Treat memory as read-only — no new messages are stored.

**options.lastMessages** (`number | false`): Number of recent messages to include in context, or \`false\` to disable.

**options.semanticRecall** (`boolean | SemanticRecall`): Semantic recall configuration. See the Memory class reference for the full shape.

**options.generateTitle** (`boolean | { model: ModelRouterModelId; instructions?: string }`): Title generation configuration. Pass an object with \`model\` (in \`"provider/model"\` form) and optional \`instructions\`.

**observationalMemory** (`boolean | SerializedObservationalMemoryConfig`): Long-lived fact extraction. Pass \`true\` to enable with defaults, or an object to override observer/reflector models, scope, and activation behavior.

## `SerializedObservationalMemoryConfig`

**model** (`string`): Model ID used by both the Observer and Reflector (for example, \`"google/gemini-2.5-flash"\`).

**scope** (`'resource' | 'thread'`): Whether observations are scoped to a resource or a single thread.

**activateAfterIdle** (`ObservationalMemoryActivationTTL`): Inactivity TTL before forcing buffered observation activation.

**activateOnProviderChange** (`boolean`): Force-activate buffered observations when the actor model changes.

**shareTokenBudget** (`boolean`): Share the token budget between messages and observations.

**temporalMarkers** (`boolean`): Persist inline temporal gap markers for long pauses between messages.

**retrieval** (`boolean | { vector?: boolean; scope?: 'thread' | 'resource' }`): Experimental. Enable retrieval-mode observation groups as durable pointers to raw message history.

**observation** (`SerializedObservationalMemoryObservationConfig`): Observer-step configuration (model, token thresholds, buffering).

**reflection** (`SerializedObservationalMemoryReflectionConfig`): Reflector-step configuration (model, observation token thresholds, buffering).

## Related

- [Memory class](https://mastra.ai/reference/memory/memory-class) — the runtime type this config hydrates into.
- [Observational memory](https://mastra.ai/reference/memory/observational-memory) — full observational memory reference.
- [BuilderAgentDefaults](https://mastra.ai/reference/editor/agent-builder/builder-agent-defaults) — where this type is pinned as the Builder default.
- [Agent Builder: Memory](https://mastra.ai/docs/agent-builder/memory) — concept and worked examples.