> ## Documentation Index
> Fetch the complete documentation index at: https://psychiatrist.sudo.la/llms.txt
> Use this file to discover all available pages before exploring further.

# The server client

> Drive the local psychiatrist server, one practice per repo, from TypeScript.

> [!NOTE]
>
> Planned: #34. The shape below is settled ([ADR 0006](https://github.com/psychiatrist/psychiatrist/blob/main/docs/adr/0006-core-server-and-clients.md)); it is not in the package yet.

`@psychiatrist/server` is one local process that runs a practice per added repo. It listens only on 127.0.0.1, on a port recorded in `~/.psychiatrist`, and refuses any request without the bearer token kept there (made on first start, readable only by you). The terminal UI and the web app are its clients, and so can your code be: a typed client at `@psychiatrist/core/client`.

* **Commands over HTTP:** add and remove repos, and every [practice command](https://psychiatrist.sudo.la/sdk/practice.md) (approve, reject, answer, chat, guide, pause, resume, run, reset and the rest), with the same typed errors.
* **Events over a WebSocket:** a snapshot of each practice's state first, then its typed events (`job`, `agent`, `hitl`, `activity`, `reset`).
* **Agent transcripts** through the API.
* **The schemas** both sides use live in core, as zod.

`psychiatrist server start|stop|status|logs` manages it (its log at `~/.psychiatrist/server.log`), and the CLI starts it, detached, when it is not running.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.