Pipe a file or command output into Codex

exec & automation

// what it does

Pipe data into exec and it is appended to your prompt as context — ideal for logs, diffs, or fetched API output. Pass a lone dash as the prompt to read the entire prompt from stdin instead. So cat error.log | codex exec "diagnose this" adds the log as context, while codex exec - reads the whole instruction from stdin.

// shell

$ cat error.log | codex exec "diagnose this stack trace"
$ cat prompt.txt | codex exec -

// gotcha

A trailing - means "read the prompt from stdin," so don't combine a prompt string and a - . Give either an instruction (stdin becomes context) or - alone (stdin becomes the prompt).

// resources