I Accidentally Unlocked Hierarchical AGENTS.md Instructions in Codex

I recently initialised my entire Obsidian vault as a single Git repository, with the Vault itself as the repository root. I did this because I wanted to create a versioning solution for various documents that I have inside of my Vault, without having to create individual documents for each new version. An unexpected benefit is that Codex now loads AGENTS.md instructions hierarchically, starting at the Vault root and working down through the folder structure to whichever project I have open. This lets me maintain Vault-wide instructions once, add more specific rules for groups of projects (for me this is useful because I can now specify client specific instructions sepoerately) and keep individual project instructions focused only on their local requirements. I did not create new Codex functionality, but structuring the Git repository this way unlocked a far more granular instruction system than I realised was available.

Has anyone encountered this before? I stumbled upon it, but I have never heard anyone talk about it before. As far as I am aware, in a normal setup, Codex will only ever load the agents.md file from that project folder root in which you are currently working. Therefore, giving you control only over your system-wide prompt or system-wide custom instructions and your project-specific instructions.

I've included a Markdown document which is part of my AI OS workflow specs if anyone is interested in more detail because I think this is extremely useful for people who have quite complex and large file systems. I did extensive research and testing to come to these conclusions, and I’m pretty certain now that this is how Codex is operating within my current system. It’s great! So I thought I’d share it here.

agent_instruction_hierarchy.md