Skip to Content
Latch Docs

CLI reference

Run project checks from a terminal and inspect their resolved configuration.

Use the standalone CLI to run checks from a terminal or CI, debug automatic hooks, or inspect a saved failure.

I want toUse
Get Latch on my machineInstall the CLI from a release archive, npm tarballs, or Cargo.
Run a check nowlatch run turn_end. Manual runs bypass Git and file filters.
See what Latch foundlatch status or latch explain. Both are read-only.
See the full output from a failed hooklatch output with the reported path or ID.

Install the CLI

Standalone

Download your platform’s archive, extract it, and add its bin directory to your PATH. The v0.1.8 Linux builds target glibc 2.36 or later, including Debian 12 and Ubuntu 24.04.

PlatformStandalone archive
Apple SiliconDownload
Intel MacDownload
Linux ARM64Download
Linux x64Download
Windows x64Download

Release checksums

Run latch --version to confirm the install.

Install from npm tarballs · Build with Cargo

npm tarballs

Install with Node.js 18 or later. Download barakchamo-latch-0.1.8.tgz and the matching binary tarball from the GitHub release.

PlatformBinary tarball
Apple Silicon Macbarakchamo-latch-darwin-arm64-0.1.8.tgz
Intel Macbarakchamo-latch-darwin-x64-0.1.8.tgz
Linux ARM64barakchamo-latch-linux-arm64-0.1.8.tgz
Linux x64barakchamo-latch-linux-x64-0.1.8.tgz
Windows x64barakchamo-latch-win32-x64-0.1.8.tgz

In the directory containing the downloads, install both files together. For example, on Linux x64:

npm install --global --offline ./barakchamo-latch-0.1.8.tgz ./barakchamo-latch-linux-x64-0.1.8.tgz
latch --version

Start your harness from a terminal that can run latch --version.

Cargo

With Rust 1.88 or later, install directly from the release tag.

cargo install --locked --git https://github.com/BarakChamo/latch --tag v0.1.8 latch

See the build guide to build a bundled plugin and CLI together.

Once latch --version works, follow the harness setup guide to enable automatic checks in your agent.

Try the CLI in your project

From the directory that contains your check configuration or package scripts, resolve and run a check. For example, add this to your latch.json if make lint is your project command.

{
  "hooks": {
    "turn_end": { "commands": "make lint" }
  }
}
latch status
latch run turn_end

A passing check is quiet and exits 0. Make an edit that fails your lint rule and run latch run turn_end again. It reports the lint error and exits 1. Undo the test edit and run it once more to confirm the pass. Manual runs execute immediately from the current directory.

Commands

Run these commands from the directory containing your latch.json or package scripts.

CommandWhat it does
latch config initCreate a starter latch.json in the current directory. Existing files are preserved.
latch install cloud <claude|copilot|openhands>Add cloud hooks to the harness config at the Git worktree root. Available since 0.1.8. Existing settings are preserved. Cloud setup
latch --helpList available commands.
latch --versionPrint the installed version.
latch statusShow the resolved checks and recent prompt and automatic-check activity without running anything.
latch run after_editRun all configured edit checks immediately.
latch run turn_end or latchRun all configured turn-end checks immediately.
latch explain after_editShow the resolved edit commands, settings, and filters as JSON.
latch explain turn_end or latch explainShow the resolved turn-end configuration as JSON.
latch output <log-or-id> [--grep <text>]Replay a saved failure or search its original output.
latch output --pruneRemove expired output across projects in your user cache now.

Manual runs bypass Git change detection and file filters. Successful output is quiet by default. Failed commands print their output, and on_failure controls how many commands run. latch explain never executes commands. Its config field is the path to the latch.json file it read, or null when no file was present. configured can still be true when Latch discovers a package script.

Exit codeMeaning
0The operation succeeded.
1A check, configuration, or retrieval failed, including a search with zero matches.
2The command-line arguments were invalid.

For commands launched by a harness, see the plugin reference.

Retrieve saved output

When a failure report gives a Saved log path, open or search that .log file with your editor or your agent's file tools. For byte-for-byte replay on the original streams, pass the saved log path, filename, or ID to latch output from the same project.

latch output <id>
latch output <id> --grep 'test_create_user'

Full replay sends the original bytes to stdout and stderr. Search matches a literal, case-sensitive string and returns up to 40 lines per stream, with long lines shortened around the match.

Cache location and retention

The cache is under $XDG_STATE_HOME/latch/output-v1, or under ~/.local/state/latch/output-v1 by default. On Windows the fallback uses %LOCALAPPDATA% when available. Saved output may contain sensitive text printed by the check. Entries expire after seven days. Latch sweeps expired files across projects during normal use, with an hour between successful sweeps. Each project keeps up to 64 entries and 64 MiB. A command with more than 16 MiB of combined output still gets a preview with an explanation that full output could not be saved.

Run latch output --prune to sweep immediately. On machines that rarely run Latch, schedule that command as the same user with the same state directory.

On this page