---
name: Codex Rules
slug: codex-rules
category: AI Engineering
description: Codex Rules injects static project instructions and file-specific rules into Codex sessions automatically. Use it to configure supported rule file locations, matching behavior, and environment variables for Codex.
github: "https://github.com/code-yeongyu/lazycodex/tree/main/plugins/omo/skills/rules"
language: TypeScript
stars: 3246
forks: 201
install: "npx degit https://github.com/code-yeongyu/lazycodex/tree/main/plugins/omo/skills/rules ~/.claude/skills/rules"
installs_to: ~/.claude/skills/rules
source_path: plugins/omo/skills/rules/SKILL.md
collection_size: 25
category_size: 2451
collection_url: "https://dirskills.com/collections/code-yeongyu/lazycodex"
added: 2026-08-17T07:08:46.783Z
last_synced: 2026-08-17T07:08:46.783Z
canonical_url: "https://dirskills.com/skills/codex-rules"
---

# Codex Rules

Codex Rules injects static project instructions and file-specific rules into Codex sessions automatically. Use it to configure supported rule file locations, matching behavior, and environment variables for Codex.

**Install:**

```bash
npx degit https://github.com/code-yeongyu/lazycodex/tree/main/plugins/omo/skills/rules ~/.claude/skills/rules
```

## README

# Codex Rules

Codex Rules is automatic once the plugin is enabled. It injects:

- static project instructions on `SessionStart` and `UserPromptSubmit`
- matching file-specific rules after Codex `apply_patch` by default

Dynamic `PostToolUse` output is injected as additional context and is deduplicated per plugin data session. Codex Rules does not rewrite tool output.

Supported project sources:

- `CONTEXT.md`
- `.omo/rules/**/*.md`
- `.claude/rules/**/*.md`
- `.cursor/rules/**/*.md`
- `.github/instructions/**/*.md`
- `.github/copilot-instructions.md`

Supported environment knobs:

- `CODEX_RULES_DISABLED=1`
- `CODEX_RULES_MODE=both|static|dynamic|off`
- `CODEX_RULES_MAX_RULE_CHARS=<number>`
- `CODEX_RULES_MAX_RESULT_CHARS=<number>`
- `CODEX_RULES_ENABLED_SOURCES=CONTEXT.md,.omo/rules`

The legacy `PI_RULES_*` variables are accepted as fallbacks for users migrating from `pi-rules`.
