@pathrule/cli
v1.0.7
Published
Pathrule, the context layer for AI coding agents: path-scoped memories, rules, and skills for Claude Code, Cursor, Codex, and Windsurf.
Readme
Quickstart
npm i -g @pathrule/cli
cd your-project
pathrule setup --local # no account: knowledge stays on this machine
pathrule doctor # see what each agent receivesRestart your agent. From the next session on, it gets the notes for the path it is about to touch, and saves new ones as it works: a decision you state, a lesson it should not have to learn twice.
Working with a team? Run pathrule setup without --local. It signs you in to Pathrule Cloud, finds or creates the workspace and attaches this folder, so every machine and every teammate gets the same knowledge.
What pathrule setup does
| Step | What you get |
| --- | --- |
| Workspace | Creates or reuses this folder's workspace: on this machine with --local, in Pathrule Cloud without it. |
| MCP entry | Every agent you pick gets the Pathrule MCP server: get_context and the tools it uses to read and write knowledge. |
| Hooks | Claude Code and Codex get the notes for a path before they act: on session start, on each prompt and on file tools. |
| Pathrule's own files | Claude Code reads Pathrule's .claude/rules/pathrule/ at session start, each file scoped to its paths. Every file Pathrule writes is listed in .pathrule/managed-files.json. Your CLAUDE.md and AGENTS.md are left as they are. |
Pick agents with --target: claude-code, codex, cursor, copilot, windsurf or all. Each one gets the same knowledge through the channel it supports:
| Agent | Before it acts | MCP |
| --- | --- | --- |
| Claude Code | Hooks, prompt hook included, and Pathrule's own .claude/rules/pathrule/ | Local or Remote |
| Codex | Hooks, prompt hook included | Local or Remote |
| Cursor · GitHub Copilot · Windsurf | get_context, when the agent asks | Local |
Commands
Your agent writes knowledge, through the MCP server. The CLI sets things up, reads what was saved and tells you what each agent receives.
| | Commands |
| --- | --- |
| Set up | setup · init · install <agent> · uninstall <agent> · attach · detach · sync |
| Read knowledge | search "<query>" · memory list · memory read "<title>" --print · rule … · skill … · ui (Local Console on 127.0.0.1) |
| Check | status · doctor · preflight |
| Runtime signals | instrument events: the errors and events your app reported, and whether a fix was verified |
| Cloud and team | login · logout · whoami · workspace · org · team · invite · billing · upgrade · activity |
| Maintenance | update · config · index · embeddings · topics · learning · me · host |
Run pathrule on its own for the project home, and pathrule help for every command this build has.
Scripts and CI
Four options work across the CLI:
| Option | Effect |
| --- | --- |
| --json | Stable, machine-readable output |
| --yes | Accepts prompts for supported mutating commands |
| --no-open | Opens no browser window |
| --no-color | Plain output |
pathrule setup --local --target claude-code --yes
pathrule doctor --json
pathrule search "api client" --jsonRequirements
Node.js 22.14.0 or newer, on macOS, Linux and Windows. Upgrade with pathrule update or npm i -g @pathrule/cli@latest.
- Windows. The CLI writes a
pathrule-hook.cmdshim next topathrule-hook.jsin%USERPROFILE%\.pathrule\bin\, so agents that start hooks without a shell run the.cmddirectly. - Proxies and custom CAs. Set
HTTPS_PROXY,HTTP_PROXY,NO_PROXYorNODE_EXTRA_CA_CERTSbeforepathrule install <agent>. The CLI carries them into the managed MCP entry, so the MCP server your agent starts reaches Pathrule Cloud too. - State location. Per-user state lives in
~/.pathrule. SetPATHRULE_HOMEto move it;pathrule installcarries it into the MCP entry.
Privacy and security
- Your code stays yours. Your source code stays on your machine. With
--local, so does your knowledge: no account, no cloud. - No telemetry. The CLI and the MCP server send no product telemetry, signed in to Pathrule Cloud or not.
pathrule telemetrysays so. - No background service. The local host Pathrule's tools share starts when a command needs it and stops after ten minutes without use. It binds to loopback, refuses requests from browsers and requires a per-start token kept in
~/.pathrule/host/host.json, readable only by you. - Cloud on your session. Pathrule Cloud uses your user session, never an embedded service key, and enforces workspace permissions on every request.
Found a vulnerability? See the security policy.
Learn more
- Pathrule on GitHub: the whole open-source layer, the VS Code extension and the Local Console
- PathruleBench: every condition, chain and check, and how to run it yourself
- Docs · Changelog · Get help
