Skip to content

Zagot-byte/command-butler

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Command Butler 🧹🧠

A security-first, offline, AI-assisted command-line helper for Linux

Command Butler is a local CLI agent that translates fuzzy human intent (e.g. "fix net", "list process") into safe, predefined Linux commands.

It is designed for control, safety, and transparency.


✨ Features

  • 🧠 Local LLM (llama3.2:3b via Ollama) — no cloud, no API keys.
  • 🔐 Strict Sandbox — AI only selects from catalog/commands.json.
  • 🔁 Multi-step Agent Loop — Bounded for safety, fully inspectable.
  • 🛡️ Sudo Escalation Loop — Intelligently handles "Permission denied" errors by prompting for sudo.
  • 💬 Interactive Mode — Full REPL with command history (up-arrow support).
  • 🔍 Command Discovery — Add new commands easily with butler --cmd <name>.
  • Fast & Lightweight — Built with Python, zero external dependencies besides Ollama.

🚀 Quick Start

1. Prerequisites

2. Install

git clone https://github.com/USER/BUTLER.git
cd BUTLER
./install.sh

3. Usage

# Activate the environment
source .env/bin/activate

# Single command
butler "check network status"

# Interactive mode
butler --interactive

# Discovery mode (add new command to catalog)
butler --cmd htop

🏗️ Architecture

butler/
├── engine.py           # Orchestrator
├── slm_decision.py     # Intent → Command Selection
├── slm_analyzer.py     # Output → Analysis
├── executor.py         # Subprocess Runner (with sudo -S support)
├── logger.py           # Audit logging
└── formatter.py        # Box-style UI
catalog/
└── commands.json       # The Allowlist

Key guarantees:

  • AI NEVER generates raw shell strings.
  • Only commands in the catalog can be executed.
  • Human-in-the-loop for all critical actions.

📜 Audit Log

Every action is recorded in history.jsonl (omitted from git). You can view what Butler did and why.


🛠️ Adding Commands

You can manually edit catalog/commands.json or use the built-in discovery tool:

butler --cmd "nmap"

Butler will scan the manual pages and suggest a safe, descriptive entry for your catalog.


🧠 Philosophy

AI should assist, not take control.

Command Butler exists to keep humans in charge. Every action is a suggestion, every execution is verified.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors