<!-- GENERATED by scripts/build-docs.mjs from the live Commander tree (src/cli/program.ts). Do not edit by hand. -->

# pai daemon

> PAI daemon management: serve, status, restart, install, uninstall, logs

## Synopsis

```
pai daemon <subcommand> [options]
```

## Subcommands

| Command | Description |
|---------|-------------|
| [`pai daemon serve`](#pai-daemon-serve) | Start the PAI daemon in the foreground |
| [`pai daemon migrate`](#pai-daemon-migrate) | Migrate federation data from SQLite to PostgreSQL |
| [`pai daemon status`](#pai-daemon-status) | Query the running daemon status |
| [`pai daemon restart`](#pai-daemon-restart) | Send SIGTERM to the running daemon (launchd will restart it) |
| [`pai daemon install`](#pai-daemon-install) | Install daemon as a launchd service and update ~/.claude.json to use the shim |
| [`pai daemon uninstall`](#pai-daemon-uninstall) | Remove the launchd service and revert to direct MCP |
| [`pai daemon keepalive`](#pai-daemon-keepalive) | Show interactive-session cache keepalive config, per-session beat counters, and recent ledger lines |
| [`pai daemon logs`](#pai-daemon-logs) | Tail the daemon log (/tmp/pai-daemon.log) |

### pai daemon serve

Start the PAI daemon in the foreground


### pai daemon migrate

Migrate federation data from SQLite to PostgreSQL

**Options**

| Option | Description | Default |
|--------|-------------|---------|
| `--connection-string <url>` | Postgres connection string (default: from config or postgresql://pai:pai@localhost:5432/pai) |  |


### pai daemon status

Query the running daemon status


### pai daemon restart

Send SIGTERM to the running daemon (launchd will restart it)


### pai daemon install

Install daemon as a launchd service and update ~/.claude.json to use the shim


### pai daemon uninstall

Remove the launchd service and revert to direct MCP


### pai daemon keepalive

Show interactive-session cache keepalive config, per-session beat counters, and recent ledger lines


### pai daemon logs

Tail the daemon log (/tmp/pai-daemon.log)

**Options**

| Option | Description | Default |
|--------|-------------|---------|
| `-n, --lines <n>` | Number of lines to show | `50` |
| `-f, --follow` | Follow log output (like tail -f) |  |


## See also

[`pai audit`](audit.md) · [`pai backup`](backup.md) · [`pai clear-names`](clear-names.md) · [`pai config`](config.md) · [`pai db`](db.md) · [`pai end`](end.md) · [`pai help`](help.md) · [`pai identity`](identity.md) · [`pai kg`](kg.md) · [`pai launch`](launch.md) · [`pai mcp`](mcp.md) · [`pai memory`](memory.md) · [`pai notify`](notify.md) · [`pai observation`](observation.md) · [`pai obsidian`](obsidian.md) · [`pai pause`](pause.md) · [`pai project`](project.md) · [`pai projects`](projects.md) · [`pai registry`](registry.md) · [`pai restore`](restore.md) · [`pai session`](session.md) · [`pai sessions`](sessions.md) · [`pai setup`](setup.md) · [`pai shell-init`](shell-init.md) · [`pai skill`](skill.md) · [`pai task`](task.md) · [`pai topic`](topic.md) · [`pai update`](update.md) · [`pai worker`](worker.md) · [`pai zettel`](zettel.md)

Run `pai help <area>` to read any of these in the terminal.

