# uip agent memory

> Syntax and options for `uip agent memory`, which attaches, lists, and removes memory spaces on a low-code agent and adds, lists, disables, enables, or removes the items a deployed memory space holds.

`uip agent memory` manages the memory-space features attached to an agent: a memory space is a retrieval-augmented recall source the agent can search against at runtime. `uip agent memory item` adds, lists, disables, enables, and removes the items a memory space holds at runtime. Items come from real agent runs: feedback left on a run's trace (episodic items) or an escalation span the agent raised (escalation items).

`memory add`, `memory list`, and `memory remove` edit the local agent project. The `memory item` verbs read and write the deployed runtime memory space, and require login. Run `uip login` first.

## Synopsis

```
uip agent memory add    <name> --memory-space <name> [--folder-path <path>] [--reference-key <key>] [--description <desc>] [--threshold <n>] [--result-count <n>] [--search-mode <hybrid|semantic>] [--field <name=weight>]... [--disable-dynamic-few-shot] [--path <dir>]
uip agent memory list   [--path <dir>]
uip agent memory remove <name> [--folder-path <path>] [--path <dir>]

uip agent memory item add  <name> --memory-type episodic --feedback-id <id> [--folder-path <path> | --folder-key <key>] [--path <dir>]
uip agent memory item add  <name> --memory-type escalation --trace-id <id> --span-id <id> [--answer <text>] [--folder-path <path> | --folder-key <key>] [--path <dir>]
uip agent memory item list <name> [--memory-type <episodic|escalation>] [--folder-path <path> | --folder-key <key>] [--path <dir>]
uip agent memory item disable <name> (--item-id <ids...> | --feedback-id <ids...>) [--folder-path <path> | --folder-key <key>] [--path <dir>]
uip agent memory item enable  <name> (--item-id <ids...> | --feedback-id <ids...>) [--folder-path <path> | --folder-key <key>] [--path <dir>]
uip agent memory item remove  <name> (--item-id <ids...> | --feedback-id <ids...>) [--folder-path <path> | --folder-key <key>] [--path <dir>] --yes
```

All invocations honor the [global options](./global-options.md) (`--output`, `--output-filter`, `--log-level`, `--log-file`). Exit codes follow the [standard contract](./exit-codes.md).

## uip agent memory add

Attach a memory space to the agent.

### Arguments

- `<name>` *(required)* — Feature name to use in the agent.

### Options

| Flag | Default | Required | Purpose |
|---|---|---|---|
| `--memory-space <name>` | — | yes | Memory space name to attach. |
| `--folder-path <path>` | `solution_folder` inside a solution | outside a solution | Folder path where the memory space exists. Required when the agent project is not inside a solution. |
| `--reference-key <key>` | — | | Memory space solution resource key. When omitted, the key is resolved from the enclosing solution. |
| `--description <desc>` | — | | Memory space description. |
| `--threshold <n>` | `0` | | Retrieval score threshold. |
| `--result-count <n>` | `3` | | Number of results to retrieve (positive integer). |
| `--search-mode <mode>` | `hybrid` | | `hybrid` or `semantic`. |
| `--field <name=weight>` | — | | Input field weight. Repeatable. |
| `--disable-dynamic-few-shot` | off | | Attach the memory space without enabling dynamic few-shot retrieval (enabled by default). |
| `--path <path>` | `.` | | Path to the agent project directory. |

### Solution resource

When the agent project is inside a solution and `--reference-key` is omitted, `memory add` links the feature to the memory space resource the solution declares. `Data.SolutionResource.Status` reports the outcome:

| Status | Meaning |
|---|---|
| `NotInSolution` | No solution encloses the project. Nothing is declared or linked. |
| `Linked` | The solution already declares this memory space. The feature carries its key. |
| `Created` | The memory space is in `solution_folder` and the solution did not declare it. The command declares it in the solution and links the feature. |
| `NotDeclared` | The memory space is in a folder other than `solution_folder` and the solution does not declare it. `Instructions` gives the `uip solution resources add --source remote` command to run. |
| `Provided` | The key came from `--reference-key`. |

If writing the feature fails after the command declared the memory space in the solution, the command removes that declaration again. Refer to [uip solution resources](./uip-solution-resources.md) to manage solution resources directly.

### Examples

```bash
# Standalone agent project: --folder-path is required
uip agent memory add SupportRecall --memory-space customer-support-recall --folder-path Shared --path ./my-agent

# Inside a solution: declare the memory space as a solution resource and link it
uip agent memory add SupportRecall --memory-space customer-support-recall --path ./my-agent
```

### Data shape (--output json)

```json
{
  "Code": "AgentMemoryAdd",
  "Data": {
    "Status": "Memory space added",
    "Name": "SupportRecall",
    "MemorySpace": "customer-support-recall",
    "FolderPath": "solution_folder",
    "DynamicFewShotEnabled": true,
    "Id": "a1b2c3d4-0000-0000-0000-000000000070",
    "ReferenceKey": "a1b2c3d4-0000-0000-0000-000000000071",
    "SolutionResource": {
      "Status": "Created",
      "Key": "a1b2c3d4-0000-0000-0000-000000000071",
      "Solution": "./MySolution/MySolution.uipx"
    }
  }
}
```

## uip agent memory list

### Options

| Flag | Default | Purpose |
|---|---|---|
| `--path <path>` | `.` | Path to the agent project directory. |

### Example

```bash
uip agent memory list --path ./my-agent
```

### Data shape (--output json)

```json
{
  "Code": "AgentMemoryList",
  "Data": [
    { "Name": "SupportRecall", "MemorySpace": "customer-support-recall", "FolderPath": "Shared", "DynamicFewShotEnabled": true, "Id": "a1b2c3d4-0000-0000-0000-000000000070" }
  ]
}
```

## uip agent memory remove

### Arguments

- `<name>` *(required)* — Feature name, memory space name, or ID to remove.

### Options

| Flag | Purpose |
|---|---|
| `--folder-path <path>` | Folder path, when removing by memory space name. |
| `--path <path>` | Path to the agent project directory (default `.`). |

### Example

```bash
uip agent memory remove SupportRecall --path ./my-agent
```

### Data shape (--output json)

```json
{ "Code": "AgentMemoryRemove", "Data": { "Status": "Memory space removed", "Name": "SupportRecall" } }
```

A memory space not found by name/ID fails the command with a non-zero exit code.

## uip agent memory item add

Promote an agent run into the runtime memory space. The item type decides which run data the item comes from:

| `--memory-type` | Source | Required options |
|---|---|---|
| `episodic` (or `0`) | Feedback left on a run's trace. Create it with [`uip traces feedback create`](./uip-traces-feedback.md#uip-traces-feedback-create). | `--feedback-id` |
| `escalation` (or `1`) | An escalation span the agent raised. Find the trace and span IDs with [`uip traces spans get`](./uip-traces.md#uip-traces-spans-get). | `--trace-id`, `--span-id` |

### Arguments

- `<name>` *(required)* — Feature name, memory space name, or ID.

### Options

| Flag | Required | Purpose |
|---|---|---|
| `--memory-type <type>` | yes | `episodic` (`0`) or `escalation` (`1`). |
| `--feedback-id <id>` | for `episodic` | Feedback to promote. |
| `--trace-id <id>` | for `escalation` | Trace of the escalation span. |
| `--span-id <id>` | for `escalation` | Escalation span to store. |
| `--answer <text>` | | Answer stored with an escalation item. |
| `--folder-path <path>` | when the feature folder is `solution_folder` | Orchestrator folder the memory space lives in at runtime. Defaults to the folder of the agent feature. |
| `--folder-key <key>` | | Orchestrator folder key, instead of `--folder-path`. |
| `--path <path>` | | Path to the agent project directory (default `.`). |

Pass either `--folder-path` or `--folder-key`, not both. When the feature points at `solution_folder`, pass the folder the solution is deployed to; [`uip solution deploy list`](./uip-solution-deploy.md#uip-solution-deploy-list) shows it.

### Examples

```bash
# Promote feedback on a run as an episodic item
uip agent memory item add SupportRecall --memory-type episodic --feedback-id 2f1e0c3a-0000-0000-0000-000000000010 --folder-path Shared/MySolution --path ./my-agent

# Store an escalation, with its answer, as an escalation item
uip agent memory item add SupportRecall --memory-type escalation --trace-id 3c4d5e6f-0000-0000-0000-000000000020 --span-id 4d5e6f70-0000-0000-0000-000000000021 --answer "Refund within 14 days" --folder-key 5c1eab29-0000-0000-0000-000000000030 --path ./my-agent
```

### Data shape (--output json)

```json
{
  "Code": "AgentMemoryItemAdd",
  "Data": {
    "Status": "Memory item added",
    "Memory": "SupportRecall",
    "MemorySpace": "customer-support-recall",
    "MemorySpaceId": "a1b2c3d4-0000-0000-0000-000000000090",
    "FolderPath": "Shared/MySolution",
    "FolderKey": "5c1eab29-0000-0000-0000-000000000030",
    "MemoryType": 0,
    "FeedbackId": "2f1e0c3a-0000-0000-0000-000000000010",
    "TraceId": null,
    "SpanId": null,
    "Id": "a1b2c3d4-0000-0000-0000-000000000080"
  }
}
```

For an escalation item, `FeedbackId` is `null`, and `TraceId` and `SpanId` carry the values passed.

A feedback is promoted once. Adding a feedback that the memory space already holds fails with `ErrorCode: "invalid_argument"`, and `Instructions` names the existing item. To promote it again, remove that item first with [`memory item remove`](#uip-agent-memory-item-remove).

## uip agent memory item list

List the items the runtime memory space holds, in the folder the solution is deployed to.

### Arguments

- `<name>` *(required)* — Feature name, memory space name, or ID.

### Options

| Flag | Purpose |
|---|---|
| `--memory-type <type>` | Only items of this type: `episodic` (`0`) or `escalation` (`1`). |
| `--folder-path <path>` | Orchestrator folder the memory space lives in at runtime. Defaults to the folder of the agent feature; required when that folder is `solution_folder`. |
| `--folder-key <key>` | Orchestrator folder key, instead of `--folder-path`. |
| `--path <path>` | Path to the agent project directory (default `.`). |

### Example

```bash
uip agent memory item list SupportRecall --folder-path Shared/MySolution --path ./my-agent
```

### Data shape (--output json)

```json
{
  "Code": "AgentMemoryItemList",
  "Data": [
    {
      "Id": "a1b2c3d4-0000-0000-0000-000000000080",
      "MemoryType": 0,
      "Status": 0,
      "FeedbackId": "2f1e0c3a-0000-0000-0000-000000000010",
      "TraceId": null,
      "SpanId": null,
      "AgentId": "a1b2c3d4-0000-0000-0000-000000000001",
      "UserEmail": "jane.doe@example.com",
      "UpdateTime": "2026-09-29T14:00:00.000Z"
    }
  ]
}
```

`Status` is `0` for an enabled item, which the agent retrieves at runtime, and `1` for a disabled item.

## uip agent memory item disable

Stop the agent from retrieving items, without deleting them. [`memory item enable`](#uip-agent-memory-item-enable) reverses it.

### Arguments

- `<name>` *(required)* — Feature name, memory space name, or ID.

### Options

| Flag | Purpose |
|---|---|
| `--item-id <ids...>` | Items to act on, by the `Id` that `memory item list` shows. Space-separated. |
| `--feedback-id <ids...>` | Items to act on, by the feedback they were promoted from, instead of `--item-id`. Space-separated. |
| `--folder-path <path>` | Orchestrator folder the memory space lives in at runtime. Defaults to the folder of the agent feature; required when that folder is `solution_folder`. |
| `--folder-key <key>` | Orchestrator folder key, instead of `--folder-path`. |
| `--path <path>` | Path to the agent project directory (default `.`). |

Pass exactly one of `--item-id` and `--feedback-id`. An empty ID is refused. Every ID is checked against the items the memory space holds before anything changes: an ID that the space does not hold fails the command with `ErrorCode: "not_found"`, and no item is changed. If a change of several items fails part way, `Instructions` names the items that were already changed.

### Example

```bash
uip agent memory item disable SupportRecall --item-id a1b2c3d4-0000-0000-0000-000000000080 --folder-path Shared/MySolution --path ./my-agent
```

### Data shape (--output json)

```json
{
  "Code": "AgentMemoryItemDisable",
  "Data": {
    "Status": "Memory items disabled",
    "Memory": "SupportRecall",
    "MemorySpace": "customer-support-recall",
    "MemorySpaceId": "a1b2c3d4-0000-0000-0000-000000000090",
    "FolderPath": "Shared/MySolution",
    "FolderKey": "5c1eab29-0000-0000-0000-000000000030",
    "Items": [
      {
        "Id": "a1b2c3d4-0000-0000-0000-000000000080",
        "FeedbackId": "2f1e0c3a-0000-0000-0000-000000000010",
        "MemoryType": 0,
        "Status": 1
      }
    ]
  }
}
```

`Items` lists the items that the command changed, with their status after the change.

## uip agent memory item enable

Let the agent retrieve disabled items again. The arguments, options, and ID checks are the same as for [`memory item disable`](#uip-agent-memory-item-disable).

### Example

```bash
uip agent memory item enable SupportRecall --item-id a1b2c3d4-0000-0000-0000-000000000080 --folder-path Shared/MySolution --path ./my-agent
```

### Data shape (--output json)

`Code` is `AgentMemoryItemEnable`, `Data.Status` is `Memory items enabled`, and each row in `Data.Items` has `Status: 0`. The other fields are the same as for `memory item disable`.

## uip agent memory item remove

Delete items from the memory space. The deletion cannot be undone. To keep an item but stop the agent from retrieving it, use [`memory item disable`](#uip-agent-memory-item-disable).

### Arguments

- `<name>` *(required)* — Feature name, memory space name, or ID.

### Options

| Flag | Purpose |
|---|---|
| `--item-id <ids...>` | Items to delete, by the `Id` that `memory item list` shows. Space-separated. |
| `--feedback-id <ids...>` | Items to delete, by the feedback they were promoted from, instead of `--item-id`. Space-separated. |
| `--folder-path <path>` | Orchestrator folder the memory space lives in at runtime. Defaults to the folder of the agent feature; required when that folder is `solution_folder`. |
| `--folder-key <key>` | Orchestrator folder key, instead of `--folder-path`. |
| `--path <path>` | Path to the agent project directory (default `.`). |
| `-y, --yes` | Required. Confirms the deletion. The CLI never prompts; without `--yes`, the command fails with `ErrorCode: "confirmation_required"`. |

The ID checks are the same as for [`memory item disable`](#uip-agent-memory-item-disable): nothing is deleted when the memory space does not hold one of the IDs.

### Example

```bash
# Remove the item promoted from a feedback
uip agent memory item remove SupportRecall --feedback-id 2f1e0c3a-0000-0000-0000-000000000010 --folder-path Shared/MySolution --path ./my-agent --yes
```

### Data shape (--output json)

```json
{
  "Code": "AgentMemoryItemRemove",
  "Data": {
    "Status": "Memory items removed",
    "Memory": "SupportRecall",
    "MemorySpace": "customer-support-recall",
    "MemorySpaceId": "a1b2c3d4-0000-0000-0000-000000000090",
    "FolderPath": "Shared/MySolution",
    "FolderKey": "5c1eab29-0000-0000-0000-000000000030",
    "Items": [
      {
        "Id": "a1b2c3d4-0000-0000-0000-000000000080",
        "FeedbackId": "2f1e0c3a-0000-0000-0000-000000000010",
        "MemoryType": 0,
        "Status": 0
      }
    ]
  }
}
```

`Items` lists the deleted items.

## Related

- [`uip agent validate`](./uip-agent-validate.md) — re-run after editing memory configuration.
- [`uip agent refresh`](./uip-agent-refresh.md) — regenerates derived files after a memory space is added.

## See also

- [Global options](./global-options.md), [Exit codes](./exit-codes.md).
