A team layer above your CLAUDE.md
Pathrule routes path-scoped memories, rules and skills into Claude Code at hook time, before the first tool call. Your CLAUDE.md stops being a 600-line file the model half-ignores and becomes a focused slice for the directory you are actually working in.
The CLAUDE.md problem
Pathrule for Claude Code is a concrete implementation of the AI coding context layer pattern. Single-file context works on day one. By month three, the same file is too long for the model to follow, too noisy for new teammates to read, and too stale to trust. Long instruction files lose signal. That much shows up in every team that has put more than a quarter into Claude Code.
The fix is not "write a shorter CLAUDE.md". The fix is to stop modelling team knowledge as one giant file when the work is path-scoped.
What Pathrule adds to Claude Code
PreToolUse + UserPromptSubmit
Pathrule runs at the two hook points Claude Code already exposes, before the first tool call. The model sees the scoped slice on every turn, not just the one initial load from CLAUDE.md.
Rules where they apply
A rule attached to /apps/mobile only fires when Claude Code is acting under that path. The root CLAUDE.md stops being a dumping ground.
Memories, rules, skills
Memories carry team-learned context. Rules are advisory or strict. Skills are multi-step playbooks the model invokes by name.
What the install actually does
Pathrule does not patch Claude Code. It writes a hook entry into the configuration file Claude Code already reads at startup, pointing at a single unobfuscated Node.js script under ~/.pathrule/bin. You can grep both files yourself.
~/.claude/settings.json
{
"hooks": {
"PreToolUse": [
{ "command": "node ~/.pathrule/bin/pathrule-hook.js pre-tool-use" }
],
"UserPromptSubmit": [
{ "command": "node ~/.pathrule/bin/pathrule-hook.js user-prompt-submit" }
]
}
}Removing the entries removes Pathrule instantly. The rest of your Claude Code setup is untouched.
CLAUDE.md vs Pathrule
| CLAUDE.md alone | Pathrule + Claude Code |
|---|---|
| One file, every turn, every directory. | Path-scoped slice for the directory the model is working in. |
| Token budget grows linearly with team rules. | Token cost stays flat. Only relevant rules are injected. |
| Rules ignored as the file grows. | Every injected rule is load-bearing for the current path. |
| Tied to Claude Code; Cursor and Codex need their own files. | Same content drives Claude Code, Cursor, Codex, Windsurf and GitHub Copilot. |
| Version-controlled in the repo. Editable by anyone with push. | Reviewable, auditable knowledge graph with row-level security. |
Long read: Why Claude Code ignores your CLAUDE.md.
How Pathrule fits a team running Claude Code
Authoring. Write memories, rules and skills in the web app, the desktop app or the CLI, and attach each to a path. Or let the assistant capture them in flow: when something is worth keeping it proposes a memory or rule and writes it once you confirm. Nothing is saved without your okay.
Review and repair. Pathrule treats rules and skills as reviewable artifacts. The self-audit surfaces stale or conflicting entries as suggestions; your assistant drafts the fix and you approve the change. Pathrule never edits your knowledge on its own.
Sharing. Memberships and per-node overrides are enforced server-side. Onboarding a new teammate is one invite, not a tour of a giant
CLAUDE.md.Privacy. Source code never leaves your disk through Pathrule. See Security.
Frequently asked questions
What does Pathrule add to Claude Code?
A path-scoped knowledge layer that injects team memories, rules and skills into Claude Code at hook time. It runs at PreToolUse and UserPromptSubmit, before the first tool call, so the model gets only the slice of context that matches the current working directory.
Do I have to give up my CLAUDE.md?
No. Pathrule sits above CLAUDE.md. Your existing file keeps working. Pathrule adds the path-routing layer so that team rules do not have to live in one giant file.
Why does Claude Code seem to ignore parts of my CLAUDE.md?
Long instruction files lose signal. As a CLAUDE.md grows past a few hundred lines, the model follows fewer of its rules. Pathrule fixes this by delivering only the rules that apply to the current path, so each instruction the model sees is load-bearing. Long read: Why Claude Code ignores your CLAUDE.md.
How does Pathrule install into Claude Code?
Pathrule writes a hook entry into ~/.claude/settings.json that points at a single, unobfuscated Node.js hook script under ~/.pathrule/bin. The hook emits JSON. Removing the entry removes Pathrule instantly.
Does Pathrule see my source code?
No. Pathrule never reads, scans or uploads your source files. The cloud stores only the typed memories, rules and skills your team writes. Full breakdown on the Security page.