// feature

Single-File Architecture
amux is One Python File (2026)

amux’s entire server, dashboard, and REST API live in a single Python file (amux-server.py). No external dependencies beyond Python 3 and tmux. Self-heals by restarting itself on file save. Deploy in under 2 minutes.

Last updated: July 11, 2026

Quick answer: amux is a single Python file (amux-server.py) that contains the HTTP server, REST API, SSE backend, web dashboard (HTML/CSS/JS inline), SQLite database, self-healing watchdog, and all business logic. Zero external Python dependencies — if you have Python 3 and tmux, you can run amux. The file watches its own mtime and restarts itself when you change it, so deploying a new version is git pull && touch amux-server.py.

What lives inside a single file

Why single-file?

Technical implementation

amux uses Python’s http.server.BaseHTTPRequestHandler as the server base. Routing is a single if/elif chain on self.path. SQLite handles all persistent storage via Python’s stdlib sqlite3 module. Server-sent events (SSE) are streamed over persistent HTTP connections. The web dashboard — all HTML, CSS, and JavaScript — is stored as Python string constants and served inline.

Self-restart mechanism: A background thread checks the server file’s mtime every few seconds. When a change is detected, it calls os.execv(sys.executable, [sys.executable] + sys.argv), replacing the process with a fresh copy that picks up the new code. The ~/.amux/server.env file loads environment variables at startup via os.environ.setdefault, so they survive across restarts.

Deployment comparison

Deploy methodStepsDependenciesRestart on update
amux single filegit clone && python3 amux-server.pyPython 3 + tmuxtouch amux-server.py (auto)
Typical web appInstall packages, build assets, configure serverpip/npm/cargo + dozens of packagesRestart service manually
DockerBuild image, run containerDocker daemon + base imageRebuild and redeploy image
Cloud agent (Devin etc.)Sign up, no deployNone (not self-hosted)N/A

Contributing

Because amux is one file, contributions are a single PR touching amux-server.py. The pattern for a new REST endpoint:

elif self.path.startswith('/api/myendpoint'):
    data = json.loads(self.rfile.read(...))
    result = do_something(data)
    return self._json(result)

The file is organized into sections with clear comment headers: # ── SESSIONS ──, # ── BOARD ──, # ── EMAIL ──, etc. Most contributions are 10–50 lines. Verify syntax after editing: python3 -c "import ast; ast.parse(open('amux-server.py').read())"

Frequently asked questions

How many lines of code is amux?

amux is a single Python file (amux-server.py) containing the complete HTTP server, REST API, SSE backend, web dashboard (HTML/CSS/JS inline), SQLite layer, self-healing watchdog, and all business logic. The entire AI agent control plane is in one file.

Does amux require any Python packages?

No. amux uses only Python’s standard library. The only system requirements are Python 3.8+ and tmux. There is nothing to pip install.

How does amux auto-restart when the file changes?

The server uses os.execv to replace itself with a fresh process when it detects its own file has changed (mtime check every few seconds). This means touch amux-server.py or any file edit triggers a hot restart automatically — no service restart command needed.

Is it hard to contribute to a large single file?

The file is organized into sections with clear comment headers. Adding a new REST endpoint is a single if self.path.startswith(...) block. Most contributions are 10–50 lines. The entire codebase is visible at once — no jumping between modules.

Is this architecture production-grade?

For a developer tool running on a single machine managing a local agent fleet — yes. amux is designed to be reliable, fast to deploy, and easy to understand. It is not designed to serve thousands of concurrent requests, but it comfortably handles dozens of agent sessions and multiple browser tabs simultaneously.

Run your AI engineering team from one dashboard

amux is an open-source control plane for AI coding agents — self-healing, phone-first, MIT licensed, single Python file.

git clone https://github.com/mixpeek/amux && cd amux && ./install.sh
amux register myproject --dir ~/Dev/myproject --yolo
amux start myproject
amux serve  # → https://localhost:8822
⭐ Star on GitHub Get started

Related guides