SuperAPI AI Directory

lark-workflow-knowledge-base

Office & productivity

View repository

Updated 10-15 23:59

About this skill

Personal Knowledge Base Workflow

CRITICAL — Before starting, you MUST first use the Read tool to read ../lark-shared/SKILL.md, which contains authentication and permission handling

Applicable Scenarios

  • "Help me save this article" / "Save this link to the knowledge base"
  • "What articles are there about AI chips?" / "Search the knowledge base"
  • "I previously saved a video about Nvidia, help me find it"
  • "What has been saved recently?" / "Knowledge base overview"
  • "Associate the new content with what was previously saved"

Prerequisites

Only supports user identity. Ensure authorization before execution:

lark-cli auth login --domain wiki,docs,im,base,drive

Workflow Overview

保存内容:
  用户发送链接/内容 ──► AI 抓取内容 ──► 生成摘要+标签
                                      │
                                      ▼
                              doc +create (知识库) ──► base +record-upsert (索引)

搜索内容:
  自然语言查询 ──► base +record-list ──► 匹配结果
                                       │
                                       ▼
                               doc +fetch (详细内容)

关联分析:
  新保存内容 ──► base +record-list (已有标签/关键词) ──► 发现关联
                                                        │
                                                        ▼
                                               im +messages-send (通知关联)

Data Initialization

First-time Setup

  1. Create/designate a knowledge base space
# 如果用户已有知识库空间,记录 space_id
# 否则在飞书中创建一个个人知识库空间
  1. Create an index multi-dimensional table

Table name: Knowledge Base Index (kb_index)

Field Name Type Description
Title Text Content title
URL URL Original link
Content Type Single select Article/Video/Tweet/PDF/Podcast/Other
Source Platform Single select Website/YouTube/Twitter/X/WeChat Official Account/Other
Tags Multi-select AI-generated tags
Summary Text AI-generated content summary (within 200 characters)
Key Points Text Core viewpoints or conclusions
Document Link URL Feishu document link
Document Token Text Feishu document doc_token
Save Time Date Time added to the database
Related Entries Relation Relate to other knowledge base entries
Rating Number User rating (1-5)
Notes Text User notes

Initialization Commands

# 创建索引表
# 注意:+table-create 可能部分成功,需捕获错误后用 +field-create 补字段
# 注意:连续创建字段会触发限流(错误码 800004135),每次调用间隔至少 1 秒
lark-cli base +table-create --name "知识库索引" --fields '[
  {"name":"标题","type":"text"},
  {"name":"URL","type":"link"},
  {"name":"内容类型","type":"select","multiple":false,"options":[{"name":"文章"},{"name":"视频"},{"name":"推文"},{"name":"PDF"},{"name":"播客"},{"name":"其他"}]},
  {"name":"来源平台","type":"select","multiple":false,"options":[{"name":"网站"},{"name":"YouTube"},{"name":"Twitter/X"},{"name":"公众号"},{"name":"其他"}]},
  {"name":"标签","type":"text"},
  {"name":"摘要","type":"text"},
  {"name":"关键观点","type":"text"},
  {"name":"文档链接","type":"link"},
  {"name":"文档Token","type":"text"},
  {"name":"保存时间","type":"datetime"},
  {"name":"评分","type":"number"},
  {"name":"备注","type":"text"}
]'
# 注:关联条目字段需单独用 +field-create 创建(type="lookup" 需要关联目标表 ID)

Rate Limiting Handling: If +table-create partially fails due to rate limiting, the table will still be created successfully. In this case:

  1. Use base +table-list to get the table_id
  2. Use base +field-create --table-id <id> --json '{"name":"字段名","type":"text"}' to add fields one by one, with an interval of 1-2 seconds each time

Mode 1: Save Content

Step 1: Get Content

Receive from Feishu message:

# 查看用户发送的消息
lark-cli im +chat-messages-list --chat-id "<chat_id>"

Get the URL directly from the conversation: The user sends a link in the conversation, and the AI directly extracts the URL.

Step 2: Fetch Content

Use AI capabilities to fetch the link content:

  • Article URL → Fetch the full text content
  • YouTube videos → Fetch title, description, subtitles/transcript
  • Twitter/X tweets → Fetch the full thread (not just a single post)
  • PDF URL → Download and extract text
  • Podcasts → Fetch title, description, timestamp summary

Step 3: AI generates summaries and tags

For the fetched content, AI automatically processes:

  1. Generate summary: within 200 characters, summarizing the core content
  2. Extract key points: 3-5 key points
  3. Generate tags: 3-8 tags, based on content and topic
  4. Determine content type: article/video/tweet/PDF/other

Step 4: Check for duplicates

lark-cli base +record-list --table-id "<table_id>" --filter '...URL = "<目标URL>"'

If the URL already exists, prompt the user with "This content is already in the knowledge base" and display the existing record.

Step 5: Discover related content

Based on tags and keywords, search for related content in the existing knowledge base:

lark-cli base +record-list --table-id "<table_id>" --filter '...标签 CONTAINS_ANY [标签1, 标签2]'

Step 6: Save to Feishu

Create a Feishu document (in the knowledge base):

lark-cli docs +create --title "<内容标题>" --markdown "<格式化后的全文内容>"

Update the index table:

lark-cli base +record-upsert --table-id "<table_id>" --json '{
  "标题": "...",
  "URL": "...",
  "内容类型": "文章",
  "标签": ["标签1", "标签2"],
  "摘要": "...",
  "关键观点": "...",
  "文档链接": "...",
  "保存时间": "..."
}'

Step 7: Notify the user

lark-cli im +messages-send --chat-id "<chat_id>" --markdown "已保存到知识库!"

The notification includes:

  • Title and summary
  • Automatically generated tags
  • Discovered related content (if any)
  • Feishu document link

Mode 2: Search content

Natural language search

Convert the user's natural language query into a tag/keyword search:

# 基于关键词搜索
lark-cli base +record-list --table-id "<table_id>" --filter '...摘要 CONTAINS "AI芯片"'

# 基于标签搜索
lark-cli base +record-list --table-id "<table_id>" --filter '...标签 CONTAINS_ANY ["AI", "芯片", "Nvidia"]'

# 基于时间搜索
lark-cli base +record-list --table-id "<table_id>" --filter '...保存时间 >= "2026-03-01"'

Search result display

找到 N 条相关内容:

### 1. {标题}
- 类型:文章 | 平台:36氪
- 标签:AI、芯片、GPU
- 摘要:{摘要内容}
- 保存时间:2026-03-15
- [查看详情]({飞书文档链接})

### 2. {标题}
...

Mode 3: Related analysis

When saving new content, automatically perform related analysis with existing content:

AI processing logic:

  1. Extract tags and keywords from the new content
  2. Search the index table for entries with the same/similar tags
  3. Compare semantic similarity of content summaries
  4. Generate a relation note: "You saved a similar viewpoint three weeks ago, which was analyzed from a different angle at the time"

When a relation is discovered:

lark-cli base +record-upsert --table-id "<table_id>" --json '{
  "关联条目": "已有关联条目ID"
}'

Mode 4: Batch import

Supports importing multiple pieces of content at once:

  1. The user sends multiple links (one per line)
  2. AI fetches and processes them one by one
  3. Batch create Feishu documents
  4. Batch update the index table
  5. Generate an import report

Mode 5: Regular organization

Users can request regular organization of the knowledge base:

  • Merge duplicate content
  • Update outdated tags
  • Generate a knowledge base statistics report (total number of entries, distribution by type, distribution by tag, recent saving trends)

Permissions table

Command Required scope
docs +create docx:document:create
docs +fetch docx:document:read
wiki spaces get_node wiki:node:read
im +messages-send im:message:send_as_bot
im +chat-messages-list im:message:readonly
base +table-create bitable:app
base +record-list bitable:app:read
base +record-upsert bitable:app:write
drive metas batch_query drive:drive:read

Reference

  • lark-shared — Authentication, permissions (required reading)
  • lark-doc — +create、+fetch、+search Detailed usage
  • lark-wiki — Knowledge base node management
  • lark-im — +messages-send、+chat-messages-list Detailed usage
  • lark-base — +table-create、+record-list、+record-upsert Detailed usage
  • lark-drive — File metadata query