netresearch/matrix-skill / skills/matrix-administration
matrix-administration
VerifiedUse when administering a Synapse / Matrix homeserver — list or snapshot all rooms, rate room health (public, unencrypted, orphaned), render a Graphviz map of the room/space tree, force-join users, promote room admins, harden rooms (add-to-space + restrict + encrypt), deactivate Matrix users (with GDPR erase), find biggest rooms by DB size, audit where a user is admin or member, replay join/leave timelines, or search unencrypted history. Trigger on any '/_synapse/admin', server-wide room operation, Matrix user offboarding, or anything requiring a homeserver-admin token — even without 'admin API' in the prompt. Companion to matrix-communication.
scripts/synapse-search.py
View on GitHub#!/usr/bin/env -S uv run --script
# SPDX-License-Identifier: MIT
# SPDX-FileCopyrightText: Netresearch DTT GmbH
# /// script
# requires-python = ">=3.11"
# dependencies = []
# ///
"""Search a single room for unencrypted messages by a user.
Calls ``POST /_matrix/client/v3/search``. Only **unencrypted** messages
are searchable — end-to-end encrypted rooms return nothing. The token
holder must be a member of the room.
Usage:
synapse-search.py <ROOM_ID> <USER_ID> <TERM…>
"""
from __future__ import annotations
import argparse
import os
import sys
from datetime import UTC, datetime
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
from _lib import client_request, gray, load_config, quote
def main() -> int:
parser = argparse.ArgumentParser(description=__doc__.split("\n\n")[0])
parser.add_argument("room_id")
parser.add_argument("user_id")
parser.add_argument("terms", nargs="+")
args = parser.parse_args()
config = load_config()
term = " ".join(args.terms)
next_batch: str | None = None
messages: list[dict] = []
while True:
endpoint = "/search"
if next_batch is not None:
endpoint += f"?next_batch={quote(next_batch)}"
body = {
"search_categories": {
"room_events": {
"groupings": {"group_by": [{"key": "room_id"}]},
"filter": {
"limit": 1000,
"senders": [args.user_id],
"rooms": [args.room_id],
},
"keys": ["content.body"],
"order_by": "recent",
"search_term": term,
}
}
}
result = client_request(config, "POST", endpoint, body)
if "error" in result:
print(f"Error: {result['error']}", file=sys.stderr)
return 1
events = (
result.get("search_categories", {})
.get("room_events", {})
.get("results", [])
)
for entry in events:
ev = entry.get("result") or {}
ts = ev.get("origin_server_ts") or 0
messages.append(
{
"ts": datetime.fromtimestamp(ts / 1000, tz=UTC),
"msgtype": (ev.get("content") or {}).get("msgtype"),
"body": (ev.get("content") or {}).get("body", ""),
}
)
next_batch = (
result.get("search_categories", {}).get("room_events", {}).get("next_batch")
)
if not next_batch:
break
messages.sort(key=lambda m: m["ts"])
for m in messages:
ts = gray(f"[{m['ts'].isoformat()}]")
suffix = gray(f"({m['msgtype']})") if m["msgtype"] else ""
print(f"{ts} {m['body']} {suffix}".rstrip())
return 0
if __name__ == "__main__":
sys.exit(main())
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| rea-analysis-optimizationmorluto/reaOptimize REA providers and shared analysis workflows for agent context, latency, CPU, and memory while preserving correctness and Evidence. Use for analysis bottlenecks and cache or query design; CI/test-suite optimization belongs to rea-ci-tests-audit. | Stars: 470k | Updated | Claude CodeCodex | Verified | Install |
| rea-ci-tests-auditmorluto/reaAudit REA CI and test suites for correctness, fixture drift, false passes, and measured performance; use for suite or workflow investigations and efficiency changes, rather than ordinary feature testing or a single test failure. | Stars: 470k | Updated | Claude CodeCodex | Verified | Install |
| rea-tool-designmorluto/reaAudit, investigate, design, or change REA investigation tools, CLI/MCP contracts, provider capabilities, and Evidence semantics. | Stars: 470k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-auditDietrichGebert/ponytailQuality audit of the whole repo: bugs, security, real load, missing tests, speed, and what to delete. Most important first. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |