No. 135 Instruction files

Repository expectations

Use when later sessions should inherit a written instruction

  • Claude Code
  • Codex
  • Cursor
  • Instruction files

Prompt

# AGENTS.md

## Repository expectations

- Run `npm run lint` before opening a pull request.
- Document public utilities in `docs/` when you change behavior.

When to use

“Repository expectations” fits when later sessions should inherit a written instruction, because it says “AGENTS.md”, and it is written to stay in force on later turns rather than to finish one task.

With “Repository expectations” loaded, the user message can be as small as “fix the empty-cart total in src/cart.js and do not touch the test runner”, because “AGENTS.md” is already in force.

When not to use

Leave “Repository expectations” unused when you are fixing one bug tonight and you do not want tomorrow's session to inherit the words, because “AGENTS.md” points the other way

How to run it

Claude Code

Claude Code loads “Repository expectations” from .claude/rules on later sessions, so “AGENTS.md” survives a new chat, which a one-off paste does not.

Codex

Codex keeps “Repository expectations” only if you put “AGENTS.md” in AGENTS.md, or in AGENTS.override.md beside the directory that should inherit it. A paste that is not saved is gone next thread.

Cursor

Cursor keeps “Repository expectations” by saving “AGENTS.md” as .cursor/rules. The chat transcript alone will not reload it tomorrow.

Comparison

对比待补

This before-and-after was not run on this machine.

Related

来源:OpenAI · https://developers.openai.com/codex/guides/agents-md · 2026-12-01