2026-03-28 23:50:54 -04:00

Matrix-Letta Bridge

A bridge connecting Letta AI agents to encrypted Matrix rooms using mautrix-python.

Features

  • End-to-end encryption (E2EE) - Full support via mautrix-python's OlmMachine
  • Reaction-to-feedback mapping - Matrix emoji reactions (thumbs up/down) are sent as feedback to Letta for preference learning
  • Persistent crypto store - SQLite-based storage for E2EE keys and session state
  • Cross-signing support - Optional recovery key for device verification

Setup

Prerequisites

  • Python 3.10+
  • A Matrix homeserver account
  • A Letta Cloud account and agent

Installation

python -m venv venv
source venv/bin/activate
pip install mautrix python-dotenv requests

Configuration

Create a .env file:

# Matrix
MATRIX_HOMESERVER=https://your-homeserver.example.com
MATRIX_USER_ID=@bot:your-homeserver.example.com
MATRIX_PASSWORD=your-bot-password
MATRIX_RECOVERY_KEY=  # Optional: for cross-signing verification

# Letta
LETTA_API_KEY=sk-let-...
LETTA_AGENT_ID=agent-...
LETTA_BASE_URL=https://api.letta.com/v1/

# Optional
BRIDGE_DB_URL=sqlite:store/bridge.db
CRYPTO_PICKLE_KEY=your-pickle-key

Running

python bridge-e2ee.py

Or install as a systemd service using meridian-bridge.service.

Reaction Feedback Mapping

Reaction Feedback
👍 👍 ❤️ 🎉 🙌 💯 positive
👎 👎 👀 😕 negative

Feedback is sent to Letta's /v1/steps/{step_id}/feedback endpoint via PATCH.

Architecture

  • bridge-e2ee.py - Main bridge script
  • sqlite_crypto_store.py - E2EE key storage implementation
  • store/ - Runtime data (SQLite databases, session state)

License

MIT

Description
Legacy Python Matrix bridge with E2EE - historical reference
Readme 1.1 MiB
Languages
Python 98.4%
Shell 1.6%