Lifestyle
AGENTS.md scopes and overrides
Trace root and nested instructions, conflicts and overrides, and verify which files were selected.
About 12 min read · Practice 25 min

Practical · Desktop / CLI / VS Code / JetBrains / cloud
Before you start
On this page
Back to the Codex learning hubCodex learning hub: tutorial directoryA planned 60-lesson, ten-unit Codex curriculum, from setup and your first task to MD instructions and advanced integrations. Find your next lesson by experience, platform, goal or command; unpublished entries show their status.Read the full article
Goal and preparation
AGENTS.mdProject instructions with AGENTS.mdAGENTS.md supplies project instructions before Codex starts work. Global guidance and files along the project-root-to-working-directory path form an instruction chain. At the same level, AGENTS.override.md takes precedence. Keep rules concrete and verify what was actually loaded.Read the full article holds work instructions; config.tomlConfigure Codex with config.tomlconfig.toml sets client options, while AGENTS.md describes working instructions. User settings live in Codex home; trusted projects can add .codex/config.toml. CLI overrides, project layers and managed requirements mean a single file does not prove the effective configuration.Read the full article holds application settings with a different precedence mechanism. Observe reply markers and an inherited requirement without changing sandbox permissions or running unknown commands. Being able to quote a file does not prove startup discovery; compare behavior and working directory too.
Understand the discovery order
Global guidance normally lives in the user's .codex directory, or the existing CODEX_HOME location. Project discovery walks from the recognized root to the current directory, not through all sibling folders. Each level checks AGENTS.override.md before AGENTS.md, then configured fallback names, taking at most one file. Deeper guidance overrides conflicting earlier items while compatible requirements remain.
| Situation | Project files selected | Do not assume |
|---|---|---|
| Start at root | Root instructions | Every descendant was loaded |
| Start in ui | Root, then ui | ui can cancel enforced policy |
| Nonempty ui override exists | Root, then ui override | Same-level AGENTS.md also merges |
| Edit rules in an old session | Earlier context may remain | Saving proves a new load |
Step 1: Create an isolated rule lab
Create a new codex-rules-lab with ui and data subfolders, initially without an override. Open it in your editor and verify the terminal location with Get-Location in PowerShell or pwd on macOS/Linux. After confirming this is a new lab, initialize Git below to define its project root. No commit or remote connection is required.
git init
git rev-parse --show-toplevel
Create root AGENTS.md with the complete sample below. ROOT-LAB is an observable reply prefix; KEEP-DATA is a compatible requirement retained across subdirectories. These markers serve the experiment. Real rules should express actual tests, data preservation and delivery requirements.
# Root practice instructions
- Start the final answer with ROOT-LAB.
- Include KEEP-DATA in the final answer.
- Do not change any files for the rule-discovery exercise.
- Report checks that were actually performed separately from unverified claims.
Put the second sample in ui/AGENTS.md and the data note in data/README.md. README is deliberately not an AGENTS file; without an applicable fallback-name configuration, Markdown alone does not make it startup guidance. Check exact capitalization and extensions, including accidental .txt suffixes.
# UI practice instructions
- Start the final answer with UI-LAB instead of ROOT-LAB.
- Include UI-BASE in the final answer.
# Data notes
This folder describes fictional practice data.
DATA-NOTE is a document marker, not a required answer prefix.
Step 2: Start once from each directory
From the lab-root terminal, run the first read-only CLI launch. Inside Codex, send the natural-language prompt below without pasting rules or prescribing a prefix. Expect ROOT-LAB and KEEP-DATA. Use /exit to return to the shell, then start a fresh ui session with the second launch command, rather than resuming the earlier task.
codex --cd . --sandbox read-only
Without changing files, report the current working directory and the project instruction sources already available to this session. Follow the active response-format instructions. Do not search unrelated sibling folders just to collect more rules. Distinguish known loaded instructions from files you have not inspected.
codex --cd ui --sandbox read-only
Send the identical request in ui. Expect UI-LAB, KEEP-DATA and UI-BASE: the nested prefix overrides the root prefix while compatible root instructions remain. If the model can report rules only after being asked to read them manually, distinguish that from startup discovery. A model's self-report is not a loading log; retain uncertainty where evidence is insufficient.
Step 3: Add a same-level override and compare
Exit ui, retain ui/AGENTS.md and add ui/AGENTS.override.md below. From the lab root, relaunch codex --cd ui --sandbox read-only and send the same request. Expect UI-OVERRIDE and KEEP-DATA, without UI-BASE inherited from the replaced same-level file. The override replaces that level's candidate, not every root or global instruction.
# UI override practice
- Start the final answer with UI-OVERRIDE instead of ROOT-LAB.
- Include OVERRIDE-ACTIVE in the final answer.
For a boundary case, back up the override, empty it, save and start fresh, then record the actual discovery. Local diagnostic inputs from codex-cli 0.154.0-alpha.6.2 contain no override body but also do not load same-level AGENTS.md; root instructions remain. Do not rely on an empty file to disable an override. Rename it to override.saved.md, outside the configured fallback list, then start fresh and verify UI-LAB, UI-BASE and KEEP-DATA. Keep global files and the settings directory intact.
Separate discovery from compliance in one record
Fill in the fields for each fresh start: root, UI, override, empty override and renamed restoration. Keep expectations out of the observed-answer field. If diagnostic input contains the UI override but the answer omits OVERRIDE-ACTIVE, discovery is evidenced but response compliance failed. That does not prove a missing file; a model's claim is not diagnostic-input evidence either. Retain only a practice summary of private input that may contain other rules.
Case: [root / UI / override / empty override / renamed restoration]
CLI version and start directory: [actual values]
New session: [yes / no / unverified]
Instruction-file state: [paths, nonempty/empty/renamed]
Expected markers: [prediction]
Instruction-source evidence: [observed input/log / model statement only / unavailable]
Actual answer markers: [observed values / no model run]
Conclusion: [discovery verified? response verified? remaining uncertainty]
Diagnose failures and confirm completion
For missing markers, check actual extensions, nonempty content, Git root and --cd. For stale markers, confirm a fresh launch rather than resume. For one missing requirement, inspect same-level overrides, global preferences and higher-priority environment instructions. A deeper AGENTS.md does not bypass organization policy, tool permissions or user requests. Identify the conflicting source before changing rules you control.
Long guidance may hit the documented 32 KiB default combined limit, measured in bytes rather than characters. Keep essential rules and move long designs/examples into ordinary documents read when needed. Splitting content among sibling directories does not automatically load it all. Fallback names and the limit are settings covered in configurationConfigure Codex with config.tomlconfig.toml sets client options, while AGENTS.md describes working instructions. User settings live in Codex home; trusted projects can add .codex/config.toml. CLI overrides, project layers and managed requirements mean a single file does not prove the effective configuration.Read the full article, with restart verification after changes.
Retain launch directory, file state and observed markers for root, ui, override, empty-override and renamed-override cases. KEEP-DATA should remain, and removing the override should restore ui behavior. Local evidence uses debug prompt-input to inspect actual constructed inputs without a model request or compliance claim. Record documented and version-specific behavior; verify response behavior separately in fresh sessions. Continue with rules and context filesSeparating rules, documentation and contextSeparate working rules, project entry points, design requirements and handoff state. Check outdated hypotheses against actual files and tests.Read the full article to keep AGENTS.md maintainable.
Back to the Codex learning hubCodex learning hub: tutorial directoryA planned 60-lesson, ten-unit Codex curriculum, from setup and your first task to MD instructions and advanced integrations. Find your next lesson by experience, platform, goal or command; unpublished entries show their status.Read the full article
Read the full description
Three numbered stages: identify the starting point, perform the exercise, and verify the result. Original illustration, not a product screenshot.
Lifestyle
Codex learning hub: tutorial directory
A planned 60-lesson, ten-unit Codex curriculum, from setup and your first task to MD instructions and advanced integrations. Find your next lesson by experience, platform, goal or command; unpublished entries show their status.
Lifestyle
Worktrees and isolated tasks
A Git worktree gives one repository multiple working directories on different branches. It isolates file edits, but databases, ports and external services may still be shared. File isolation is not full resource isolation.
Lifestyle
Workshop: build a small website
Plan and build the Small Steps task website from brief.md, with adding, completing, deleting, filtering and local persistence. Separate HTML, CSS, data functions, UI events and tests, verify with Node and browser checks, and document restart and recovery steps.
Lifestyle
Usage and efficiency: reducing rework
Record task conditions, model options, time and outcomes to reduce unnecessary retries and excess context.
Articles that cite this one
Latest travel guides

GuideTokyo
Where to Stay in Tokyo: Comparing Shinjuku, Ueno, Tokyo Station, Shibuya, Asakusa, Ikebukuro, and Ginza, Plus Airport Access, Accommodation Tax, and Luggage Delivery
Where should you stay in Tokyo? Compare Shinjuku, Ueno, Tokyo Station, Shibuya, Asakusa, Ikebukuro, and Ginza by the same criteria: access from Narita and Haneda, transit routes, nearby attractions, neighborhood character, and who each area suits. Includes a comparison table, a Yamanote Line diagram, Tokyo’s accommodation tax as verified in 2026/9 (changing to 3% in 2027/4), and Airport TA-Q-BIN luggage shipping rules.
- Budget
- Hotels

GuideTokyo
How to Choose Tokyo Transit Passes: Are Suica, Welcome Suica, the Tokyo Subway Ticket, and the JR Pass Worth It?
On a first Tokyo trip, start with an IC card and pay per ride (Welcome Suica has no deposit and is valid for 28 days). If you take four or more subway rides in a day, add a 72-hour Tokyo Subway Ticket for 2,000 yen; a JR Pass is never worthwhile if you stay in Tokyo and do not go to Kansai. See what TOURIST PASMO, Suica on iPhone, and the Tokyo Metro day pass do and do not cover, with a decision chart. Prices verified in September 2026.
- Transport
- Budget

GuideTokyo
Tokyo Disneyland and DisneySea Guide: Ticket Prices, Fantasy Springs, Disney Premier Access (DPA), Standby Pass, and Which Park to Choose for Your First Visit
Tokyo Disney one-day Passport prices vary: most weekdays in 9/2026 cost ¥9,900 and weekends ¥10,900. At 14:00 daily, tickets go on sale for the same date two months later. Free Priority Pass is no longer on the official service list; only paid Disney Premier Access (¥1,000–3,500 per person per use) shortens waits. Covers hours, the 25th anniversary, Standby Pass, Entry Request, Fantasy Springs access and first-visit park choice; checked on the official site in 9/2026.
- Itineraries
- Family
Sources
- Custom instructions with AGENTS.md · Checked:
- CLI commands · Checked: