Rules / Instructions
Per-repo conventions, learned once.
What's a rule?
A rule is text that gets injected into every chat in a workspace. Use it for things the model should always know about your codebase.
Where they live
.codexax/rules.md— single rule file.codexax/rules/*.md— multiple files, all loaded- Front-matter
globfield scopes rules to specific paths
Example
---
glob: ["src/**/*.tsx"]
---
# React conventions
- Use function components with hooks. No class components.
- Prefer composition over prop drilling. Reach for Context after 3 levels.
- Co-locate styles in the same file via styled-jsx.
- Tests live next to the file: foo.tsx → foo.test.tsx.Personal vs team
- Repo rules (committed) — apply to everyone working on the project.
- User rules (
~/.codexax/rules.md) — apply to all your projects, not shared.
What rules are good for
- "Always use early returns, never deep nesting."
- "This codebase uses pnpm, not npm."
- "Errors propagate via Result<T, E>, never thrown."
- "DB queries go through the repository layer, never raw SQL in routes."
What they're bad for: anything you'd put in a README. The model can read your README; it doesn't need rules to repeat it.