codex icon indicating copy to clipboard operation
codex copied to clipboard

Look for custom prompts in {project root}/.codex/prompts/ first

Open alexeyv opened this issue 4 months ago • 13 comments

What feature would you like to see?

People are using development tools (such as Codex CLI) to work on multiple projects. Some of us have project-specific custom prompts, and even SHARED custom prompts, version controlled in project repos. Both are great reasons why global ~/.codex/prompts/ is not good enough.

Yes, I can do CODEX_HOME=pwd/.codex/ every time I switch to another project or worktree, that is (a) a rather silly hoop to jump through, but more importantly (b) I now have all the stuff that SHOULD live in ~/.codex split between multiple locations. Yuck!

Proposal: search for /custom-prompt should look for {project root}/.codex/prompts/custom-prompt.md first, then go to $CODEX_HOME or ~/.codex

Additional information

No response

alexeyv avatar Oct 04 '25 15:10 alexeyv

May this help you in meanwhile : https://github.com/openai/codex/issues/4715#issuecomment-3368447587

Hotion13 avatar Oct 04 '25 19:10 Hotion13

Running into same problem. Codex should support multiple places to looking for prompts. There should be a system wide codex config as well as project specific. Overriding system wide doesn't work since that's where auth setting are stored

sehz avatar Oct 09 '25 19:10 sehz

Oh, and one more think. With my little linux envrc trick, or my python package custom prompts works for codex-cli, it's still broken in codex ide (vscode extension) ! I dont even understand how this extension is meant to be used effectively !

Hotion13 avatar Oct 09 '25 22:10 Hotion13

This feature will be important later was we will want to use custom prompts when we run tasks in the cloud. If they are in the projects .codex directory, then the prompts directory can live in the repo and the cloud tasks can have access to the prompts.

tlester avatar Oct 12 '25 00:10 tlester

That would be must have to not being forced using agent locally, with customs prompts and same feature than CLI and vscode extension !

Hotion13 avatar Oct 12 '25 09:10 Hotion13

can't see how this is not implemented from the beginning. I totally second the request to have a project based folder for prompts (and config as well)

Helmi avatar Oct 16 '25 09:10 Helmi

can't see how this is not implemented from the beginning. I totally second the request to have a project based folder for prompts (and config as well)

Have you tried my little project ? If this might help you: https://github.com/Hotion13/cx-prompts It'll hardlink your custom prompts to your user home codex folder.

Tell me if it's work for you too. I'll delete it when this will be implemented by codex....

Hotion13 avatar Oct 16 '25 10:10 Hotion13

Thanks for your work and for pointing it out. I might try this later.

Helmi avatar Oct 16 '25 13:10 Helmi

The feature is really needed because using the spec-kit on codex is too painful.

xiaowangzhixiao avatar Oct 27 '25 15:10 xiaowangzhixiao

This is related to #3706

etraut-openai avatar Nov 14 '25 06:11 etraut-openai

I found a temporary workaround for project-specific prompts that may help others until native support is available.

In my project root, I created an executable script at: .codex/bin/test-coverage.sh with the following content:

#!/bin/bash

codex [YOUR_CODEX_OPTIONS] ".codex/instructions/default.agent.md .codex/prompts/test-coverage.md Focus only on analyzing the existing code for test coverage needs. Do not generate any unit tests yet—wait for my next instruction."

Then I simply run: .codex/bin/test-coverage.sh

This initializes the agent with prompts scoped to the project.

It’s not ideal, since you need to exit and restart another agent when switching tasks (or run multiple Codex sessions and swap between them), but it works reliably for now.

Native project-level prompt loading would make this much smoother, especially when versioning prompts within the repository.

vpominchuk avatar Nov 22 '25 18:11 vpominchuk

Are there any plans to add this to one of the upcoming releases ? 😔

JulianPinzaru avatar Dec 03 '25 08:12 JulianPinzaru

Please add local .codex folder support

cogscides avatar Dec 11 '25 20:12 cogscides