Skip to main content

A terminal assistant powered by On-Device LLM

Project description

TBuddy - Terminal Assistant Powered by On-Device LLM

Python 3.12+ Poetry License

TBuddy is an intelligent terminal assistant that converts natural language queries into bash commands using on-device (<1B params) Large Language Models (LLMs). It provides both a command-line interface and a daemon service for seamless terminal command generation.

🚀 Features

  • Natural Language to Bash Commands: Convert plain English descriptions into executable bash commands
  • On-Device LLM Integration: Uses Ollama with extremely small sub 1Billion parameter local models for balancing privacy, speed, memory usage and accuracy
  • Semantic Example Selection: Leverages vector embeddings to find relevant command examples from a pre-curated list
  • Dual Operation Modes:
    • One-off command generation
    • Background daemon service for persistent, faster availability
  • Rich Example Database: Comprehensive collection of text-to-command examples (available with repo)
  • Safe Command Generation: Focuses on standard, secure and safe bash commands

🏗️ Architecture

Core Components

terminal-buddy/
├── src/terminal_buddy/
│ ├── main.py # CLI interface and server logic
│ └── utils/
│ ├── llm_functions.py # LLM integration with Ollama
│ ├── config.py # Configuration management
│ ├── prompts.py # System prompts and templates
│ └── example_selection.py # Vector-based Example Selection
├── data/examples/
│ └── text_2_command_examples.json # Training examples (included in the repo)
└── tests/ # Test suite

Key Technologies

  • Ollama: Local LLM inference engine
  • LangChain: Vector embeddings and example selection
  • ChromaDB: Vector database for semantic search
  • Typer: Modern CLI framework
  • Pydantic: Configuration and data validation

📋 Prerequisites

  • Python 3.12 or higher
  • Ollama installed and running
  • Required Ollama models:
    • qwen3:0.6b (for command generation)
    • nomic-embed-text (for embeddings)

🛠️ Installation

Step 1 - Install Package

Using pip installer (Recommended)

pip install terminal-buddy

Using Poetry (Build Yourself)

# Clone the repository
git clone <repository-url>
cd terminal-buddy

# Install dependencies
poetry install

# Install the package
poetry install --with dev

Step 2 - Setup Ollama Models

# Pull required models
ollama pull qwen3:0.6b
ollama pull nomic-embed-text

🚀 Usage

TBuddy provides a CLI with multiple commands grouped under query, server, and config.

Query Commands

Generate a command directly

tb query "list all files in current directory"

Server Management

# Start the server in background mode (default)
tb server up

# Start the server in foreground mode
tb server up --no-daemonize

# Stop the server
tb server down

# Check server status
tb server status

Configuration Management

# Show current configuration
tb config show

# Update LLM model
tb config set-llm-model qwen3:0.6b

# Update embeddings model
tb config set-embeddings-model nomic-embed-text

# Update examples file path
tb config set-examples-path ./data/examples/text_2_command_examples.json

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

terminal_buddy-0.1.2.tar.gz (22.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

terminal_buddy-0.1.2-py3-none-any.whl (22.7 kB view details)

Uploaded Python 3

File details

Details for the file terminal_buddy-0.1.2.tar.gz.

File metadata

  • Download URL: terminal_buddy-0.1.2.tar.gz
  • Upload date:
  • Size: 22.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.4 CPython/3.12.11 Linux/6.11.0-1018-azure

File hashes

Hashes for terminal_buddy-0.1.2.tar.gz
Algorithm Hash digest
SHA256 30ab446967379b981bd5ab21f518d299b81a7606f137d4051f5e00799edc21b2
MD5 c3500f066f5f334995cbaa0dbcb2a70b
BLAKE2b-256 107b297c0029c3590d84b95701f40b4ae4bd6702b23a095ae9d0224fe0e03268

See more details on using hashes here.

File details

Details for the file terminal_buddy-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: terminal_buddy-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 22.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.4 CPython/3.12.11 Linux/6.11.0-1018-azure

File hashes

Hashes for terminal_buddy-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 7c695cd93721b0a682767771cc87fdec05947d57b584679f58f838f15e06048f
MD5 319c41678cd6d0e325234744bbd9c155
BLAKE2b-256 6a1285a9d13e8ef7b9bd6d7854d358f5c0493870227630ef4f51276fc1b956cf

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page