CLI Overview

What is the Ravi CLI?

The Ravi CLI (ravi) is a Go command-line client that gives AI agents programmatic access to their Identity — email, phone, credential vault, and 2FA. It’s designed to be used by both humans and AI agents.

Installation

brew install ravi-hq/tap/ravi

See Installation for more options.

Design principles

JSON-first output

All commands support the --json flag. JSON output is stable and designed for programmatic parsing by AI agents. Human-readable output is for interactive use only.

# For agents — structured, parseable
ravi inbox email --unread --json | jq -r '.[0].subject'

# For humans — formatted, readable
ravi inbox email --unread

Client-side encryption

The CLI handles all encryption and decryption locally. When you store a password, it’s encrypted before leaving your machine. When you retrieve one, it’s decrypted after arriving. The server never sees plaintext credentials.

Transparent token management

Access tokens refresh automatically. The CLI detects token expiry and refreshes before making the request. If a request returns 401, it retries once after refreshing. You never need to manually manage tokens.

Identity scoping

Every API request is scoped to the active Identity via the X-Ravi-Identity header. Switch Identities with ravi identity use <name> and all subsequent commands operate against that Identity.

Configuration

Configuration is stored in ~/.ravi/ with secure file permissions (0600):

FileContents
auth.jsonAccess token, refresh token, user email, encryption keypair
config.jsonActive Identity UUID and name

Per-project override

A .ravi/config.json in the current working directory overrides the global config. This allows different projects to use different Identities automatically.

Environment variables

The CLI respects two environment variable overrides. Neither is required for normal use, but both are important for container and multi-agent deployments:

VariableDescription
RAVI_CONFIG_DIROverride the config directory (default: ~/.ravi). Point this at a per-process directory to isolate Identity state between parallel agents — the preferred alternative to ravi identity use in concurrent processes.
RAVI_ACCESS_TOKENOverride the Bearer access token read from auth.json. Useful in containers and CI where ~/.ravi/auth.json may not exist: extract the token at launch time on a machine with a browser, pass it as a secret, and inject it here.

RAVI_CONFIG_DIR — parallel agent isolation

# Harness: set up one config dir per worker at dispatch time
mkdir -p /workspace/agent-1/.ravi
echo '{"identity_uuid":"<uuid-1>"}' > /workspace/agent-1/.ravi/config.json

# Worker process: every ravi call targets agent-1's Identity — no global state mutation
RAVI_CONFIG_DIR=/workspace/agent-1/.ravi ravi get email --json
RAVI_CONFIG_DIR=/workspace/agent-1/.ravi ravi inbox sms --unread --json

When set, RAVI_CONFIG_DIR takes precedence over the default ~/.ravi directory and over any .ravi/config.json found in the current working directory. This makes it the safest isolation mechanism for parallel processes.

For a complete harness integration example, see Harness Integration.

RAVI_ACCESS_TOKEN — container and CI auth injection

The device-code login flow requires browser access once. For environments that run headlessly from the start (Docker containers, GitHub Actions, serverless), extract the token on a machine with a browser and inject it:

# On a machine with a browser — run once
ravi auth login
cat ~/.ravi/auth.json | jq -r '.access_token'
# → eyJhbGci... (copy this value)

# In your CI secret store or Docker run command:
docker run -e RAVI_ACCESS_TOKEN="eyJhbGci..." my-agent
# In a GitHub Actions workflow:
- name: Run agent
  env:
    RAVI_ACCESS_TOKEN: ${{ secrets.RAVI_ACCESS_TOKEN }}
  run: ./agent.sh

Token expiry: Access tokens expire after 1 hour. For long-running containers, pass the full auth.json content and mount it at ~/.ravi/auth.json so the CLI can refresh automatically. RAVI_ACCESS_TOKEN is best for short-lived jobs; file-based auth is better for daemons.

Command groups

GroupPurpose
ravi authLogin, logout, check status
ravi identityCreate, list, switch Identities
ravi getGet email address, phone number
ravi inboxRead SMS and email (grouped by conversation/thread)
ravi messageRead individual messages (flat list)
ravi emailCompose, reply, reply-all
ravi passwordsWebsite credential CRUD
ravi secretsKey-value secret CRUD
ravi feedbackSend feedback to the Ravi team

Global flags

FlagDescription
--jsonOutput in JSON format (recommended for agents)
--helpShow help for any command
--versionShow version information

Next steps