Repository navigation
Custom /prompts - #2696
Custom /prompts#2696
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR implements custom prompts functionality that allows users to save frequently used prompts as Markdown files in ~/.codex/prompts/ and access them through the TUI slash command interface.
- Adds discovery and loading of custom prompts from the filesystem
- Integrates custom prompts into the TUI slash command popup alongside built-in commands
- Automatically submits prompt content when selected, excluding prompts that collide with built-in command names
Reviewed Changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
codex-rs/protocol/src/custom_prompts.rs |
Defines CustomPrompt struct for representing custom prompts |
codex-rs/protocol/src/protocol.rs |
Adds ListCustomPrompts operation and response event types |
codex-rs/core/src/custom_prompts.rs |
Implements prompt file discovery logic with exclusion support |
codex-rs/core/src/codex.rs |
Handles ListCustomPrompts operation by discovering and returning prompts |
codex-rs/tui/src/bottom_pane/command_popup.rs |
Extends popup to display both built-in commands and custom prompts |
codex-rs/tui/src/bottom_pane/chat_composer.rs |
Handles selection of custom prompts and submission of their content |
codex-rs/tui/src/chatwidget.rs |
Requests custom prompts on session start and forwards to UI |
codex-rs/README.md |
Documents custom prompts feature and usage instructions |
Comments suppressed due to low confidence (1)
codex-rs/tui/src/bottom_pane/command_popup.rs:1
- The cursor positioning logic on line 396 is moved outside the match statement but only applies when the textarea text is set inside the match branches. This could lead to unexpected cursor behavior when the textarea is already non-empty but no text was set. Move the cursor positioning inside each match branch after setting the text.
use ratatui::buffer::Buffer;
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
|
Summary
Testing
|
|
Summary Review
Follow-up (outside this PR scope)
|
|
some tests are now failing because of a different PR merged before this, hold on a sec while I fix |
| name: format!("/{}", self.prompts[i].name), | ||
| match_indices: indices.map(|v| v.into_iter().map(|i| i + 1).collect()), | ||
| is_current: false, | ||
| description: Some("send saved prompt".to_string()), |
There was a problem hiding this comment.
Why don't we take the first line of the prompt?
There was a problem hiding this comment.
I think that might look weird if a prompt has just one word in the first line. The "send saved prompt" at least tells the user what happens if they hit enter. But either way works, lmk which you'd prefer!
There was a problem hiding this comment.
We can try it this way and change it if it doesn't feel right, I guess.
|
@codex do a deep review |
There was a problem hiding this comment.
Codex Review: Here are some suggestions.
Reply with @codex fix comments to fix any unresolved comments.
About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you open a pull request for review, mark a draft as ready, or comment "@codex review". If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex fix this CI failure" or "@codex address that feedback".
| name: format!("/{}", self.prompts[i].name), | ||
| match_indices: indices.map(|v| v.into_iter().map(|i| i + 1).collect()), | ||
| is_current: false, | ||
| description: Some("send saved prompt".to_string()), |
There was a problem hiding this comment.
We can try it this way and change it if it doesn't feel right, I guess.
Adds custom
/promptsto~/.codex/prompts/<command>.md.Details:
Op::ListCustomPromptsto core.ListCustomPromptsResponsewith list ofCustomPrompt(name, content).