Skip to main content

Installation

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

Droid CLI commands

Droid CLI flags

Customize droid’s behavior with command-line flags:
Use --output-format json for scripting and automation, allowing you to parse droid’s responses programmatically.

Autonomy levels

droid exec uses tiered autonomy to control what operations the agent can perform. Only raise access when the environment is safe. Examples:
--skip-permissions-unsafe removes all safety checks. Use only in isolated environments like Docker containers.

Model IDs

Use any available model ID with -m, --model or --spec-model. For custom models, see Bring Your Own Key (BYOK). See Choosing Your Model for detailed guidance on which model to use for different tasks.

Interactive mode features

Keyboard shortcuts

The interactive REPL supports a rich set of keyboard shortcuts for navigation, overlays, and input control:
Run /terminal-setup once to configure your terminal so Shift+Enter reliably produces a newline in the chat input.

Bash mode

Press ! 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.
  • Toggle on: Press ! (when input is empty)
  • Execute commands: Type any shell command and press Enter
  • Toggle off: Press Esc 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 — 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.

Slash commands

Available when running droid in interactive mode. Type the command at the prompt: For detailed information on slash commands, see the interactive mode documentation.

Git worktrees

Use -w, --worktree [name] to run a session inside a native 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. Each worktree is created as a sibling directory next to your repo (../<repo>-wt-<branch>/) with 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:
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.
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.

Subcommand flags

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

droid search flags

droid mcp add flags

droid plugin flags

droid computer register flags

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 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:
See MCP Configuration 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 at app.factory.ai/settings/api-keys
  2. Set the environment variable:
Persist the variable in your shell profile (~/.bashrc, ~/.zshrc, or PowerShell $PROFILE) for long-term use.
Never commit API keys to source control. Use environment variables or secure secret management.

Exit codes

Common workflows

Code review

See the Local Code Review documentation for detailed guidance on review types, workflows, and best practices.

Testing and debugging

Refactoring

Parallel sessions on one repo

See Git worktrees for details.

CI/CD integration

See also