Documentation menu
DocsReference

Standalone daemon

Download, verify, and install aitd to access a headless Linux or macOS working host through Online Service or over your LAN.

Every Ait stable release includes standalone daemon archives containing a single executable, aitd. Use it on hosts that do not need a desktop interface, such as cloud servers, build machines, or an always-on Mac mini. Once it runs in unattended mode and signs in to your Ait account, the host appears in the online host list, and you can connect to it from the desktop, Android, iOS, or Web clients.

Version scope: the download and service examples below target v0.2.26 and use run. Older versions such as v0.1.20 used run --headless. Follow the migration below when upgrading and keep startup arguments consistent with your version.

This page uses two terms:

  • Standalone daemon is how you get it: the aitd program, downloaded separately instead of installed with the desktop app. It is the same program the desktop app bundles.
  • Unattended operation is how it runs: authorize the machine with aitd login, then start it with aitd run. The daemon stays online through account relay without anyone at the machine and reconnects automatically after restarts.

Starting with 0.1.22, direct startup, run, and desktop startup use the same lifecycle. The local API remains available before sign-in, and the daemon maintains online connections after machine authorization. Remove --headless from older startup scripts. See Server configuration for the listener, data directory, and local API token.

Computers with the desktop app do not need it. The desktop app includes the daemon and manages its lifecycle, using the same machine authorization and online connection flow.

Current source and upgrades

Starting with 0.1.30, standalone archives and the desktop bundle use aitd as the executable name. When upgrading an existing service, keep its service name and change systemd ExecStart or launchd ProgramArguments to /usr/local/bin/aitd, then reload and restart it. Remove the old /usr/local/bin/ait-daemon only after confirming the new path is in use.

Experimental Bot data change: at startup, 0.1.30 discards legacy Bot configurations, Channels, Conversations and history without migration. Back up the daemon data directory before upgrading and starting if you need that data. Old workspace .ait/bots/ memory files are not automatically removed. See the 0.1.30 release notes.

Current standalone and desktop-bundled daemons share one authorization and publication flow:

aitd login
aitd run

The --headless flag has been removed. After upgrading to a build with this change, remove it from tmux commands, systemd ExecStart, and launchd ProgramArguments, then reload the service configuration. Check aitd --version and aitd run --help before starting.

Every startup path generates and reuses <data-dir>/local-api.token when AIT_SERVER_TOKEN is absent. The daemon owns machine authorization, lease renewal, and reconnects. Quitting a client does not revoke authorization; explicitly disconnecting the host clears it. Source builds produce target/release/daemon. See Local development, Server configuration, and the daemon manual for the current setup.

The download and service examples below use v0.2.26. Use the assets and arguments for your release when running another version.

Requirements

Platform Archive Requirements
Linux x86_64 daemon-linux-x64 glibc 2.28 or later, such as Ubuntu 20.04, Debian 10, RHEL / Rocky / AlmaLinux 8, or newer
macOS Apple Silicon daemon-macos-arm64 macOS 13 or later; the executable is signed and notarized by Apple

You also need:

  • Online Service requires an Ait account shared with the connecting client. Direct LAN access uses the daemon’s access token.
  • At least one agent CLI installed and signed in on this host. See Agent setup.

Download (v0.2.26)

Platform GitHub release China download mirror
Linux x86_64 Ait-0.2.26-daemon-linux-x64.tar.gz COS download
macOS Apple Silicon Ait-0.2.26-daemon-macos-arm64.tar.gz COS download

Both locations serve identical files. The SHA256SUMS checksum file is published only on the GitHub release. Archives for other versions use the same names on all releases.

Install

These commands download the archive from GitHub, verify its checksum, and install aitd to /usr/local/bin. In mainland China, you can replace the first curl URL with https://download.aitapp.cn/v${VERSION}/${ASSET}.

Linux

VERSION=0.2.26
ASSET="Ait-${VERSION}-daemon-linux-x64.tar.gz"
curl -fLO "https://github.com/ait-app/ait/releases/download/v${VERSION}/${ASSET}" &&
curl -fLO "https://github.com/ait-app/ait/releases/download/v${VERSION}/SHA256SUMS" &&
awk -v asset="$ASSET" '$2 == asset' SHA256SUMS | sha256sum -c - &&
tar -xzf "${ASSET}" &&
sudo install -m 0755 aitd /usr/local/bin/aitd &&
aitd --version

macOS

VERSION=0.2.26
ASSET="Ait-${VERSION}-daemon-macos-arm64.tar.gz"
curl -fLO "https://github.com/ait-app/ait/releases/download/v${VERSION}/${ASSET}" &&
curl -fLO "https://github.com/ait-app/ait/releases/download/v${VERSION}/SHA256SUMS" &&
awk -v asset="$ASSET" '$2 == asset' SHA256SUMS | shasum -a 256 -c - &&
tar -xzf "${ASSET}" &&
sudo mkdir -p /usr/local/bin &&
sudo install -m 0755 aitd /usr/local/bin/aitd &&
aitd --version

A successful check prints OK. If it prints nothing or reports FAILED, delete the downloaded files and download them again before installing.

In this release, both the packaged program and its command-line help use aitd.

Run in unattended mode

Authorize this machine first, then start the daemon in unattended mode. Run these commands as the same system user that will run the daemon:

aitd login
aitd run

login prints a web address and a verification code. Open the address in a browser on any device, sign in to your Ait account, enter the code, and confirm this machine.

The online host list uses the system hostname as this machine’s name by default. To use a different name, add --name when signing in, for example aitd login --name my-server.

After authorization, run connects to the official account service at https://aitapp.cn/api and listens locally on 127.0.0.1:7316. Later restarts restore the authorization without signing in again. Sign in to the same account on another device and choose this host from the online host list; see Connections & data.

If opening a browser is inconvenient, issue a single-use enrollment token from the host details page on the web, then sign in through standard input:

aitd login --token-stdin

Supply the single-use token issued on the Web host details page on standard input. When entering it interactively, paste the token, press Enter, then press Ctrl-D to send EOF. For automation, pass it through a protected input stream. Then start aitd run.

Check authorization and runtime status:

aitd status --json

New installations use ~/.ait. Without an explicit data directory, the daemon chooses the first existing path in this order: ~/.ait, ~/.ait-server-desktop, ~/.ait-server. Existing directories are not moved or merged; use --data-dir to keep a specific location. The selected directory holds the machine authorization, the local API token, and work data. See Server configuration for the listen address, data directory, and other options.

Connect over LAN without signing in

  1. Set the listener. Standalone aitd listens on 127.0.0.1:7316 by default. Run it as the user that runs your agents and replace the example IP with your working host’s LAN address. You can also use AIT_SERVER_LISTEN=192.168.1.10:7316 aitd run. If tmux or systemd already manages it, stop the existing process, update its startup command, and start it again.

    aitd run --listen 192.168.1.10:7316
  2. Get the access token. After startup, read local-api.token from the active data directory. On a fresh installation, use cat ~/.ait/local-api.token. For an existing installation, use its actual directory. If you set AIT_SERVER_TOKEN at startup, enter that value in the client. It takes precedence and leaves the file intact. A custom token needs 32–256 visible ASCII characters without spaces. You can generate one with openssl rand -hex 32.

  3. Allow access from your trusted subnet. If a host firewall is active, allow TCP 7316 from the client subnet only. The UFW example below uses a sample subnet. Replace it with yours.

    sudo ufw allow from 192.168.1.0/24 to any port 7316 proto tcp
  4. Connect the client. In the desktop or mobile app, choose Add host → Direct connection. Enter the working host’s IP in Host, 7316 in Port, and the access token in Server token. Enable Use SSL only with a TLS terminator in front of the daemon.

Binding 0.0.0.0:7316 listens on all IPv4 interfaces. Clients still use a reachable host IP. The built-in listener runs without TLS, so keep the port off the public internet. On an untrusted network, keep the loopback listener and use an SSH tunnel or Online Service. With a trusted VPN, bind the listener to the VPN interface. Ait for Web at aitapp.cn connects through Online Service only.

Keep it running

aitd run runs in the foreground and exits when you close the terminal or the SSH connection drops.

The fresh-install examples below use aitd for the program, tmux session, systemd service, and log names. Hosts upgraded from an older release can keep their existing names; only the startup path needs to change to /usr/local/bin/aitd.

tmux is the simplest option. The daemon keeps working after you disconnect, and you can return to the session to read its logs:

tmux new -s aitd
aitd run

Press Ctrl-b, then d, to detach; the daemon keeps running. Reattach later with tmux attach -t aitd, and press Ctrl-c in the session to stop it. If tmux is not installed, use your distribution’s package manager on Linux (for example, sudo apt install tmux) or brew install tmux on macOS.

tmux sessions do not survive a host restart. To start the daemon automatically at boot, use systemd or launchd instead.

Persistent start: systemd on Linux

Create a systemd user service as the user who will run your agents:

mkdir -p ~/.config/systemd/user
cat > ~/.config/systemd/user/aitd.service <<'EOF'
[Unit]
Description=Ait daemon

[Service]
ExecStart=/usr/local/bin/aitd run
Restart=on-failure
RestartSec=5
Environment=PATH=%h/.local/bin:/usr/local/bin:/usr/bin:/bin

[Install]
WantedBy=default.target
EOF
systemctl --user daemon-reload
systemctl --user enable --now aitd
sudo loginctl enable-linger "$USER"

enable-linger starts the service at boot even when the user is not logged in. Follow its logs with journalctl --user -u aitd -f.

Persistent start: launchd on macOS

Create a LaunchAgent as the same user that completed login:

mkdir -p ~/Library/LaunchAgents ~/Library/Logs
cat > ~/Library/LaunchAgents/com.ait-app.aitd.plist <<EOF
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
  <key>Label</key><string>com.ait-app.aitd</string>
  <key>ProgramArguments</key>
  <array>
    <string>/usr/local/bin/aitd</string>
    <string>run</string>
  </array>
  <key>EnvironmentVariables</key>
  <dict>
    <key>PATH</key><string>$HOME/.local/bin:/opt/homebrew/bin:/usr/local/bin:/usr/bin:/bin</string>
  </dict>
  <key>RunAtLoad</key><true/>
  <key>KeepAlive</key><true/>
  <key>StandardOutPath</key><string>$HOME/Library/Logs/aitd.log</string>
  <key>StandardErrorPath</key><string>$HOME/Library/Logs/aitd.log</string>
</dict>
</plist>
EOF
launchctl bootstrap "gui/$(id -u)" ~/Library/LaunchAgents/com.ait-app.aitd.plist

A LaunchAgent runs after its user logs in. To keep a Mac online with nobody logged in, turn on automatic login for that user. Logs go to ~/Library/Logs/aitd.log.

systemd and launchd do not read shell configuration such as ~/.bashrc or ~/.zshrc, so their PATH may differ from your terminal. If an agent is installed elsewhere (for example, a global npm directory or nvm), add that directory to the PATH above, or set an absolute program path with variables such as AIT_SERVER_CODEX_BIN; see Server configuration. tmux inherits your terminal environment and usually needs no extra setup.

Stop and start

The table uses the aitd names from the fresh-install examples. If you kept an older service name, label, plist path, or log path, substitute it in these commands.

Method Stop Start
tmux Press Ctrl-c in the session Run aitd run in the session
systemd systemctl --user stop aitd systemctl --user start aitd
launchd launchctl bootout "gui/$(id -u)/com.ait-app.aitd" launchctl bootstrap "gui/$(id -u)" ~/Library/LaunchAgents/com.ait-app.aitd.plist

Upgrade

Repeat the installation steps with the new VERSION, then restart the daemon as described in Stop and start; with systemd you can also run systemctl --user restart aitd. Upgrading keeps the machine authorization and data directory. You do not need to sign in again.

Reauthorize, sign out, and uninstall

Before signing in, reauthorizing, or signing out, stop the daemon that uses the same data directory as described in Stop and start, then start it again when you are done.

  • When authorization is no longer valid, status shows reauthorization_required. Stop the daemon, run aitd login, then start it again. Use aitd login --force to replace an authorization deliberately.
  • aitd logout revokes this machine’s authorization and clears local credentials. If the account service is unreachable, follow the prompt to revoke it from the host details page on the web.
  • To uninstall, sign out, disable any systemd or launchd service and delete its service file, then delete /usr/local/bin/aitd. The data directory is not deleted automatically. It is ~/.ait for new installations, the existing ~/.ait-server-desktop or ~/.ait-server directory the daemon selected, or the path given with --data-dir; remove it manually when you no longer need it.

See the unattended daemon guide for authorization recovery, credential files, and status fields.

Support Ait developmentIf Ait helps you, a voluntary tip supports its continued development.Tip via WeChat
WeChat appreciation code for Ait development

Scan with WeChat, or save the code and open it in WeChat to scan. Thank you for your support.

View / save the code