Skip to content
Pathrule

rules

Not a suggestion.
A rule that holds.

Rules and constraints for AI coding agents. Each one carries a scope, a priority and an enforcement level, so a requirement never arrives at the weight of a preference.

one rule, three settings/services/billing

Money is stored as integers in cents.

scope
priority
enforcement
where
Only under /services/billing
how strongly
Always sent when in scope
on a violation
A matching edit is denied before it lands

Scoping is solved. Rank is not.

CLAUDE.mdevery line, one weight
  • A security rule reads like a style tip
  • Weighed differently on turn forty
  • Describes a mistake, cannot refuse it
  • No trail for the rule itself
pathrule3 rules for this file
  • Never ship the service keyhigh, strict
  • Money is integer centshigh
  • Prefer named exportslow
  • services/billing/checkout.ts
  • Each rule carries its rank
  • Fires only where it applies
  • A strict rule can refuse the edit
  • Versioned and reviewable

Instruction files can point a rule at a folder now. Anthropic's own docs still call them "context, not enforced configuration", and point to hooks for anything that must hold.

High priority is a budget.

Example workspace, one prompt

Everything high

high, always sent
96
medium, when relevant
0
low, when there is room
0

Mostly medium

high, always sent
5
medium, when relevant
28
low, when there is room
16

If half the rules are high priority, none of them are. Default to medium, and promote a rule only when you can name the incident a violation causes.

Where a strict rule can block.

On Claude Code, the edit is blocked.

why pathrule setup registers the Pathrule hook, which checks the edit before it runs.

It depends on the client, not the rule. Where the Pathrule hook runs before a write, a strict rule with an approved block pattern stops a matching edit and names itself as the reason.

Is it a rule at all?

  1. Does the answer start with "it depends"?The agent should weigh it against the situation.Write a memory
  2. Is it a sequence someone keeps repeating?The order matters more than any single step.Write a skill
  3. Non-negotiable?Give it a scope, a priority and an enforcement level.It is a rule

Writing a preference as a rule spends the credibility of every other rule you have.

Questions.

What is an AI agent rule?

A constraint an AI coding agent must follow inside a defined scope. A rule carries a scope type (folder, file_type or project), a priority (high, medium or low) and an enforcement level (advisory or strict), which together decide where it applies, how strongly it surfaces and what happens when something violates it.

What is the difference between a rule and a memory?

A memory says what is true here and the agent weighs it against the situation. A rule says what must not happen and is not up for negotiation. If the honest answer is "it depends, the agent should think about it", write a memory instead: writing it as a rule spends the credibility of every other rule you have.

Why does my AI agent ignore its rules?

Usually because the rule competes with unrelated guidance in a long instruction file, because its scope is wrong so it never fires on the paths where it matters, or because it is written as a preference and is therefore correctly weighed away. Long reads: why Cursor rules get silently ignored and why Claude Code ignores your CLAUDE.md.

Can a rule actually block a change, or only advise?

Both are available, and it depends on the client. A strict rule with an approved block pattern is checked by the local Pathrule hook, which denies a matching edit before it lands and surfaces the rule as the reason. Pathrule CLI and the VS Code extension register that hook for Claude Code, and for Codex when the repository has Codex files. Cursor, GitHub Copilot, Windsurf and Remote MCP receive rules as context with no pre-write check.

How many rules should be high priority?

Few. High priority means always injected when the scope matches, so it is a budget: if half your rules are high priority, none of them are. Reserve it for violations that cause bugs, security regressions or compliance problems, and default everything else to medium.

How is this different from Cursor Rules or CLAUDE.md?

Cursor rules and Claude Code rules can be path-scoped, and both products expose hooks. Pathrule stores each rule with scope, priority and enforcement in one workspace source, selects it for the task, and sends it to Claude Code, Codex, Cursor, GitHub Copilot and Windsurf. Side by side: Pathrule vs Cursor Rules and Pathrule vs instruction files.

Do I have to delete my existing rule files?

No. Pathrule sits above them. CLAUDE.md, AGENTS.md and .cursorrules keep doing what they are good at, which is repository-wide constants. Pathrule carries the path-scoped constraints those files cannot model well.

Can the same rule apply to more than one path?

Yes. Rules are reusable: one rule object can be attached to several nodes, so a shared constraint is written and reviewed once rather than copied per directory. Writing rules covers the authoring detail.

Write the rule once.
Every agent keeps it.