ShellLM is a local-first command history augmentor. It provides semantic search capabilities for shell sessions by recording commands and their outputs into a vector database for context-aware retrieval.
Rather than relying on keyword-based history searches, ShellLM implements a local Retrieval-Augmented Generation (RAG) pipeline. It creates a vector embedding based on your shell commands and stdout using all-MiniLM-L6-v2 and stores the results in LanceDB, a high-performance columnar vector database.
- Capture: Shell hooks (
bash_rc_script.shandzsh_rc.sh) transmit commands and output to the daemon over Unix sockets. - Daemon: A Go-based orchestrator (
shelllm-daemon) responsible for generating embeddings, writing to the DB, and handling queries. - CLI: A lightweight frontend (
slm) for querying your history using natural language. - Storage: LanceDB for efficient, local vector storage and retrieval.
- Inference: Local execution of the ONNX runtime for sentence embeddings.
- Go 1.26+
- ONNX Runtime & LanceDB: The
Makefilewill automatically download the correct shared libraries for your platform (Linux/macOS).
-
Clone the repository:
git clone https://github.com/kylestanfield/shelllm.git cd shelllm -
Build and Install: This will download necessary models and libraries (~500MB), compile the binaries, and install the
slmcommand to/usr/local/bin.make build sudo make install
-
Shell Integration: Add the hook to your shell configuration file.
For Bash (
~/.bashrc):source /path/to/shelllm/bash_rc_script.shFor Zsh (
~/.zshrc):source /path/to/shelllm/zsh_rc.sh
-
Start the Daemon: The daemon must be running to capture history and answer queries.
make run
Note: In production mode, the daemon runs silently.
-
Querying: Use the
slmcommand to ask questions about your shell history.slm "how do I untar a file?" slm why did my last docker build fail?
To run the daemon with verbose logging enabled:
make devTo remove binaries and temporary socket files (but keep the downloaded libraries and model):
make cleanMIT