CLI

Install

Install Pathrule CLI on macOS, Linux, or Windows with npm, then sign in over a browser or an SSH friendly device code flow.


Pathrule CLI is the terminal first surface for Pathrule. It runs the local MCP server, the hook supervisor, and the local cache for agents you drive from a shell. This page shows how to install it and sign in.

Requirements

  • macOS, Linux, or Windows.
  • Node.js 20.11.1 or newer (npm is the install path on every operating system).
  • A modern shell: zsh, bash or fish, or PowerShell on Windows.
  • An AI coding assistant that speaks MCP (Claude Code, Cursor, Codex CLI, Windsurf, GitHub Copilot). Optional for install, but you will want one to verify the hook flow.

Install

npm (macOS, Linux, Windows)

npm is the install path on all three operating systems. It needs Node.js 20.11.1 or newer.

npm install -g @pathrule/cli

On Windows, run this from PowerShell. Pathrule registers a Windows compatible hook command automatically, so the same pathrule commands work there exactly as they do in a Unix shell.

Direct download

If you prefer not to use a package manager, see the CLI page for the latest signed release, extract it, and put the pathrule launcher on your PATH. It runs on macOS, Linux, and Windows and needs Node.js available.

A Homebrew tap for macOS is planned. Until it is live, use npm.

Verify

pathrule --version

The CLI prints its version and exits zero. If the command is not found, make sure the install location is on your PATH and reopen the shell.

Sign in

Two flows. Pick the one that matches the machine you are on.

Browser PKCE flow

Use this on a desktop or any machine with a browser available.

pathrule login

The CLI opens a browser, you sign in to your Pathrule account, and the CLI receives a session over the PKCE callback. No tokens are pasted into the terminal.

Device code flow

Use this on a headless box, an SSH host, or a CI runner.

pathrule login --device-code

The CLI prints a short verification URL and a code. Open the URL on a machine with a browser, enter the code, and approve the session. The CLI completes the handshake without ever holding your password.

Attach a workspace

A workspace is the unit Pathrule scopes content to. Attach it to the local directory you want it to apply under.

pathrule workspace list
pathrule workspace attach --workspace my-team --path ~/repos/my-team

After attach, any time you run an AI client in a directory under that path, the runtime knows which workspace's content to serve.

Verify the wiring

The doctor is the single command that confirms everything is hooked up end to end.

pathrule doctor

It checks:

  • The local cache exists and is fresh.
  • The MCP server starts and responds to a ping.
  • Each supported AI client config points at the right MCP command.
  • The hook registration is current for the AI clients you have installed.

If anything is off, doctor prints a one line fix suggestion. Most issues are resolved by running pathrule repair, which re writes the configs to the expected state.

  • Quickstart to write your first memory and watch the hook fire.
  • How hooks work for the model that explains what doctor is verifying.
  • MCP overview for the tools the assistant calls once the runtime is up.