# Rules

> Use when the user asks about Codex Rules behavior, injected project rules, supported rule file locations, matching, or environment configuration.

- Skill: `code-yeongyu/rules-2` (Agent Skill)
- Install (CLI): `npx get-skill add code-yeongyu/rules-2`
- Raw SKILL.md: https://api.skillmd.com/api/skills/code-yeongyu/rules-2/raw
- Safety review: pending (external: skill-scanner PASS, skillspector PASS)
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: code-yeongyu (https://skillmd.com/u/code-yeongyu)
- Updated: 2026-09-21
- Page: https://skillmd.com/skills/code-yeongyu/rules-2

---


# 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:

- `AGENTS.md`
- `CLAUDE.md`
- `CONTEXT.md`
- `.sisyphus/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=AGENTS.md,.sisyphus/rules`

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

