Skip to content

feat(matrix): Matrix chat integration surface — bridge, wormhole, shell commands - #52

Merged
mdheller merged 1 commit into
mainfrom
feat/matrix-bridge
Aug 4, 2026
Merged

feat(matrix): Matrix chat integration surface — bridge, wormhole, shell commands#52
mdheller merged 1 commit into
mainfrom
feat/matrix-bridge

Conversation

@mdheller

@mdheller mdheller commented Aug 4, 2026

Copy link
Copy Markdown

Summary

TurtleTerm as a first-class integration surface for Matrix chat — mesh events flow into rooms, shell output can be shared directly, and magic-wormhole enables one-shot encrypted file transfer without pre-shared secrets.

New: turtle-matrix-bridge

Command What it does
turtle-matrix-bridge daemon <room> Tails memory-mesh JSONL, forwards shell events to room
mx <message> Post plain text to default Matrix room
mxf <file> Post file as syntax-highlighted code block
mxw <file> Wormhole-send file, post the receive code to the room
mxr <code> Wormhole-receive by code, post result path to room
mxstatus Homeserver connectivity + wormhole binary check

Magic Wormhole

mxw / mxr use the system wormhole or wormhole-william binary (MIT). No pre-shared secrets — PAKE-based one-time code (7-coconut-harbor-storm). The receive code is posted back to the Matrix thread so any room member can run wormhole receive <code> or !qes wormhole recv <code> from their own session.

Forwarded mesh events (default)

cloudshell-connect · k3s-tunnel-start · split-view · error-triage · note-saved · runbook-run

Configurable via MATRIX_BRIDGE_EVENTS env var or ~/.config/sourceos/matrix.yaml.

Keybindings

Key Action
CMD+SHIFT+ALT+M mx (compose message prefix in terminal)
CMD+SHIFT+ALT+W mxw (wormhole-send prefix)

Dashboard

New Matrix badge in the status bar — green when the bridge daemon PID is alive, red otherwise.

Config

~/.config/sourceos/matrix.yaml:

MATRIX_HOMESERVER_URL: https://matrix.org
MATRIX_ACCESS_TOKEN: syt_...
MATRIX_BOT_ROOM_ID: "!abc123:matrix.org"

Companion PRs

  • prophet-platform #1404matrix-qes-operator shell dispatch verbs (!qes cloudshell, !qes k3s, !qes runbook, !qes noe, !qes wormhole)
  • prophet-platform #1405matrix-shell-integration appservice receiver + homeserver client

Test plan

  • mxstatus — shows config; reports wormhole binary found/missing
  • mx "hello from TurtleTerm" — message appears in Matrix room
  • mxf ~/.zshrc — zshrc posted as code block with syntax highlight
  • mxw /tmp/testfile.txt — wormhole code printed + posted to room
  • mxr <code> — file received, result posted to room
  • Start daemon: Matrix badge in dashboard turns green
  • csh → Matrix room gets 🔗 Cloudshell connected event
  • ktunnel start → Matrix room gets 🚇 k3s tunnel open event

…ll commands

turtle-matrix-bridge binary:
  - Daemon tails memory-mesh JSONL and forwards shell events to a Matrix room
    (cloudshell-connect, k3s-tunnel-start, split-view, error-triage, note-saved,
    runbook-run forwarded by default — configurable via MATRIX_BRIDGE_EVENTS)
  - `send <text>`            — post plain text to default room
  - `send-file <path>`       — post file as a syntax-highlighted code block
  - `wormhole-send <path>`   — start magic-wormhole send, post the wormhole code
                               to the room so any recipient can receive it
  - `wormhole-recv <code>`   — receive a wormhole transfer, post result to room
  - `status`                 — homeserver connectivity + wormhole binary check
  Config: ~/.config/sourceos/matrix.yaml or MATRIX_* env vars

Shell surface (turtle-shell-init.zsh):
  - `mx <msg>`    post message to Matrix room
  - `mxf <file>`  post file as code block
  - `mxw <file>`  wormhole-send + post code to room  (CMD+SHIFT+ALT+W)
  - `mxr <code>`  wormhole-recv + post result to room
  - `mxstatus`    show bridge config + connectivity
  - Daemon auto-started at shell init if matrix.yaml or MATRIX_ACCESS_TOKEN present
  - CMD+SHIFT+ALT+M  → `mx ` (compose message prefix)

Palette (turtleterm.lua):
  - Matrix: send message, send file, wormhole send, bridge status
  - CMD+SHIFT+ALT+M / CMD+SHIFT+ALT+W keybindings

Dashboard (turtle-mesh-serve):
  - Matrix badge in status bar: green=bridge daemon alive, red=off
  - matrix_bridge_up in gather_state() via PID file liveness check
@mdheller
mdheller merged commit 0025d47 into main Aug 4, 2026
13 of 14 checks passed
@mdheller
mdheller deleted the feat/matrix-bridge branch August 4, 2026 15:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant