Translate natural language into shell commands directly in your terminal using Mistral AI. The suggested command is pre-filled on your command line so you can review it before pressing Enter.
example.mp4
- Oh My Zsh installed
curl(pre-installed on macOS)jq- install withbrew install jq- A Mistral AI API key
# Clone or navigate to this project, then run:
bash install.shAdd the following to your ~/.zshrc:
# Mistral API key (see Security section below for secure storage options)
export MISTRAL_API_KEY="your-key-here"
# Add remembercommands to your plugins list
plugins=(remembercommands)Then reload your shell:
source ~/.zshrc~/.zshrc exposes it in plaintext. See the Security section below for safer alternatives using macOS Keychain.
$ remembercmd list all files sorted by size
# Pre-fills: ls -lS
$ remembercmd find python files modified today
# Pre-fills: find . -name "*.py" -mtime 0
$ remembercmd count lines in all js files
# Pre-fills: find . -name "*.js" | xargs wc -l
$ remembercmd compress the logs folder
# Pre-fills: tar -czf logs.tar.gz logs/The command appears on your terminal line ready to execute. Press Enter to run it, or edit it first.
You can use a shorter alias like rr, rc, or cmd instead of remembercmd. Add this to your ~/.zshrc before the plugins=() line:
export REMEMBERCOMMANDS_ALIAS="rr"Then use it:
rr list all filesAll settings can be overridden in your ~/.zshrc (before the plugins=() line):
| Variable | Default | Description |
|---|---|---|
MISTRAL_API_KEY |
(required) | Your Mistral AI API key |
REMEMBERCOMMANDS_ALIAS |
remembercmd |
Custom command alias (e.g., rr, rc, cmd) |
REMEMBERCOMMANDS_MODEL |
ministral-3b-latest |
Mistral model to use |
REMEMBERCOMMANDS_TEMPERATURE |
0.2 |
Response creativity (0-1) |
REMEMBERCOMMANDS_MAX_TOKENS |
200 |
Max response length |
REMEMBERCOMMANDS_API_URL |
https://api.mistral.ai/v1/chat/completions |
API endpoint |
REMEMBERCOMMANDS_SYSTEM_PROMPT |
(built-in) | Custom system prompt |
Recommended: Use macOS Keychain (most secure)
# Store your API key in Keychain (one-time setup)
security add-generic-password -a "$USER" -s "mistral-api-key" -w "your-api-key-here"
# Add this to your ~/.zshrc to retrieve it automatically
export MISTRAL_API_KEY=$(security find-generic-password -a "$USER" -s "mistral-api-key" -w 2>/dev/null)Alternative: Environment Variable (less secure)
# Add to ~/.zshrc
export MISTRAL_API_KEY="your-key-here"~/.zshrc means:
- It's visible in plaintext on your disk
- It appears in
envoutput - It could be accidentally committed if you version-control your dotfiles
Always review commands before executing. The plugin pre-fills the command on your terminal line, allowing you to:
- Review the command for accuracy
- Edit it if needed
- Press Ctrl+C to cancel
Dangerous Command Detection: The plugin automatically detects potentially dangerous patterns like:
rm -rf /orrm -rf *dd if=(disk operations)mkfs(filesystem formatting)sudo rmchmod -R 777
When detected, you'll see a warning prompt before the command is pre-filled.
Be mindful of API usage. The Mistral AI API has rate limits and each request incurs costs. Consider:
- Reviewing your API usage at https://console.mistral.ai
- Setting up billing alerts in your Mistral account
- Using the plugin judiciously for actual needs
This plugin includes several security protections:
- ✅ HTTPS enforcement: API URL must use HTTPS
- ✅ TLS 1.2+ required: Enforced via curl flags
- ✅ Input validation: Maximum 500 character input length
- ✅ Configuration validation: Temperature and token limits validated
- ✅ Response length check: Warns on unusually long responses
- ✅ Error message sanitization: API keys redacted from error messages
- ✅ Dangerous command warnings: Alerts before risky operations
If you discover a security vulnerability, please report it by opening a GitHub Issue. Please include:
- Description of the vulnerability
- Steps to reproduce
- Potential impact
Do not disclose security issues publicly until they are resolved.
- You type
remembercmd <your question> - The plugin sends your question to Mistral AI with a system prompt that instructs the model to return only the raw shell command
- The response is cleaned up and placed on your command line using
print -z - You review the command, optionally edit it, then press Enter to execute
Error: MISTRAL_API_KEY is not set
Add export MISTRAL_API_KEY="your-key" to your ~/.zshrc and run source ~/.zshrc.
Error: jq is required but not installed
Run brew install jq.
Error: Mistral API returned HTTP 401
Your API key is invalid. Check it at https://console.mistral.ai/api-keys.
Error: Mistral API returned HTTP 429
Rate limited. Wait a moment and try again.
Command not found: remembercmd
Make sure remembercommands is in your plugins=(...) list in ~/.zshrc and you ran source ~/.zshrc.