Guides

CLI

Reference for Carrick login, workspace setup, index refreshes, file checks and status output.

The carrick CLI provides workspace initialisation, index synchronization, diagnostics, and Language Server Protocol (LSP) capabilities.

Carrick requires Node 24 or newer to execute the sidecar that resolves TypeScript request and response types. The package includes the Rust scanner binary, the type sidecar, the Language Server Protocol (LSP) server, and agent hooks. The scanner binary installs as a platform-specific optional dependency (@carrick-tools/cli-<platform>-<arch>), avoiding postinstall build scripts and supporting --ignore-scripts. carrick refresh downloads your authenticated hosted index.

Install the CLI, sign in, and initialise your workspace:

npm install -g carrick
carrick login
cd ~/code
carrick init

Authentication

Carrick provides browser-based OAuth authentication with PKCE:

carrick login
carrick logout
  • carrick login opens a browser window to authorise your CLI with your Carrick workspace and stores the credentials locally.
  • carrick logout revokes this machine’s key on the server, then removes the locally stored workspace credentials. Other machines and editor connections stay signed in. If Carrick cannot be reached, the credentials are still removed and the command says the key is still live. It does not unset environment variables.

carrick login stores the workspace credential in $XDG_CONFIG_HOME/carrick/credentials.json, falling back to ~/.config/carrick/ on macOS and Linux or %APPDATA%\carrick\ on Windows, with file mode 0600. Note that GitHub CLI credentials and GITHUB_TOKEN do not authenticate Carrick. If you run carrick init on a machine without stored credentials, the CLI launches the sign-in flow automatically.

In a non-interactive shell, set the CARRICK_TOKEN environment variable to authenticate with an existing Carrick key. With CARRICK_TOKEN set, carrick login verifies that token instead of opening the browser.

Updates

Every command reads a cached answer to whether a newer carrick exists, refreshes it in the background, and prints the update command for the way this copy was installed. The check never blocks on the network. Set CARRICK_NO_UPDATE_CHECK=1 to turn it off for a reproducible run.

When you run Carrick through npx and an older global carrick exists, Carrick updates that global to the version you ran, because the global answers your agent’s hooks and every new shell. It uses the package manager that owns the global and nothing that overrides your own npm configuration. On a machine with no global, carrick init --install-global installs one.

Workspace initialisation

Run carrick init in a single repository or in a directory containing sibling repositories:

carrick init [DIRECTORY] [--repo OWNER/REPO]... [--mcp EDITOR] [--install-global]

    -w, --workspace DIR  The folder holding the repos (default: this one)
        --repo OWNER/REPO  Cover only this repo: repeatable, or one
                         comma-separated list. It also names the GitHub repo
                         whose origin remote names none
        --project SLUG   Check that the repos are in this Carrick project.
                         Repos change project on the dashboard, so a project
                         they are not in stops the run
        --mcp EDITOR     Add Carrick to this editor's own MCP configuration,
                         a file outside this workspace: repeatable, or one
                         comma-separated list. Without it, each editor whose
                         command is on this machine gets the entry
        --install-global Install carrick on this machine where there is none,
                         so the agent hooks can run it by name after this run
                         ends

carrick init signs you in (or uses a sign-in from carrick login), then asks nothing further. Carrick builds the index itself, in the cloud, so init runs no scan. It sets up the repositories in the folder that are in your Carrick workspace, and adds the following.

  • Claude Code hook settings: Merged into .claude/settings.json (or .claude/settings.local.json if carrick is not on PATH). PostToolUse hooks run carrick hook post-edit on file edits for instant diagnostics, and carrick hook post-read on file reads to show callers and dependencies. The SessionStart hook runs carrick hook session-start to refresh index state.
  • .codex/hooks.json: Configures edit recording and reuse checks for Codex environments.
  • Task skills: Five agent skills in .claude/skills/<name>/SKILL.md and .agents/skills/<name>/SKILL.md (carrick-impact, carrick-reuse, carrick-drift, carrick-census and carrick-audit). See task skills.
  • A short Carrick section in AGENTS.md, and in CLAUDE.md where the folder already has one. It points the agent to the rules in .carrick/RULES.md.
  • MCP connection: Added to Claude Code, and to each other editor (Cursor, Windsurf, VS Code) whose command is on this machine.
  • The index: Read into the ignored .carrick/ directory, so this machine can answer from it. It re-reads your source first, which takes minutes on a large workspace. init skips the re-read when .carrick/ already holds an index current for this checkout.

If none of the repositories in the folder is in your Carrick workspace, init stops and names the dashboard page where you add them. If Carrick has not finished building an index yet, init says so, and carrick refresh reads it in once it is ready.

Besides .carrick/, init writes nothing into a repository except the hook settings, the skills and the AGENTS.md section.

init prints one line per action, marked ◇ when done, ▲ for a warning that says what to do, and ■ for something it could not do and why. Without a terminal (an agent’s shell, a pipe) it writes the same lines as plain text, with no colour and no spinner.

Each repository is identified by its origin remote. A remote written through a per-account SSH host alias (git@github.com-work:owner/repo.git) is resolved with ssh -G, so an alias whose HostName is github.com counts as an ordinary GitHub repository. When a remote still names no GitHub repository, init says which repository it was and leaves it out. A --repo owner/repo value that matches no repository in the folder attaches to the one repository there that has no identity.

Project boundaries

Repositories that interact with one another belong in the same project. --project checks that the repositories are in the project you name, and stops the run if they are not. Move a repository between projects on the dashboard.

cd ~/code/second-system
carrick init --project second-system

You add repositories to your workspace by installing the Carrick GitHub App, which needs a workspace owner or admin. See the Quickstart.

Reading the index onto your machine

Carrick builds the index in the cloud. Run carrick refresh to pull it onto your machine:

carrick refresh
carrick refresh --service api
  • carrick refresh: Re-runs local deterministic extraction and downloads updated classification rows from Carrick Cloud without running remote models or uploading. Use --service <name> to limit extraction to a single service before re-joining workspace contracts.

refresh replays hosted answers for unchanged files when the hosted commit is available locally and cache versions match. Changed files keep their local facts while their hosted model answers are withheld, and no model runs on your machine.

On macOS, refresh keeps the machine from idle-sleeping until it finishes, for at most three hours, and prints one line saying so. Closing the lid still puts it to sleep. Pass --no-keep-awake or set CARRICK_NO_KEEP_AWAKE=1 to let it sleep.

A Claude Code session opened in a workspace still waiting for its first hosted index starts carrick refresh in the background, at most once an hour. Set CARRICK_REFRESH_COOLDOWN_MS to change that interval.

Inspecting local contracts

Query the local index for file-level and workspace-level contract status:

carrick check path/to/file.ts
carrick check path/to/file.ts --recheck
carrick touch path/to/file.ts
carrick status
  • carrick check <file>: Displays all routes, client calls, counterpart locations, and stored contract verdicts for the specified file.
  • carrick check <file> --recheck: Re-extracts and re-evaluates the specified file against the existing index within a 10-second budget (configurable via CARRICK_RECHECK_BUDGET_MS), verifying uncommitted working-tree changes without contacting the network.
  • carrick touch <file>: Lists indexed routes and calls for a file without computing contract verdicts.
  • carrick status: Lists indexed services, last-scanned commit hashes, and local modified file counts.

These commands read .carrick/ and write nothing. Add --json to any inspection command to receive structured JSON output, in the shape pinned in docs/local-mode-output.md.

Additional commands

Command Action
carrick derive --workspace . Prints the detected repository and service proposal without modifying files or running scans.
carrick doctor [DIRECTORY] Inspects configuration paths, agent hooks, and skill file digests, reporting any discrepancies.
carrick remove [--keep-login] Removes local .carrick directories, agent hooks, MCP registrations, and credentials while preserving tracked repository files.
carrick lsp --stdio Starts the Language Server Protocol process used by editor extensions and LSP clients.
carrick hook <name> Executes an agent lifecycle hook (post-edit, post-read, session-start, stop, user-prompt).
carrick --version Displays the installed CLI version.

Check the setup

carrick doctor re-reads the decisions made once at setup, such as which directories are services, which shared roots they include and which tsconfig resolves their types. Carrick rebuilds the index on every push to the default branch, but nothing rebuilds the configuration. The command exits non-zero when it finds a problem, and checks that:

  • Every directory, include and tsconfig a carrick.json declares exists.
  • The agent hook entries are the ones this version installs, and the command they run still resolves to this package.
  • Each agent client on this machine has the Carrick MCP server.
  • The hosted index answers for every service, with the local index’s distance from the working tree and from the default branch as notes.

carrick doctor writes nothing and runs no scan.

Remove Carrick

To remove the local configuration created by carrick init and uninstall the CLI:

carrick remove
npm uninstall -g carrick

carrick remove removes local hook entries, unregisters the MCP server from local agent configs, deletes .carrick/, and clears local credentials. Tracked repository files such as carrick.json remain under version control, and the CLI prints git rm commands if you choose to delete them.

Other hooks, other MCP servers and the settings files themselves stay. An MCP server called carrick that points anywhere other than api.carrick.tools is left alone and reported. Pass --workspace DIR to name a folder other than the current one. Running it twice is safe, and the second run says there is nothing left to remove. It also names the sections only their owner can unpick, which are the ## Carrick section of an AGENTS.md, the hook-pack entries in a committed .claude/settings.json, and the .claude negations in .gitignore. Revoking the key itself is a separate action, on the Account page.

Environment variables

Variable Description
CARRICK_TOKEN Overrides locally stored authentication credentials with an explicit API token.
CARRICK_WORKSPACE Overrides the target workspace root directory.
CARRICK_NO_UPDATE_CHECK Set to 1 to disable checking for newer CLI versions.
CARRICK_NO_KEEP_AWAKE Set to 1 to let the machine idle-sleep during carrick refresh.
CARRICK_REFRESH_COOLDOWN_MS Minimum interval in milliseconds between the background carrick refresh runs a Claude Code session starts while waiting for a hosted index. Defaults to one hour.
CARRICK_RECHECK_BUDGET_MS Maximum duration in milliseconds allowed for carrick check --recheck before falling back to cached index data.