Pathrule
OfficialIntegrates with GitHub Copilot as a coding agent, supplying path-scoped memories, rules, and skills via Pathrule hooks and MCP to give it the project context needed for the files or paths being edited.
This server has a remotely hosted endpoint. Open its connector listing for connection details, authentication requirements, and setup instructions:
Quickstart
Node.js 22.14.0 or newer, on macOS, Linux or Windows.
npm i -g @pathrule/cli
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 writes new ones as it works.
Other ways in | Command | Good for |
VS Code extension |
| Knowledge beside the code. Marketplace and Open VSX. |
Claude Code / Codex plugin |
| Installing from inside the agent. Setup shows a plan before it changes anything. |
Cursor plugin | Cursor Marketplace → Pathrule | The same hooks, MCP and skills inside Cursor. |
Gemini CLI / OpenCode plugin |
| The same setup in Gemini CLI and OpenCode. |
Any MCP client |
| Agents without a plugin system. Listed in the official MCP Registry. |
Local Console |
| Browse and edit knowledge on 127.0.0.1. No account. |
Remote MCP |
| Trying it with nothing installed. No hooks, no local mode. |
From source |
| Hacking on Pathrule. See docs/quickstart.md. |
Related MCP server: Sugar
Explain it once
Coding agents start every session blank. So the same correction comes back, day after day, agent after agent:
Day | Agent | What you typed | |
Mon | Claude Code | “use our api client, not fetch” | 1st |
Tue | Claude Code | “again: api client, not fetch” | 2nd |
Wed | Codex | “we use the api client.” | 3rd |
Thu | Cursor | “I told you yesterday. api client.” | 4th |
Fri | Claude Code | “API CLIENT. NOT FETCH.” | 5th |
Five sessions, three agents, nothing remembered. With Pathrule you say it once:
You fix it once, the way you normally would.
Pathrule files it next to the code it is about: a memory on
features/, not a line in a file every session has to read.Every agent knows from the next session on, whichever one you open.
Only what matters
A workspace collects hundreds of notes. An agent editing features/orders needs four of them.
Knowledge is matched by path, scope and relevance, then fit to a per-prompt budget. Enforced rules are never cut for space. Whatever does not fit is listed by title, so the agent can ask for it. When a prompt names a function or a type, the hook also points the agent to the file and line where it is defined (JS/TS, Python, Go).
Three kinds of knowledge
Kind | What it holds | Example on |
Memory | Decisions, gotchas and incidents, in short markdown. | “Use the api client. It handles auth and retries.” |
Rule | Constraints the agent must follow, ranked above advice. | “Data loading goes through React Query.” |
Skill | Reusable procedures and checklists an agent can run. | “Run the checks before calling it done.” |
Three ways in
Channel | When it reaches the agent | Cost |
Path-scoped rule files | Claude Code reads Pathrule's own | Cached by the client. |
Hooks | Before the agent acts: on session start, on each prompt and on file tools. Only new or changed context is sent again. | Budgeted per prompt. |
MCP | When the agent asks, at the depth the request needs. | Every MCP client has it. |
Why not just CLAUDE.md?
A CLAUDE.md file is read whole on every step, so every note your team adds makes every session cost more. Pathrule sends each prompt only what the path and the task need. PathruleBench measured the difference with the same agent, the same prompts and the same hidden checks, from 500 to 2,000 items of team knowledge.
At 2,000 items of team knowledge | CLAUDE.md | Pathrule |
Cost a chain of 8 sessions | $3.89–$4.21 | $1.76–$1.89 |
Input tokens a chain | 11.8–12.5 M | 4.3–4.7 M |
Memory probes passed | 89% | 97% |
Chains that passed every memory probe | 0 of 9 | 5 of 9 |
A habit said once, followed later | 78% | 97% |
What a failing command taught, kept | 33% | 78% |
The work each prompt asked for | 100% | 100% |
From 500 to 2,000 items, a chain with CLAUDE.md costs 89–98% more. With Pathrule it moves between −1% and +10%. Your knowledge base can grow; the bill does not.
Claude Code with claude-sonnet-5-5 in Python, Go and TypeScript; nine chains an arm at 2,000 items (three per language); executable tests decide every pass, no model judges. The Pathrule arm is this repository's open-source CLI in local mode: no Cloud, no model.
Every condition, chain and check, and how to run it yourself → pathrule/benchmark
Smarter the longer you use it.
Day one needs no account, no network and no model. Everything after builds on what you and your agents already did in this repository.
When | What Pathrule does | Where it runs |
Day 0Foundation | Hooks and the local MCP server are wired into your agents. What you write is delivered per path, within a budget, through the hooks and Claude Code's path-scoped rules; your own | Open source, this machine |
Week 1Memory | A decision you state in a prompt (“from now on…”, “we decided…”) is saved in your own words. A lesson a failing command taught is saved once. Each note is filed next to the code it is about, and only new or changed context is sent again. | Open source, this machine |
Month 1Your habits | A preference you state lives in a local file of your own. Said once in passing, it waits; said again in another session, it reaches every agent. One you call lasting is in force at once. A project rule always wins over a personal one. | Open source, this machine |
Month 3At scale | Thousands of notes, and a session stays the same size: the root rules file stays around 6k characters and the rest arrives per prompt. A sentence that says where code lives is marked | Open source, this machine |
When you chooseTeam | The same knowledge on every machine and for every member. For a Cloud workspace, a model also reads the prompts Pathrule's phrase rules found nothing in and keeps the sentence you meant to last, still in your words. It is paid from AI Credits. | Pathrule Cloud, opt-in |
No model runs on your machine. Everything before Team is the open-source CLI, the same path the benchmark above measured.
Switch agents. Keep the knowledge.
Agent | Before it acts | Instruction file | MCP |
Claude Code | Hooks, prompt hook included | Pathrule's own | Local or Remote |
Codex | Hooks, prompt hook included | — | Local or Remote |
Cursor | — | — | Local |
GitHub Copilot | — | — | Local |
Windsurf | — | — | Local |
Any MCP client | — | — | Local or Remote |
Not another rules file
A rules file | Pathrule | |
Written | By hand, kept current by hand | Grows as you and your agents work |
Reaches | One tool per file | Every connected agent |
Delivered | All of it, every session | Only what the path and the task need |
Changes | When someone edits it | Versioned; new knowledge replaces old |
Keep your CLAUDE.md and AGENTS.md: Pathrule does not edit them. It delivers the rest per path and per task, where a single file cannot.
What's in this repository
This is Pathrule's open-source foundation. It runs with no account and no network service: the store, retrieval and ranking, the MCP server, the hooks, the learning loop and the CLI.
Part | Here | Licence |
Foundation: protocol, agent IR, the local knowledge store, host, MCP server, CLI, Pathrule Cloud client, agent integrations, Local Console, VS Code extension | Yes | Apache-2.0 |
Pathrule Cloud: team workspaces, sync, the web console, Remote MCP, the Cloud model tier | No | Proprietary |
protocol · agent-ir · core · integrations · mcp · host · ui · local-console · cloud · cli · vscode
pnpm install
pnpm typecheck # every package
pnpm test # every package's tests
pnpm build # each package's npm buildYour code stays yours
Source code is never uploaded automatically.
Local mode has no account, runs no model, and the open CLI sends no telemetry.
Your agent keeps its own model provider. Pathrule is not a model, an agent or an IDE.
Pathrule Cloud is opt-in. Signed in, it stores your knowledge and uses the prompt to rank it, and its model tier may read a prompt to find a decision meant to last.
Community
Contributors
Contributing (DCO sign-off) · Code of conduct · Report a vulnerability · Get help · Trademark policy
License
Apache-2.0. See LICENSE and NOTICE. The Pathrule name and logo are not licensed under Apache-2.0.
This server cannot be deployed
Maintenance
Related MCP Connectors
Shared memory for coding agents. Stop re-explaining your codebase every session.
Path-scoped team memories, rules and skills for Claude Code, Cursor, Codex and other MCP clients.
Project memory, documentation and controlled secret access for AI coding agents.
Persistent engineering memory designed to follow developers across coding agents.
Related MCP Servers
- AlicenseAqualityBmaintenancePath-scoped team memories, rules and skills for AI coding agents.301MIT
- FlicenseNot gradedqualityAmaintenanceEnables AI coding agents to read and write persistent, local-first memory across sessions and projects, with semantic search, global guidelines, and optional autonomous task execution.-
- FlicenseNot gradedqualityAmaintenanceProvides AI coding agents with a local-first persistent memory layer they can read and write during sessions, storing decisions, preferences, error patterns, and research per project or globally. Enables semantic and keyword search, formatted context recall, and cross-project guideline surfacing without API keys or cloud storage.-
- FlicenseNot gradedqualityAmaintenanceEnables AI coding agents to store and retrieve persistent project and cross-project memories via semantic search, so decisions, preferences, error patterns, and guidelines survive across sessions. Optionally supports autonomous task execution built on the same local-first knowledge store.-