# Droid CLI Reference

Complete reference for the Droid CLI, including commands and flags

## Installation

**macOS/Linux:** `curl -fsSL https://app.factory.ai/cli | sh`

**Homebrew:** `brew install --cask droid`

**Windows:** `irm https://app.factory.ai/cli/windows | iex`

**npm:** `npm install -g droid`

The Droid CLI operates in two modes:

- **Interactive (`droid`)** - Chat-first REPL with slash commands
- **Non-interactive (`droid exec`)** - Single-shot execution for automation and scripting

### Installing a specific version

Pin a version when upgrades must be reviewed and applied intentionally, such as in CI runners,
provisioned development environments, or other reproducible systems.

#### npm

Specify an exact package version:

```bash
npm install -g droid@0.174.0
```

The binaries published through npm have auto-updates disabled at build time, so the installed
version remains pinned. To upgrade, install the new version explicitly with npm.

#### Built-in updater

After installing Droid through the standalone installer, select a version with:

```bash
droid update --version 0.174.0
```

This command can also roll back to an older version. Use `droid update --check` to check for an
available update without installing it.

<Note>
  Standalone installations enable automatic updates by default. After selecting a version, follow
  the [auto-update guidance](#auto-updates) to keep it pinned.
</Note>

#### Direct binary download

Release binaries and their SHA256 checksums use the following paths:

```text
https://downloads.factory.ai/factory-cli/releases/<version>/<platform>/<arch>/<binary>
https://downloads.factory.ai/factory-cli/releases/<version>/<platform>/<arch>/<binary>.sha256
```

- `<platform>`: `linux`, `darwin`, or `windows`
- `<arch>`: `x64`, `arm64`, or `x64-baseline`
- `<binary>`: `droid` on Linux and macOS, or `droid.exe` on Windows

For example, download and verify the Linux x64 binary:

```bash
VERSION=0.174.0
BASE_URL="https://downloads.factory.ai/factory-cli/releases/${VERSION}/linux/x64"

curl -fsSLO "${BASE_URL}/droid"
curl -fsSLO "${BASE_URL}/droid.sha256"
echo "$(awk '{print $1}' droid.sha256)  droid" | sha256sum --check
chmod +x droid
```

Move the verified binary to a directory on `PATH`. The download URL layout is an implementation
detail, so always pin a version and verify its checksum.

## Droid CLI commands

| Command                              | Description                                                            | Example                                        |
| :----------------------------------- | :--------------------------------------------------------------------- | :--------------------------------------------- |
| `droid`                              | Start interactive REPL                                                 | `droid`                                        |
| `droid "query"`                      | Start REPL with initial prompt                                         | `droid "explain this project"`                 |
| `droid --resume [sessionId]`         | Resume a session (defaults to last modified). Alias: `-r`              | `droid --resume`                               |
| `droid --fork <sessionId>`           | Fork and resume a session in a new copy                                | `droid --fork session-abc123`                  |
| `droid exec "query"`                 | Execute task without interactive mode                                  | `droid exec "summarize src/auth"`              |
| `droid exec -f prompt.md`            | Load prompt from file                                                  | `droid exec -f .factory/prompts/review.md`     |
| `cat file \| droid exec`             | Process piped content                                                  | `git diff \| droid exec "draft release notes"` |
| `droid exec -s <id> "query"`         | Resume existing session in exec mode                                   | `droid exec -s session-123 "continue"`         |
| `droid exec --list-tools`            | List available tools, then exit                                        | `droid exec --list-tools`                      |
| `droid search "query"`               | Search across local sessions (messages, documents, tool results). Alias: `droid find` | `droid search "auth bug"`                      |
| `droid rules check`                 | Validate permission rules and optionally preview command policy | `droid rules check --command 'git push origin main'` |
| `droid loop <command>`               | Create, list, pause, resume, or cancel a session's recurring prompts; Droid runs them as tools in a session ([details](#schedule-recurring-prompts)) | `droid loop --help`                            |
| `droid work-item link`               | Link the calling session to a Linear issue; Droid runs it as a tool in a session ([details](#link-a-session-to-a-work-item)) | `droid work-item link --help`                  |
| `droid analytics effectiveness <command>` | Fetch usage for, and render, the Agent Effectiveness report ([details](#generate-an-agent-effectiveness-report)) | `droid analytics effectiveness usage --date-range last_30_days` |
| `droid analytics readiness store`    | Store a `/readiness-report` result; Droid runs it as a tool in a session ([details](#store-a-readiness-report)) | `droid analytics readiness store --help`       |
| `droid mcp add <name> <url>`         | Add an MCP server                                                      | `droid mcp add api https://api.example.com/mcp --type http`  |
| `droid mcp remove <name>`            | Remove an MCP server                                                   | `droid mcp remove linear`                      |
| `droid mcp auth`                     | Sign in to every MCP server that needs authentication, one at a time   | `droid mcp auth`                               |
| `droid plugin install <plugin>`      | Install a plugin. Alias: `droid plugin i`                              | `droid plugin install droid-control@factory-plugins` |
| `droid plugin uninstall <plugin>`    | Uninstall a plugin. Alias: `droid plugin remove`                       | `droid plugin uninstall droid-control@factory-plugins` |
| `droid plugin update <plugin>`       | Update a plugin to the latest version                                  | `droid plugin update droid-control@factory-plugins` |
| `droid plugin list`                  | List installed plugins                                                 | `droid plugin list`                            |
| `droid plugin marketplace`           | Manage plugin marketplaces                                             | `droid plugin marketplace`                     |
| `droid computer register [name]`     | Register this computer for Remote Control      | `droid computer register laptop`               |
| `droid computer remove`              | Remove this computer's Remote Control registration                                | `droid computer remove`                        |
| `droid computer list`                | List computers and Factory Environments as JSON; use `--human` for readable tables | `droid computer list --human`                  |
| `droid computer service-accounts list` | List service accounts (Manager role or higher)                  | `droid computer service-accounts list`         |
| `droid computer ssh <name>`          | SSH into a registered computer                                    | `droid computer ssh laptop`                    |
| `droid computer port-forward <name> <mappings...>` | Forward local ports to a computer over the relay        | `droid computer port-forward laptop 8080:80`   |
| `droid daemon`                       | Run the Factory daemon server                                          | `droid daemon`                                 |
| `droid daemon --remote-control`       | Connect this computer through [Remote Control](/remote-control). Alias: `--remote-access` | `droid daemon --remote-control`                |
| `droid update`                       | Manually update the CLI to latest version                              | `droid update`                                 |

## List computers and environments

`droid computer list` lists your computers and the Factory Environments visible to your
identity, including whether each Environment can launch. It is read-only and prints JSON
by default. Use `--human` for readable tables.

```bash
droid computer list
droid computer list --human
```

To list another identity's inventory, first list the organization's service accounts,
then select an active account by its ID or name. Both account discovery and account selection
require the **Manager role or higher**. Replace the example values with an account returned by
the first command:

```bash
droid computer service-accounts list
droid computer list --service-account-id sa_example
droid computer list --service-account-name "deploy-bot"
```

| Flag | Behavior |
| :--- | :------- |
| `--service-account-id <id>` | List the selected service account's computers and Factory Environments instead of your own. |
| `--service-account-name <name>` | Select the same inventory by account name. Supply either the ID or the name, not both. |
| `--human` | Print readable output instead of JSON; nonempty lists appear as a computer table followed by a Factory Environments table. |

The service-account list returns `{"ok": true, "data": {"serviceAccounts": [...]}}`.
Each account has `id`, `name`, and `status`. Deleted accounts are omitted; inactive
accounts remain visible, but only active accounts can be selected with the flags above
or run automations.

### Read the human output

In English, `--human` prints a computer table with `COMPUTER`, `STATUS`, `PROVIDER`, and `ID` columns and
marks this machine with `(this machine)` when Droid can identify it. When there are no
computers, it prints a message instead: how to register this machine for your own
inventory, or `No computers registered for service account "<name>".` for a selected
account.

When Environments are returned, a `Factory Environments:` section follows after a blank
line. The table has `ENVIRONMENT`, `STATUS`, `SCOPE`, `LAUNCHABLE`, and `ID` columns, and
`LAUNCHABLE` is `yes` or `no`. For example, with illustrative names and IDs:

```text
COMPUTER               STATUS  PROVIDER  ID
laptop (this machine)  active  byom      3f2a9c1e-5b7d-4e8a-9c0f-1d2e3f4a5b6c
dev-box                active  e2b       8b1c2d3e-4f5a-4b6c-8d7e-9f0a1b2c3d4e

Factory Environments:
ENVIRONMENT   STATUS    SCOPE         LAUNCHABLE  ID
team-default  ready     organization  yes         0c56098a-c40d-4a56-bdd2-8f58120dc456
my-sandbox    building  user          no          6de596d4-1a67-4ebc-be46-61265c198698
```

With `--service-account-id` or `--service-account-name`, the heading is
`Factory Environments service account "<name>" can launch:`.

If the Environment lookup fails, one line replaces the Environments section, and the
computers still list. The HTTP status appears when one is available:

```text
Factory Environments could not be listed (HTTP <status>: <error>).
```

Without an HTTP status, the line is `Factory Environments could not be listed (<error>).`
When the lookup succeeds with no Environments, the section is omitted.

### Read the JSON result

A successful computer list returns `{"ok": true, "data": {...}}` with these fields:

| Field | Meaning |
| :---- | :------ |
| `data.serviceAccount` | The selected account (`id`, `name`, `status`), or `null` for your own inventory. |
| `data.computers` | Computer rows with `id`, `name`, `providerType`, `thisMachine`, and `status` when known. An unknown status appears as `unknown` in the human table. |
| `data.environments` | A successful Environment lookup (`ok: true`, `items`) or a failed lookup (`ok: false`, `error`, and an HTTP `status` when available). |

Each Environment item has `id`, `name`, `status`, `scope`, and `launchable`. Use an
Environment with `launchable: true` when choosing an automation's `environmentName`.
Account selection applies to both the computers and Environments in the result.

An Environment lookup can fail while the computer list succeeds. Check
`data.environments.ok` before reading `items`: `ok: false` means the lookup failed,
**not** that no Environments exist. The top-level `ok` can still be `true`, and the
command can exit successfully with the computer inventory intact.

### Migrate existing scripts and prompts

`droid computer list` defaults to JSON. If a script expects the computer table, add
`--human` and account for the Factory Environments section, or update the script to read
`data.computers` and handle `data.environments` separately.

Update tool names in prompts and automation instructions:

| Previous tool | Current tool |
| :------------ | :----------- |
| `ListComputers` | `computer_list` (Script: `tools.computer.list`) |
| `ListServiceAccounts` | `computer_service_accounts_list` (Script: `tools.computer.service_accounts_list`) |
| `PickSlackChannels` | Removed. |

## Check permission rules

Use `droid rules check` to validate [permission rules](/autonomy-and-safety/permission-rules),
run their embedded matching examples, and preview a decision without executing a command.

```bash
droid rules check
droid rules check --command 'git push origin main'
droid rules check --file rules.json --command 'npm publish' --json
```

| Option | Behavior |
| :----- | :------- |
| `--file <path>` | Check a standalone `{version, rules}` object or bare rule array. Does not load built-ins or other settings. A full `settings.json` wrapper is not accepted. |
| `--command <shell-command>` | Preview the policy decision for a non-empty command. Quote it so your shell passes it as one argument. |
| `--json` | Print the report as one JSON object, including rule diagnostics and, when requested, decision and match details. |

Without `--file`, the checker validates resolved settings. A command preview follows the
active policy engine; validating rules does not enable enforcement on a client still
using legacy policy.

Exit code `0` means the check succeeded, even if the preview says `block`. Invalid rules
or failed examples produce exit code `1`. Preview covers command policy only, not
hooks, sandbox permissions, autonomy, or session approvals.

The `commandAllowlist`, `commandDenylist`, and `commandBlocklist` settings are deprecated
but remain respected for backward compatibility. Use `permissionRules` for new policy;
see [migration guidance](/autonomy-and-safety/permission-rules#migrate-legacy-command-lists).

## Run loop, work item, and analytics commands

`droid loop`, `droid work-item link`, and `droid analytics` are the command form of tools
that Droid calls during a session. The `droid analytics effectiveness` commands and their tools
share one schema: each flag is a field of the tool, spelled in kebab case on the command line,
and the tool returns the command's `data`. For example,
`droid analytics effectiveness usage --date-range last_30_days` is the
`analytics_effectiveness_usage` tool with `dateRange: "last_30_days"`, which a Script calls as
`tools.analytics.effectiveness_usage`. The `droid loop` commands, `droid work-item link`, and
`droid analytics readiness store` run only as tools or in a Script. Their commands accept no
input; they name the tool to call instead.

Where a command runs decides what it does:

| Where | Behavior |
| :---- | :------- |
| A Droid session | Droid calls the tool directly. If the session's shell runs one of these commands, it exits `1` with `in_process_command` and names the tool to call instead. |
| A terminal outside any session | The `droid analytics effectiveness` commands run. The `droid loop` commands, `droid work-item link`, and `droid analytics readiness store` exit `1` with `in_process_command` and name the tool to call, because each acts on a session. |

A command prints `{"ok": true, "data": {...}}` to stdout and exits `0` when it succeeds.
A failure prints `{"ok": false, "code": "...", "error": "..."}` to stderr, sometimes with
`details`, and exits `1`. A command group that is not enabled for your organization fails
with an unknown-command error instead, and a failure while Droid starts, such as a settings
file it cannot read, can print a plain-text error instead. A flag that takes JSON accepts it
inline or from a file, as in `--request @request.json`.

| Code | Meaning |
| :--- | :------ |
| `invalid_input` | The command line could not be parsed, such as an unknown flag or an `@file` that cannot be read; a flag or tool field failed its schema; or `loop_resume` was given a listed loop that is not paused. |
| `not_found` | The loop ID matched no loop in this session, or `loop_pause` or `loop_resume` was given a cancelled or expired loop. |
| `unavailable` | The command needs a session, this machine cannot schedule loops, or session contents sync is off. |
| `permission_denied` | A permission rule or the sandbox denied a file the command writes, such as the report `droid analytics effectiveness render` saves. |
| `in_process_command` | A session's shell ran the command, or a terminal ran a command that runs only as a tool. `details.tool` and `details.scriptPath` name the tool to call. |
| `request_failed` | The local daemon or Droid refused a request the command made. When Droid answered, `status` carries its HTTP status. |

In Airgap Mode, Droid does not offer the `work_item_link` and `analytics_effectiveness_usage`
tools, because each needs Droid on every run.

### Schedule recurring prompts

In a session, type `/loop <interval> <prompt>` or ask Droid to repeat a task on a schedule.
`/loop <interval> <prompt>` schedules the loop directly; for a request in prose, Droid creates
the loop with the `loop_create` tool. `/loop status` lists the session's
loops, and `/loop stop <loop-id>` stops one (`/loop stop all` stops every loop in the
session).

```text
> /loop 30m check the CI run on my pull request and fix any failure
```

Loops fire from the daemon on the session's machine, so they run on your own machine and on
[Computers](/droid-computers/overview). On your own machine, a loop runs only while its
session is open. On a Computer, a loop keeps running after you leave the session: each run
wakes the Computer and reopens the session. There a loop expires seven days after it is
created or last resumed, rescheduled, or given a new prompt, so a forgotten loop does not keep
running unattended. Workspace sandboxes cannot schedule loops, because nothing wakes a paused
sandbox for a scheduled run.

Droid manages a session's loops with five tools, which a Script calls as `tools.loop.create`,
`tools.loop.list`, `tools.loop.pause`, `tools.loop.resume`, and `tools.loop.cancel`:

| Tool | What it does | Fields |
| :--- | :----------- | :----- |
| `loop_create` | Schedule `prompt` as a recurring prompt for the calling session. Inside a Task, the loop belongs to the session that launched the Task when the Task's session records one, and otherwise to the Task's own session. Runs only in a session. | `prompt` and `cron`, both required; `waitForSchedule` |
| `loop_list` | List the session's loops, with their IDs, schedules, and states. | None |
| `loop_pause` | Stop a loop from running and keep it, so `loop_resume` can restart it. | `loopId` |
| `loop_resume` | Run a paused loop on its schedule again. A listed loop that is not paused fails with `invalid_input`; a cancelled or expired loop, which `loop_list` does not show, fails with `not_found`. | `loopId` |
| `loop_cancel` | Delete a loop. Cancelling a loop that is already cancelled succeeds again. | `loopId` |

For example, a Script schedules a loop that checks CI every 15 minutes, starting at the first
scheduled run, with
`tools.loop.create({ prompt: "check CI", cron: "*/15 * * * *", waitForSchedule: true })`.

`cron` takes a five-field cron expression in UTC:

- A step cadence such as `*/15 * * * *` or `0 */2 * * *` is anchored to the minute the loop
  is created, so its scheduled runs fall on minute boundaries. It must be an exact
  interval from 1 minute to 24 hours.
- A time of day, such as `0 9 * * *` for 09:00 UTC, is kept as written.
- The loop also runs once right away unless `waitForSchedule` is `true`. Without that run,
  the scheduler skips a first scheduled run that falls less than 30 seconds after the loop
  is created.

A loop belongs to the session that created it. A loop created inside a Task belongs instead
to the session that launched the Task, when the Task's session records one. Each run prompts
the session the loop belongs to. To manage
a session's loops, use `/loop` in that session or ask Droid.

#### Read the loop output

`/loop status` prints one line per loop:

```text
6503a90d · active · next 9:15am · expires in 7d · #3 · check CI
```

The fields are the loop ID; its state, such as `active` or `paused`; the next run time, or
the cadence when no run is scheduled or the loop is paused; `expires in <time>` when the
loop expires; `#` and the number of runs so far; and the start of the prompt.
`/loop status` prints `No scheduled loops.` when there are none. When `/loop <interval> <prompt>`
creates a loop, it shows the schedule and the same line for the new loop.
`loop_pause`, `loop_resume`, and `loop_cancel` fail with `not_found` when the loop ID matches
no loop in the session, such as
`Loop 6503a90d was not found among this session's loops.`

`loop_create`, `loop_pause`, and `loop_resume` return the loop record as `loop`, `loop_list`
returns `loops`, and `loop_cancel` returns `loopId`. A loop record carries `id`,
`status`, `schedule.expression`, `schedule.nextRunAt` when a run is scheduled,
`expiresAt` when the loop expires, and `stats.fireCount`.

### Link a session to a work item

Linking a session to a Linear issue records which issue the session works on, so
Droid can track the session's cost and productivity against it. In a session,
type `/link-work <url>`, or tell Droid which issue the session is for; Droid links it with
the `work_item_link` tool (`tools.work_item.link` in a Script), the tool form of
`droid work-item link`. The tool tells Droid to link only an issue you identify as the
session's work, not one the conversation mentions in passing.

```text
> /link-work https://linear.app/acme/issue/PLT-524
```

`/link-work` with no URL shows the session's current link, and `/link-work clear` removes
it. A session links one issue at a time: the latest link replaces the previous one,
whether you or Droid made it.

Linking needs:

- Work item linking enabled for your organization. Until Droid enables it,
  `/link-work` is hidden, Droid does not offer `work_item_link`, and
  `droid work-item link` fails with `unknown command 'work-item'`.
- Session contents sync, because the link is stored with the synced session. With sync
  off, linking fails with `unavailable`.

The `work_item_link` tool takes `workItemUrl`, a full Linear URL, such as
`https://linear.app/acme/issue/PLT-524`. A bare issue key such as `PLT-524`, or a URL
outside Linear, fails with `invalid_input`. The stored URL drops any credentials, query
string, and fragment. The tool returns the stored
`workItemUrl`, `platform` (`linear`), and `ticketId`: the issue key, or `null` when the
URL names no issue.

### Generate an Agent Effectiveness report

`/agent-effectiveness-report` builds an HTML report that relates your organization's
Droid usage to the pull requests and work items your team delivered. Add a
timeframe, or Droid asks for one: the last 30 days, the last 90 days, lifetime, or a
custom start and end date.

```text
> /agent-effectiveness-report last 30 days
```

Droid fetches usage from Droid with the `analytics_effectiveness_usage` tool,
collects merged pull requests with the GitHub CLI and work items from Linear or Jira, joins
them by person, and renders the report with the `analytics_effectiveness_render` tool.
Droid does not upload pull request or work item data to Droid; it joins and
renders them on the session's machine, then saves the report as an HTML file and tries to
open it in your browser. In a headless environment, or when opening fails, Droid gives you
the file's path and link instead.

The report needs:

- The Owner or Manager role in an organization where Droid has enabled the
  report. `/agent-effectiveness-report` is listed only for those users.
- Linear or Jira access, through an MCP server or an API key.
- The GitHub CLI (`gh`), signed in to an account that can see your organization's GitHub
  organization.

Without Linear or Jira access, or without `gh` access, Droid stops instead of rendering a
partial report.

#### Run the report steps yourself

`droid analytics effectiveness` runs the same two steps from a terminal or a script. Both
commands print JSON; neither takes `--human`.

| Command | What it does | Example |
| :------ | :----------- | :------ |
| `droid analytics effectiveness usage` | Fetch per-user usage and organization totals for a date range. Needs the same role and enablement as the report. | `droid analytics effectiveness usage --date-range last_30_days` |
| `droid analytics effectiveness render` | Render the report from usage and the pull requests and work items you collected, and save it as an HTML file. | `droid analytics effectiveness render --request @request.json --coding-usage @usage.json --daily-usage-rows @daily.json` |

`usage` takes the date range:

| Flag | Behavior |
| :--- | :------- |
| `--date-range <range>` | `custom` (the default), `last_30_days`, `last_90_days`, or `lifetime`. |
| `--start-date <date>` | First day of the range, as `YYYY-MM-DD`. Required with `custom`. |
| `--end-date <date>` | Last day of the range, as `YYYY-MM-DD`, inclusive. Required with `custom`. |

A range other than `lifetime` covers at most 90 days; a longer one fails with
`request_failed` and `status` `400`. For a user who is not an Owner or Manager, or an
organization without the report enabled, `usage` fails with `request_failed`. On success,
`data` carries `organizationId`, `organizationName`, the resolved `startDate` and
`endDate`, `generatedAt`, `codingUsage`, and `totalUsage`. `codingUsage` has one row per
user, with `userId`, `userEmail`, `sessions`, `billingEvents`, `billableTokens`,
`droidCommits`, `droidPrsCreated`, `toolCalls`, `skillCalls`, and `fileOperations`.
`totalUsage` holds the organization's `sessions`, `billingEvents`, and `billableTokens`.

`render` takes the collected data:

| Flag | Behavior |
| :--- | :------- |
| `--request <json\|@file>` | Required. The report request: the organization's ID and name, the resolved date range, the work items, pull requests, and repositories you collected, and render options. |
| `--coding-usage <json\|@file>` | Required. The `codingUsage` rows `usage` returned for the same range, unchanged. |
| `--total-usage <json\|@file>` | The `totalUsage` that `usage` returned. The headline credits figure uses it; every chart and per-user figure uses `codingUsage`. |
| `--daily-usage-rows <json\|@file>` | Required. One entry per day of the range: the date and the `codingUsage` rows of a `usage` call for that day alone. A count of entries that differs from the number of days fails with `invalid_input`. A repeated or out-of-range date is not rejected when the count matches, so give each date exactly once. |

`render` makes no request to Droid. It saves `agent-effectiveness-report-<start>-to-<end>.html`
in an `agent-effectiveness-report` directory under the system temporary directory, and
returns `data.filename`, `data.path`, `data.fileUrl`, and `data.trendPointCount`, the
number of days in the report's daily trend.

### Store a readiness report

[`/readiness-report`](/agent-readiness/readiness-report) evaluates the repository, then
Droid stores the result with the `analytics_readiness_store` tool
(`tools.analytics.readiness_store` in a Script), the tool form of
`droid analytics readiness store`. Storing a report runs only in a session.

The `readinessReportUpload` setting decides where the report goes. `always` uploads it to
Droid, `never` keeps it off Droid, and `ask` or no setting asks you
first when the session can ask you. A refresh you start from the readiness page in
Droid uploads without asking, unless the setting is `never`. When the report is
not uploaded, because of the setting, a declined or impossible ask, Airgap Mode, or a failed
upload, Droid saves it in the repository's `.factory` directory.

`analytics_readiness_store` takes these fields:

| Field | Behavior |
| :---- | :------- |
| `repoUrl` | Required. Repository URL, such as `https://github.com/owner/repo`. The username and password of an HTTP or HTTPS URL are stripped before the report is stored. |
| `report` | Required. Each readiness criterion's numerator (`null` when skipped), denominator, and rationale. Every criterion key is required. |
| `apps` | Map of app paths to their descriptions, for monorepos, such as `{"apps/web": {"description": "Customer dashboard"}}`. |
| `commitHash` | Commit the report describes (`git rev-parse HEAD`). |
| `branch` | Branch the report describes (`git rev-parse --abbrev-ref HEAD`). |
| `hasLocalChanges` | The working tree had uncommitted changes. |
| `hasNonRemoteCommits` | The branch had commits not pushed to its remote. |
| `modelUsed` | Model and reasoning level that generated the report: `id` and `reasoningEffort` (`low`, `medium`, `high`, or `off`). |

The result says whether the report was uploaded:

| `uploaded` | Other fields |
| :--------- | :----------- |
| `true` | `reportId`, the report's ID in Droid. |
| `false` | `reason`: `disabled_by_setting`, `declined`, `consent_unavailable`, `airgap`, or `upload_failed`. `localPath`: where the report was saved. For `disabled_by_setting`, `declined`, or `consent_unavailable`, a failed save gives `localPath` `null`, with `localError` saying why. |

When saving fails in Airgap Mode, the call fails with that save's error, such as
`permission_denied`. When the upload and then the save both fail, the call fails with
`request_failed`.

### Update tool names in prompts and automations

These tools replace earlier tools. Update tool names in prompts, automation instructions,
and tool selectors:

| Previous tool | Current tool |
| :------------ | :----------- |
| `Loop` | `loop_create`, `loop_list`, `loop_pause`, `loop_resume`, and `loop_cancel` (Script: `tools.loop.create`, `tools.loop.list`, `tools.loop.pause`, `tools.loop.resume`, `tools.loop.cancel`) |
| `LinkWorkItem`, `link-work-item-cli` | `work_item_link` (Script: `tools.work_item.link`) |
| `get_agent_effectiveness_usage` | `analytics_effectiveness_usage` (Script: `tools.analytics.effectiveness_usage`) |
| `render_agent_effectiveness_report` | `analytics_effectiveness_render` (Script: `tools.analytics.effectiveness_render`) |
| `store_agent_readiness_report` | `analytics_readiness_store` (Script: `tools.analytics.readiness_store`) |

A denial of a previous tool, such as `--remove-tools Loop`, also denies the tools that
replaced it. Selectors that add tools, `--only-tools` and `--add-tools`, need the current
names.

## Droid CLI flags

Customize droid's behavior with command-line flags:

| Flag                              | Description                                                        | Example                                                      |
| :-------------------------------- | :----------------------------------------------------------------- | :----------------------------------------------------------- |
| `-f, --file <path>`               | Read prompt from a file                                            | `droid exec -f plan.md`                                      |
| `-m, --model <id>`                | Select a specific [model ID](/models)                              | `droid exec -m claude-opus-5-5`                              |
| `-s, --session-id <id>`           | Continue an existing session                                       | `droid exec -s session-abc123`                               |
| `--auto <level>`                  | Set [autonomy level](#autonomy-levels) (`low`, `medium`, `high`)   | `droid exec --auto medium "run tests"`                       |
| `--only-tools <ids>`              | Use only these tools: names such as `Read`, or `MCP:<server>[/<tool>]` (comma or space separated) | `droid exec --only-tools Read,Grep,Glob,LS`                  |
| `--add-tools <ids>`               | Add tools to the default set (same selectors as `--only-tools`)    | `droid exec --add-tools MCP:linear`                          |
| `--remove-tools <ids>`            | Remove tools from the allowed set (same selectors as `--only-tools`) | `droid exec --auto low --remove-tools Execute`               |
| `--disable-builtin-skills`        | Disable Factory-provided builtin skills in interactive or exec sessions while preserving other skill sources | `droid --disable-builtin-skills` |
| `--list-tools`                    | Print available tools and exit                                     | `droid exec --list-tools`                                    |
| `-o, --output-format <format>`    | Output format (`text`, `json`, `stream-json`, `stream-jsonrpc`)    | `droid exec -o json "document API"`                          |
| `--input-format <format>`         | Input format for multi-turn sessions. Use `stream-jsonrpc`; the older `stream-json` mode is deprecated. Must match `--output-format`. | `droid exec --input-format stream-jsonrpc -o stream-jsonrpc` |
| `-r, --resume [sessionId]`        | Resume a previous session. In interactive mode, `-r` is `--resume`; in `droid exec`, `-r` is `--reasoning-effort`. | `droid -r`                                                   |
| `-r, --reasoning-effort <level>`  | Override reasoning effort; valid levels are model-dependent (see [/models](/models)). In `droid exec`, `-r` maps to this flag. | `droid exec -r high "debug flaky test"`                      |
| `--spec-model <id>`               | Use a different [model ID](/models) for specification planning     | `droid exec --spec-model claude-opus-5-5`                    |
| `--spec-reasoning-effort <level>` | Override reasoning effort for spec mode                            | `droid exec --use-spec --spec-reasoning-effort high`         |
| `--use-spec`                      | Start in specification mode (plan before executing)                | `droid exec --use-spec "add user profiles"`                  |
| `--skip-permissions-unsafe`       | Skip all permission prompts; command blocks still apply (unsafe) | `droid exec --skip-permissions-unsafe`                       |
| `--cwd <path>`                    | Execute from a specific working directory (use an absolute path)   | `droid exec --cwd "$PWD/service" --auto medium "run tests"`      |
| `-w, --worktree [name]`           | Run the session in an isolated [git worktree](#git-worktrees)      | `droid --worktree fix-bug`                                   |
| `--tag <spec>`                    | Session tag (name or JSON, repeatable)                             | `droid exec --tag code-review`                               |
| `--log-group-id <id>`             | Log group ID for filtering logs                                    | `droid exec --log-group-id grp-123`                          |
| `--fork <id>`                     | Fork and resume an existing session into a new copy                | `droid exec --fork session-abc123`                           |
| `--mission`                       | Run `droid exec` in [Mission Mode](/missions/overview) (multi-agent orchestration). Requires `--auto high` or `--skip-permissions-unsafe`. | `droid exec --mission --auto high -f mission.md`             |
| `--worker-model <id>`             | Model used for mission worker agents                               | `droid exec --mission --worker-model claude-opus-5-5`      |
| `--worker-reasoning-effort <level>` | Reasoning effort for mission worker agents (model-dependent; see [/models](/models)) | `droid exec --mission --worker-reasoning-effort medium`      |
| `--validator-model <id>`          | Model used for mission validator agents                            | `droid exec --mission --validator-model gpt-6.2-sol`     |
| `--validator-reasoning-effort <level>` | Reasoning effort for mission validator agents                  | `droid exec --mission --validator-reasoning-effort high`     |
| `--append-system-prompt <text>`   | Append custom text to the end of the system prompt                 | `droid --append-system-prompt "Always run tests."`           |
| `--append-system-prompt-file <path>` | Append the contents of a file to the end of the system prompt   | `droid --append-system-prompt-file .factory/system.md`       |
| `--settings <path>`               | Apply a [settings](/droid-cli/settings) file merged on top of the normal settings hierarchy, for this process only | `droid exec --settings ./runtime-settings.json`              |
| `-v, --version`                   | Display CLI version                                                | `droid -v`                                                   |
| `-h, --help`                      | Show help information                                              | `droid --help`                                               |

<Tip>
  Use `--output-format json` for scripting and automation, so you can parse droid's responses
  programmatically.
</Tip>

<Note>
  `--output-format` controls how `droid exec` serializes results. Your saved
  [output style](/droid-cli/output-styles) controls how Droid writes the responses inside them.
</Note>

## Manage automations

Create and manage [automations](/automations/custom) from a Droid session. Type
`/automations` to open this machine's scheduled automations, or ask Droid to create, list,
read, edit, delete, or run an automation. Droid does this with the automation tools; there
is no `droid automations` command.

```text
> /automations
```

| Tool | What it does |
| :--- | :----------- |
| `ListAutomationTemplates` | List the prompt presets that `CreateAutomation` applies with `templateId`. Pass `trigger` to list only the presets for that trigger. |
| `ListAutomations` | List the scheduled automations on this machine, or the scheduled, webhook, Slack, and chained automations in the cloud. It omits prompts; use `ReadAutomation` to read one. |
| `ReadAutomation` | Show one automation and its full prompt. When this machine's daemon cannot supply a local automation's prompt, the result says so instead. |
| `CreateAutomation` | Create an automation. `trigger` is `schedule` (the default), `webhook`, `slack`, or `automation` for a chained automation. |
| `EditAutomation` | Change an automation. A new `prompt` replaces the whole prompt. |
| `DeleteAutomation` | Delete an automation. Deleting a webhook automation also retires its URL. |
| `RunAutomation` | Start a run now, without waiting for it to finish. Pass exactly one of `automationId` and `automationName`; `automationName` matches an exact name, ignoring case. |

`CreateAutomation`, `ListAutomations`, `ReadAutomation`, `EditAutomation`, and
`DeleteAutomation` require `executionLocation`: `local` for automations on this machine, or
`remote` for automations in the cloud. `ListAutomationTemplates` and `RunAutomation` do not
take it. Webhook, Slack, and chained automations are always `remote`. A local schedule
runs only while the desktop app or a standalone `droid daemon` is running on this machine; a
terminal session alone does not run it. Factory-managed Droid Computers never run local
schedules, so create a `remote` automation there.

Creating an automation needs a `name` and a `prompt`, unless a Slack automation
(`trigger: "slack"`) uses `templateId: "incident-response"`, which supplies them. That
template applies the Incident Response preset: its name and prompt, `messageSource: "bots"`,
and `sessionPrivacy: "team"`. Fields you pass override the preset. New automations default
to `status: "active"`; pass `status: "paused"` to create one paused. A scheduled automation
needs a `schedule`.

`model` accepts a model ID, a display name, or `cheapest`, the available built-in model,
other than Router, with the lowest credit multiplier. Omit `model` and `reasoningEffort` to
use the defaults. On `EditAutomation`, an empty string clears either one, and only a remote
automation's `reasoningEffort` can be changed. A remote automation's `description` takes up
to 1,024 characters, and creating a remote automation also takes up to 16 `tags`.

On a remote create, `privacyLevel` is `private` or `organization`, and `sessionPrivacy` is
`private` or `team`. Unless a service account or the Incident Response preset sets them,
both default to `private`; with `privacyLevel: "organization"`, run sessions default to
`team`.

A remote automation needs exactly one run target: `computerName` or `computerId` for a
computer, or `environmentName` or `environmentId` to start each run on a fresh computer built
from a Factory Environment. To deliver runs into an existing session instead, pass
`deliverToSessionId` (`"current"` for the session you are in) and no run target. Runs then
happen wherever that session lives, and the automation cannot start a chain.
`executionLocation` is still required. The session's autonomy, model, and tools stay in
effect, so `model` and `reasoningEffort` do not apply, and a run can wait for your
permission. Slack automations cannot deliver into a session. To deliver into a session on
another machine that is not a registered computer, create the automation from that machine.

On `EditAutomation`, for a remote automation created with session delivery,
`deliverToSessionId` moves its deliveries to another session on the same kind of machine; it
cannot turn session delivery off, and `computerId` is refused. Session delivery cannot be
added to an automation created without it. For a remote automation that runs on a computer
and does not deliver into a session, `computerId` moves it to another computer, and a
service-account automation must stay on one of that account's computers. An automation that
runs on an Environment or on the organization default refuses a `computerId` edit.

To run a remote automation as a service account, pass `runAsServiceAccountName` or
`runAsServiceAccountId` with an active account you can select (see
[List computers and environments](#list-computers-and-environments)), and target one of that
account's computers or a Factory Environment. Such an automation defaults to
`privacyLevel: "organization"` and `sessionPrivacy: "team"`.

Creating an active remote scheduled automation also starts its first run right away, unless
it delivers into a session, which waits for its next scheduled time. If that run cannot
start, the automation stays created and the result says why. Webhook, Slack, and chained
automations wait for their first delivery, message, or upstream run.

A chained automation (`trigger: "automation"`) runs when a run of one of the automations in
its `triggeredByAutomationIds` ends, completed or failed. Its sources are up to five
scheduled, webhook, or chained cloud automations with the same owner, not Slack or CI
automations; loops are rejected, and each source can start at most five automations. A new
chain can be at most five automations deep, counting the first. Remote scheduled, webhook,
and Slack automations can also take `triggeredByAutomationIds`, and their own trigger keeps
working alongside those sources. On `EditAutomation`, `triggeredByAutomationIds` replaces
the whole list, and an empty list clears it. `passUpstreamContext` decides whether the
source run's outcome and final message enter the prompt, marked as untrusted. It defaults
to `true`; omit it on `EditAutomation` to keep the current value.

`CreateAutomation` returns a webhook automation's receiver URL and its secret. The secret
cannot be read back later; the URL can be found again in the web app. `EditAutomation` with
`rotateWebhookSecret` invalidates the current secret at once and returns the replacement
once, with the receiver URL. `payloadRegex` filters deliveries by their raw body. It takes a
JavaScript regular expression, without flags, that RE2 can run, so lookahead, lookbehind,
backreferences, and inline modifiers are rejected; on `EditAutomation`, `payloadRegex: ""`
clears the filter. `maxRunsPerHour` caps the runs that deliveries start in each clock hour:
an integer from 1 to 60, `10` by default.

For a Slack automation, `messageSource` is `anyone` (the default), `humans`, or `bots`.
Omit `messageSource` on `EditAutomation` to keep its current value.
With `keywords`, only a message that contains at least one of the phrases starts a run. A
message that contains an `excludedKeywords` phrase, or comes from an `excludedAuthors`
sender, never does, even when it matches `keywords`. On `EditAutomation`, `addKeywords` and
`removeKeywords`, `addExcludedKeywords` and `removeExcludedKeywords`, `addExcludedAuthors`
and `removeExcludedAuthors`, and `addSlackChannelPatterns` and `removeSlackChannelPatterns`
change one list without replacing the rest of it.

`CreateAutomation`, `EditAutomation`, `DeleteAutomation`, and `RunAutomation` ask for your
approval, subject to your [autonomy level](#autonomy-levels); `ListAutomationTemplates`,
`ListAutomations`, and `ReadAutomation` do not, and neither does a call that only chooses
Slack channels. In `droid exec` at the default autonomy, Droid can list templates, list
automations, and read one. Creating, editing, or running an automation is medium risk.
Deleting one, or creating one that runs as a service account, is high risk. In Airgap Mode,
the seven automation tools are not available, and `/automations` is hidden and does not run.

### Choose Slack channels

To have you pick a Slack automation's channels, Droid first calls `CreateAutomation` with
only `trigger: "slack"`, `executionLocation: "remote"`, `chooseSlackChannels: true`, and an
optional `nameFilter`, which matches part of a channel name, ignoring case; it is not a
wildcard pattern. That call creates nothing. Called directly in an interactive CLI session
that can ask you questions, it opens a channel picker and returns your selection. In the
picker, Ctrl+R reloads the channels, and Esc cancels the picker and stops Droid's turn.
Called from a Script, or in a session that cannot ask you questions, it returns the channels
the Factory Slack app can see, and Droid confirms the set with you. Droid then creates the
automation with the chosen channels as `slackChannels`.

For an existing Slack automation, `EditAutomation` with `chooseSlackChannels: true` and no
other change edits nothing. Called directly in an interactive CLI session that can ask you
questions, it opens the picker with the current channels selected and reports the channels
added and removed; from a Script or elsewhere, it lists the channels the Factory Slack app
can see, with the current ones marked. After a selection in the picker, the result lists
separately the current channels the picker could not offer and treats them as unchanged. A
channel can be missing because it is archived, the Factory Slack app is not in it, or it is a
private channel you cannot see. Droid then applies the change with `addSlackChannels` and
`removeSlackChannels`.

### Read automation results

The automation tools return their results as text for Droid to read. When `ReadAutomation`
finds the automation, the result ends with its full prompt between `<prompt>` tags, or says
that this machine's daemon cannot supply a local automation's prompt. An automation it cannot
find is reported as not found. For a webhook automation, it also reports
the payload filter and up to five recent deliveries, newest first, which show why a
delivery did not start a run. For a Slack automation, it lists the channels with their IDs,
the channel patterns, keywords, and exclusions. For a cloud automation, it names the
chained automations this one starts and the automations that trigger it; that list is
unavailable for an automation someone else owns. If the delivery or trigger lookup fails,
the read still succeeds and the result marks that part unavailable. `ReadAutomation` cannot
read a CI automation.

In `ListAutomations` and `ReadAutomation` results, when Droid can read the model catalog, a
model that is not in it is marked as falling back to the default; when it cannot read the
catalog, no model is marked. A remote `custom:` model is not checked against this machine's
models. `delivers:this-session` marks an automation that delivers into the current session,
and `delivers:<sessionId>` names another session.

A create or edit can succeed even when reading the automation back fails. If an edit's
other changes are saved but rotating the webhook secret fails, the result
reports the saved changes and the rotation error. Retry the rotation on its own; until it
succeeds, do not rely on either secret.

`RunAutomation` returns without waiting for the run to finish. If several automations match
`automationName`, the result lists their IDs; call again with `automationId`. The run gets
no input from the call; it sees only its own prompt. A paused automation still runs. If the
automation is already running, the call is skipped rather than failed. Droid
refuses a CI-triggered automation, which cannot start on demand, and the result says why. A
local automation on a machine that is not a registered computer starts only from a session
hosted by the daemon that owns it: the desktop app's daemon or a standalone `droid daemon`.
Other sessions get a refusal that says why. A local automation on a registered self-hosted
computer can also start from another
session, through Droid, when you can use that computer. When this session's daemon
hosts the automation, `automationId` can be its slug or its ID. A self-hosted computer must
be online, because Droid cannot wake it to start the run, and a computer whose
Droid is too old to start runs on demand is refused with a request to update it. A refusal can also mean
that Droid paused the automation because its target cannot run, or that you
cannot use the target; the result gives Droid's explanation. When the run ends, the chained automations it starts run as
usual.

### Renamed automation tools

The automation tools replace the earlier `automations_` tools. A Script calls each one by
its name:

| Previous name | Tool | Script path |
| :------------ | :--- | :---------- |
| `automations_templates_list` | `ListAutomationTemplates` | `tools.ListAutomationTemplates` |
| `automations_list` | `ListAutomations` | `tools.ListAutomations` |
| `automations_read` | `ReadAutomation` | `tools.ReadAutomation` |
| `automations_create` | `CreateAutomation` | `tools.CreateAutomation` |
| `automations_edit` | `EditAutomation` | `tools.EditAutomation` |
| `automations_delete` | `DeleteAutomation` | `tools.DeleteAutomation` |
| `automations_run` | `RunAutomation` | `tools.RunAutomation` |

`droid exec --remove-tools` with a previous name fails as an unknown tool identifier. A tool
selection that Droid re-resolves during a session skips a previous name, and a saved denial
that names one does not deny the tool that replaced it. Update prompts, automation instructions, and tool selectors to the
current names.

## Autonomy levels

`droid exec` uses tiered autonomy to control what operations the agent can perform. Only raise access when the environment is safe.

| Level                       | Intended for             | Notable allowances                                            |
| :-------------------------- | :----------------------- | :------------------------------------------------------------ |
| _(default)_                 | Read-only reconnaissance | File reads, git diffs, environment inspection                 |
| `--auto low`                | Safe edits               | Create/edit files, run formatters, non-destructive commands   |
| `--auto medium`             | Local development        | Install dependencies, build/test, git commits, git push, opening pull requests |
| `--auto high`               | CI/CD & orchestration    | Git force push, deploy scripts, long-running operations       |
| `--skip-permissions-unsafe` | Isolated sandboxes only  | Skips all permission prompts; command blocks still apply |

**Examples:**

```bash
# Default (read-only)
droid exec "Analyze the auth system and create a plan"

# Low autonomy - safe edits
droid exec --auto low "Add JSDoc comments to all functions"

# Medium autonomy - development work
droid exec --auto medium "Install deps, run tests, fix issues"

# High autonomy - deployment
droid exec --auto high "Run the tests and deploy to staging"
```

<Warning>
  `--skip-permissions-unsafe` skips all permission prompts, but command blocks still apply.
  Use **only** in isolated, disposable
  environments such as throwaway containers. See [Permission rules](/autonomy-and-safety/permission-rules).
</Warning>

## Model IDs

Use any [available model ID](/models) with `-m, --model` or `--spec-model`. For custom models, see [Custom Models (BYOK)](/model-independence/byok).

`droid exec --model` and `--spec-model` also accept provider [tier aliases](/automations/code-review-ci#advanced-model-overrides) such as `openai-latest-balanced`, which follow Factory's recommended model for that provider and tier as new models ship.

### Legacy models

When a newer version of a model is available to you, `/model` lists the older one in a collapsed **Legacy Models** section. Selecting a legacy model asks you to **Switch to latest** or **Keep using legacy**. Keeping it adds the model to `legacyModelOverrides` in your user `settings.json`, and Droid stops asking about it.

When Droid starts, it moves saved default models (including spec mode, subagent, mission, and compaction models) from a legacy model to its newer version, unless the model is in `legacyModelOverrides`. A model passed to `droid exec --model` runs as named.

## Interactive mode features

### Keyboard shortcuts

The interactive REPL supports a rich set of keyboard shortcuts for navigation, overlays, and input control:

| Shortcut | Action |
| :------- | :----- |
| <Kbd keys='Ctrl+C' /> | Cancel the current operation / interrupt the agent. Press twice quickly to exit |
| <Kbd keys='Ctrl+Z' /> | Suspend the process (Unix only). Resume with `fg` |
| <Kbd keys='Ctrl+O' /> | Toggle the detailed transcript view (full message details) |
| <Kbd keys='Ctrl+T' /> | Toggle the Mission Control overlay (orchestrator sessions only) |
| <Kbd keys='Ctrl+N' /> | Cycle through available models (when typing in chat input) |
| <Kbd keys='Ctrl+L' /> | Cycle through autonomy levels (when typing in chat input) |
| <Kbd keys='Ctrl+Y' /> | Toggle the `/btw` scroll view (side-question history) |
| <Kbd keys='Ctrl+J' /> | Toggle the changelog display (dismiss / restore) |
| <Kbd keys='Alt+E' /> | Toggle the approval details view (Option+E on macOS) |
| <Kbd keys='Ctrl+V' /> | Paste an image from the clipboard as an attachment |
| <Kbd>Tab</Kbd> | Cycle through the model's available reasoning-effort levels |
| <Kbd keys='Shift+Tab' /> | Toggle Normal Mode and Spec Mode |
| <Kbd>@</Kbd> | File path autocomplete: typing `@` triggers fuzzy file search |
| <Kbd>Up</Kbd> / <Kbd>Down</Kbd> | Navigate input history (cycle through previously submitted messages) |
| Double <Kbd>Escape</Kbd> | Second press clears the input draft; a third Escape opens the rewind menu |
| <Kbd>?</Kbd> | Open the scrollable keyboard shortcuts pane (when the input is empty); close it with <Kbd>Esc</Kbd> |
| <Kbd keys='Ctrl+/' /> | Open the keyboard shortcuts pane (works even when the input has content) |
| <Kbd keys='Ctrl+A' /> | Move the cursor to the start of the line |
| <Kbd keys='Ctrl+W' /> | Delete the word before the cursor |
| <Kbd keys='Ctrl+K' /> | Delete from the cursor to the end of the line |
| <Kbd keys='Ctrl+U' /> | Delete from the cursor to the start of the line |
| <Kbd keys='Ctrl+D' /> | Clear all attached images, or forward-delete the next character if none attached |
| <Kbd keys='Ctrl+F' /> | Open the fork tree for the highlighted session (in the `/sessions` list view) |
| <Kbd keys='Ctrl+R' /> | Rename the highlighted session (in the `/sessions` list view) |
| <Kbd keys='Ctrl+X' /> | Archive the highlighted session (in the `/sessions` list view); restores it on the Archived tab |
| <Kbd keys='Alt+Up' /> | Scroll the transcript up (navigate any turn) |
| <Kbd keys='Alt+Down' /> | Scroll the transcript down (navigate any turn) |
| <Kbd keys='Alt+PageUp' /> | Scroll the transcript up to the previous user turn |
| <Kbd keys='Alt+PageDown' /> | Scroll the transcript down to the next user turn |
| <Kbd>Escape</Kbd> | Close the active pane, overlay, or menu |
| <Kbd keys='Shift+Enter' /> | Insert a newline in the chat input (multiline editing) |
| <Kbd>!</Kbd> | Toggle [bash mode](#bash-mode) (when the input is empty) |

<Tip>
  Run `/terminal-setup` once to configure your terminal so <Kbd keys='Shift+Enter' /> reliably produces a newline
  in the chat input.
</Tip>

### Bash mode

Press <Kbd>!</Kbd> when the input is empty to toggle bash mode. In bash mode, commands execute directly in your shell without AI interpretation, useful for quick operations like checking `git status` or running `npm test`.

{/* sweep-allow: term-bullets */}

- **Toggle on:** Press <Kbd>!</Kbd> (when input is empty)
- **Execute commands:** Type any shell command and press <Kbd>Enter</Kbd>
- **Toggle off:** Press <Kbd>Esc</Kbd> to return to normal AI chat mode

The prompt changes from `>` to `$` when bash mode is active.

### Mermaid diagram rendering

Droid automatically renders Mermaid diagram code blocks as ASCII art directly in the terminal, with no external viewer or browser required. When a response contains a fenced ```` ```mermaid ```` block of a supported diagram type, the diagram is drawn inline in the transcript.

**Supported diagram types:**

- `flowchart` (and `graph`)
- `sequenceDiagram`
- `stateDiagram`
- `classDiagram`
- `erDiagram`

Unsupported diagram types (for example `gantt`, `pie`, `mindmap`, `timeline`, `journey`, `gitGraph`) fall back to displaying the raw Mermaid source and a link to view the diagram externally.

### Markdown and math rendering

Droid renders supported inline Markdown styles in responses, including formatting inside
table cells. It also converts inline and display TeX into Unicode math for terminal output.

Use `\(...\)` or `$...$` for inline math. Use `\[...\]` or `$$...$$` for display math.
A completed code fence labeled `latex`, `math`, or `tex` also renders as display math:

````text
```latex
\frac{a}{b}
```
````

### Slash commands

Available when running `droid` in interactive mode. Type the command at the prompt:

| Command                       | Description                                                    |
| :---------------------------- | :------------------------------------------------------------- |
| `/account`                    | Open Factory account settings in browser                       |
| `/agent-effectiveness-report [timeframe]` | Build an organization-level Agent Effectiveness report from Factory usage, pull requests, and work items; listed for Owners and Managers of organizations where it is enabled ([details](#generate-an-agent-effectiveness-report)) |
| `/archive`                    | Archive the current session (restore it from the `/sessions` Archived tab) |
| `/automations`                | Open this machine's scheduled automations ([details](#manage-automations)) |
| `/billing`                    | View and manage billing settings                               |
| `/btw <question>`             | Ask a side question without polluting the main transcript     |
| `/bug [title]`                | Create a bug report with session data and logs                 |
| `/clear`                      | Clear conversation context, keep current model & autonomy      |
| `/commands`                   | Manage custom slash commands                                   |
| `/compress [prompt]`          | Compress session and move to new one with summary              |
| `/context`                    | Show context window usage breakdown with progress bar          |
| `/copy`                       | Copy prompts, responses, turn ranges, or session ID            |
| `/cost`                       | Show usage statistics                                          |
| `/create-skill`               | Create a reusable skill from current session                   |
| `/cd <path>`                  | Change session working directory (alias for `/cwd`)             |
| `/cwd <path>`                 | Change session working directory                               |
| `/diagnostics`                | Show settings configuration errors                             |
| `/droids`                     | Manage custom droids                                           |
| `/missions`                   | Enter Mission Mode                                             |
| `/fast`                       | Enable fast mode for current model (`/fast off` to disable)    |
| `/favorite`                   | Mark current session as a favorite                             |
| `/fork`                       | Copy current session into a new session; you stay in the original and get a `droid --resume <id>` command for the fork |
| `/help`                       | Show available slash commands                                  |
| `/hooks`                      | Manage lifecycle hooks                                         |
| `/ide`                        | Configure IDE integrations                                     |
| `/install-code-review`        | Set up automated code review                                   |
| `/install-slack-app`          | Install/connect Slack integration                              |
| `/language <locale>`          | Switch TUI display language                                    |
| `/limits`                     | Manage token usage limits and overage preferences              |
| `/link-work <url>`            | Link this session to a Linear issue; `/link-work` shows the link and `/link-work clear` removes it. Listed where work item linking is enabled ([details](#link-a-session-to-a-work-item)) |
| `/login`                      | Sign in to Factory                                             |
| `/logout`                     | Sign out of Factory                                            |
| `/loop <interval> <prompt>`   | Repeat a prompt on an interval from 1 minute to 24 hours; `/loop status` lists loops and `/loop stop <id>` stops one ([details](#schedule-recurring-prompts)) |
| `/mcp`                        | Manage Model Context Protocol servers                          |
| `/model`                      | Switch AI model mid-session                                    |
| `/new`                        | Start a fresh session, reset model & autonomy to defaults      |
| `/plugins`                    | Manage plugins and marketplaces                                |
| `/quit`                       | Exit droid (alias: `exit`, or press <Kbd keys='Ctrl+C' />)     |
| `/readiness-fix`              | Fix failing agent readiness signals from latest report         |
| `/readiness-report`           | Generate readiness report                                      |
| `/rename`                     | Rename current session                                         |
| `/review`                     | Start AI-powered code review workflow                          |
| `/rewind-conversation`        | Undo recent changes in the session                             |
| `/sessions`                   | List and resume previous sessions, with forks grouped under their parent ([details](#session-list)) |
| `/settings`                   | Configure application settings                                 |
| `/setup-incident-response`    | Set up Slack auto-run for incident-response channel            |
| `/share`                      | Share session with organization                                |
| `/skills`                     | Manage and invoke skills                                       |
| `/stats [period]`             | Show usage statistics (supports relative periods, date ranges) |
| `/status`                     | Show current droid status and configuration                    |
| `/statusline`                 | Configure custom status line                                   |
| `/terminal-setup`             | Configure terminal keybindings for <Kbd keys='Shift+Enter' />  |
| `/themes`                     | Choose a color theme                                           |
| `/tree`                       | Browse, label, and filter the current session's fork tree, and resume or fork from any entry ([details](#session-tree)) |
| `/vim [on\|off]`              | Toggle vim-style modal editing (INSERT/NORMAL) in the chat input |

Slash commands stay usable while the agent is running: read-only and settings commands open right away over the live stream, commands that modify the conversation or session (such as `/new`, `/clear`, `/compress`) ask for confirmation before stopping the current run, and `/model`, `/fast`, and `/archive` apply only between turns. `/fork` also runs immediately: it copies the session in the background and keeps you in the original session, so there is nothing to interrupt.

Archiving hides a session from your session lists without deleting any data. Restore an archived session anytime from the Archived tab in `/sessions` (where <Kbd keys='Ctrl+X' /> restores instead of archiving), or send a new message in the archived session to restore it automatically.

For detailed information on slash commands, see the [interactive mode documentation](/droid-cli/quickstart#useful-slash-commands).

### Session list

`/sessions` lists your previous sessions and opens with the newest one selected. Press <Kbd>Enter</Kbd> to resume the selected session, or use the [`/sessions` shortcuts](#keyboard-shortcuts) to rename it, archive it, or open its fork tree.

Forks appear directly under the session they came from, marked with `↳`, so a session and its forks stay together. Each fork family takes its place in the list from its most recently active member. Search keeps the grouping: when a search hides a fork's parent, the fork stays under its nearest ancestor that still matches.

A chain of sessions that each continue the last, such as the new session `/compress` starts, stays in one column. The indent grows only below a session that has more than one fork.

### Session tree

`/tree` shows the current session's fork family as one tree: the messages of the original session and every fork, joined at the points where the forks branched off. `← current` marks where you are, and `● <title>` marks the latest entry of each session in the family.

A conversation with no forks renders flat. Rows indent only where the conversation branches: `├─` and `└─` connect each branch to the row it branched from, and `│` carries a branch past the rows of its siblings.

Select a row and press <Kbd>Enter</Kbd> to act on it:

- On another session's latest entry, resume that session.
- On a user message, fork just before it and prefill the message so you can edit and resend it.
- On an assistant message, fork just after it and continue with an empty prompt.

| Key | Action |
| :-- | :----- |
| <Kbd>Up</Kbd> / <Kbd>Down</Kbd> | Move the selection |
| <Kbd>Left</Kbd> | Collapse the selected branch, or jump to the row it branched from |
| <Kbd>Right</Kbd> | Expand a collapsed branch |
| <Kbd>Enter</Kbd> | Resume, edit and resend, or continue from the selected row |
| <Kbd keys='Shift+L' /> | Add, edit, or clear the selected row's label |
| <Kbd>f</Kbd> | Cycle the filter: no tools, user only, all |
| <Kbd>t</Kbd> | Show user messages, assistant replies, and compaction summaries (the default "no tools" filter) |
| <Kbd>u</Kbd> | Show user messages only |
| <Kbd>a</Kbd> | Show every entry, including tool calls and results |
| <Kbd>l</Kbd> | Show only labeled rows; press again to return to "no tools" |
| <Kbd>Escape</Kbd> | Close the tree |

The footer names the active filter. The filter keys work even when the current filter shows no rows.

<Kbd keys='Shift+L' /> opens a one-line editor below the tree, prefilled with the row's label. Press <Kbd>Enter</Kbd> to save it as a `[label]` badge on the row, or <Kbd>Escape</Kbd> to cancel. Saving an empty label removes it. Letters you type in the editor never trigger tree shortcuts. A label holds one line of up to 32 characters; longer text ends in an ellipsis.

Labels last until you exit Droid. They survive closing `/tree` and switching or forking from it, and because forks share their history, one label marks the same entry in every session of the fork family. Labels are not saved to disk.

### Git worktrees

Use `-w, --worktree [name]` to run a session inside a native [git worktree](https://git-scm.com/docs/git-worktree) so you can work on multiple branches of the same repository in parallel without file conflicts. This flag is available on both `droid` (interactive) and `droid exec`.

By default, Droid creates worktrees under the [`worktreeDirectory` setting](/droid-cli/settings#infrastructure), which defaults to `~/.factory/worktrees`. Each worktree uses the path `<root>/<8-character group>/<repository name>/` and has its own checkout and dedicated branch.

**Branch naming:**

- **`--worktree`** (no value): Creates/reuses a worktree on a branch named `<current-branch>-wt`.
- **`--worktree <name>`**: Uses `<name>` as the branch. If the branch already exists, it is checked out in the worktree; otherwise it is created from `HEAD`.
- If the target branch is already checked out in another worktree, the command fails with a clear error.

**Examples:**

```bash
# Interactive: derive branch from current branch (creates <current>-wt)
droid --worktree

# Interactive: explicit branch name
droid -w fix-auth-bug "start debugging the login flow"

# Headless: isolate an automated task on its own branch
droid exec --worktree refactor-tests --auto medium "migrate jest suites to vitest"

# Run two parallel sessions on the same repo, each on its own branch
droid --worktree feature-a &
droid --worktree feature-b &
```

**Session lifecycle:**

- **Interactive mode**: The worktree persists after the session ends so you can resume work, inspect changes, or push the branch.
- **`droid exec` mode**: On exit, a clean worktree (no uncommitted changes) is removed automatically; a dirty worktree is preserved and its path is printed so you can review the work.
- The underlying git branch is **never deleted** by Droid; only the worktree directory is removed during cleanup.

<Note>
  When `--worktree` is active, Droid operates entirely inside the worktree directory. Run follow-up
  commands (tests, builds, installs) from that directory rather than the original repo root. Fresh
  worktrees may not have dependencies installed yet (for example `node_modules`); set them up if
  builds or tests fail with missing-module errors.
</Note>

### Subcommand flags

In addition to the global flags above, several `droid` subcommands accept their own flags.

#### `droid update` flags

| Flag                      | Description                                        | Example                      |
| :------------------------ | :------------------------------------------------- | :--------------------------- |
| `-c, --check`             | Check for updates without installing               | `droid update --check`       |
| `-v, --version <version>` | Update to or roll back to a specific version       | `droid update -v 0.174.0`    |

#### `droid search` flags

| Flag                  | Description                                                              | Example                                  |
| :-------------------- | :----------------------------------------------------------------------- | :--------------------------------------- |
| `--kind <kind>`       | Filter by entry kind: `message_text`, `document`, `tool_use`, `tool_result`, or `all` | `droid search "auth" --kind document`    |
| `--limit-sessions <n>` | Maximum number of sessions to return                                    | `droid search "auth" --limit-sessions 5` |
| `--limit-hits <n>`    | Maximum number of matches per kind per session                           | `droid search "auth" --limit-hits 3`     |
| `--context-chars <n>` | Number of characters of context shown around each match                  | `droid search "auth" --context-chars 200`|
| `--json`              | Emit results as JSON                                                     | `droid search "auth" --json`             |
| `--reindex`           | Drop the search cache and rebuild the local index                        | `droid search "auth" --reindex`          |

#### `droid mcp add` flags

| Flag                       | Description                                                              | Example                                                          |
| :------------------------- | :----------------------------------------------------------------------- | :--------------------------------------------------------------- |
| `--type <type>`            | Server transport: `http` (streamable HTTP), `sse` (legacy HTTP+SSE), or `stdio` (local) | `droid mcp add api https://api.example.com/mcp --type http`      |
| `--env <KEY=VALUE>`        | Set an environment variable for a stdio server (repeatable)              | `droid mcp add gh "gh-mcp" --type stdio --env GH_TOKEN=$GH_TOKEN`|
| `--header <KEY: VALUE>`    | Add an HTTP header for a remote server (repeatable)                      | `droid mcp add api https://api.example.com/mcp --type http --header "Authorization: Bearer $TOKEN"` |

#### `droid plugin` flags

| Flag                  | Description                                                              | Example                                                  |
| :-------------------- | :----------------------------------------------------------------------- | :------------------------------------------------------- |
| `-s, --scope <scope>` | Installation scope: `user` (default) or `project`                        | `droid plugin install droid-control@factory-plugins --scope project` |

#### `droid computer register` flags

| Flag         | Description                                              | Example                              |
| :----------- | :------------------------------------------------------- | :----------------------------------- |
| `-y, --yes`  | Skip interactive prompts and accept registration defaults | `droid computer register laptop -y`  |

### MCP command reference

The `/mcp` slash command opens an interactive manager UI for browsing and managing MCP servers.

**Quick start:** Type `/mcp` and select **"+ Add MCP server from registry"** to browse 40+ pre-configured servers (Linear, Sentry, Notion, Stripe, Vercel, and more). Select a server, authenticate if required, and you're ready to go.

**CLI commands** for scripting and automation:

```bash
droid mcp add <name> <url> --type http    # Add HTTP (streamable) server
droid mcp add <name> <url> --type sse     # Add legacy HTTP+SSE server
droid mcp add <name> "<command>"          # Add stdio server
droid mcp remove <name>                   # Remove a server
droid mcp auth                            # Sign in to every server that needs it
```

See [MCP Configuration](/harness/mcp) for the full registry list, CLI options (`--env`, `--header`), configuration files, and how user vs project config layering works.

## Authentication

1. Generate an API key in the <a href="https://app.factory.ai/settings/api-keys">Factory API keys settings</a>
2. Set the environment variable:

<CodeGroup>

```bash macOS/Linux
export FACTORY_API_KEY=fk-...
```

```powershell Windows (PowerShell)
$env:FACTORY_API_KEY="fk-..."
```

```cmd Windows (CMD)
set FACTORY_API_KEY=fk-...
```

</CodeGroup>

**Persist the variable** in your shell profile (`~/.bashrc`, `~/.zshrc`, or PowerShell `$PROFILE`) for long-term use.

<Warning>
  Never commit API keys to source control. Use environment variables or secure secret management.
</Warning>

## Auto-updates

Standalone Droid installations check for and install CLI updates automatically. Run `droid update`
to trigger an update on demand.

To keep a standalone installation pinned, disable its in-process updater:

```bash
export FACTORY_DROID_AUTO_UPDATE_ENABLED=false
```

With this variable set, automatic updates are disabled and `droid update` does not install another
version. Set it in the environment that launches every Droid process, including `droid daemon`.

The npm distribution has auto-updates disabled at build time and does not require this variable.
Running `droid update` from an npm installation reports that auto-update is unavailable. Setting
`FACTORY_DROID_AUTO_UPDATE_ENABLED=true` explicitly overrides the npm build default.

Enterprise administrators can disable CLI auto-updates for all organization members with the
`disableAutoUpdate` organization setting. See the [release notes](/changelog/release-notes) and
[organization controls](/enterprise/hierarchical-settings-and-org-control).

<Tip>
  Pin the CLI and disable auto-updates in reproducible environments. For local developer
  installations, leave auto-updates enabled to receive fixes and security updates.
</Tip>

## Exit codes

| Code | Meaning                       |
| :--- | :---------------------------- |
| `0`  | Success                       |
| `1`  | General runtime error         |
| `2`  | Invalid CLI arguments/options |

## Common workflows

### Code review

Interactive review inside a Droid session:

```text
> /review
```

Non-interactive review through `droid exec`:

```bash
# Analysis only
droid exec "Review this PR for security issues"

# With modifications
droid exec --auto low "Review code and add missing type hints"
```

See the [Local Code Review documentation](/automations/code-review) for detailed guidance on review types, workflows, and best practices.

### Testing and debugging

```bash
# Investigation
droid exec "Analyze failing tests and explain root cause"

# Fix and verify
droid exec --auto medium "Fix failing tests and run test suite"
```

### Refactoring

```bash
# Planning
droid exec "Create refactoring plan for auth module"

# Execution
droid exec --auto low --use-spec "Refactor auth module"
```

### Parallel sessions on one repo

```bash
# Work on two branches of the same repo at the same time, each in its own worktree
droid --worktree feature-a &
droid --worktree feature-b &

# Fan out headless tasks across branches without clobbering each other's files
droid exec -w migration-step-1 --auto medium "apply codemod A" &
droid exec -w migration-step-2 --auto medium "apply codemod B" &
wait
```

See [Git worktrees](#git-worktrees) for details.

### CI/CD integration

```yaml
# GitHub Actions example
- name: Run Droid Analysis
  env:
    FACTORY_API_KEY: ${{ secrets.FACTORY_API_KEY }}
  run: |
    droid exec --auto medium -f .github/prompts/deploy.md
```

<RelatedLinks>
  <RelatedLink href='/https/docs.factory.com/models' title='Available Models'>
    Model IDs and reasoning options.
  </RelatedLink>
  <RelatedLink href='/https/docs.factory.com/harness/custom-slash-commands' title='Custom commands'>
    Create your own shortcuts.
  </RelatedLink>
  <RelatedLink href='/https/docs.factory.com/harness/subagents' title='Custom droids'>
    Build specialized agents.
  </RelatedLink>
  <RelatedLink href='/https/docs.factory.com/harness/mcp' title='MCP configuration'>
    External tool integration.
  </RelatedLink>
</RelatedLinks>
