フィールドガイド / 15 分
AGENTS.md で repository knowledge を永続化する
Global preferences、team rules、directory instructions を layer する。
Codex は作業前に global guidance と、trusted project では repo root から cwd までの project files を結合します。近い guidance が後で override し、各 level では AGENTS.override.md が優先。combined project guidance には default size limit があります。
CLI
検証済みターミナル手順
- ›
/init - $
codex --ask-for-approval never "Summarize the current instructions." - $
codex -C services/payments --ask-for-approval never "List the instruction sources you loaded."
A
作業原則
Scope の近くへ
Repo-wide は root、service-specific は service 近く。
Recurring friction を encode
繰り返す mistake/review feedback だけ追加。
Discovery を verify
Target cwd から loaded sources を列挙させます。
B
フィールド手順
- 01
Scaffold を生成
/init 後に generic prose を real commands へ。
- 02
Root contract
layout、build、tests、lint、boundary、done。
- 03
Narrow overrides
本当に behavior が違う場所だけ。
- 04
Chain を小さく
default 32 KiB。詳細は docs へ link。
- 05
Multiple dirs で test
root と specialized subtree で sources 確認。
PASS / FAIL
受入チェック
- Commands が current。
- Constraint が正しい closest scope。
- Sources を検証。
- Secrets がない。
WATCH / REJECT
失敗パターン
- AGENTS を security enforcement と誤解。
- Commands なしの抽象 values。
- Override shadow を忘れる。
- Untrusted project でも project AGENTS.md が読まれると期待する(untrusted project は project-level instructions を提供しません)。