assistant-registration

assistant-registration is a cursor rule for coding agents from nongjun/feishu-cursor-claw. It costs 0 tokens per session (685 once invoked), scanned A, original, MIT.

A standard for registering webhook-based notifications, such as alerts, daily reports, and reminders, in a central assistant configuration system. A webhook is a URL that receives automated messages from another program.

In plain words
What is it for?
Use it when adding or changing a webhook notification: define the assistant, fetch its configuration, skip disabled or unconfigured destinations, and build the correct message payload for the platform.
Why use it?
It keeps notification settings, enable switches, and webhook URLs under central control. It also provides one consistent process for supporting different messaging platforms.

Cursor rule

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add rules/nongjun/feishu-cursor-claw/assistant-registration
Clone the repo
git clone --depth 1 https://github.com/nongjun/feishu-cursor-claw

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for assistant-registration

README.md
[![agentmods](https://agentmods.dev/badge/rules/nongjun/feishu-cursor-claw/assistant-registration.svg)](https://agentmods.dev/rules/nongjun/feishu-cursor-claw/assistant-registration)
Your own site
<a href="https://agentmods.dev/rules/nongjun/feishu-cursor-claw/assistant-registration"><img src="https://agentmods.dev/badge/rules/nongjun/feishu-cursor-claw/assistant-registration.svg" alt="Measured on agentmods" height="20"></a>
Per session 0 Nothing until a file matches its globs; then the whole rule loads.
When invoked 685 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00000 $0.00685
Opus 5 $0.00000 $0.00342
Sonnet 5 $0.00000 $0.00137
Haiku 4.5 $0.00000 $0.00068

Measured 4d ago against content hash 4289bcc86367, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

assistant-registration scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 4d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

参考代码/njcursor/rules/assistant-registration.mdc · 81 lines

What it actually says

小助手统一注册规范

核心原则

系统中所有 webhook 推送功能(告警、日报、提醒等)必须注册到门户系统的小助手配置中心,由门户统一管理 webhook URL 和开关。

新增小助手的标准流程

1. 在模块 main.py 的 MODULE_ASSISTANTS 中添加定义

MODULE_ASSISTANTS = [
    # ... 现有定义 ...
    {
        "assistant_code": "your_new_assistant",  # 全局唯一,snake_case
        "display_name": "你的新功能名称",
        "description": "一句话描述推送内容和触发方式",
        "module_code": "your_module",  # archive/quality/moment/contact 等
        "schedule_config": {
            "type": "cron",  # cron / interval / realtime
            "times": ["09:00"],  # cron 类型填写
            # "interval_minutes": 5,  # interval 类型填写
            # "description": "事件触发",  # realtime 类型填写
        },
    },
]

模块启动时会通过 register_assistants(MODULE_ASSISTANTS) 自动向门户注册。

2. 通过 assistant_config_client 获取 webhook 配置

from app.services.assistant_config_client import get_assistant_config

config = await get_assistant_config("your_new_assistant")
if not config.enabled or not config.webhook_key:
    return  # 未启用或未配置则跳过

# config.webhook_key 是完整的 webhook URL

3. 使用 build_payload 构建多平台消息

from shared_backend.utils.webhook_platform import detect_platform, build_payload

payload = build_payload(detect_platform(webhook_url), content, "markdown")

禁止事项

  • ❌ 不要在代码中硬编码 webhook URL
  • ❌ 不要直接从环境变量读取 webhook(仅作为降级回退)
  • ❌ 不要硬编码企微消息格式(使用 build_payload 适配多平台)
  • ❌ 不要在门户的 ASSISTANT_DEFINITIONS 中手动添加(由各模块自动注册)

相关文件

  • 注册工具: 公共模块/shared_backend/utils/assistant_registry.py
  • 平台适配: 公共模块/shared_backend/utils/webhook_platform.py
  • 配置客户端: 各模块 app/services/assistant_config_client.py
  • 门户 API: 门户系统/后端服务/app/api/assistant.py(/internal/register-batch)
Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 4d ago First seen · 81 lines · 0 tokens per session scan A 4289bcc86367

Subscribe to this mod's changes

assistant-registration is a cursor rule published in the GitHub repository nongjun/feishu-cursor-claw (14 stars, last pushed 1mo ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 685 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.