Pipe input or attach files to a headless run

headless & scripting

// what it does

opencode run reads piped stdin, so cat error.log | opencode run "explain this error" feeds a file straight in; -f/--file attaches one or more files — including images like screenshots or diagrams — as first-class attachments. Pair either with a prompt describing what to do with the input.

// shell

$ cat error.log | opencode run "explain this error and suggest a fix"
$ opencode run -f diagram.png "implement the flow shown in this diagram"

// resources