Skip to content

agamennone-siae/shai

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Shai

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.

🌟 Features

  • 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 --help parameters and inject them into the LLM context to ensure accurate syntax.
  • Interactive REPL: Use shai as an interactive shell! Normal tools like ls -l pass 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 folder for 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.

🚀 Pre-requisites

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.

Ubuntu / Debian

sudo apt-get update
sudo apt-get install -y cmake build-essential gcc g++ pkg-config libssl-dev libclang-dev clang

macOS (using Homebrew)

brew install cmake pkg-config openssl llvm

🛠️ Building & Installing

Clone 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 --release

To 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.

📖 Usage

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"

🤝 Contributing

Contributions are heavily encouraged!

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages