A federated AI agent on Matrix with openclawOS
Add Pi to your Matrix homeserver — end-to-end encrypted rooms, federated identity, sessions per room, all on your hardware.
- matrix
- federation
- tutorial
- e2ee
Matrix is the federated chat protocol the internet keeps wanting. If you self-host a homeserver (Synapse, Dendrite, Conduit), adding an AI agent that respects the federated, end-to-end encrypted model is the natural next step.
openclawOS pairs Matrix cleanly. Here’s the setup.
Setup
- Provision a Matrix account for the bot on your homeserver (e.g.,
@pi:matrix.example.com). - Get an access token from your client (Element → settings → Advanced → Access Token).
openclaw apps install matrix, paste the homeserver URL + access token.- Invite
@pi:your.serverto a room.
E2EE handshake
On the bot’s first appearance in an E2EE room, you’ll be prompted to verify Pi’s device — same flow as verifying any new Element device. openclawOS uses matrix-rust-sdk and speaks Olm/Megolm; verified sessions persist.
Sessions
Each Matrix room is its own session by default. Identity linking can bridge sessions across rooms if you want a single Pi memory across your federated identity.
Federation
Pi appears as a federated user. A Matrix user on another homeserver can interact with @pi:your.server and Pi responds, end-to-end encrypted. This is the closest thing to a true peer-to-peer AI assistant — federated identity, federated state, locally-decrypted execution.
Why bother
For self-hosted Matrix admins, openclawOS finishes the stack. You’ve already chosen “my data stays in my domain”; adding an AI that respects the same posture is just the next checkbox.
Frequently asked
Yes. openclawOS uses matrix-rust-sdk which speaks Olm/Megolm. Verify Pi's device the same way you'd verify any other device in your Matrix client.
Related reading
A private AI assistant on Signal — fully self-hosted
Signal is the most privacy-respecting mass-market messenger. Pair it with openclawOS for an AI agent that respects the same privacy posture, end to end.
How multi-channel AI agents actually work under the hood
A deep dive into the openclawOS kernel: routing, sessions, identity, memory and the tricky parts of making one agent feel coherent across WhatsApp, Telegram, Discord and the rest.