ask. don't grep. don't awk. just ask
ask is an AI-powered CLI tool for developers who live in the terminal. It brings multi-provider LLM support, agent capabilities, and shell-native intelligence to your fingertips.
Unlike generic LLM CLIs, ask is built for shell power users:
- Generates reusable bash functions - Not just answers, but tools
- Agent mode - Executes safe plans with your approval
- Shell-native - Works perfectly with pipes and Unix philosophy
- Context-aware - Understands git repos, recent commands, system state
- Fast & streaming - Real-time responses as you type
- Multi-provider - Anthropic, OpenAI, Google Gemini, OpenRouter support
- Pure bash - No Python, Node, or other runtimes needed
# Download
curl -o ask https://raw.githubusercontent.com/elias-ba/ask/main/ask
chmod +x ask
# Move to PATH
sudo mv ask /usr/local/bin/
# Or for user-only install
mv ask ~/.local/bin/git clone https://github.com/elias-ba/ask.git
cd ask
chmod +x ask
sudo ln -s "$(pwd)/ask" /usr/local/bin/askcurl- For API callsjq- For JSON processing- Optional:
gloworbatfor prettier output
Install on Ubuntu/Debian:
sudo apt-get install curl jqInstall on macOS:
brew install curl jqask manages API keys for you:
# Set your API key (it will prompt you securely)
ask keys set anthropic
# Or for other providers
ask keys set openai
ask keys set openrouter
ask keys set google
# List your configured keys
ask keys list
# Check where keys are stored
ask keys pathKeys are stored securely in ~/.config/ask/keys.env with 600 permissions (readable only by you).
If you prefer environment variables:
# Anthropic (recommended)
export ANTHROPIC_API_KEY='sk-ant-...'
# OpenAI
export OPENAI_API_KEY='sk-...'
# Google Gemini
export GOOGLE_API_KEY='...'
# OpenRouter
export OPENROUTER_API_KEY='sk-or-...'Add to your ~/.bashrc or ~/.zshrc to persist.
- Anthropic: https://console.anthropic.com/
- OpenAI: https://platform.openai.com/api-keys
- Google Gemini: https://aistudio.google.com/apikey
- OpenRouter: https://openrouter.ai/keys
# Simple queries
ask "how do I find large files?"
# Pipe input
git log --oneline | ask "summarize recent changes"
# Debug errors
cat error.log | ask "what's causing these errors?"Let ask execute tasks for you:
# Optimize images
ask --agent "find and optimize all PNG files in ./images"
# Clean up
ask --agent "remove docker containers older than 30 days"
# Dry run first
ask --agent --dry-run "reorganize these files by type"Create reusable tools:
# Generate a function
ask --fn parse_nginx "extract 500 errors from nginx access logs"
# ask will generate, validate, and save:
# parse_nginx() {
# grep " 500 " "$1" | awk '{print $1, $7}' | sort | uniq -c
# }
# Use it immediately
source ~/.config/ask/functions.sh
parse_nginx /var/log/nginx/access.log# Generate semantic commit messages
git add .
ask commit
# Review PR
ask pr-review
# Explain what changed
git diff main | ask "explain these changes"ask
# Starts interactive chat with:
# - Conversation history
# - Context awareness
# - Multi-turn dialogue
# - Special commands (/help, /clear, etc.)# Minimal context (pwd, date)
ask --context min "what's in this directory?"
# Auto context (git, recent commands)
ask --context auto "debug this error"
# Full context (env, history, system)
ask --context full "why did that command fail?"# List available models
ask --list-models
# Use specific model
ask -m gpt-4o "write a poem"
# Switch provider
ask -p openai "your question"# Enable streaming (default)
ask -s "long explanation"
# Disable for parseable output
ask -n "output json" | jq .Inside ask interactive mode:
| Command | Description |
|---|---|
/clear |
Clear conversation history |
/save |
Save conversation to file |
/load |
Load previous conversation |
/models |
List available models |
/switch [provider] [model] |
Switch provider/model |
/context [level] |
Set context level |
/help |
Show help |
/exit or /quit |
Exit |
ask uses XDG Base Directory spec:
~/.config/ask/ # Configuration
└── functions.sh # Generated functions
~/.cache/ask/ # Cache & history
├── history.jsonl # Conversation history
└── context.json # Context cache# Analyze logs
tail -f /var/log/app.log | ask "alert me to errors"
# Process data
cat users.csv | ask "find duplicate emails"
# Code review
git diff | ask "suggest improvements"# Debug
ask "why is this segfaulting?" < debug.log
# Test generation
ask --fn test_auth "generate pytest tests for auth.py"
# Documentation
ask "explain this codebase" --context full# Diagnose issues
docker ps | ask "which containers are unhealthy?"
# Performance analysis
top -bn1 | ask "what's consuming resources?"
# Security audit
ask --agent "find files with 777 permissions"Contributions welcome! ask is designed to be:
- Simple - Pure bash, easy to understand
- Powerful - Real developer workflows
- Safe - Always confirm dangerous operations
- Extensible - Easy to add providers/features
ask follows the Unix philosophy:
- Do one thing well - Shell-native AI assistance
- Work together - Pipe-friendly, composable
- Text streams - Universal interface
- Simple - Bash script, no complex dependencies
Built for developers who never leave the terminal.
# Check installation
which ask
# Verify it's executable
chmod +x /usr/local/bin/ask
# Check PATH
echo $PATH# Verify key is set
echo $ANTHROPIC_API_KEY
# Test manually
ask --version# Disable streaming if terminal has issues
ask -n "your query"MIT License - See LICENSE file
- GitHub: https://github.com/elias-ba/ask
- Issues: https://github.com/elias-ba/ask/issues
- Discussions: https://github.com/elias-ba/ask/discussions