Skip to main content

Plain English to shell commands, powered by Claude or Ollama

Project description

ShellSage

Plain English to shell commands, powered by Claude or Ollama.

Claude API Ollama Offline Capable License: MIT Python 3.10+


Demo

Demo


Installation

pip install shellsage

After installing, run the one-time setup:

shellsage init

Quick Start

# Find all large files in your home directory
shellsage "find files larger than 100MB in my home directory"

# Create a new git branch and switch to it
shellsage "create a new git branch called feature/login and switch to it"

# Compress a folder
shellsage "compress the folder ./logs into a tar.gz archive"

# Kill a process on port 8080
shellsage "kill whatever process is running on port 8080"

# Bulk rename all .jpeg files to .jpg
shellsage "rename all .jpeg files in this folder to .jpg"

Ollama Setup (Local AI)

ShellSage can run entirely offline using Ollama.

1. Install Ollama

Platform Command
macOS brew install ollama
Linux curl -fsSL https://ollama.com/install.sh | sh
Windows https://ollama.com/download

2. Pull a model

ollama pull llama3.2        # recommended — fast and capable
ollama pull qwen2.5:3b      # lightweight, great for slower machines
ollama pull mistral         # most capable open model

3. Start the server

ollama serve
# macOS: starts automatically from the menu bar app

4. Verify

curl http://localhost:11434/api/tags

Then run shellsage init and choose Ollama.


CLI Reference

Usage: shellsage [OPTIONS] [INTENT] COMMAND [ARGS]...

  Translate INTENT into shell commands using AI.

Arguments:
  INTENT  Plain English description of what you want to do.

Options:
  --dry-run           Show commands without executing them.
  --explain           Show per-token breakdown before prompting.
  --provider TEXT     Override configured provider: claude or ollama.
  --help              Show this message and exit.

Commands:
  init      Run the first-time setup wizard.
  config    Re-run the setup wizard to change settings.
  history   Print this session's command history.

Examples

# Preview without running
shellsage "delete all .log files" --dry-run

# Get a detailed explanation of each command
shellsage "set up a Python virtual environment" --explain

# Override provider for this run
shellsage "list docker containers" --provider claude

# View commands run this session
shellsage history

# Reconfigure at any time
shellsage config

Safety System

ShellSage has a two-layer safety system:

Hard Blocklist

The following commands are always blocked and can never run, regardless of context:

  • rm -rf /, rm -rf /*, rm -rf ~
  • dd if=/dev/zero, dd if=/dev/random, dd if=/dev/urandom
  • mkfs, chmod -R 777 /
  • Fork bombs: :(){ :|:& };:
  • Piping untrusted URLs into a shell: curl | bash, wget -O- | sh

Danger Levels

Each proposed command is shown with a color-coded panel:

Level Color Indicator
safe Green 🟢
caution Yellow 🟡
destructive Red 🔴

You always see the command and its danger level before being asked to run it. You can also press e at the confirmation prompt to get a detailed token-by-token explanation.


Switching Providers

shellsage config

This re-runs the interactive setup wizard where you can switch between Claude and Ollama, change models, and update your API key.


How It Works

  1. ShellSage detects your OS, shell, working directory, and installed tools.
  2. It sends your English intent to the configured LLM with a structured prompt.
  3. The LLM responds with a JSON plan containing one or more shell commands.
  4. ShellSage validates each command against the safety blocklist.
  5. You confirm (or explain, or skip) each command before it runs.
  6. If a command fails, ShellSage automatically attempts to self-correct using the error output.

Contributing

  1. Fork the repository.
  2. Create a feature branch: git checkout -b feature/my-feature
  3. Install dev dependencies: pip install -e ".[dev]"
  4. Run tests: pytest tests/
  5. Submit a pull request.

Please keep pull requests focused on a single concern and include tests for new functionality.


License

MIT — see LICENSE.

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

shellsage_ai-0.1.0.tar.gz (17.8 kB view details)

Uploaded Source

Built Distribution

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

shellsage_ai-0.1.0-py3-none-any.whl (20.3 kB view details)

Uploaded Python 3

File details

Details for the file shellsage_ai-0.1.0.tar.gz.

File metadata

  • Download URL: shellsage_ai-0.1.0.tar.gz
  • Upload date:
  • Size: 17.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.2

File hashes

Hashes for shellsage_ai-0.1.0.tar.gz
Algorithm Hash digest
SHA256 f0693cdc3e178a81d1161a6943877ab2906da95d4a86e4c9cb6bdadf6989952e
MD5 c56a61eaa9ffbd17a458edcd1be57557
BLAKE2b-256 e60b07f5fabe9d7e34a0f70f3af99fbd4d7edb4e70ac36423e03f067ecf65117

See more details on using hashes here.

File details

Details for the file shellsage_ai-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: shellsage_ai-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 20.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.2

File hashes

Hashes for shellsage_ai-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 133fc19c80cb4c4419605b567be5d0e79b811e487604910f1d39632771ddd260
MD5 0dbf8ee5cef08f80f8ea83025d16350f
BLAKE2b-256 1d17659dd403f8c70a8afc2cbf7554646cc58d17726e027be12b2a697835853b

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