Skip to main content
The crush run command executes a single prompt in non-interactive mode, making it perfect for scripting, automation, and piping data.

Usage

crush run [prompt...] [flags]

Description

Run a single prompt in non-interactive mode and exit. The prompt can be provided as command-line arguments or piped from stdin. This is ideal for:
  • One-off queries and commands
  • Shell scripting and automation
  • Processing piped data
  • CI/CD pipelines
  • Output redirection to files

Flags

--quiet
boolean
default:"false"
Hide the spinner during execution. Useful when you want cleaner output for scripting.Short flag: -q
--verbose
boolean
default:"false"
Show detailed logs during execution. Useful for debugging.Short flag: -v
--model
string
default:"configured default"
Model to use for this run. Accepts either model or provider/model format to disambiguate models with the same name across providers.Short flag: -mExamples:
  • claude-sonnet-4-20250514
  • anthropic/claude-sonnet-4-20250514
  • gpt-4o
  • openai/gpt-4o
--small-model
string
default:"configured default"
Small model to use for auxiliary tasks. If not provided, uses the default small model for the provider.

Global Flags

All global flags are also available: --debug, --yolo, --cwd, --data-dir

Input Methods

Command-line Arguments

Provide the prompt directly as arguments:
crush run "Explain how binary search works"

Stdin (Pipe)

Pipe data into the prompt:
cat README.md | crush run "Summarize this README"
curl https://charm.land | crush run "What is this website about?"

File Redirection

Read from a file using shell redirection:
crush run "What is this code doing?" < main.go

Combined Input

When piping data, crush run prepends the stdin content to your prompt:
cat error.log | crush run "Find the root cause of these errors"
# Equivalent to: crush run "<contents of error.log>\n\nFind the root cause of these errors"

Output Redirection

Redirect Crush’s output to files:
crush run "Generate a README for this project" > README.md
crush run "Create a .gitignore for a Node.js project" >> .gitignore

Examples

# Run a simple prompt
crush run "Guess my 5 favorite Pokémon"

Scripting Examples

Automated Code Review

#!/bin/bash
for file in src/**/*.go; do
  echo "Reviewing $file..."
  crush run --quiet "Review this code for bugs and improvements" < "$file" > "reviews/${file}.md"
done

CI/CD Integration

# .github/workflows/review.yml
name: AI Code Review
on: [pull_request]
jobs:
  review:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - name: Review changes
        run: |
          git diff main | crush run --quiet "Review these changes" > review.md
          cat review.md >> $GITHUB_STEP_SUMMARY

Batch Processing

# Process multiple files
for file in *.txt; do
  crush run "Translate this to Spanish" < "$file" > "spanish_${file}"
done

Behavior

Provider Configuration

The command requires at least one provider to be configured. If no providers are set up, you’ll see:
no providers configured - please run 'crush' to set up a provider interactively
Run crush without arguments to configure providers interactively.

Non-Interactive Mode

In non-interactive mode:
  • No TUI is displayed
  • Output goes directly to stdout
  • A spinner shows progress (unless --quiet or --verbose is used)
  • Tool permissions still apply (unless --yolo is used)
  • Session is not saved to history by default

Signal Handling

The command responds to interrupt signals:
  • SIGINT (Ctrl+C): Gracefully cancels the operation
  • SIGTERM: Gracefully shuts down

Differences from crush

Featurecrushcrush run
ModeInteractive TUINon-interactive
OutputTerminal UIPlain text to stdout
SessionSaved to historyOne-off execution
InputChat interfaceCommand-line args or stdin
Use caseDevelopment sessionsScripting, automation
ExitManual (Ctrl+C)Automatic after completion

See Also

Build docs developers (and LLMs) love