CLI Reference

A complete reference for the ai command.

Usage

ai                 # start an interactive session in the current repo
ai "<request>"     # start a session with <request> as the first message
ai [options]

Coding sessions require an interactive terminal on both stdin and stdout. Piped prompts and redirected coding output are rejected; commands such as --help, --version, whoami, --usage, and --list-sessions remain redirectable.

Auth

CommandDescription
aiSigns you in if you aren't, then starts a session.
ai loginThe same thing; kept for muscle memory. Starts the session directly when you are already signed in.
ai whoamiShow the signed-in account.
ai --usageShow account usage percentage and reset times.
ai logoutSign out.

The sign-in screen opens your browser and, at the same time, prints a URL you can open on any other device and a box for an authorization code. Headless and remote machines need no separate command: open the URL wherever you have a browser, choose On another computer on that page, and paste the code it shows. Whichever route answers first signs you in.

Sessions

CommandDescription
ai --list-sessionsList saved sessions for this repo.
ai --session <id|name>Resume a saved session by id or name.

Sessions are stored locally and scoped to the current repo. Local history can be listed and resumed from that computer. Continuing a session through the service requires the TheGitAI account used for that session. The five most recent sessions per repo are kept.

Options

OptionDescription
-y, --yesStart in Auto-Accept mode.
-h, --helpShow help.

Chat commands

Used inside an interactive session:

CommandDescription
/helpShow help.
/aboutShow the installed version and platform information.
/usageShow account usage percentage and reset times.
/modelList supported models and pick one.
/model <id>Switch the active model without clearing history.
/resumeResume a saved session for this repo.
/jobsOpen the background jobs picker (browse, expand output, stop).
/jobs output <id>Print a background job's full captured output.
/jobs kill <id>Stop a background job by id.
/reportOpen the public GitHub issue form to file a bug.
/newstart a new conversation; this session remains saved
/logoutSign out and quit.
/exitQuit the session.

Environment

VariableDescription
THEGITAI_SESSION_DIROverride the default local directory for saved sessions.
Run ai --help at any time to print this reference in your terminal.