pi-daemon1.3

Reference

Using Pi Daemon from Culture

Culture (TUI, web, Android and Apple) connects to Pi Daemon directly over AHP. No Paratenic hop or connector is needed: Culture is multi-host, and Pi Daemon is one more host, configured with a URL and a bearer file.

Host entry

Add the daemon to Culture's ~/.config/culture/config.yaml:

hosts:
  - id: pi
    label: Pi Daemon
    url: ws://127.0.0.1:7463/ahp
    token_file: ~/.local/state/pi-daemon/api-token
    default_working_directory: file:///home/me/src
  • url is the daemon's listener with the path /ahp. Use the instance's port for a named instance.
  • token_file is the daemon's bearer file: the generated STATE_DIR/api-token, or the tokenFile you configured. Culture rereads it on every connection and requires it to be owner-only, so pointing it at the daemon's own file works when Culture runs as the same user. Otherwise copy the bearer into an owner-only file for Culture; never paste it into chat or argv.
  • default_working_directory should be under one of the profile's cwdRoots; session creation outside them is refused.

culture config validate checks the file. Culture speaks AHP 0.8.0. Pi Daemon speaks AHP 1.0 and still serves 0.8.0 to clients that offer only it, in 0.8 shapes, so Culture keeps working while it moves to 1.0 (AHP 1.0 with a 0.8 fallback).

What you see

  • Each profile is an agent (RootState.agents) named after the profile. A new session picks one; with a single profile it is the default.
  • The new-session form asks for cwd, model (provider/model) and thinking, with the profile's defaults filled in.
  • Each Pi Daemon session is one Culture session whose root conversation is its chat. Its history pages from the session's Durable store, and a running turn streams text, reasoning, tool calls (with their arguments and running output) and usage. Tool calls a profile requires approval for wait for Culture's approve or deny.
  • The session list shows each session working, waiting for an answer, unread or archived. Marking a session read or archived, switching its default chat, and a chat's draft are kept by the daemon across restarts.
  • Creating, switching and deleting chats works as with Paratenic; a deleted chat's history stays in the session's store.
  • The files a chat's write and edit calls changed show as its changeset, with each file's diff; Culture reverts a file or the whole changeset.
  • A session shows its profile's MCP servers with their state, which Culture can stop and start, and its tools, skills, prompt templates and extensions.
  • Deleting a session in Culture deletes its store and catalog entry.

Culture's Paratenic conventions (paratenic.pi turn metadata, the virtual://paratenic/feed resource, paratenic.identity) are optional. Pi Daemon does not provide them, and Culture works without them.

See Operations for the exact AHP subset the daemon implements. Commands it does not implement answer MethodNotFound and are not advertised.

Reaching it from another machine

The listener is plain HTTP on loopback by default. For Culture on another device (Android, another laptop), choose one:

  • Tailnet. Bind the tailnet address (services.pi-daemon.api.bind = "100.x.y.z", with allowInsecureHttp = true), and in Culture use ws://100.x.y.z:7463/ahp with allow_plaintext_non_loopback: true.
  • TLS proxy. Keep the loopback bind and put a TLS reverse proxy in front of it that forwards WebSocket upgrades and the Authorization header. In Culture use wss://host.example/ahp.

Every client of an instance shares its bearer and sees all its sessions.