Skip to main content

🖥️ Alan – AI Terminal Command Assistant

Alan turns natural-language requests into safe, executable shell commands. It runs locally against Ollama by default and falls back to cloud LLM providers (OpenRouter, OpenAI, Anthropic) when an API key is configured.

alan please list all Python files

🚀 Features

  • Natural language → shell commands (e.g. alan please list directory filesls)
  • Multiple LLM backends — local Ollama first, with OpenRouter / OpenAI / Anthropic fallback
  • Safety checks — refuses dangerous commands (e.g. rm -rf /) and confirms before executing
  • Smart command tracking — learns from accepted/rejected suggestions and scores confidence
  • Command statistics via alan stats
  • Cross-platform — detects macOS, Linux (apt/yum/dnf/pacman/zypper), and Windows
  • Clipboard support via alan copy
  • Additional modules included in the package: MCP server, speech-to-text / wake-word, daemon mode, plugins, and domain personas (DevOps, sysadmin, data scientist, developer)

📦 Requirements

  • Python 3.8+
  • For local inference: Ollama installed and running, with at least one model pulled (default qwen2.5:0.5b):
    brew install ollama        # or see https://ollama.ai for other platforms
    ollama serve
    ollama pull qwen2.5:0.5b
    
  • OR a cloud provider API key (no Ollama required): set one of OPENROUTER_API_KEY, OPENAI_API_KEY, or ANTHROPIC_API_KEY.

Core Python dependencies (rich, colorama, pydantic, schedule, requests) are installed automatically by pip.


📥 Install (users)

pip install alan-terminal-ai

Optional provider/feature extras:

pip install "alan-terminal-ai[openrouter]"   # OpenRouter
pip install "alan-terminal-ai[openai]"       # OpenAI
pip install "alan-terminal-ai[anthropic]"    # Anthropic
pip install "alan-terminal-ai[mcp]"          # MCP server
pip install "alan-terminal-ai[stt]"          # speech-to-text + wake word
pip install "alan-terminal-ai[all]"          # everything optional

Verify the install:

alan --version
alan status        # shows which LLM backend is active

🛠️ Development setup (contributors)

If you want to work on Alan itself:

# 1. Clone
git clone https://github.com/ankit0305/alan-terminal-ai.git
cd alan-terminal-ai

# 2. Create and activate a virtual environment
python3 -m venv .venv
source .venv/bin/activate        # Windows: .venv\Scripts\activate

# 3. Editable install with dev tools
pip install -e ".[dev]"

# 4. (Recommended) install git hooks
pre-commit install

Running tests

pytest

Tests live in alanterminalai/tests/. The default pytest config (in pyproject.toml) runs with coverage enabled.

Linting & formatting

The repo is configured for black, isort, flake8, and mypy (line length 100):

black .
isort .
flake8
mypy alanterminalai

These also run automatically via pre-commit if you installed the hooks.


💡 Usage

alan please [your request]

Examples

alan please list all Python files
alan please find files modified today
alan please count lines in all py files
alan please show disk usage
alan please check running processes

For each request Alan suggests a command, runs safety checks, shows confidence based on your history, and asks for confirmation before executing.


📜 Commands

alan please [request]   # Get and run a command suggestion
alan copy               # Copy the last command/output to clipboard
alan stats              # Show command tracking statistics
alan status             # Show available and active LLM backends
alan --help             # Show help
alan --version          # Show version

🔀 LLM backend selection

Alan tries backends in this order:

  1. Ollama (local, default model qwen2.5:0.5b) — used if Ollama is running.
  2. Cloud fallback — if Ollama is unavailable, Alan uses the first configured cloud provider. Set one of:
    export OPENROUTER_API_KEY=...
    export OPENAI_API_KEY=...
    export ANTHROPIC_API_KEY=...
    

Run alan status to see which backends are available and which one is active.


🧠 Smart Learning & Tracking

Alan tracks command preferences to improve future suggestions:

  • Acceptance/rejection tracking — learns which commands you accept or reject
  • Confidence scoring — shows confidence levels based on your history
  • Similar command suggestions — surfaces previously accepted similar commands
  • Usage statistics — most-used command types and success rates

View your statistics with alan stats. History is stored in command_history.json.


🧩 Configuration

Create ~/.alan_config.json to customize behavior:

{
  "tracking": {
    "enabled": true,
    "show_confidence": true,
    "show_similar_commands": true
  },
  "display": {
    "show_system_info": true,
    "use_emojis": true,
    "verbose_output": false
  },
  "safety": {
    "enable_safety_checks": true,
    "prompt_for_dangerous_commands": true
  }
}

⚠️ Safety

Alan will:

  • Reject known-dangerous commands (e.g. rm -rf /)
  • Display the suggested command first
  • Ask for confirmation before running anything

You can review and modify the command before it runs.


📚 Documentation

Additional documentation lives in the docs/ folder:


🤝 Contributing

Contributions are welcome. Fork the repo, create a feature branch, run the tests and linters (pytest, pre-commit run --all-files), and open a pull request against main.


📄 License

See LICENSE.

Download files

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

Source Distribution

alan_terminal_ai-0.2.11.tar.gz (53.7 kB view details)

Uploaded Source

Built Distribution

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

alan_terminal_ai-0.2.11-py3-none-any.whl (65.4 kB view details)

Uploaded Python 3

File details

Details for the file alan_terminal_ai-0.2.11.tar.gz.

File metadata

  • Download URL: alan_terminal_ai-0.2.11.tar.gz
  • Upload date:
  • Size: 53.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for alan_terminal_ai-0.2.11.tar.gz
Algorithm Hash digest
SHA256 2f52714571bb5f52b17612fad1d9bf5f90542a2540189f398923576fe80e75bf
MD5 50133450ba36e2c4c8cb07a33d4c4b05
BLAKE2b-256 16922bfadc3bc1bad4b00feb786ad9b9142aae98e60c87787410cbbc2d304804

See more details on using hashes here.

File details

Details for the file alan_terminal_ai-0.2.11-py3-none-any.whl.

File metadata

File hashes

Hashes for alan_terminal_ai-0.2.11-py3-none-any.whl
Algorithm Hash digest
SHA256 1c0a1d9d69a6d27ed8070335eadb2121681c043352dcb5c0ce064a4d32dd5f6e
MD5 15fc3d15b157507a9d1df51193ce3a85
BLAKE2b-256 063cdbc3e4d5bae671de897fbf3ce142524cb3b5a2b9122a185c5ab1daa71f53

See more details on using hashes here.

Release history Release notifications | RSS feed

0.4.0

2 files

0.3.0

2 files

0.2.14

2 files

0.2.13

2 files

0.2.12

2 files

This release

0.2.11 This release

2 files

0.2.10

2 files

0.2.8

2 files

0.2.7

2 files

0.2.4

2 files

0.2.3

2 files

0.0.0

2 files

Supported by

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