Skip to content

Support Slash Commands in codex exec Mode #3641

Open

Description

@jtele2

What feature would you like to see?

Slash commands do not work in exec mode (or do not work in the way users expect).

For example, say I have a custom COMMIT slash command. In Claude Code, I'm able to run the equivalent of this easily: codex e "/COMMIT" - and it will run my slash command. Codex CLI does not seem to parse that as a slash command (and inject my prompt), but rather just interpret the raw text.


Proposal

Enable alias-slash commands (or a subset thereof) within the codex exec / codex e mode. That is, allow the user to prefix the prompt or combine slash commands with the prompt so that non-interactive runs can:

  • Adjust or set the approval mode (e.g. --auto-edit, --full-auto), OR via slash command semantics
  • Inspect status (e.g. /status)
  • Possibly change model or reasoning level (via /model)
  • Apply other interactive commands that should logically function even without full TUI
Examples
codex exec "/mode full-auto; fix the CI failure" (builtin)
codex exec "/approvals suggest; lint and format code" (builtin)
codex e "/status; run all tests" (builtin)
codex e "/COMMIT" (custom)

Motivation

  • Make codex exec mode more powerful and flexible without needing to drop into interactive mode.
  • Enable scripting or automation workflows that depend on triggering different contexts (mode, permissions, model) in a single command.
  • Reduce friction for users who know what they want and don't need interactive prompts.

Are you interested in implementing this feature?

No response

Additional information

No response

Activity

  1. added
    enhancement
    on Sep 15, 2025
  2. changed the title [-]Feature Request: Support Slash Commands in `codex exec` Mode[/-] [+]Support Slash Commands in `codex exec` Mode[/+] on Nov 13, 2025
  3. added
    exec
    on Nov 16, 2025
  4. added a commit that references this issue on Apr 11, 2026
    aa5e244
  5. HomyeeKing commented on Apr 11, 2026

    @HomyeeKing

    Hi @ae-openai and team,

    I'd like to share a concrete use case for this feature that would significantly improve automation workflows.

    Use Case: Programmatic Triggering

    Currently, when using codex exec in scripts or CI/CD pipelines, we have to choose between:

    1. Interactive mode - manually set mode/model each time
    2. CLI flags - verbose and hard to remember (--full-auto --model gpt-4)

    Example: Git Hook Integration

    #!/bin/bash
    # pre-commit hook
    
    # Current approach - verbose and error-prone
    codex exec --full-auto --model gpt-4 "review staged changes"
    
    # Proposed approach - clean and intuitive
    codex exec "/mode full-auto /model gpt-4 review staged changes"

    Example: CI/CD Pipeline

    # .github/workflows/codex.yml
    - name: Auto-fix linting issues
      run: codex exec "/mode suggest fix eslint warnings in src/"

    Example: IDE Integration

    IDEs could generate commands like:

    codex exec "/reasoning high explain this function" << 'EOF'
    def complex_algorithm(data):
        ...
    EOF

    Benefits

    1. Single string - easier to pass around in scripts
    2. Self-documenting - the command shows intent clearly
    3. Composability - can chain with other shell features
    4. Familiar - matches interactive mode experience

    Would love to hear thoughts on prioritizing this for the exec mode. Happy to help with implementation details or testing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementexec

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions