---
title: "openemail knowledge"
description: "Every command in this namespace, with its arguments, flags and examples."
url: "https://openemail.uk/docs/cli/reference/knowledge"
area: "CLI"
category: "Reference"
---

# openemail knowledge

Every command in this namespace, with its arguments, flags and examples.

## Commands

### `openemail knowledge list`

List one page of the knowledge base

```bash
openemail knowledge list [flags]
```

Resolves one page of the knowledge base, newest first: the notes, files and web pages the AI uses when it writes replies, drafts email and answers in the assistant. Each item says where it sits, whether the AI can use it yet and how much text was read from it.

Every item sits at one level, its `scope`: an empty string for the whole workspace, `@` and a domain for everything on that domain (`@acme.com`), or one address (`sales@acme.com`). The AI writing for an address reads that address, then its domain, then the whole workspace, the most specific first. `level` names the kind of level, `workspace`, `domain` or `address`.

`status` is `queued` or `processing` while the text is read and indexed, `ready` once the AI can use it, and `failed` with a `failure` when it could not be read. A key or an app limited to particular addresses sees the whole-workspace items and the items at its addresses and at their domains.

Each item also says how the AI uses it: `uses` counts the times it came up in a reply suggestion, a draft, the assistant or a search, with `lastUsedAt` the latest, and `flags` counts the open duplicate and conflict flags that name it. A link read again on a schedule has `refreshDays` and `nextRefreshAt`, a page kept by a connector names it in `connectorId`, and a note saved from a conversation names it in `threadId`.

Add `--all` to walk every page: a table on a terminal, one JSON object per line when piped or with `--ndjson`, and one `{ items, hasMore, nextCursor }` document with `--json`. `--max <n>` stops after that many items.

- Scopes: `knowledge:read`.
- Needs a sign-in.
- Aliases: `ls`.

**Flags**

- `--scope <value>`: Keeps the items at exactly this level: `@` and a domain such as `@acme.com`, or one address. An empty string is not sent, so ask for the whole-workspace items with `level: 'workspace'`.
- `--level <value>`: Keeps one kind of level: `workspace`, `domain` or `address`.
- `--kind <value>`: Keeps one kind of item: `note`, `file` or `link`.
- `--status <value>`: Keeps one status: `queued`, `processing`, `ready` or `failed`.
- `--pinned`: `true` keeps the pinned notes and `false` everything else.
- `--q <value>`: Words in the title, the file name or the link, matched without regard to case or accents.
- `--limit <n>` (default `25`): Page size, from 1 to 100. The server defaults to 50.
- `--cursor <value>`: The `nextCursor` of the previous page. Leave it out for the first page.
- `--all`: Fetch every page and stream the items as they arrive.
- `--max <n>`: Stop after this many items. Implies `--all`.
- `--ndjson`: Print every item as one JSON object per line. Implies `--all`

**Examples**

```bash
openemail knowledge list
```

With optional flags

```bash
openemail knowledge list --level domain --kind file
```

Walk every page and stop after 100 items

```bash
openemail knowledge list --all --max 100
```

One JSON object per line when piped

```bash
openemail knowledge list --all > knowledge.ndjson
```

Also available in: API [`GET /knowledge`](https://openemail.uk/docs/api/reference/knowledge#get-knowledge); TypeScript [`knowledge.list()`](https://openemail.uk/docs/sdk/reference/knowledge#list); Python [`knowledge.list()`](https://openemail.uk/docs/python/reference/knowledge#list); Ruby [`knowledge.list`](https://openemail.uk/docs/ruby/reference/knowledge#list); PHP [`knowledge->list`](https://openemail.uk/docs/php/reference/knowledge#list).

### `openemail knowledge levels`

List the levels knowledge can sit at

```bash
openemail knowledge levels [flags]
```

Resolves every level the caller can see: the whole workspace first, then each domain, then each address, with how many items each holds and whether the caller may add and change items there. Pass its `scope` when you add an item.

A key or an app limited to particular addresses sees the whole workspace, its addresses and their domains. `writable` is true at the whole workspace only for a caller that reaches every address, at a domain for one that holds the whole domain, and at an address for one that holds that address.

- Scopes: `knowledge:read`.
- Needs a sign-in.

**Examples**

```bash
openemail knowledge levels
```

Print the raw JSON

```bash
openemail knowledge levels --json
```

Also available in: API [`GET /knowledge/levels`](https://openemail.uk/docs/api/reference/knowledge#get-knowledge-levels); TypeScript [`knowledge.levels()`](https://openemail.uk/docs/sdk/reference/knowledge#levels); Python [`knowledge.levels()`](https://openemail.uk/docs/python/reference/knowledge#levels); Ruby [`knowledge.levels`](https://openemail.uk/docs/ruby/reference/knowledge#levels); PHP [`knowledge->levels`](https://openemail.uk/docs/php/reference/knowledge#levels).

### `openemail knowledge usage`

Read how much of the plan the knowledge base uses

```bash
openemail knowledge usage [flags]
```

Resolves how many items and how many characters of text the workspace keeps in its knowledge base, beside what its plan allows in `limits`: 50 items and 1,000,000 characters on Free, 500 and 10,000,000 on Starter, 2,000 and 50,000,000 on Business, and 10,000 and 200,000,000 on Enterprise.

An item counts as soon as it is added, and its characters once its text has been read. The numbers are for the whole workspace, whatever the key may reach.

- Scopes: `knowledge:read`.
- Needs a sign-in.

**Examples**

```bash
openemail knowledge usage
```

Print the raw JSON

```bash
openemail knowledge usage --json
```

Also available in: API [`GET /knowledge/usage`](https://openemail.uk/docs/api/reference/knowledge#get-knowledge-usage); TypeScript [`knowledge.usage()`](https://openemail.uk/docs/sdk/reference/knowledge#usage); Python [`knowledge.usage()`](https://openemail.uk/docs/python/reference/knowledge#usage); Ruby [`knowledge.usage`](https://openemail.uk/docs/ruby/reference/knowledge#usage); PHP [`knowledge->usage`](https://openemail.uk/docs/php/reference/knowledge#usage).

### `openemail knowledge search`

Search the knowledge base the way the AI does

```bash
openemail knowledge search --query <value> [flags]
openemail knowledge search --data <json|@file|-> [flags]
```

Resolves the passages that best answer `query`, best first, found by meaning and by words the way the AI finds them when it writes. Each hit names the item it comes from in `sourceId`, with its title, kind, level and link, the headings the passage sits under and the passage itself.

With `address`, it searches the levels the AI uses for that address: the address, its domain and the whole workspace, the most specific ranked a little higher. With `scope`, it searches that one level, and `scope` wins when both are given. With neither, it searches every level the caller can see.

With `rerank: true`, the AI reads the best 25 passages and puts them in the order that best answers `query`, leaving out the ones that do not help. It adds a second or two and counts as one AI action, and `reranked` says whether it happened: when it cannot finish, the passages keep their usual order and `reranked` is false.

- Scopes: `knowledge:read`.
- Needs a sign-in.

**Flags**

- `--query <value>`: What to look for, in plain words, up to 500 characters. Required, here or in `--data`.
- `--address <value>`: An address of the workspace, to search the levels the AI uses when it writes as that address.
- `--scope <value>`: One level to search: an empty string for the whole workspace, `@` and a domain, or one address.
- `--limit <n>`: How many passages, from 1 to 25. The server defaults to 8.
- `--rerank`: Has the AI put the passages in the order that best answers `query`. Left out, false.
- `--data <json|@file|->`: The whole `body` as JSON, inline, from a file with @path, or - for standard input. Flags override its keys.

**Examples**

The required values only

```bash
openemail knowledge search --query 'How long do refunds take?'
```

With optional flags

```bash
openemail knowledge search --query 'How long do refunds take?' --address support@acme.com
```

Read the whole body from a JSON file

```bash
openemail knowledge search --data @knowledge.json
```

Also available in: API [`POST /knowledge/search`](https://openemail.uk/docs/api/reference/knowledge#post-knowledge-search); TypeScript [`knowledge.search()`](https://openemail.uk/docs/sdk/reference/knowledge#search); Python [`knowledge.search()`](https://openemail.uk/docs/python/reference/knowledge#search); Ruby [`knowledge.search`](https://openemail.uk/docs/ruby/reference/knowledge#search); PHP [`knowledge->search`](https://openemail.uk/docs/php/reference/knowledge#search).

### `openemail knowledge create-note`

Add a note to the knowledge base

```bash
openemail knowledge create-note --title <value> --body <value> [flags]
openemail knowledge create-note --data <json|@file|-> [flags]
```

Saves a note of up to 20,000 characters at one level and resolves with it. Markdown is kept, and its headings become the headings the passages sit under. A note is usually `ready` for the AI within a second or two, and `queued` or `processing` until then.

`pinned: true` puts the note into every prompt the AI writes at its level, not only when it matches what is being written. The AI reads at most 2,000 characters of pinned notes from each level, so keep them short.

Changing an item needs reach over every address its level covers: the whole workspace needs every address, a domain needs the whole domain, and an address needs that address. A key or an app limited to particular addresses can change items only at those addresses, or at domains it holds whole.

- Scopes: `knowledge:write`.
- Needs a sign-in.

**Flags**

- `--scope <value>` (default `""`): The level: an empty string, or left out, for the whole workspace, `@` and a domain such as `@acme.com`, or one address such as `sales@acme.com`.
- `--title <value>`: A short name for the note, at most 200 characters. Required, here or in `--data`.
- `--body <value>`: The text, up to 20,000 characters, in Markdown if you like. Required, here or in `--data`.
- `--pinned`: Puts the note into every prompt at its level. Left out, false.
- `--thread-id <value>`: The conversation the note comes from, such as the one `draftFromThread` read. It is kept on the note as `--thread-id`.
- `--data <json|@file|->`: The whole `body` as JSON, inline, from a file with @path, or - for standard input. Flags override its keys.

**Examples**

The required values only

```bash
openemail knowledge create-note --title Refunds --body 'Refunds are paid within 14 days of the return reaching our warehouse.'
```

With optional flags

```bash
openemail knowledge create-note --title Refunds --body 'Refunds are paid within 14 days of the return reaching our warehouse.' --scope @acme.com --pinned
```

Read the whole body from a JSON file

```bash
openemail knowledge create-note --data @knowledge.json
```

Also available in: API [`POST /knowledge/notes`](https://openemail.uk/docs/api/reference/knowledge#post-knowledge-notes); TypeScript [`knowledge.createNote()`](https://openemail.uk/docs/sdk/reference/knowledge#createNote); Python [`knowledge.create_note()`](https://openemail.uk/docs/python/reference/knowledge#createNote); Ruby [`knowledge.create_note`](https://openemail.uk/docs/ruby/reference/knowledge#createNote); PHP [`knowledge->createNote`](https://openemail.uk/docs/php/reference/knowledge#createNote).

### `openemail knowledge add-link`

Add a web page to the knowledge base

```bash
openemail knowledge add-link --url <value> [flags]
openemail knowledge add-link --data <json|@file|-> [flags]
```

Adds a public web page at one level and resolves with it, `queued`. The page is fetched and read in the background, and the AI uses it once its `status` is `ready`. Without a `title`, the item is named after the link until the page is read, and then after the page's own title.

`url` is a public `http` or `https` address of at most 2,048 characters, and it is kept as `https`. An address on a private or local host, or one with a user name, a password or a port, is refused. A level holds a page once, and `refresh` fetches it again after it changes. With `--refresh-days`, the page is also read again every 1, 7 or 30 days on its own, `nextRefreshAt` says when, and a changed page reaches the AI without a call.

Changing an item needs reach over every address its level covers: the whole workspace needs every address, a domain needs the whole domain, and an address needs that address. A key or an app limited to particular addresses can change items only at those addresses, or at domains it holds whole.

- Scopes: `knowledge:write`.
- Needs a sign-in.

**Flags**

- `--scope <value>` (default `""`): The level: an empty string, or left out, for the whole workspace, `@` and a domain such as `@acme.com`, or one address such as `sales@acme.com`.
- `--url <value>`: The page, a public `http` or `https` address of at most 2,048 characters. Required, here or in `--data`.
- `--title <value>`: A name for the item, at most 200 characters. Left out, the page's own title once it has been read.
- `--refresh-days <n>`: Reads the page again every 1, 7 or 30 days. Left out or `null`, it is read again only when you call `refresh`.
- `--data <json|@file|->`: The whole `body` as JSON, inline, from a file with @path, or - for standard input. Flags override its keys.

**Examples**

The required values only

```bash
openemail knowledge add-link --url https://acme.com/shipping
```

With optional flags

```bash
openemail knowledge add-link --url https://acme.com/shipping --scope @acme.com
```

Read the whole body from a JSON file

```bash
openemail knowledge add-link --data @knowledge.json
```

Also available in: API [`POST /knowledge/links`](https://openemail.uk/docs/api/reference/knowledge#post-knowledge-links); TypeScript [`knowledge.addLink()`](https://openemail.uk/docs/sdk/reference/knowledge#addLink); Python [`knowledge.add_link()`](https://openemail.uk/docs/python/reference/knowledge#addLink); Ruby [`knowledge.add_link`](https://openemail.uk/docs/ruby/reference/knowledge#addLink); PHP [`knowledge->addLink`](https://openemail.uk/docs/php/reference/knowledge#addLink).

### `openemail knowledge upload-file`

Upload a file to the knowledge base

```bash
openemail knowledge upload-file <data> [flags]
```

Stores a document or an image at one level and resolves with it, `queued`. Its text is read in the background, and the AI uses it once its `status` is `ready`. PDFs, Word documents, spreadsheets (Excel, OpenDocument, Numbers and CSV), OpenDocument text, HTML, XML, Markdown, plain text, JSON and images (JPEG, PNG, WebP and SVG) can be read.

`data` is a `Blob`, an `ArrayBuffer` or a `Uint8Array`, sent as the request body. The name travels as the `filename` query parameter, and the type is `--content-type`, a `Blob`'s own type when that is left out, or the extension of the name when the type is generic. A document can be up to 20 MB and an image up to 10 MB.

Changing an item needs reach over every address its level covers: the whole workspace needs every address, a domain needs the whole domain, and an address needs that address. A key or an app limited to particular addresses can change items only at those addresses, or at domains it holds whole.

- Scopes: `knowledge:write`.
- Needs a sign-in.

**Arguments**

- `<data>` (required): The file: a `Blob`, `ArrayBuffer` or `Uint8Array`, not empty, at most 20 MB for a document and 10 MB for an image.

**Flags**

- `--filename <value>`: The file name, such as `price-list.pdf`. Its extension tells the kind of file when the type is generic. A missing or blank name throws before anything is sent.
- `--content-type <value>`: The MIME type, such as `application/pdf`. Left out, a `Blob`'s own type is used, else the extension of `filename`.
- `--scope <value>`: The level: an empty string, or left out, for the whole workspace, `@` and a domain such as `@acme.com`, or one address such as `sales@acme.com`.
- `--title <value>`: A name for the item, at most 200 characters. Left out, the file name without its extension.
- `--timeout-ms <n>`: How long the upload may take, in milliseconds. Left out, it is 10 minutes, or the client `--timeout-ms` when that is longer. `0` waits as long as it takes.

**Examples**

The required values only

```bash
openemail knowledge upload-file ./photo.jpg
```

With optional flags

```bash
openemail knowledge upload-file ./photo.jpg --filename price-list.pdf --content-type application/pdf --scope sales@acme.com
```

Also available in: API [`POST /knowledge/files`](https://openemail.uk/docs/api/reference/knowledge#post-knowledge-files); TypeScript [`knowledge.uploadFile()`](https://openemail.uk/docs/sdk/reference/knowledge#uploadFile); Python [`knowledge.upload_file()`](https://openemail.uk/docs/python/reference/knowledge#uploadFile); Ruby [`knowledge.upload_file`](https://openemail.uk/docs/ruby/reference/knowledge#uploadFile); PHP [`knowledge->uploadFile`](https://openemail.uk/docs/php/reference/knowledge#uploadFile).

### `openemail knowledge get`

Read one knowledge item and its text

```bash
openemail knowledge get <id> [flags]
```

Resolves one item with its text: the `body` of a note, or in `preview` the first 20,000 characters read from a file or a page, with `previewTruncated` true when the text goes on past it. `preview` is null while a file or a page has not been read yet, and `body` is null for anything but a note.

- Scopes: `knowledge:read`.
- Needs a sign-in.
- Aliases: `show`, `view`.

**Arguments**

- `<id>` (required): The id of the item, `kb_` and 24 hex characters, as `list` returns it.

**Examples**

```bash
openemail knowledge get kb_8c1f4a2b9d7e3f60a5c7b21d
```

Print the raw JSON

```bash
openemail knowledge get kb_8c1f4a2b9d7e3f60a5c7b21d --json
```

Also available in: API [`GET /knowledge/{id}`](https://openemail.uk/docs/api/reference/knowledge#get-knowledge-id); TypeScript [`knowledge.get()`](https://openemail.uk/docs/sdk/reference/knowledge#get); Python [`knowledge.get()`](https://openemail.uk/docs/python/reference/knowledge#get); Ruby [`knowledge.get`](https://openemail.uk/docs/ruby/reference/knowledge#get); PHP [`knowledge->get`](https://openemail.uk/docs/php/reference/knowledge#get).

### `openemail knowledge update`

Change a knowledge item

```bash
openemail knowledge update <id> [flags]
```

Changes the title of an item, the text of a note, the page of a link, how often a link is read again, whether a note is pinned, or its level, and resolves with the item as it is now. Give at least one field. A changed title, text or link is read and indexed again, so the item goes back to `queued`, and its previous text stays in use until the new one is ready. Moving an item to another level needs no new reading.

Changing an item needs reach over every address its level covers: the whole workspace needs every address, a domain needs the whole domain, and an address needs that address. A key or an app limited to particular addresses can change items only at those addresses, or at domains it holds whole. Moving an item needs that reach at both levels.

- Scopes: `knowledge:write`.
- Needs a sign-in.
- Aliases: `edit`.

**Arguments**

- `<id>` (required): The id of the item, `kb_` and 24 hex characters, as `list` returns it.

**Flags**

- `--title <value>`: A new name, at most 200 characters.
- `--body <value>`: The new text of a note, up to 20,000 characters.
- `--scope <value>`: The level to move it to: an empty string for the whole workspace, `@` and a domain, or one address.
- `--pinned`: Whether a note goes into every prompt at its level.
- `--url <value>`: The new page of a link, a public `http` or `https` address.
- `--refresh-days <n>`: Reads a link again every 1, 7 or 30 days, counted from now. `null` stops that.
- `--data <json|@file|->`: The whole `patch` as JSON, inline, from a file with @path, or - for standard input. Flags override its keys.

**Examples**

With optional flags

```bash
openemail knowledge update kb_8c1f4a2b9d7e3f60a5c7b21d --body 'Refunds are paid within 10 days of the return reaching our warehouse.' --pinned
```

Print the raw JSON

```bash
openemail knowledge update kb_8c1f4a2b9d7e3f60a5c7b21d --body 'Refunds are paid within 10 days of the return reaching our warehouse.' --pinned --json
```

Also available in: API [`PATCH /knowledge/{id}`](https://openemail.uk/docs/api/reference/knowledge#patch-knowledge-id); TypeScript [`knowledge.update()`](https://openemail.uk/docs/sdk/reference/knowledge#update); Python [`knowledge.update()`](https://openemail.uk/docs/python/reference/knowledge#update); Ruby [`knowledge.update`](https://openemail.uk/docs/ruby/reference/knowledge#update); PHP [`knowledge->update`](https://openemail.uk/docs/php/reference/knowledge#update).

### `openemail knowledge delete`

Delete a knowledge item for good

```bash
openemail knowledge delete <id> [flags]
```

Removes an item with its file and every passage read from it, and the AI stops using it at once. There is no undo.

- Scopes: `knowledge:write`.
- Needs a sign-in.
- Asks you to confirm.
- Aliases: `rm`, `del`, `remove`.

**Arguments**

- `<id>` (required): The id of the item, `kb_` and 24 hex characters, as `list` returns it.

**Examples**

```bash
openemail knowledge delete kb_8c1f4a2b9d7e3f60a5c7b21d
```

Skip the confirmation, for scripts

```bash
openemail knowledge delete kb_8c1f4a2b9d7e3f60a5c7b21d --yes
```

Also available in: API [`DELETE /knowledge/{id}`](https://openemail.uk/docs/api/reference/knowledge#delete-knowledge-id); TypeScript [`knowledge.delete()`](https://openemail.uk/docs/sdk/reference/knowledge#delete); Python [`knowledge.delete()`](https://openemail.uk/docs/python/reference/knowledge#delete); Ruby [`knowledge.delete`](https://openemail.uk/docs/ruby/reference/knowledge#delete); PHP [`knowledge->delete`](https://openemail.uk/docs/php/reference/knowledge#delete).

### `openemail knowledge refresh`

Read a knowledge item again

```bash
openemail knowledge refresh <id> [flags]
```

Fetches a link again, reads a file again or indexes a note again, clears any `failure` and resolves with the item, back at `queued`. Use it after a page changed or when an item failed. The previous text stays in use until the new one is ready.

- Scopes: `knowledge:write`.
- Needs a sign-in.

**Arguments**

- `<id>` (required): The id of the item, `kb_` and 24 hex characters, as `list` returns it.

**Examples**

```bash
openemail knowledge refresh kb_8c1f4a2b9d7e3f60a5c7b21d
```

Print the raw JSON

```bash
openemail knowledge refresh kb_8c1f4a2b9d7e3f60a5c7b21d --json
```

Also available in: API [`POST /knowledge/{id}/refresh`](https://openemail.uk/docs/api/reference/knowledge#post-knowledge-id-refresh); TypeScript [`knowledge.refresh()`](https://openemail.uk/docs/sdk/reference/knowledge#refresh); Python [`knowledge.refresh()`](https://openemail.uk/docs/python/reference/knowledge#refresh); Ruby [`knowledge.refresh`](https://openemail.uk/docs/ruby/reference/knowledge#refresh); PHP [`knowledge->refresh`](https://openemail.uk/docs/php/reference/knowledge#refresh).

### `openemail knowledge stats`

Read how the AI used the knowledge base

```bash
openemail knowledge stats [flags]
```

Resolves how the AI used the knowledge base over the last `days` days, today included, 30 unless you say. `uses` counts the times a reply suggestion, a draft, the assistant or a search found something in it, and `empty` the times it looked and found nothing. `coverage` is `uses` divided by the two together, from 0 to 1, and 0 when it never looked. `bySurface` splits `uses` by where they happened, under the keys `compose`, `reply`, `chat`, `tool` and `search`, and `series` has one entry per day, oldest first, days with nothing included.

`topItems` lists the items used most, ever, and `unusedItems` counts the ready items the AI has never used. `pendingSuggestions` counts the learned notes waiting for review, `openQuestions` the questions senders asked that nothing answers yet, and `openFlags` the open duplicate and conflict flags. `uses`, `empty`, `bySurface` and `series` cover the whole workspace, while the items, suggestions, questions and flags count only what the caller can see.

- Scopes: `knowledge:read`.
- Needs a sign-in.

**Flags**

- `--days <n>` (default `30`): How many days back to count, today included, from 1 to 90. The server defaults to 30.

**Examples**

```bash
openemail knowledge stats
```

With optional flags

```bash
openemail knowledge stats --days 7
```

Print the raw JSON

```bash
openemail knowledge stats --json
```

Also available in: API [`GET /knowledge/stats`](https://openemail.uk/docs/api/reference/knowledge#get-knowledge-stats); TypeScript [`knowledge.stats()`](https://openemail.uk/docs/sdk/reference/knowledge#stats); Python [`knowledge.stats()`](https://openemail.uk/docs/python/reference/knowledge#stats); Ruby [`knowledge.stats`](https://openemail.uk/docs/ruby/reference/knowledge#stats); PHP [`knowledge->stats`](https://openemail.uk/docs/php/reference/knowledge#stats).

### `openemail knowledge list-suggestions`

List one page of knowledge suggestions and questions

```bash
openemail knowledge list-suggestions [flags]
```

Resolves one page of what the AI suggests adding to the knowledge base, the most recent first, pending ones unless you ask for another `status`.

A `learned` suggestion is a note the AI drew from a reply sent from the workspace: it reads the message the reply answers and the reply, and keeps up to three facts that would hold for other people too, at the level of the domain the reply was sent from, or the whole workspace when that domain is not one of its own. Facts the knowledge base already holds are left out, and at most 100 replies a day are read. A `question` is something a sender asked about the business that neither the conversation nor the knowledge base answers: when the AI suggests replies to an incoming message, it notes up to 3 such questions, at the level of the domain the message arrived at, chosen the same way. Accept a question with its answer and it becomes a note.

The same fact or question again counts up `occurrences` instead of adding a second suggestion, and one that was dismissed is not suggested again. Both kinds stop while the workspace setting `knowledgeLearning` is off, which `settings.update` changes.

Add `--all` to walk every page: a table on a terminal, one JSON object per line when piped or with `--ndjson`, and one `{ items, hasMore, nextCursor }` document with `--json`. `--max <n>` stops after that many items.

- Scopes: `knowledge:read`.
- Needs a sign-in.

**Flags**

- `--kind <value>`: Keeps one kind: `learned` for notes drawn from sent replies, or `question` for questions nothing answers.
- `--status <value>` (default `"pending"`): Keeps one status: `pending`, `accepted` or `dismissed`. Left out, `pending`.
- `--limit <n>` (default `25`): Page size, from 1 to 100. The server defaults to 50.
- `--cursor <value>`: The `nextCursor` of the previous page. Leave it out for the first page.
- `--all`: Fetch every page and stream the items as they arrive.
- `--max <n>`: Stop after this many items. Implies `--all`.
- `--ndjson`: Print every item as one JSON object per line. Implies `--all`

**Examples**

```bash
openemail knowledge list-suggestions
```

With optional flags

```bash
openemail knowledge list-suggestions --kind question
```

Walk every page and stop after 100 items

```bash
openemail knowledge list-suggestions --all --max 100
```

One JSON object per line when piped

```bash
openemail knowledge list-suggestions --all > knowledge.ndjson
```

Also available in: API [`GET /knowledge/suggestions`](https://openemail.uk/docs/api/reference/knowledge#get-knowledge-suggestions); TypeScript [`knowledge.listSuggestions()`](https://openemail.uk/docs/sdk/reference/knowledge#listSuggestions); Python [`knowledge.list_suggestions()`](https://openemail.uk/docs/python/reference/knowledge#listSuggestions); Ruby [`knowledge.list_suggestions`](https://openemail.uk/docs/ruby/reference/knowledge#listSuggestions); PHP [`knowledge->listSuggestions`](https://openemail.uk/docs/php/reference/knowledge#listSuggestions).

### `openemail knowledge accept-suggestion`

Save a knowledge suggestion as a note

```bash
openemail knowledge accept-suggestion <id> [flags]
```

Saves a pending suggestion or question as a note, marks it `accepted` and resolves with both: the suggestion, its `sourceId` naming the new note, and the note itself in `item`. Any field you send takes the place of the suggested one, so you can tidy the title, rewrite the text, move it to another level or pin it on the way in. The note keeps the conversation the suggestion came from in `threadId`.

A question needs its answer in `body`, and its title stays the question unless you send one. Answering a question this way is how it becomes a note the AI uses from then on.

Changing an item needs reach over every address its level covers: the whole workspace needs every address, a domain needs the whole domain, and an address needs that address. A key or an app limited to particular addresses can change items only at those addresses, or at domains it holds whole.

- Scopes: `knowledge:write`.
- Needs a sign-in.

**Arguments**

- `<id>` (required): The id of the suggestion or question, `kp_` and 24 hex characters, as `listSuggestions` returns it.

**Flags**

- `--title <value>`: A title for the note, at most 200 characters. Left out, the suggested title or the question.
- `--body <value>`: The text of the note, up to 20,000 characters. Left out, the suggested note. A question needs it: the answer.
- `--scope <value>`: The level for the note: an empty string for the whole workspace, `@` and a domain, or one address. Left out, the suggested level.
- `--pinned`: Puts the note into every prompt at its level. Left out, false.
- `--data <json|@file|->`: The whole `body` as JSON, inline, from a file with @path, or - for standard input. Flags override its keys.

**Examples**

The required values only

```bash
openemail knowledge accept-suggestion kp_3f9a1c7e5b2d8046a1c3e5f7
```

With optional flags

```bash
openemail knowledge accept-suggestion kp_3f9a1c7e5b2d8046a1c3e5f7 --body 'Orders over 50 euros ship free within the EU.'
```

Also available in: API [`POST /knowledge/suggestions/{id}/accept`](https://openemail.uk/docs/api/reference/knowledge#post-knowledge-suggestions-id-accept); TypeScript [`knowledge.acceptSuggestion()`](https://openemail.uk/docs/sdk/reference/knowledge#acceptSuggestion); Python [`knowledge.accept_suggestion()`](https://openemail.uk/docs/python/reference/knowledge#acceptSuggestion); Ruby [`knowledge.accept_suggestion`](https://openemail.uk/docs/ruby/reference/knowledge#acceptSuggestion); PHP [`knowledge->acceptSuggestion`](https://openemail.uk/docs/php/reference/knowledge#acceptSuggestion).

### `openemail knowledge dismiss-suggestion`

Dismiss a knowledge suggestion or question

```bash
openemail knowledge dismiss-suggestion <id> [flags]
```

Marks a pending suggestion or question `dismissed` and resolves with it. It leaves the pending list, the same fact or question is not suggested again, and nothing is added to the knowledge base.

Dismissing needs the reach to add a note at the level of the suggestion: the whole workspace needs every address, a domain needs the whole domain, and an address needs that address.

- Scopes: `knowledge:write`.
- Needs a sign-in.

**Arguments**

- `<id>` (required): The id of the suggestion or question, `kp_` and 24 hex characters, as `listSuggestions` returns it.

**Examples**

```bash
openemail knowledge dismiss-suggestion kp_3f9a1c7e5b2d8046a1c3e5f7
```

Print the raw JSON

```bash
openemail knowledge dismiss-suggestion kp_3f9a1c7e5b2d8046a1c3e5f7 --json
```

Also available in: API [`POST /knowledge/suggestions/{id}/dismiss`](https://openemail.uk/docs/api/reference/knowledge#post-knowledge-suggestions-id-dismiss); TypeScript [`knowledge.dismissSuggestion()`](https://openemail.uk/docs/sdk/reference/knowledge#dismissSuggestion); Python [`knowledge.dismiss_suggestion()`](https://openemail.uk/docs/python/reference/knowledge#dismissSuggestion); Ruby [`knowledge.dismiss_suggestion`](https://openemail.uk/docs/ruby/reference/knowledge#dismissSuggestion); PHP [`knowledge->dismissSuggestion`](https://openemail.uk/docs/php/reference/knowledge#dismissSuggestion).

### `openemail knowledge list-flags`

List the open duplicate and conflict flags

```bash
openemail knowledge list-flags [flags]
```

Resolves the open warnings about pairs of knowledge items, newest first. Each item is compared with the closest items at every level when it is indexed, and again whenever it changes. `duplicate` means the two items say nearly the same thing. `conflict` means the AI found that two closely related items disagree on a fact, such as a price or a deadline, and `detail` says how in one sentence. The AI looks for conflicts while the workspace setting `knowledgeLearning` is on, at most 200 times a day.

Change or delete one of the two items to settle a flag: a changed item is compared again once it is indexed, and the flags of a deleted item go with it. When the two are fine as they are, dismiss the flag with `dismissFlag`. A flag shows only to a caller who can see both items.

- Scopes: `knowledge:read`.
- Needs a sign-in.

**Flags**

- `--item-id <value>`: Keeps the flags that name this knowledge item, on either side.
- `--limit <n>` (default `50`): How many flags, from 1 to 100. The server defaults to 50.

**Examples**

```bash
openemail knowledge list-flags
```

Print the raw JSON

```bash
openemail knowledge list-flags --json
```

Also available in: API [`GET /knowledge/flags`](https://openemail.uk/docs/api/reference/knowledge#get-knowledge-flags); TypeScript [`knowledge.listFlags()`](https://openemail.uk/docs/sdk/reference/knowledge#listFlags); Python [`knowledge.list_flags()`](https://openemail.uk/docs/python/reference/knowledge#listFlags); Ruby [`knowledge.list_flags`](https://openemail.uk/docs/ruby/reference/knowledge#listFlags); PHP [`knowledge->listFlags`](https://openemail.uk/docs/php/reference/knowledge#listFlags).

### `openemail knowledge dismiss-flag`

Dismiss a duplicate or conflict flag

```bash
openemail knowledge dismiss-flag <id> [flags]
```

Marks a flag `dismissed` when the two items are fine as they are, and resolves with it. The same two items are not flagged for the same reason again. To settle a real duplicate or conflict instead, change or delete one of the items.

Dismissing needs the reach to change items at the levels of both items: the whole workspace needs every address, a domain needs the whole domain, and an address needs that address.

- Scopes: `knowledge:write`.
- Needs a sign-in.

**Arguments**

- `<id>` (required): The id of the flag, `kf_` and 24 hex characters, as `listFlags` returns it.

**Examples**

```bash
openemail knowledge dismiss-flag kb_8c1f4a2b9d7e3f60a5c7b21d
```

Print the raw JSON

```bash
openemail knowledge dismiss-flag kb_8c1f4a2b9d7e3f60a5c7b21d --json
```

Also available in: API [`POST /knowledge/flags/{id}/dismiss`](https://openemail.uk/docs/api/reference/knowledge#post-knowledge-flags-id-dismiss); TypeScript [`knowledge.dismissFlag()`](https://openemail.uk/docs/sdk/reference/knowledge#dismissFlag); Python [`knowledge.dismiss_flag()`](https://openemail.uk/docs/python/reference/knowledge#dismissFlag); Ruby [`knowledge.dismiss_flag`](https://openemail.uk/docs/ruby/reference/knowledge#dismissFlag); PHP [`knowledge->dismissFlag`](https://openemail.uk/docs/php/reference/knowledge#dismissFlag).

### `openemail knowledge list-connectors`

List the knowledge connectors

```bash
openemail knowledge list-connectors [flags]
```

Resolves every connector at a level the caller can see, newest first. A connector keeps many web pages from one source in the knowledge base, each page as a link item at the connector's level: a site it crawls, a sitemap, an RSS or Atom feed, or a Zendesk help center. Each one says how many items it keeps, its status, when it last synced and when it syncs next.

- Scopes: `knowledge:read`.
- Needs a sign-in.

**Examples**

```bash
openemail knowledge list-connectors
```

Print the raw JSON

```bash
openemail knowledge list-connectors --json
```

Also available in: API [`GET /knowledge/connectors`](https://openemail.uk/docs/api/reference/knowledge#get-knowledge-connectors); TypeScript [`knowledge.listConnectors()`](https://openemail.uk/docs/sdk/reference/knowledge#listConnectors); Python [`knowledge.list_connectors()`](https://openemail.uk/docs/python/reference/knowledge#listConnectors); Ruby [`knowledge.list_connectors`](https://openemail.uk/docs/ruby/reference/knowledge#listConnectors); PHP [`knowledge->listConnectors`](https://openemail.uk/docs/php/reference/knowledge#listConnectors).

### `openemail knowledge add-connector`

Keep the pages of a site, sitemap, feed or help center

```bash
openemail knowledge add-connector --kind <value> --url <value> [flags]
openemail knowledge add-connector --data <json|@file|-> [flags]
```

Adds a connector at one level and resolves with it, `queued`. Its first sync starts within a minute, and every page it finds becomes a link item at the connector's level, read in the background like any other link.

`site` reads the page at `url` and follows its links to pages on the same host under the same path, leaving out what the site's robots.txt disallows. `sitemap` reads a sitemap, or a sitemap index and up to 5 of its sitemaps. `feed` reads an RSS or Atom feed. `zendesk` reads the published articles of a Zendesk help center from its address, such as `https://example.zendesk.com`.

It keeps at most `--page-limit` pages, 25 unless you say, and syncs again every `--refresh-days` days, 7 unless you say: new pages are added, changed ones are read again and the items of pages that are gone are removed. A page already in the knowledge base as a link at the same level is left to that item. Its items count toward the plan allowance, and a sync stops adding pages once that is reached.

Changing an item needs reach over every address its level covers: the whole workspace needs every address, a domain needs the whole domain, and an address needs that address. A key or an app limited to particular addresses can change items only at those addresses, or at domains it holds whole.

- Scopes: `knowledge:write`.
- Needs a sign-in.

**Flags**

- `--kind <value>`: What `url` is: `site`, `sitemap`, `feed` or `zendesk`. Required, here or in `--data`.
- `--url <value>`: A public web address of at most 2,048 characters, kept as `https`: the page a site crawl starts from, the sitemap, the feed, or the address of the help center. Required, here or in `--data`.
- `--scope <value>` (default `""`): The level: an empty string, or left out, for the whole workspace, `@` and a domain such as `@acme.com`, or one address such as `sales@acme.com`.
- `--title <value>`: A name for the connector, at most 200 characters. Left out, the host and the kind, such as `acme.com (sitemap)`.
- `--refresh-days <n>`: Sync again every 1, 7 or 30 days. Left out, 7. `null` syncs only when you call `syncConnector`.
- `--page-limit <n>` (default `25`): The most pages to keep, from 1 to 200. Left out, 25.
- `--data <json|@file|->`: The whole `body` as JSON, inline, from a file with @path, or - for standard input. Flags override its keys.

**Examples**

The required values only

```bash
openemail knowledge add-connector --kind sitemap --url https://acme.com/sitemap.xml
```

With optional flags

```bash
openemail knowledge add-connector --kind sitemap --url https://acme.com/sitemap.xml --scope @acme.com --page-limit 100
```

Read the whole body from a JSON file

```bash
openemail knowledge add-connector --data @knowledge.json
```

Also available in: API [`POST /knowledge/connectors`](https://openemail.uk/docs/api/reference/knowledge#post-knowledge-connectors); TypeScript [`knowledge.addConnector()`](https://openemail.uk/docs/sdk/reference/knowledge#addConnector); Python [`knowledge.add_connector()`](https://openemail.uk/docs/python/reference/knowledge#addConnector); Ruby [`knowledge.add_connector`](https://openemail.uk/docs/ruby/reference/knowledge#addConnector); PHP [`knowledge->addConnector`](https://openemail.uk/docs/php/reference/knowledge#addConnector).

### `openemail knowledge get-connector`

Read one knowledge connector

```bash
openemail knowledge get-connector <id> [flags]
```

Resolves one connector: its source, its level, how many items it keeps, its status, and when it last synced and syncs next. `status` is `queued` until a sync starts, `syncing` while it reads the source, `ready` once its pages are items, and `failed` with a `failure` when the source could not be read after several tries.

- Scopes: `knowledge:read`.
- Needs a sign-in.

**Arguments**

- `<id>` (required): The id of the connector, `kc_` and 24 hex characters, as `listConnectors` returns it.

**Examples**

```bash
openemail knowledge get-connector kc_5d2e8f1a3c7b9064e2a4c6f8
```

Print the raw JSON

```bash
openemail knowledge get-connector kc_5d2e8f1a3c7b9064e2a4c6f8 --json
```

Also available in: API [`GET /knowledge/connectors/{id}`](https://openemail.uk/docs/api/reference/knowledge#get-knowledge-connectors-id); TypeScript [`knowledge.getConnector()`](https://openemail.uk/docs/sdk/reference/knowledge#getConnector); Python [`knowledge.get_connector()`](https://openemail.uk/docs/python/reference/knowledge#getConnector); Ruby [`knowledge.get_connector`](https://openemail.uk/docs/ruby/reference/knowledge#getConnector); PHP [`knowledge->getConnector`](https://openemail.uk/docs/php/reference/knowledge#getConnector).

### `openemail knowledge update-connector`

Change a knowledge connector

```bash
openemail knowledge update-connector <id> [flags]
```

Changes the title of a connector, its level, how often it syncs or the most pages it keeps, and resolves with it as it is now. Give at least one field. Moving it to another level moves its items with it, and they are indexed again there. A new `--refresh-days` counts from the last sync, and a new `--page-limit` applies from the next sync.

Changing an item needs reach over every address its level covers: the whole workspace needs every address, a domain needs the whole domain, and an address needs that address. A key or an app limited to particular addresses can change items only at those addresses, or at domains it holds whole. Moving a connector needs that reach at both levels.

- Scopes: `knowledge:write`.
- Needs a sign-in.

**Arguments**

- `<id>` (required): The id of the connector, `kc_` and 24 hex characters, as `listConnectors` returns it.

**Flags**

- `--title <value>`: A new name, at most 200 characters.
- `--scope <value>`: The level to move it and its items to: an empty string for the whole workspace, `@` and a domain, or one address.
- `--refresh-days <n>`: Sync every 1, 7 or 30 days. `null` syncs only when you call `syncConnector`.
- `--page-limit <n>`: The most pages to keep, from 1 to 200.
- `--data <json|@file|->`: The whole `patch` as JSON, inline, from a file with @path, or - for standard input. Flags override its keys.

**Examples**

With optional flags

```bash
openemail knowledge update-connector kc_5d2e8f1a3c7b9064e2a4c6f8 --refresh-days 1 --page-limit 150
```

Print the raw JSON

```bash
openemail knowledge update-connector kc_5d2e8f1a3c7b9064e2a4c6f8 --refresh-days 1 --page-limit 150 --json
```

Also available in: API [`PATCH /knowledge/connectors/{id}`](https://openemail.uk/docs/api/reference/knowledge#patch-knowledge-connectors-id); TypeScript [`knowledge.updateConnector()`](https://openemail.uk/docs/sdk/reference/knowledge#updateConnector); Python [`knowledge.update_connector()`](https://openemail.uk/docs/python/reference/knowledge#updateConnector); Ruby [`knowledge.update_connector`](https://openemail.uk/docs/ruby/reference/knowledge#updateConnector); PHP [`knowledge->updateConnector`](https://openemail.uk/docs/php/reference/knowledge#updateConnector).

### `openemail knowledge delete-connector`

Delete a knowledge connector and its items

```bash
openemail knowledge delete-connector <id> [flags]
```

Removes a connector with every item it added to the knowledge base, and the AI stops using them at once. There is no undo. Links you added yourself stay, even when the connector found the same pages.

- Scopes: `knowledge:write`.
- Needs a sign-in.
- Asks you to confirm.

**Arguments**

- `<id>` (required): The id of the connector, `kc_` and 24 hex characters, as `listConnectors` returns it.

**Examples**

```bash
openemail knowledge delete-connector kc_5d2e8f1a3c7b9064e2a4c6f8
```

Skip the confirmation, for scripts

```bash
openemail knowledge delete-connector kc_5d2e8f1a3c7b9064e2a4c6f8 --yes
```

Also available in: API [`DELETE /knowledge/connectors/{id}`](https://openemail.uk/docs/api/reference/knowledge#delete-knowledge-connectors-id); TypeScript [`knowledge.deleteConnector()`](https://openemail.uk/docs/sdk/reference/knowledge#deleteConnector); Python [`knowledge.delete_connector()`](https://openemail.uk/docs/python/reference/knowledge#deleteConnector); Ruby [`knowledge.delete_connector`](https://openemail.uk/docs/ruby/reference/knowledge#deleteConnector); PHP [`knowledge->deleteConnector`](https://openemail.uk/docs/php/reference/knowledge#deleteConnector).

### `openemail knowledge sync-connector`

Sync a knowledge connector now

```bash
openemail knowledge sync-connector <id> [flags]
```

Queues a sync that starts within a minute, whatever the schedule says, clears any `failure` and resolves with the connector, back at `queued`. Use it after the source changed, or to try again after a failure. Like a scheduled sync, it adds new pages, reads changed ones again and removes the items of pages that are gone.

- Scopes: `knowledge:write`.
- Needs a sign-in.

**Arguments**

- `<id>` (required): The id of the connector, `kc_` and 24 hex characters, as `listConnectors` returns it.

**Examples**

```bash
openemail knowledge sync-connector kb_8c1f4a2b9d7e3f60a5c7b21d
```

Print the raw JSON

```bash
openemail knowledge sync-connector kb_8c1f4a2b9d7e3f60a5c7b21d --json
```

Also available in: API [`POST /knowledge/connectors/{id}/sync`](https://openemail.uk/docs/api/reference/knowledge#post-knowledge-connectors-id-sync); TypeScript [`knowledge.syncConnector()`](https://openemail.uk/docs/sdk/reference/knowledge#syncConnector); Python [`knowledge.sync_connector()`](https://openemail.uk/docs/python/reference/knowledge#syncConnector); Ruby [`knowledge.sync_connector`](https://openemail.uk/docs/ruby/reference/knowledge#syncConnector); PHP [`knowledge->syncConnector`](https://openemail.uk/docs/php/reference/knowledge#syncConnector).

### `openemail knowledge draft-from-thread`

Draft a knowledge note from a conversation

```bash
openemail knowledge draft-from-thread --thread-id <value> [flags]
openemail knowledge draft-from-thread --data <json|@file|-> [flags]
```

The AI reads a conversation and drafts one note of the facts in it that the team will need again, leaving out personal details and what matters only to that conversation. Nothing is saved: the draft comes back with a `title`, a `body` in Markdown and a `scope` it suggests, and you keep it, changed as you like, with `createNote` and the same `--thread-id`.

`scope` suggests the domain the conversation arrived at when the caller may add items there, otherwise the whole workspace or the address itself. Each draft counts as one AI action.

- Scopes: `knowledge:write`, `threads:read`.
- Needs a sign-in.

**Flags**

- `--thread-id <value>`: The conversation, by the id `threads.list` gives it. Required, here or in `--data`.
- `--data <json|@file|->`: The whole `body` as JSON, inline, from a file with @path, or - for standard input. Flags override its keys.

**Examples**

```bash
openemail knowledge draft-from-thread --thread-id CAHk7pQ2x9LmZ4-mail.example.com
```

Read the whole body from a JSON file

```bash
openemail knowledge draft-from-thread --data @knowledge.json
```

Also available in: API [`POST /knowledge/drafts`](https://openemail.uk/docs/api/reference/knowledge#post-knowledge-drafts); TypeScript [`knowledge.draftFromThread()`](https://openemail.uk/docs/sdk/reference/knowledge#draftFromThread); Python [`knowledge.draft_from_thread()`](https://openemail.uk/docs/python/reference/knowledge#draftFromThread); Ruby [`knowledge.draft_from_thread`](https://openemail.uk/docs/ruby/reference/knowledge#draftFromThread); PHP [`knowledge->draftFromThread`](https://openemail.uk/docs/php/reference/knowledge#draftFromThread).
