cto-legends · module overview · infrastructure · MIT
legends-buzz: Block Buzz Nostr Relay, NIP-29 & Agent ChatOps CLI
Operate self-hosted Block Buzz Nostr relays, route all 26 Buzz MCP domains through token-compact CLI calls, diagnose NIP-29 and NIP-FI membership 403s, reconstruct reply threads, and audit attachments with zero dependencies.
GitHub Repository (https://github.com/avalonreset/legends-buzz)
Self-hosting Block Buzz (ghcr.io/block/buzz) gives engineering teams a fast, sovereign Nostr workspace built on NIP-29 groups, NIP-OA relay roles, and NIP-FI member lists. However, operating a live relay with AI coding agents exposes subtle traps: loading a 30-tool Buzz MCP server burns thousands of Turn-0 schema tokens; relay admins with NIP-OA admin roles still hit HTTP 403 errors on private channel reads when their pubkey is missing from the NIP-FI kind:39002 member list; edge reverse proxies silently strip WebSocket Upgrade headers or connect-src wss: directives on /invite/* links; and on Windows NTFS drives, Buzz.exe (the Tauri GUI) and buzz.exe (the Rust CLI) collide in the same directory.
legends-buzz gives your coding agent a zero-dependency Python 3.11+ standard-library CLI to operate, audit, and troubleshoot Block Buzz relays and desktop clients safely. Instead of running a persistent MCP server, your agent queries the complete 26-domain, 108-subcommand MCP-to-CLI routing map and executes buzz commands on demand with --format agent for token-compact output.
For live relay governance, the module runs SSRF-guarded 6-surface readiness probes, distinguishes NIP-OA relay roles from NIP-FI channel membership lists, audits explicit owner access across every channel using Bech32 npub1... or 64-character hex pubkeys, reconstructs full connected-component kind:9 reply threads, inspects untrusted attachments through a 5-gate zero-trust pipeline, and executes preview-first SHA-256 disposable message canaries.
Deterministic Execution Boundary
Why Raw Prompts and Always-On Chat MCP Servers Break on Self-Hosted Nostr Relays
An unguided AI coding agent assumes a relay admin can read every private channel, guesses non-existent buzz thread flags, passes Nostr nsec1... private keys on command-line arguments where process tables expose them, or mistakes the Windows Tauri GUI executable for the headless Rust CLI.
- 26-Domain MCP-to-CLI Routing Without Turn-0 Schema Bloat: Maps all 26 Block Buzz operational domains (messages, channels, dms, threads, reactions, pins, bookmarks, search, canvas, scheduled, reminders, webhooks, and admin controls) to exact buzz CLI commands with --format agent, saving thousands of startup context tokens.
- NIP-OA Relay Admin vs. NIP-FI Channel Membership Diagnostics: Pinpoints the exact cause of residual HTTP 403 errors on private channels by comparing NIP-OA relay-wide roles (kind:13104) against NIP-FI per-channel member lists (kind:39002), and audits explicit owner role coverage across every channel using BIP-173 Bech32 npub1... or hex pubkeys.
- 6-Surface SSRF-Guarded Relay Probe & Connected Thread Context: Verifies /_readiness, /health, NIP-11 relay documents, Tauri desktop CORS headers, /invite/* CSP headers, and authenticated RFC 6455 /pair WebSocket 101 upgrades in one pass, while reconstructing full ancestor and descendant kind:9 reply chains client-side.
- 5-Gate Zero-Trust Attachment Inspection & Windows PE Collision Audit: Validates downloaded attachments against a 100 MiB ceiling, path-traversal rules, SHA-256 digests, 13 magic-byte file signatures, and polyglot payload traps before any agent parser opens them, and inspects Windows PE headers to separate WINDOWS_GUI (Buzz.exe) from WINDOWS_CUI (buzz.exe).
CLI Subcommands & Capability Surface
- 26-Domain MCP-to-CLI Router & Live Grammar Inventory: Maps all 26 Block Buzz MCP capability domains to exact non-interactive buzz CLI invocations (--format agent and --format json) and cross-checks them against your installed buzz binary grammar across 26 top-level commands and 108 subcommands.
- SSRF-Guarded 6-Surface Live Relay Probe: Audits /_readiness, /health, NIP-11 metadata (application/nostr+json), Tauri desktop CORS origins (http://tauri.localhost and https://tauri.localhost), /invite/* Content-Security-Policy connect-src wss: rules, and authenticated /pair WebSocket 101 handshakes while blocking loopback, RFC1918, and cloud metadata IPs.
- NIP-FI Membership & Bech32 npub/Hex Owner Governance Audit: Diagnoses why a NIP-OA relay admin receives HTTP 403 on private channel message history when omitted from NIP-FI kind:39002 member lists, and verifies whether an owner pubkey (accepted as Bech32 npub1... or 64-character hex) holds explicit owner membership across every relay channel.
- Connected-Component Reply Thread Reconstruction: Captures structured JSON channel snapshots and reconstructs complete ancestor and descendant kind:9 reply trees around any target message ID by traversing both direct reply_to fields and Nostr e tags without relying on server-side thread_id indexing.
- 5-Gate Zero-Trust Attachment Inspector & Windows PE Audit: Inspects local or relay-hosted attachments across five security gates (100 MiB size cap, filename sanitization, SHA-256 digest, 13-signature magic-byte check, and HTML/script/ZIP polyglot rejection) and audits Windows PE subsystem headers to detect NTFS Buzz.exe vs. buzz.exe collisions.
- Preview-First Canary, 8-Gate Upgrade Plan & 9 Blueprints: Runs SHA-256 plan-locked send, readback, and delete message canaries in disposable channels, generates 8-gate zero-downtime Docker relay upgrade plans, and renders 9 production blueprints (Caddy, Nginx, Docker Compose, systemd user units, and buzz-acp agent bridges).
Raw Frontier LLM vs. legends-buzz Execution Matrix
- Agent Tool Execution & Token Overhead: Standard AI Chat (Loads a persistent 30-tool Buzz MCP server at Turn 0 or guesses non-existent buzz CLI flags that fail mid-run.) vs. With legends-buzz (Routes all 26 domains through verified buzz CLI subcommands on demand using --format agent and --format json.) · Live cli-inventory grammar check confirming 26 top-level commands, 108 subcommands, and --format agent support.
- Private Channel 403 & Owner Access Diagnosis: Standard AI Chat (Assumes NIP-OA relay admin status grants automatic read access to every private channel and misdiagnoses HTTP 403 errors as broken keys.) vs. With legends-buzz (Separates NIP-OA relay roles (kind:13104) from NIP-FI channel member lists (kind:39002) and normalizes Bech32 npub1... or hex pubkeys to audit explicit channel ownership.) · Structured JSON audit listing every channel where the target pubkey is missing or lacks the explicit owner role, paired with exact remediation commands.
- Relay Edge Proxy & Desktop Client Parity: Standard AI Chat (Checks only HTTP 200 on the root URL while missing broken /pair WebSocket upgrades, stripped Tauri CORS headers, or Windows Buzz.exe/buzz.exe collisions.) vs. With legends-buzz (Probes all 6 relay HTTP/WSS/CORS/CSP surfaces with SSRF guards and inspects Windows PE IMAGE_OPTIONAL_HEADER.Subsystem values.) · 6-surface relay probe report (including RFC 6455 Sec-WebSocket-Accept validation) and PE subsystem verification.
- Secret Hygiene & Live Mutation Safety: Standard AI Chat (Passes nsec1... private keys on CLI arguments, opens untrusted attachments blindly, or posts test messages into production channels without cleanup.) vs. With legends-buzz (Reads keys only from environment or --env-file, scrubs nsec1/ncryptsec1/hex64 secrets from all output, runs 5-gate attachment inspection, and locks live canaries behind SHA-256 --confirm-plan hashes.) · Zero secret leakage across stdout/stderr, 5-gate attachment receipts, and preview-first SHA-256 canary cleanup verification.
Explicit Safety Boundaries & Exclusions
- Never accepts Nostr private keys (nsec1..., ncryptsec1..., or 64-character hex secrets) on command-line arguments where OS process tables or shell history could expose them.
- Never executes live relay message canary mutations without an explicit preview pass and matching SHA-256 --confirm-plan digest.
- Never probes loopback, private RFC1918, link-local, or cloud metadata IP addresses unless --allow-private-network is explicitly passed for local container testing.
- Never moves, resizes, kills, or launches the Buzz Desktop GUI window during desktop binary and asset integrity audits.
Operator FAQ
- Why use legends-buzz with the buzz CLI instead of running a persistent Buzz MCP server?
- Loading a 30-tool MCP server injects thousands of schema tokens into Turn 0 of every coding session, even when you are not touching chat infrastructure. legends-buzz maps all 26 Block Buzz domains to deterministic buzz CLI commands with --format agent, keeping startup token overhead near zero while adding 6-surface relay probes, NIP-FI 403 diagnostics, connected thread reconstruction, and 5-gate attachment security that raw MCP wrappers lack.
- Why does a Block Buzz relay admin still get HTTP 403 Not a member of channel on private channels?
- Block Buzz separates relay-wide administration (NIP-OA kind:13104, such as roles: ["admin"]) from per-channel membership (NIP-FI kind:39002). While a relay admin can list channels or add members, calling GET /api/v1/channels/<id>/messages on a private channel still returns HTTP 403 until that pubkey is explicitly added to the channel member list. legends-buzz membership-check and owner-access-audit detect this exact state and generate the remediation command.
- What is the Windows NTFS Buzz.exe vs. buzz.exe collision, and how does desktop-audit catch it?
- On case-insensitive Windows NTFS drives, installing the Tauri desktop app (Buzz.exe) and the headless Rust CLI (buzz.exe) into the same folder overwrites one binary with the other. If an agent invokes the GUI binary expecting CLI JSON output, the command hangs or launches a desktop window. legends-buzz desktop-audit reads the Windows PE IMAGE_OPTIONAL_HEADER.Subsystem bytes directly to verify that Buzz.exe is WINDOWS_GUI (2) and your CLI binary is WINDOWS_CUI (3) in a separate directory.
- How does legends-buzz protect Nostr private keys and untrusted channel attachments?
- Private keys are read exclusively from environment variables (BUZZ_PRIVATE_KEY) or a local --env-file, never from CLI flags, and an automatic secret scrubber redacts nsec1..., ncryptsec1..., Bearer tokens, and 64-character hex secrets from all JSON and Markdown outputs. Untrusted attachments are checked through five zero-trust gates (100 MiB size cap, filename sanitization, SHA-256 verification, 13-signature magic-byte matching, and polyglot payload rejection) before any downstream tool opens them.
All 22 cto-legends Packages (1 Router + 21 Modules)
cto-legends · GitHub: The single local CLI router for Claude Code, Codex, and Cursor: reads one compact startup index and loads 21 isolated Python tools on demand with zero context bloat.
legends-empire · GitHub: Govern your local Obsidian and Markdown vault with SHA-256 file integrity locks, crash-safe write transactions, immutable evidence staging, and read-only stewardship audits.
legends-astro · GitHub: Migrate WordPress, Next.js, or legacy HTML sites to Astro v7 with a pre-build route and SEO parity contract, offline documentation, and post-build verification.
legends-hetzner · GitHub: Scan live European and US Hetzner Cloud stock, compare cost-optimized x86 and ARM64 sizing, and enforce 10-check preflight plans before provisioning any server.
legends-coolify · GitHub: Audit your self-hosted Coolify servers, Docker container states, deployment queues, environment variable keys, and database backup schedules over read-only HTTPS with zero secret exposure.
legends-cloudflare · GitHub: Execute preview-first Cloudflare DNS updates and cutovers that preserve orange-cloud proxy states, guard multi-record hostnames, and verify every change via live API readback.
legends-stripe · GitHub: Audit Stripe .env price IDs, sync Test and Live price ladders, reconcile fixed-fee drag and net retained cash to the cent, and verify raw-body HMAC webhooks with zero dependencies.
legends-gohighlevel · GitHub: Operate GoHighLevel sub-accounts, batch-clone V2 snapshots with headless PIT minting, X-ray and rebrand internal workflow steps, and enforce 5-layer agency permissions and 4-store SaaS rebilling markups.
legends-buzz · GitHub: Operate self-hosted Block Buzz Nostr relays, route all 26 Buzz MCP domains through token-compact CLI calls, diagnose NIP-29 and NIP-FI membership 403s, reconstruct reply threads, and audit attachments with zero dependencies.
legends-github · GitHub: Audit GitHub repository health, package verified releases, align your 20 repo topics with live search demand, and verify 1280x640 Open Graph social preview cards pixel for pixel.
legends-jev · GitHub: Local Python OCR and visual verification for UI screenshots, exact original-image pixel coordinates, and Google Street View storefront signage audits.
legends-geogrid · GitHub: Run circular-lattice Google Maps rank studies up to 30 positions deep at wholesale DataForSEO rates, complete with Street View signage dossiers and 18-page vector PDF briefings.
legends-dataforseo · GitHub: Query Google organic SERPs, Google Maps, and keyword volume over the DataForSEO API with offline cost previews, zero-dependency Python execution, and SHA-256 local evidence banking.
legends-firecrawl · GitHub: Convert JavaScript-heavy websites into clean Markdown and run preview-gated Firecrawl site maps, bounded crawls, and Alexandria catalog queries with SHA-256 local evidence banking.
legends-grant · GitHub: Search federal, state, and foundation grants across 56 US jurisdictions, verify verbatim eligibility rules against your private company facts, and check proposal budgets to the cent.
legends-obs · GitHub: Automate OBS Studio over its local WebSocket server with profile backups, window-aware scene switching, hardware encoder checks, and canary test-clip verification.
legends-captions · GitHub: Repair misheard technical terms, lock letter-by-letter acronym timing, and render frame-accurate word-by-word subtitles for 4K60 vertical and widescreen video.
legends-yt-dlp · GitHub: Paced yt-dlp video, audio, and YouTube transcript pipeline with resumable batch ledgers, local GPU word alignment, and frame-accurate FFmpeg clip cuts.
legends-stable-audio-3 · GitHub: Generate custom instrumental tracks on your local GPU with Stable Audio 3 and crossfade multi-hour background mixes with automated silence trimming.
legends-hyperyap · GitHub: Push-to-talk local GPU voice dictation for Windows, macOS, and Linux: transcribe speech offline with NVIDIA Parakeet and paste straight into your active editor or terminal.
legends-ambient-intelligence · GitHub: Offline voice memo and meeting transcription pipeline: archive USB voice recorders with SHA-256 deduplication, run local Whisper or Parakeet, and distill Obsidian notes.
legends-youtube · GitHub: Operate YouTube channels over Data API v3 and Analytics API v2 with ETag-guarded lossless metadata updates, zero-quota public readbacks, Perfect Video Score idea radar, Shorts Related-video guards, Studio chapter and quiz validators, and an 18-file Empire knowledge pack.