微信收藏知识库

v1.1.4

微信收藏夹导出、智能分类与知识库管理。支持从解析后的 favorite.db 导出收藏记录、三级分类体系(一级9类 + 二级57标签 + 跨领域6类)、LLM 智能增强(可选)、批量导入 IMA 知识库(可选)。核心功能支持离线使用,网络功能默认关闭。

1· 181·0 current·0 all-time
byBrainClaw@geosun

Install

OpenClaw Prompt Flow

Install with OpenClaw

Best for remote or guided setup. Copy the exact prompt, then paste it into OpenClaw for geosun/wechat-favorites.

Previewing Install & Setup.
Prompt PreviewInstall & Setup
Install the skill "微信收藏知识库" (geosun/wechat-favorites) from ClawHub.
Skill page: https://clawhub.ai/geosun/wechat-favorites
Keep the work scoped to this skill only.
After install, inspect the skill metadata and help me finish setup.
Use only the metadata you can verify from ClawHub; do not invent missing requirements.
Ask before making any broader environment changes.

Command Line

CLI Commands

Use the direct CLI path if you want to install manually and keep every step visible.

OpenClaw CLI

Bare skill slug

openclaw skills install wechat-favorites

ClawHub CLI

Package manager switcher

npx clawhub@latest install wechat-favorites
Security Scan
Capability signals
CryptoCan make purchasesRequires sensitive credentials
These labels describe what authority the skill may exercise. They are separate from suspicious or malicious moderation verdicts.
VirusTotalVirusTotal
Pending
View report →
OpenClawOpenClaw
Benign
medium confidence
Purpose & Capability
Name/description (WeChat favorites export, classification, optional LLM/IMA import) matches the included scripts: decrypt_db.py, export_favorites.py, classify_favorites.py, llm_*.py and import_ima.py. Required operations (reading favorite.db, classifying, optionally calling LLM or IMA) align with the stated capability. The skill does expect an all_keys.json to decrypt SQLCipher DBs (decrypt_db.py prints '请先运行 find_all_keys.py'), and SKILL.md explicitly suggests pre-parsing favorite.db using other tools — together these are consistent with the described workflow.
Instruction Scope
SKILL.md and scripts limit actions to local file parsing/processing and optional network calls for LLM and IMA. Sensitive actions are limited: decrypt_db requires a local all_keys.json and reads files under the detected db_storage path; llm_classify only sends title/source/url (not full content) per the prompt build. The skill will auto-detect and write a local config.json and may scan user directories (APPDATA, ~/Documents/xwechat_files, etc.) to find WeChat db paths — this is expected but worth noting.
Install Mechanism
No install spec; code is instruction-only and runs locally. No remote download/extract behavior observed. This minimizes supply-chain risks compared with arbitrary installers.
Credentials
The skill declares no required env vars but the code optionally reads SAFE_MODE, LLM_API_KEY/LLM_API_URL/LLM_MODEL and IMA_CLIENT_ID/IMA_API_KEY/IMA_KB_ID (or files under ~/.config/ima). These are proportionate to the optional LLM and IMA features and are documented in SKILL.md. Users should verify and control any API keys placed in environment or ~/.config/ima before use.
Persistence & Privilege
always:false and normal model invocation. The skill writes/updates its own config.json (scripts/config.py auto-saves detected db_dir) and creates output directories (decrypted/, exported_favorites/, exported state/log files) — expected for a local data processing tool. It does not modify other skills or system-wide agent settings.
Assessment
This skill appears to do what it says: local decryption/export/classification of WeChat favorites, with optional LLM classification and optional bulk import to Tencent IMA. Before installing/running, consider: 1) Data sensitivity — decrypt_db will attempt to decrypt local WeChat DB files if you supply a keys file (all_keys.json); ensure that all_keys.json was created by you with a trusted tool and that you are comfortable decrypting the files on this machine. 2) Auto-detection — config.py may auto-detect WeChat data directories and will write config.json to the script directory; if you prefer manual control, create config.json yourself. 3) Network/credentials are optional — set SAFE_MODE=1 to force offline operation; if you enable LLM or IMA, provide LLM_API_KEY / IMA credentials only in trusted environments and understand which fields are sent (LLM code builds prompts containing title/source/url; import_ima sends URL lists to ima.qq.com). 4) Code quality notes: import_ima.py contains a bug (uses undefined variable batch_count) which may raise an exception; llm and incremental scripts expect LLM_API_KEY for network usage. 5) Least privilege: run in an isolated/trusted environment and review/verify config and credential files (~/.config/ima, environment variables) before use. If you want greater assurance, run the scripts on a copy of your data or inspect the few omitted helper files (e.g., find_all_keys.py if you plan to extract keys) so you understand how keys are produced.

Like a lobster shell, security has layers — review code before you run it.

latestvk971qhcxsak65tds2xx1099df985kvzg
181downloads
1stars
8versions
Updated 1d ago
v1.1.4
MIT-0

微信收藏知识库

Decrypt, categorize and organize wechat favorites (Official Account collection) into knowledge base

收藏夹导出 · 智能分类 · 知识库导入

快速上手: 解析收藏夹 → 导出记录 → 智能分类 → 导入 IMA 知识库

💡 试试这样说: "帮我整理微信收藏" / "导出收藏夹并分类" / "把微信收藏导入知识库" / "解析 favorite.db 导出文章"


触发词: 微信收藏(WeChat Favorites)、收藏夹导出(favorites export)、收藏文章分类(favorites classification)、IMA 知识库导入(knowledge base import)、收藏整理(favorites organizer)、微信公众号收藏、公众号文章整理


为什么用这个工具?

微信收藏夹积累了大量文章:随手打的标签越来越复杂,待读越积越多,从来没有真正整理过,也不记得读了哪些、学到了什么。这个工具可以:

  • 自动分类 — 96% 的文章自动归入 9 大类,无需手动整理
  • 细粒度标签 — 57 个二级标签,精准定位细分主题
  • 跨领域识别 — 自动标注"生物医药+投资"等复合主题
  • LLM 增强 — 低置信度条目用大模型智能重判
  • 知识库导入 — 一键导入 IMA,构建个人知识库

实测数据

基于 32,333 篇文章(2014-2025 收藏):

指标数值
总收藏数36,853
文章数32,333
一级分类覆盖率96.0% (31,088/32,333)
LLM 重分类成功率98.5% (8,789/8,912)
二级标签平均覆盖率35.5%

核心能力

能力说明
收藏导出从解析后的 favorite.db 导出全部收藏记录为 CSV
关键词分类一级分类 9 类(生物医药/AI/投资等),关键词匹配自动识别
标签增强二级标签 57 个 + 跨领域标签 6 类,支持多标签组合
LLM 增强(可选)置信度 < 0.4 时自动调用 LLM 二次分类,需配置 API Key
IMA导入(可选)批量导入到 IMA 知识库,需配置凭证
报告生成分类统计、各分类 CSV 导出

前置条件

1. 微信收藏数据库

本工具需要已解析的 favorite.db 文件。解析步骤请使用专门的微信数据库处理工具。

2. Python 环境

pip install pycryptodome zstandard

3. IMA 导入(可选)

如需导入 IMA 知识库:

  1. 创建 IMA 知识库,获取 kb_id
  2. 配置凭证:~/.config/ima/client_id~/.config/ima/api_key

4. IMA 导入配置(可选)

IMA 凭证支持多种配置方式(优先级从高到低):

方式说明
命令行参数--client-id, --api-key, --kb-id
环境变量IMA_CLIENT_ID, IMA_API_KEY, IMA_KB_ID
config.jsonima_kb_id 字段
文件~/.config/ima/client_id, ~/.config/ima/api_key
# 方式 1: 命令行参数
python import_ima.py --kb-id YOUR_KB_ID --client-id XXX --api-key YYY

# 方式 2: 环境变量
IMA_CLIENT_ID=xxx IMA_API_KEY=yyy python import_ima.py

# 方式 3: 配置文件
# 在项目目录创建 config.json,填写 ima_kb_id
# 创建 ~/.config/ima/client_id 和 api_key 文件

安全说明

本工具涉及本地文件操作与可选网络调用。所有核心功能(导出 + 本地分类)可在离线环境完成,无需任何网络配置。

操作行为数据流向说明
收藏导出读取已解析的 favorite.db,导出为 CSV本地只读核心功能,完全离线
智能分类基于关键词本地分类本地计算核心功能,完全离线
LLM 分类可选,将标题/摘要发送至外部 LLM API本地 → OpenRouter (可选,需配置)默认关闭,不调用外部 API
IMA 导入可选,将收藏 URL 列表发送至腾讯 IMA本地 → ima.qq.com (可选,需配置)默认关闭,不调用外部 API
凭证读取读取本地 ~/.config/ima/ 凭证文件本地读取仅 IMA 功能需要,不上传凭证

可选功能说明:

  • LLM 分类:依赖 llm_classify.py,通过 OpenRouter API 调用大模型。默认关闭,需设置 LLM_API_URL 等环境变量才会发起网络请求
  • IMA 导入:依赖 import_ima.py,调用腾讯 IMA 知识库 API。默认关闭,需配置 client_id/api_key 才会发起网络请求
  • SAFE_MODE完全禁用网络功能,设置 SAFE_MODE=1 环境变量即可强制离线模式
  • 敏感数据:LLM 仅发送文章标题和摘要,不发送正文内容; IMA 仅发送收藏的 URL 列表,不包含微信聊天记录

离线使用方案:

  • 导出 + 本地分类:无需网络,无需配置任何 API
  • LLM 增强:可使用本地模型(修改 LLM_API_URL 指向本地 Ollama)
  • IMA 导入:可选功能,不导入不影响其他功能

建议: 在信任的网络环境或离线环境使用,网络功能均为可选,默认关闭。

快速开始

cd scripts

# 0. 验证环境
python quick_validate.py

# 1. 解析数据库(如未解析)
python decrypt_db.py  # 或使用其他工具

# 2. 导出收藏记录
python export_favorites.py

# 3. 智能分类(支持 LLM 增强)
python classify_favorites.py

# 4. 导入 IMA(可选)
python import_ima.py

目录结构

wechat-favorites/
├── SKILL.md                     # 本文件
├── LICENSE.txt                  # MIT License
├── CHANGELOG.md                 # 更新日志
├── requirements.txt             # 依赖声明
├── config.json                  # 用户配置(需创建)
├── scripts/
│   ├── quick_validate.py        # 环境验证
│   ├── decrypt_db.py            # 数据库解析
│   ├── export_favorites.py      # 收藏导出
│   ├── classify_favorites.py    # 智能分类(一级+二级+跨领域)
│   ├── llm_classify.py          # LLM 二次分类模块
│   ├── llm_incremental.py       # LLM 增量批处理
│   ├── merge_llm_results.py     # LLM 结果合并
│   ├── normalize_categories.py  # 标签标准化
│   ├── import_ima.py            # IMA 导入
│   ├── config.py                # 配置加载
│   └── key_utils.py             # 密钥工具
├── decrypted/                   # 解析输出
│   └── favorite/favorite.db
├── exported_favorites/          # 导出输出
│   ├── favorites_all.csv        # 全部收藏
│   ├── articles_final.csv       # 带分类标签
│   ├── cat_biomed.csv           # 生物医药分类
│   ├── cat_AI科技.csv           # AI 分类
│   └── ...
└── references/
    ├── classification.md        # 分类算法说明
    └── schema.md                # 数据库结构

数据流程

favorite.db (加密)
      │
      ▼ decrypt_db.py
favorite.db (解析后)
      │
      ▼ export_favorites.py
favorites_all.csv
      │
      ▼ classify_favorites.py [--llm]
articles_final.csv + cat_*.csv
      │
      ▼ import_ima.py
IMA 知识库

分类体系

一级分类(9类)

分类关键词示例
生物医药创新药、ADC、CAR-T、mRNA、临床试验、靶点、抗体
AI科技GPT、大模型、Agent、RAG、芯片、GPU、NVIDIA
投资金融IPO、融资、科创板、估值、基金、VC、PE
科学研究Nature、Science、论文、神经科学、突破
商业财经企业战略、行业分析、商业模式、宏观
生活方式健康、运动、旅行、读书、电影
媒体资讯新闻、热点、评论、舆论
政治国际国际关系、地缘政治、中美、外交
其他未命中以上分类

二级标签(57个)

每个一级分类下设细分标签,关键词匹配自动识别:

一级分类二级标签示例
生物医药ADC、CAR-T、mRNA、创新药、临床、神经科学、免疫治疗、基因编辑、疫苗、医疗器械...
AI科技大模型、AI应用、AI医疗、自动驾驶、机器人、GPU、芯片、深度学习、RAG、Agent...
投资金融VC/PE、二级市场、IPO、并购、估值、私募、公募、债券、量化...
科学研究神经科学、物理、化学、生物、材料、天文学、量子计算...
商业财经企业战略、行业分析、商业模式、宏观经济、消费、零售...
生活方式健康、运动、旅行、读书、电影、美食、教育...

完整标签列表见 references/classification.md

跨领域标签(6类)

识别跨领域主题,多标签组合:

跨领域标签触发条件
生物医药+投资医药领域 + 融资/IPO/估值关键词
AI+医疗AI领域 + 医疗/医院/诊断关键词
AI+投资AI领域 + 融资/IPO/估值关键词
生物医药+AI医药领域 + AI/大模型关键词
商业+政治商业领域 + 国际关系/政策关键词
科学+政策科学领域 + 政策/监管关键词

LLM 二次分类

关键词分类置信度不足时,可启用 LLM 二次分类进行智能重判:

# 置信度低于 0.4 时触发 LLM
python classify_favorites.py --llm

# 全量 LLM 分类(跳过关键词)
python classify_favorites.py --llm-only

# 自定义触发阈值
python classify_favorites.py --llm --llm-threshold 0.3

环境变量配置:

变量默认值说明
LLM_API_URLhttp://localhost:4200/v1/chat/completionsAPI 地址
LLM_MODELauto模型名称
LLM_CONCURRENCY5最大并发数
LLM_BATCH_SIZE10每批处理数量

OpenRouter 配置示例:

export LLM_API_URL="https://openrouter.ai/api/v1/chat/completions"
export LLM_MODEL="deepseek/deepseek-chat"
export LLM_API_KEY="your-openrouter-api-key"

输出文件说明

文件内容
favorites_all.csv全部收藏记录
articles_final.csvcategorysubcategorycross_domain 标签的文章
cat_*.csv各分类单独文件
llm_checkpoint.jsonLLM 分类断点(增量处理)
ima_import_state.jsonIMA 导入进度(断点续传)
ima_import.logIMA 导入日志

CSV 字段说明:

字段说明
local_id原始记录 ID
title文章标题
url文章链接
desc摘要
source来源公众号
create_time收藏时间
category一级分类
subcategory二级标签(多个用逗号分隔)
cross_domain跨领域标签(多个用逗号分隔)
confidence分类置信度

favorite.db 表结构

CREATE TABLE fav_db_item (
    local_id INTEGER PRIMARY KEY,
    fav_local_type INTEGER,  -- 类型:1=文章, 3=图片, 等
    status INTEGER,
    create_time INTEGER,     -- 收藏时间戳
    source_id TEXT,          -- 来源 wxid
    source_type INTEGER,
    content BLOB,            -- XML 内容
    WCDB_CT_content INTEGER  -- 压缩标记:4=zstd
);

content 字段解析:

  • <title> 标题
  • <url> 链接
  • <source> 来源公众号
  • <description> 摘要

常见问题

Q: 收藏数据不完整? A: 检查 favorite.db 最后修改时间,微信可能未同步最新数据。

Q: IMA 导入被限流? A: API 限流约 200 次/小时,脚本已内置 3 秒/批的限速。

Q: 如何新增分类? A: 编辑 classify_favorites.py 中的 CATEGORIES 字典。

Q: 解析失败? A: 确保密钥正确,检查 all_keys.json 是否包含 favorite.db 的密钥。

Q: LLM 分类中断了怎么办? A: 脚本自动保存断点到 llm_checkpoint.json,重新运行会从中断处继续。

技术细节

SQLCipher 4 参数

  • 加密:AES-256-CBC + HMAC-SHA512
  • KDF:PBKDF2-HMAC-SHA512,256,000 iterations
  • 页面:4096 bytes,reserve = 80

支持平台

平台解析支持
Windows
Linux
macOS

相关链接

参考资料

更新日志

v1.1 — 2026-04

  • 分类体系升级:新增三级分类体系——9大主类、57个二级标签、6个跨领域标签,分类更精细多元
  • 文档全面优化:完善 SKILL.md,补充分类逻辑说明、LLM 使用指南、实测数据、文件格式说明
  • 快速上手简化:精简配置示例、优化命令说明、增强引导提示、补充常用触发词,方便快速上手
  • LLM 智能增强(可选):新增 LLM 辅助分类脚本(llm_classify.py、llm_incremental.py、merge_llm_results.py、normalize_categories.py),低置信度或模糊条目可交由大模型重新分类
  • 安全说明强化:新增## 安全说明章节,强调本地化、隐私保护与数据安全
  • 版本升级:1.1.0 → 1.1,新显示名(微信收藏知识库)

License

MIT License

免责声明

本工具仅供个人备份和学习使用。请勿用于任何商业用途或违法行为。解析的数据仅限个人所有,不得传播或用于侵犯他人隐私。

Comments

Loading comments...