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

# lua resources

> The agent's knowledge resources: list, view and delete them by name or id; create and update in the menu or the admin dashboard

`lua resources` reads and deletes the documents the agent's Knowledge Search (`rag`) [feature](/concepts/knowledge-and-features) draws on. A deletion takes effect for every end user at once.

*Verified against lua-cli 3.33.0.*

## Synopsis

```bash theme={null}
lua resources [action] [--resource-name <name>]
lua resources <list|view|delete> --resource-name <name>
```

## Description

A resource is a named text document that belongs to the agent. `list`, `view` and `delete` run without a prompt; `--resource-name` accepts the resource's id exactly or its name case-insensitively. Creating and updating a resource needs an editor for the content, so those two live only in the menu the bare command opens (`Create new resource`, `Update existing resource`, both in `$EDITOR`) and in the [admin dashboard](/get-started/for-operators).

A non-interactive `delete` asks nothing. If the list cannot be fetched the command prints `⚠️  Error loading resources` and continues with an empty list, so `list` then reports no resources.

<Warning>
  `lua resources delete --resource-name <name>` removes the document permanently and without confirmation. Run `lua resources view` first if you are unsure which document the name matches.
</Warning>

## Arguments

| Argument | Values                   | Description                                                                                                  |
| -------- | ------------------------ | ------------------------------------------------------------------------------------------------------------ |
| `action` | `list`, `view`, `delete` | Aliases: `ls`, `l` → `list`; `show`, `info` → `view`; `rm`, `remove`, `del` → `delete`. Omit it for the menu |

### Actions

| Action   | Description                   | Prints                                                                   |
| -------- | ----------------------------- | ------------------------------------------------------------------------ |
| `list`   | Every resource with a preview | `<n>. <name>` and `Preview:` with the first 60 characters of the content |
| `view`   | One resource in full          | `📄 Resource: <name>`, `Created:`, `Updated:`, then the content          |
| `delete` | Remove one resource           | `✅ Resource "<name>" deleted successfully`                               |

## Options

| Option                   | Description                                                                       | Default |
| ------------------------ | --------------------------------------------------------------------------------- | ------- |
| `--resource-name <name>` | Resource name (case-insensitive) or resource id. Required for `view` and `delete` | —       |

Omitting it is `✖ usage: --resource-name is required for action "<action>"` (exit 2) with the resource names as the hint; no match is `✖ not_found: Resource "<name>" not found` (exit 3).

## Examples

List the agent's resources.

```bash theme={null}
lua resources list --ci
```

```text Output theme={null}
============================================================
📚 Agent Resources
============================================================

ℹ️  No resources configured.

💡 Resources are knowledge base documents your agent can reference.
```

Print one document and then remove it.

```bash theme={null}
lua resources view --resource-name "Return Policy" --ci
lua resources delete --resource-name "Return Policy" --ci
```

Open the menu to create or edit a document in your editor.

```bash theme={null}
lua resources
```

## Exit codes

| Code | Meaning                                          |
| ---- | ------------------------------------------------ |
| `0`  | Success                                          |
| `1`  | The delete failed (`Operation failed`)           |
| `2`  | Usage: unknown action, missing `--resource-name` |
| `3`  | Resource not found                               |
| `9`  | Not signed in (401)                              |
| `10` | Forbidden (403 or another 4xx)                   |
| `11` | Unavailable: 5xx, connection refused, timeout    |
| `12` | The model provider refused the request (424)     |

## See also

* [Add knowledge](/build/add-knowledge) — resources, `rag` and when to use `Data` instead
* [Knowledge and features](/concepts/knowledge-and-features)
* [`lua features`](/reference/cli/features) — turn `rag` on or off
