A modular automation OS for building and running tools, workflows, and AI systems in your terminal.
TerminalOS is designed to be extended.
Fork it. Add modules. Build tools. Automate something.
π This is your terminal. Make it do what you want.
- π Dynamic Module Discovery: Drop new modules into
app/modules/*/controller.pyand they load automatically - π Live Code Reloading: Menu rebuilds each loop to pick up module/library changes instantly
- π± Android Automation Ready: Integrated ADB controller for device control, screenshot capture, and interaction
- π¨ Clean Architecture: Separate concerns with dedicated UI, status, config, and library boundaries
- π§© Extensible by Design: Controllers stay thin; business logic lives in services or libraries
- β‘ Production-Grade: Comprehensive logging, error handling, and configuration management
# Clone the repository
git clone https://github.com/NatBuilds/TerminalOS.git
cd TerminalOS
# Create virtual environment
python -m venv .venv
# Activate virtual environment
# Windows:
.\.venv\Scripts\Activate.ps1
# macOS/Linux:
source .venv/bin/activate
# Install dependencies
python -m pip install -r requirements.txt
# Run the application
python run.py- Python 3.12+
colorama>=0.4.6- Colored terminal outputrequests>=2.31.0- HTTP requestsopencv-python>=4.10.0.84- Image processing (optional)pytesseract>=0.3.13- OCR support (optional)
For Android device automation:
# Windows (via Chocolatey)
choco install android-sdk
# macOS
brew install android-platform-tools
# Linux
sudo apt-get install android-tools-adb
# Or download from: https://developer.android.com/studio/releases/platform-toolspython run.pyNavigate through the menu to:
- Settings - Control verbose/debug output
- Tools - Example tool menus
- Device Tools - Android ADB utilities (if configured)
- Logs - View application logs
- Entry:
run.pyβapp.main.main() - Discovery: Scans
app/modules/*/controller.pyfor feature modules - Reload: Reloads libraries and module controllers each menu loop
- Register: Calls each module's
register(menu)function - Display: Renders menu and executes selected action
- Repeat: Back to step 2 (enables live code editing)
- example - Basic "Hello" example
- settings - Toggle verbose mode and view state
- tools - Example submenu structure
- device_tools - ADB utilities (11 options) + Vision tools (3 options)
- screenshot_analyzer - Complete ADB + OpenCV + Tesseract example
- cron_scheduler - Task scheduling interface
- logs - Log management and search
Planned areas of expansion, with no specific release order:
- ComfyUI local image generation
- Local AI integrations: Ollama, LM Studio, any OpenAI endpoint, OpenRouter
- Other connections
Config file: app/config.json (auto-created with sensible defaults)
{
"llm": {
"provider": "lm_studio",
"base_url": "http://localhost:1234",
"chat_endpoint": "/v1/chat/completions",
"model": "your-model-name",
"api_key": "not-needed",
"timeout": 30
}
}{
"adb": {
"adb_executable": "adb",
"device_serial": "",
"timeout": 30
}
}{
"ocr": {
"tesseract_cmd": "tesseract",
"language": "eng",
"psm": 3,
"oem": 3,
"timeout": 30
}
}app/libraries/llm/llm_chat.py behavior:
- Builds endpoint from
base_url + chat_endpoint - Checks availability via
GET /models(check_endpoint()) - Sends OpenAI-style chat payloads to
/chat/completions - Parses
choices[0].message.content - Reports transport/shape errors through status logs
The following outputs were captured during a verification run on this workspace on 2026-04-26.
Dependency check after install attempt:
WARNING: Package(s) not found: colorama
WARNING: Package(s) not found: requests
Install command re-run result:
python -m pip install -r requirements.txt --disable-pip-version-check --retries 1 --timeout 15
... (Command execution interrupted after 300000 milliseconds)
Start attempt before dependencies were available:
Traceback (most recent call last):
File "INSTALL_LOCATION\TerminalOS\run.py", line 1, in <module>
from app.main import main
...
ModuleNotFoundError: No module named 'colorama'
If you hit the same issue, run:
python -m pip install -r requirements.txt- Python 3.11+
colorama>=0.4.6requests>=2.31.0
TerminalOS/
ββ run.py
ββ requirements.txt
ββ README.md
ββ CONTRIBUTING.md
ββ AGENTS.md
ββ templates/
β ββ module_template_controller.py
ββ app/
ββ main.py
ββ config.json
ββ assets/ascii.txt
ββ core/
ββ libraries/
ββ modules/
ββ tmp/
Create a new module with app/modules/<name>/controller.py:
from app.core import status
def my_action() -> None:
status.success("My feature works!")
def register(menu) -> None:
"""Called automatically at startup"""
menu.add("My Feature", my_action)Or use the template: templates/module_template_controller.py
from app.libraries import ADBController
adb = ADBController()
# List devices
for device in adb.devices():
print(f"{device.serial}: {device.state}")
# Capture screenshot
adb.screenshot("screenshots/screen.png")
# Control device
adb.tap(100, 200)
adb.talk("Hello Android")
adb.open_app("com.android.chrome")Combine ADB, OpenCV, and OCR:
from app.libraries import ADBController, OpenCVImageTools, TesseractOCR
adb = ADBController()
cv = OpenCVImageTools()
ocr = TesseractOCR()
# Capture
adb.screenshot("screenshot.png")
# Process
image = cv.load_image("screenshot.png")
gray = cv.to_grayscale(image)
# Extract text
text = ocr.extract_text("screenshot.png")See app/modules/screenshot_analyzer/controller.py for complete example.
TerminalOS/
βββ run.py # Entry point
βββ requirements.txt # Python dependencies
βββ app/
β βββ main.py # Core runtime loop
β βββ config.json # Configuration (auto-created)
β βββ core/ # Framework essentials
β β βββ menu.py # Menu system
β β βββ ui.py # Console rendering
β β βββ status.py # Status logging
β β βββ config.py # Config management
β β βββ cron_runtime.py # Task scheduling
β βββ libraries/ # Reusable components
β β βββ adb/ # Android ADB controller
β β βββ opencv/ # Image processing
β β βββ ocr/ # Text extraction
β β βββ logging/ # File logging
β β βββ cron/ # Task scheduler
β β βββ text/ # Text utilities
β βββ modules/ # Feature modules (auto-discovered)
β βββ example/
β βββ settings/
β βββ tools/
β βββ device_tools/
β βββ screenshot_analyzer/
β βββ cron_scheduler/
β βββ logs/
βββ templates/ # Module template
βββ logs/ # Application logs
- Create
app/modules/<name>/controller.py - Implement
register(menu) -> None - Add actions:
menu.add("Label", handler) - Save and run - it's auto-loaded!
Enable verbose mode in Settings menu to see debug logs. Changes to modules are picked up on next menu render without restarting.
No formal test framework is included. Validate changes by:
- Running
python run.py - Navigating to your module
- Verifying expected output
| Issue | Solution |
|---|---|
| Module not in menu | Verify controller.py exists and register(menu) doesn't raise |
| No debug output | Enable verbose in Settings menu |
| ADB not found | Install Android SDK Platform Tools or configure path in config.json |
| No devices detected | Enable USB debugging, connect device, accept ADB prompt |
| OpenCV errors | Run pip install opencv-python |
| Tesseract not working | Install system-wide (choco/brew/apt) and pytesseract |
- Menu rebuild is ~50-200ms depending on modules
- Live reload enabled for development; suitable for production dashboards
- Logging adds minimal overhead
- Thread-safe for basic concurrent use
