The Script
How It Works
The Shebang Line
#!/usr/bin/env- Standard Unix shebang for finding executables in PATH-S- Essential flag that allows passing arguments (like--haiku) to the commandai- The AIRun command--haiku- Use the fastest, cheapest model tier (perfect for simple tasks)
The Prompt
Everything after the shebang is your prompt:Running the Script
Method 1: Make it executable and run directly
ai --haiku to execute the file.
Method 2: Run with the ai command
Method 3: Override the model
Flag precedence: CLI flags > shebang flags > saved defaultsRunning
ai --sonnet hello.md overrides the --haiku in the shebang.Why Use Haiku?
This script uses--haiku because:
- Fastest - Haiku responds in milliseconds
- Cheapest - Lowest cost per token
- Sufficient - Simple text generation doesn’t need Opus
| Task | Model |
|---|---|
| Simple text, greetings, summaries | --haiku |
| Code analysis, test running | --sonnet |
| Complex reasoning, architecture design | --opus |
Creating Your Own
Create a new script:Read-Only by Default
This script doesn’t need any permission flags because it only generates text. It cannot:- Write files
- Run commands
- Modify your system
- Test Automation - Using
--skipfor running commands - Code Analysis - Read-only analysis without permissions