Add ability to add custom commands / tasks
Resolved 💬 3 comments Opened May 13, 2025 by homoky Closed Sep 3, 2025
💡 Likely answer: A maintainer (dedrisian-oai, contributor)
responded on this thread — see the highlighted reply below.
List in JSON config list of files that could be run via / slash command:
example: /create-commit-message
3 Comments
Hello @seratch @aibrahim-oai @nornagon-openai,
If possible, I would like to propose my solution for this feature request. As per "Contributing" section of README.me, here's the general overview of the proposal, but as I needed such solution privately, I already have it working quite decently:
What's New
Core Infrastructure (
codex-rs/core/src/custom_commands/)mod.rs- Main module with data structures (CustomCommand,CommandArgument,Commandtrait)loader.rs- File discovery, parsing pipeline, caching, and command managementparser.rs- YAML frontmatter extraction and markdown content parsingtemplate.rs- Handlebars-powered template processing with system variablesvalidator.rs- Security validation (path traversal prevention, input sanitization)registry.rs- Unified registry merging built-in and custom commandsTUI Integration (
codex-rs/tui/src/custom_commands/)executor.rs- Command execution logic and async processingmod.rs- Module exports and feature gatingDependencies
handlebars,serde_yaml,notifyas optional dependencies behindcustom-commandsfeature flagWhat's Modified
codex-rs/tui/src/slash_command.rsCustom(String)variant toSlashCommandenumCommandCreate,CommandEdit, etc.)is_custom()method for type checkingcodex-rs/tui/src/bottom_pane/command_popup.rsupdate_with_custom_commands()method to merge command listscodex-rs/tui/src/app.rsCommandExecutorinitialization with registry setupDispatchCommandhandlercodex-rs/core/Cargo.tomlcustom-commandsfeature flag with optional dependenciesKey Features
Command Definition Format
Security Measures
{{exec}},{{system}}, etc.).mdonly)Performance Optimizations
User Experience
/popup with "(user)" indicator/command-list,/command-reload, etc.)Testing Coverage
Backward Compatibility
@seratch @aibrahim-oai @nornagon-openai With the recent pull request at https://github.com/openai/codex/pull/2453 I believe my proposal is no longer needed.
This has been released! https://github.com/openai/codex/pull/2696