What is Butterfish?
Butterfish is a command-line tool designed to integrate AI capabilities, specifically large language models (LLMs), into your shell environment. It is akin to having Github Copilot but directly within your terminal, enhancing your command-line interactions with AI-driven assistance.
Key Features and Functionality
Integration with Shell
Butterfish works seamlessly with popular shells such as bash
and zsh
on both MacOS and Linux. When you run butterfish shell
, it wraps your existing shell, allowing you to use it as normal while adding AI-powered features.
AI Prompting
To engage the AI, you simply start a command with a capital letter. For example, typing “Summarize the file I just printed” will prompt the AI to provide a summary based on the context of your shell history.
Contextual Help
The AI has access to your shell history, enabling it to provide contextual help. You can ask questions like “Why did that command fail?” and receive relevant answers based on the previous commands and their outputs.
Autocomplete Shell Commands
Butterfish offers autocomplete suggestions for shell commands, similar to Github Copilot. These suggestions are based on your recent history and the AI’s understanding of the context.
Goal Mode
Butterfish includes a “Goal Mode” where the AI acts as an agent to execute commands to achieve a specific goal. For instance, you can use Run make in this directory, debug problems
to let the AI handle the process of running and debugging commands.
Customizable Prompts
The prompts used to interact with the AI are transparent and editable. They are stored in a prompts.yaml
file, allowing users to tweak and customize the language used in the prompts to better suit their needs.
Text Indexing and Search
Butterfish can index text files and search them using the OpenAI embedding API. This allows you to search for specific content within indexed files and retrieve relevant snippets.
Text Generation and Question Answering
Using the OpenAI API, Butterfish can generate text and answer questions based on the input provided. This functionality extends beyond shell commands, allowing you to use it for general queries or text generation tasks.
Additional Features
- GPT Autosuggest: Provides command completions based on the context, similar to Github Copilot.
- Transparent Prompts: Allows users to see and edit the prompts sent to the AI.
- Support for Child Processes: Butterfish avoids interfering with interactive processes like
vim
orssh
. - Prompt Library: Prompts are stored in a configurable file, enabling easy editing and customization.
Installation and Usage
To use Butterfish, you need an OpenAI account and an API key. You can install it using pip install butterfish
. Once installed, you can start the Butterfish shell by running butterfish shell
in your terminal.
In summary, Butterfish enhances your command-line experience by integrating AI capabilities, providing contextual help, autocomplete suggestions, and the ability to execute commands to achieve specific goals, all while allowing for customization and transparency in its prompts.