autosnippet 2.9.0 → 2.10.0

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 (97) hide show
  1. package/README.md +4 -4
  2. package/bin/cli.js +5 -33
  3. package/config/constitution.yaml +9 -2
  4. package/dashboard/dist/assets/{icons-CH-H9x0E.js → icons-BkT3XrKf.js} +105 -100
  5. package/dashboard/dist/assets/index-BsB7DzW4.css +1 -0
  6. package/dashboard/dist/assets/index-DdmQMrJJ.js +155 -0
  7. package/dashboard/dist/index.html +3 -3
  8. package/lib/cli/AiScanService.js +13 -11
  9. package/lib/cli/KnowledgeSyncService.js +343 -0
  10. package/lib/cli/SetupService.js +8 -26
  11. package/lib/core/gateway/GatewayActionRegistry.js +48 -58
  12. package/lib/domain/index.js +16 -11
  13. package/lib/domain/knowledge/KnowledgeEntry.js +351 -0
  14. package/lib/domain/knowledge/KnowledgeRepository.js +123 -0
  15. package/lib/domain/knowledge/Lifecycle.js +109 -0
  16. package/lib/domain/knowledge/index.js +27 -0
  17. package/lib/domain/knowledge/values/Constraints.js +125 -0
  18. package/lib/domain/knowledge/values/Content.js +86 -0
  19. package/lib/domain/knowledge/values/Quality.js +93 -0
  20. package/lib/domain/knowledge/values/Reasoning.js +69 -0
  21. package/lib/domain/knowledge/values/Relations.js +168 -0
  22. package/lib/domain/knowledge/values/Stats.js +87 -0
  23. package/lib/domain/knowledge/values/index.js +9 -0
  24. package/lib/external/ai/AiProvider.js +48 -0
  25. package/lib/external/mcp/McpServer.js +7 -5
  26. package/lib/external/mcp/handlers/bootstrap/pipeline/orchestrator.js +2 -2
  27. package/lib/external/mcp/handlers/bootstrap.js +116 -11
  28. package/lib/external/mcp/handlers/browse.js +77 -73
  29. package/lib/external/mcp/handlers/candidate.js +29 -276
  30. package/lib/external/mcp/handlers/guard.js +2 -0
  31. package/lib/external/mcp/handlers/knowledge.js +205 -0
  32. package/lib/external/mcp/handlers/structure.js +25 -23
  33. package/lib/external/mcp/handlers/system.js +10 -12
  34. package/lib/external/mcp/tools.js +125 -138
  35. package/lib/http/HttpServer.js +4 -8
  36. package/lib/http/routes/extract.js +48 -4
  37. package/lib/http/routes/knowledge.js +246 -0
  38. package/lib/http/routes/search.js +12 -17
  39. package/lib/infrastructure/database/migrations/016_unified_knowledge_entries.js +395 -0
  40. package/lib/infrastructure/external/XcodeAutomation.js +187 -103
  41. package/lib/injection/ServiceContainer.js +49 -60
  42. package/lib/repository/knowledge/KnowledgeRepository.impl.js +373 -0
  43. package/lib/service/automation/DirectiveDetector.js +2 -3
  44. package/lib/service/automation/FileWatcher.js +67 -28
  45. package/lib/service/automation/XcodeIntegration.js +931 -156
  46. package/lib/service/automation/handlers/AlinkHandler.js +6 -4
  47. package/lib/service/automation/handlers/CreateHandler.js +53 -18
  48. package/lib/service/automation/handlers/GuardHandler.js +183 -20
  49. package/lib/service/automation/handlers/SearchHandler.js +35 -17
  50. package/lib/service/chat/CandidateGuardrail.js +1 -1
  51. package/lib/service/chat/ChatAgent.js +46 -45
  52. package/lib/service/chat/ContextWindow.js +5 -5
  53. package/lib/service/chat/ProducerAgent.js +7 -7
  54. package/lib/service/chat/tools.js +130 -123
  55. package/lib/service/guard/GuardCheckEngine.js +114 -10
  56. package/lib/service/guard/GuardService.js +59 -48
  57. package/lib/service/knowledge/ConfidenceRouter.js +159 -0
  58. package/lib/service/knowledge/KnowledgeFileWriter.js +602 -0
  59. package/lib/service/knowledge/KnowledgeService.js +725 -0
  60. package/lib/service/search/SearchEngine.js +92 -19
  61. package/lib/service/skills/SignalCollector.js +12 -7
  62. package/lib/service/skills/SkillAdvisor.js +13 -11
  63. package/lib/service/snippet/SnippetFactory.js +5 -5
  64. package/package.json +1 -1
  65. package/scripts/install-cursor-skill.js +0 -6
  66. package/scripts/migrate-md-to-knowledge.mjs +364 -0
  67. package/skills/autosnippet-analysis/SKILL.md +15 -7
  68. package/skills/autosnippet-candidates/SKILL.md +6 -6
  69. package/skills/autosnippet-coldstart/SKILL.md +7 -3
  70. package/skills/autosnippet-concepts/SKILL.md +7 -6
  71. package/skills/autosnippet-create/SKILL.md +13 -13
  72. package/skills/autosnippet-intent/SKILL.md +3 -2
  73. package/skills/autosnippet-lifecycle/SKILL.md +5 -5
  74. package/skills/autosnippet-recipes/SKILL.md +16 -4
  75. package/templates/constitution.yaml +1 -1
  76. package/templates/copilot-instructions.md +6 -6
  77. package/templates/recipes-setup/README.md +3 -3
  78. package/dashboard/dist/assets/index-CqJRvYRL.js +0 -197
  79. package/dashboard/dist/assets/index-DICm9PNa.css +0 -1
  80. package/lib/cli/CandidateSyncService.js +0 -261
  81. package/lib/cli/SyncService.js +0 -356
  82. package/lib/domain/candidate/Candidate.js +0 -196
  83. package/lib/domain/candidate/CandidateRepository.js +0 -107
  84. package/lib/domain/candidate/Reasoning.js +0 -52
  85. package/lib/domain/recipe/Recipe.js +0 -421
  86. package/lib/domain/recipe/RecipeRepository.js +0 -54
  87. package/lib/domain/types/CandidateStatus.js +0 -52
  88. package/lib/http/routes/candidates.js +0 -559
  89. package/lib/http/routes/recipes.js +0 -397
  90. package/lib/repository/candidate/CandidateRepository.impl.js +0 -230
  91. package/lib/repository/recipe/RecipeRepository.impl.js +0 -498
  92. package/lib/service/candidate/CandidateAggregator.js +0 -52
  93. package/lib/service/candidate/CandidateFileWriter.js +0 -383
  94. package/lib/service/candidate/CandidateService.js +0 -1001
  95. package/lib/service/recipe/RecipeFileWriter.js +0 -514
  96. package/lib/service/recipe/RecipeService.js +0 -786
  97. package/lib/service/recipe/RecipeStatsTracker.js +0 -148
@@ -73,7 +73,7 @@ description: Deep project analysis — full scan + semantic field enrichment + g
73
73
  }
74
74
  ```
75
75
 
76
- Use `autosnippet_submit_candidates` for batch submission.
76
+ Use `autosnippet_submit_knowledge_batch` for batch submission.
77
77
 
78
78
  #### Phase 4: Guard Deep Audit (Optional)
79
79
  对特定文件调用 `autosnippet_guard_audit_files` 做深度规范审计。
@@ -101,7 +101,7 @@ Use `autosnippet_submit_candidates` for batch submission.
101
101
  ### Workflow for Enrichment
102
102
 
103
103
  **方式 A: 你(Agent)直接补全**
104
- 在分析代码时,直接填写所有 6 个语义字段到 `autosnippet_submit_candidate` 调用中。
104
+ 在分析代码时,直接填写所有 6 个语义字段到 `autosnippet_submit_knowledge` 调用中。
105
105
 
106
106
  **方式 B: 对已有候选调用 AI 补全**
107
107
  ```
@@ -109,6 +109,13 @@ autosnippet_enrich_candidates({ candidateIds: ["id1", "id2", ...] })
109
109
  ```
110
110
  AI 会分析每条候选的代码,自动填充缺失字段(已有字段不会被覆盖)。
111
111
 
112
+ **方式 C: Bootstrap 候选 AI 润色**
113
+ ```
114
+ autosnippet_bootstrap_refine({ candidateIds: ["id1", "id2", ...] })
115
+ ```
116
+ 使用 AI 对 Bootstrap 候选做内容润色(改善 summary、补充 insight、推断 relations、调整 confidence)。
117
+ 必须在 `autosnippet_enrich_candidates` 之后调用(确保字段完整后再润色)。
118
+
112
119
  ---
113
120
 
114
121
  ## Capability 3: 候选 → Recipe 查漏补缺
@@ -119,11 +126,12 @@ AI 会分析每条候选的代码,自动填充缺失字段(已有字段不
119
126
 
120
127
  ### Workflow
121
128
 
122
- 1. 调用 `autosnippet_enrich_candidates` 对目标候选做 AI 补全
123
- 2. 调用 `autosnippet_validate_candidate` 检查结构完整性
124
- 3. 调用 `autosnippet_check_duplicate` 检查重复
125
- 4. 报告补全情况 + 缺失字段 + 重复风险
126
- 5. 如缺失字段 AI 无法填充,提示用户手动补充
129
+ 1. 调用 `autosnippet_enrich_candidates` 对目标候选做结构补齐(诊断缺失字段)
130
+ 2. 调用 `autosnippet_bootstrap_refine` 对候选做 AI 润色(summary/insight/relations)
131
+ 3. 调用 `autosnippet_validate_candidate` 检查结构完整性
132
+ 4. 调用 `autosnippet_check_duplicate` 检查重复
133
+ 5. 报告补全情况 + 缺失字段 + 重复风险
134
+ 6. 如缺失字段 AI 无法填充,提示用户手动补充
127
135
 
128
136
  ### Recipe 必备字段检查清单
129
137
 
@@ -221,18 +221,18 @@ Severity: `error` (must fix) | `warning` (should fix) | `info` (suggestion)
221
221
  3. Call `autosnippet_context_search` to mark similarity and fill `relations`
222
222
  4. (Optional) `autosnippet_validate_candidate` pre-validate
223
223
  5. (Optional) `autosnippet_check_duplicate` dedup hint
224
- 6. `autosnippet_submit_candidate` or `autosnippet_submit_candidates` to submit
224
+ 6. `autosnippet_submit_knowledge` or `autosnippet_submit_knowledge_batch` to submit
225
225
 
226
226
  ## Batch Target Scan Flow
227
227
  1. `autosnippet_get_targets` → select targetName
228
228
  2. `autosnippet_get_target_files(targetName)`
229
229
  3. Parallel scan → per-file checklist extraction → aggregate / dedup / score
230
- 4. `autosnippet_submit_candidates` batch submit — **all V2 fields are preserved**
230
+ 4. `autosnippet_submit_knowledge_batch` batch submit — **all V2 fields are preserved**
231
231
 
232
232
  ## Draft File Flow (alternative)
233
233
  1. Create draft folder (e.g. `.autosnippet-drafts/`) outside `AutoSnippet/`
234
234
  2. Generate one .md per pattern in draft folder
235
- 3. Call `autosnippet_submit_draft_recipes` with filePaths and `deleteAfterSubmit: true`
235
+ 3. Call `autosnippet_submit_knowledge_batch` with filePaths and `deleteAfterSubmit: true`
236
236
  4. Delete draft folder after submit
237
237
 
238
238
  ---
@@ -247,9 +247,9 @@ Severity: `error` (must fix) | `warning` (should fix) | `info` (suggestion)
247
247
  | `autosnippet_context_search` | Find similar existing Recipes → fill `relations` |
248
248
  | `autosnippet_validate_candidate` | Pre-validate candidate fields |
249
249
  | `autosnippet_check_duplicate` | Cosine similarity dedup check |
250
- | `autosnippet_submit_candidate` | Submit single candidate (**all V2 fields**) |
251
- | `autosnippet_submit_candidates` | Batch submit candidates (**all V2 fields preserved**) |
252
- | `autosnippet_submit_draft_recipes` | Submit .md draft files as candidates |
250
+ | `autosnippet_submit_knowledge` | Submit single candidate (**all V2 fields**) |
251
+ | `autosnippet_submit_knowledge_batch` | Batch submit candidates (**all V2 fields preserved**) |
252
+ | `autosnippet_submit_knowledge_batch` | Submit .md draft files as candidates |
253
253
 
254
254
  ---
255
255
 
@@ -226,7 +226,7 @@ description: Cold-start knowledge base initialization. Full 9-dimension analysis
226
226
 
227
227
  ## Phase 5: 批量提交
228
228
 
229
- 将所有分析结果通过 `autosnippet_submit_candidates` 批量提交:
229
+ 将所有分析结果通过 `autosnippet_submit_knowledge_batch` 批量提交:
230
230
 
231
231
  ```json
232
232
  {
@@ -448,12 +448,16 @@ description: Cold-start knowledge base initialization. Full 9-dimension analysis
448
448
  | Tool | 用途 |
449
449
  |------|------|
450
450
  | `autosnippet_bootstrap_knowledge` | 启动冷启动扫描(本 Skill 核心工具) |
451
- | `autosnippet_submit_candidates` | 批量提交候选 |
452
- | `autosnippet_submit_candidate` | 提交单条候选 |
451
+ | `autosnippet_enrich_candidates` | 结构补齐:诊断候选字段缺失 |
452
+ | `autosnippet_bootstrap_refine` | 内容润色:AI 精炼候选质量(summary/insight/relations) |
453
+ | `autosnippet_submit_knowledge_batch` | 批量提交候选 |
454
+ | `autosnippet_submit_knowledge` | 提交单条候选 |
453
455
  | `autosnippet_validate_candidate` | 校验候选字段 |
454
456
  | `autosnippet_check_duplicate` | 去重检查 |
455
457
  | `autosnippet_context_search` | 查找已有知识(避免重复) |
456
458
  | `autosnippet_scan_project` | 轻量探查(不写库) |
459
+ | `autosnippet_list_skills` | 列出可用 Skill 列表 |
460
+ | `autosnippet_load_skill` | 加载指定 Skill 文档获取指引 |
457
461
 
458
462
  ## Related Skills
459
463
 
@@ -87,13 +87,14 @@ This is a conceptual map. Skills stay semantic; MCP provides capability.
87
87
  | 知识图谱 | `autosnippet_graph_query`, `autosnippet_graph_impact`, `autosnippet_graph_path`, `autosnippet_graph_stats` |
88
88
  | 候选预检 | `autosnippet_validate_candidate` |
89
89
  | 去重建议 | `autosnippet_check_duplicate` |
90
- | 候选提交 | `autosnippet_submit_candidate`, `autosnippet_submit_candidates`, `autosnippet_submit_draft_recipes` |
90
+ | 候选提交 | `autosnippet_submit_knowledge`, `autosnippet_submit_knowledge_batch`, `autosnippet_submit_knowledge_batch` |
91
91
  | AI 补全 | `autosnippet_enrich_candidates` |
92
92
  | Guard 检查 | `autosnippet_guard_check`, `autosnippet_guard_audit_files` |
93
93
  | 合规报告 | `autosnippet_compliance_report`, `autosnippet_recipe_insights` |
94
94
  | 使用确认 | `autosnippet_confirm_usage` |
95
95
  | 项目扫描 | `autosnippet_scan_project` |
96
- | 冷启动 | `autosnippet_bootstrap_knowledge` |
96
+ | 冷启动 | `autosnippet_bootstrap_knowledge`, `autosnippet_bootstrap_refine` |
97
+ | Skills 管理 | `autosnippet_list_skills`, `autosnippet_load_skill`, `autosnippet_create_skill`, `autosnippet_update_skill`, `autosnippet_delete_skill`, `autosnippet_suggest_skills` |
97
98
  | 自检/能力 | `autosnippet_health`, `autosnippet_capabilities` |
98
99
 
99
100
  ### Failure Handling (Examples)
@@ -336,7 +337,7 @@ When creating or extracting Recipes:
336
337
 
337
338
  ### Candidate-only Rule (重要)
338
339
 
339
- - **If the user asks for candidates**: Extract structured items and submit via MCP **`autosnippet_submit_candidates`**.
340
+ - **If the user asks for candidates**: Extract structured items and submit via MCP **`autosnippet_submit_knowledge_batch`**.
340
341
 
341
342
  ---
342
343
 
@@ -376,7 +377,7 @@ When `asd ui` is running in the project root, use the HTTP API for on-demand sem
376
377
  | Capability | Description | Skill |
377
378
  |------------|-------------|-------|
378
379
  | **Recipe lookup** | Read `references/project-recipes-context.md` 轻量索引,需全文调 MCP `autosnippet_get_recipe(id)` / `autosnippet_context_search`. Recipe over source | autosnippet-recipes |
379
- | **Create Recipe** | Dashboard New Recipe; or write to `_draft_recipe.md` and watch auto-adds; or MCP `autosnippet_submit_draft_recipes` | autosnippet-create |
380
+ | **Create Recipe** | Dashboard New Recipe; or write to `_draft_recipe.md` and watch auto-adds; or MCP `autosnippet_submit_knowledge_batch` | autosnippet-create |
380
381
  | **Search & insert** | `ass` shortcut or `// as:search`, `asd search`, Dashboard search | autosnippet-search |
381
382
  | **Audit review** | `// as:audit`; watch runs AI review against knowledge base | autosnippet-guard |
382
383
  | **Dependency graph** | `AutoSnippet/AutoSnippet.spmmap.json`; `asd spm-map` to update; MCP graph tools for querying | autosnippet-structure |
@@ -593,8 +594,8 @@ authority: 3
593
594
 
594
595
  ### How to add new knowledge
595
596
 
596
- 1. **Single code / single Recipe**: Copy to clipboard → open Dashboard (run `asd ui` if not running) → Use Copied Code, paste, review, save; or write `_draft_recipe.md` and let watch auto-add to Candidates. Or use `autosnippet_submit_draft_recipes` via MCP.
597
- 2. **Multiple drafts (recommended)**: Create a **draft folder** (e.g. `.autosnippet-drafts`), **one .md file per Recipe**—do not put everything in one big file. Call MCP **`autosnippet_submit_draft_recipes`** with those file paths to submit to Candidates, then review in Dashboard **Candidates**. **After submit, delete the draft folder** (use `deleteAfterSubmit: true` or `rm -rf .autosnippet-drafts`).
597
+ 1. **Single code / single Recipe**: Copy to clipboard → open Dashboard (run `asd ui` if not running) → Use Copied Code, paste, review, save; or write `_draft_recipe.md` and let watch auto-add to Candidates. Or use `autosnippet_submit_knowledge_batch` via MCP.
598
+ 2. **Multiple drafts (recommended)**: Create a **draft folder** (e.g. `.autosnippet-drafts`), **one .md file per Recipe**—do not put everything in one big file. Call MCP **`autosnippet_submit_knowledge_batch`** with those file paths to submit to Candidates, then review in Dashboard **Candidates**. **After submit, delete the draft folder** (use `deleteAfterSubmit: true` or `rm -rf .autosnippet-drafts`).
598
599
  3. **Intro-only docs**: Recipe candidates can be intro-only (frontmatter + usage guide, no code); after approval they become Recipes and **do not generate a Snippet**—used only for search and Guard context.
599
600
 
600
601
  ### How to use knowledge once it’s in the base
@@ -12,8 +12,8 @@ This skill tells the agent how to **submit module usage code** (that Cursor has
12
12
  ## Instructions for the agent (read this first)
13
13
 
14
14
  1. **Goal**: When you (Cursor) have **finished writing or refining** module usage code, or the user says "把这段提交到 web / 加入知识库", guide them to **submit that code to the Dashboard** so it becomes a **Recipe** in `AutoSnippet/recipes/`.
15
- 2. **Draft workflow**: Prefer **creating a draft folder** (e.g. `.autosnippet-drafts`), **one .md file per Recipe**, multiple draft files—**do not use one big file**. Call MCP **`autosnippet_submit_draft_recipes`** with filePaths (the .md files in the draft folder) to submit to Candidates. **After submit, delete the draft folder** (use `deleteAfterSubmit: true` or run `rm -rf .autosnippet-drafts`). Single-item flow can use `_draft_recipe.md` and watch will auto-add to Candidates.
16
- 3. **When user asks for "candidates"**: Use MCP **`autosnippet_submit_candidates`** for structured items (title/summary/trigger/code/usageGuide); use **`autosnippet_submit_draft_recipes`** for Markdown draft files (prefer draft folder + multiple files; delete draft folder after submit).
15
+ 2. **Draft workflow**: Prefer **creating a draft folder** (e.g. `.autosnippet-drafts`), **one .md file per Recipe**, multiple draft files—**do not use one big file**. Call MCP **`autosnippet_submit_knowledge_batch`** with filePaths (the .md files in the draft folder) to submit to Candidates. **After submit, delete the draft folder** (use `deleteAfterSubmit: true` or run `rm -rf .autosnippet-drafts`). Single-item flow can use `_draft_recipe.md` and watch will auto-add to Candidates.
16
+ 3. **When user asks for "candidates"**: Use MCP **`autosnippet_submit_knowledge_batch`** for structured items (title/summary/trigger/code/usageGuide); use **`autosnippet_submit_knowledge_batch`** for Markdown draft files (prefer draft folder + multiple files; delete draft folder after submit).
17
17
  4. **One Recipe = one scenario**: If you are drafting content, **split** into multiple Recipes by scenario. Never combine multiple usage patterns into one Recipe file or one candidate.
18
18
  5. **Recipe candidates can be intro-only**: Intro-only docs (no code block) can be submitted as candidates; after approval they become Recipes and **do not generate a Snippet**—used only for search and Guard context.
19
19
  6. **MUST follow standard Recipe format**: Use the complete template from **autosnippet-concepts** skill. Include all required fields: frontmatter with `title`, `trigger`, `category` (one of 8 standard values), `language` (must be `swift` or `objectivec`), `summary_cn`, `summary_en`, `headers` (complete import statements), plus `## Snippet / Code Reference` and `## AI Context / Usage Guide` section.
@@ -51,11 +51,11 @@ This skill tells the agent how to **submit module usage code** (that Cursor has
51
51
  ```
52
52
  - See [templates/recipes-setup/README.md](../../templates/recipes-setup/README.md) for detailed format guide & examples.
53
53
  7. **Auto-fill headers from project context**: Before submitting, **check `references/project-recipes-context.md`** (轻量索引) to find similar Recipes by title/trigger/category, then call MCP **`autosnippet_get_recipe(id)`** to get full content including headers. Copy the exact import format for `headers` field. If needed, call MCP **`autosnippet_context_search`** with the module name to find similar Recipes and extract their header patterns. This ensures consistency and correctness.
54
- 8. **Primary flow (MCP preferred)**: Code is ready → Agent writes to `_draft_recipe.md` or calls `autosnippet_submit_draft_recipes` / `autosnippet_submit_candidates` → candidates appear in Dashboard Candidates → user reviews and approves → Recipe is added to the knowledge base.
54
+ 8. **Primary flow (MCP preferred)**: Code is ready → Agent writes to `_draft_recipe.md` or calls `autosnippet_submit_knowledge_batch` / `autosnippet_submit_knowledge_batch` → candidates appear in Dashboard Candidates → user reviews and approves → Recipe is added to the knowledge base.
55
55
  9. **Alternative (Dashboard browser)**: Code is ready → user opens Dashboard (`asd ui` running) → **New Recipe** → **Use Copied Code** (paste the code) → AI fills title/summary/trigger/headers → **user reviews and approves** → saved to knowledge base.
56
56
  10. **Alternative (in editor)**: User adds **`// as:create`** in the source file, copies the code, saves → **watch** (from `asd watch` or `asd ui`) auto-adds to Candidates → user opens Dashboard **Candidates** to review and save.
57
57
  9. **Draft & clipboard auto-add**: When you write to **`_draft_recipe.md`** (project root) or user uses **`// as:create`** with clipboard content, **watch** automatically reads the draft/clipboard, adds it to **Candidates** (target `_draft` or `_watch`), and shows a **friendly prompt** (e.g. "已创建候选「xxx」,请在 Candidates 页审核" in notification and console). User only needs to open Dashboard **Candidates** to review and save — no manual copy-paste required.
58
- 10. **Multiple recipes**: Prefer **one .md file per Recipe** in a draft folder (e.g. `.autosnippet-drafts/`), call **`autosnippet_submit_draft_recipes`** with the list of file paths, then **delete the draft folder** after submit. Do not use one big file for many Recipes.
58
+ 10. **Multiple recipes**: Prefer **one .md file per Recipe** in a draft folder (e.g. `.autosnippet-drafts/`), call **`autosnippet_submit_knowledge_batch`** with the list of file paths, then **delete the draft folder** after submit. Do not use one big file for many Recipes.
59
59
  11. **Project root** = directory with `AutoSnippet/AutoSnippet.boxspec.json`. All commands run from the project root.
60
60
 
61
61
  ---
@@ -68,7 +68,7 @@ This skill tells the agent how to **submit module usage code** (that Cursor has
68
68
 
69
69
  - **Code scenario**: Usage code is in current file or clipboard. If not copied, prompt user to copy the code block you provide.
70
70
  ...rated a full Recipe (frontmatter, Snippet, Usage Guide), **prefer writing to draft file** `_draft_recipe.md` at project root. On save, **watch automatically reads the draft**, adds it to **Candidates** (target `_draft`), and shows a **friendly prompt** ("已创建候选「xxx」,请在 Candidates 页审核"). User opens Dashboard **Candidates** to review and save — no manual copy needed. Or output in copyable format in chat and guide user to copy → Dashboard → Use Copied Code → paste → review → save. **Do not write to `AutoSnippet/recipes/` or `AutoSnippet/snippets/`.**
71
- - **Candidate output rule**: When the user asks for candidates, **do not create files under `AutoSnippet/`**. Use **`autosnippet_submit_candidates`** for structured items; use **`autosnippet_submit_draft_recipes`** for draft .md files (prefer draft folder + multiple files; delete draft folder after submit).
71
+ - **Candidate output rule**: When the user asks for candidates, **do not create files under `AutoSnippet/`**. Use **`autosnippet_submit_knowledge_batch`** for structured items; use **`autosnippet_submit_knowledge_batch`** for draft .md files (prefer draft folder + multiple files; delete draft folder after submit).
72
72
 
73
73
  ### Step 2: Open the web (Dashboard) in browser
74
74
 
@@ -78,7 +78,7 @@ This skill tells the agent how to **submit module usage code** (that Cursor has
78
78
  ### Step 3: Submit via Dashboard
79
79
 
80
80
  1. **Browser**: Run terminal command `open "http://localhost:3000/?action=create&source=clipboard"` (macOS) to open the browser.
81
- 2. **Draft file (preferred for Agent)**: Write full Recipe MD to `_draft_recipe.md` at project root → watch auto-adds to Candidates. Or call MCP **`autosnippet_submit_draft_recipes`** with draft file paths.
81
+ 2. **Draft file (preferred for Agent)**: Write full Recipe MD to `_draft_recipe.md` at project root → watch auto-adds to Candidates. Or call MCP **`autosnippet_submit_knowledge_batch`** with draft file paths.
82
82
  3. **Manual fallback**: User opens **`http://localhost:3000`** in browser → **New Recipe** → **Use Copied Code** → paste.
83
83
  3. Pasted code: **Full Recipe MD** (with `---` frontmatter, `## Snippet / Code Reference`, `## AI Context / Usage Guide`) is parsed directly, **no AI rewrite**. Plain code still goes through AI analysis and fill.
84
84
  4. **User reviews and approves** — 人工审核 title/summary/category/trigger 及内容,确认无误后再保存。
@@ -92,7 +92,7 @@ This skill tells the agent how to **submit module usage code** (that Cursor has
92
92
 
93
93
  ## Alternative: Copy then jump to Web (Xcode and Cursor)
94
94
 
95
- **Option A — MCP Submit (Cursor 首选)**: After user confirms code, Agent calls **`autosnippet_submit_draft_recipes`** (for .md drafts) or **`autosnippet_submit_candidates`** (for structured items) to submit directly to Candidates. User reviews in Dashboard.
95
+ **Option A — MCP Submit (Cursor 首选)**: After user confirms code, Agent calls **`autosnippet_submit_knowledge_batch`** (for .md drafts) or **`autosnippet_submit_knowledge_batch`** (for structured items) to submit directly to Candidates. User reviews in Dashboard.
96
96
 
97
97
  **Option B — Browser (Dashboard)**: Run `open "http://localhost:3000/?action=create&source=clipboard"` to open Dashboard New Recipe page; page reads clipboard and fills.
98
98
 
@@ -148,9 +148,9 @@ Watch parses all such blocks and adds each as a separate candidate; prompt may s
148
148
 
149
149
  | User / Cursor situation | Action |
150
150
  |-------------------------|--------|
151
- | "把这段提交到 web / 加入知识库" (code just written) | 1) 提示用户复制代码;2) 写入 `_draft_recipe.md` 或调用 **`autosnippet_submit_draft_recipes`**;3) 若需 Dashboard,运行 `open "http://localhost:3000/?action=create&source=clipboard"`;4) 用户粘贴并保存。 |
151
+ | "把这段提交到 web / 加入知识库" (code just written) | 1) 提示用户复制代码;2) 写入 `_draft_recipe.md` 或调用 **`autosnippet_submit_knowledge_batch`**;3) 若需 Dashboard,运行 `open "http://localhost:3000/?action=create&source=clipboard"`;4) 用户粘贴并保存。 |
152
152
  | Agent 起草了 Recipe/Snippet 内容 | **Prefer**: Write to `_draft_recipe.md` (project root) → save → **watch 自动读取并加入候选池**,并给出友好提示 → 用户打开 Dashboard **Candidates** 审核并保存。无需手动复制。 |
153
- | Code in current file, want to submit from editor | **MCP**:`autosnippet_submit_draft_recipes`(写草稿 .md 后提交)。或 Add **`// as:create`**, copy, save;确保 **`asd watch`** / **`asd ui`** 运行;有剪贴板时自动加入候选并友好提示。 |
153
+ | Code in current file, want to submit from editor | **MCP**:`autosnippet_submit_knowledge_batch`(写草稿 .md 后提交)。或 Add **`// as:create`**, copy, save;确保 **`asd watch`** / **`asd ui`** 运行;有剪贴板时自动加入候选并友好提示。 |
154
154
  | Code already in a file (path known) | 打开 **`http://localhost:3000`** → New Recipe → enter path → **Scan File** → review → save. |
155
155
  | Agent 起草内容无法完整复制 | Write to `_draft_recipe.md` → save → **watch 自动读取草稿、加入候选并友好提示** → 用户打开 **Candidates** 审核保存。 |
156
156
  | Batch from Target | **`asd ais <Target>`** → 打开 **`http://localhost:3000`** → **Candidates** → approve. |
@@ -162,13 +162,13 @@ Watch parses all such blocks and adds each as a separate candidate; prompt may s
162
162
  | Tool | Use |
163
163
  |------|-----|
164
164
  | `autosnippet_context_search` | On-demand semantic search of knowledge base; pass `query`, `limit?` |
165
- | `autosnippet_submit_draft_recipes` | Submit draft .md as candidates: prefer draft folder + multiple files (not one big file); supports intro-only docs (no code—no Snippet). Pass `filePaths`, optional `targetName`, `deleteAfterSubmit`. **Delete the draft folder after submit** (e.g. `deleteAfterSubmit: true` or `rm -rf .autosnippet-drafts`). |
166
- | `autosnippet_submit_candidates` | Submit structured items (title, summary, trigger, language, code, usageGuide) for batch scan, etc. |
167
- | `autosnippet_submit_candidate` | Submit single structured candidate with full V2 fields. |
165
+ | `autosnippet_submit_knowledge_batch` | Submit draft .md as candidates: prefer draft folder + multiple files (not one big file); supports intro-only docs (no code—no Snippet). Pass `filePaths`, optional `targetName`, `deleteAfterSubmit`. **Delete the draft folder after submit** (e.g. `deleteAfterSubmit: true` or `rm -rf .autosnippet-drafts`). |
166
+ | `autosnippet_submit_knowledge_batch` | Submit structured items (title, summary, trigger, language, code, usageGuide) for batch scan, etc. |
167
+ | `autosnippet_submit_knowledge` | Submit single structured candidate with full V2 fields. |
168
168
  | `autosnippet_validate_candidate` | Pre-validate candidate quality before submission. |
169
169
  | `autosnippet_check_duplicate` | Check for duplicate Recipes before submission. |
170
170
 
171
- **Fallback when Dashboard not open**: Agent can always use `autosnippet_submit_draft_recipes` or `autosnippet_submit_candidates` directly via MCP — no browser needed.
171
+ **Fallback when Dashboard not open**: Agent can always use `autosnippet_submit_knowledge_batch` or `autosnippet_submit_knowledge_batch` directly via MCP — no browser needed.
172
172
 
173
173
  ---
174
174
 
@@ -42,10 +42,11 @@ Use this skill when the user's intent is unclear or overlaps multiple capabiliti
42
42
  - Insights: `autosnippet_recipe_insights`, `autosnippet_compliance_report`
43
43
  - Graph: `autosnippet_graph_query`, `autosnippet_graph_impact`, `autosnippet_graph_path`, `autosnippet_graph_stats`
44
44
  - Structure: `autosnippet_get_targets`, `autosnippet_get_target_files`, `autosnippet_get_target_metadata`
45
- - Candidates: `autosnippet_validate_candidate`, `autosnippet_check_duplicate`, `autosnippet_submit_candidate`, `autosnippet_submit_candidates`, `autosnippet_submit_draft_recipes`, `autosnippet_enrich_candidates`
45
+ - Candidates: `autosnippet_validate_candidate`, `autosnippet_check_duplicate`, `autosnippet_submit_knowledge`, `autosnippet_submit_knowledge_batch`, `autosnippet_submit_knowledge_batch`, `autosnippet_enrich_candidates`
46
46
  - Guard: `autosnippet_guard_check`, `autosnippet_guard_audit_files`, `autosnippet_scan_project`
47
47
  - Telemetry: `autosnippet_confirm_usage`
48
- - Bootstrap: `autosnippet_bootstrap_knowledge`
48
+ - Bootstrap: `autosnippet_bootstrap_knowledge`, `autosnippet_bootstrap_refine`
49
+ - Skills: `autosnippet_list_skills`, `autosnippet_load_skill`, `autosnippet_create_skill`, `autosnippet_update_skill`, `autosnippet_delete_skill`, `autosnippet_suggest_skills`
49
50
 
50
51
  This skill is a router only; it does not perform actions itself.
51
52
 
@@ -37,9 +37,9 @@ This skill documents the Recipe lifecycle and clarifies what Agent can and canno
37
37
  ## Agent Role: What You CAN Do
38
38
 
39
39
  ### 1. Submit Candidates
40
- - `autosnippet_submit_candidate` - single structured candidate
41
- - `autosnippet_submit_candidates` - batch structured candidates
42
- - `autosnippet_submit_draft_recipes` - submit .md files as candidates
40
+ - `autosnippet_submit_knowledge` - single structured candidate
41
+ - `autosnippet_submit_knowledge_batch` - batch structured candidates
42
+ - `autosnippet_submit_knowledge_batch` - submit .md files as candidates
43
43
 
44
44
  ### 2. Validate and Enhance Candidates
45
45
  - `autosnippet_validate_candidate` - pre-validate quality
@@ -81,7 +81,7 @@ This skill documents the Recipe lifecycle and clarifies what Agent can and canno
81
81
  2. Generate structured candidate with rationale, steps, etc.
82
82
  3. `autosnippet_check_duplicate` - verify no duplicate exists
83
83
  4. `autosnippet_validate_candidate` - pre-validate quality
84
- 5. `autosnippet_submit_candidate` - submit to candidate pool
84
+ 5. `autosnippet_submit_knowledge` - submit to candidate pool
85
85
  6. Tell user: "Candidate submitted. Review in Dashboard Candidates page."
86
86
 
87
87
  ### Workflow 2: User asks about an existing Recipe
@@ -94,7 +94,7 @@ This skill documents the Recipe lifecycle and clarifies what Agent can and canno
94
94
  1. Explain: "I cannot modify Recipes directly. I can submit an improved version as a new candidate."
95
95
  2. `autosnippet_get_recipe` to read current content
96
96
  3. Generate improved candidate based on user's feedback
97
- 4. `autosnippet_submit_candidate` - submit improved version
97
+ 4. `autosnippet_submit_knowledge` - submit improved version
98
98
  5. Tell user: "Improved version submitted as candidate. Update the Recipe in Dashboard."
99
99
 
100
100
  ---
@@ -78,7 +78,7 @@ Recipe is the core knowledge unit. V2 uses a unified structured model:
78
78
 
79
79
  ---
80
80
 
81
- ## MCP Tools Reference (31 tools)
81
+ ## MCP Tools Reference (38 tools)
82
82
 
83
83
  ### Query (Agent can freely use)
84
84
 
@@ -109,9 +109,9 @@ Recipe is the core knowledge unit. V2 uses a unified structured model:
109
109
 
110
110
  | Tool | Description |
111
111
  |------|-------------|
112
- | autosnippet_submit_candidate | Submit single candidate (supports structured content) |
113
- | autosnippet_submit_candidates | Batch submit candidates |
114
- | autosnippet_submit_draft_recipes | Submit draft .md files as candidates |
112
+ | autosnippet_submit_knowledge | Submit single candidate (supports structured content) |
113
+ | autosnippet_submit_knowledge_batch | Batch submit candidates |
114
+ | autosnippet_submit_knowledge_batch | Submit draft .md files as candidates |
115
115
  | autosnippet_validate_candidate | Validate candidate quality |
116
116
  | autosnippet_check_duplicate | Dedup check |
117
117
  | autosnippet_enrich_candidates | AI semantic field enrichment for candidates |
@@ -124,6 +124,18 @@ Recipe is the core knowledge unit. V2 uses a unified structured model:
124
124
  | autosnippet_guard_audit_files | Multi-file batch Guard audit |
125
125
  | autosnippet_scan_project | Lightweight project scan + Guard audit |
126
126
  | autosnippet_bootstrap_knowledge | Cold-start knowledge base initialization (9 dimensions) |
127
+ | autosnippet_bootstrap_refine | AI refinement of bootstrap candidates (Phase 6) |
128
+
129
+ ### Skills Management
130
+
131
+ | Tool | Description |
132
+ |------|-------------|
133
+ | autosnippet_list_skills | List all available Agent Skills |
134
+ | autosnippet_load_skill | Load Skill document for domain guidance |
135
+ | autosnippet_create_skill | Create project-level Skill |
136
+ | autosnippet_update_skill | Update project-level Skill |
137
+ | autosnippet_delete_skill | Delete project-level Skill |
138
+ | autosnippet_suggest_skills | AI-powered Skill creation suggestions |
127
139
 
128
140
  ### Usage Telemetry
129
141
 
@@ -48,7 +48,7 @@ roles:
48
48
  - "read:recipes"
49
49
  - "read:guard_rules"
50
50
  - "create:candidates"
51
- - "submit:candidates"
51
+ - "submit:knowledge"
52
52
  - "read:audit_logs:self"
53
53
  - "knowledge:bootstrap"
54
54
  - "create:skills"
@@ -23,7 +23,7 @@
23
23
 
24
24
  ## 强制规则(必须遵守)
25
25
  1. **禁止直接修改** 知识库目录内容(`AutoSnippet/recipes/`、`.autosnippet/` 等)。
26
- 2. 创建或入库必须走 **Dashboard** 或 MCP 工具流程(`autosnippet_submit_candidate`、`autosnippet_submit_candidates`)。
26
+ 2. 创建或入库必须走 **Dashboard** 或 MCP 工具流程(`autosnippet_submit_knowledge`、`autosnippet_submit_knowledge_batch`)。
27
27
  3. **优先使用 Recipe** 作为项目标准;源代码仅作补充。
28
28
  4. MCP 检索优先:使用 `autosnippet_search` 或 `autosnippet_context_search` 获取语义检索结果。
29
29
  5. MCP 调用失败时,**不要在同一轮重复重试**,回退到已读文档或静态上下文。
@@ -47,9 +47,9 @@
47
47
  ### 候选提交 & 校验
48
48
  - `autosnippet_validate_candidate` — 提交前预校验(5 层)
49
49
  - `autosnippet_check_duplicate` — 相似度检测
50
- - `autosnippet_submit_candidate` — 单条提交(reasoning 必填)
51
- - `autosnippet_submit_candidates` — 批量提交(含去重 + 限流)
52
- - `autosnippet_submit_draft_recipes` — 解析草稿 Markdown 文件
50
+ - `autosnippet_submit_knowledge` — 单条提交(reasoning 必填)
51
+ - `autosnippet_submit_knowledge_batch` — 批量提交(含去重 + 限流)
52
+ - `autosnippet_submit_knowledge_batch` — 解析草稿 Markdown 文件
53
53
  - `autosnippet_enrich_candidates` — AI 补全缺失语义字段
54
54
 
55
55
  ### 项目扫描 & 冷启动
@@ -85,8 +85,8 @@
85
85
 
86
86
  ## 推荐工作流
87
87
  - **查找**:`autosnippet_search`(推荐)或 `autosnippet_context_search`(上下文感知)。
88
- - **产出候选**:`autosnippet_validate_candidate` 预校验 → `autosnippet_submit_candidate` 提交。
89
- - **冷启动**:`autosnippet_bootstrap_knowledge` → `autosnippet_enrich_candidates` → `autosnippet_bootstrap_refine` → 逐 Target 深入 → `autosnippet_submit_candidates`。
88
+ - **产出候选**:`autosnippet_validate_candidate` 预校验 → `autosnippet_submit_knowledge` 提交。
89
+ - **冷启动**:`autosnippet_bootstrap_knowledge` → `autosnippet_enrich_candidates` → `autosnippet_bootstrap_refine` → 逐 Target 深入 → `autosnippet_submit_knowledge_batch`。
90
90
  - **Skills 创建**:`autosnippet_suggest_skills` 分析 → `autosnippet_create_skill` 固化知识。
91
91
  - **采纳反馈**:`autosnippet_confirm_usage`(记录使用量影响排序权重)。
92
92
 
@@ -160,9 +160,9 @@ V2 知识库中的 Recipe 按 `knowledgeType` 自动归入三类 kind,影响
160
160
  | `autosnippet_search` | 统合搜索(BM25 + 语义融合) |
161
161
  | `autosnippet_context_search` | 智能上下文检索 |
162
162
  | `autosnippet_validate_candidate` | 候选结构化预校验 |
163
- | `autosnippet_submit_candidate` | 单条候选提交(reasoning 必填) |
164
- | `autosnippet_submit_candidates` | 批量候选提交 |
165
- | `autosnippet_submit_draft_recipes` | 解析草稿 Markdown 为候选 |
163
+ | `autosnippet_submit_knowledge` | 单条候选提交(reasoning 必填) |
164
+ | `autosnippet_submit_knowledge_batch` | 批量候选提交 |
165
+ | `autosnippet_submit_knowledge_batch` | 解析草稿 Markdown 为候选 |
166
166
  | `autosnippet_confirm_usage` | 确认 Recipe 被采纳/应用 |
167
167
  | `autosnippet_recipe_insights` | 获取 Recipe 质量洞察(只读) |
168
168