rules
Project instructions automatically injected from CONTEXT, rules, and instruction files.
The rules Skill anchors LazyCodex (LZX) to project-specific instructions. When the OmO (oh-my-openagent) plugin is enabled in Codex, project rules are injected automatically. You do not need to paste them into every session. Codex keeps supported rules and instruction files in context while it works.
One-Line Summary
Codex Rules is automatic. It injects static project instructions at session start and on each prompt, then injects file-specific matching rules after edits. There is no command to run. Turn on the plugin, and the repository conventions follow Codex everywhere.
Injection Targets
- Static project instructions on
SessionStartandUserPromptSubmit. - Matching file-specific rules after Codex
apply_patchby default.
Dynamic PostToolUse output is injected as additional context, and duplicate plugin data is removed per session. Codex Rules does not rewrite tool output. It only adds instructions beside it.
Supported Project Sources
| Source | Notes |
|---|---|
CONTEXT.md | General project context. |
.omo/rules/**/*.md | OmO/LazyCodex rules tree. |
.claude/rules/**/*.md | Claude rules directory. |
.cursor/rules/**/*.md | Cursor rules. |
.github/instructions/**/*.md | GitHub instruction files. |
.github/copilot-instructions.md | Copilot instructions. |
Configuration
Environment variables adjust the behavior.
| Variable | Effect |
|---|---|
CODEX_RULES_DISABLED=1 | Disable the entire Skill. |
CODEX_RULES_MODE=both|static|dynamic|off | Choose static, dynamic, both, or off. |
CODEX_RULES_MAX_RULE_CHARS=<number> | Limit the size of each injected rule. |
CODEX_RULES_MAX_RESULT_CHARS=<number> | Limit injected result context size. |
CODEX_RULES_ENABLED_SOURCES=CONTEXT.md,.omo/rules | Restrict which sources are read. |
Legacy PI_RULES_* variables remain accepted as a fallback for users migrating from pi-rules.
Pairing With $init-deep
$init-deep creates hierarchical project memory. The rules Skill then keeps supported rules and instruction files in front of Codex on every session and prompt. Once the memory exists, rules keeps injecting it.