---
title: CLI Reference
description: Every ai command, flag, and in-session slash command for the TheGitAI CLI in one place.
---

# CLI Reference

A complete reference for the `ai` command.

## Usage

```bash
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

| Command | Description |
|---------|-------------|
| `ai` | Signs you in if you aren't, then starts a session. |
| `ai login` | The same thing; kept for muscle memory. Starts the session directly when you are already signed in. |
| `ai whoami` | Show the signed-in account. |
| `ai --usage` | Show account usage percentage and reset times. |
| `ai logout` | Sign 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

| Command | Description |
|---------|-------------|
| `ai --list-sessions` | List 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

| Option | Description |
|--------|-------------|
| `-y`, `--yes` | Start in Auto-Accept mode. |
| `-h`, `--help` | Show help. |

## Chat commands

Used inside an interactive session:

| Command | Description |
|---------|-------------|
| `/help` | Show help. |
| `/about` | Show the installed version and platform information. |
| `/usage` | Show account usage percentage and reset times. |
| `/model` | List supported models and pick one. |
| `/model <id>` | Switch the active model without clearing history. |
| `/resume` | Resume a saved session for this repo. |
| `/jobs` | Open 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. |
| `/report` | Open the public GitHub issue form to file a bug. |
| `/new` | start a new conversation; this session remains saved |
| `/logout` | Sign out and quit. |
| `/exit` | Quit the session. |

## Environment

| Variable | Description |
|----------|-------------|
| `THEGITAI_SESSION_DIR` | Override the default local directory for saved sessions. |

::tip
Run `ai --help` at any time to print this reference in your terminal.
::
