Skip to content

Search documentation

Search every page of the Hoplite docs

CLI

CLI

Run Hoplite's coding agent from your terminal, script it with hoplite ask, and connect local ACP clients.

The Hoplite CLI (@usehoplite/cli) is Hoplite's coding agent in your terminal. Every prompt runs on a Hoplite thread in your project's cloud sandbox, and the CLI streams back the answer, tool calls, and approval requests. Nothing runs on your machine, and the CLI talks only to the Hoplite API, apart from a once-a-day update check against hoplite.sh.

Because the work lives in a thread, you can open the same conversation in the Hoplite app, share it with teammates, and pick it up again from any terminal.

Install

terminal
npm i -g @usehoplite/cli

On macOS you can use Homebrew instead:

terminal
brew install usehoplite/tap/hoplite

Or, without npm or Homebrew on macOS and Linux, run the install script. It installs hoplite and hoplite-legacy in ~/.local/bin after checking the release checksum, and needs no sudo:

terminal
curl -fsSL https://hoplite.sh/install.sh | sh

npm and Homebrew install the hoplite command and its short alias hplt. Native release archives for macOS, Linux, and Windows are listed with their sizes and SHA-256 checksums on the download page, and published under https://hoplite.sh/downloads/releases/<version>/ with a checksums.txt per release; https://hoplite.sh/downloads/latest.json names the current version. A macOS or Linux archive contains hoplite and its hoplite-legacy helper; keep the two in the same directory.

Windows

On Windows, hoplite provides the sign-in, import, handoff, skills, mcp start, and mcp config commands. The interactive agent, hoplite ask, hoplite exec, hoplite shell, hoplite push, hoplite status, hoplite acp, and hoplite mcp connect are available on macOS and Linux only.

On Windows, install with npm as above. Without npm, download the archive for your architecture (amd64 or arm64) and the release's checksums.txt, then compare the two hashes before extracting hoplite.exe:

PowerShell
Invoke-WebRequest https://hoplite.sh/downloads/releases/3.0.0/hoplite_3.0.0_windows_amd64.zip -OutFile hoplite_3.0.0_windows_amd64.zipInvoke-WebRequest https://hoplite.sh/downloads/releases/3.0.0/checksums.txt -OutFile checksums.txt(Get-FileHash -Algorithm SHA256 hoplite_3.0.0_windows_amd64.zip).Hash.ToLower()Select-String ' hoplite_3.0.0_windows_amd64.zip$' checksums.txt

Verify a download

Every release's native downloads include a checksums.txt with the SHA-256 of each archive, and the install script checks it before extracting anything. To install a specific version, or into another directory, pass --version and --install-dir (or set HOPLITE_INSTALL_DIR):

terminal
curl -fsSL https://hoplite.sh/install.sh | sh -s -- --version 3.0.0 --install-dir "$HOME/.local/bin"

To check an archive you downloaded yourself, compare it with its line in the release's checksums.txt:

terminal
curl -fsSLO https://hoplite.sh/downloads/releases/3.0.0/hoplite_3.0.0_darwin_arm64.tar.gzcurl -fsSLO https://hoplite.sh/downloads/releases/3.0.0/checksums.txtgrep ' hoplite_3.0.0_darwin_arm64.tar.gz$' checksums.txt | shasum -a 256 -c

On Linux, sha256sum -c works the same way.

Upgrade

The CLI does not update itself. Upgrade with the tool you installed it with:

terminal
npm i -g @usehoplite/cli@latestbrew upgrade hoplite

If you used the install script, run it again. hoplite --version prints the installed version. When a newer release is out, the interactive CLI says so in one line at startup (see Network).

Upgrading from 2.x

Version 3 makes hoplite Hoplite's coding agent in your terminal. The 2.x commands still work, but you'll be asked to sign in once after upgrading. Keys stored by 2.x keep working for onboard, update, undo, handoff, skills, and mcp, but they lack the permissions the agent needs to continue and stop runs, so Hoplite refuses them for sessions. The first hoplite, hoplite ask, or hoplite acp then signs you in again in the browser and stores a new key. In a script, where nobody can sign in, hoplite ask and hoplite exec stop with a message to run hoplite login once after upgrading. On macOS, keys move to the Keychain the first time they are read. What changed:

2.x3.x
hoplite with no command started the history importhoplite starts an interactive session. Run hoplite onboard to import
hoplite --headless, hoplite --org-id IDhoplite onboard --headless, hoplite onboard --org-id ID
hoplite versionhoplite --version
Signed in during hoplite onboard onlyhoplite login and hoplite logout; hoplite, hoplite ask, and hoplite acp also sign in on first use
hoplite completion printed shell completion scriptsRemoved on macOS and Linux

onboard, update, undo, handoff, skills, mcp, and auth take the same flags as before, including --api-key and HOPLITE_API_KEY. hoplite ask, hoplite exec, hoplite shell, hoplite acp, and hoplite status are new in 3.0. On Windows, hoplite is still the 2.x command set with login and logout added.

If you go back to 2.x on macOS, sign in again there: 2.x can't read keys from the Keychain, so it treats you as signed out. The Keychain items stay until you run hoplite logout with 3.x or delete them in Keychain Access.

Start a session

Run hoplite from a repository that is linked to a Hoplite project:

terminal
cd path/to/your-repohoplite

The CLI finds the project from the repository's GitHub remote. If more than one project links the same repository, it uses your saved /project choice, or the project with the most recently used thread. If neither has a clear answer, use /project or set HOPLITE_PROJECT_ID. See Configuration.

Interactive sessions covers the composer, queueing and steering, threads, and shortcuts. For one-off or scripted requests, use hoplite ask.

Sign in

The first time you run hoplite or hoplite ask, the CLI opens your browser to sign in. On the approval page you choose the workspace, and the CLI stores a CLI key for it. You don't need to create an API key.

CommandWhat it does
hoplite loginSign in again, or sign in ahead of time
hoplite login --org SLUGAdd another workspace, or switch to one you already signed in to. The last workspace you sign in to becomes the default outside a linked repository
hoplite logoutSign out: revoke every CLI key stored for this API on Hoplite, then remove them

hoplite logout acts on one API at a time, the one HOPLITE_BASE_URL or --base-url names (by default Hoplite's), and leaves keys for other APIs alone. A key Hoplite can't revoke, for example while it's unreachable, is still removed, with a warning that it stays valid until it expires; revoke it under Settings → Workspace → API keys.

On macOS, keys are stored in the Keychain under the service Hoplite CLI. ~/.config/hoplite/credentials.json keeps an index without secrets ($XDG_CONFIG_HOME/hoplite/credentials.json when XDG_CONFIG_HOME is set). On other systems, or when no keychain is writable, keys are stored in that file with owner-only permissions (0600). Keys that an older version stored in the file move to the Keychain the first time they are read.

If you start several sessions at once while signed out, they share a single browser sign-in.

Use an existing API key

To use a key you already have, for example in CI, create one under Settings → Workspace → API keys. hoplite onboard, update, undo, handoff, skills, mcp config, and auth accept it in one of three ways. When more than one is present, the CLI uses the first in this order:

  1. The --api-key flag, such as hoplite handoff --api-key hop_.... It's convenient for a one-off run, but the key lands in your shell history.
  2. The HOPLITE_API_KEY environment variable, which suits CI secrets and keeps the key out of history.
  3. Stored credentials, written by hoplite login, hoplite onboard, or hoplite auth login.

A key from the flag or the environment is used for that run only and never written to disk. Sessions (hoplite, ask, acp, exec, and shell) use stored credentials only. To store an existing key for every command, pipe it to auth login so it stays out of shell history:

terminal
printf '%s\n' "$HOPLITE_API_KEY" | hoplite auth login --api-key-stdin

The CLI asks the API which workspace the key belongs to, so you don't pass an organization ID. hoplite auth status shows which key would be used, where it came from, and its workspace, with the key masked.

Commands

CommandWhat it does
hopliteStart an interactive session
hoplite --resume, -c, -rResume a thread
hoplite ask PROMPTRun one request without the interactive UI
hoplite acpRun Hoplite as a local ACP agent for Zed, Paseo, and other ACP clients
hoplite exec COMMANDRun a command in a thread's sandbox and exit with its status
hoplite shellOpen a shell in a thread's sandbox, like ssh
hoplite pushSend your uncommitted local changes to a thread's sandbox
hoplite status [--json]Show the CLI version, working directory, and Hoplite endpoint
hoplite login, hoplite logoutSign in and out
hoplite onboardScan local Claude Code, Codex, OpenCode, and Cursor history and import it
hoplite updateImport new local sessions and refresh history you imported before
hoplite undoRemove the threads created by the last import
hoplite handoffContinue your current local agent session as a live Hoplite thread
hoplite skills add NAMECreate a project skill in .agents/skills
hoplite skills listList the project skills available to Hoplite agents
hoplite skills import-globalAdd selected local global skills to your personal library
hoplite mcp startAuthorize Hoplite's MCP server in the browser and store the token
hoplite mcp configPrint MCP client config that sends an API key to Hoplite's MCP server
hoplite mcp connect URL [NAME] -t THREADConnect local MCP tools to a cloud thread on macOS and Linux, with optional --read-only, headers, and browser OAuth
hoplite auth loginVerify an existing API key and store it (--api-key-stdin, --api-key, or HOPLITE_API_KEY)
hoplite auth statusShow which API key the CLI would use and its workspace

Run hoplite COMMAND --help for a command's flags. Inside a session, /help lists the slash commands.

Use Hoplite in Zed or Paseo

hoplite acp runs the CLI as a local Agent Client Protocol agent, so editors and tools that start ACP agents as local processes can use Hoplite. It uses your stored sign-in, and each session runs in the project linked to the repository it opens. Setup for Zed and Paseo is in Local ACP clients.

What's in this section

PageWhat it covers
Interactive sessionsThe composer, queue and steer, approvals, threads, teammates, models, failures, and offline behavior
Slash commandsEvery slash command, pull requests, previews, usage, and thread actions
hoplite askOne-shot and scripted requests, JSON output, resuming threads
ConfigurationSettings, stored files, and environment variables
Hand off a sessionContinue a Claude Code, Codex, OpenCode, or Cursor session in Hoplite
Hoplite MCP serverDrive Hoplite from Claude Code, Cursor, or another MCP client
Hoplite ACP endpointThe ACP protocol, and setup for Zed and Paseo

Problems with installing, signing in, or connecting are covered in Troubleshooting.

Acknowledgements

The interactive CLI is built on fx by Vercel, used under the Apache License 2.0 and modified by Hoplite to run on Hoplite threads. It also includes the Zig standard library and, on Linux, musl libc, both under the MIT License. Every macOS and Linux release ships these licenses and notices in a third_party folder:

Installed withLocation
npmthird_party in the @usehoplite/cli-<os>-<cpu> package, next to its bin folder
Homebrew$(brew --prefix)/share/doc/hoplite/third_party
The install scriptshare/hoplite/third_party next to the install directory: ~/.local/share/hoplite/third_party by default
A release archivethird_party, next to hoplite

Related