codex icon indicating copy to clipboard operation
codex copied to clipboard

[Feature Request] .codexignore file

Open jonasry opened this issue 1 year ago • 10 comments

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.

jonasry avatar Apr 17 '25 06:04 jonasry

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.

caleb-harrelson avatar May 21 '25 23:05 caleb-harrelson

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

amrnali avatar Jun 14 '25 15:06 amrnali

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

lostmygithubaccount avatar Jun 16 '25 13:06 lostmygithubaccount

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.

codex-maintainers avatar Aug 07 '25 18:08 codex-maintainers

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

Image

kdawgwilk avatar Mar 03 '26 08:03 kdawgwilk

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.

flawnson avatar Apr 16 '26 14:04 flawnson

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

PaulRBerg avatar Jun 18 '26 13:06 PaulRBerg

When its too much AI slop that you dont even review what issue was being opened and closed. Just keep pushing for code.

face-al avatar Sep 15 '26 10:09 face-al

There's a separate open issue about this feature request, everyone in this thread, please upvote that issue so that it gets more visibility:

https://github.com/openai/codex/issues/24993

PaulRBerg avatar Sep 15 '26 10:09 PaulRBerg

Thanks @PaulRBerg !

face-al avatar Sep 15 '26 11:09 face-al