# Command line

Every assent command, option, setting and exit code, for agents and shell scripts that talk to Assent.

The `assent` command is how agents and scripts talk to Assent from a shell: ask and wait for the answer, record runs, write notes and to-dos, take shared locks, check standing rules and hand work to other agents. It needs Node.js 20 or later.

```bash
npm install -g assent-cli
```

## Configure

Create an agent in Assent and copy its agent key (see [Connect an agent](https://docs.specvista.com/assent/connect-an-agent.md)). Then either set it in the environment:

```bash
export ASSENT_AGENT_KEY=oak_...
```

or write it to `~/.assent/config.json` (on Windows, `%USERPROFILE%\.assent\config.json`), readable only by you:

```json
{ "agentKey": "oak_..." }
```

In PowerShell, set it with `$env:ASSENT_AGENT_KEY = "oak_..."`.

Requests go to the hosted Assent service at `https://ordia-api.specvista.com/api/v1` unless you set `ASSENT_API_URL`. Another server must use https (plain http only for localhost), and redirects are refused, so the agent key is never sent in the clear or to another host.

| Setting | What it does |
|---|---|
| `ASSENT_AGENT_KEY` | The agent key. Wins over `agentKey` in the config file. |
| `ASSENT_API_URL` | Optional. Set it only to point at another Assent server. Wins over `apiUrl` in the config file. |
| `ASSENT_CONFIG` | Path of the config file to read instead of `~/.assent/config.json`, for example one file per agent. |
| `ASSENT_TIMEOUT_MS` | Request timeout in milliseconds. Default 10000. |
| `ASSENT_RUN_UUID` | The run that `ask`, `task add`, `note`, `note personal` and `handoff` link their new item to when `--run` is not given. |
| `ASSENT_HOOK_TIMEOUT_MS` | Timeout for each request `assent hook pre-tool-use` makes. Default 3000. |
| `ASSENT_HOOK_WAIT_SECONDS` | How long `assent hook pre-tool-use --ask` waits for your answer. Wins over `hook.waitSeconds` in the config file. Default 120. |

## Output

Every command prints one line of JSON. `--get <field>` prints just that field, which suits shell scripts:

```bash
RUN=$(assent run start --summary "job scan" --get uuid)
```

`assent help` (or `assent --help`) prints every command and option, and `assent --version` prints the version. Check the latest release with `npm view assent-cli version`.

## Dates and times

`--due`, `--remind` and `--retry-at` take a date and time:

- `2026-10-15T17:00` or `2026-10-15 17:00`, in this computer's time zone.
- `2026-10-15T17:00:00+01:00`, with an offset.
- `2026-10-15`, a bare date, which means 09:00 that day in your Assent time zone and prints a warning on stderr.

## Commands

### Who am I

```text
assent whoami
```

Shows the agent this key belongs to.

### Runs

```text
assent run start [--summary s] [--max-minutes n]
assent run progress <run-uuid> --done n --total m [--label l]
assent run finish <run-uuid> (--exit-code n | --status ok|fail|deferred) [--summary s] [--log-file path] [--log-tail-bytes n]
    [--task task-uuid] [--result-json path|-] [--done n] [--skipped n] [--needs-you n] [--failed n]
    [--retry-at when]
    [--issue-reason needs_action|recovery_exhausted|deadline_at_risk --impact text --action-needed text]
assent run defer <run-uuid> --retry-at when
```

- `run progress` shows progress on the phone as a Live Activity.
- `run finish` records how the run ended. With `--task`, the counts come from that task's item results. `--retry-at` is only allowed with `--status deferred`.
- `--issue-reason`, `--impact` and `--action-needed` go together and raise an action for you. They are not allowed with `ok`, and each text is at most 500 characters.
- `run defer` shows the run as deferred until that time, for example after a usage limit.

### Asks

```text
assent ask --title t [--kind approve|todo|pay|login|code|reply] [--detail d] [--url u] [--draft text | --draft-file path|-]
    [--action id:label[:primary|secondary|danger]]... [--item id:title[:unselected]]...
    [--item-json path|-] [--recommend item-id]... [--reason item-id:text]... [--badge item-id:label[:tone]]...
    [--link item-id:label:url]... [--why text] [--field key:label[:type]:value]...
    [--attach item-id:path]... [--quote-json json|path|- [--quote-image path]]
    [--group key:title] [--conflict-on field-key]... [--total-of field-key] [--decline-action action-id]
    [--rule-action name] [--target t]
    [--due when] [--remind when] [--dedupe key] [--wait [--timeout seconds] [--interval seconds] [--no-pickup]]
    [--question text] [--answer-type yes_no|choice|text|number|done] [--effort minutes] [--series key]
    [--idempotency-key uuid] [--allow-duplicate]
assent attach <path> [--name n]
assent answers
assent picked-up <task-uuid>
```

- `ask` asks you. The kind defaults to `approve`. [Asks](https://docs.specvista.com/assent/asks.md) covers every kind and option. `--quote-json` shows the post or message the ask responds to, exactly as written and without redaction: inline JSON, a path, or `-` for stdin, with `author`, `text` and optional `handle`, `postedAt` and `url`. `--quote-image` uploads a screenshot (png, jpeg or webp) to show with it.
- `attach` uploads a file (pdf, png, jpeg, gif, webp, txt or md, at most 10 MB) and prints its uuid, once you turn attachments on for this agent.
- `answers` lists your answered asks that are not picked up yet.
- `picked-up` marks an answer as acted on, so it is never delivered again.

### To-dos

```text
assent task add --title t --why text [--detail d] [--url u] [--due when] [--remind when] [--dedupe key]
    [--project project-uuid [--track name]] [--effort minutes] [--series key] [--idempotency-key uuid] [--allow-duplicate]
    [--parent ask-uuid --parent-item item-id]
assent task resolve <task-uuid> [--withdraw] [--note text]
assent task update <task-uuid> [--due when|none] [--remind when|none]
assent task get <task-uuid>
assent task item-result <task-uuid> <item-id> done|skipped|needs_you|failed [--reason r] [--url u]
assent task item-status <task-uuid> <item-id>
```

- `task add` adds a personal to-do to your Ordia Desk (the Specvista notes and tasks app at [notes.specvista.com](https://notes.specvista.com), which uses your Assent account). `--parent` and `--parent-item` link it to one item of the agent's own ask: marking the to-do done marks that item done, and resolving the item in the ask closes the to-do. For a to-do in your Assent inbox instead, use `assent ask --kind todo`.
- `task resolve` closes your own ask once the work is done, or withdraws it with `--withdraw`. Its reminders stop.
- `task update` changes the due or reminder time of a task this agent created. `none` clears it.
- `task item-result` reports each item as it finishes. The `--url` must start with `http://` or `https://`.
- `task item-status` prints `go`, `held`, `withdrawn`, `not_selected` or the recorded outcome for an item.

### Notes, links and memory

```text
assent note --title t (--content text | --content-file path | --content-file -) [--tag t]... [--run run-uuid]
assent note personal --title t (--content text | --content-file path | --content-file -) [--tag t]... [--run run-uuid]
assent note update <note-uuid> [--title t] [--content text | --content-file path | --content-file -] [--tag t]...
assent link --from type:uuid --to type:uuid [--relation produced|about|blocks|related]
assent memory get
```

- `note` writes a note you see under the agent's name in Assent. `--content-file -` reads stdin.
- `note personal` adds a long-lived personal note to your Ordia Desk.
- `link` links two items. The types are `note`, `task`, `run` and `agent`, and the relation defaults to `related`.
- `memory get` reads the pinned memory notes you shared with this agent.

### Locks

```text
assent lock acquire <resource> [--ttl minutes] [--wait seconds] [--interval seconds]
assent lock release <resource> [--token t]
```

A shared lock, for example `deploy:web`, keeps two agents off the same resource. The lock lasts `--ttl` minutes (default 30). `--wait` keeps trying for that many seconds, every `--interval` seconds (default 15). If the lock is still held, the command exits with 3. `lock release` uses the token saved when the lock was taken, or `--token`.

```bash
assent lock acquire deploy:web --ttl 45 --wait 90 && deploy; assent lock release deploy:web
```

### Hand-offs

```text
assent handoff (--to <agent name> | --to-uuid <agent uuid>) --title t [--detail d] [--run run-uuid]
assent handoffs
assent handoffs done <task-uuid>
```

Hand work to another of your agents, list the open hand-offs other agents gave this one, and mark one as done.

### Projects and plans

```text
assent project get <project-uuid>
assent project overview <project-uuid>
assent plan create --file path|- [--idempotency-key uuid]
assent plan get <plan-uuid>
assent plan sessions <plan-uuid> --file path|-
```

- `project get` and `project overview` read a project you linked this agent to: progress, tracks, milestones, this week and overdue.
- `plan create` takes JSON `{ title, summary?, tracks: [{key,title}], sessions: [{key,trackKey,title,dueAt,detail?,sessionMinutes?,habitKey?,url?}] }`, with at most 1000 sessions.
- `plan sessions` takes JSON `{ sessions: [{key, dueAt?, title?, detail?, status?: open|done|cancelled}] }`, with at most 500 sessions.

### Rules and the Claude Code hook

```text
assent rules check --action name [--target t] [--summary s]
assent rules list
assent rules add --deny --action pattern [--target pattern] [--reason r] [--expires 1d|7d|30d|none]
assent rules remove <rule-uuid>
assent hook pre-tool-use [--ask [--max-wait seconds]]
assent hook claude-code install [--config path] [--settings path] [--yes]
assent hook claude-code uninstall [--settings path] [--yes]
```

`rules check` exits 0 for allow, 10 for deny and 11 for ask. `rules list` shows the standing rules that apply to this agent. Agents can only add deny rules for themselves, and `rules remove` removes only a deny rule this agent added. [Rules](https://docs.specvista.com/assent/rules.md) explains how rules match. `hook pre-tool-use` reads a Claude Code PreToolUse event on stdin, prints allow, deny or ask, and always exits 0. With `--ask`, it sends calls on its ask list to you and blocks them unless you allow them, waiting at most `--max-wait` seconds (default 45). `hook claude-code install` adds that hook to `~/.claude/settings.json` (or the `--settings` file) after showing the change, and `uninstall` removes it. See [Claude Code](https://docs.specvista.com/assent/claude-code.md).

### MCP

```text
assent mcp
```

Runs a local MCP server on stdin and stdout for clients that start one as a command, sending each message to the Assent MCP server with this agent's key. See [MCP server](https://docs.specvista.com/assent/mcp.md).

## Exit codes

| Code | Meaning |
|---|---|
| 0 | OK |
| 1 | Error |
| 2 | Usage error |
| 3 | Conflict: lock held, already answered or expired |
| 4 | Not found |
| 5 | Not configured or unauthorised |
| 6 | `--wait` timed out |
| 10 | `rules check` found a deny rule |
| 11 | `rules check` found no rule: ask the person |
| 69 | Assent unreachable: network failure, timeout, rate limit or a 5xx |

Before a risky step, go ahead only when `ask --wait` exits 0 with `answer.actionId` `done`, or `rules check` exits 0. Any other exit code, including 5, 6 and 69, means stop. Reporting commands such as `run start`, `run finish` and `note` can treat a failure as "Assent unavailable, carry on as before".

## Privacy

`run finish` redacts emails, tokens, keys, phone numbers and home paths from the summary and log tail before sending. `note`, `note personal` and `note update` redact the title and content the same way, and `ask` and `task add` redact the title and detail. A `--url` link, a reply draft and a `--quote-json` quote are sent as given. Never pass passwords, card or bank details to any command: `pay` and `login` asks carry only a link.
