Your AI-powered "Do What I Mean" companion for the command line.
bashme.ai is a smart assistant that lives in your terminal. It analyzes your current, often incomplete, commands or even plain English descriptions, and instantly suggests complete, ready-to-run shell commands. Stop remembering arcane flags and start telling your shell what you want to do.
(A sample GIF demonstrating the functionality)
- 🧠 Context-Aware Suggestions: Uses your current working directory (
ls), command history (history), and even command documentation (man) to provide highly relevant and accurate suggestions. - 📝 Natural Language to Command: Simply type a comment like
# find all markdown files modified in the last dayand let the AI generate the precise command for you. - ⚡ Interactive & Real-time: Built with
fzffor a fluid, real-time filtering experience. Suggestions update live as you refine your query. - 🛠️ Agentic Tool Use: Powered by LangGraph,
bashme.aiis a true agent. It can decide on its own to use tools likelsormanto gather information before giving you an answer. - 🚀 Blazing Fast: Runs as local daemons to ensure minimal latency, making it feel like a natural part of your shell.
- 💡 Learns Your Style: By leveraging your shell history, it adapts to the commands and patterns you use most often.
bashme.ai has a decoupled, client-server architecture to ensure it's both powerful and non-blocking in your shell.
- Shell Integration (
ai_complete.sh+fzf): A lightweight Bash script captures your current command line ($READLINE_LINE) and cursor position when you press a keybinding (Alt+c). It opens anfzfwindow, which provides the interactive UI. - CLI Client (
cli.py): Thefzfwindow calls a simple Python CLI. This client gathers all the context (command, pwd, etc.) and sends it over HTTP to the Agent Daemon. - Agent Daemon (
agent_daemon.py): A FastAPI server that hosts the LangGraph agent. It receives the context, invokes the agent, and streams the suggestions back to the CLI client, which pipes them intofzf. - Tool Server (
server.py): AFastMCPserver that exposes crucial functions (ls,man,history,get_os_info) as "tools" for the agent. This is how the agent can "see" your local environment to make informed decisions.
Follow these steps to get bashme.ai running on your system.
- Linux or macOS with
systemd(for running services). If you don't usesystemd, you can run the daemons manually. - Python >= 3.11
- fzf (a command-line fuzzy finder)
- uv (an extremely fast Python package installer and resolver)
git clone https://github.com/your-username/bashme.ai.git
cd bashme.aiWe use uv for fast and reliable dependency management.
# Create a virtual environment
uv venv
# Activate the environment
source .venv/bin/activate
# Install all dependencies from pyproject.toml
uv syncbashme.ai uses the Google Gemini API.
- Get an API key from Google AI Studio.
- Create a configuration directory and an environment file:
mkdir -p ~/.config/bashme cp .env.example ~/.config/bashme/env
- Edit
~/.config/bashme/envand add your API key:# ~/.config/bashme/env BASHME_API_KEY=YOUR_GOOGLE_AI_API_KEY_HERE
We provide systemd user services to run the tool server and agent daemon in the background.
-
⚠️ IMPORTANT: The service files contain hardcoded paths. You must edit them to match your system.- Find your project path:
pwd(e.g.,/home/user/bashme.ai) - Find your python path:
which python(e.g.,/home/user/bashme.ai/.venv/bin/python)
- Find your project path:
-
Copy the example service files.
cp bashme_server.service.example bashme_server.service cp bashme_agent.service.example bashme_agent.service
-
Edit
bashme_server.serviceandbashme_agent.service, replacing all instances of/home/user/src/bashme.aiand/opt/home/user/venv/bashme/bin/pythonwith your actual paths. -
Install and start the services:
# Create the systemd user directory if it doesn't exist mkdir -p ~/.config/systemd/user/ # Copy the configured service files cp bashme_server.service ~/.config/systemd/user/ cp bashme_agent.service ~/.config/systemd/user/ # Reload the systemd daemon, then enable and start the services systemctl --user daemon-reload systemctl --user enable --now bashme_server.service bashme_agent.service
-
Check that the services are running:
systemctl --user status bashme_server.service bashme_agent.service
-
⚠️ IMPORTANT: Theai_complete.shscript also has hardcoded paths. Edit it to match your environment.python_executableshould point to your virtual environment's Python.cli_scriptshould point to thecli.pyfile in the repository.
-
Once edited, source the script in your
.bashrcor.bash_profileto make it available in your shell sessions.# Add this line to the end of your ~/.bashrc source /path/to/your/bashme.ai/ai_complete.sh
-
Restart your shell or run
source ~/.bashrc.
You're all set! Now you can use bashme.ai in any terminal session.
- Start typing a command, or don't type anything at all.
- Press
Alt+c(orEscthenc). - The
fzfwindow will appear with AI-generated suggestions. - You can:
- Select a command with
Enter. - Type to filter the suggestions in real-time.
- Press
Escto cancel.
- Select a command with
- Natural Language: Type
# find all log files in /var/log larger than 10MBand pressAlt+c. - Command Completion: Type
docker run -it pythand pressAlt+c. - Creative Pipelining: Type
ls -la | # count the number of directoriesand pressAlt+c. - Empty Prompt: Just press
Alt+con an empty line to get suggestions based on your current directory and history (e.g.,git status).
The heart of the AI's behavior is defined in src/bashme/system_prompt.xml. You can edit this file to change the agent's personality, rules, and output format. After editing, simply restart the agent service:
systemctl --user restart bashme_agent.serviceThis project is licensed under the GPL-3.0-only License. See the LICENSE file for details.
mkdir /opt/home/user/venv/bashme
ln -s /opt/home/user/venv/bashme .venv
uv sync --all-groups
/opt/home/user/venv/bashme/bin/python /home/user/src/bashme.ai/src/bashme/client.py --current-command "cat ai_" --cursor-position 7 --pwd $(pwd) --api-key $(vault kv get -mount=secret -field=google_aistudio_api_key airflow)mkdir -p ~/.config/bashme ~/.config/systemd/user/
cp bashme_server.service.example bashme_server.service
cp bashme_agent.service.example bashme_agent.service
# edit if needed, then
cp bashme_server.service ~/.config/systemd/user/bashme_server.service
cp bashme_agent.service ~/.config/systemd/user/bashme_agent.service
# edit the api key
echo "BASHME_API_KEY=$(vault kv get -mount=secret -field=google_aistudio_api_key airflow)" > .env
cp .env ~/.config/bashme/env