Skip to content

Run as a service

Service mode keeps the same daemon, HTTP app, Automations dispatcher, supervision loop, and memory consolidation running after the foreground shell closes. It does not itself make Agents act; automatic work still needs an enabled Automation trigger.

The built-in manager supports a systemd user unit on Linux and a launchd user agent on macOS.

  1. Validate the current user’s configuration:

    Terminal window
    axocoatl validate
  2. Install the service definition:

    Terminal window
    axocoatl service install
  3. If the configuration contains environment placeholders, inject those values through the service manager. A literal key supplied during onboarding needs no separate environment injection.

  4. Start it and enable it at login:

    Terminal window
    axocoatl service start
    axocoatl service status
  5. Print the browser sign-in link. The service does not print it, so the token stays out of its logs:

    Terminal window
    axocoatl url

    For a service installed with --config, pass the same path, and the same AXOCOATL_DATA_DIR if the service sets one.

Install resolves both the current axocoatl executable and the config file to absolute paths. The default service uses the same user configuration and data root as foreground commands. An explicit --config keeps advanced local mode; its data defaults to <config-directory>/data unless AXOCOATL_DATA_DIR overrides it.

A service manager starts the daemon with its own minimal environment, not your shell’s. launchd, for example, gives a LaunchAgent only /usr/bin:/bin:/usr/sbin:/sbin on its PATH, which does not contain a Homebrew Podman in /opt/homebrew/bin. Install therefore writes into the definition:

  • PATH: the directory of the podman that your shell finds at install time, then the directories of the git and gh it finds, which Keep as PR runs, followed by /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin;
  • CONTAINER_CONNECTION and CONTAINER_HOST, when they are set at install time, so the service uses the same Podman connection as your shell. A CONTAINER_HOST that contains a password is not recorded.
  • AXOCOATL_SOCKET_PATH, when it is set to an absolute path at install time, so the service’s daemon listens on the IPC socket your commands use. Set it when the default socket path, ~/.axocoatl/run/axocoatl.sock (or $XDG_RUNTIME_DIR/axocoatl/axocoatl.sock), is longer than a Unix socket path may be: 103 bytes on macOS, 107 on Linux. Install warns when the service’s daemon could not start for that reason.

Install prints what it recorded and warns when it found no podman. It never writes provider keys or other secrets into the definition. Run axocoatl service install again after you move Podman, git or gh, or change the Podman connection. If the service was running, load the new definition with axocoatl service restart.

On macOS the daemon’s output goes to ~/Library/Logs/Axocoatl/daemon.log. When they do not exist yet, install creates that directory owner-only and the file with mode 0600; an existing log is kept. On Linux the output goes to the user journal. The service log never contains the sign-in link: serve writes only a hint to run axocoatl url.

For an explicit configuration, validate and install it deliberately:

Terminal window
axocoatl validate /absolute/path/to/axocoatl.yaml
axocoatl service install --config /absolute/path/to/axocoatl.yaml

Axocoatl interpolates process environment variables in YAML and does not load dotenv files. The generated service unit/plist does not inject provider keys. This section applies only when the active configuration retains an environment placeholder.

Create a root-readable-by-you-only environment file, then add it through a user-unit override:

[Service]
EnvironmentFile=/absolute/path/to/axocoatl.env
Environment=AXOCOATL_DATA_DIR=/absolute/path/to/axocoatl-data

Open the override with systemctl --user edit axocoatl, then apply it:

Terminal window
systemctl --user daemon-reload
systemctl --user restart axocoatl

On Linux, run the hint printed by install when the daemon must survive logout:

Terminal window
loginctl enable-linger "$USER"
Terminal window
axocoatl service status
axocoatl service stop
axocoatl service start
axocoatl service restart
axocoatl service uninstall

status says whether the daemon runs and, when its last start failed, the line that start logged, also while launchd or systemd is starting it again. start starts a service that does not run and leaves one that runs as it is. restart stops a running service and starts it again with the installed definition, which is how a definition install rewrote, or a new axocoatl binary at the same path, takes effect; it starts a service that does not run. Both wait until the daemon says it started (up to 60 seconds). When its start fails (an invalid configuration, a port in use, a data directory it refuses), they exit with status 1 and print the line the daemon logged; launchd and systemd keep starting it again until you fix the cause and run axocoatl service restart. stop returns once the daemon has exited and leaves the definition installed. The daemon ends its turns and Sessions first: launchd gives it 60 seconds, the most it allows, and systemd 90 seconds, its default, before they kill it. A daemon that was killed leaves Session containers, which the next start removes. uninstall stops the service, as stop does, and removes the definition.

Stopping or restarting the service leaves a Podman machine the daemon started running: Axocoatl starts podman machine start in a session of its own, outside the daemon’s process group, which launchd ends with the daemon.

For platform logs:

Terminal window
journalctl --user -u axocoatl --since today

axocoatl service status also prints where the logs are.

For an interactive diagnostic run, stop the service first so it releases the per-user IPC socket, then run:

Terminal window
RUST_LOG=debug axocoatl dev

Pass --config /absolute/path/to/axocoatl.yaml as well only when diagnosing an explicit advanced configuration.

Next: Data and backup →