For us "dinosaurs" who grew up in the terminal, the modern AI revolution has felt a bit... disconnected. We spend our days in a high-performance CLI environment, yet every time we need an LLM’s help, we’re forced to context-switch to a browser, paste code into a chat window, and hope the "copy-paste" cycle doesn't break our flow.
I builtqsh (Qwen Shell) to solve this. It’s a local-first, privacy-focused CLI that brings vision and semantic understanding directly into the Unix pipe. No APIs, no data leakage, just a 0.8B-parameter brain running on your local hardware.
1. The "Big Three": Vision, Filter, and Command
qsh isn't just a chatbot; it’s an extension of the coreutils philosophy. It treats the LLM as a smart filter.
Semantic Vision:
The Image PipePowered by Qwen 3.5-0.8B’s unified processor, qsh can analyze visual features alongside text. Instead of manually scrolling through a folder of screenshots to find an error, you can now pipe your images directly into a query:
# Find every image with a cat and open it automatically
ls examples/*.jpg | qsh vision "is there a cat?" | xargs open
The model evaluates the query for each image, prints the filename only if the answer is "YES," and lets the next pipe handle the result.
The Semantic Filter: Grep with Meaning
Standard grep is great for finding strings, but it's useless for finding intent. The filter command evaluates standard input against a natural language query:
# Filter a messy TODO list by context
cat notes.txt | qsh filter "What is due tomorrow?"
It acts as a semantic pipe, asking your question for every line of text. The LLM returns a "Yes" or "No," allowing you to sift through logs or notes with human-level logic.
Commander Mode: AI-Powered Autocomplete
We’ve all been there: you make a mistake in a Git repository and can’t remember the exact syntax to undo the last three commits without losing work. Instead of hitting StackOverflow, you just ask:
qsh "Undo my last 3 git commits but keep the changes"
qsh translates your intent into valid, executable Bash. But it doesn't just run it blindly...
2. Safety First: Deterministic Guardrails
"But muh safety!" I can already hear the Linux SysAdmins screaming. Giving an AI access to a shell is inherently risky.
To solve this, qsh uses a Hybrid Safety Model:
- Deterministic Scans: The Rust binary uses a high-performance pattern matcher (defined in
safety.rs) to scan the AI's output for dangerous strings likerm -rf /,mkfs, ordd. - Interactive Review: If a command looks dangerous, it’s flagged with bright red text. The user is presented with a two-step confirmation process, offering a chance for further explanation or a hard abort.
It’s the best of both worlds: Probabilistic power from the LLM, and Deterministic safety from Rust.
3. The Architecture: Rust AND Python?
A common question I get is: "How does a system language like Rust talk to a machine learning language like Python without lag?" I chose a hybrid architecture to play to the strengths of each:
Rust: Handles the fast I/O, the SQLite history database, the safety logic, and the CLI interface.
Python: Handles the heavy lifting of torch and the transformerslibrary.
I would love to use Rust for everything, but support for the latest Qwen 3.5 architectures isn't fully implemented in the Rust Hugging Facecandle library yet— so I submitted a Pull Request to fix that!(
The installation is a simple one-liner that sets up a local virtual environment (qenv) to keep your system clean:
curl -sSL https://raw.githubusercontent.com/woodRock/qsh/main/setup.sh | sh
4. The "Local-First" Manifesto
Why not just use the OpenAI API or Claude? I’ll give you three reasons:
- Zero-Data Leakage: Your terminal history and local file paths never leave your machine. Given recent news about AI companies and government contracts, do you really want to send your full file system context to a cloud server?
- Offline Utility:
qshworks in a basement, on a plane, or in a war zone. You get consistent 100% uptime without worrying about rate limits or server overloads. - The 0.8B Sweet Spot: Qwen 3.5-0.8B is small enough to run on a standard laptop (even without a beefy GPU) but "smart" enough to master Bash syntax.
5. Built to Last: Stability & Memory
For a tool to be truly "useful," it needs to be reliable.
- SQLite Memory:
qshdoesn't see commands in isolation. It stores your session history in a local SQLite database. This allows for context-aware follow-ups like:qsh "What was that file I just listed?" - Robust Testing: Stability isn't an afterthought. We've implemented a comprehensive integration test suite and a GitHub Actions CI pipeline to ensure that the semantic logic and safety guardrails remain intact as the tool grows.
6. What’s Next?
The goal is to eventually move the inference entirely into Rust once the candleecosystem catches up, removing the Python dependency altogether.
Until then,qshis here to give your Unix pipes the brain they’ve been waiting for.
Check out the project on GitHub: