@gabrywu/knowledge-bank 0.1.2-alpha.252 → 0.1.2-alpha.276

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. package/dist/claude-marketplace/.claude-plugin/marketplace.json +2 -2
  2. package/dist/claude-marketplace/core/.claude-plugin/plugin.json +1 -1
  3. package/dist/claude-marketplace/core/skills/KNOWLEDGE-DEFINITION.zh.md +79 -0
  4. package/dist/claude-marketplace/core/skills/knowledge.add/{skill.md → SKILL.md} +8 -10
  5. package/dist/claude-marketplace/core/skills/knowledge.add/skill.zh.md +47 -0
  6. package/dist/claude-marketplace/core/skills/knowledge.collect/SKILL.md +53 -14
  7. package/dist/claude-marketplace/core/skills/knowledge.collect/SKILL.zh.md +185 -0
  8. package/dist/claude-marketplace/core/skills/knowledge.delete/skill.zh.md +22 -0
  9. package/dist/claude-marketplace/core/skills/knowledge.detect/SKILL.md +115 -0
  10. package/dist/claude-marketplace/core/skills/knowledge.detect/skill.zh.md +117 -0
  11. package/dist/claude-marketplace/core/skills/knowledge.enhance/SKILL.md +55 -34
  12. package/dist/claude-marketplace/core/skills/knowledge.enhance/SKILL.zh.md +157 -0
  13. package/dist/claude-marketplace/core/skills/knowledge.import/{skill.md → SKILL.md} +9 -8
  14. package/dist/claude-marketplace/core/skills/knowledge.import/skill.zh.md +35 -0
  15. package/dist/claude-marketplace/core/skills/knowledge.init/{skill.md → SKILL.md} +8 -7
  16. package/dist/claude-marketplace/core/skills/knowledge.init/skill.zh.md +38 -0
  17. package/dist/claude-marketplace/core/skills/knowledge.save/SKILL.md +82 -0
  18. package/dist/claude-marketplace/core/skills/knowledge.save/skill.zh.md +82 -0
  19. package/dist/claude-marketplace/core/skills/knowledge.status/skill.zh.md +19 -0
  20. package/dist/claude-marketplace/core/skills/knowledge.update/SKILL.md +77 -0
  21. package/dist/claude-marketplace/core/skills/knowledge.update/skill.zh.md +77 -0
  22. package/dist/cli.js +2 -2
  23. package/dist/mcp-server.js +1 -1
  24. package/dist/web/public/css/style.css +243 -41
  25. package/dist/web/public/js/main.js +264 -31
  26. package/dist/web/views/layout.ejs +9 -5
  27. package/dist/web/views/partials/row-details.ejs +32 -1
  28. package/dist/web/views/table.ejs +154 -6
  29. package/package.json +3 -4
  30. package/dist/claude-marketplace/core/skills/knowledge.save/skill.md +0 -39
  31. package/dist/claude-marketplace/core/skills/knowledge.update/skill.md +0 -34
  32. /package/dist/claude-marketplace/core/skills/knowledge.delete/{skill.md → SKILL.md} +0 -0
  33. /package/dist/claude-marketplace/core/skills/knowledge.status/{skill.md → SKILL.md} +0 -0
@@ -0,0 +1,117 @@
1
+ ---
2
+ name: knowledge.detect
3
+ description: 从当前对话中定义并收集技术知识点
4
+ disable-model-invocation: false
5
+ user-invocable: true
6
+ allowed-tools: Read, Write, Bash
7
+ context: fork
8
+ agent: general-purpose
9
+ ---
10
+
11
+ # 会话内知识检测与收集
12
+
13
+ 该技能**专门**负责从**当前对话会话**中识别并提取高价值的技术知识点。它**不**负责管理、搜索或代表持久知识库;它仅定义并捕获在此特定交互过程中产生的见解。
14
+
15
+ ## 1. 检测范围
16
+
17
+ - **上下文**:分析当前会话的整个对话历史。
18
+ - **指导 (ARGUMENTS)**:`ARGUMENTS` 参数作为知识收集的**指导**或**主题**。它可以指定要关注的特定主题或提供有关如何收集的指令。
19
+ - 如果提供了 `ARGUMENTS`:优先检测与指定主题相关的知识。
20
+ - 如果 `ARGUMENTS` 为 **null** 或为空:自主检测对话历史中产生的所有高价值技术知识。
21
+ - **重点**:捕获在此对话期间产生的自发见解、问题解决路径和技术决策。
22
+
23
+ ## 2. 核心知识要素
24
+
25
+ 每个知识项目必须包含以下四个基本要素:
26
+
27
+ 1. **什么 (What)**:发现的核心见解、模式或解决方案。
28
+ 2. **在哪 (Where)**:涉及的具体文件位置、行号或系统组件。
29
+ 3. **为什么 (Why)**:理由、上下文或正在解决的问题。
30
+ 4. **如何 (How)**:实现方法、使用示例或过程步骤。
31
+
32
+ ## 3. 资格标准
33
+
34
+ 知识必须满足以下所有要求:
35
+ - **相关性**:与本项目中的具体文件/模式相关,或适用于个人发展原则。
36
+ - **价值性**:为未来的开发工作节省大量时间/精力。
37
+ - **非显而易见性**:仅通过阅读代码无法立即发现。
38
+ - **可操作性**:为开发人员提供明确的指导。
39
+
40
+ ## 4. 知识范围
41
+
42
+ - **项目范围** (`project`):特定于当前代码库、架构、独特模式和配置。
43
+ - **个人范围** (`personal`):包括通用技术见解、个人偏好、编码原则或可重用的跨项目工作流程。具体包括:
44
+ - **通用/普遍性**:广泛的技术见解或适用于各种上下文的最佳实践。
45
+ - **个人偏好**:个人开发风格、编码原则或偏爱的模式。
46
+ - **跨项目**:可在不同项目中重用的逻辑、工作流程或解决方案。
47
+ - **哲学性**:高级开发原则和决策制定框架。
48
+
49
+ ## 5. 知识类别
50
+
51
+ 常见类别 include:
52
+ 1. **架构** (`architecture`):系统设计、组件结构和架构模式。
53
+ 2. **代码模式** (`code_pattern`):可重用的模式和约定。
54
+ 3. **问题解决** (`pitfall`):调试过程、根本原因和解决策略。
55
+ 4. **工具使用** (`tool_usage`):项目特定的配置、命令和工作流程。
56
+ 5. **领域知识** (`api_usage`):业务逻辑和特定领域的理解。
57
+ 6. **探索** (`exploration`):代码库结构、依赖关系和约定。
58
+
59
+ **可扩展性**:如果技术见解不适合现有类别,鼓励创建新类别。确保新类别名称简洁(小写 snake_case)。
60
+
61
+ ## 6. 检测政策与框架
62
+
63
+ ### 检测政策
64
+ 自动检测并标记具有重大技术见解的知识。专注于实质性发现、问题解决和架构理由。
65
+
66
+ ### 检测决策框架
67
+ 对照以下四项检查评估每个潜在见解:
68
+ 1. **投入**:是否涉及有意义的调查或问题解决?
69
+ 2. **影响**:它对未来的开发是否有显著帮助?
70
+ 3. **适用性**:它是项目特定的还是有价值的个人原则?
71
+ 4. **非显而易见性**:是否难以仅从代码中得出?
72
+
73
+ **阈值**:一个见解必须通过至少 **3/4** 的检查才能被收集。
74
+
75
+ ## 7. 工作流程
76
+
77
+ ### 1. 分析与指导
78
+
79
+ `ARGUMENTS` 参数提供了知识收集的指导或主题:
80
+
81
+ <ARGUMENTS>
82
+ $ARGUMENTS
83
+ </ARGUMENTS>
84
+
85
+ 你必须根据此指导分析整个对话历史,以检测并提取高价值的技术知识。
86
+
87
+ ### 2. 提取
88
+ 对于每个符合条件的见解,提取:
89
+ - **标题**:简洁且具有描述性。
90
+ - **类别与范围**:如上所述定义。
91
+ - **内容**:四个核心要素(什么、在哪、为什么、如何)。
92
+
93
+ ## 8. 收集结果输出
94
+
95
+ ### 当检测到知识点时
96
+
97
+ ```
98
+ 🧠 检测到知识
99
+
100
+ **总计:** [数量] 点
101
+
102
+ 1. **[知识标题]**
103
+ - 类别: [category] | 范围: [scope]
104
+ - 位置: [相关文件/组件]
105
+ - 要素:
106
+ - **什么**: [见解]
107
+ - **为什么**: [理由]
108
+ - **如何**: [实现]
109
+ ```
110
+
111
+ ### 当未检测到知识点时
112
+
113
+ ```
114
+ ❌ 未检测到知识
115
+
116
+ **原因:** [基于资格标准的简要解释]
117
+ ```
@@ -4,13 +4,11 @@ description: Search and inject relevant knowledge into current session based on
4
4
  disable-model-invocation: false
5
5
  user-invocable: true
6
6
  allowed-tools: knowledge_search, knowledge_list, knowledge_get, Read, Write, Bash
7
- context: fork
8
- agent: general-purpose
9
7
  ---
10
8
 
11
9
  # Knowledge Enhancement & Context Injection
12
10
 
13
- Intelligent knowledge retrieval system that searches for relevant knowledge items based on user input and injects contextual information into the current session to enhance development productivity.
11
+ Intelligent knowledge retrieval system that summarizes relevant keywords based on context and searches for knowledge items to inject contextual information into the current session.
14
12
 
15
13
  **Important:** You have access to the `knowledge-bank-management` MCP server which provides tools for searching and retrieving knowledge. Use these MCP tools to find and inject relevant context into the current session. All temporary files generated during knowledge search should be placed in the !`npx knowledge-bank config -t` directory.
16
14
  **System Environment Variables:**
@@ -25,28 +23,20 @@ The MCP tools support file operations through the `to` parameter:
25
23
  - **Filename Only**: The `to` parameter accepts only filenames (e.g., `knowledge-search.json`)
26
24
  - **Path Resolution**: The MCP tools automatically resolve the complete file paths (specifically within the `tmp` directory) and return them in responses
27
25
 
28
- ## Knowledge Definition Standards
29
-
30
- **IMPORTANT:** Refer to KNOWLEDGE-DEFINITION.md for:
31
- - Knowledge categories and types
32
- - Search guidance and relevance criteria
33
- - Quality standards for knowledge retrieval
34
-
35
- This reference document provides essential guidance for understanding what knowledge to search for and how to evaluate relevance for context injection.
36
-
37
26
  # Knowledge Enhancement Workflow
38
27
 
39
- ## 1. User Input Analysis
40
- Analyze user input to identify knowledge search terms and context:
28
+ ## 1. Contextual Keyword Summarization
29
+ Analyze the user input and session context to summarize a list of targeted keywords for knowledge retrieval:
41
30
 
42
31
  <user_input>
43
32
  $ARGUMENTS
44
33
  </user_input>
45
34
 
46
- **Search Strategy:**
47
- - Extract key technical terms, file names, and concepts
48
- - Identify knowledge types most relevant to the query
49
- - Determine search scope (project, domain, tools, etc.)
35
+ **Keyword Extraction Strategy:**
36
+ - **Primary Concepts**: Identify the core technical topics, frameworks, or tools mentioned.
37
+ - **Specific Entities**: Extract file paths, class names, function names, or error messages.
38
+ - **Implicit Context**: Infer related patterns or architectural concepts that would be beneficial.
39
+ - **Search Terms**: Combine extracted items into optimized search queries (e.g., "React performance optimization hooks").
50
40
 
51
41
  ## 2. Knowledge Search & Retrieval
52
42
 
@@ -64,30 +54,65 @@ Use `knowledge_list` for type-specific knowledge retrieval with filters.
64
54
 
65
55
  ## 3. Knowledge Contextual Injection
66
56
 
67
- ### Relevance Scoring & Selection
68
- - **High Relevance**: Direct matches to user query terms
69
- - **Medium Relevance**: Related concepts and patterns
70
- - **Low Relevance**: Tangential knowledge for broader context
57
+ ### New Workflow with Essential Fields
58
+
59
+ **IMPORTANT CHANGE**: MCP search and list now return only essential fields (id, title, summary, knowledge_type, status, source_file) for performance optimization.
60
+
61
+ #### Step 1: Search for Essential Fields
62
+ Use `knowledge_search` or `knowledge_list` to get essential fields only:
63
+
64
+ ```
65
+ knowledge_search({
66
+ query: ["extracted", "keywords"],
67
+ to: "search-results.json"
68
+ })
69
+ ```
71
70
 
72
- ### Context Injection Format
73
- Retrieved knowledge should be saved to a temporary file using the `to` parameter in `knowledge_search` or `knowledge_list`. Use filename only (e.g., `{knowledge title}.json`) - the MCP tool will handle the complete path (resolving to the `tmp` directory) and return it.
71
+ #### Step 2: Analyze Relevance and Score Results
72
+ After reading the search results file, you MUST analyze each knowledge item's relevance to the current context:
74
73
 
75
- **Crucial:** After the MCP tool returns the `file_path`, you MUST use the `Read` tool to read the contents of that file.
74
+ **Relevance Scoring Criteria:**
75
+ - **Title Match (40% weight)**: How many words from the title appear in the user's context
76
+ - **Summary Match (30% weight)**: How many words from the summary relate to the context
77
+ - **Knowledge Type Match (15% weight)**: Does the knowledge_type relate to the current task
78
+ - **Source File Match (10% weight)**: Does the source_file relate to files mentioned in context
79
+ - **Status Bonus (5% weight)**: Prioritize 'verified' status knowledge
76
80
 
77
- Then, present the retrieved knowledge in the following format so it can be injected into the main session:
81
+ **Scoring Algorithm:**
82
+ 1. Extract keywords from user context (lowercase, remove stopwords)
83
+ 2. For each knowledge item, calculate relevance score (0.0 to 1.0)
84
+ 3. Filter items with score > 0.3 (moderate relevance threshold)
85
+ 4. Sort by score descending
86
+ 5. Take top 3-5 most relevant items
87
+
88
+ #### Step 3: Retrieve Full Knowledge Items
89
+ Only for high-relevance items (score > 0.3), use `knowledge_get` to retrieve full content:
90
+
91
+ ```
92
+ knowledge_get({
93
+ id: relevantId,
94
+ to: "knowledge-{id}.md"
95
+ })
96
+ ```
97
+
98
+ #### Step 4: Context Injection Format
99
+ Present retrieved knowledge in this format:
78
100
 
79
101
  ```
80
102
  🔍 RELEVANT KNOWLEDGE FOUND
81
103
 
82
- **Summary:** [Brief summary of the retrieved knowledge]
83
- **Storage:** [file_path]
104
+ **Relevance Analysis:** Found X relevant items from Y search results
105
+ **Top Relevance Scores:** [item1: 0.85, item2: 0.72, item3: 0.61]
84
106
 
85
107
  <knowledge_content>
86
- [Insert the FULL content of the file you just read here]
108
+ [Insert the FULL content of the retrieved knowledge files here]
87
109
  </knowledge_content>
88
110
  ```
89
111
 
90
- **Note:** The `to` parameter only contains the filename, not the full path. The MCP tool automatically resolves the complete file path and returns it after saving.
112
+ **Critical Requirements:**
113
+ - NEVER call `knowledge_get` for low-relevance items (score ≤ 0.3)
114
+ - Always explain why each knowledge item is relevant
115
+ - Limit to maximum 5 knowledge retrievals to avoid performance issues
91
116
 
92
117
  ### No Results Handling
93
118
  If no relevant knowledge found, respond with empty string, indicating no context to inject.
@@ -119,10 +144,6 @@ Use `knowledge_list` with type, status, and scope filters.
119
144
  ## Direct Retrieval
120
145
  Use `knowledge_get` when you have a specific knowledge item ID.
121
146
 
122
- ## Knowledge Search Guidance
123
-
124
- Use the knowledge categories and definitions from the Knowledge Definition Standards above to guide your search strategy and relevance scoring.
125
-
126
147
  ---
127
148
 
128
149
  # Integration Best Practices
@@ -0,0 +1,157 @@
1
+ ---
2
+ name: knowledge.enhance
3
+ description: 根据用户输入搜索相关知识并注入到当前会话中
4
+ disable-model-invocation: false
5
+ user-invocable: true
6
+ allowed-tools: knowledge_search, knowledge_list, knowledge_get, Read, Write, Bash
7
+ context: fork
8
+ agent: general-purpose
9
+ ---
10
+
11
+ # 知识增强与上下文注入
12
+
13
+ 智能知识检索系统,根据上下文总结指定关键词并搜索知识项目,以将上下文信息注入当前会话。
14
+
15
+ **重要提示:** 您可以访问 `knowledge-bank-management` MCP 服务器,该服务器提供搜索和检索知识的工具。使用 these MCP 工具查找并将相关上下文注入当前会话。知识搜索期间生成的所有临时文件应放置在 !`npx knowledge-bank config -t` 目录中。
16
+
17
+ **系统环境变量:**
18
+ - CLAUDE_SESSION_ID=!`echo $CLAUDE_SESSION_ID`
19
+ - CLAUDE_SESSION_SOURCE=!`echo $CLAUDE_SESSION_SOURCE`
20
+ - CLAUDE_SESSION_MODE=!`echo $CLAUDE_SESSION_MODE`
21
+ - CLAUDE_SESSION_REPOSITORYID=!`echo $CLAUDE_SESSION_REPOSITORYID`
22
+
23
+ ## 文件参数配置
24
+
25
+ MCP 工具通过 `to` 参数支持文件操作:
26
+ - **仅文件名**:`to` 参数只接受文件名(例如:`knowledge-search.json`)
27
+ - **路径解析**:MCP 工具自动解析完整文件路径(特别是在 `tmp` 目录内)并在响应中返回
28
+
29
+ # 知识增强工作流程
30
+
31
+ ## 1. 上下文关键词总结
32
+ 分析用户输入和会话上下文,总结用于知识检索的目标关键词列表:
33
+
34
+ <user_input>
35
+ $ARGUMENTS
36
+ </user_input>
37
+
38
+ **关键词提取策略:**
39
+ - **核心概念**:识别提到的核心技术主题、框架或工具。
40
+ - **特定实体**:提取文件路径、类名、函数名或错误消息。
41
+ - **隐含上下文**:推断可能受益的相关模式或架构概念。
42
+ - **搜索术语**:将提取的项目组合成优化的搜索查询(例如,“React 性能优化 hooks”)。
43
+
44
+ ## 2. 知识搜索与检索
45
+
46
+ ### 多方面搜索方法
47
+
48
+ 使用 `knowledge_search` 进行基于内容的搜索,使用提取的关键词。
49
+
50
+ 使用 `knowledge_list` 进行具有过滤器的特定类型知识检索。
51
+
52
+ ### 搜索术语提取逻辑
53
+ - **文件引用**:提取文件路径、扩展名和目录模式
54
+ - **技术术语**:识别框架、库、模式和工具
55
+ - **问题域**:识别调试、配置、架构主题
56
+ - **功能区域**:映射到相关业务域和功能
57
+
58
+ ## 3. 知识上下文注入
59
+
60
+ ### 具有基本字段的新流程
61
+
62
+ **重要更改**:为了优化性能,MCP 搜索和列表现在仅返回基本字段(id、title、summary、knowledge_type、status、source_file)。
63
+
64
+ #### 第 1 步:搜索基本字段
65
+ 使用 `knowledge_search` 或 `knowledge_list` 仅获取基本字段:
66
+
67
+ ```
68
+ knowledge_search({
69
+ query: ["extracted", "keywords"],
70
+ to: "search-results.json"
71
+ })
72
+ ```
73
+
74
+ #### 第 2 步:分析相关性并对结果评分
75
+ 读取搜索结果文件后,您必须分析每个知识项目与当前上下文的相关性:
76
+
77
+ **相关性评分标准:**
78
+ - **标题匹配 (40% 权重)**:标题中有多少单词出现在用户上下文中
79
+ - **摘要匹配 (30% 权重)**:摘要中有多少单词与上下文相关
80
+ - **知识类型匹配 (15% 权重)**:knowledge_type 是否与当前任务相关
81
+ - **源文件匹配 (10% 权重)**:source_file 是否与上下文中提到的文件相关
82
+ - **状态加分 (5% 权重)**:优先选择“已验证”状态的知识
83
+
84
+ **评分算法:**
85
+ 1. 从用户上下文中提取关键词(小写,去除停用词)
86
+ 2. 为每个知识项目计算相关性评分(0.0 到 1.0)
87
+ 3. 过滤评分 > 0.3 的项目(中等相关性阈值)
88
+ 4. 按评分降序排序
89
+ 5. 选取前 3-5 个最相关的项目
90
+
91
+ #### 第 3 步:检索完整知识项目
92
+ 仅对于高相关性项目(评分 > 0.3),使用 `knowledge_get` 检索完整内容:
93
+
94
+ ```
95
+ knowledge_get({
96
+ id: relevantId,
97
+ to: "knowledge-{id}.md"
98
+ })
99
+ ```
100
+
101
+ #### 第 4 步:上下文注入格式
102
+ 以这种格式呈现检索到的知识:
103
+
104
+ ```
105
+ 🔍 发现相关知识
106
+
107
+ **相关性分析:** 从 Y 个搜索结果中发现 X 个相关项目
108
+ **最高相关性评分:** [item1: 0.85, item2: 0.72, item3: 0.61]
109
+
110
+ <knowledge_content>
111
+ [在此处插入检索到的知识文件的完整内容]
112
+ </knowledge_content>
113
+ ```
114
+
115
+ **关键要求:**
116
+ - 绝不为低相关性项目(评分 ≤ 0.3)调用 `knowledge_get`
117
+ - 始终解释为什么每个知识项目都是相关的
118
+ - 限制为最多 5 个知识检索,以避免性能问题
119
+
120
+ ### 无结果处理
121
+ 如果未找到相关知识,响应空字符串,表示没有要注入的上下文。
122
+
123
+ ## 4. 增强策略
124
+
125
+ ### 主动知识发现
126
+ - **相关模式**:使用 `knowledge_search` 发现类似的实现模式
127
+ - **历史解决方案**:使用与问题相关关键词的 `knowledge_search`
128
+ - **最佳实践**:使用按类型和状态过滤的 `knowledge_list`
129
+ - **工具配置**:使用 `knowledge_search` 或 `knowledge_list` 获取配置知识
130
+
131
+ ### 上下文丰富
132
+ - **代码依赖**:使用文件路径和组件名称的 `knowledge_search`
133
+ - **架构上下文**:使用按架构类型过滤的 `knowledge_list`
134
+ - **调试历史**:使用错误消息和问题关键词的 `knowledge_search`
135
+ - **性能洞察**:使用 `knowledge_search` 或 `knowledge_list` 获取优化知识
136
+
137
+ ---
138
+
139
+ # 搜索策略示例
140
+
141
+ ## 基于内容的搜索
142
+ 使用来自用户输入的提取关键词的 `knowledge_search`。
143
+
144
+ ## 特定类型检索
145
+ 使用带有类型、状态和范围过滤器的 `knowledge_list`。
146
+
147
+ ## 直接检索
148
+ 当您有特定知识项目 ID 时使用 `knowledge_get`。
149
+
150
+ ---
151
+
152
+ # 集成最佳实践
153
+
154
+ - **会话增强**:使用 `knowledge_search` 根据用户的初始查询注入相关上下文
155
+ - **渐进式发现**:随着对话的发展,使用额外的搜索来发现更多知识
156
+ - **质量过滤**:使用 `knowledge_list` 过滤器优先考虑已验证的状态
157
+ - **智能建议**:找到相关知识后,推荐相关的探索路径
@@ -3,7 +3,7 @@ name: knowledge.import
3
3
  description: Import knowledge items from files or external sources
4
4
  disable-model-invocation: false
5
5
  user-invocable: true
6
- allowed-tools: knowledge_create, Write, Read, Bash
6
+ allowed-tools: knowledge_create, Write, Read, Bash, Skill
7
7
  context: fork
8
8
  agent: general-purpose
9
9
  ---
@@ -12,14 +12,15 @@ agent: general-purpose
12
12
 
13
13
  Import knowledge items from external files (JSON, Markdown) or documentation directories.
14
14
 
15
- ## Knowledge Definition Standards
15
+ ## Knowledge Detection Integration
16
16
 
17
- **IMPORTANT:** Refer to KNOWLEDGE-DEFINITION.md for:
18
- - Knowledge categories and types
19
- - Validation criteria and quality standards
20
- - Import format requirements
17
+ **IMPORTANT:** Use the `knowledge.detect` skill to validate imported content against established knowledge standards before creation. This ensures only valuable, well-structured knowledge is imported and prevents low-quality entries.
21
18
 
22
- This reference document provides the validation framework for ensuring imported knowledge meets established standards.
19
+ To use knowledge detection for import validation:
20
+ 1. Parse and extract content from source files
21
+ 2. Call `knowledge.detect` with extracted content to validate knowledge quality
22
+ 3. Only proceed with import for content that passes detection criteria
23
+ 4. Use detection results to guide categorization and structure enhancement
23
24
 
24
25
  ## Workflow
25
26
 
@@ -27,7 +28,7 @@ This reference document provides the validation framework for ensuring imported
27
28
  2. **Data Parsing**:
28
29
  - Read the source files using the `read` or `glob` tools.
29
30
  - Extract knowledge content, titles, and metadata from the source.
30
- 3. **Validation**: Validate the extracted data against the knowledge standards defined in the Knowledge Definition Standards above.
31
+ 3. **Validation**: Use `knowledge.detect` to validate the extracted data against established knowledge standards and quality criteria.
31
32
  4. **Knowledge Creation**:
32
33
  - For each valid item, write the data to a temporary JSON file in !`npx knowledge-bank config -t`.
33
34
  - Use the `knowledge_create` MCP tool with the `from` parameter to import the items.
@@ -0,0 +1,35 @@
1
+ ---
2
+ name: knowledge.import
3
+ description: 从文件或外部源导入知识项目
4
+ disable-model-invocation: false
5
+ user-invocable: true
6
+ allowed-tools: knowledge_create, Write, Read, Bash, Skill
7
+ context: fork
8
+ agent: general-purpose
9
+ ---
10
+
11
+ # 知识导入
12
+
13
+ 从外部文件(JSON、Markdown)或文档目录导入知识项目。
14
+
15
+ ## 知识检测集成
16
+
17
+ **重要提示:** 使用 `knowledge.detect` 技能在创建之前根据既定知识标准验证导入的内容。这确保只导入有价值、结构良好的知识,并防止低质量条目。
18
+
19
+ 使用知识检测进行导入验证:
20
+ 1. 解析并从源文件中提取内容
21
+ 2. 使用提取的内容调用 `knowledge.detect` 以验证知识质量
22
+ 3. 仅对通过检测标准的内容进行导入
23
+ 4. 使用检测结果指导分类和结构增强
24
+
25
+ ## 工作流程
26
+
27
+ 1. **源发现**:分析提供的源路径(`$ARGUMENTS`)并确定格式(JSON、Markdown等)。
28
+ 2. **数据解析**:
29
+ - 使用 `read` 或 `glob` 工具读取源文件。
30
+ - 从源中提取知识内容、标题和元数据。
31
+ 3. **验证**:使用 `knowledge.detect` 根据既定的知识标准和质量标准验证提取的数据。
32
+ 4. **知识创建**:
33
+ - 对于每个有效项目,将数据写入 !`npx knowledge-bank config -t` 中的临时 JSON 文件。
34
+ - 使用带有 `from` 参数的 `knowledge_create` MCP 工具导入项目。
35
+ 5. **报告**:提供成功导入多少项目以及遇到的任何错误的摘要。
@@ -3,7 +3,7 @@ name: knowledge.init
3
3
  description: Initialize a comprehensive knowledge base by analyzing the entire codebase
4
4
  disable-model-invocation: false
5
5
  user-invocable: true
6
- allowed-tools: knowledge_create, knowledge_list, Write, Read, Bash
6
+ allowed-tools: knowledge_create, knowledge_list, Write, Read, Bash, Skill
7
7
  context: fork
8
8
  agent: general-purpose
9
9
  ---
@@ -12,14 +12,15 @@ agent: general-purpose
12
12
 
13
13
  Analyzes the codebase structure, patterns, and key components to create foundational knowledge items. This skill is ideal for first-time setup or when significant architecture changes occur.
14
14
 
15
- ## Knowledge Definition Standards
15
+ ## Knowledge Detection Integration
16
16
 
17
- **IMPORTANT:** Refer to KNOWLEDGE-DEFINITION.md for:
18
- - Knowledge categories and types
19
- - Quality standards for foundational knowledge
20
- - Comprehensive coverage criteria
17
+ **IMPORTANT:** Use the `knowledge.detect` skill to validate discovered codebase insights and ensure they meet knowledge quality standards before creating foundational knowledge items. This ensures comprehensive initialization with only valuable, actionable knowledge.
21
18
 
22
- This reference document provides the essential framework for creating comprehensive, well-categorized foundational knowledge items.
19
+ To use knowledge detection for initialization:
20
+ 1. Analyze codebase structure and identify potential knowledge areas
21
+ 2. Call `knowledge.detect` with discovered insights to validate their knowledge value
22
+ 3. Use detection results to guide categorization and prioritization of foundational knowledge
23
+ 4. Focus on creating knowledge that passes detection criteria for maximum value
23
24
 
24
25
  ## Workflow
25
26
 
@@ -0,0 +1,38 @@
1
+ ---
2
+ name: knowledge.init
3
+ description: 通过分析整个代码库初始化全面的知识库
4
+ disable-model-invocation: false
5
+ user-invocable: true
6
+ allowed-tools: knowledge_create, knowledge_list, Write, Read, Bash, Skill
7
+ context: fork
8
+ agent: general-purpose
9
+ ---
10
+
11
+ # 知识初始化
12
+
13
+ 分析代码库结构、模式和关键组件以创建基础知识项目。该技能非常适合首次设置或发生重大架构更改时使用。
14
+
15
+ ## 知识检测集成
16
+
17
+ **重要提示:** 使用 `knowledge.detect` 技能验证发现的代码库洞察,并确保它们在创建基础知识项目之前符合知识质量标准。这确保了全面初始化,只包含有价值、可操作的知识。
18
+
19
+ 使用知识检测进行初始化:
20
+ 1. 分析代码库结构并识别潜在的知识区域
21
+ 2. 使用发现的洞察调用 `knowledge.detect` 以验证其知识价值
22
+ 3. 使用检测结果指导基础知识的分类和优先级排序
23
+ 4. 专注于创建通过检测标准以获得最大价值的知识
24
+
25
+ ## 工作流程
26
+
27
+ 1. **代码库分析**:使用 `glob` 和 `read` 探索项目结构,识别框架,并定位关键配置文件。
28
+ 2. **主题识别**:识别基础知识区域(例如:架构、API 数据流、测试模式)。
29
+ 3. **内容生成**:为每个识别的主题生成全面内容,包括:
30
+ - 描述性标题
31
+ - 主题摘要
32
+ - 关键实现详情
33
+ - 代码示例
34
+ - 相关文件路径
35
+ 4. **知识创建**:
36
+ - 将每个主题生成的知识写入 !`npx knowledge-bank config -t` 中的临时 JSON 文件。
37
+ - 使用带有 `from` 参数的 `knowledge_create` MCP 工具填充知识库。
38
+ 5. **摘要报告**:提供所有创建的基础知识项目及其 ID 的列表。
@@ -0,0 +1,82 @@
1
+ ---
2
+ name: knowledge.save
3
+ description: Manually save knowledge from current conversation session to the knowledge base
4
+ disable-model-invocation: false
5
+ user-invocable: true
6
+ allowed-tools: knowledge_create, knowledge_search, knowledge_update, knowledge_list, Write, Read, Bash, Skill
7
+ context: fork
8
+ agent: general-purpose
9
+ ---
10
+
11
+ # Knowledge Saving (Manual)
12
+
13
+ Analyzes the current conversation session to identify and save valuable knowledge points to the knowledge base. This allows manual capture of insights that might not be automatically detected.
14
+
15
+ ## Knowledge Detection Integration
16
+
17
+ **IMPORTANT:** Use the `knowledge.detect` skill to analyze the current conversation session and identify valuable knowledge points before proceeding with manual save operations. This ensures consistency with established knowledge standards and prevents saving of low-value content.
18
+
19
+ To use knowledge detection for manual saving:
20
+ 1. Call `knowledge.detect` with the conversation content to identify potential knowledge points
21
+ 2. Use detection results to guide extraction and categorization
22
+ 3. Only proceed with saving for content that passes detection criteria
23
+ 4. Enhance detected knowledge with additional context when manual intervention adds value
24
+
25
+ ## Workflow
26
+
27
+ **IMPORTANT CHANGE**: MCP search now returns only essential fields (id, title, summary, knowledge_type, status, source_file) for performance optimization.
28
+
29
+ ### New Save Workflow with Smart Duplicate Detection:
30
+
31
+ 1. **Session Analysis**: Analyze the conversation history for technical insights, problem-solving discussions, and architectural decisions. If a topic is provided in `$ARGUMENTS`, focus on that area.
32
+
33
+ 2. **Knowledge Extraction**: Extract structured knowledge items based on detection results and established knowledge standards.
34
+
35
+ 3. **Smart Duplicate Check**:
36
+
37
+ #### Step 3a: Search for Essential Fields
38
+ Use `knowledge_search` to find potential duplicates:
39
+ ```
40
+ knowledge_search({
41
+ query: ["keywords", "from", "extracted", "knowledge"],
42
+ to: "duplicate-check.json"
43
+ })
44
+ ```
45
+
46
+ #### Step 3b: Analyze Duplication Risk
47
+ After reading the search results file, analyze similarity to extracted knowledge:
48
+
49
+ **Similarity Scoring Criteria:**
50
+ - **Topic Similarity (40% weight)**: Keywords and concepts overlap
51
+ - **Knowledge Type Match (30% weight)**: Same knowledge_type suggests potential duplication
52
+ - **Source Context (20% weight)**: Related files or implementation areas
53
+ - **Conceptual Overlap (10% weight)**: Similar problem domain or solution pattern
54
+
55
+ #### Step 3c: Retrieve Full Content for High-Similarity Items
56
+ Only for high-similarity items (score > 0.6), use `knowledge_get` to retrieve full content:
57
+ ```
58
+ knowledge_get({
59
+ id: similarId,
60
+ to: "existing-{id}.md"
61
+ })
62
+ ```
63
+
64
+ 4. **Knowledge Creation/Update Decision**:
65
+ - **Similarity > 0.8**: Update existing knowledge with new insights
66
+ - **Similarity 0.6-0.8**: Merge content or create related knowledge
67
+ - **Similarity < 0.6**: Create new knowledge item
68
+ - Write data to temporary JSON files in !`npx knowledge-bank config -t`
69
+
70
+ 5. **Reporting**: Provide summary with similarity analysis and creation/update decisions.
71
+
72
+ **Critical Requirements:**
73
+ - NEVER call `knowledge_get` for low-similarity items (score ≤ 0.6)
74
+ - Limit duplicate detection to maximum 3 knowledge retrievals
75
+ - Always explain duplication analysis reasoning
76
+
77
+ ## Quality Indicators
78
+
79
+ Knowledge items are created when content:
80
+ - Contains actionable guidance with concrete examples.
81
+ - Explains rationale ("why") not just implementation ("what").
82
+ - Includes specific file references and code snippets.