← 返回 Skills 市场
dongweiii

Feishu Doc Collab

作者 dongweiii · GitHub ↗ · v1.2.0 · MIT-0
cross-platform ⚠ suspicious
308
总下载
0
收藏
0
当前安装
3
版本数
在 OpenClaw 中安装
/install feishu-doc-collab
功能描述
Enable real-time AI collaboration in Feishu (Lark) documents. When a user edits a Feishu doc, the agent automatically detects the change, reads the document,...
使用说明 (SKILL.md)

Feishu Document Collaboration Skill

Turn any Feishu document into a real-time human-AI collaboration space.

Overview

This skill patches OpenClaw's Feishu extension to detect document edit events and trigger isolated agent sessions. Combined with a structured in-document chat protocol, it enables:

  • ✍️ Write a question in a Feishu doc → AI reads it and appends a reply
  • 🚦 Status flags (🔴 editing / 🟢 done) prevent premature responses
  • 👥 Multi-party routing: messages can target specific participants
  • 📋 Optional Bitable task board for structured task management

Prerequisites

  1. OpenClaw with Feishu channel configured (app ID, app secret, event subscriptions)
  2. openclaw-lark extension installed (v2026.3+) or built-in feishu extension
  3. Feishu app event subscriptions enabled:
    • drive.file.edit_v1 — document edit events
    • drive.file.bitable_record_changed_v1 — (optional) bitable record changes
    • drive.file.read_v1 — (optional, auto-ignored to suppress warnings)
  4. Required Feishu app permissions (enable in Open Platform console + user OAuth):
    • space:document:retrieve — read documents
    • docx:document:readonly — read docx content (app-level)
    • base:table:read — read bitable table structure
    • base:record:read — read bitable records
    • base:record:update — update bitable records (for task board)
    • base:field:read — read bitable field definitions
    • drive:drive:readonly — read drive file info
  5. Hooks enabled in openclaw.json:
    {
      "hooks": {
        "enabled": true,
        "token": "your-hooks-token-here"
      }
    }
    

Quick Setup

Step 1: Enable hooks in openclaw.json

Add the hooks section if not present:

# Generate a random token
TOKEN=$(openssl rand -hex 16)
echo "Your hooks token: $TOKEN"
# Then add to openclaw.json:
# "hooks": { "enabled": true, "token": "\x3CTOKEN>" }

Step 2: Apply the monitor patch

bash ./skills/feishu-doc-collab/scripts/patch-monitor.sh

This patches the Feishu extension's monitor.js (or monitor.ts for older installs) to:

  • Detect drive.file.edit_v1 and bitable_record_changed_v1 events
  • Apply 30-second debounce per file to prevent event storms
  • Skip bot's own edits (anti-loop)
  • Trigger an isolated agent session via /hooks/agent with deliver: false
  • Silently ignore drive.file.read_v1 events (suppress warnings)

Step 3: Configure your agent identity

Edit ./skills/feishu-doc-collab/config.json:

{
  "agent_name": "MyBot",
  "agent_display_name": "My AI Assistant"
}

The patch script uses this to set up message routing (who the agent responds as).

Step 4: Restart the gateway

openclaw gateway restart

Step 5: Set up the Doc Chat Protocol

Copy the protocol template to your workspace:

cp ./skills/feishu-doc-collab/assets/DOC_PROTOCOL_TEMPLATE.md ./DOC_PROTOCOL.md

Edit DOC_PROTOCOL.md to fill in your participant roster.

How It Works

Document Edit Flow

User edits Feishu doc
        ↓
Feishu sends drive.file.edit_v1 event
        ↓
Patched monitor.ts receives event
        ↓
Checks: is this the bot's own edit? → Yes: skip (anti-loop)
        ↓ No
Debounce: same file triggered within 30s? → Yes: skip
        ↓ No
POST /hooks/agent with deliver:false (isolated session)
        ↓
Agent reads DOC_PROTOCOL.md for message format
        ↓
Agent reads the document, finds last message block
        ↓
Checks: status=🟢? addressed to me? not from me?
        ↓ Yes
Agent composes reply and appends to document

In-Document Chat Protocol

Messages in the document follow this format:

---
> **Sender Name** → **Receiver Name** | 🟢 完成

Your message content here.

Status flags:

  • 🔴 编辑中 (editing) — AI will NOT process this message (user is still typing)
  • 🟢 完成 (done) — AI will read and respond to this message

Routing:

  • → AgentName — addressed to a specific AI agent
  • → all — broadcast to all participants

This solves a critical problem: Feishu auto-saves continuously while typing, which would trigger multiple premature AI responses without the status flag mechanism.

Bitable Task Board (Optional)

For structured task management alongside document collaboration:

  1. Create a Bitable with these fields:

    • Task Summary (Text)
    • Status (SingleSelect): Unread / Read / In Progress / Done / N/A
    • Created (DateTime)
    • From (SingleSelect): participant names
    • To (MultiSelect): participant names
    • Priority (SingleSelect): Low / Medium / High / Urgent
    • Notes (Text)
    • Related Doc (URL)
  2. Configure in config.json:

    {
      "bitable": {
        "app_token": "your_bitable_app_token",
        "table_id": "your_table_id"
      }
    }
    
  3. The patch also handles bitable_record_changed_v1 events for task routing.

Re-applying After Updates

⚠️ OpenClaw or extension updates may overwrite monitor.js. After any update:

bash ./skills/feishu-doc-collab/scripts/patch-monitor.sh
openclaw gateway restart

The patch script is idempotent — safe to run multiple times.

Note: For the openclaw-lark extension (compiled .js), no jiti cache clearing is needed. For older built-in .ts installs, also run: rm -f /tmp/jiti/src-monitor.*.cjs

Configuration Reference

config.json

Field Type Required Description
agent_name string Yes Internal name used in protocol routing
agent_display_name string Yes Display name shown in doc replies
bitable.app_token string No Bitable app token for task board
bitable.table_id string No Bitable table ID for task board

Environment

The patch reads from ~/.openclaw/openclaw.json:

  • hooks.token — authentication for /hooks/agent endpoint
  • gateway.port — gateway port (default: 18789)

Known Issues & Solutions

Event Storm (事件风暴)

Problem: Feishu sends multiple drive.file.edit_v1 and bitable_record_changed_v1 events for a single logical edit. Bitable edits are especially bad — changing one record field can trigger 10-20+ events in rapid succession. Without debounce, each event spawns a separate isolated agent session (using the full model), causing massive token waste.

Real-world impact: A single bitable task edit triggered 15+ Hook sessions consuming 350k+ tokens, all running in parallel and all reaching the same conclusion: "nothing to do".

Solution: 30-second debounce per fileToken (implemented in patch-monitor.sh v2):

  • A Map\x3Cstring, number> tracks the last trigger timestamp per file/table
  • If the same file was triggered within 30 seconds, the event is silently skipped
  • For bitable events, the debounce key includes both fileToken and tableId
  • The debounce is applied before the /hooks/agent call, so no session is created

Bot self-edit loop: When the agent updates a bitable record (e.g., changing status to "处理完"), that edit triggers MORE events. The bot self-edit check (comparing operator_id to botOpenId) catches most of these, but the debounce provides a critical safety net for cases where the operator ID doesn't match (e.g., API calls vs. bot identity).

Important: Already-running sessions cannot be stopped by debounce. If an event storm has already started, the sessions will run to completion. Debounce only prevents NEW triggers.

Re-patching After Updates

OpenClaw or extension updates may overwrite monitor.js. After any update:

bash ./skills/feishu-doc-collab/scripts/patch-monitor.sh
openclaw gateway restart

The patch script is idempotent — checks for both /hooks/agent and _editDebounce markers.

Limitations

  • Requires patching OpenClaw extension files (fragile across updates)
  • Feishu app needs drive.file.edit_v1 event subscription approval
  • Multiple OAuth scopes must be authorized (use batch auth for convenience)
  • Document must use the structured protocol format for reliable routing
  • Works best with docx type; other file types (sheets, slides) are not supported
  • Isolated hook sessions reuse cached OAuth tokens from the main interactive session

Credits

Created by dongwei. Inspired by the need for real-time human-AI collaboration in Chinese enterprise workflows using Feishu/Lark.

License

MIT

安全使用建议
This skill will overwrite your OpenClaw/Lark monitor code and read your ~/.openclaw/openclaw.json hooks.token to call the local /hooks/agent endpoint. That behavior is required for the feature, but the registry did not declare the config path or token requirement — so it's easy to miss. Before installing: (1) review references/monitor-full-patched.js line-by-line to confirm it only performs the documented actions (reads openclaw.json, debounces edits, POSTs to localhost); (2) back up your existing monitor.js/ts (the script does this but double-check); (3) test in a non-production environment first; (4) consider creating a dedicated OpenClaw gateway/hooks token with minimal privileges to limit blast radius; (5) verify the skill's publisher/trustworthiness since the package author could replace the packaged monitor file with code that exfiltrates secrets. If you are uncomfortable modifying installed extension files or exposing a hooks token, do not install this skill.
功能分析
Type: OpenClaw Skill Name: feishu-doc-collab Version: 1.2.0 The skill performs invasive patching of the OpenClaw Feishu extension's source code (monitor.js) via a bash script (patch-monitor.sh) to intercept document edit events. The patched code programmatically reads the sensitive 'hooks.token' from the global 'openclaw.json' configuration file to authenticate local API calls to the /hooks/agent endpoint. While these actions are aligned with the stated purpose of enabling real-time document collaboration, the method of overwriting extension files and extracting system-wide secrets represents a significant security risk and bypasses standard plugin boundaries.
能力评估
Purpose & Capability
The skill's code and instructions align with the stated purpose: it patches the Feishu/OpenClaw monitor to detect document edit events and trigger an isolated agent session. However, the skill accesses the OpenClaw hooks token stored in ~/.openclaw/openclaw.json (to call /hooks/agent) even though no config paths or credentials are declared in the registry metadata — an inconsistency between declared requirements and actual needs.
Instruction Scope
The SKILL.md and scripts explicitly instruct the operator to overwrite the platform's monitor.js/monitor.ts with the provided patched file and to enable a hooks token in openclaw.json. The instructions therefore direct reading of a local config file (~/.openclaw/openclaw.json) and modification of an unrelated extension file — activities outside the simple 'skill' scope and high-impact (persistent change to platform behavior).
Install Mechanism
There is no remote download, but the provided patch script copies a packaged reference JS file over the platform's monitor file (with a backup). Overwriting an installed extension file is high-impact: it modifies code that will run continuously and survive restarts/updates. The script is idempotent and makes a backup, but this install approach requires filesystem write access to system/user extension locations and therefore increases risk.
Credentials
The registry lists no required env vars or config paths, but the runtime code reads ~/.openclaw/openclaw.json to extract hooks.token and gateway.port. That token is a sensitive local secret used to authorize calls to /hooks/agent; the skill requires it to operate but the metadata didn't declare it. Reading local config files containing credentials is proportionate to the stated goal, but the lack of declaration is an inconsistency and a potential surprise to users.
Persistence & Privilege
The skill persists by replacing the platform's monitor implementation and registering event handlers that autonomously trigger agent sessions on document edits. While autonomous invocation is a normal capability, the combination of (a) modifying an extension file that runs continuously and (b) needing a hooks token to call into the agent gives the skill persistent, operational privilege on the host. This change is not gated by the registry metadata and thus deserves caution.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install feishu-doc-collab
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /feishu-doc-collab 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.2.0
v1.2.0: Support openclaw-lark extension (compiled .js), deliver:false for hook sessions, drive.file.read_v1 empty handler, OAuth permission docs, debounce improvements
v1.1.0
Added 30s debounce to prevent event storms; documented known issues; updated patch script with smart detection
v1.0.0
Initial release: real-time AI collaboration in Feishu docs via edit event detection and structured in-doc chat protocol.
元数据
Slug feishu-doc-collab
版本 1.2.0
许可证 MIT-0
累计安装 0
当前安装数 0
历史版本数 3
常见问题

Feishu Doc Collab 是什么?

Enable real-time AI collaboration in Feishu (Lark) documents. When a user edits a Feishu doc, the agent automatically detects the change, reads the document,... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 308 次。

如何安装 Feishu Doc Collab?

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

Feishu Doc Collab 是免费的吗?

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

Feishu Doc Collab 支持哪些平台?

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

谁开发了 Feishu Doc Collab?

由 dongweiii(@dongweiii)开发并维护,当前版本 v1.2.0。

💬 留言讨论