Install latest from the GitHub repository:
or from pypi
pip install shell_sage
We recommend also setting up your terminal editor of choice to keep the editor content's displayed in the terminal on exit. This allows ShellSage
to see the files you have been working on. Here is how you can do this in vim:
echo "set t_ti= t_te=" >> ~/.vimrc
You will also need to get an Anthropic API key and set its environment variable:
export ANTHROPIC_API_KEY=sk...
ShellSage
is designed to be ran inside a tmux session since it relies on tmux for getting what has is displayed on your terminal as context. If you don't want to use tmux, you will need to use the --NH
command, which will not include your terminal history.
ssage hi ShellSage
Hello! I'm ShellSage, your command-line assistant. I can help you with:
- Bash commands and scripting
- System administration tasks
- Git operations
- File management
- Process handling
- And more!
You can also pipe outputs into ShellSage
:
cat file.txt | ssage summarize this file
You can also select a specific pane for context to come from instead of the default current pane.
ssage --pid %3 your question
Tip: To use the pane-id selection feature, it is helpful to add
set -g status-right '#{pane_id}'
to your~/.tmux.conf
file. Once done, you can reload your tmux config withtmux source ~/.tmux.conf
to have the pane id displayed on the right hand side of your tmux status bar.