Streaming Flags
Stream output in real-time - Display AI responses as they’re generatedWhat it does:Shebang:
- Enables real-time streaming output
- Shows AI response as it’s being generated (word by word)
- Status messages go to stderr, clean output to stdout
- Automatically adds
--output-format stream-json --verbose
jqmust be installed:brew install jq
- Long-running scripts where you want progress
- Scripts that generate reports (output to file, narration to console)
- Debugging and monitoring
Suppress status messages - Clean output only (perfect for CI/CD)Short form:
-qWhat it does:- Disables
--livestatus narration - Suppresses “Using: …” and “Model: …” messages
- Only shows AI response (clean stdout)
- Perfect for piping and file redirection
- CI/CD pipelines
- Script output that feeds into other tools
- File generation without noise
Input Positioning
Control where piped content goes - Prepend or append stdin to file contentValues:Append behavior:Use prepend for:
prepend(default) - Piped content comes before file contentappend- Piped content comes after file content
- Data-first workflows (“here’s the data, now analyze it”)
- Piping logs/metrics to analysis scripts
- Context-first workflows (“here’s the task, here’s the data”)
- Scripts where instructions come first
Output Format
Claude Code native: Control output formatValues:
text(default) - Plain text outputjson- Complete JSON response at endstream-json- Streaming JSON (used by--live)
--live automatically sets stream-jsonExamples:Claude Code native: Show detailed execution informationWhat it does:
- Shows detailed internal operations
- Displays API requests/responses
- Useful for debugging issues
--liveflag--output-format stream-json
Examples
Real-Time Streaming
CI/CD Clean Output
Unix Pipelines
Debugging
Report Generation
Dual Output Streams
Live Streaming Details
When you use--live:
- Status messages → stderr (your console)
- Clean output → stdout (files, pipes)
- Real-time display → word-by-word as generated
- Requires
jq→ install withbrew install jq
Combining Flags
Stream Processing
Extract JSON Fields
Parse Streaming Output
Split Streams
Troubleshooting
--live shows 'jq not found' error
--live shows 'jq not found' error
Install jq for JSON streaming:
Status messages in output file
Status messages in output file
Status messages go to stdout by default. Use
--quiet or redirect stderr:--live not streaming, just buffering
--live not streaming, just buffering
Make sure you’re using the AI Runner wrapper, not calling Claude Code directly:
Piped input in wrong position
Piped input in wrong position
Use
--stdin-position to control placement: