CRITICAL — Before starting, you MUST first use the Read tool to read lark-shared/SKILL.md, which contains authentication, permission handling, and security rules.
Applicable Scenarios
- "Check the status of the knowledge base" / "Which documents are outdated"
- "Knowledge base health report" / "Audit the knowledge base"
- "Are there any documents that haven't been updated for a long time" / "Knowledge base structure analysis"
- "Knowledge base optimization suggestions" / "Wiki audit"
- "Clean up the knowledge base" / "Which documents may need updating"
Together with existing Skills, it forms the "Knowledge Management Trio":
knowledge-qa:Search Q&A — Use the knowledge basedoc-summarizer:Document Summary — Understand the knowledge basewiki-auditor(this Skill):Health Audit — Maintain the knowledge base
Prerequisites
Supports user identity. Before execution, ensure authorization has been granted:
lark-cli auth login --domain wiki,drive
Workflow
指定知识空间 ──► wiki spaces list(列出可用空间)
│
▼
wiki nodes(遍历节点树)
│
▼
drive metas(获取文档元数据)
│
▼
AI 健康度分析
┌────────┼────────┐
▼ ▼ ▼
过时检测 结构分析 覆盖评估
│
▼
健康度审计报告
Step 1: List knowledge spaces
Refer to lark-wiki/SKILL.md。
# 列出所有可见的知识空间
lark-cli wiki spaces list --format json
If there are multiple spaces, list them for the user to choose:
找到 3 个知识空间:
1. 产品团队知识库(space_id: xxx)
2. 技术文档库(space_id: yyy)
3. 公司公共知识库(space_id: zzz)
请选择要审计的知识空间(输入序号,或"全部")
Step 2: Traverse knowledge nodes
# 获取空间根节点下的子节点
lark-cli wiki spaces nodes list --params '{"space_id":"<space_id>","page_size":50}' --format json
# 获取子节点的子节点(递归)
lark-cli wiki spaces nodes list --params '{"space_id":"<space_id>","parent_node_token":"<parent_token>","page_size":50}' --format json
For each node, record:
node_token: node tokenobj_token: associated document tokenobj_type: document typetitle: titlehas_child: whether it has child nodes- Node hierarchy depth (calculated based on recursion depth)
⚠️ Data volume control: A large knowledge base may have hundreds of nodes. It is recommended to limit the maximum traversal depth to 3-4 levels; when exceeded, prompt the user to narrow the scope.
Step 3: Obtain document metadata
Refer to lark-drive/SKILL.md。
# 批量获取文档元数据(每次最多 15 个)
lark-cli drive metas batch_query --data '{
"request_docs": [
{"doc_type": "docx", "doc_token": "<token1>"},
{"doc_type": "docx", "doc_token": "<token2>"}
],
"with_url": true
}' --format json
Extract from the metadata:
latest_modify_time: last modified timecreate_time: creation timeowner: document ownerurl: document link
Step 4: AI health analysis
4.1 Outdated document detection:
| Outdated level | Time since last update | Mark |
|---|---|---|
| Fresh | < 30 days | 🟢 |
| Normal | 30-90 days | 🟡 |
| Stale | 90-180 days | 🟠 |
| Outdated | > 180 days | 🔴 |
4.2 Structure analysis:
- Hierarchy depth distribution (too deep > 4 levels is not conducive to discovery)
- Isolated nodes (proportion of leaf nodes that have documents but no child nodes and no sibling nodes)
- Empty nodes (nodes exist but the associated document is empty or has been deleted)
- Directory balance (too many documents under a single directory > 20)
4.3 Coverage assessment:
- Total number of documents
- Distribution by document type (docx / sheet / bitable, etc.)
- Distribution by creator (whether highly concentrated among a few people)
Step 5: Generate audit report
## 📚 知识库健康度报告
### 空间信息
- **知识空间**:{空间名称}
- **审计时间**:{当前日期}
- **总文档数**:{N} 篇
- **节点层级**:最深 {M} 层
### 🏥 健康度评分
| 维度 | 评分 | 说明 |
|------|------|------|
| 内容新鲜度 | {X}/100 | 基于文档更新时间分布 |
| 结构合理性 | {Y}/100 | 基于层级深度和目录均衡度 |
| 覆盖完整性 | {Z}/100 | 基于文档数量和类型分布 |
| **综合评分** | **{总分}/100** | **{优秀/良好/需改进/较差}** |
### 🔴 过时文档清单(需关注)
| # | 文档标题 | 最后更新 | 距今 | 拥有者 | 链接 |
|---|---------|---------|------|--------|------|
| 1 | XX 接口文档 v1.0 | 2025-06-15 | 292天 | 张三 | [查看]({链接}) |
| 2 | YY 项目设计方案 | 2025-08-20 | 226天 | 李四 | [查看]({链接}) |
| 3 | ZZ 操作手册 | 2025-09-10 | 205天 | 王五 | [查看]({链接}) |
### 📊 新鲜度分布
🟢 Fresh (<30 days) ████████░░ 35% ({N} articles) 🟡 Normal (30-90 days) ██████░░░░ 28% ({N} articles) 🟠 Stale (90-180 days) ████░░░░░░ 22% ({N} articles) 🔴 Outdated (>180 days) ███░░░░░░░ 15% ({N} articles)
### 🗂️ 结构分析
- **层级分布**:1层 {N}个 | 2层 {N}个 | 3层 {N}个 | 4层+ {N}个
- ⚠️ 「{目录名}」下有 {N} 篇文档,建议拆分子目录
- ⚠️ 发现 {N} 个空节点(可能是已删除的文档引用)
- ⚠️ 层级深度 > 4 层的分支有 {N} 个
### 👤 贡献者分布
| 作者 | 文档数 | 占比 |
|------|--------|------|
| 张三 | 25 | 35% |
| 李四 | 18 | 25% |
| 其他 | 28 | 40% |
### 💡 优化建议
1. **{建议 1}**:{针对过时文档的具体建议}
2. **{建议 2}**:{针对结构问题的具体建议}
3. **{建议 3}**:{针对贡献者集中度的建议}
Step 6: Automatically create remediation suggestion Wiki (optional, v1.0.7+)
When the user wants to write the audit results to the knowledge base:
# 在知识库中创建审计报告节点(v1.0.7+ shortcut)
lark-cli wiki +node-create --space-id "<space_id>" \
--parent-node-token "<parent_token>" \
--title "知识库审计报告 (<date>)"
Tip: The audit report can be directly embedded in the knowledge base, making it convenient for the team to view and track remediation progress.
Step 7: Automatically fix misplaced documents (optional, v1.0.10+)
When the audit finds that a document is placed in an unreasonable location, it can be directly moved to the correct directory:
# 将错位文档移动到正确目录(v1.0.10+ shortcut)
lark-cli wiki +move --space-id "<space_id>" \
--node-token "<misplaced_node_token>" \
--target-parent-token "<correct_parent_token>"
⚠️ Safety rule: Before moving a document, the change plan must be displayed and user confirmation obtained. Tip:
wiki +moveSupports asynchronous task polling, so long-running operations will not time out.
Fault tolerance mechanism
| Exception scenario | Handling method |
|---|---|
| No access permission to the knowledge space | Prompt the user to join the space or contact the administrator |
| Number of nodes > 200 | Limit the traversal depth to 2 levels and prompt the user to narrow the scope |
| Failed to retrieve document metadata | Record the failed nodes and analyze the rest normally |
| No documents in the space | Prompt "This knowledge space currently has no documents" |
| drive domain not authorized | Unable to retrieve modification time; perform structural analysis only |
Permission table
| Step | Command | Required scope | Required or not |
|---|---|---|---|
| List spaces | wiki spaces list |
wiki:wiki:readonly |
✅ Required |
| Traverse nodes | wiki spaces nodes list |
wiki:wiki:readonly |
✅ Required |
| Document metadata | drive metas batch_query |
drive:drive:readonly |
Recommended |
| Create audit report | wiki +node-create |
wiki:wiki |
Optional (when writing audit results) |
| Move misplaced documents | wiki +move |
wiki:wiki |
Optional (v1.0.10+) |
Reference
- lark-shared — Authentication, permissions (required reading)
- lark-wiki — Detailed usage for knowledge space traversal
- lark-drive — Document metadata query