> ## Documentation Index
> Fetch the complete documentation index at: https://docs.qoder.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Dream Schemas

> Dream object, input/output, and status schemas.

## Dream object

All Dream endpoints return the Dream object.

| Field          | Type           | Description                                                       |
| -------------- | -------------- | ----------------------------------------------------------------- |
| `id`           | string         | Dream ID, prefixed with `drm_`                                    |
| `type`         | string         | Always `"dream"`                                                  |
| `status`       | string         | Dream status, see [Dream status](#dream-status)                   |
| `inputs`       | array          | Input list, see [Dream input](#dream-input)                       |
| `outputs`      | array          | Output list, see [Dream output](#dream-output)                    |
| `model`        | object         | Model used, format `{"id": "auto"}`                               |
| `instructions` | string         | Custom consolidation instructions, max 4096 characters            |
| `session_id`   | string or null | Associated Dreaming Session ID (populated after execution starts) |
| `usage`        | object         | Token usage statistics                                            |
| `error`        | object or null | Error details on failure                                          |
| `created_at`   | string         | UTC creation time (ISO 8601)                                      |
| `ended_at`     | string or null | UTC end time (only for terminal states)                           |
| `archived_at`  | string or null | UTC archive time                                                  |

## Dream status

| Value       | Description                                |
| ----------- | ------------------------------------------ |
| `pending`   | Created, awaiting execution                |
| `running`   | Memory consolidation in progress           |
| `completed` | Consolidation finished; results in outputs |
| `failed`    | Execution failed; reason in error          |
| `canceled`  | Canceled by user                           |

## Dream input

Each element in the `inputs` array:

| type value     | Required fields   | Description                                                   |
| -------------- | ----------------- | ------------------------------------------------------------- |
| `memory_store` | `memory_store_id` | Specifies the input Memory Store (required, only one allowed) |
| `sessions`     | `session_ids`     | Specifies Sessions to prioritize (optional, max 100 IDs)      |

## Dream output

After completion, elements in the `outputs` array:

| Field             | Type   | Description                                    |
| ----------------- | ------ | ---------------------------------------------- |
| `type`            | string | Always `"memory_store"`                        |
| `memory_store_id` | string | The consolidated output Memory Store ID        |
| `files_touched`   | array  | Paths of memory files created/modified/deleted |

## Dream usage

| Field                         | Type    | Description                |
| ----------------------------- | ------- | -------------------------- |
| `input_tokens`                | integer | Input token count          |
| `output_tokens`               | integer | Output token count         |
| `cache_creation_input_tokens` | integer | Cache creation token count |
| `cache_read_input_tokens`     | integer | Cache read token count     |

## Dream error

Error object returned on failure:

| Field     | Type   | Description                                         |
| --------- | ------ | --------------------------------------------------- |
| `type`    | string | Error type (e.g. `"no_output"`, `"internal_error"`) |
| `message` | string | Error description                                   |
