Shai is a powerful AI CLI assistant completely written in Rust. It utilizes the capabilities of Qwen 3.5 (via the highly optimized CPU llama.cpp backend) to understand both natural language and exact system commands, directly within your terminal.
Shai not only interprets your conversational requests into ready-to-execute system commands, but also uses a custom RAG (Retrieval-Augmented Generation) pipeline interacting securely with your local man and --help pages to ensure commands are exactly accurate to your environment.
- Local Inference: 100% local processing running securely on your CPU without any external API calls or data harvesting.
- Auto-Model Download: On its first run, Shai asks you which checkpoint of the Qwen model to pull down and dynamically fetches & caches it from HuggingFace via
hf-hub. - Intelligent RAG: Shai automatically attempts to extract raw manual pages and CLI
--helpparameters and inject them into the LLM context to ensure accurate syntax. - Interactive REPL: Use
shaias an interactive shell! Normal tools likels -lpass directly through to bash, while questions like "How do I create a tarball?" are dynamically intercepted and routed to the AI. - One-Shot Commands: Pass commands directly like
shai build a docker container from this folderfor instant answers. - Secure Fallbacks: By default, Shai intercepts every proposed command generated by the model before execution, forcing a user verification
[y/N]prompt for security.
Since Shai utilizes llama-cpp-2 under the hood to compile the fast C++ ML backends natively to Rust, you must have standard system build utilities (C++ Compiler, CMake) and OpenSSL.
sudo apt-get update
sudo apt-get install -y cmake build-essential gcc g++ pkg-config libssl-dev libclang-dev clangbrew install cmake pkg-config openssl llvmClone the repository and build via Cargo:
git clone https://github.com/your-username/shai.git
cd shai
# Build the release binary. This will compile Llama.cpp in the background
# and may take a few minutes!
cargo build --releaseTo easily use the Shai tool globally across your machine, you can install it using Cargo:
cargo install --path .This will place the executable in your ~/.cargo/bin/ directory.
Start the REPL by running the command by itself!
shai
# First run will initialize the HuggingFace model downloader.Welcome to shai REPL! Type your natural language request or a normal command.
Type 'exit' or 'quit' to close.
shai> echo "hello world"
hello world
shai> list the contents of my ssh folder
Proposed Command:
ls -al ~/.ssh
Do you want to execute this command? [y/N]
Or, supply a one-shot query:
shai "find all rust files modified in the last 7 days and delete them"Contributions are heavily encouraged!