$ show openclaw/hermit
Hermit is a feature-rich Discord moderation and community bot for the OpenClaw ecosystem, deployed to Cloudflare Workers with a Bun-based gateway forwarder relaying Discord gateway events. In production it runs as a single Worker isolate using Carbon (@buape/carbon) for Discord interactions and Drizzle ORM over Cloudflare D1 for persistence. It exposes 14+ slash commands (claim, nominate, slap, lobster, say, admin, role, maintainer, helper, github, beta-pings), context-menu commands, webhook APIs for ClawHub search intelligence and publisher abuse digests, scheduled cron tasks (nomination expiry, thread monitoring, card sync), and a React-SSR form system with OAuth flows for ban appeals, content rights cases, and moderated submissions. The bot is tightly coupled to one Discord guild, with guild/channel/role/user IDs hardcoded across config files, though the domain modules (moderation, nominations, forms, games) are cleanly separated and extensively unit-tested against a SQLite D1 shim. A substantial secondary character is deterministic content/data engineering: the repo bundles a frozen WoRMS taxonomy snapshot of 264 accepted lobster species across 6 families, plus meticulously provenance-tracked AI artwork pipelines (1056 lobster scenes, ~327 slap scenes) with SHA-256 checksums, batch manifests, QA gates (RIFF signature checks, dwebp decode, perceptual dHash near-duplicate detection), remediation loops, and byte-identical rebuild tests. These pipelines feed the in-bot lobster encounter and fish-slap games rather than serving external research, so the repository is best classified as an application with strong data-engineering DNA. The build scripts are genuinely reusable for any biodiversity-data or generative-asset workflow. Drift risks include hardcoded local generation paths (e.g. /Users/hrudolph/...), pinned dependency overrides (esbuild, postcss, ws), future-dated snapshot timestamps as data artifacts, and checksum locks that make data updates deliberately expensive.
The LLM identified 6 files worth highlighting for reuse:
Builds a frozen species catalog from WoRMS API archives with full provenance, family evidence profiles, exclusion rules (synonyms, extinct, non-marine), SHA-256 checksums, and offline byte-identical rebuild capability. The deterministic snapshot + validation pattern is directly reusable for any external taxonomy or reference-data ingestion pipeline that needs versioned, auditable local copies.
Implements strict, composable validation utilities (requireExactKeys, requireEnum, validateCitationShape) that bind capability claims to scientific citations and enforce schema conformance. These are framework-agnostic and could be extracted into any data pipeline needing rigorous JSON schema enforcement with provenance-aware evidence.
Automated QA for generated image assets: verifies WebP RIFF signatures, decodes via dwebp, runs ImageMagick identify checks, and computes perceptual dHashes for near-duplicate detection with strict vs. lenient completion modes. Reusable for any AI-artifact pipeline that needs to guarantee format validity, dimensions, and visual uniqueness before shipping assets.
Shared cooldown ledger backed by D1, enforcing actor/target/channel cooldowns with atomic read-expire semantics for both the slap and lobster encounter games. Demonstrates a clean, self-contained rate-limit pattern that could be lifted into any interaction-heavy application needing persistent, multi-scope cooldowns.
Parses weekly ClawHub search recommendation digests, validates structure/timestamps/URLs, and renders multi-part Discord deliveries with dedup, atomic claim, nonce checks, and part-keyed receipts. The idempotent delivery-with-reconciliation pattern is a solid reference for any webhook-fed notification system where duplicate or out-of-order payloads are a risk.
Per-channel Discord webhook lookup/creation with a 15-minute TTL cache and single-flight concurrency protection, avoiding duplicate webhook creation under parallel interaction load. Small, well-isolated, and directly extractable as a caching layer for any rate-limited external API.