The Script
How It Works
Stdin Support
AIRun scripts accept stdin like any Unix command:Why Use Haiku?
This script uses--haiku because:
- Fast - Data analysis doesn’t need deep reasoning
- Cheap - Processing lots of files costs less
- Sufficient - Haiku can summarize and identify patterns
Running the Script
Pipe from File
Pipe from Command
Pipe from API
Save Output
Real-World Usage
Process JSON Data
Analyze CSV Files
Process Log Files
Analyze Git History
Chaining Scripts Together
Pipe output from one AI script to another:Process Multiple Files
Controlling Stdin Position
By default, piped data is prepended to your prompt. You can control this:Data Processing Patterns
Transform JSON to CSV
Filter and Aggregate
Detect Anomalies
Enrich Data
Stdin vs File Arguments
When to Use Stdin
✅ Use stdin when:- Piping from commands (
git log | ./script.md) - Chaining scripts together
- Processing streams
- Keeping scripts generic (don’t hardcode filenames)
When to Use File Arguments
✅ Use file arguments when:- The script needs to read multiple files
- The script needs to know the filename
- You want to be explicit about what’s being processed
Combining Stdin with Other Flags
Stdin + Live Output
Stdin + Provider Override
Stdin + Variables
CI/CD Examples
GitHub Actions
Process Database Dumps
Troubleshooting
No Stdin Detected
Problem: Script doesn’t see piped data. Solution: Make sure you’re actually piping:Stdin Data Not in Prompt
Problem: AI says “no data provided.” Solution: Check that stdin isn’t empty:Binary Data Issues
Problem: Piping binary files causes errors. Solution: AIRun expects text data. Convert binary first:Next Steps
Data Processing
Complete data pipeline patterns
Chaining Scripts
Build multi-stage pipelines
CI/CD Integration
Automate data analysis in CI/CD
Live Output
Stream processing for large datasets