Skip to main content
Glama
README.md
# AI-Launcher-Pro

**An installable software module that turns a standard host machine into a dedicated AI Node.**  
Models run where you decide, are driven over MCP, REST or a web page, and every action goes through the same permission levels and audit log.

<p align="left">
  <img src="https://img.shields.io/badge/Python-3.11+-blue?style=for-the-badge&logo=python" />
  <img src="https://img.shields.io/badge/Protocol-MCP-black?style=for-the-badge" />
  <img src="https://img.shields.io/badge/Linux-supported-green?style=for-the-badge&logo=linux&logoColor=white" />
  <img src="https://img.shields.io/badge/Windows-alpha-orange?style=for-the-badge&logo=windows&logoColor=white" />
  <img src="https://img.shields.io/badge/License-Apache%202.0-yellow?style=for-the-badge" />
</p>

**Jump to:** [Overview](#-overview) ยท [Status](#-status) ยท [Install](#-install-windows-or-linux) ยท [Try it](#-try-it-on-a-machine) ยท [Reference](#-reference)

---

## ๐Ÿงญ Overview

An installable software module that transforms a standard host machine into a dedicated AI Node.

This module manages the full lifecycle of local AI models (starting, stopping, and monitoring execution) while preserving the robust configuration, optimization, and fallback behaviors of our core runtime scripts. It provides real-time reporting of hardware metrics and network identifiers (MAC addresses), and exposes a dual-interface control layer with identical functionalities and security boundaries:

| Interface | What it is |
|---|---|
| ๐Ÿ”Œ **Model Context Protocol (MCP)** | Integrates seamlessly with compatible orchestrators and client environments (such as Claude Desktop). |
| ๐Ÿ–ฅ๏ธ **Node Web Dashboard ("Control Room")** | A localized web interface served directly by the node, designed to be embedded or accessed via external control panels. |

### ๐Ÿงฑ Architecture & Ecosystem Role

- **Independent & Modular:** Developed as a standalone, decoupled project, separate from orchestration frameworks or legacy applications.
- **Ecosystem Ready:** Fully compatible with external launchers, agent systems, and multi-agent platforms, allowing them to leverage the node as a standardized computing target.

---

## ๐Ÿ“Œ Status
First implementation (milestone M2): the node can load and stop model presets on GPUs, report status, hardware and sensors, and shut the machine down,
through MCP, REST and a minimal web page. Parity with the existing NODE_B scripts is checked by tests ([docs/parity.md](docs/parity.md)).
Feature-first, with a minimal safety floor: private IPv4 only by default, no shell, audit log, optional token (mandatory if you choose `network: any`).
For agents that must drive a node, read the guide in [docs/skills/use-ai-node/SKILL.md](docs/skills/use-ai-node/SKILL.md).
To use a node from Claude Desktop (Linux), install the extension described in [clients/claude-desktop/README.md](clients/claude-desktop/README.md); `python scripts/build_mcpb.py` builds it.
See [docs/architecture.md](docs/architecture.md) for the design, the permission levels and what is deliberately postponed.

---

## โšก Quick start (development)
```
python -m venv .venv && . .venv/bin/activate
pip install -e ".[dev]"
python -m pytest -q
```
The tests never read the machine they run on: `ainode doctor` and the service look at stand-in folders for `/proc`, `/sys` and `/dev` (empty unless a test builds a machine there), the commands are faked, so the result is the same on an AMD node, an NVIDIA box, a laptop or a CI runner.

---

## ๐Ÿ“ฆ Install: Windows or Linux?

The code is the same; the installer depends on the system. Pick the line for yours. Each has an **online** way (a git clone, the machine needs internet for pip) and an **offline** way (a bundle with every Python package inside, for a machine without internet).

| System | Online (git clone) | Offline (bundle) |
|---|---|---|
| **Windows 10 / 11** (alpha) | `git clone <this repository>`, then double-click `install.bat` (it asks for administrator rights and which address to use; installs a Windows service) | download `ai-launcher-pro-windows-<version>.zip` from the release, unzip, double-click `install.bat` |
| **Linux** (Debian / Ubuntu) | `git clone <this repository> && cd ai-launcher-pro && sudo ./install.sh` | download `ai-launcher-pro-linux-<version>-py311.tar.gz` (Debian 12) or `-py312.tar.gz` (Ubuntu 24.04), `tar xzf` it, `cd` into the folder, `sudo ./install.sh` |

The offline Linux archive is chosen by the machine's Python version (`python3 --version`: 3.11 or 3.12), x86_64 only. Neither bundle contains Docker, GPU drivers or model images. Windows details and limits: [README-WINDOWS.md](README-WINDOWS.md). The bundles are built by `scripts/build_windows_zip.py` and `scripts/build_linux_bundle.py` (also by the `bundles` workflow, which attaches them to every release).

---

## ๐Ÿง Install on a server (Debian/Ubuntu)
```
git clone <this repository> ai-launcher-pro && cd ai-launcher-pro
./install.sh --dry-run          # prints every action and changes nothing (no root needed)
sudo ./install.sh               # installs and starts the service; add --yes to skip the address question
```
Run it with `sudo` from your normal account: the node runs as **that account, never as root**. The script is idempotent (a second run changes nothing),
checks Python >= 3.11 and Docker, creates `.venv` and runs `pip install -e .`, writes `config.yaml` with the first private IPv4 address of the machine,
`mode: read_only` and `network: private`, makes the token (`ainode token --write`, skipped with `--no-token`), installs a sudoers file with **only** the two `shutdown`
commands, with exactly the arguments the node passes (no wildcard) (checked with `visudo -c`), adds you to the `docker` group if it exists, installs and starts `ainode.service`, and runs `ainode doctor` before the start (a failure stops it).
At the end it prints the node URL, the MCP URL, the token file path (never the token), the MAC and broadcast address, and the Claude Desktop hint.
The node is named `ai-node-<machine name>` unless you pass `--name`; on a first install in a terminal the script proposes that name at the end and you can type another (Enter keeps it), then prints the address of the control room (`http://<address>:<port>/ui`, `https` when the config has a certificate) and where the token is, which the page asks for once. With `--yes` nobody is asked.

Options: `--name`, `--bind`, `--port`, `--yes`, `--no-token`, `--user`, `--root`, `--with-docker` (only explains; the script **never installs Docker or drivers**), `--with-recipes` (see "Recipes" below), `--with-restart-rule`, `--with-smart-rule` (one sudoers line per disk for `smartctl -H`, needs `smartmontools`) (see "Shell access" below), `--uninstall`
(removes the service, the sudoers file, the venv and the docker group membership it added; keeps `config.yaml`, the token, the audit log, presets and profiles).
A new node starts in `read_only`: to load models, set `mode: operational` in `config.yaml` by hand and restart the service. Manual test list for a fresh VM: [docs/parity.md](docs/parity.md).

---

## ๐ŸชŸ Other operating systems
The node's main target is **Linux** (Debian/Ubuntu for the installer): models run in Docker with the host's device files, and the hardware is read from `/proc` and `/sys`. **Windows** is in alpha (see above and [README-WINDOWS.md](README-WINDOWS.md)): the node, its read tools and shutdown work; loading models there is not done yet. macOS is not supported and nothing has been run there.
[docs/portability.md](docs/portability.md) is the feasibility and design note for them (a native engine runner instead of Docker, Vulkan on Windows, Metal on macOS, other workloads such as Stable Diffusion and speech, a phased plan, the security rules and the open questions); it is a plan, not an implementation. Ideas for going beyond launching models (the node as a controlled door to a desktop, a phone or a browser, from a reading of Windows-MCP, MacOS-MCP, Android-MCP and Web-Use) are analysis only, nothing built.

---

## ๐Ÿš€ Try it on a machine
```
cp config.example.yaml config.yaml          # set bind (your LAN IPv4), a free port and the gpus device files
# first run: the node needs at least one preset in presets/ (its live folder). Either start from the example ...
cp examples/presets/example-model.yaml presets/      # then edit file, folders, image and port for a real model
# ... or import the presets of the existing NODE_B script:
ainode import-presets /path/to/flux_model.sh --out presets
ainode doctor --config config.yaml          # address, port, presets, model files, modules, Docker, IPv6
ainode gpus --config config.yaml            # GPUs found (PCI ids, backend) and a ready-to-paste `gpus:` block; changes nothing
ainode serve --config config.yaml           # MCP /mcp, REST /api/<action>, web /ui, health /health
```
`presets/` and `profiles/` are **the node's own files**: git ignores their `*.yaml` (only a `.gitkeep` is tracked), so a real install never conflicts with the repo.
The repo's examples live in `examples/` and are copied by hand; neither the node nor the tests read them from there. An empty `presets/` is allowed:
`ainode doctor` then warns "0 preset(s)" and the node starts with nothing to load.

Use the node's own virtual environment: the interpreter that runs the service must have the dependencies (`ainode doctor` checks it).

Token (optional) and profiles:
```
ainode token --write config.yaml           # writes token_sha256 into the config (one line, comments kept) and the token into token.txt (mode 600)
ainode token --check config.yaml           # does token.txt match the hash in the config?
ainode doctor --config config.yaml         # also catches duplicated keys and a token file that does not match
```
A profile (`profiles/*.yaml`) is a named set of (preset, GPU) steps loaded together; start from `examples/profiles/example-profile.yaml`
(`cp examples/profiles/example-profile.yaml profiles/` once the preset it names exists in `presets/`).
Actions: `profile_list`, `profile_load_start` (a job, follow it with `job_result`), `profile_stop`, `profile_save` (create or replace one, checked like the files read at start) and `profile_trash` (the file is moved into `profiles/_to_delete`, never deleted; both refused while its models run). The page can do the same when `ui_control` is on.

---

## ๐Ÿ“š Reference

### ๐Ÿง  CPU models, instruction sets and CPU monitoring
A node with **no GPU** is valid: a preset that lists `cpu` under `gpus` (and has an image for it) runs with `gpu: "cpu"`: no device files, no groups, `-ngl 0` and `--threads` (`cpu_threads`, default physical cores - 1, never more than the cores).
The cpu is not a GPU slot: loading on it never stops a model on a GPU and the other way round; only one cpu model runs at a time unless the preset says `cpu_exclusive: false`.
llama.cpp built for a newer instruction set **crashes on an older CPU without saying why**, so the node reads the CPU's flags from `/proc/cpuinfo` (it never runs probe code) and says it before starting anything:
`node_inventory.cpu.features` (sse4_2, avx, avx2, fma, f16c, bmi2, avx512f/bw/dq/vl, avx512_vnni, avx512_bf16, avx_vnni, amx_tile/int8/bf16, avx10) and `cpu.level`: `baseline < avx < avx2 < avx512 < amx`
(avx2 needs avx2+fma+f16c+bmi2, avx512 needs avx512f+bw+dq+vl, amx needs amx_tile+int8+bf16; each level needs the one below). `node_info` shows `cpu_level`.
A preset can give `images: {cpu: {baseline: ..., avx2: ..., avx512: ...}}`; the node picks the best image not above the CPU level. If nothing fits, or the preset says `requires_cpu: avx2` and the CPU is below it, the load is refused with
`this CPU is avx; preset X needs avx2 or an image for the avx level` and **nothing is stopped or freed**. `ainode doctor` warns about presets that no image of this CPU's level can run.
`node_inventory.accelerators` lists NPUs the kernel shows (`/dev/accel*`, `/sys/class/accel`, `intel_vpu`, `amdxdna`), always with `usable_by_node: false`: the llama.cpp in our images does not use NPUs, so the node reports them and does not claim to run models on them. The integrated GPU is a GPU: use it through `gpus` (backend `vulkan` or `intel`).
`node_status.cpu` gives, per package, the temperature (`coretemp`/`k10temp`, labelled by chip) and the frequency (min/avg/max), and for the machine the load (1/5/15 min), memory and swap, throttling (the kernel's `thermal_throttle` counters: whether they went up since the node started or since the last call, with a warning in `node_status.warnings`), power from intel-rapl when readable (null otherwise), and on laptops the battery; `ainode doctor` warns when the machine is on battery.
**Laptop as a node:** closing the lid suspends the machine: set `HandleLidSwitch=ignore` and `HandleLidSwitchExternalPower=ignore` in `/etc/systemd/logind.conf` and restart `systemd-logind` (or reboot). Wake-on-LAN usually works on the wired port only and not on every laptop. Keep it on AC power and watch the temperature (`node_status.cpu`).

**Public llama.cpp images:** `ghcr.io/ggml-org/llama.cpp:server`, `:full` and `:full-vulkan` keep the engine in `/app`, not where the node's own images do. Let the node find it: `image_engine_register` (any client with level 1) looks inside the image, checks that `llama-server` is there and remembers it in `engines.json` next to `config.yaml`; `image_engines` shows what each image uses. Or say it yourself in `config.yaml`: `engine_paths: {ghcr.io/ggml-org/llama.cpp:server: /app/llama-server}` (per image; the default is unchanged, and `config.yaml` wins over `engines.json`).

### ๐Ÿงช Recipes (optional, level 2)
`recipes_enabled: true` (needs a token) lets an AI client prepare the machine through built-in recipes in two steps: `recipe_plan` shows the exact commands (nothing changes), and after the human approves, `recipe_apply(plan_id)` runs exactly that plan
(10-minute plan, runs once, stops at the first failed step, no retry, every step in the audit log). Without root: `image_pull` (only images listed in `recipe_images`), `model_trash` (moves a model file no preset uses into a `_to_delete` folder; it never deletes), `model_copy_ssh` (copies a model from a machine listed in `ssh_sources` with rsync over ssh, as `.part`, checked, renamed last), `model_pull` (downloads a `.gguf` from a Hugging Face repo listed in `hf_repos`, the Hub's commit pinned, checked against the SHA-256 the Hub states, renamed last), `model_copy` (fetches a model from another node's own door, listed in `share_peers`; that node sets `model_share: true` and a share token of its own) and the detection part of `amd_gpu_access` (the ROCm host side; it installs no driver).
With the **root helper** (`sudo ./install.sh --with-recipes`, opt-in): `docker_install` (Docker's official repository, Debian and Ubuntu only), `docker_group`, `nvidia_container_toolkit` (the runtime and the CDI file; never the driver),
`amd_gpu_access` (adds the node's user to `video` and `render`) and `wol_enable` (a systemd unit that turns Wake-on-LAN on, only for a wired interface whose card supports it: never a cellular modem or wifi; ethtool must be installed). The node itself never runs as root: it calls ONE program,
`/usr/local/sbin/ainode-recipe <recipe id>` (root-owned, mode 0755, standard library only, its own table of recipes), through a sudoers line that spells out each recipe id. The recipes still do nothing until the owner sets
`recipes_enabled: true`, and each one runs only after a person approved its plan. Drivers and kernels are never installed: the recipes detect and explain.
To move an image from one machine to another, run a small registry on the private network and use `image_pull`: [docs/images-via-registry.md](docs/images-via-registry.md).
`recipes_enabled`, `recipe_images` and `ui_control` are edited by hand on the machine, like `mode`. `ui_control: true` (needs a token and `mode: operational`) adds Load, Stop and profile buttons to the page's "Models by card" section; without it that section only shows which model runs on which card.

**Shell access for an AI (level 3, off by default).** If you want an assistant to run commands on a node (check a log, install a package, copy a file), `ainode shell --enable` shows the risks and asks you to type `ACCETTO`; `--until 4h` makes it end by itself. It needs a token. The installer offers it on a first install. `ainode shell --disable` turns it off. Every command is audited in full. To let that assistant also update the node, `sudo ./install.sh --with-restart-rule` (or the question the installer asks after the shell question) adds `/etc/sudoers.d/ainode-restart`: one line that lets the node's user run exactly `systemctl restart ainode.service` without a password, and no other sudo. See [docs/architecture.md](docs/architecture.md).

### ๐ŸŽ›๏ธ GPU backends
Each card in `gpus` has a backend: a plain list of device files means AMD (`rocm`, as always); `{backend: nvidia, index: 0}`, `{backend: vulkan, devices: [...]}` and `{backend: intel, devices: [...]}`
select the others (`nvidia_mode: gpus | cdi` chooses how an NVIDIA card is handed over; no `/dev/dri` is passed for it). A preset has either one `image` or `images: {rocm, cuda, vulkan, intel}`,
and optional `backends.<name>.args/env` extras. One model runs on one backend: `both` over cards of different backends is refused. See `config.example.yaml` and `examples/presets/example-multi-backend.yaml`.
`node_status` and `node_gpu` list every GPU with its `backend`, memory, temperature, load and power where the driver gives them (`rocm-smi`, `nvidia-smi`, or sysfs for vulkan/intel); a tool that is not installed makes only
those cards `available: false` with a reason. `ainode doctor` checks each backend (device files, the tool, the NVIDIA container toolkit or CDI file) and only ever warns about them. Sensor lines carry their chip name
(`amdgpu-pci-4300: fan1: 0 RPM`; a `fan1 0 RPM` alarm from the motherboard chip `it8772` is an unused fan header, not a GPU). AMD cards report `temperature_c` (hottest sensor) and `temperatures_c` (edge / junction / memory). vulkan and intel containers get `--group-add video --group-add render`; rocm keeps its proven line (`rocm_render_group: true` adds `render` there too).

### ๐Ÿ” Exposure and security modes
Three settings, each one a deliberate choice, edited by hand in `config.yaml`: `mode` (`read_only` | `operational`), `token_sha256` (optional, one token per node)
and `network` (`private` | `any`). `private` is the default: one private IPv4 address, never IPv6, never `0.0.0.0`. `any` also allows a public or IPv6 address, or `0.0.0.0`,
and **the node refuses to start with `network: any` and no token** (`ainode doctor` fails too). Optional `tls_cert` / `tls_key` make the node serve HTTPS (URLs start with `https://`);
with `network: any` and no TLS, `doctor` and `serve` warn that the token travels in clear text. Names that clients may use in the `Host` header go in `allowed_hosts`.
**The models' own ports have no authentication** (llama-server has no key), so the node token does not protect them. They are published on `model_bind`; its default is the node's
own address on a private network and `127.0.0.1` (this machine only) with `network: any`. `publish: all` (every interface, like the old script) still works on a private network
only, where `ainode doctor` just **warns** about it (the node itself is bound to a private address); `ainode doctor` **fails** when a `model_bind` is public, IPv6 global or a wildcard, and `serve` warns.
`trusted_networks: [100.64.0.0/10]` (optional, empty by default) lets you declare networks private yourself, for example Tailscale: addresses inside them are accepted as `bind` with
`network: private` and count as private for `model_bind` and `doctor`.
With `network: any`, `/health` answers only `{"status": "alive"}` (the node name is given on a private network).
Details and the full table are in [docs/architecture.md](docs/architecture.md#exposure-rule-and-security-modes).

### ๐Ÿ†” Identity and Wake-on-LAN
`node_identity` reports every network interface with its MAC, IPv4 address(es), the broadcast address of each network and a best-effort Wake-on-LAN state. `peers:` in `config.yaml` lists the
neighbours this node may wake (`name`, `mac` **in quotes**, `broadcast` = the subnet broadcast of the peer's LAN, for example `172.16.1.255`); `node_peers` lists them and `node_wake(peer)` (level 1,
refused in `read_only`) sends the magic packet from Python, to configured peers only. `ainode doctor` warns when the kernel's wake flag is off on the node's interface (and how to enable it)
and when a peer is on a network this node is not connected to.
`node_identity` also says which interface can really wake this node (`wake_paths`: wired, Wake-on-LAN `g`); a wifi or mobile-data MAC is never offered as a wake path. `node_suspend` (level 1, refused in `read_only`) stops the models and suspends the machine after 5 s; a magic packet to a wired port wakes it, and the answer says whether any wake path exists.
`bind` may be the **name of an interface** (`bind: eno1`): the node takes its IPv4 address at start, so a DHCP change does not leave the service "activating" (limit: the interface must have an address when the node starts).
`ainode gpus` (and `node_info.gpus_detected`, and `ainode doctor`) lists every `/dev/dri/renderD*` with its PCI vendor/device and the backend that would drive it; it never enables anything, you paste the block. Cards known not to work (Intel HD 4600) are shown as *seen but not usable*.
**A node cannot wake itself, and Wake-on-LAN does not cross networks**: to power on a PC on another network you need an always-on node or device on *its* LAN (another node, a Raspberry Pi),
or a smart plug with the BIOS "power on after AC loss" option, or the board's remote management. See [docs/architecture.md](docs/architecture.md#identity-wake-on-lan-and-neighbours).

#### ๐Ÿ”Ž Quick checks from another machine on the LAN
Replace the address and port:
```
curl http://172.16.2.20:8700/health
curl http://172.16.2.20:8700/api/node_info
curl http://172.16.2.20:8700/api/node_status
curl -X POST http://172.16.2.20:8700/api/preset_load_start -H 'Content-Type: application/json' -d '{"preset":"qwen","gpu":"0"}'
curl "http://172.16.2.20:8700/api/job_result?job_id=<job_id>&wait=40"
```
If a token is configured add `-H "Authorization: Bearer $(cat token.txt)"`. For an MCP client use `http://<address>:<port>/mcp` (streamable HTTP).