---
name: selera
description: Use Selera CLI to work with the user's Selera health records, upload medical documents, read lab values and source facts, add notes, and prepare doctor summaries. Use when the user asks to use Selera from a terminal or AI agent.
---

# Selera

Use the user's Selera account through the CLI. Selera performs document and note analysis, explanations and summary briefs on its server, with the same consent, card permissions and Free/Premium limits as the app.

## Start

If `selera` is missing, install it on macOS or Linux (arm64/x64, including musl):

```sh
curl -fsSL https://selera.health/install-cli | bash
```

The installer verifies SHA-256 and uses `~/.local/bin`. Follow its printed PATH instruction if needed; Node.js and Bun are not required.

```sh
selera commands --json
selera auth status --json
```

The installed version's catalog is the authority for commands, flags, body schemas, permissions, side effects, costs and retries. Inspect relevant command help rather than guessing a schema.

If authentication is missing or expired, run `selera auth login` (or `--no-browser` for a remote terminal). The user signs in, reads health-data consent, compares the code and approves in Selera's browser. Do not approve or accept consent on their behalf without their informed authorization. Sessions last 30 days. `auth logout` revokes the CLI session; the app's account menu can manage sessions too.

## Work with the intended card

```sh
selera persons list --json
selera subscription get --json
selera documents list --person PERSON_ID --json
selera entries list --person PERSON_ID --json
```

Use a returned card ID. Clarify which person the user means if their request is ambiguous; do not select a relative's card by guesswork. Fetch only the health information needed for the task. Avoid putting health data in logs, shell history or unrelated files. External agents may transmit CLI output to their own model provider; Selera account approval does not change that provider's data policy.

For an authorized upload:

```sh
selera documents upload report.pdf --person PERSON_ID --json
selera documents get DOCUMENT_ID --json
```

Uploads are asynchronous. Inspect the returned document's status before treating extracted facts as available. `waiting` means analysis needs allowance. Check `subscription get`; do not repeatedly retry or enable Premium to bypass a limit. `documents retry` asks Selera to start a failed/waiting analysis again. Notes use `notes create --file ./note.json`; they are analyzed without consuming the file-reading quota.

AI explanations require a Premium-covered card and have a per-user request limit. Doctor summaries include an AI brief only for a Premium-covered card. Care reminders use `plans`; account plans use `subscription`. No separate AI-provider key is needed.

## Output and mutations

Use `--json`. Successful JSON goes to stdout; progress and `{error:{code,message,status?,retryable}}` errors go to stderr. Exit codes: 0 success, 2 input, 3 authentication, 4 permission/consent, 5 missing, 6 conflict, 7 rate limit, 8 unavailable, 9 network, 10 internal.

Use private JSON files with `--file` or stdin with `--file -` for sensitive bodies and share tokens. Downloads need an explicit `--out` and never overwrite an existing file. `--locale uk|en` selects generated content's language (default uk). Requests default to 120 seconds; `--timeout` accepts 1–300.

Carry out only changes authorized by the user's task. `--yes` is required for deletion, access, sharing, consent and Premium changes; the flag itself is not user authorization. Family invitations send email. Share links grant access to anyone holding the token. Check the catalog's side effects and keep these actions within the user's stated scope.

Writes are never automatically retried. After a timeout or lost response, inspect current state before repeating; a write may already have succeeded. For exit 3, reauthenticate. For exit 4, resolve the stated permission/consent requirement with the user. For exit 7, respect the allowance and stop repeated attempts.

Preserve source dates, units, reference ranges and provenance when presenting health facts. Check important values against the original document; do not turn a CLI result into a diagnosis or treatment change.

The [public CLI guide](https://selera.health/cli.md) describes installation, workflows, limits and exit codes. [Privacy](https://selera.health/en/privacy) and [terms](https://selera.health/en/terms) describe account and health-data processing.
