Per-project config
What feature would you like to see?
Currently, all config goes in ~/.codex/config.toml. This is problematic for a few reasons:
- It is not possible to set project-specific config that is automatically picked up; you must set a (globally accessible) profile and then start codex with that profile, or else type out a long command using
--configwith the same arguments each time. - It is not possible to share project-specific config with collaborators via VCS (possibly useful for sharing model providers and config).
- Project-specific config such as
[projects."/path/to/project"] trust_level = truehave to live at a global level, which makes using VCS to sync one's globalconfig.tomlacross machines problematic.
It would be better if, like with Claude Code, you could have a per-project .codex folder and within that, config.toml and config.local.toml, the former of which lives in VCS and the latter of which is in .gitignore and used just for oneself (this is where you can configure personal preferences like verbosity, reasoning level, etc). This way you could launch codex within a directory and be all set up with your preferences without having to specify a profile every time, and without having to write your profile in your global config. Also, truly project-specific settings such as trust_level would live there instead of globally. (For security, trust_level should probably only valid within config.local.toml so that a sneaky collaborator can't trick you intro trusting a folder by pushing a commit.)
Are you interested in implementing this feature?
Sure
Additional information
_No response_
6 Comments
@rben01 we hear you on this!
Certainly sharing
config.tomlfiles with a team via source control is a compelling feature, but as you touched on, there are safety concerns, such as someone pushing a malicious commit toconfig.tomlor Codex itself modifyingconfig.tomlin a way that gives it escalated privileges on a subsequent invocation. We need to think through how we want to mitigate these risks before committing to a solution.Though if you personally want to take on this risk today, one thing you could do is put a shared
config.tomlin some other folder and then add a wrapper script that runscodexwithCODEX_HOMEset to the folder containing the sharedconfig.toml. It's admittedly not as clean as a first-party solution, but perhaps it can unblock you for now?For now I think that that idea will work. However, in theory I would also like project-specific config to merge with and override global config, effectively having a hierarchy of config files.
I also think it would be an improvement even just to have trust settings live in a different file in
~/.codexinstead of~/.codex/config.toml, again just to make the global config easier to use with VCS. This would also fix the issue with security and project-specific config.toml — trust settings just wouldn't exist in a project-specific file. (Other settings like sandboxing would still present a problem.)https://github.com/openai/codex/issues/2628#issuecomment-3301944076
This is a good workaround until Codex adds official support for per-project
config.tomlI implemented project-local configuration support for .codex. Now, the system first checks if a .codex directory exists in the current project folder and uses it as the configuration home. If not found, it falls back to the global CODEX_HOME environment variable or ~/.codex.
With this change:
Each project can have its own .codex/config.toml, .codex/auth.json, and other configuration files, isolating project settings from global settings.
Existing workflows remain compatible, as the global config is used when a project-local .codex folder does not exist.
Documentation has been updated to reflect this new behavior.
This addresses the request for project-specific configuration in Issue #3120. You can review the changes in PR #4007
Note: Adding .codex files to .gitignore is the developer's responsibility.
Thanks for the feature request. I think this is captured in https://github.com/openai/codex/issues/2554, so I'm going to close this one and consolidate.
i have same problem =(