Pathrule for Codex

AGENTS.md plus scoped team context

Pathrule is the path-scoped knowledge layer above your AGENTS.md. It indexes team memories, rules and skills by path and routes only the slice that matches the current working directory into OpenAI Codex CLI at hook time, before the first tool call.

The AGENTS.md ceiling

Pathrule for Codex is a concrete implementation of the AI coding context layer pattern. AGENTS.md is the open standard now read natively by OpenAI Codex, GitHub Copilot, Cursor, Windsurf, Amp, Warp, Aider, Devin, Gemini CLI and Amazon Q. One file, repository root, ships on every turn. It is great for repository-wide constants.

It is not great for team-scale work. As a team adds rules for the mobile app, the backend, the data pipeline, the frontend and the migrations, that one file grows past the point where the model can follow it. Long instruction files lose signal. The work is path-scoped; one flat file is the wrong shape.

What Pathrule adds to Codex

Hook-time injection

Before the first tool call

Pathrule runs at the hook layer Codex already exposes, before the model picks a tool. The scoped slice is delivered every turn, not only on session start.

Path-indexed graph

Subtree, not whole file

A rule attached to /services/billing only fires when Codex is acting under that path. AGENTS.md keeps the global rules; Pathrule keeps the scoped ones.

Three node types

Memories, rules, skills

Memories carry team-learned context. Rules are advisory or strict. Skills are multi-step playbooks Codex can invoke by name.

Same content, every tool

Claude Code, Cursor, Windsurf

The same memories, rules and skills also work for Claude Code, Cursor and Windsurf through one MCP server. Tool churn no longer resets team knowledge.

What the install actually does

Pathrule does not patch Codex. It turns on Codex's hook support and registers hooks that point at a single unobfuscated Node.js script under ~/.pathrule/bin, so Codex receives the path-scoped context on each prompt and tool call, and a strict rule can block a matching change. You can grep the hook script and your Codex config yourself. Removing the entries removes Pathrule instantly, and the rest of your Codex setup is untouched.

AGENTS.md vs Pathrule

AGENTS.md alonePathrule + Codex
One file. Every turn. Every path.Path-scoped slice. Only what applies to the current directory.
Token cost grows with team size.Token cost stays flat. Relevant rules only.
Editable by anyone with push. No review trail.Reviewable rules and skills with row-level security.
Tied to whichever tools read AGENTS.md natively.Same content drives Codex, Claude Code, Cursor and Windsurf.
Onboarding = "read the 400-line file".Onboarding = "join the workspace; the right rules show up on the right paths".

Long read: AGENTS.md vs Pathrule: when each makes sense.

How Pathrule fits a team running Codex

  • Authoring. Write memories, rules and skills in the web app, desktop or 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 enforced server-side. New teammates do not need to read a 400-line AGENTS.md.

  • Privacy. Source code never leaves your disk through Pathrule. See Security.

Frequently asked questions

What is AGENTS.md?

The open standard instruction file read natively by OpenAI Codex, GitHub Copilot, Cursor, Windsurf, Amp, Warp, Aider, Devin, Gemini CLI and Amazon Q. It lives at the repository root and ships the same content on every turn.

What does Pathrule add to Codex?

A path-scoped layer above AGENTS.md. Pathrule indexes memories, rules and skills by path and injects the matching slice into Codex CLI at hook time, before the first tool call.

Do I have to delete AGENTS.md to use Pathrule?

No. Pathrule sits above AGENTS.md. Your existing file keeps working. AGENTS.md carries the repository-wide constants; Pathrule carries the path-scoped knowledge AGENTS.md cannot model well.

Why does AGENTS.md break down for team-scale work?

AGENTS.md is one file. As a team adds rules for every part of the codebase, the file grows past the point where the model can follow it. Long instruction files lose signal. The work is path-scoped; one flat file is the wrong shape.

How does Pathrule install into Codex?

Pathrule turns on Codex's hook support and registers a hook that points at a single unobfuscated Node.js script under ~/.pathrule/bin. Codex receives the path-scoped context on each prompt and tool call. 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.

Get started with Pathrule.