You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Allow shell command pass through (eg. with ! prefix) #2866
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.
Activity
michalkos commentedon Aug 29, 2025
#2471
etraut-openai commentedon Nov 27, 2025
This feature has been implemented in recent versions of the Codex CLI.