Support project-scoped custom prompts in `.codex/prompts` (repo root + cwd)

Resolved 💬 5 comments Opened Jan 25, 2026 by vjain419 Closed Jan 25, 2026

Summary

Custom slash prompts are currently only loaded from $CODEX_HOME/prompts. Please also load prompts from project-scoped .codex/prompts directories (repo root and any .codex directories between repo root and CWD), similar to how skills are loaded.

Why this matters

In monorepos and large repos, teams want to share prompts at the project/team level without requiring per-user setup or symlinks. Keeping prompts in the repo makes them versioned, reviewable, and portable across machines/CI.

Current behavior (code pointers)

  • codex-rs/core/src/custom_prompts.rs:
  • default_prompts_dir() returns only $CODEX_HOME/prompts.
  • discover_prompts_in(...) reads a single directory.
  • codex-rs/core/src/codex.rs:
  • list_custom_prompts only calls default_prompts_dir() and then discover_prompts_in(...).
  • There is no project/CWD prompt discovery path.

Proposed behavior

  1. Discover prompts from project-scoped .codex/prompts directories, in order of precedence from CWD → repo root (same traversal as project config layers).
  2. Keep $CODEX_HOME/prompts as a fallback (lowest precedence).
  3. De-duplicate by prompt name with “highest precedence wins”.
  4. Apply the same trust rules used for project layers (i.e., if a .codex dir is untrusted/disabled, consider skipping its prompts or marking them disabled).

Suggested precedence order:

  1. CWD/.codex/prompts
  2. Parent .codex/prompts up to repo root
  3. $CODEX_HOME/prompts

Implementation notes (sketch)

  • Add a prompt-roots helper that mirrors skills::loader::skill_roots_from_layer_stack but returns .codex/prompts directories for project/user layers.
  • In codex::list_custom_prompts, enumerate all roots in precedence order and call discover_prompts_in_excluding(...) (or add a similar helper) to avoid duplicates by name.
  • Add tests to custom_prompts.rs or config/skills tests to cover:
  • Repo root + nested .codex/prompts both present
  • CWD precedence over repo root
  • Fallback to $CODEX_HOME/prompts
  • Trust/untrusted behavior if applicable

View original on GitHub ↗

This issue has 5 comments on GitHub. Read the full discussion on GitHub ↗