[Feature Request] .codexignore file

Resolved 💬 7 comments Opened Apr 17, 2025 by jonasry Closed Aug 7, 2025
💡 Likely answer: A maintainer (lostmygithubaccount, contributor) responded on this thread — see the highlighted reply below.

Add support for removing files and path from codex.

Intended use is to prevent files that contain sensitive data from being sent to the AI model. For example test files with sensitive input data for testing.

The .codexignore file is similar to a .gitignore file and contains paths that aren't read/updated by the AI.

View original on GitHub ↗

7 Comments

caleb-harrelson · 1 year ago

Also useful for ignoring things like dependency lock files. My pdm.lock is adding ~10k tokens to the context that aren't relevant to codex but I don't want it in .gitignore either.

amrnali · 1 year ago

Not sure if this can be solved by setting this as an instruction in AGENTS.md. If smn can confirm.

lostmygithubaccount contributor · 1 year ago
Not sure if this can be solved by setting this as an instruction in AGENTS.md. If smn can confirm.

deterministic solutions are always preferable

codex-maintainers · 11 months ago

Thank you for the feedback! Please try the latest version of Codex CLI to see if this feature is supported. If not, we encourage you to contribute to the codex-rs/ implementation. More details on our project update can be found here.

kdawgwilk · 4 months ago

I have worktree directories showing up the @ file dropdown that should be ignored but i don't see a way to add those to not show up in the list

<img width="624" height="143" alt="Image" src="https://github.com/user-attachments/assets/7935a58a-6648-4fd2-997c-6ca2c7d9a545" />

flawnson · 3 months ago

Jetbrains IDEs have support for .aiignore files. You can create one in root dir of your project and use codex through their chat plugin and the model should respect the file. I've added all env varibles, .pem files, secrets, etc. in and it seems to work right now.

Would be great to see codex adopt this standard.

The fact that codex supports llms.txt but refuses to implement support for an .aiignore is just silly.

PaulRBerg · 1 month ago

Why has this issue been closed as completed? It doesn't seem like this feature is supported.