Module 02 · beginner · 45 min
Memory & AGENTS.md
AGENTS.md is the durable instruction layer for repository work. Codex reads files from the repository root down toward the current working directory, allowing broad rules and more specific nested guidance.
Instruction hierarchy
Place an AGENTS.md at the repository root for team-wide expectations. Add nested AGENTS.md files when a package or service needs more specific rules. Guidance closer to the current directory takes precedence when instructions conflict.
repo/
├── AGENTS.md
├── apps/
│ └── web/
│ └── AGENTS.md
└── packages/What belongs in AGENTS.md
Record verified run, test, lint, and build commands; architecture landmarks; code conventions; safety boundaries; and definition-of-done checks. Keep volatile status in a project context file or issue tracker.
- Commands: Verified setup and checks
- Map: Important files and ownership
- Rules: Conventions and boundaries
Write operational instructions
Use direct, testable language. Prefer “Run npm test after changing parser code” over “Be careful with tests.” Explain unusual constraints and where deeper references live.
# Verification
- Run `npm test` after parser changes.
- Run `npm run lint` before handoff.
- Do not edit generated files under `dist/`.Keep instructions healthy
Remove stale commands, avoid copying chat transcripts, and keep secrets out. Treat AGENTS.md as a maintained interface between the repository and every coding agent that works inside it.
Continue learning
Use the official OpenAI Codex documentation as the final reference for current commands, settings, and availability.