Skip to content

Allow shell command pass through (eg. with ! prefix) #2866

Closed

Description

@0xdevalias

What feature would you like to see?

Sometimes I find it would be useful to be able to execute a shell command directly, without needing to switch out of codex, or have a separate terminal tab running, etc.

For example, most recently I wanted to run a simple ls in the current directory to get some context before writing my prompt in codex.

Currently I can ask codex to run the command, and it will, but it feels like a waste of tokens and kind of slow when I already know exactly what I want to run:

user
ls

codex
Listing the repo directory contents to see what’s available.

>_
  ✓ 📂 ls -la

codex
Here’s what I see:

- foo.json
- AGENTS.md

Want me to validate and pretty-print foo.json next?

user
!ls

codex
Running ls again to confirm the current contents.

>_
  ✓ 📂 ls -la

codex
Contents unchanged:

- foo.json
- AGENTS.md

Next step: validate the JSON with jq -e . foo.json?

It would be nice if I was able to prefix a command with ! and have the pass through directly to the underlying shell; and I guess in a roundabout way making that context available within the agent session as well.

I haven't thought too deeply about whether it would be more useful for the agent to automatically try to respond to that input, directly (eg. suggesting something to do based on it), or if it would just 'exist' in its context for future prompts/etc.

Are you interested in implementing this feature?

Unfortunately I don't have the capacity to currently, nor the familiarity with rust.

Additional information

N/A

Activity

  1. added
    enhancement
    on Aug 29, 2025
  2. michalkos commented on Aug 29, 2025

    @michalkos
  3. etraut-openai commented on Nov 27, 2025

    @etraut-openai
    Contributor

    This feature has been implemented in recent versions of the Codex CLI.

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

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions