Skip to main content
When its conditions are met, Dreams creates a regular session in which the configured agent reads and updates files in the original memory store. Each Dreams policy is executed by a platform-managed trigger; the agent writes results directly back to the original memory store without creating a new one.
If a Dreams run fails, content already written is not rolled back automatically. Dreams may modify multiple files; restoring requires handling each file individually rather than rolling back an entire memory store at once.

Choose how to run Dreams

Manually duplicate the memory store

By default, Dreams updates the current memory store in place without creating a new one. If you want to prevent consolidation from affecting existing content, duplicate the memory store first and configure and run Dreams on the copy:
  1. On the memory store details page, click Duplicate memory store. The copy includes all current memory files without historical versions, leaving the original memory store unchanged.
  2. Create and run Dreams on the copy, then review the consolidated results.
  3. Select the copy when creating future sessions that need the consolidated content.

Official or custom Dreams agent

The official Dreams agent works well for most scenarios. When you want to customize what consolidation focuses on, you can select a custom agent in the console—for example:
  • Scope consolidation through agent instructions, such as organizing only project conventions and open issues, or focusing on Python-related discussions.
  • Consolidate only existing content in the memory store without referencing historical sessions.
  • Choose which model runs Dreams.
  • Pair the agent with skills or plugins to bring in relevant context during consolidation.
  • Run consolidation in parallel using subagents.
These are exploratory patterns rather than fixed templates. Because the core purpose of Dreams is distilling takeaways from past sessions, keep customizations centered on that goal.

Trigger modes

Manual triggering is ideal for validating consolidation quality and checking file versions first; once results match expectations, enable automatic triggering. Automatic triggering suits ongoing maintenance and can run when a set number of sessions change or on a daily schedule. The two conditions are independent, and meeting either condition triggers Dreams.

Configure automatic Dreams

Use an existing memory store ID to target the memory store you want to configure. When configuring the agent that runs Dreams, you can omit agent_id to use the platform’s default Dreams agent. Every update must include both the full activity and schedule objects; the update replaces both conditions rather than merging them. The two conditions are independent, and meeting either one triggers Dreams. Whenever either condition is enabled, environment_id must be provided. The example request below enables both the activity condition and the schedule condition. Replace MEMORY_STORE_ID, env_your_environment_id, and the optional agent_id with existing resource IDs.
The activity condition counts how many sessions attached to this memory store have changed since Dreams was last triggered (or since the condition was enabled). Once that count reaches min_changed_sessions (valid range: 1 to 100), the platform triggers a Dreams run. Regular sessions created by Dreams itself do not re-trigger this condition. The schedule condition triggers Dreams once a day at the specified local time. When triggered, the platform starts a Dreams run even if there have been no new sessions, letting the agent check whether the memory store needs updates. local_time uses HH:mm format, and timezone uses an IANA time zone name. If you need only one condition, set enabled to false on the other while still including both the activity and schedule objects in the request body. You can also open the memory store details page in the console and click Configure; see Using the Console:
  • Changed sessions: Runs after 1–100 changed sessions, corresponding to activity.
  • Daily schedule: Runs daily at HH:mm in an IANA time zone, corresponding to schedule.
  • Dream agent: Uses the official Dream Agent by default, or lets you switch to a custom agent.
  • Environment: Required when either trigger condition is enabled; when a run starts, the session mounts the current memory store in read-write mode.
Saving generates a new configuration version.

Disable automatic Dreams

Set enabled to false on both conditions to disable automatic Dreams. environment_id is not required when disabling both conditions. Save agent_id from the current policy response as DREAM_AGENT_ID first to preserve the currently configured Dreams agent. If you are currently using the platform’s default Dreams agent, you can set DREAM_AGENT_ID to agent_dream.
Omitting agent_id selects the platform’s default Dreams agent.

Inspect the current policy

After updating, query the Dreams policy and save trigger_id from the response. trigger_id identifies the trigger managed by the Dreams policy. A trigger is a rule that starts an agent session when its conditions are met. Whenever the activity condition or schedule condition is satisfied, the platform creates a Dreams session through this trigger. Query command:
Example response:
Save trigger_id from the response as TRIGGER_ID. You will need this value to run Dreams manually and inspect run records. Because this trigger is managed centrally through the Dreams policy endpoint, it cannot be updated, paused, resumed, or archived via the triggers endpoints. Continue using the Dreams policy endpoint whenever you need to adjust trigger conditions or disable automatic Dreams. To run Dreams immediately, call the run endpoint on this trigger.

Run Dreams manually

The Dreams policy does not expose a separate immediate-run endpoint. Call the trigger’s run endpoint to trigger a Dreams run manually:
Example response:
The run endpoint executes the trigger synchronously and returns the run record in a terminal state (completed, failed, or skipped). id in the response is the ID of this TriggerRun. Save it as TRIGGER_RUN_ID to query the status of this run. A manual run uses only the current policy: it does not accept extra session parameters or instructions, and it does not change the activity condition’s progress or the schedule. Enabled conditions continue to trigger afterward as configured. Every trigger execution creates a TriggerRun; the existing memory store is updated only when a session is actually created and executed, and a run entry is appended to .dream/log.md—including no-op records when no other updates were needed.

Inspect trigger runs

A TriggerRun is a run record that tracks the execution status of Dreams and its associated session. Use TRIGGER_RUN_ID from the previous step to query the latest status of this run:
Example response:
Run statuses include running, completed, failed, and skipped. running means the session is starting, failed means the run failed (see error for details), and skipped means the trigger was not active when fired. completed indicates only that the platform created the session and accepted its initial event—it does not mean Dreams has finished consolidating memories. Check the session events for session_id and the memory store versions to confirm the actual outcome of Dreams. If the run record does not yet include session_id, no session has been created or linked for this run, so you cannot query a session for it. To inspect historical runs, list all TriggerRun records for the trigger:

Inspect the associated session

After obtaining session_id from the run record, query the session created by this run:
Replace SESSION_ID with session_id from the TriggerRun response. Inspect session events to follow what happened during the Dreams run:
To stream ongoing status and output during execution, see Event Stream.

Inspect memory store changes

Dreams may modify multiple files in a memory store. List the files first and pick the ID of the file you want to inspect:
Save id of the target file from the previous step as MEMORY_ID, then query its version list (ordered from newest to oldest):
Regular sessions created by Dreams use source: "session", with source_id set to the ID of that Dreams session. source set to api indicates a direct API write; versions generated when restoring a file via the API also use api. Save session_id from the TriggerRun response and filter the version list for source equal to session and source_id equal to that session ID to locate every change produced by that Dreams run. Then check operation (created, modified, renamed, or deleted), path, and created_at to determine whether the run created, modified, renamed, or deleted the file. To read file content, choose a version whose operation is not "deleted" and that has no redacted_at, and save its id as VERSION_ID:
The returned content is Base64-encoded. A version with operation set to "deleted" is only a deletion marker without content, and a version with redacted_at has had its content erased. When restoring a deleted file, use the most recent readable version prior to deletion rather than the deletion marker itself, and call POST /v1/memory-stores/{id}/memories with the original path to recreate it (which generates a new memory_id; see Memory). You cannot call the GET or PATCH endpoints in the next section on a deleted memory_id (they return 404). Because a failed Dreams run may leave partial file changes behind, inspect each affected file individually.

Restore files

Restoring a file that has not been deleted writes the body of a historical version back to the current file. Save content from the historical version response obtained in the previous section as HISTORICAL_CONTENT. Before restoring, re-read the current file to get the latest content_sha256:
Save content_sha256 from the current file response as CONTENT_SHA256. You only need content_sha256 here—content in the current file response is not used for this restoration. CONTENT_SHA256 must be the exact value returned by the endpoint; do not fabricate or modify it. Next, write the historical version’s body back to the current file:
On success, the platform returns the updated file; if the content changed, a new file version is created for this restoration, whereas writing content identical to the current file does not create a new version. Use the new content_sha256 from the response for any subsequent updates to the file. If the current file was modified by another operation after you read it, the stale content_sha256 no longer matches and the update returns HTTP 409 without overwriting the newer content. Re-read the current file to obtain the latest content_sha256 before deciding whether to continue restoring. When restoring multiple files, read the latest content_sha256 and perform the update for each file individually, verifying each restoration result separately; files already restored are not rolled back if a subsequent update fails.

Maintenance and best practices

  • Organize memory stores by long-term purpose—for example, project-conventions for project standards and architecture decisions, customer-context for long-term customer background and preferences, research-findings for verified research conclusions, and operations for runbooks and incident lessons. Clear memory store descriptions help agents decide when to read and update them.
  • Keep README.md and index.md concise as entry points. Whenever you add, move, rename, or delete files, update the links and summaries in index.md so they stay consistent with the actual contents.
  • Avoid making heavy concurrent edits to the same memory store while Dreams is running to reduce the risk of write conflicts.
  • Automatic Dreams consumes model quota, so configure trigger frequency according to your needs and periodically review consolidated results to ensure they remain accurate, relevant, and easy to reuse.

Memory

Create memory stores, mount them in sessions, and manage memory versions.

Create a Session

Learn how to create sessions and configure memory store bindings.

Agents

Configure the agent that runs Dreams.