# @catena/cli

Catena CLI lets an approved agent act from a named local profile: inspect the
policy it has been assigned, list the accounts and counterparties it can see,
and submit policy-checked money movement intents.

Install it with the `catena` package, which includes this CLI and the Catena
SDK:

```bash
npm i -g catena
catena guide
```

If you installed `@catena/cli` before, remove it first with
`npm rm -g @catena/cli`. Both packages install a `catena` command, so npm
refuses to install the second one.

Or run it without installing:

```bash
npx catena <command> [args]
```

Examples use `npx catena` so they work directly from npm.

## How it works

`link` connects a profile to an agent through an approval link that a person
opens in the Catena console. After linking, Catena writes routing metadata to
`~/.config/catena/profiles.json` (see `CATENA_HOME` below to move it) and stores
session material in the OS credential store. Every other command resolves the
selected profile and prints pretty JSON to stdout so it can be piped through
tools such as `jq`; pass `--json` to print compact single-line JSON instead.
`unlink` revokes only the selected profile's server link and removes that
profile's local credential.

## Hosts without a keychain

`link` stores its credential in the OS keychain: the macOS Keychain, or the
Secret Service keyring on Linux. On a Linux host with no keyring, such as a
headless VM or a container with a persistent home directory, `link` stores it in
a file that only your user can read, under `~/.config/catena/credentials/`, and
says so.

A CI job, a serverless runtime, or a cloud agent sandbox that starts fresh for
each task has no persistent disk to keep that file on. Set `CATENA_SECRET_KEY`
to the agent's P-256 secret key there instead, in the platform's secret
settings:

```bash
CATENA_SECRET_KEY="<64 hex characters>" npx catena whoami
```

Create the key in the Catena console: open the agent, select the **Secret keys**
tab, then **Create secret key**. The console shows it one time. `@catena/sdk`
reads the same variable, so one key serves either client. Set the value with no
surrounding whitespace: the CLI trims it, and the SDK does not.

While the key is set, `profiles current` reports `source: "secret-key"` with no
`.profile` field, and `profiles list` adds `shadowedBy` and marks every profile
`current: false`.

On a machine that also holds a linked profile or sets `CATENA_PROFILE`, every
command prints one stderr line that names the key as the signing credential. The
line is left out when `CATENA_PROFILE` or a directory binding chooses a profile
on this machine that records its agent, because that agent then decides whether
Catena accepts the key. Stdout keeps only the command result, which on a command
that names its identity includes `actingAs`.

The key outranks every profile tier, but an explicit `--profile` still wins.
`unlink` does not apply to it; revoke the key in the console instead.

When `CATENA_PROFILE` or a directory binding chooses a profile, every command
names that profile's agent to Catena in the `Catena-Agent-Id` header, also when
it signs with the key. If the key belongs to a different agent, Catena refuses
the request and does nothing, and the command exits 1 and names each fix. A key
beside only a default or an only-linked profile names no agent and keeps
working.

## Installing without sudo

If `npm i -g catena` fails with a permission error, install to a user prefix
instead of using `sudo`:

```bash
npm config set prefix ~/.npm-global
export PATH="$HOME/.npm-global/bin:$PATH"
npm i -g catena
```

Or run each command with `npx -y catena@latest <command>`.

## Where the CLI keeps its files

The CLI keeps profiles, credential files, and saved requests in
`$XDG_CONFIG_HOME/catena`, which is `~/.config/catena` when `XDG_CONFIG_HOME` is
not set. Earlier releases kept them in `~/.catena`. The first run of a newer
release moves `~/.catena` to the new directory and leaves a link at the old
path, so an older CLI on the same machine still finds the same profiles.

The CLI keeps using `~/.catena`, and tries again on the next run, when it cannot
move it safely:

- The new directory is not `~/.config/catena`, for example because
  `XDG_CONFIG_HOME` points at one app's data folder, as Flatpak sets.
- The new directory is outside your home directory, or holds only files that the
  CLI did not write. When it already holds CLI files, the CLI uses it.
- The system refuses the rename or the link, as a sandbox or Windows without the
  symlink right can.
- `~/.catena` is a link to another directory. The CLI follows that link, even
  when `XDG_CONFIG_HOME` changes later.

A version cache or a saved response in the new directory does not count as
state. When both directories hold profiles, the CLI uses the new directory and
prints a warning on stderr that names both.

## Containers and sandboxes

`CATENA_HOME` moves everything the CLI keeps under `~/.config/catena`: profiles,
credential files, and saved link requests. In a container that loses its home
directory on restart, point it at a volume and keep it set for every command:

```bash
export CATENA_HOME=/data/catena
npx -y catena@latest link --name "Hermes Runtime"
```

The value must be an absolute path. The CLI makes everything it writes there
readable by your user only.

A cloud agent sandbox that starts fresh for each task, such as Claude, Codex,
and Cursor cloud agents or Copilot's coding agent, keeps nothing that `link`
writes. Use a secret key from the console there, as in the previous section.

When a sandbox refuses something the CLI needs, the error says what to do. A
command that cannot reach the Catena API names the host to allow. A payment from
a Mercury connection can first read from Turnkey at `api.turnkey.com`, and names
that host when it cannot reach it. A refused keychain write asks you to run the
command again with the sandbox's approval or escalation, or to use a secret key;
the CLI never moves a refused key into a file. A refused write under
`~/.config/catena` asks for approval or escalation, or for `CATENA_HOME` set to
a writable directory that persists.

Never print, read, or copy a credential file.

## First-time setup

To create or choose an agent from the Catena console, run `link` without an
agent id. Use `--name` to suggest a name when the console creates a new agent;
the approving operator can edit it before approval.

```bash
npx catena link --name "Hermes Runtime"
```

The command prints an approval link that is valid for 15 minutes, and exits. The
person who approves does not need a Catena account first: they can sign up from
the link. If signing up outlasts the link, the console asks them to have the
agent send a new one. Until the command prints `Done`, run it again from the
same directory once they approve, or on a schedule. Each run checks the request
once: it links the agent if the request was approved. Otherwise its first line
is `Not linked yet: waiting for the person to approve.`, it prints the same link
again, and it exits 0. After an approval, the agent has 24 hours to run it. Stop
once it prints `Done`. A later run that reaches the same profile prints
`Already linked as <agent> (<agent-id>)`, does nothing, and exits 0. If you will
run it on a schedule, pass `--profile <name>` from the first run and the same
name on every later run, and check `catena whoami --profile <name>` first: until
the link finishes, it says what this machine last knew of the request and gives
the same command `link` printed. A run with a different profile name starts a
second request. From the same directory, a run without `--profile` resumes the
waiting request whatever `--name` it passes. The command replaces the link only
once it expired, and then says to send the new one. If the person declined the
request, or cancelled their approval, the command says so, prints
`catena unlink --profile <name> --force`, exits 1 and starts nothing. Do not
send another link unless they ask for one.

To link a specific existing agent, ask the Catena customer for the agent id
shown in the Catena console. It looks like `agent_...`. The same flow applies:
the command prints the link and exits, and the same command run again after the
approval finishes linking. The person who approves needs to be signed in to the
agent's organization.

```bash
npx catena link <agent-id>
```

If the person approving is at this machine and can see its browser, add
`--browser`: the command opens the approval in that browser and waits. With an
agent id this is the browser sign-in, whose window stays open for up to 5
minutes. On a machine with no display it prints the link and waits.

Add `--wait` when a person at the terminal approves on another device: it waits
up to 15 minutes for the approval and prints a line about every 30 seconds.
Stopping it does not cancel the request. An agent should use neither flag,
because many agent tools show a command's output only when it exits.

Useful flags:

| Flag                | Description                                                                                 | Default                         |
| ------------------- | ------------------------------------------------------------------------------------------- | ------------------------------- |
| `--name`            | Suggested name when creating an agent from the console.                                     | none                            |
| `--browser`         | The person approving is at this machine: open the approval in its browser and wait.         | print the link and exit         |
| `--wait`            | For a person at a terminal: print the link and wait up to 15 minutes for approval.          | print the link and exit         |
| `--relink`          | With an agent id: link a profile whose key works again, keeping it working meanwhile.       | off                             |
| `--policy-proposal` | Without an agent id: attach a proposed policy, in the `policy propose` format.              | none                            |
| `--replace-request` | With `--policy-proposal`: replace the waiting request; the link already sent stops working. | off                             |
| `--profile`         | Credential profile name.                                                                    | configured default or `default` |

## Commands

### `link [agent-id]`

Connect the selected profile to an agent. Omit `agent-id` to create an agent
from the Catena console. Either way the command prints an approval link and
exits; run it again once the link is approved.

```bash
npx catena link --name "Hermes Runtime"
npx catena link <agent-id>
```

### `unlink`

Disconnect the selected profile from its agent and remove its local credential.

Nothing on this machine can withdraw a link request that is still waiting. To
cancel one, ask the person who approves to deny it on the approval page, or let
it expire. If they approve a new agent's request anyway, Catena creates an agent
that nothing connects to, which they can delete from the agent's page in the
console. `unlink --profile <name> --force`, which `link` prints with the link,
forgets the request on this machine. `link` relinks a profile that has already
finished linking only when it has no working key, or with `--relink`. Without a
working key that command forgets the profile too; a `--relink` run prints none,
since the profile still works. While a request waits beside another profile, an
`unlink` that names no profile (no `--profile`, `CATENA_PROFILE`, directory
binding or default profile) refuses and lists the profiles.

```bash
npx catena unlink
```

### `profiles current`

Show the selected credential profile and its routing metadata.

```bash
npx catena profiles current
```

### `profiles list`

List linked credential profiles and mark the selected default profile.

```bash
npx catena profiles list
```

### `profiles use <profile>`

Set the selected default profile. The profile must already be linked.

```bash
npx catena profiles use mcp
```

### `whoami`

Show which agent the selected profile is linked to. When no `--profile`,
`CATENA_PROFILE`, directory binding or default profile chose it, it uses the
only linked profile and says so on stderr.

```bash
npx catena whoami
```

### `policy show`

Show the policy assigned to the linked agent. Read this before creating
counterparties or submitting intents.

```bash
npx catena policy show
```

The policy includes `policyCapabilities` rows. Each row grants one `read`,
`send`, or `transfer` capability on one account and carries block or approval
`rules`. It also includes `counterpartyRules` for send recipient scope and
counterparty creation.

### `policy request-override`

Ask a person to approve a temporary increase to one policy limit.

```bash
npx catena policy request-override \
  --account acct_... \
  --amount 500 \
  --duration 4h \
  --reason "Vendor invoice INV-4471 is $420"
```

`--account` raises that account's own limit. For a limit shared across all
accounts (`accountAggregationScope: "across_accounts"` in `policy show`), pass
`--all-accounts` instead; raising one account's limit does not lift a block from
a shared limit. Pass exactly one of the two. Use `--capability transfer` for a
transfer limit and `--rule` to select another limit type. `--idempotency-key` is
optional.

### Intent idempotency

The `send`, `transfer`, `counterparties create`,
`counterparties request-details`, and `policy request-override` commands accept
an optional `--idempotency-key`. When omitted, the CLI generates a fresh key for
that invocation, so matching command inputs alone are not deduplicated. `send`
and `transfer` print that key to stderr as `idempotency key: <key>` before they
send anything, and a timeout on the request that creates the intent names the
key in its error. The `x402` command manages a fresh key internally for each
payment challenge. If a manual retry may be needed after an ambiguous timeout,
choose and persist a key on the first attempt, or save the one the command
prints. Find the original with `intents list`, read it with `intents get <id>`,
and follow the recovery guidance under `send` before another attempt. Ask an
operator if you cannot identify or reconcile it. Keep the saved key and
unchanged inputs for a permitted retry while the original is still `pending` or
`processing`. Reusing a key with different inputs fails.

### `mpp`

Fetch an MPP-protected HTTP endpoint and pay a supported USDC charge from a
wallet account:

```bash
npx catena mpp --url https://api.example.com/paid \
  --account acct_... --max-amount 0.25
```

The CLI recognizes structurally valid EVM `evm/charge` and `usdc/charge`
challenges and leaves network and canonical USDC support to the connected
server. Base and Base Sepolia are supported where enabled. Arc support is
rolling out. Payments use the agent's normal send capability, counterparty
allowlist, spend limits, and approval flow. The recipient must already be a
saved counterparty wallet rail.

The command accepts the same request-body, header, output, profile, and JSON
flags as `x402`; run `mpp --help` for details. If approval is required, approve
the reported intent and re-run the same command. If Catena signed the payment
but the paid request failed, inspect the reported intent with `intents get <id>`
before retrying so the resource is not paid twice. If the seller refused the
signed payment, the result reports `.paid` false and `.refused`, with the
seller's unverified reason and the time until which the payment can still
settle. Every payment reports `.payment.settlement` with that time;
`catena guide` explains how to read its outcome after it. The command exits 1
when the seller refused the payment, or when it paid and the response is not a
2xx. `x402` reports a seller's refusal of a signed payment the same way, with
`.paid` false and `.refused`, and exits 1; it prints no `.body` for the refusal,
because that body is the seller's unchecked text.

### `accounts list`

List the accounts available under the agent's policy.

```bash
npx catena accounts list
```

### `counterparties list`

List counterparties, their status, and their rails. Use rail ids from this
output with `send`.

```bash
npx catena counterparties list
```

### `counterparties create`

Request creation of a counterparty with an email but no payment details. This
saves the counterparty without sending an email. The command returns an intent
envelope; policy may complete it, block it, or route it to approval.

```bash
npx catena counterparties create \
  --name "Acme Vendor" \
  --email billing@acme.test
```

Required flags: `--name`, `--email`.

Optional flags: `--idempotency-key`.

`counterparties create email` is an equivalent explicit form. Use the `bank` or
`wallet` subcommand when payment details are available.

### `counterparties create bank`

Request creation of a bank-rail counterparty. The command returns an intent
envelope; policy may complete it, block it, or route it to approval.

```bash
npx catena counterparties create bank \
  --name "Acme Vendor" \
  --bank-name "Chase" \
  --routing-number 021000021 \
  --account-number 123456789 \
  --address-street "123 Main St" \
  --address-city "New York" \
  --address-state NY \
  --address-postal-code 10001
```

Required flags: `--name`, `--bank-name`, `--routing-number`, `--account-number`,
`--address-street`, `--address-city`, `--address-state`,
`--address-postal-code`.

Optional flags: `--account-type` (`checking` or `savings`), `--address-country`,
`--email`, `--idempotency-key`.

### `counterparties create wallet`

Request creation of a wallet-rail counterparty. The command returns an intent
envelope; policy may complete it, block it, or route it to approval.

```bash
npx catena counterparties create wallet \
  --name "DAO Treasury" \
  --address 0xAbC123...
```

Required flags: `--name`, `--address`.

Optional flags: `--network` (defaults to `base`; availability depends on the
connected environment), `--asset` (defaults to the network's USDC; on a network
without USDC, such as Tempo, pass an asset from `organization.heldAssets` in
`setup-state`), `--email`, `--idempotency-key`.

### `counterparties request-details`

Ask an existing counterparty to provide bank details, wallet details, or both.
The request follows policy and may require human approval.

```bash
npx catena counterparties request-details cp_... --bank
```

Pass at least one of `--bank` or `--wallet`. `--idempotency-key` is optional.
The outstanding-invitation conflict remains independent of idempotency.

### `send`

Request a USD send to a counterparty rail.

```bash
npx catena send \
  --rail cpr_... \
  --amount 125.00 \
  --method ach
```

Required flags: `--rail`, `--amount`, `--method`.

Optional flags: `--account`, `--description`, `--idempotency-key`, and `--memo`.

Omit `--account` when the current effective policy allows sends from exactly one
account. Zero or multiple send accounts produce an error; other readable or
transfer accounts do not count. An explicit source is never replaced. The
result's `accountId` identifies the source pinned to the intent, including while
awaiting approval. `intents get <id>` returns the same source.

A same-key retry uses the original intent's source, even if the current policy
selects another account or no longer has a unique send account. Changed payment
details or an explicitly different source return HTTP 409. Some
`blocked/blocked` attempts are reevaluated against the current policy with the
source still pinned; a retired payment plan instead returns HTTP 409. Read and
reconcile a `blocked/blocked` payment before resending on either key: an earlier
provider attempt may be unresolved. New operations without an explicit source
resolve the current policy. Use a new key for a new operation, and reconcile an
unknown outcome before sending again.

Read the original payment's status and resolution before another attempt. Stop
on completed and accept denied. After cancelled, use a new key only if another
attempt is appropriate. For other blocked, failed, expired or unknown outcomes,
ask an operator to confirm whether the original payment moved money before
retrying on either key. If reconciliation confirms another attempt is
appropriate after failed or expired, use a new key; the original key only
replays or conflicts with its retired plan. Run `catena guide` for the full
recovery instructions.

`--method` must be one of `ach`, `wire`, or `on-chain`. `--memo` is sent with an
ACH or wire payment. It remains accepted for on-chain sends for compatibility,
but is deprecated and is not sent to the blockchain. Use `--description` for an
internal Catena note on any send.

To check whether a send completed, run `intents get <id>` with the returned
intent id. A separate invocation without an explicit key is a new send, even
when its inputs match an earlier command.

A send to a counterparty wallet on another network is an ordinary `send`. When
the account cannot pay it from its balance on the rail's network, Catena moves
the money between networks under the same intent, carried by a movement plan.
`intents get <id>` then carries `movement`, whose `nextStep` reads `wait` until
the payment is `done` or `blocked`.

### `transfer`

Request a USD transfer between two accounts visible to the agent.

```bash
npx catena transfer \
  --from acct_... \
  --to acct_... \
  --amount 125.00
```

Required flags: `--from`, `--to`, `--amount`.

Optional flags: `--memo`, `--description`, `--idempotency-key`.

To check whether a transfer completed, run `intents get <id>` with the returned
intent id. A separate invocation without an explicit key is a new transfer, even
when its inputs match an earlier command.

### `accounts balance`

Read an account balance through the policy engine.

`balances.total` and `balances.available` are USD at par across assets.
`balances.byNetwork[]` shows each agent network. Optional `balances.holdings[]`
breaks it down by CAIP-19 `token`, with `network`, `networkLabel`, `asset`,
`assetLabel`, `total` and `available`. When holdings are absent, every figure is
USDC. They are omitted for bank accounts and until the account is split by
network. Their available values sum to `balances.available`; their totals sum to
`balances.total` only when all account networks are inside the agent network
fence. Closed networks and inactive accounts have zero available; retired
wallets contribute to total alone. These figures describe the account; a quote
decides whether a particular payment can be funded.

```bash
npx catena accounts balance acct_...
```

### `accounts transactions`

Read an account's transaction history through the policy engine. Granted by the
same read access as `accounts balance` and never creates an intent. Returns
`{ accountId, transactions, total }` newest-first.

Rows show `amount`, `fee`, and `currency` in USD. `amount` is what the recipient
received when `tokenDetails` is present; `fee` includes fees, conversion cost,
and customer-paid gas. A movement within the same account shows amount zero and
its net cost as the fee. A net conversion credit can make the fee negative.
Without token details, the recorded amount and Catena fee are retained. Optional
`tokenDetails.debited[]` and `credited[]` entries contain `asset`, `network`,
and `amount` in USD at par. `asset` uses the same lower-case token symbols as
balance holdings. `paid`, when present, names a payment's destination token when
a different funding token was converted. Transfers name the other account as the
counterparty.

```bash
npx catena accounts transactions acct_...
```

Optional flags: `--start` / `--end` (ISO 8601 bounds), `--limit` (default 50,
max 200), `--offset` (pagination). Page until
`offset + transactions.length >= total`.

### `accounts deposit-address`

Read an account deposit address through the policy engine. `--network` and
`--asset` default to `base` and `usdc`. On a network without USDC, such as
Tempo, pass an `--asset` from `organization.heldAssets` in `setup-state`.

```bash
npx catena accounts deposit-address acct_... --network base --asset usdc
```

### `intents get`

Look up the current state of an intent created by this agent.

```bash
npx catena intents get int_...
```

Use `status` for stable control flow. `resolution` is `null` until the intent is
final, then identifies the exact terminal outcome: `completed`, `blocked`,
`denied`, `expired`, `failed`, or `cancelled`. Preserve future nonblank
resolution values when forwarding output.

The response includes a `data` field carrying the associated result once one
exists: the linked transaction for `send`/`transfer` intents, or the created
counterparty for `create_counterparty`. It is `null` when there is no associated
result yet. When `data` has a console destination, `metadata.dataUrl` contains
the browser URL for that result.

### `intents cancel`

Cancel an intent that is waiting for approval, is approved but has not begun
execution, or is executing a bank payment that is not yet signed. Repeating a
successful cancellation is safe.

```bash
npx catena intents cancel int_...
```

The command returns the same intent representation as `intents get`, with
`resolution: "cancelled"`. It cannot stop or reverse a bank payment once it is
signed, or any other payment once it is executing; ineligible intents return
HTTP 409 with `intent_not_cancellable`.

### `purchases`

Buy from a merchant's website with a one-time Stripe Link card, or with a
merchant token at a checkout that takes one. The agent's policy decides each
purchase, and a person approves it in the Catena console when the policy asks
for that. A person always approves it at Stripe Link. `catena guide` gives the
steps an agent follows.

```bash
npx catena purchases cards
npx catena purchases buy --amount 42.80 --merchant-name "..." \
  --merchant-url https://... --description "..." --idempotency-key <key>
npx catena purchases get int_... --wait --since <phase>
npx catena purchases card int_... --idempotency-key <key> --output-file <path>
npx catena purchases token int_... --idempotency-key <key> --output-file <path>
```

`buy` and `get` print the intent with the `phase` Catena gives it:
`awaiting_console`, `sending`, `awaiting_cardholder`, `requires_action`,
`ready`, `done`, `unknown`, or `unavailable`. `get --wait --since <phase>` takes
the phase of the response you last acted on, from `buy` or the last `get`. It
waits through `sending`, and through the other three of the first four while the
phase stays `<phase>`; without `--since`, it holds whichever of them it first
reads. On any other phase, one added later included, it returns at once. `card`
writes the approved card's number, CVC, expiry, and billing address to a new
file that only its owner can read, and refuses a path that exists. It prints
only the card's brand, last four digits, expiry, and `testCard`. Catena never
stores the card. Delete the file once the order is placed.

`buy --checkout-merchant acct_...` asks for a merchant token for that checkout
merchant instead of a card. `token` writes the approved token, its
`merchantAccountId`, and its `validUntil` to a new file the same way, and prints
only those two. Delete the file once the token is in the checkout.

### `feedback <message>`

Send free-form feedback about Catena to the Catena team. Use it to report a bug,
describe friction or a missing capability, or share an observation about working
with Catena. The message must be 1-4000 characters after trimming. Write-only:
previously submitted feedback cannot be read back.

Pass the message as a single quoted argument, or omit it and pipe the message on
stdin. Use stdin (or `--` before the argument) when the message starts with `-`
or spans multiple lines.

```bash
npx catena feedback "The transfer flow worked great"

npx catena feedback <<'EOF'
**Goal**
What I was trying to accomplish and why.

**Attempt**
What I tried, including relevant context.

**Outcome**
What happened and where I became blocked or confused.

**Evidence**
Relevant commands, inputs, responses, errors, documentation, or other concrete
observations. For a reproducible bug, include the reproduction steps, expected
behavior, and whether it reproduces consistently.

**Impact**
What I could not do, or what became unnecessarily difficult or risky.

**Workaround** _(optional)_
Any workaround I found and its limitations.
EOF
```

### `api <endpoint>`

Send a signed request to any agent API route with the selected profile, and
print the JSON response. Use it when no command does what you need. The endpoint
is a path under the agent API, and can include a query string.

```bash
npx catena api /me
npx catena api "/intents?status=pending" --paginate
npx catena api /feedback --field body="The balance call was slow"
npx catena api /pay-requests --data @body.json --header "Idempotency-Key: ..."
```

`--data` and `--field` select `POST` unless `--method` is set. With
`--method GET`, each `--field` goes into the query string. `--paginate` follows
`nextCursor` or `offset` and prints every page as one JSON array.

The command sends every route. For a route where a dedicated command does work
on this machine, it prints a `note:` line on stderr that names that command, and
sends the request anyway. These routes are creating an intent, signing a payment
intent, releasing a card, unlinking, and linking.

## Output and exit codes

Non-`link` commands print pretty JSON to stdout. Errors print to stderr and exit
with code 1.

Commands that pay or change a request, intent, counterparty, or policy say which
identity is acting: `send`, `transfer`, `x402`, `mpp`, `requests pay`,
`requests pay-incoming`, `requests create`, `requests cancel`, `intents cancel`,
`counterparties create`, `counterparties request-details`, `policy propose`, and
`policy request-override`, and also `requests verify` and
`accounts deposit-address`, whose answers can decide a payment. Each prints one
`acting as:` line to stderr before its first other request and adds `actingAs`
to its JSON, with `agentId`, `agentName`, `organizationId`, `profile`, `source`,
`apiUrl`, `confirmed`, and `confirmedAt`. Where a command prints an array, each
outcome has the key. `organizationId` is an ID, not the organization's name.
`confirmedAt` is when Catena last named the agent for this key: the CLI keeps
that answer for 24 hours in `cache/identities.json` in its directory, and asks
again sooner when the profile names a different agent. Within that day, a key
registered to another agent still shows the old agent. A profile chosen by
`--profile`, `CATENA_PROFILE`, or a directory binding names its agent, so Catena
refuses the command. A key alone, a default profile, or an only-linked profile
names none, so nothing refuses it. `confirmed: false` means the CLI could not
look the agent up: the name, organization, and `confirmedAt` are `null`,
`agentId` is too when the command signed with `CATENA_SECRET_KEY`, and the
command still ran.

`send` and `transfer` exit as soon as the intent is created and any immediate
next action is submitted. Inspect the returned `.status`, `.resolution`, and
`.reasons` fields, then use `npx catena intents get <intent-id>` to check
whether it later completes, requires approval, or fails.

## Configuration

| Variable            | Purpose                                                           | Default            |
| ------------------- | ----------------------------------------------------------------- | ------------------ |
| `CATENA_SECRET_KEY` | Agent P-256 secret key (64 hex). Selects no profile.              | none               |
| `CATENA_PROFILE`    | Credential profile name.                                          | none               |
| `CATENA_HOME`       | Absolute path for profiles, credential files, and saved requests. | `~/.config/catena` |
| `XDG_CONFIG_HOME`   | Base of the default directory, `$XDG_CONFIG_HOME/catena`.         | `~/.config`        |
| `DO_NOT_TRACK`      | Set to `1` or `true` to disable local failure reports.            | unset              |

## Local failure telemetry

The CLI reports at most one categorical local failure per invocation so Catena
can detect failures that never reach the API, such as an unavailable keychain or
an unreadable profile file. The only application and environment attributes the
CLI explicitly sends are a fixed failure code, the CLI version, the
operating-system family, the Node.js major version, and a telemetry schema
version. The event also contains fixed routing fields. Sentry adds a random
event ID, timestamps, and its SDK and package versions. The CLI does not send
command arguments, error messages, stack traces, file paths, URLs, credentials,
user or organization identifiers, or a persistent installation identifier.
Expected input errors, normal API errors, help and version commands,
cancellations, and successful commands do not report anything.

The reporting SDK is loaded only after an eligible failure. Reports get up to
two seconds to send, are never retried or stored locally, and cannot change the
command's result. Set `DO_NOT_TRACK=1` (or `DO_NOT_TRACK=true`) to disable it.

## Discovering options

Every command supports `--help`.

```bash
npx catena --help
npx catena send --help
npx catena counterparties create --help
npx catena counterparties create email --help
npx catena counterparties create bank --help
npx catena counterparties create wallet --help
npx catena counterparties request-details --help
```
