All Products
Search
Document Center

Tablestore:Memory Dream

Last Updated:Jul 07, 2026

As conversations grow, long-term memories accumulate duplicates, inconsistent phrasing, mergeable entries, and outdated items. Memory Dream refines, merges, and deduplicates stored memories and raw messages in the background, producing actionable operations that keep the memory store concise and consistent. Choose between proposal-first review and confidence-gated auto-apply.

Key concepts

Memory Dream reads from the memory store and produces consolidation actions in the background. Consolidation tasks come in three types, distinguished by their target. Actions from memory tasks write back to the memory store; actions from skill and profile tasks are emitted only as standalone events for the caller to consume.

taskType

Consolidation target

Action types emitted

memory (default)

Long-term memories: rewrite, merge, deduplicate, or remove outdated entries. Applied actions update the memory store directly.

ADD / UPDATE / DELETE / MERGE / NOOP

skill

Reusable skills extracted from historical interactions. Actions are emitted as events and do not write to the memory store.

EMIT_SKILL

profile

Structured user profiles distilled from interactions. Actions are emitted as events and do not write to the memory store.

EMIT_PROFILE

Choose an apply mode based on how much you trust the consolidation results:

applyMode

Behavior

proposal (default)

Consolidation generates only proposed actions, which the caller applies explicitly with ApplyMemoryDreamActions.

safe_auto

Actions that meet the confidence threshold (confidenceThresholds) are applied automatically by the service; the rest remain as proposals.

Note

applyMode is supported only for taskType=memory. Passing skill or profile returns a 403 error (applyMode is not supported for taskType=skill|profile). Actions from skill and profile tasks (EMIT_SKILL / EMIT_PROFILE) are emitted as events for the caller to consume, with no apply workflow.

Quick start

In proposal mode, the end-to-end workflow uses four APIs in order: create a task, poll its status, list proposed actions, and apply them. Task status transitions: queuedrunningplanning → (optional applying) → completed. Other terminal states include completed_with_failures, failed, and cancelled.

Step 1: Create a consolidation task

POST /CreateMemoryDreamTask
{
  "memoryStoreName": "agent_memory",
  "scopes": [ { "appId": "app-001", "tenantId": "user-001" } ],
  "taskType": "memory",
  "applyMode": "proposal"
}

Response:

{
  "memoryStoreName": "agent_memory",
  "dreamId": "2a528008111f5dc3500c73fd965089f7",
  "status": "queued",
  "createdAt": "2026-06-17T07:21:25.329Z"
}

Step 2: Poll the task status

POST /GetMemoryDreamTask
{ "memoryStoreName": "agent_memory", "dreamId": "2a528008111f5dc3500c73fd965089f7" }
Note

Right after a task is created, the consolidation task index may still be building. GetMemoryDreamTask may briefly return 409 (error message: dream task index is still building, please retry shortly). Retry after a short wait.

Response (completed):

{
  "dreamId": "2a528008111f5dc3500c73fd965089f7",
  "taskType": "memory",
  "applyMode": "proposal",
  "status": "completed",
  "actions": { "total": 2, "proposed": 2, "applied": 0, "skipped": 0, "failed": 0 },
  "input": { "sessionCount": 1, "messageCount": 1, "memoryCount": 2, "incremental": false },
  "finishedAt": "2026-06-17T07:21:32.276Z"
}

Step 3: Review proposed actions

POST /ListMemoryDreamActions
{ "memoryStoreName": "agent_memory", "dreamId": "2a528008111f5dc3500c73fd965089f7", "limit": 20 }

Response:

{
  "dreamId": "2a528008111f5dc3500c73fd965089f7",
  "actions": [
    {
      "actionId": "968768529cdfde8d56686a71e1c28227",
      "action": "UPDATE",
      "status": "proposed",
      "targetMemoryId": "d16fd038835d89ae8586f7814e5256c1",
      "newMemory": { "text": "User prefers concise responses.", "unitType": "atomic_fact" },
      "reason": "Rewrite as a more precise atomic_fact.",
      "confidence": 0.95
    }
  ]
}

Key action fields:

Field

Description

actionId

Action ID. Used when applying the action.

action

Action type: ADD / UPDATE / DELETE / MERGE / NOOP / EMIT_SKILL / EMIT_PROFILE.

status

Action status: proposed / applied / skipped / failed.

targetScope / targetMemoryId

Scope and target memory ID that the action operates on (UPDATE / DELETE / MERGE).

newMemory

New memory content, including text and unitType. Used for ADD, UPDATE, and MERGE.

reason

Model-provided reason for the action.

confidence

Confidence score, from 0 to 1.

Step 4: Apply actions

POST /ApplyMemoryDreamActions
{
  "memoryStoreName": "agent_memory",
  "dreamId": "2a528008111f5dc3500c73fd965089f7",
  "actionIds": ["968768529cdfde8d56686a71e1c28227", "a0f4715245920ea7b6a34c1828c6f1ae"]
}

Response:

{
  "dreamId": "2a528008111f5dc3500c73fd965089f7",
  "applied": 2,
  "failed": 0,
  "results": [
    { "actionId": "968768529cdfde8d56686a71e1c28227", "status": "applied", "memoryId": "bd14a67ed215c114896325d912c8fa71" }
  ]
}

Key parameters

For parameter value ranges, see Limitations and notes.

Parameter

Description

scopes

Scopes to consolidate. Required. Up to 20 items.

actionIds

Action IDs to apply. Required for ApplyMemoryDreamActions; empty arrays are rejected. Obtain the IDs from the ListMemoryDreamActions response.

confidenceThresholds

Auto-apply thresholds. Keys: add / update / merge; values from 0 to 1. DELETE actions do not support auto thresholds and always remain as proposals.

scopeOutputMode

Scope of the resulting memories: preserve_scope (default; keeps the original scope) or promote_scope (promotes to a higher-level scope).

incremental

When set to true, consolidation resumes from the progress of the last successful run (suitable for scheduled triggers). Defaults to false for full consolidation.

minTimestamp / maxTimestamp

Restricts the time range of messages included in the consolidation.

maxSessions

Maximum number of sessions processed in a single consolidation run.

maxMessages

Maximum number of messages processed in a single consolidation run.

maxMemories

Maximum number of memories processed in a single consolidation run.

expandedScopeLimit

Maximum number of scopes after expansion.

instructions

Custom consolidation instructions, up to 4,000 characters.

Best practices

  • Do not block the online request path while waiting for consolidation results. Consolidation runs in the background; poll GetMemoryDreamTask for progress.

  • Use proposal mode in production and apply actions only after human or programmatic confirmation. When you trust the results, define confidenceThresholds for add, update, and merge, and switch to safe_auto mode.

  • For scheduled consolidation, set incremental=true to avoid full reprocessing on each run.