claude-code/claude-zh/commands/instinct-import.md

143 lines
3.4 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
name: instinct-import
description: 從隊友、Skill Creator 或其他來源匯入直覺 (Instincts)
command: true
---
# 直覺匯入指令 (Instinct Import Command)
## 實作方式
使用外掛程式根路徑執行直覺 CLI
```bash
python3 "${CLAUDE_PLUGIN_ROOT}/skills/continuous-learning-v2/scripts/instinct-cli.py" import <file-or-url> [--dry-run] [--force] [--min-confidence 0.7]
```
或者,如果未設定 `CLAUDE_PLUGIN_ROOT` (手動安裝)
```bash
python3 ~/claude/skills/continuous-learning-v2/scripts/instinct-cli.py import <file-or-url>
```
匯入來源:
- 隊友的匯出檔
- Skill Creator (儲存庫分析)
- 社群集合
- 先前機器的備份
## 使用方式
```
/instinct-import team-instincts.yaml
/instinct-import https://github.com/org/repo/instincts.yaml
/instinct-import --from-skill-creator acme/webapp
```
## 操作步驟
1. 獲取直覺檔案 (本地路徑或 URL)
2. 解析並驗證格式
3. 檢查是否與現有直覺重複
4. 合併或新增直覺
5. 儲存至 `~/.claude/homunculus/instincts/inherited/`
## 匯入流程
```
📥 正在從 team-instincts.yaml 匯入直覺
================================================
找到 12 則待匯入的直覺。
正在分析衝突...
## 新直覺 (8)
這些將被新增:
✓ use-zod-validation (置信度: 0.7)
✓ prefer-named-exports (置信度: 0.65)
✓ test-async-functions (置信度: 0.8)
...
## 重複直覺 (3)
已有類似的直覺:
⚠️ prefer-functional-style
本地0.8 置信度12 次觀察
匯入0.7 置信度
→ 保留本地 (置信度較高)
⚠️ test-first-workflow
本地0.75 置信度
匯入0.9 置信度
→ 更新為匯入內容 (置信度較高)
## 衝突直覺 (1)
這些與本地直覺相牴觸:
❌ use-classes-for-services
衝突項avoid-classes
→ 跳過 (需要手動解決)
---
匯入 8 個新項,更新 1 個,跳過 3 個?
```
## 合併策略
### 針對重複項
當匯入的直覺與現有直覺匹配時:
- **高置信度優先**:保留置信度較高的那一項
- **合併證據**:結合觀察計數
- **更新時間戳記**:標記為最近已驗證
### 針對衝突項
當匯入的直覺與現有直覺牴觸時:
- **預設跳過**:不要匯入受衝突的直覺
- **標記待審查**:將兩者都標記為需要關注
- **手動解決**:由使用者決定保留哪一項
## 來源追蹤
匯入的直覺會標記有:
```yaml
source: "inherited"
imported_from: "team-instincts.yaml"
imported_at: "2025-01-22T10:30:00Z"
original_source: "session-observation" # 或 "repo-analysis"
```
## Skill Creator 整合
從 Skill Creator 匯入時:
```
/instinct-import --from-skill-creator acme/webapp
```
這會獲取透過儲存庫分析生成的直覺:
- 來源:`repo-analysis`
- 較高的初始置信度 (0.7+)
- 連結至來源儲存庫
## 旗標 (Flags)
- `--dry-run`:預覽而不實際匯入
- `--force`:即使存在衝突也進行匯入
- `--merge-strategy <higher|local|import>`:如何處理重複項
- `--from-skill-creator <owner/repo>`:從 Skill Creator 分析結果匯入
- `--min-confidence <n>`:僅匯入高於門檻值的直覺
## 輸出結果
匯入完成後:
```
✅ 匯入完成!
新增8 則直覺
更新1 則直覺
跳過3 則直覺 (2 則重複1 則衝突)
新直覺已儲存至:~/.claude/homunculus/instincts/inherited/
執行 /instinct-status 以查看所有直覺。
```