---
title: "Agent Memory"
canonical: https://trickest.com/docs/developer-tools/cli/memory
description: "Create, read, search, and manage the AI agent persistent memory entries from the CLI."
---

# Agent Memory

The `memory` family manages the AI agent's **persistent memory** — durable notes the
agent can recall across sessions. Each entry has a **key**, a **type**, an
**importance** (1–5), and **content**. Memory is scoped to your vault.

<Note>
Mutating commands like `memory set` print a human status line **and** the JSON
entry. Add `--quiet` if you're parsing stdout as JSON.
</Note>

## Command summary

| Subcommand | Description |
|---|---|
| `memory ls` | List memory entries |
| `memory get\|read <key-or-id>` | Get one entry |
| `memory set\|write <key> <value>` | Create or update an entry |
| `memory append <key-or-id> <content>` | Append to an existing entry |
| `memory rm\|delete <key-or-id>` | Delete an entry |
| `memory log <content>` | Append to the daily log |
| `memory search <query>` | Semantic similarity search |
| `memory backup` / `export` | Dump all entries as JSON |
| `memory restore` / `import` | Restore from a backup (reads JSON from stdin) |

## The lifecycle

A complete round-trip:

```bash
trickest memory set scope:notes "In-scope: *.example.com" --importance 4
```
```text
Memory entry created: f2be3e9b-…
{"id":"f2be3e9b-…","type":"section","importance":4,"content":"In-scope: *.example.com","created_at":"2026-06-03T20:58:38Z"}
```

```bash
trickest memory get scope:notes
```
```json
{"id":"f2be3e9b-…","vault_id":"e54ccb18-…","type":"section","importance":4,"content":"In-scope: *.example.com","metadata":"{}","created_at":"2026-06-03T20:58:38Z","updated_at":"2026-06-03T20:58:38Z"}
```

```bash
trickest memory rm scope:notes
# Memory entry deleted: scope:notes
```

After deletion, `get` returns an error (exit code 1):

```json
{"code":"ERR_UNEXPECTED","message":"Memory entry not found: key=scope:notes, type=section","hint":null}
```

## `memory set`

```bash
trickest memory set <key> "<value>" --type note --importance 5
```

| Flag | Description |
|---|---|
| `--type <type>` | `section` (default), `log`, `plan`, `workflow_meta`, `session_chunk`, `session_memory`, `workflow_context`, `note` |
| `--importance <n>` | Importance 1–5 |

`set` is upsert: calling it again with the same key updates the entry. Use
`append` to add to existing content instead of replacing it:

```bash
trickest memory append scope:notes "Exclude api.example.com"
```

## `memory ls`

```bash
trickest memory ls --type note --importance 3 --sort importance --limit 20
```

| Flag | Description |
|---|---|
| `--type <type>` | Filter by type (same set as `set`) |
| `--importance <min>` | Minimum importance (1–5) |
| `--sort <field>` | `recent` (default), `oldest`, or `importance` |
| `--limit <n>` | Maximum entries to show |

<Warning>
Unfiltered, `memory ls` can return a very large payload (the agent accumulates many
entries). Always filter with `--type`/`--importance` or cap with `--limit`, and use
`memory search` to find specific entries.
</Warning>

## `memory search`

Semantic (similarity) search over entries:

```bash
trickest memory search "which domains are in scope" --limit 5
```

| Flag | Description |
|---|---|
| `--limit <n>` | Maximum results to return |

## Daily log

`memory log` appends a timestamped entry to the daily log — useful for the agent to
journal progress:

```bash
trickest memory log "Finished discovery pipeline, 412 live hosts"
```

## Backup & restore

```bash
trickest memory backup > memory-backup.json        # or: memory export
cat memory-backup.json | trickest memory restore    # or: memory import
```

## Related

<CardGroup cols={2}>
  <Card title="Sessions & Skills" icon="robot" href="/docs/developer-tools/cli/sessions-skills">
    The agent sessions and installable skills that use memory.
  </Card>
  <Card title="Notifications & Audit" icon="bell" href="/docs/developer-tools/cli/notifications-audit">
    Track activity and platform events.
  </Card>
</CardGroup>

---
_Markdown source of https://trickest.com/docs/developer-tools/cli/memory._
