| Level | File | Purpose |
|---|---|---|
| 0 | ~/AGENTS.md (global) |
Global project map — Codex reads it on every session |
| 1 | <project-root>/AGENTS.md |
Per-project context — overrides/extends global on project-specific runs |
| 1.5 | <project-root>/graphify-out/GRAPH_REPORT.md |
Optional — Graphify graph |
| Hooks | <project-root>/.codex/hooks.json |
Optional — pre-tool hooks |
cp templates/level-0.md.template ~/AGENTS.md
# edit ~/AGENTS.md to add your real projects and serversCodex looks for AGENTS.md first in the current working directory, then in $HOME. The global one acts as your Level 0.
cd ~/projects/your-project-a
cp /path/to/ai-context-hierarchy/templates/level-1.md.template AGENTS.mdWhen Codex is invoked from inside the project, it merges both files: the local AGENTS.md takes precedence on conflicts.
pip install graphifyy
cd ~/projects/your-project-a
graphify .
graphify codex install # writes .codex/hooks.json with a BeforeTool hook
# that nudges the agent to read GRAPH_REPORT.md
# before grep/glob callscodex
> List my projectsCodex should answer from ~/AGENTS.md without filesystem search. If it does not, check codex --debug to see whether AGENTS.md was discovered.
graphify codex uninstall
rm <project>/AGENTS.md
rm ~/AGENTS.md