Butterfish is a command-line tool designed to integrate Large Language Models (LLMs) directly into your shell environment, offering a powerful way to interact with AI for software engineering and general command-line tasks. It aims to make users more effective and faster by providing AI assistance without requiring context switching to other applications or using a mouse.
Core Features:
- AI-Powered Shell: Butterfish wraps your existing shell (bash, zsh) and allows you to prompt an AI by simply starting a command with a capital letter. This enables contextual questions based on your shell history, such as "Why did that command fail?" or "Give me a command to do X."
- Contextual Awareness: The AI has access to your shell history, allowing for highly relevant and context-aware assistance. This eliminates the need for manual copy-pasting of commands or outputs.
- Goal Mode: This feature allows an AI agent to execute commands autonomously to achieve a specified goal. Commands can be initiated with
!(requiring confirmation) or!!(unsafe, executes without confirmation). This is useful for tasks like debugging or automating sequences of commands. - GPT Autosuggest: Similar to GitHub Copilot, Butterfish provides command autosuggestions powered by AI. These suggestions are context-aware and can be applied by pressing the
Tabkey. - Customizable Prompts: Users have control over the prompts sent to the AI. These prompt wrappers are visible and editable in
~/.config/butterfish/prompts.yaml, allowing for fine-tuning of AI behavior. - Model Selection: Butterfish defaults to
gpt-4-turbobut allows users to select other models, including compatible local models, via command-line flags. - Transparent Prompts: The tool provides verbose logging (
-vor-vv) and logs to a file (/var/tmp/butterfish.logon macOS) to show raw AI requests and responses, promoting transparency. - OpenAI Compatible API Support: Butterfish can be configured to use any server with an OpenAI-compatible API, enabling the use of local LLMs.
- Other Utilities: Beyond shell integration, Butterfish offers command-line utilities for direct prompting, command generation, text summarization, and managing embeddings of local files.
- Neovim Plugin: A dedicated Neovim plugin (
butterfish.nvim) is available for seamless LLM interaction within the Neovim editor.
Target Users:
Butterfish is primarily designed for developers, system administrators, and anyone who frequently works from the command line and can benefit from AI assistance to speed up their workflow, debug issues, and automate tasks. It's particularly useful for those who prefer a terminal-centric workflow and want to leverage the power of LLMs without leaving their shell environment.
Technical Details:
Butterfish acts as a shell wrapper, intercepting input and output to provide its AI features. It manages conversation history, constructs API requests to LLMs, and streams responses back to the terminal. It also includes mechanisms to avoid interfering with interactive child processes like vim or ssh.
The tool is open-source, written in Golang, and distributed under the MIT License. It aims to be unobtrusive, natural to use, and transparent in its operation.

