AIOS (AI Operating Shell) is a command-line automation assistant that lets you interact with AI models to ask questions, generate step-by-step plans, and safely execute system commands — all from your terminal.
It's designed for developers, sysadmins, and power users who want AI-assisted automation without sacrificing safety.
You can run it locally using Ollama models (like llama3, llama3.1), connect to OpenAI APIs (GPT-4/4o, etc.), or use a Local stub for offline development and testing.
Instead of just answering questions, AIOS can:
- Understand your goal (e.g., "Install a Python dev box").
- Plan safe, ordered shell commands to achieve it.
- Show you exactly what will be run (approval gate).
- Enforce allowlists so only approved commands execute.
- Stream results back to your terminal in real time.
- Automatically detect operation modes (Check, Audit, Fix, Harden).
- Provide intelligent recovery when commands fail.
- Support combined operations (check, audit and fix).
- Manage advanced workflows with templates and scheduling.
This makes it ideal for:
- Troubleshooting — "What logs should I check if apps crash?"
- System setup — "Install PostgreSQL and configure a new database."
- Maintenance tasks — "Upgrade all system packages."
- Security operations — "Check and fix system vulnerabilities."
- Cross-platform automation — works on Linux, macOS, and Windows.
You can use AIOS to perform comprehensive security operations.
For example, to check and fix system vulnerabilities:
./target/release/aishell plan "check and fix system vulnerabilities"This automatically:
- Detects operation mode: Combined (Check → Fix)
- Shows safety warnings: Clear about system modifications
- Executes in phases: Analysis first, then remediation
- Provides recovery: Intelligent error handling and alternatives
For enterprise-grade security management:
# Apply security templates
./target/release/aishell apply --template "cis_ubuntu_20.04"
# Execute saved plans
./target/release/aishell apply --plan "security_audit_2024_08_23"
# Batch operations
./target/release/aishell apply --batch "plan1,plan2,plan3"
# Scheduled execution
./target/release/aishell apply --schedule "daily" --plan "vulnerability_scan"./target/release/aishell --backend=ollama plan "upgrade all system packages"
{
"goal": "upgrade all system packages",
"steps": [
{ "cmd": "sudo apt update", "why": "Fetch latest package info" },
{ "cmd": "sudo apt upgrade -y", "why": "Apply updates" }
],
"risk": "low"
}- aishell: Ask / Plan / Apply / Pkg commands
- Smart Operation Modes: Automatic detection of Check, Audit, Fix, Harden operations
- Combined Operations: Support for "check, audit and fix" workflows
- Intelligent Recovery: AI-powered error recovery and alternatives
- Advanced Workflow Management: Templates, scheduling, and batch operations
- Pluggable backends via CLI (
--backend=ollama|openai|local) or env (AIOS_BACKEND) - System snapshot via
sysctlxfor richer planning prompts - Streaming answers for
Ask(disable with--no-stream) - Strict JSON for
Plan(extracts JSON safely) - Integrated execution with
Plancommand (no separate Apply needed) - Advanced Apply for workflow management (templates, scheduling, batch)
- Cross-platform executor: bash on Linux/macOS, PowerShell on Windows
- Safety-first design with clear operation mode warnings
- Config via
.env(URL, model, timeout, backend)
aios_scaffold/
├── platform/ # OS & package manager detection
├── sysctlx/ # System probe tool (OS, CPU, Mem info)
├── aishell/ # Main CLI: Ask/Plan/Apply/Pkg
│ ├── backend/ # Backend modules: ollama.rs, openai.rs, local.rs, mod.rs
│ ├── cli.rs # CLI arg parsing
│ ├── commands.rs # Command handlers
│ ├── sysprobe.rs # Integration with sysctlx
│ ├── policy.rs # Allowlist/policy checks
│ ├── plan.rs # Plan save/load structs
│ └── shell.rs # Cross-platform shell runner
└── policies/ # Allowlist definitionsollama pull llama3.1
cargo build --release
export PATH="$PWD/target/release:$PATH"
./target/release/sysctlx os
./target/release/aishell ask "What logs should I check if apps crash?"
./target/release/aishell plan "install a Python dev box" # executes immediately
./target/release/aishell plan "check system vulnerabilities" # read-only analysis
./target/release/aishell plan "audit system security" # install tools + analyze
./target/release/aishell plan "check and fix system vulnerabilities" # combined operation./target/release/aishell --backend=ollama ask "Hello!"
./target/release/aishell --backend=openai ask "Hello!"
./target/release/aishell --backend=local ask "Hello!"export AIOS_BACKEND=openai
export OPENAI_API_KEY=sk-...
./target/release/aishell ask "Hello!"AIOS_MODEL=llama3
AIOS_TIMEOUT_SECS=120
AIOS_BACKEND=ollama
AIOS_OLLAMA_BASE_URL=http://127.0.0.1:11434
OPENAI_API_KEY=sk-...
- Plans saved to:
~/.aios/plan.json - Execution logs:
~/.aios/history/*.log - Allowlist files:
policies/allowlist.*.txt(only commands whose first token is allowed will run;sudo <allowed>is OK) - sysprobe step: calls
sysctlxto embed live OS/CPU/Mem info in planning prompts.
Ifsysctlxisn't found, planning still works—just without the snapshot.
- Operation modes: Automatically detected from command keywords (check, audit, fix, harden)
- Safety warnings: Clear indicators for operations that modify the system
- Integrated execution:
plancommand now executes immediately,applyis for advanced workflows - Combined operations: Support for "check, audit and fix" workflows
- Intelligent recovery: AI-powered error recovery and alternatives
./target/release/aishell --backend=ollama plan "upgrade all system packages"
{
"goal": "upgrade all system packages",
"steps": [
{ "cmd": "sudo apt update", "why": "Fetch latest package info" },
{ "cmd": "sudo apt upgrade -y", "why": "Apply updates" }
],
"risk": "low"
} Install Rust
`curl https://sh.rustup.rs -sSf | sh`
Optional: Install Ollama
`brew install ollama`
Build
`cd /path/to/aios`
`cargo build --release`
`export PATH="$PWD/target/release:$PATH"` Install Rust (rustup-init.exe)
Optional: Install Ollama for Windows
cd C:\path\to\aios
cargo build --release
$env:Path = "$PWD\target\release;$env:Path"