Skip to main content
Glama
README.md
<div align="center">

# tonik

**Let your AI agents speak short status summaries aloud — queued and played offline in a minimal bottom-screen pill, so you don't have to read walls of logs.**

[![Python 3.11-3.14](https://img.shields.io/badge/python-3.11--3.14-0A0A0A?style=flat-square&logo=python&logoColor=white)](https://www.python.org/)
[![uv](https://img.shields.io/badge/uv-PEP%20723-EF4444?style=flat-square)](https://docs.astral.sh/uv/)
[![Supertonic TTS](https://img.shields.io/badge/TTS-Supertonic%20ONNX-0A0A0A?style=flat-square)](https://pypi.org/project/supertonic/)
[![FastMCP](https://img.shields.io/badge/MCP-FastMCP-EF4444?style=flat-square)](https://modelcontextprotocol.io/)
[![License: PolyForm-NC-1.0.0](https://img.shields.io/badge/license-PolyForm--NC--1.0.0-0A0A0A?style=flat-square)](LICENSE)

<br />

<img src="assets/demo.gif" alt="tonik bottom-pill demo" width="560" />

</div>

---

## Why tonik

- **No Electron, no bloat** — pure Python + PySide6 frameless pill (`420 × 58`) in matte black, red, and white.
- **Zero `.venv` pollution** — PEP 723 inline dependencies runnable anywhere with `uv run --no-project`.
- **0% CPU idle daemon** — `tonik serve` sleeps in your Windows `Default` desktop, slides up on speech, and drains a FIFO queue (`+N`).
- **Agent-native via FastMCP** — `mcp_server.py` exposes `speak` and `status` tools so AI agents deliver short, humanized spoken reports.
- **Offline & fast** — runs locally on CPU via Supertonic ONNX (`en`, `pl`, `ru` and 28 more languages).

## Platform Support

| Platform | Status | Notes |
| :--- | :--- | :--- |
| **Windows 10/11** | Verified | Bottom pill UI, audio, `Startup` `.vbs`, and FastMCP verified. |
| **Linux (X11/Wayland)** | Experimental (RC) | Headless CI verified (`autostart` `.desktop`, `serve`/`status`/`stop`); live desktop UI &amp; PulseAudio/PipeWire pending verification. |
| **macOS** | Untested | Not tested; `autostart` not implemented yet. |

## Quick Start

### Option 1: Install as global CLI tools via `uv` (recommended)

```powershell
uv tool install git+https://github.com/CosmoVoxel/tonik.git
```

This installs two global commands on your `PATH` (`tonik` and `tonik-mcp`):

```powershell
tonik "Build finished. Three files updated."
tonik serve
tonik autostart install
tonik doctor
```

### Option 2: Standalone binaries (no Python or `uv` required)

Download the prebuilt executables from [GitHub Releases](https://github.com/CosmoVoxel/tonik/releases):
- **Windows**: `tonik-windows-amd64.exe` and `tonik-mcp-windows-amd64.exe`
- **Linux**: `tonik-linux-amd64` and `tonik-mcp-linux-amd64`

### Option 3: One-line script installer (`uv run`)

**Windows (PowerShell):**
```powershell
irm https://raw.githubusercontent.com/CosmoVoxel/tonik/main/install.ps1 | iex
```

**Linux (sh):**
```sh
curl -fsSL https://raw.githubusercontent.com/CosmoVoxel/tonik/main/install.sh | sh
```

**Common commands:**
```powershell
# Pipe multi-line text from stdin
"Build finished." | uv run --no-project tonik.py

# Start user-session daemon in background (recommended for MCP + desktop UI)
powershell -ExecutionPolicy Bypass -File tonik.ps1 serve

# Auto-start daemon on Windows/Linux login
uv run --no-project tonik.py autostart install
```

## Daemon Lifecycle

```mermaid
stateDiagram-v2
    [*] --> off
    off --> idle: tonik serve
    idle --> working: speak() / CLI request
    working --> working: queued (+N)
    working --> idle: queue empty
    idle --> off: tonik stop
```

## Controls & CLI

| Action / Flag | Behavior |
| :--- | :--- |
| `Space` | Pause / resume playback |
| `Esc` or red `✕` | Stop playback and clear queue |
| Drag pill | Reposition anywhere on screen |
| `--voice` | `M1`–`M5` (male), `F1`–`F5` (female) |
| `--lang` | `en`, `pl`, `ru` (auto-detected if omitted) |
| `--speed` / `--no-ui` / `--save` | Rate multiplier, headless audio, or WAV export |

<details>
<summary>All CLI commands &amp; MCP configuration</summary>

```powershell
uv run --no-project tonik.py serve --warm      # Foreground daemon with preloaded model
uv run --no-project tonik.py status            # Check state: off | idle | working
uv run --no-project tonik.py stop              # Stop running daemon
uv run --no-project tonik.py autostart status  # Check Windows Startup entry
uv run --no-project tonik.py doctor --test-audio
uv run --no-project tonik.py voices
uv run --no-project tonik.py devices
uv run --no-project tonik.py update
uv run --no-project --refresh tonik.py doctor
```

Add to `~/.gemini/config/mcp_config.json` (using `tonik-mcp` from Option 1/2, or `uv run`):

```json
{
  "mcpServers": {
    "tonik": {
      "command": "tonik-mcp"
    }
  }
}
```

> **Windows Desktop Isolation**: Sandboxed agent shells run on a hidden desktop (`exebox-...`), so GUI windows spawned from inside an agent shell do not appear on your screen. Start `tonik serve` (or `autostart install`) in your own `Default` desktop session so MCP calls pop up the pill.

</details>

## Documentation

| Doc | Purpose |
| :--- | :--- |
| [ARCHITECTURE.md](ARCHITECTURE.md) | Module layout, `PillState` classes, `QLocalServer` IPC, and desktop isolation |
| [AGENTS.md](AGENTS.md) | Agent workflow: MCP `status` -> `speak`, `humanizer`, `en`/`pl`/`ru` policy |
| [CLAUDE.md](CLAUDE.md) | Quick rules and verification commands for AI coding assistants |
| [LLM.txt](LLM.txt) | Compact machine-readable project index |
| [CONTRIBUTING.md](CONTRIBUTING.md) | Contribution guidelines (AI-assisted PRs welcome) |
| [LICENSE](LICENSE) | PolyForm Noncommercial 1.0.0 (free to use, no resale/commercial use) |