Skill: jirboy/knowledge-orchestrator (version 1.0.0)

--- name: knowledge-orchestrator description: [已整合] 知识库协调器已整合到 knowledge 统一入口技能 argument-hint: "[操作] [参数]" --- # ⚠️ 已整合 - 请使用 knowledge 统一入口 > **本技能保留用于向后兼容，功能已整合到 `knowledge` 统一入口技能** > > **推荐使用：** `knowledge search/sync/link [参数]` 或直接使用本技能（自动转发） --- # Knowledge Orchestrator（兼容层） 知识库协调器，统一管理 Zotero + Obsidian + IMA 三个平台。 ## 迁移指南 **新用法：** ``` knowledge search RTHS --all knowledge sync 笔记名称 --to-ima knowledge link 10.1002/eqe.1234 RTHS 综述 ``` **旧用法（仍然可用）：** ``` search RTHS --all sync 笔记名称 --to-ima ``` ## 核心功能 - 🔍 统一搜索（跨平台） - ☁️ 云端同步（IMA） - 🔗 关联文献和笔记 ## 配置要求 | 服务 | 配置文件 | 说明 | |------|---------|------| | Zotero | `~/.config/zotero/api_key` | 文献库访问 | | IMA | `~/.config/ima/client_id` | 客户端 ID | | IMA | `~/.config/ima/api_key` | API 密钥 | ## 安全说明 - ✅ 仅发送到官方 API（api.zotero.org, ima.qq.com） - ❌ 不要分享凭据 - ❌ 不要硬编码在脚本中

path: knowledge_search.py
content: #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
知识库统一搜索工具

用法:
    python knowledge_search.py --query "RTHS" --all
    python knowledge_search.py --query "振动台" --zotero --obsidian
"""

import argparse
import json
import sys
from pathlib import Path

# 导入子技能
sys.path.insert(0, str(Path(__file__).parent.parent / 'zotero-manager'))
sys.path.insert(0, str(Path(__file__).parent.parent / 'obsidian-manager'))

try:
    from zotero_search import search_library, get_api_key, get_user_id, format_results as zotero_format
    from obsidian_search import search_notes, format_results as obsidian_format
    ZOTERO_AVAILABLE = True
except ImportError as e:
    print(f"警告：Zotero/Obsidian 模块导入失败：{e}")
    ZOTERO_AVAILABLE = False


def search_ima(query, limit=10):
    """搜索 IMA 知识库（简化版本，待完善）"""
    # TODO: 集成 IMA API
    print(f"[IMA] 搜索：{query}（功能开发中）")
    return []


def search_all(query, limit=10):
    """搜索所有平台"""
    results = {
        'zotero': [],
        'obsidian': [],
        'ima': []
    }
    
    print(f"统一搜索：{query}")
    print("=" * 60)
    
    # 搜索 Zotero
    if ZOTERO_AVAILABLE:
        print("\n【Zotero 文献】")
        try:
            [REDACTED_SECRET])
            user_id = get_user_id(api_key)
            if user_id:
                items = search_library(query, api_key, user_id, limit)
                results['zotero'] = items
                formatted = zotero_format(items)
                print(formatted)
            else:
                print("无法连接 Zotero（API Key 配置？）")
        except ValueError as e:
            print(f"Zotero 未配置：{e}")
        except Exception as e:
            print(f"Zotero 搜索失败：{e}")
    else:
        print("Zotero 模块不可用")
    
    # 搜索 Obsidian
    print("\n【Obsidian 笔记】")
    obsidian_results = search_notes(query, limit=limit)
    results['obsidian'] = obsidian_results
    if obsidian_results:
        print(obsidian_format(obsidian_results))
    else:
        print("未找到匹配的笔记")
    
    # 搜索 IMA
    print("\n【IMA 云端】")
    ima_results = search_ima(query, limit=limit)
    results['ima'] = ima_results
    if ima_results:
        print(ima_results)
    else:
        print("未找到或功能开发中")
    
    # 统计
    print("\n" + "=" * 60)
    total = len(results['zotero']) + len(results['obsidian']) + len(results['ima'])
    print(f"共找到 {total} 条结果")
    print(f"  - Zotero: {len(results['zotero'])} 篇")
    print(f"  - Obsidian: {len(results['obsidian'])} 篇")
    print(f"  - IMA: {len(results['ima'])} 条")
    
    return results


def main():
    parser = argparse.ArgumentParser(description='知识库统一搜索工具')
    parser.add_argument('--query', '-q', type=str, required=True, help='搜索关键词')
    parser.add_argument('--all', action='store_true', help='搜索所有平台')
    parser.add_argument('--zotero', action='store_true', help='仅搜索 Zotero')
    parser.add_argument('--obsidian', action='store_true', help='仅搜索 Obsidian')
    parser.add_argument('--ima', action='store_true', help='仅搜索 IMA')
    parser.add_argument('--limit', '-l', type=int, default=10, help='返回结果数量')
    parser.add_argument('--json', action='store_true', help='以 JSON 格式输出')
    
    args = parser.parse_args()
    
    # 确定搜索范围
    if args.all or (not args.zotero and not args.obsidian and not args.ima):
        results = search_all(args.query, args.limit)
    else:
        results = {}
        if args.zotero:
            print("【Zotero 文献】")
            # TODO: 实现单独搜索
        if args.obsidian:
            print("【Obsidian 笔记】")
            obs_results = search_notes(args.query, limit=args.limit)
            results['obsidian'] = obs_results
            print(obsidian_format(obs_results))
        if args.ima:
            print("【IMA 云端】")
            results['ima'] = search_ima(args.query, args.limit)
    
    if args.json:
        print(json.dumps(results, ensure_ascii=False, indent=2))


if __name__ == '__main__':
    main()


path: package.json
content: license: MIT
version: 1.0.0
description: 知识编排与管理技能
name: knowledge-orchestrator
author: OpenClaw Community

path: README.md
content: # Knowledge Orchestrator 鎶€鑳?
**鐗堟湰锛?* v0.1  
**鍒涘缓鏃堕棿锛?* 2026 骞?3 鏈?26 鏃? 
**鐘舵€侊細** 馃攧 寮€鍙戜腑

---

## 馃幆 鍔熻兘

- 鉁?缁熶竴鎼滅储锛圸otero + Obsidian + IMA锛?- 鈴?鍚屾鍒?IMA
- 鈴?鏂囩尞 - 绗旇鍏宠仈
- 鈴?鐭ヨ瘑鍥捐氨

---

## 馃殌 蹇€熷紑濮?
### 閰嶇疆鍑瘉

**Zotero:**
```bash
mkdir -p D:\Personal\OpenClaw\.config\zotero
echo "your_zotero_api_key" > D:\Personal\OpenClaw\.config\zotero\api_key
```

**IMA:**
```bash
# 宸查厤缃湪 D:\Personal\OpenClaw\.config\ima\
# client_id 鍜?api_key 宸插瓨鍦?```

### 缁熶竴鎼滅储

```bash
cd skills/knowledge-orchestrator
python knowledge_search.py -q "RTHS" --all
```

---

## 馃摉 浣跨敤绀轰緥

### 鎼滅储鎵€鏈夊钩鍙?
```bash
python knowledge_search.py -q "鎸姩鍙版帶鍒? --all -l 10
```

### 浠呮悳绱?Obsidian

```bash
python knowledge_search.py -q "RTHS" --obsidian
```

### 鍚屾绗旇鍒?IMA锛堝緟寮€鍙戯級

```bash
python knowledge_sync.py --note "鎸姩鍙版帶鍒剁郴缁熸灦鏋? --to-ima
```

---

## 馃搧 鏂囦欢缁撴瀯

```
skills/knowledge-orchestrator/
鈹溾攢鈹€ SKILL.md                 # 鎶€鑳藉畾涔?鈹溾攢鈹€ README.md                # 浣跨敤璇存槑锛堟湰鏂囦欢锛?鈹溾攢鈹€ knowledge_search.py      # 缁熶竴鎼滅储
鈹溾攢鈹€ knowledge_sync.py        # 鍚屾鍒?IMA锛堝緟寮€鍙戯級
鈹溾攢鈹€ knowledge_link.py        # 鏂囩尞 - 绗旇鍏宠仈锛堝緟寮€鍙戯級
鈹斺攢鈹€ knowledge_graph.py       # 鐭ヨ瘑鍥捐氨锛堝緟寮€鍙戯級
```

---

## 馃攧 宸ヤ綔娴佺▼

### 鏂囩尞绠＄悊宸ヤ綔娴?```
1. Zotero 瀵煎叆鏂囩尞
   鈫?2. Obsidian 鍒涘缓绗旇
   鈫?3. 鍗忚皟鍣ㄨ嚜鍔ㄥ叧鑱?   鈫?4. 鍚屾鍒?IMA 浜戠
```

### 鐭ヨ瘑妫€绱㈠伐浣滄祦
```
鐢ㄦ埛鎼滅储 鈫?鍗忚皟鍣ㄦ悳绱笁骞冲彴 鈫?姹囨€昏繑鍥炵粨鏋?```

---

## 馃搳 骞冲彴瀵规瘮

| 骞冲彴 | 鐢ㄩ€?| 鎼滅储鑼冨洿 | 鍚屾鏂瑰悜 |
|------|------|----------|----------|
| **Zotero** | 鏂囩尞绠＄悊 | 鏂囩尞鍏冩暟鎹?| 鍗曞悜锛堝鍏ワ級 |
| **Obsidian** | 鐭ヨ瘑绗旇 | 鏈湴绗旇 | 鍙屽悜 |
| **IMA** | 浜戠鍗忎綔 | 浜戠绗旇 | 鍗曞悜锛堝鍑猴級 |

---

## 馃敡 寰呭紑鍙戝姛鑳?
- [ ] `knowledge_sync.py` - 鍚屾鍒?IMA
  - 閫夋嫨绗旇鍚屾
  - 鑷姩鍚屾瑙勫垯
  - 鍐茬獊澶勭悊

- [ ] `knowledge_link.py` - 鏂囩尞 - 绗旇鍏宠仈
  - 閫氳繃 DOI 鍏宠仈
  - 鍙屽悜閾炬帴缁存姢

- [ ] `knowledge_graph.py` - 鐭ヨ瘑鍥捐氨
  - 鍙鍖栧睍绀?  - 缁熻鍒嗘瀽

- [ ] IMA API 闆嗘垚
  - 绗旇涓婁紶
  - 浜戠鎼滅储

---

## 馃挕 鏈€浣冲疄璺?
### 鎼滅储鎶€宸?- 浣跨敤鍏蜂綋鍏抽敭璇嶏紙濡?RTHS"鑰岄潪"璇曢獙"锛?- 闄愬埗缁撴灉鏁伴噺锛?l 5锛夋彁楂橀€熷害
- 瀹氭湡娓呯悊鏃犵敤绗旇

### 鍚屾绛栫暐
- 浠呭悓姝ラ噸瑕佺瑪璁板埌 IMA
- 瀹氭湡澶囦唤 Obsidian 浠撳簱
- 鏂囩尞鍏冩暟鎹互 Zotero 涓哄噯

---

## 馃摓 闂鍙嶉

閬囧埌闂璇锋鏌ワ細
1. Zotero API Key 鏄惁閰嶇疆
2. IMA 鍑瘉鏄惁鏈夋晥
3. research 鐩綍鏄惁瀛樺湪

---

**鐭ヨ瘑绠＄悊鎶€鑳界郴缁熷紑鍙戝畬鎴愶紒** 馃帀

涓嬩竴姝ワ細
- 娴嬭瘯涓変釜鎶€鑳?- 閰嶇疆鍑瘉
- 寮€濮嬩娇鐢?


Security scan verdicts — ClawScan: clean | static analysis: clean | VirusTotal: clean | SkillSpector: clean (LOW)