← 返回 Skills 市场
bhupendrafire-ai

Discord AI Dispatcher

作者 bhupendrafire-ai · GitHub ↗ · v1.7.8 · MIT-0
cross-platform ⚠ suspicious
156
总下载
0
收藏
0
当前安装
8
版本数
在 OpenClaw 中安装
/install 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.
使用说明 (SKILL.md)

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:

  1. Prefix Identification: An updateId (e.g., systemevent00100) directly dictates the target channel.
    • systemevent -> Infrastructure Events
    • appalert -> Application Monitoring
    • userupdate -> User Activity
  2. 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 XXXXX in prefixXXXXX).
  • 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:

  1. Lock File: Create a dispatcher.lock at the start of the orchestrator.
  2. Abort Logic: If a lock exists and is "fresh" (\x3C 30 mins), the next pulse must exit immediately.
  3. Atomic Recovery: Always use try/finally blocks 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.

  1. Integrity Checks: Wrap every ConvertFrom-Json call in a try/catch.
  2. 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:

  1. Label Extraction: It scans for colons and automatically wraps the text before them in **Bold Labels**.
  2. Normalization: It forcefully standardizes fluctuating terms to established vocabulary.
  3. Noise Blacklist: It aggressively strips AI conversational filler.
  4. 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.

  1. Logic: Use PATCH (or corresponding update paradigm) instead of POST for webhooks.
  2. 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:

  1. State Realignment: Resetting last-seen-ids.json or polling-state.json to the actual last-delivered marker to ensure the "Gaps" are re-sent.
  2. Logic Tuning: If sequential IDs are conflicting with timestamp IDs, adjust the Test-IsSequentialDuplicate helper to be more specific.
  3. 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-IsSequentialDuplicate filter 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 -AsHashtable fails in 5.1. Use manual property-looping to convert PSCustomObjects into Hashtables for reliable $state[$key] access.
    • Encoding: Always specify -Encoding UTF8 on Set-Content to prevent character corruption in mixed-version environments.
  • 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.

安全使用建议
This skill is plausible for a Discord/webhook dispatcher, but it instructs the agent to read and modify local state files, store and use webhook secrets from config/webhooks.json, automatically delete corrupted state files, and force-replay historical alerts. Before installing or using it: 1) Review and back up your existing state files (last-seen-ids.json, polling-state.json, dispatcher.log). 2) Inspect config/webhooks.json and ensure webhook endpoints are correct and limited in scope; treat those URLs as secrets. 3) Require explicit confirmation for destructive actions (file deletion, state resets, bypassing deduplication) and limit automatic 'heal' re-sends to a small test set. 4) Run the skill in a sandbox or test environment first to observe re-sync behavior and to ensure no unintended data leakage occurs. 5) If the skill needs DB/API access, supply credentials via a controlled mechanism and do not allow broad filesystem access to avoid exposing other sensitive files. If you want, provide the config layout and where the skill will run and I can point out exact lines/instructions that will perform each risky action.
功能分析
Type: OpenClaw Skill Name: discord-ai-dispatcher Version: 1.7.8 The skill bundle describes an AI-managed Discord notification system that utilizes high-risk operational patterns, including instructions for the agent to establish persistence via Windows Task Scheduler or Cron and to 'self-heal' by automatically deleting and re-initializing local state files. Most notably, the SKILL.md explicitly instructs the agent to bypass deduplication filters ('Test-IsSequentialDuplicate') during recovery modes, which could lead to notification storms or the re-processing of sensitive data. While these features are framed as reliability enhancements, the combination of autonomous file system management, persistence, and the bypassing of logic checks warrants a suspicious classification.
能力评估
Purpose & Capability
The name/description (Discord dispatcher) aligns with the instructions: the SKILL.md repeatedly references routing by ID prefix, local state files, webhook config, deduplication, and updating messages rather than posting new ones. Storing webhook URLs in config/webhooks.json and reading dispatcher.log/last-seen-ids.json is coherent for this purpose. However, the skill also describes re-initializing state from an external API/DB and performing audits without declaring any required credentials or how the agent should authenticate, which is an inconsistency.
Instruction Scope
The runtime instructions explicitly tell the agent to read and modify local files (config/webhooks.json, dispatcher.log, last-seen-ids.json, polling-state.json), delete corrupted state files, bypass deduplication in 'heal mode', and force-inject historical alerts. Those are powerful and potentially destructive actions. The guidance to automatically delete corrupted JSON and re-sync a 24-hour backlog may cause unexpected mass re-sends of potentially sensitive data and should require explicit user consent and clear limits.
Install Mechanism
No install spec or code is included — this is instruction-only, so nothing is written to disk by an installer. That limits supply-chain risk; the skill will rely on the agent's environment and whatever scripts the user runs.
Credentials
The skill declares no required environment variables or primary credential, yet it depends on local webhook secrets (config/webhooks.json) and on access to source APIs/DBs for re-initialization and audit. This mismatch means the instructions expect access to sensitive credentials/config without declaring them or requiring safeguards. The healing/force-delivery behavior could resend sensitive historical payloads to webhooks, potentially leaking data if webhooks point to external systems.
Persistence & Privilege
The skill is not marked always:true and does not request persistent platform-level privileges. However, the instructions advocate periodic audits, automatic recovery that deletes and re-initializes state files, and a healing queue that bypasses normal checks — behaviors that modify local state and can have long-lived effects. Those operations are permitted by instruction-only skills but deserve cautious access controls.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install discord-ai-dispatcher
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /discord-ai-dispatcher 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.7.8
Version 1.7.8 - Added a new "AI Improvement Layer" section to the documentation, outlining diagnostic and self-healing workflows for missed or failed notifications. - Included details on how to perform root cause analysis (RCA) from logs, state realignment, logic tuning, and recovery best practices. - No code changes; this release focuses on expanded usage guidance and troubleshooting strategies in SKILL.md.
v1.7.7
Version 1.7.7 of discord-ai-dispatcher - No file changes detected in this version. - Documentation in SKILL.md was reviewed and remains unchanged in function. - No new features, bug fixes, or behavioral adjustments introduced.
v1.7.6
**Summary:** This update adds improved deduplication logic, robust error recovery, race condition prevention, and expanded PowerShell compatibility guidance. - Deduplication now uses numeric ID comparison and explicit digit extraction for robust message ordering as ID lengths change. - Introduces a global lock-file system to prevent race conditions and file corruption during concurrent or slow polling intervals. - Adds automatic recovery for corrupted state files, enabling self-healing from storage errors. - Enhances automation guidance with best practices for headless scheduling, explicit PowerShell 5.1 and 7.0 compatibility strategies, and reliable file encoding.
v1.7.5
**Generalized and modularized the skill for broader webhook use.** - Refactored the skill guide for a generic webhook notifier instead of an Ollama-specific implementation. - Updated routing logic and terminology for more general event categories and workflows. - Revised documentation for broader applicability (removed model/vendor specifics). - Added new markdown documentation files for a "SpecialToolRoomSkill" with dedicated README and SKILL descriptors. - Removed legacy skill and readme files tied to specific implementations.
v1.7.4
- Introduced deterministic routing via the new Prefix Engine, ensuring channel selection based on `updateId` prefixes instead of AI categorization. - Added a sequential state tracker for reliable deduplication, preventing outdated or duplicate updates through numeric `updateId` checks. - Removed AI-based category classification to eliminate misrouted notifications (“classification drift”). - All other architecture, cleaning, dashboard, and optimization strategies remain unchanged.
v1.7.3
- Introduced a two-phase task-splitting approach for formatting: first categorizing events with a lightweight AI call, then formatting with a category-specific prompt for improved reliability. - Added the "Healing Cleaner" logic to automatically correct and standardize AI output, including label normalization, filler removal, and artifact stripping. - Retained dashboard mode, token optimization, professional message formatting, and automation best practices as before.
v1.7.2
- Added initial README.md file with documentation for the skill. - No changes to functionality; documentation only.
v1.7.0
**Summary:** Major update introducing advanced "Zero-Leak" routing, message updating for clean dashboards, and efficiency improvements. - Implements a robust Two-Tier routing system: hardcoded overrides + local AI reasoning for 100% Discord channel accuracy. - Adds Dashboard Mode, updating existing messages (via PATCH) to minimize chat clutter and centralize status info. - Optimizes token and compute usage for local AI models, including payload pruning and compressed prompts. - Enforces professional formatting: bolded labels, horizontal dividers, and clear tool/AI workflow separation. - Recommends Task Scheduler for automation on Windows, and encourages instant webhook setup post-install.
元数据
Slug discord-ai-dispatcher
版本 1.7.8
许可证 MIT-0
累计安装 0
当前安装数 0
历史版本数 8
常见问题

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. 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 156 次。

如何安装 Discord AI Dispatcher?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install discord-ai-dispatcher」即可一键安装,无需额外配置。

Discord AI Dispatcher 是免费的吗?

是的,Discord AI Dispatcher 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

Discord AI Dispatcher 支持哪些平台?

Discord AI Dispatcher 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 Discord AI Dispatcher?

由 bhupendrafire-ai(@bhupendrafire-ai)开发并维护,当前版本 v1.7.8。

💬 留言讨论