Skip to content

netresearch/matrix-skill / skills/matrix-administration

matrix-administration

Verified

Use 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-biggest-rooms.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 = []
# ///
"""Print the largest rooms on the homeserver by Synapse-estimated DB size.

Calls ``GET /_synapse/admin/v1/statistics/database/rooms`` and looks up the
display name for each result.  Limit defaults to 10.

Usage:
    synapse-biggest-rooms.py [--limit 10]
"""

from __future__ import annotations

import argparse
import os
import sys

sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))

from _lib import admin_request, load_config, quote
from _lib.pretty_bytes import pretty_bytes


def main() -> int:
    parser = argparse.ArgumentParser(description=__doc__.split("\n\n")[0])
    parser.add_argument("-n", "--limit", type=int, default=10)
    args = parser.parse_args()

    config = load_config()
    result = admin_request(config, "GET", "/v1/statistics/database/rooms")
    if "error" in result:
        print(f"Error: {result['error']}", file=sys.stderr)
        return 1

    rooms = result.get("rooms", []) or []
    rooms.sort(key=lambda r: r.get("estimated_size", 0), reverse=True)
    rooms = rooms[: args.limit]

    rows = []
    for r in rooms:
        info = admin_request(config, "GET", f"/v1/rooms/{quote(r['room_id'])}")
        name = info.get("name") if isinstance(info, dict) else None
        rows.append(
            {
                "room_id": r["room_id"],
                "name": name,
                "size": pretty_bytes(r.get("estimated_size", 0)),
            }
        )

    width_id = max((len(row["room_id"]) for row in rows), default=8)
    width_size = max((len(row["size"]) for row in rows), default=4)
    print(f"{'room_id'.ljust(width_id)}  {'size'.rjust(width_size)}  name")
    for row in rows:
        name = row["name"] or "-"
        print(
            f"{row['room_id'].ljust(width_id)}  {row['size'].rjust(width_size)}  {name}"
        )
    return 0


if __name__ == "__main__":
    sys.exit(main())
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: 471kUpdated Claude CodeCodexVerifiedInstall
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: 471kUpdated Claude CodeCodexVerifiedInstall
rea-tool-designmorluto/reaAudit, investigate, design, or change REA investigation tools, CLI/MCP contracts, provider capabilities, and Evidence semantics.Stars: 471kUpdated Claude CodeCodexVerifiedInstall
ponytail-auditDietrichGebert/ponytailQuality audit of the whole repo: bugs, security, real load, missing tests, speed, and what to delete. Most important first.Stars: 194kUpdated Claude CodeCodexVerifiedInstall