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, and responds inline — turning any Feishu document into a live human-AI conversation. Features: - Feishu document edit event → triggers isolated agent session automatically - Structured in-doc chat protocol (status flags prevent premature AI responses while user is still typing) - Multi-party support: multiple humans + multiple AI agents in one document - Bitable (spreadsheet) task board integration for collaborative task management - Anti-loop: bot's own edits are automatically ignored Triggers: Feishu doc collaboration, 飞书文档协作, document edit event, in-doc chat, 文档内对话, Lark document AI, feishu doc auto-reply, 飞书文档自动回复
Best use case
feishu-doc-collab is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
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, and responds inline — turning any Feishu document into a live human-AI conversation. Features: - Feishu document edit event → triggers isolated agent session automatically - Structured in-doc chat protocol (status flags prevent premature AI responses while user is still typing) - Multi-party support: multiple humans + multiple AI agents in one document - Bitable (spreadsheet) task board integration for collaborative task management - Anti-loop: bot's own edits are automatically ignored Triggers: Feishu doc collaboration, 飞书文档协作, document edit event, in-doc chat, 文档内对话, Lark document AI, feishu doc auto-reply, 飞书文档自动回复
Teams using feishu-doc-collab should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/feishu-doc-collab/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How feishu-doc-collab Compares
| Feature / Agent | feishu-doc-collab | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
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, and responds inline — turning any Feishu document into a live human-AI conversation. Features: - Feishu document edit event → triggers isolated agent session automatically - Structured in-doc chat protocol (status flags prevent premature AI responses while user is still typing) - Multi-party support: multiple humans + multiple AI agents in one document - Bitable (spreadsheet) task board integration for collaborative task management - Anti-loop: bot's own edits are automatically ignored Triggers: Feishu doc collaboration, 飞书文档协作, document edit event, in-doc chat, 文档内对话, Lark document AI, feishu doc auto-reply, 飞书文档自动回复
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
SKILL.md Source
# 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. **Feishu app event subscriptions enabled:**
- `drive.file.edit_v1` — document edit events
- `drive.file.bitable_record_changed_v1` — (optional) bitable record changes
3. **Hooks enabled** in `openclaw.json`:
```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:
```bash
# Generate a random token
TOKEN=$(openssl rand -hex 16)
echo "Your hooks token: $TOKEN"
# Then add to openclaw.json:
# "hooks": { "enabled": true, "token": "<TOKEN>" }
```
### Step 2: Apply the monitor patch
```bash
bash ./skills/feishu-doc-collab/scripts/patch-monitor.sh
```
This patches `monitor.ts` in the Feishu extension to:
- Detect `drive.file.edit_v1` events
- Trigger an isolated agent session via `/hooks/agent`
- The agent reads the doc, checks for new messages, and responds
### Step 3: Configure your agent identity
Edit `./skills/feishu-doc-collab/config.json`:
```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
```bash
openclaw gateway restart
```
### Step 5: Set up the Doc Chat Protocol
Copy the protocol template to your workspace:
```bash
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
POST /hooks/agent with isolated session instructions
↓
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:
```markdown
---
> **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`:
```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 updates overwrite `monitor.ts`.** After any update:
```bash
bash ./skills/feishu-doc-collab/scripts/patch-monitor.sh
openclaw gateway restart
```
The patch script is idempotent — safe to run multiple times.
## 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<string, 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 updates overwrite `monitor.ts`. After any update:
```bash
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 source files (fragile across updates)
- Feishu app needs `drive.file.edit_v1` event subscription approval
- Document must use the structured protocol format for reliable routing
- Works best with docx type; other file types (sheets, slides) are not supported
## Credits
Created by dongwei. Inspired by the need for real-time human-AI collaboration
in Chinese enterprise workflows using Feishu/Lark.
## License
MITRelated Skills
feishu-evolver-wrapper
Feishu-integrated wrapper for the capability-evolver. Manages the evolution loop lifecycle (start/stop/ensure), sends rich Feishu card reports, and provides dashboard visualization. Use when running evolver with Feishu reporting or when managing the evolution daemon.
feishu-doc
Fetch content from Feishu (Lark) Wiki, Docs, Sheets, and Bitable. Automatically resolves Wiki URLs to real entities and converts content to Markdown.
youtube-watcher
Fetch and read transcripts from YouTube videos. Use when you need to summarize a video, answer questions about its content, or extract information from it.
youtube-transcript
Fetch and summarize YouTube video transcripts. Use when asked to summarize, transcribe, or extract content from YouTube videos. Handles transcript fetching via residential IP proxy to bypass YouTube's cloud IP blocks.
youtube-auto-captions - YouTube 自动字幕
## 描述
youtube
YouTube Data API integration with managed OAuth. Search videos, manage playlists, access channel data, and interact with comments. Use this skill when users want to interact with YouTube. For other third party apps, use the api-gateway skill (https://clawhub.ai/byungkyu/api-gateway).
yahoo-finance
Get stock prices, quotes, fundamentals, earnings, options, dividends, and analyst ratings using Yahoo Finance. Uses yfinance library - no API key required.
xurl
A Twitter research and content intelligence skill focused on attracting WordPress and Shopify clients. Use to analyze Twitter profiles, threads, and conversations for: (1) Identifying what small agency founders and eCommerce brands are discussing; (2) Understanding pain points around WordPress performance, Shopify CRO, and development bottlenecks; (3) Extracting high-performing content angles; (4) Turning insights into authority-building posts; (5) Converting Twitter intelligence into business leverage for clear content angles, strong positioning, and qualified inbound leads.
xlsx
Use this skill any time a spreadsheet file is the primary input or output. This means any task where the user wants to: open, read, edit, or fix an existing .xlsx, .xlsm, .csv, or .tsv file (e.g., adding columns, computing formulas, formatting, charting, cleaning messy data); create a new spreadsheet from scratch or from other data sources; or convert between tabular file formats. Trigger especially when the user references a spreadsheet file by name or path — even casually (like "the xlsx in my downloads") — and wants something done to it or produced from it. Also trigger for cleaning or restructuring messy tabular data files (malformed rows, misplaced headers, junk data) into proper spreadsheets. The deliverable must be a spreadsheet file. Do NOT trigger when the primary deliverable is a Word document, HTML report, standalone Python script, database pipeline, or Google Sheets API integration, even if tabular data is involved.
xiaohongshu-mcp
Automate Xiaohongshu (RedNote) content operations using a Python client for the xiaohongshu-mcp server. Use for: (1) Publishing image, text, and video content, (2) Searching for notes and trends, (3) Analyzing post details and comments, (4) Managing user profiles and content feeds. Triggers: xiaohongshu automation, rednote content, publish to xiaohongshu, xiaohongshu search, social media management.
twitter-openclaw
Interact with Twitter/X — read tweets, search, post, like, retweet, and manage your timeline.
x-twitter-growth
X/Twitter growth engine for building audience, crafting viral content, and analyzing engagement. Use when the user wants to grow on X/Twitter, write tweets or threads, analyze their X profile, research competitors on X, plan a posting strategy, or optimize engagement. Complements social-content (generic multi-platform) with X-specific depth: algorithm mechanics, thread engineering, reply strategy, profile optimization, and competitive intelligence via web search.