Discord AI Dispatcher
/install discord-ai-dispatcher
Generic Webhook Notifier: Advanced Skill Guide
The Webhook Notifier skill provides a robust architecture that combines hard heuristics with local AI reasoning tools to ensure 100% routing accuracy and high-density visual formatting.
🚀 The High-Consistency Architecture: Deterministic Routing
Instead of relying solely on AI categorization, this dispatcher implements a Deterministic Prefix Engine to ensure 100% routing accuracy:
- Prefix Identification: An
updateId(e.g.,systemevent00100) directly dictates the target channel.systemevent-> Infrastructure Eventsappalert-> Application Monitoringuserupdate-> User Activity
- Zero-Guessing: This removes "Classification Drift" where an AI might misinterpret an update, ensuring data always reaches the correct stakeholders.
🔢 Deterministic Sequential Deduplication
To handle out-of-order API deliveries or network retries, the dispatcher uses a Sequential State Tracker:
- Logic: It extracts a numeric suffix from the ID (the
XXXXXinprefixXXXXX). - State: The highest seen ID for each category is stored locally.
- Rule: Use Numeric Comparison (
100 > 99) instead of Alphabetical (100 \x3C 99). Regex-extract digits[^\d]and cast to[long]to ensure the sequence advances even as ID lengths change. - Result: You never see a stale update overwrite new data, and duplicate notifications are prevented.
🔒 Global Pipeline Locking (Self-Protection)
To prevent race conditions and file corruption when the AI takes longer than the polling interval:
- Lock File: Create a
dispatcher.lockat the start of the orchestrator. - Abort Logic: If a lock exists and is "fresh" (\x3C 30 mins), the next pulse must exit immediately.
- Atomic Recovery: Always use
try/finallyblocks to ensure the lock is released even if the script crashes.
🏗️ Self-Healing JSON Recovery
State files can be corrupted by power loss or interrupted writes.
- Integrity Checks: Wrap every
ConvertFrom-Jsoncall in atry/catch. - Auto-Reset: If parsing fails, log the corruption, delete the broken file, and re-initialize the state from the API source.
- Benefit: The system self-recovers from disk errors without manual developer intervention.
🩹 The "Healing Cleaner" Pattern
Instead of a "Negative Filter" (which deletes bad formatting), this skill uses a Positive Healing logic to repair inconsistent AI output:
- Label Extraction: It scans for colons and automatically wraps the text before them in
**Bold Labels**. - Normalization: It forcefully standardizes fluctuating terms to established vocabulary.
- Noise Blacklist: It aggressively strips AI conversational filler.
- Artifact Stripping: It cleans up redundant formatting artifacts (
** **), escaped characters, and unwanted markdown blocks.
- Result: You get a professional, uniform feed even if the AI model gets "creative".
📊 Dashboard Mode (Clean Chat Strategy)
Prevent chat clutter by updating existing messages instead of posting new ones.
- Logic: Use
PATCH(or corresponding update paradigm) instead ofPOSTfor webhooks. - State: Store the created message ID in a local state file.
- Advantage: Provides a single "Living" source of truth for your system status without generating unnecessary notification spam.
🪙 Token & Cost Optimization
...
- Payload Pruning: Strip all non-essential JSON keys before the AI sees them.
- Compressed Instructions: Use strict list-based prompts instead of paragraphs.
- Low Effort Fallback: If the AI is offline, use a hardcoded template for high availability.
🧠 The AI Improvement Layer: Learning From Gaps
The Webhook Notifier is built to be a self-improving system. When a gap is found, the agent must shift from Monitor to Diagnostician:
1. The RCA Feed (Log Diagnostics)
Instead of guessing, the agent must scan the dispatcher.log for the "Missing IDs":
- Skipped (
duplicate) but not Delivered: Indicates the deduplication logic was too aggressive (Historical Logic Flaw). - Timeout: Indicates the Local LLM needs a higher timeout or more GPU resources.
- No Log Record: Indicates a failure at the Poller or API fetch stage.
2. Strategic Improvement Loop
When the user feeds you an RCA report, you should automatically suggest (or implement) one of the following:
- State Realignment: Resetting
last-seen-ids.jsonorpolling-state.jsonto the actual last-delivered marker to ensure the "Gaps" are re-sent. - Logic Tuning: If sequential IDs are conflicting with timestamp IDs, adjust the
Test-IsSequentialDuplicatehelper to be more specific. - High-Precision Recovery: Creating a one-time "Healing Queue" to force-inject missed notifications into Discord.
🛡️ Recovery Best Practices:
- Bypass Deduplication: When in "Heal Mode", always bypass the
Test-IsSequentialDuplicatefilter to ensure recovery happens. - Audit History: Perform a "Log Audit" before making changes. Never assume a file is missing just because it's not in the DB—always check the logs to confirm if the Dispatcher ever saw it.
🎨 Best Practices for Professional Formatting
To maintain aesthetics and readability:
- Mandatory Bolding: Always wrap labels in visual emphasis (e.g., Key: Value).
- Horizontal Dividers: Every notification should logically separate from the next.
- Tool-Calling First: Calculate your metrics in code; use the AI only for the final beautification.
⚙️ Automation & Version Compatibility
- Scheduling Reliability: Use Headless Discrete Execution (Windows Task Scheduler / Cron). Avoid infinite
while($true)loops to prevent memory leaks and handle system reboots gracefully. - PowerShell 5.1 Compatibility:
- Hashtables: Modern PS 7.0
-AsHashtablefails in 5.1. Use manual property-looping to convert PSCustomObjects into Hashtables for reliable$state[$key]access. - Encoding: Always specify
-Encoding UTF8onSet-Contentto prevent character corruption in mixed-version environments.
- Hashtables: Modern PS 7.0
- Webhook First: Always provide users the option to setup webhooks immediately after configuring the skill for instant "out-of-box" operation.
Designed for extensible and robust notification pipelines.
- Make sure OpenClaw is installed (local or Docker)
- Run the install command in chat:
/install discord-ai-dispatcher - After installation, invoke the skill by name or use
/discord-ai-dispatcher - Provide required inputs per the skill's parameter spec and get structured output
What is Discord AI Dispatcher?
Routes Discord notifications with a two-tier system using hardcoded rules and local AI, supports message updates to reduce clutter, and optimizes resource use. It is an AI Agent Skill for Claude Code / OpenClaw, with 156 downloads so far.
How do I install Discord AI Dispatcher?
Run "/install discord-ai-dispatcher" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.
Is Discord AI Dispatcher free?
Yes, Discord AI Dispatcher is completely free, licensed under MIT-0. You can download, install and use it at no cost.
Which platforms does Discord AI Dispatcher support?
Discord AI Dispatcher is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).
Who created Discord AI Dispatcher?
It is built and maintained by bhupendrafire-ai (@bhupendrafire-ai); the current version is v1.7.8.