🖥️ 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 files→ls) - 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, orANTHROPIC_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:
- Ollama (local, default model
qwen2.5:0.5b) — used if Ollama is running. - 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:
TERMINAL_USAGE_EXAMPLES.md— real-world CLI usage examplesTESTING.md— testing guidePUBLISHING_GUIDE.md/QUICK_PUBLISH.md— releasing to PyPIIMPLEMENTATION.md— feature implementation notes
🤝 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.
- Issues: https://github.com/ankit0305/alan-terminal-ai/issues
- Repository: https://github.com/ankit0305/alan-terminal-ai
📄 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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2f52714571bb5f52b17612fad1d9bf5f90542a2540189f398923576fe80e75bf
|
|
| MD5 |
50133450ba36e2c4c8cb07a33d4c4b05
|
|
| BLAKE2b-256 |
16922bfadc3bc1bad4b00feb786ad9b9142aae98e60c87787410cbbc2d304804
|
File details
Details for the file alan_terminal_ai-0.2.11-py3-none-any.whl.
File metadata
- Download URL: alan_terminal_ai-0.2.11-py3-none-any.whl
- Upload date:
- Size: 65.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1c0a1d9d69a6d27ed8070335eadb2121681c043352dcb5c0ce064a4d32dd5f6e
|
|
| MD5 |
15fc3d15b157507a9d1df51193ce3a85
|
|
| BLAKE2b-256 |
063cdbc3e4d5bae671de897fbf3ce142524cb3b5a2b9122a185c5ab1daa71f53
|