Files
everything-claude-code/docs/zh-CN/commands/instinct-import.md
zdoc.app abcf38b085 docs(zh-CN): sync Chinese docs with latest upstream changes (#341)
* docs(zh-CN): sync Chinese docs with latest upstream changes

* docs(zh-CN): update link

---------

Co-authored-by: neo <neo.dowithless@gmail.com>
2026-03-07 14:48:02 -08:00

118 lines
2.7 KiB
Markdown
Raw 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: 从文件或URL导入本能到项目/全局作用域
command: true
---
# 本能导入命令
## 实现
使用插件根路径运行本能 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] [--scope project|global]
```
或者,如果 `CLAUDE_PLUGIN_ROOT` 未设置(手动安装):
```bash
python3 ~/.claude/skills/continuous-learning-v2/scripts/instinct-cli.py import <file-or-url>
```
从本地文件路径或 HTTP(S) URL 导入本能。
## 用法
```
/instinct-import team-instincts.yaml
/instinct-import https://github.com/org/repo/instincts.yaml
/instinct-import team-instincts.yaml --dry-run
/instinct-import team-instincts.yaml --scope global --force
```
## 执行步骤
1. 获取本能文件(本地路径或 URL
2. 解析并验证格式
3. 检查与现有本能的重复项
4. 合并或添加新本能
5. 保存到继承的本能目录:
* 项目范围:`~/.claude/homunculus/projects/<project-id>/instincts/inherited/`
* 全局范围:`~/.claude/homunculus/instincts/inherited/`
## 导入过程
```
📥 Importing instincts from: team-instincts.yaml
================================================
Found 12 instincts to import.
Analyzing conflicts...
## New Instincts (8)
These will be added:
✓ use-zod-validation (confidence: 0.7)
✓ prefer-named-exports (confidence: 0.65)
✓ test-async-functions (confidence: 0.8)
...
## Duplicate Instincts (3)
Already have similar instincts:
⚠️ prefer-functional-style
Local: 0.8 confidence, 12 observations
Import: 0.7 confidence
→ Keep local (higher confidence)
⚠️ test-first-workflow
Local: 0.75 confidence
Import: 0.9 confidence
→ Update to import (higher confidence)
Import 8 new, update 1?
```
## 合并行为
当导入一个已存在 ID 的本能时:
* 置信度更高的导入会成为更新候选
* 置信度相等或更低的导入将被跳过
* 除非使用 `--force`,否则需要用户确认
## 来源追踪
导入的本能被标记为:
```yaml
source: inherited
scope: project
imported_from: "team-instincts.yaml"
project_id: "a1b2c3d4e5f6"
project_name: "my-project"
```
## 标志
* `--dry-run`:仅预览而不导入
* `--force`:跳过确认提示
* `--min-confidence <n>`:仅导入高于阈值的本能
* `--scope <project|global>`:选择目标范围(默认:`project`
## 输出
导入后:
```
✅ Import complete!
Added: 8 instincts
Updated: 1 instinct
Skipped: 3 instincts (equal/higher confidence already exists)
New instincts saved to: ~/.claude/homunculus/instincts/inherited/
Run /instinct-status to see all instincts.
```