Every command in Pathrule CLI, grouped the way `pathrule help` groups them. Each entry says what the command does and which options matter. For a first setup, start with [Install](/docs/cli/install).

```bash
pathrule <command> [subcommand] [arguments] [options]
pathrule help
```

## Global options

| Option | What it does |
| --- | --- |
| `--json` | Prints one machine-readable JSON object instead of human output. It also turns off color, prompts and browser windows. |
| `--yes` | Accepts the confirmation that `setup` and `cache prune` ask for before they change anything. |
| `--no-open` | Never opens a browser. A command that would open one prints the URL instead. |
| `--no-color` | Prints plain output with no color. Setting the `NO_COLOR` environment variable to `1` does the same. |
| `--local` | Runs `init`, `setup`, `sync`, `search` and the `memory`, `rule` and `skill` commands against an account-free local store. See [Work without an account](#work-without-an-account). |
| `--help`, `-h` | Prints the command list. |
| `--version`, `-v` | Prints the CLI version. |

When the `CI` environment variable is `true`, the CLI also skips prompts and browser windows, so a command never waits for input on a runner.

### Options a command does not know

The CLI does not reject an option it does not recognise. Most commands read it as a plain argument, which makes the command fail or act on the wrong target. `pathrule workspace attach --path ~/repos/app` looks for a workspace named `--path`, and `pathrule install --client cursor` stops because `--client` is not a client name. `setup`, `invite`, `team`, and `memory add`, `rule add` and `skill add` check their own options and stop with an error on one they do not know. Use the options on this page or in `pathrule help`.

### JSON output

With `--json`, every reply is one JSON object with `ok`, `command` and `cwd`, plus `data` when the command succeeded, or `error` with a `code` and a `message` when it did not. Some replies add `next_steps` with the commands to run next. `--json` is available on commands that advertise it in `--help`. `snapshot` and `eject` do not support it, so run that one without it. Sign in with plain `pathrule login`, since the sign-in flow needs to show you a code.

### Exit codes

`0` means the command did what you asked. Most usage errors, such as a missing argument or an unknown client name, exit with `64`. Any other failure exits with `1`, and `pathrule doctor` exits with `1` when a check fails. On a Node.js version older than 20.11.1, every command stops with `78` before it does anything.

## Get started

| Command | What it does |
| --- | --- |
| `pathrule setup` | Connects the current folder in one guided run. It signs you in if needed, suggests the workspaces in your organization that match this folder (the same git remote, for example), attaches the one you pick or creates one named after the folder, asks which AI clients to connect, installs them, writes the files they read, and offers to start a first project scan in one of them. On an Apple Silicon Mac it finally offers the optional [on-device model](/docs/intelligence/local-model). |
| `pathrule init [name]` | Creates a workspace in your current organization, named after the folder unless you give a name, and attaches the current folder to it. |

Without a terminal to prompt in, `pathrule setup` only prints a plan: the organization, the matching workspaces, and the command that would attach the best one. These options make it act, and acting needs `--yes`:

- `--workspace <name-or-id>` attaches an existing workspace. `--workspace-id` is the same option.
- `--create-workspace` creates a workspace named after the folder. Add `--workspace-name <name>` to name it yourself.
- `--select-workspace <name-or-id>` makes a workspace current without attaching this folder.
- `--org <slug-or-id>` switches organization first.
- `--target <client>` installs the MCP entry for `claude`, `cursor`, `codex`, `windsurf`, `copilot` or `all`.

```bash
pathrule setup --workspace my-project --target all --yes
```

`pathrule setup bootstrap --rerun` scans the repository's docs and commit history again and prepares fresh memory and rule candidates for the current workspace's first project scan.

## Account and context

| Command | What it does |
| --- | --- |
| `pathrule login` | Signs in with a one-time code. The CLI prints the code and opens the approval page in your browser with the code filled in, or prints the URL to open on any device when there is no browser. `--no-open` never opens a browser. `--browser-callback` signs in with GitHub in a browser on this machine and returns over a local callback, and falls back to the code when that is not possible. `--device-code` is accepted and runs the default code flow. |
| `pathrule logout` | Signs Pathrule CLI out on this machine. `--all` also signs out the other Pathrule surfaces on this machine, such as the VS Code extension. |
| `pathrule whoami` | Shows the signed-in account and when the session expires. |
| `pathrule org list` | Lists your organizations with your role, and marks the current one with `*`. Plain `pathrule org` does the same. |
| `pathrule org current` | Shows the current organization and your role in it. |
| `pathrule org use <slug-or-id>` | Switches the current organization. |
| `pathrule workspace list` | Lists the workspaces in the current organization and marks the current one with `*`. Plain `pathrule workspace` does the same. |
| `pathrule workspace current` | Shows the current workspace. |
| `pathrule workspace use <name-or-id>` | Makes a workspace current without attaching a folder. |
| `pathrule workspace create <name>` | Creates a workspace and attaches the current folder to it. |
| `pathrule workspace attach [name-or-id]` | Attaches the current folder to an existing workspace, matched by its exact name or its id. With no argument it attaches the current workspace. There is no path option: run it inside the folder. |
| `pathrule workspace detach [name-or-id]` | Removes the workspace's folder attachment on this machine. The workspace and its content stay in Pathrule. |
| `pathrule workspace inspect` | Shows the current workspace in detail: its organization and plan, where it is attached, its git remote, how many memories, rules and skills it holds, plan usage, which AI clients are set up, and recent activity. |

Attaching, creating, `init` and `workspace use` also make that workspace current. Commands such as `memory`, `rule`, `skill`, `search` and `sync` work on the current workspace.

## Workspace setup

| Command | What it does |
| --- | --- |
| `pathrule attach [name-or-id]` | The same as `workspace attach`. |
| `pathrule detach [name-or-id]` | The same as `workspace detach`. |
| `pathrule install [client]` | Writes Pathrule's MCP server entry into an AI client's own user-level configuration and leaves every other server in it alone. The client is `claude` (or `claude-code`), `cursor`, `codex`, `windsurf`, `copilot` (or `github-copilot`), or `all`, which is the default. GitHub Copilot gets two entries, one for the Copilot CLI and one for VS Code. |
| `pathrule uninstall [client]` | Removes Pathrule's MCP entry from that client's configuration, or from all five. |
| `pathrule sync` | Writes the files your AI clients read into the repository: instruction files, hook configuration and the local hook index. Run it in the folder the workspace is attached to. `--skills` syncs only the workspace's skills into your clients' skill folders. `--local` syncs an account-free workspace. |
| `pathrule mcp run` | Starts Pathrule's local MCP server over standard input and output. This is the command the MCP entry written by `pathrule install` launches, so your AI client runs it and you do not need to. |

`pathrule sync` writes files for the AI clients chosen for this workspace in `pathrule setup`. When none are chosen, it writes for the clients whose Pathrule files are already in the repository, and for Claude Code when there are none. Claude Code's `CLAUDE.md` and hook entry are refreshed on every sync. [Install](/docs/cli/install#what-pathrule-writes-into-your-repository) lists each file. To take Pathrule back out of a repository, see [Remove Pathrule from a project](/docs/cli/install#remove-pathrule-from-a-project).

## Knowledge

| Command | What it does |
| --- | --- |
| `pathrule search <query>` | Searches memories, rules and skills in the current workspace. `--type memory,rule` narrows the kinds, `--path /apps/api` narrows to a path, and `--limit <n>` caps the results. |
| `pathrule memory list` | Lists memories. `--path` or a leading path narrows the list, so `pathrule memory list /apps/api` and `pathrule /apps/api memory list` are the same. `--limit <n>` caps it. |
| `pathrule memory read <id-or-title>` | Prints a memory. Pass `--print` to print long content in full in the terminal. |
| `pathrule memory add` | Writes a memory with `--path </node/path> --title <title>`. The body comes from `--body`, from standard input, or from your editor (`VISUAL` or `EDITOR`) when you give neither. `--allow-duplicate` skips the duplicate check. |
| `pathrule rule list`, `read`, `add` | The same for rules. `rule add` takes `--name` instead of `--title`, plus `--priority` (`high`, `medium` or `low`, default `medium`) and `--scope` (`project`, `folder` or `file_type`, default `project`). |
| `pathrule skill list`, `read`, `add` | The same for skills. `skill add` takes `--name` and an optional `--description`. |
| `pathrule refresh list` | Lists the open refresh tasks, the requests to update knowledge that has gone stale. `--include-in-progress` adds the claimed ones, and `--limit <n>` caps the list. |
| `pathrule refresh claim [id]` | Claims a refresh task, the next open one when you give no id, and prints its brief. |
| `pathrule refresh resolve <id> --status applied` | Closes a refresh task as `applied` or `rejected`. `--note "<text>"` records why. |
| `pathrule snapshot` | Captures an inventory of the current folder, with its file tree, manifests and short docs samples, git branch and recent history, and uploads it to the workspace. It reads no other file contents. `--dry-run` prints it without uploading, and `--notes "<text>"` attaches a note. |
| `pathrule snapshot list [n]` | Lists the workspace's most recent snapshots. |

## Your working preferences and the local model

| Command | What it does |
| --- | --- |
| `pathrule me list` | Lists what [User Intelligence](/docs/intelligence/user-intelligence) holds about how you work, both what is in use and what is not yet. Plain `pathrule me` does the same. |
| `pathrule me teach "<sentence>"` | Teaches a preference in your own words. It needs the optional on-device model. |
| `pathrule me explain <id>` | Shows one preference with the evidence behind it. The id is the short id `me list` prints. |
| `pathrule me scope <id>` | Keeps a preference to the workspace you run it in. `--everywhere` lets it apply in every workspace. |
| `pathrule me forget <id>` | Stops using a preference and keeps it as rejected, so the same evidence does not bring it back. `--delete` removes it entirely. |
| `pathrule me context "<task>"` | Prints what an agent would receive for that task, and which preferences were held back and why. |
| `pathrule intelligence status` | Shows whether the [on-device model](/docs/intelligence/local-model) is installed, its version, and whether an update is available. Plain `pathrule intelligence` does the same. |
| `pathrule intelligence install` | Sets up the local runtime the model needs, then downloads the model and verifies its checksum before it becomes active. It needs an Apple Silicon Mac. |
| `pathrule intelligence update` | Installs a newer model when one is available. If the update fails, the model you had stays in place. |
| `pathrule intelligence remove` | Removes the model. Everything that does not need it keeps working as before. |

## Local Console and agent integrations

| Command | What it does |
| --- | --- |
| `pathrule ui` | Opens the accountless Local Console for knowledge, activity and Local Signals. `--port`, `--no-open` and `--json` control how it opens. |
| `pathrule integrations` | Interactive setup for Claude Code and Codex. Outside an interactive terminal, lists the setup. |
| `pathrule integrations add claude codex --local --dry-run` | Previews a native integration without writing. Choose `--cloud` for Cloud mode. |
| `pathrule integrations list` | Lists detected agents and recorded integrations. |
| `pathrule integrations doctor` | Read-only checks of the installed integration. |
| `pathrule integrations repair` | Reapplies recorded Pathrule integrations. |
| `pathrule integrations remove <agent>` | Removes the recorded integration. |
| `pathrule telemetry` | Shows the telemetry preference and whether this CLI can send. |
| `pathrule telemetry enable` | Opts a signed-in managed CLI into anonymous usage events. |
| `pathrule telemetry disable` | Turns them off. |

See [Local Console](/docs/surfaces/local-console) and [Native agent integrations](/docs/mcp/native-integrations).

## Remove project integration

`pathrule eject` shows a read-only plan for removing the files and managed regions Pathrule owns in the current repository. `pathrule eject --apply` carries it out after you review it. Eject does not have a `--json` form. Native plugins are removed through `pathrule integrations remove <agent>`.

## Diagnostics and maintenance

| Command | What it does |
| --- | --- |
| `pathrule status` | Shows the signed-in account, the current organization and plan, the current workspace, and whether this folder is attached. |
| `pathrule doctor` | Runs read-only checks: sign-in, organization, workspace, whether this folder is attached, whether each AI client has Pathrule's MCP entry, and the files Pathrule manages in this folder with the surface and version that wrote each one. It names the next command when something needs attention. With `--json` the report also covers the Node.js version and flags an MCP entry whose launch command is out of date. `--bundle` writes a support file with credentials and local paths redacted. |
| `pathrule repair` | Rewrites out-of-date Pathrule MCP entries in your AI client configurations, leaving other servers alone, writes the repository files again, and reports what changed. |
| `pathrule preflight <action>` | Checks whether your plan allows an action before you try it. The action is `create_workspace`, `write_memory`, `write_rule`, `write_skill`, `sync_agents` or `materialize_skills`. |
| `pathrule cache prune` | Lists stale local cache folders without removing them. `--yes` removes them. |
| `pathrule config get <key>` | Reads a preference: `update.policy`, `telemetry.enabled` or `telemetry.id`. |
| `pathrule config set <key> <value>` | `update.policy manual` stops the daily update check, while `notify` and `auto` keep it. `telemetry.enabled false` turns the anonymous usage telemetry off. Setting the `NO_TELEMETRY` environment variable to `1` does the same for one run or shell. |
| `pathrule config reset telemetry-id` | Replaces the telemetry id with a new one. |
| `pathrule update` | Checks for a newer CLI and prints the command that installs it. It never installs anything itself. |

Once a day, an interactive run also checks for a newer CLI and prints a one line notice with the upgrade command. It only names a version that is newer than yours.

The standalone local CLI sends no telemetry. A signed-in managed CLI sends anonymous usage events only after you opt in with `pathrule telemetry enable`. Events carry no code, paths, prompts, knowledge, email or account and workspace ids. Turn them off with `pathrule telemetry disable`; `NO_TELEMETRY=1`, `DO_NOT_TRACK=1` and CI keep them off.

## Team and billing

| Command | What it does |
| --- | --- |
| `pathrule team` | Lists the members and pending invites of the current organization, or of `--org <slug-or-id>`. `pathrule team open` opens Pathrule Web, where members are managed. |
| `pathrule invite <email>` | Invites a teammate to the current organization as an editor. `--role` sets `admin`, `editor` or `viewer`, and `--org` and `--workspace` set the organization and workspace. It reports whether the invite email went out and how the invite affects your seats. |
| `pathrule billing` | Opens the organization's billing in Pathrule Web. |
| `pathrule upgrade` | Opens billing to pick a plan. |

## Help and version

| Command | What it does |
| --- | --- |
| `pathrule help` | Prints the command list. |
| `pathrule version` | Prints the CLI version, the same as `--version`. |

## Work without an account

Pathrule CLI runs on a local store with no account and no cloud. Run these inside the project:

```bash
cd ~/repos/my-project
pathrule init --local
pathrule setup --local
```

`pathrule init --local [name]` creates a local workspace for the current folder, kept on this machine, and reuses the one that already covers the folder if there is one. `pathrule setup --local` does the same and then installs the local MCP entry for every AI client, or for one with `--target <client>`, installs the hooks and writes the repository files, all without signing in. `--workspace-name <name>` names a new workspace. Options that need an account, such as `--org` or `--workspace`, stop with an error.

In a local workspace your AI agent writes memories, rules and skills through Pathrule's MCP tools. From the terminal you read and search them with `--local`:

```bash
pathrule memory list --local
pathrule rule read "No service key in browser code" --local
pathrule search "migrations" --local
pathrule sync --local
```

`memory add`, `rule add` and `skill add` need an account. With `--local` they say so and change nothing. See [Open source core](/docs/editions/open-source-core) for what the local edition includes.

## What to read next

- [Install](/docs/cli/install) for the first setup, what Pathrule writes into a repository, and how to remove it.
- [Pathrule CLI](/docs/surfaces/cli) for what the CLI owns and when to use it.
- [User Intelligence](/docs/intelligence/user-intelligence) for what `pathrule me` manages.
