# AGENTS.md Examples for Codex: Node.js, Python and Monorepos

Copy practical AGENTS.md patterns for Codex projects, including Node.js apps, Python services, and monorepos with nested package instructions.

## Quick Answer

A good AGENTS.md example gives Codex the repo purpose, allowed edit scope, setup commands, verification commands, generated-file boundaries, secret policy, and review expectations. Start with one root file, then add nested AGENTS.md files only where Node.js, Python, or monorepo packages need different commands.

## Best for

Developers and maintainers writing Codex repository instructions for real projects.

## Use this guide to

Developers want concrete AGENTS.md examples for Codex instead of only a checklist or conceptual comparison.

## Recommended play

1. Start with a root AGENTS.md that covers shared commands, safety, and completion criteria.
2. Add nested AGENTS.md files only for folders with different commands, generated files, or ownership.
3. Keep every example copyable, but replace placeholder commands with commands that pass from a clean checkout.
4. Review examples whenever package managers, CI commands, or repo boundaries change.

## Which AGENTS.md example should you use?

Pick the smallest example that matches the repo shape and risk boundary.

| Area | Use this example | When it fits | What must be explicit |
| --- | --- | --- | --- |
| Root baseline | Every Codex-enabled repository | The repo has one shared install, test, and build flow | Purpose, commands, forbidden files, secrets policy, and review rule |
| Node.js app | Frontend, Next.js, React, API routes, or package scripts drive the work | UI and build commands are easy to confuse | Package manager, route checks, generated folders, and build command |
| Python service | Backend behavior, tests, migrations, or formatting are the main risk | The agent needs a clear test runner and migration rule | pytest command, migration boundary, env policy, and external service limits |
| Nested monorepo file | A folder has different commands or owner review | Root instructions would be too broad or misleading | Local commands, local forbidden paths, and when to escalate |

## Execution steps

1. **Choose the root baseline** — Write the repo purpose, shared commands, safe edit scope, generated folders, secret policy, and completion standard.
2. **Replace placeholders** — Swap npm, pnpm, pytest, build, lint, and browser-check examples for commands that actually pass in the repository.
3. **Add nested files only where needed** — Create folder-level AGENTS.md files when a package has different commands, owners, generated files, or approval rules.
4. **Test the instruction** — Run one small Codex task that depends on the file and confirm the agent used the expected command and respected the boundary.

## Common pitfalls

- **Copying examples without testing commands**: Run the commands once and update the example before asking an agent to follow it.
- **Making nested files too long**: Keep local files focused on what changes in that folder.
- **Turning AGENTS.md into a secrets file**: List environment variable names and approval boundaries, never secret values.

## Implementation checklist

- [ ] Include the repository purpose.
- [ ] List install, test, build, lint, and formatting commands when they exist.
- [ ] Name generated folders and files that should not be edited.
- [ ] State the secret and credential policy.
- [ ] Define the completion standard and expected verification output.
- [ ] Use nested files only when folder-level commands or risks differ.

## FAQ

**Q: What should you do first?**

Start with a root AGENTS.md that covers shared commands, safety, and completion criteria.

**Q: Who is this guide for?**

Developers and maintainers writing Codex repository instructions for real projects.

**Q: What evidence supports this guide?**

This guide uses listed source material from OpenAI, AGENTS.md. Source links and scope notes are available on this page.

## Evidence sources

- [Use AGENTS.md with Codex](https://learn.chatgpt.com/docs/agent-configuration/agents-md) — OpenAI. Official Codex guidance for AGENTS.md scope, precedence, and repository instructions.
- [AGENTS.md repository](https://agents.md/) — AGENTS.md. Community reference for AGENTS.md examples and cross-tool repository guidance.

## Related guides

- [AGENTS.md template for Codex and monorepos](/guides/agents-md-template-for-ai-coding-agents) — The template page gives a compact checklist to pair with these examples.
- [AGENTS.md vs CLAUDE.md comparison](/guides/agents-md-vs-claude-md-cursorrules-copilot-instructions) — Readers should understand which tools read AGENTS.md before standardizing examples.
- [Codex vs Claude Code](/guides/codex-vs-claude-code) — Instruction examples should match the agent workflow the team chooses.
- [loop engineering for AI coding agents](/guides/loop-engineering-ai-coding-agents) — Good AGENTS.md examples name the verification command and stop rule used in agent loops.

---
Canonical: https://www.kyenai.com/guides/agents-md-examples-codex-node-python-monorepos
