autosnippet 3.2.18 → 3.2.21

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 (189) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +73 -104
  3. package/config/default.json +1 -1
  4. package/dashboard/dist/assets/{index-CKMy5LY6.js → index-DdvZE4Yd.js} +1 -1
  5. package/dashboard/dist/index.html +1 -1
  6. package/dist/bin/cli.js +45 -10
  7. package/dist/lib/agent/AgentEventBus.js +3 -3
  8. package/dist/lib/agent/AgentFactory.d.ts +3 -3
  9. package/dist/lib/agent/AgentFactory.js +4 -4
  10. package/dist/lib/agent/AgentMessage.d.ts +8 -8
  11. package/dist/lib/agent/AgentMessage.js +8 -8
  12. package/dist/lib/agent/AgentRuntime.js +2 -2
  13. package/dist/lib/agent/AgentState.js +4 -4
  14. package/dist/lib/agent/ConversationStore.d.ts +1 -1
  15. package/dist/lib/agent/ConversationStore.js +1 -1
  16. package/dist/lib/agent/PipelineStrategy.js +1 -1
  17. package/dist/lib/agent/context/ContextWindow.d.ts +2 -2
  18. package/dist/lib/agent/context/ContextWindow.js +7 -7
  19. package/dist/lib/agent/context/ExplorationTracker.js +9 -9
  20. package/dist/lib/agent/context/exploration/PlanTracker.js +2 -2
  21. package/dist/lib/agent/context/exploration/SignalDetector.d.ts +1 -1
  22. package/dist/lib/agent/context/exploration/SignalDetector.js +1 -1
  23. package/dist/lib/agent/core/LoopContext.d.ts +21 -21
  24. package/dist/lib/agent/core/LoopContext.js +21 -21
  25. package/dist/lib/agent/core/SystemPromptBuilder.js +4 -4
  26. package/dist/lib/agent/domain/EvidenceCollector.js +5 -5
  27. package/dist/lib/agent/memory/ActiveContext.js +1 -1
  28. package/dist/lib/agent/memory/MemoryRetriever.js +1 -1
  29. package/dist/lib/agent/memory/MemoryStore.js +2 -2
  30. package/dist/lib/agent/memory/SessionStore.js +3 -3
  31. package/dist/lib/agent/policies.d.ts +1 -1
  32. package/dist/lib/agent/policies.js +1 -1
  33. package/dist/lib/agent/strategies.d.ts +1 -1
  34. package/dist/lib/agent/strategies.js +4 -4
  35. package/dist/lib/agent/tools/_shared.d.ts +1 -1
  36. package/dist/lib/agent/tools/_shared.js +1 -1
  37. package/dist/lib/agent/tools/infrastructure.js +2 -2
  38. package/dist/lib/cli/SetupService.d.ts +25 -25
  39. package/dist/lib/cli/SetupService.js +28 -15
  40. package/dist/lib/cli/deploy/FileDeployer.d.ts +9 -2
  41. package/dist/lib/cli/deploy/FileDeployer.js +139 -46
  42. package/dist/lib/cli/deploy/FileManifest.d.ts +23 -39
  43. package/dist/lib/cli/deploy/FileManifest.js +22 -33
  44. package/dist/lib/core/AstAnalyzer.d.ts +2 -2
  45. package/dist/lib/core/AstAnalyzer.js +2 -2
  46. package/dist/lib/core/analysis/CallEdgeResolver.d.ts +7 -7
  47. package/dist/lib/core/analysis/CallEdgeResolver.js +9 -9
  48. package/dist/lib/core/analysis/CallGraphAnalyzer.d.ts +4 -4
  49. package/dist/lib/core/analysis/CallGraphAnalyzer.js +2 -2
  50. package/dist/lib/core/analysis/ImportPathResolver.d.ts +0 -2
  51. package/dist/lib/core/analysis/ImportPathResolver.js +2 -4
  52. package/dist/lib/core/ast/ProjectGraph.js +7 -7
  53. package/dist/lib/core/capability/CapabilityProbe.js +6 -14
  54. package/dist/lib/domain/knowledge/UnifiedValidator.js +2 -2
  55. package/dist/lib/domain/knowledge/values/Constraints.js +4 -4
  56. package/dist/lib/domain/knowledge/values/Content.js +6 -6
  57. package/dist/lib/domain/knowledge/values/Quality.js +5 -5
  58. package/dist/lib/domain/knowledge/values/Reasoning.js +5 -5
  59. package/dist/lib/domain/knowledge/values/Relations.js +1 -1
  60. package/dist/lib/domain/knowledge/values/Stats.js +6 -6
  61. package/dist/lib/domain/task/TaskIdGenerator.d.ts +4 -4
  62. package/dist/lib/domain/task/TaskIdGenerator.js +2 -2
  63. package/dist/lib/external/lark/LarkTransport.js +4 -4
  64. package/dist/lib/external/mcp/McpServer.d.ts +3 -7
  65. package/dist/lib/external/mcp/McpServer.js +9 -13
  66. package/dist/lib/external/mcp/handlers/bootstrap/ExternalSubmissionTracker.js +5 -5
  67. package/dist/lib/external/mcp/handlers/bootstrap/MissionBriefingBuilder.js +4 -3
  68. package/dist/lib/external/mcp/handlers/bootstrap/pipeline/BootstrapSnapshot.d.ts +3 -3
  69. package/dist/lib/external/mcp/handlers/bootstrap/pipeline/BootstrapSnapshot.js +3 -3
  70. package/dist/lib/external/mcp/handlers/bootstrap/pipeline/IncrementalBootstrap.d.ts +1 -1
  71. package/dist/lib/external/mcp/handlers/bootstrap/pipeline/IncrementalBootstrap.js +1 -1
  72. package/dist/lib/external/mcp/handlers/bootstrap/pipeline/dimension-context.js +3 -3
  73. package/dist/lib/external/mcp/handlers/bootstrap/shared/dimension-sop.js +27 -14
  74. package/dist/lib/external/mcp/handlers/bootstrap-external.js +6 -0
  75. package/dist/lib/external/mcp/handlers/dimension-complete-external.js +55 -1
  76. package/dist/lib/external/mcp/handlers/skill.js +9 -31
  77. package/dist/lib/external/mcp/handlers/system.js +6 -4
  78. package/dist/lib/external/mcp/handlers/task.js +16 -1
  79. package/dist/lib/external/mcp/tools.d.ts +12 -10
  80. package/dist/lib/external/mcp/tools.js +97 -69
  81. package/dist/lib/http/utils/routeHelpers.d.ts +1 -1
  82. package/dist/lib/http/utils/routeHelpers.js +1 -1
  83. package/dist/lib/http/utils/sse-sessions.d.ts +1 -1
  84. package/dist/lib/http/utils/sse-sessions.js +1 -1
  85. package/dist/lib/infrastructure/cache/CacheService.js +1 -1
  86. package/dist/lib/infrastructure/logging/Logger.js +1 -1
  87. package/dist/lib/infrastructure/monitoring/ErrorTracker.js +1 -1
  88. package/dist/lib/infrastructure/vector/AsyncPersistence.js +8 -8
  89. package/dist/lib/infrastructure/vector/BatchEmbedder.d.ts +1 -1
  90. package/dist/lib/infrastructure/vector/BatchEmbedder.js +2 -2
  91. package/dist/lib/infrastructure/vector/HnswIndex.d.ts +4 -4
  92. package/dist/lib/infrastructure/vector/HnswIndex.js +5 -5
  93. package/dist/lib/infrastructure/vector/HnswVectorAdapter.js +8 -8
  94. package/dist/lib/infrastructure/vector/ScalarQuantizer.d.ts +1 -1
  95. package/dist/lib/infrastructure/vector/ScalarQuantizer.js +4 -4
  96. package/dist/lib/infrastructure/vector/VectorStore.d.ts +1 -1
  97. package/dist/lib/infrastructure/vector/VectorStore.js +1 -1
  98. package/dist/lib/injection/ServiceContainer.d.ts +1 -1
  99. package/dist/lib/injection/ServiceContainer.js +1 -1
  100. package/dist/lib/injection/modules/KnowledgeModule.js +4 -5
  101. package/dist/lib/platform/NativeUi.d.ts +1 -1
  102. package/dist/lib/platform/NativeUi.js +1 -1
  103. package/dist/lib/platform/ios/spm/DependencyGraph.d.ts +1 -1
  104. package/dist/lib/platform/ios/spm/DependencyGraph.js +1 -1
  105. package/dist/lib/platform/ios/spm/PolicyEngine.d.ts +1 -1
  106. package/dist/lib/platform/ios/spm/PolicyEngine.js +1 -1
  107. package/dist/lib/platform/ios/spm/SpmDiscoverer.js +1 -1
  108. package/dist/lib/platform/ios/spm/SpmHelper.js +3 -3
  109. package/dist/lib/platform/ios/xcode/SaveEventFilter.js +2 -2
  110. package/dist/lib/platform/ios/xcode/XcodeIntegration.js +1 -1
  111. package/dist/lib/repository/base/BaseRepository.js +1 -1
  112. package/dist/lib/repository/task/TaskRepository.impl.d.ts +2 -2
  113. package/dist/lib/repository/task/TaskRepository.impl.js +1 -1
  114. package/dist/lib/repository/token/TokenUsageStore.js +1 -1
  115. package/dist/lib/service/automation/ActionPipeline.d.ts +1 -1
  116. package/dist/lib/service/automation/ActionPipeline.js +1 -1
  117. package/dist/lib/service/bootstrap/BootstrapEventEmitter.js +2 -2
  118. package/dist/lib/service/bootstrap/BootstrapTaskManager.d.ts +1 -1
  119. package/dist/lib/service/bootstrap/BootstrapTaskManager.js +2 -2
  120. package/dist/lib/service/bootstrap/DimensionCopyRegistry.d.ts +2 -2
  121. package/dist/lib/service/bootstrap/DimensionCopyRegistry.js +2 -2
  122. package/dist/lib/service/delivery/AgentInstructionsGenerator.d.ts +6 -15
  123. package/dist/lib/service/delivery/AgentInstructionsGenerator.js +53 -189
  124. package/dist/lib/service/delivery/CursorDeliveryPipeline.d.ts +6 -16
  125. package/dist/lib/service/delivery/CursorDeliveryPipeline.js +14 -19
  126. package/dist/lib/service/delivery/KnowledgeCompressor.d.ts +1 -1
  127. package/dist/lib/service/delivery/KnowledgeCompressor.js +1 -1
  128. package/dist/lib/service/delivery/RulesGenerator.d.ts +10 -3
  129. package/dist/lib/service/delivery/RulesGenerator.js +43 -3
  130. package/dist/lib/service/delivery/SkillsSyncer.d.ts +21 -7
  131. package/dist/lib/service/delivery/SkillsSyncer.js +46 -10
  132. package/dist/lib/service/delivery/TopicClassifier.d.ts +3 -6
  133. package/dist/lib/service/delivery/TopicClassifier.js +0 -3
  134. package/dist/lib/service/guard/ExclusionManager.d.ts +1 -1
  135. package/dist/lib/service/guard/ExclusionManager.js +1 -1
  136. package/dist/lib/service/guard/GuardCheckEngine.d.ts +3 -3
  137. package/dist/lib/service/guard/GuardCheckEngine.js +5 -5
  138. package/dist/lib/service/guard/GuardCrossFileChecks.d.ts +1 -1
  139. package/dist/lib/service/guard/GuardFeedbackLoop.d.ts +3 -3
  140. package/dist/lib/service/guard/GuardFeedbackLoop.js +3 -3
  141. package/dist/lib/service/guard/GuardPatternUtils.js +1 -1
  142. package/dist/lib/service/guard/GuardService.d.ts +1 -15
  143. package/dist/lib/service/guard/GuardService.js +0 -1
  144. package/dist/lib/service/guard/RuleLearner.d.ts +1 -1
  145. package/dist/lib/service/guard/RuleLearner.js +1 -1
  146. package/dist/lib/service/knowledge/CodeEntityGraph.d.ts +3 -3
  147. package/dist/lib/service/knowledge/CodeEntityGraph.js +3 -3
  148. package/dist/lib/service/knowledge/KnowledgeService.d.ts +0 -1
  149. package/dist/lib/service/knowledge/KnowledgeService.js +0 -1
  150. package/dist/lib/service/module/ModuleService.d.ts +1 -1
  151. package/dist/lib/service/module/ModuleService.js +2 -2
  152. package/dist/lib/service/search/HybridRetriever.d.ts +2 -2
  153. package/dist/lib/service/search/HybridRetriever.js +2 -2
  154. package/dist/lib/service/search/SearchEngine.d.ts +1 -3
  155. package/dist/lib/service/search/SearchEngine.js +1 -3
  156. package/dist/lib/service/search/contextBoost.d.ts +1 -1
  157. package/dist/lib/service/skills/EventAggregator.js +2 -2
  158. package/dist/lib/service/skills/SignalCollector.js +1 -1
  159. package/dist/lib/service/snippet/codecs/VSCodeCodec.js +1 -1
  160. package/dist/lib/service/task/TaskGraphService.d.ts +0 -3
  161. package/dist/lib/service/task/TaskGraphService.js +0 -3
  162. package/dist/lib/service/task/TaskKnowledgeBridge.d.ts +8 -27
  163. package/dist/lib/service/task/TaskKnowledgeBridge.js +0 -8
  164. package/dist/lib/service/task/TaskReadyEngine.d.ts +1 -2
  165. package/dist/lib/service/task/TaskReadyEngine.js +0 -1
  166. package/dist/lib/service/wiki/WikiRenderers.js +0 -1
  167. package/dist/lib/service/wiki/WikiUtils.js +2 -7
  168. package/dist/lib/shared/PathGuard.js +6 -6
  169. package/dist/lib/shared/schemas/config.js +1 -1
  170. package/dist/lib/shared/schemas/mcp-tools.js +84 -43
  171. package/dist/scripts/install-vscode-copilot.js +14 -4
  172. package/package.json +1 -1
  173. package/skills/autosnippet-create/SKILL.md +131 -131
  174. package/skills/autosnippet-devdocs/SKILL.md +1 -2
  175. package/skills/autosnippet-guard/SKILL.md +20 -89
  176. package/skills/autosnippet-recipes/SKILL.md +35 -117
  177. package/skills/autosnippet-structure/SKILL.md +23 -55
  178. package/templates/cursor-rules/autosnippet-skills.mdc +17 -33
  179. package/templates/instructions/agent-static.md +24 -0
  180. package/templates/instructions/conventions.md +42 -0
  181. package/skills/autosnippet-analysis/SKILL.md +0 -169
  182. package/skills/autosnippet-candidates/SKILL.md +0 -367
  183. package/skills/autosnippet-coldstart/SKILL.md +0 -988
  184. package/skills/autosnippet-concepts/SKILL.md +0 -630
  185. package/skills/autosnippet-intent/SKILL.md +0 -55
  186. package/skills/autosnippet-lifecycle/SKILL.md +0 -100
  187. package/templates/copilot-instructions.md +0 -66
  188. package/templates/cursor-rules/autosnippet-conventions.mdc +0 -172
  189. package/templates/cursor-rules/autosnippet-workflow.mdc +0 -76
@@ -1,55 +0,0 @@
1
- ---
2
- name: autosnippet-intent
3
- description: A light-weight router skill. Decide which AutoSnippet capability should be used (recipes/search/create/candidates/guard/structure/concepts). Use this to pick the right skill, then delegate to that skill for detailed steps.
4
- ---
5
-
6
- # AutoSnippet — Intent Router
7
-
8
- Use this skill when the user's intent is unclear or overlaps multiple capabilities. Your job is to select **one** primary capability, then hand off to the specific skill.
9
-
10
- ## Decision map (pick one primary path)
11
-
12
- | User intent / situation | Primary skill | Notes |
13
- |---|---|---|
14
- | "冷启动 / 初始化知识库 / 首次接入 / bootstrap" | **autosnippet-coldstart** | Full 9-dimension cold-start. |
15
- | "全项目分析 / 提取架构模式 / 生成知识库" | **autosnippet-coldstart** | Same — full project analysis. |
16
- | "有没有现成写法 / 查一下规范 / 给我标准代码" | **autosnippet-recipes** | Use Recipe context first. |
17
- | "把这段加入知识库 / 提交到知识库" | **autosnippet-create** | Submit via Dashboard or draft. |
18
- | "生成候选 / 批量扫描 / 扫 Target" | **autosnippet-candidates** | Generate rich candidates. |
19
- | "帮我审计 / Lint / 规范检查" | **autosnippet-guard** | Use Recipe as audit standard. |
20
- | "依赖关系 / 目标结构 / targets / spmmap" | **autosnippet-structure** | Targets + dep graph. |
21
- | "知识库/Recipe/Trigger 是什么" | **autosnippet-concepts** | Explain concepts. |
22
- | "补全候选字段 / enrich / 深度分析" | **autosnippet-analysis** | Semantic enrichment. |
23
-
24
- ## Rules
25
-
26
- 1. **Pick one primary path**. Avoid sending multiple flows unless the user explicitly asks.
27
- 2. **Do not force a flow**. Recommend softly (“可以…”), and only when relevant.
28
- 3. After choosing, **use the chosen skill** for the detailed steps.
29
-
30
- ## Deprecated skills (removed — do not reference)
31
-
32
- - `autosnippet-when` → replaced by this skill (autosnippet-intent)
33
- - `autosnippet-search` → merged into autosnippet-recipes
34
- - `autosnippet-batch-scan` / `autosnippet-recipe-candidates` → merged into autosnippet-candidates
35
- - `autosnippet-dep-graph` → merged into autosnippet-structure
36
-
37
- ## MCP tools (reference only — 20 个整合工具)
38
-
39
- - System: `autosnippet_health`, `autosnippet_capabilities`
40
- - Search: `autosnippet_search` (mode: auto / context / keyword / semantic)
41
- - Knowledge: `autosnippet_knowledge` (operation: list / get / insights / confirm_usage)
42
- - Graph: `autosnippet_graph` (operation: query / impact / path / stats)
43
- - Structure: `autosnippet_structure` (operation: targets / files / metadata)
44
- - Submit: `autosnippet_submit_knowledge`, `autosnippet_submit_knowledge_batch`
45
- - Document: `autosnippet_save_document`
46
- - Guard: `autosnippet_guard` (code 单文件 / files[] 批量)
47
- - Bootstrap: `autosnippet_bootstrap` (no params — Mission Briefing) + `autosnippet_dimension_complete`
48
- - Wiki: `autosnippet_wiki_plan` (topic planning) + `autosnippet_wiki_finalize` (meta.json + dedup)
49
- - Task: `autosnippet_task` (operation: prime (session entry) / create / ready / claim / close / fail / defer / progress / stats / decompose / record_decision / revise_decision / unpin_decision / list_decisions)
50
- - Skills: `autosnippet_skill` (operation: list / load / create / update / delete / suggest)
51
- - Admin: `autosnippet_enrich_candidates`, `autosnippet_knowledge_lifecycle`, `autosnippet_validate_candidate`, `autosnippet_check_duplicate`
52
-
53
- This skill is a router only; it does not perform actions itself.
54
-
55
- ```
@@ -1,100 +0,0 @@
1
- ---
2
- name: autosnippet-lifecycle
3
- description: Understand the Recipe lifecycle (draft -> active -> deprecated) and the Agent's role boundaries. Agent can submit candidates, validate, confirm usage, but CANNOT create/modify/publish/delete Recipes directly.
4
- ---
5
-
6
- # AutoSnippet Recipe Lifecycle
7
-
8
- This skill documents the Recipe lifecycle and clarifies what Agent can and cannot do.
9
-
10
- ---
11
-
12
- ## Lifecycle Stages
13
-
14
- ```
15
- Human approves
16
- Candidate -----+-----> Draft Recipe -----> Active Recipe -----> Deprecated
17
- (Agent submits) | (human creates) (human publishes) (human deprecates)
18
- |
19
- +-----> Rejected
20
- (human rejects)
21
- ```
22
-
23
- ### Stage Details
24
-
25
- | Stage | Who | How |
26
- |-------|-----|-----|
27
- | **Candidate** | Agent submits via MCP | `submit_candidate` / `submit_candidates` / `submit_draft_recipes` |
28
- | **Review** | Human via Dashboard | Dashboard Candidates page -> approve/reject |
29
- | **Draft Recipe** | Human via Dashboard | Approved candidate becomes draft Recipe |
30
- | **Active Recipe** | Human via Dashboard/API | `PATCH /api/v1/recipes/:id/publish` |
31
- | **Updated** | Human via Dashboard/API | `PATCH /api/v1/recipes/:id` |
32
- | **Deprecated** | Human via Dashboard/API | `PATCH /api/v1/recipes/:id/deprecate` |
33
- | **Deleted** | Human via Dashboard/API | `DELETE /api/v1/recipes/:id` |
34
-
35
- ---
36
-
37
- ## Agent Role: What You CAN Do
38
-
39
- ### 1. Submit Candidates
40
- - `autosnippet_submit_knowledge` - single structured candidate (built-in auto-validate + dedup)
41
- - `autosnippet_submit_knowledge_batch` - batch structured candidates
42
-
43
- ### 2. Validate and Enhance Candidates
44
- - Submit via `autosnippet_submit_knowledge` which auto-validates and checks duplicates
45
- - Add structured content: rationale, steps, codeChanges, knowledgeType, complexity, tags, constraints, headers
46
-
47
- ### 3. Search and Query Recipes
48
- - `autosnippet_knowledge(operation=list)` - list with filters (kind/language/category/knowledgeType/status/complexity)
49
- - `autosnippet_knowledge(operation=get, id)` - get full Recipe details
50
- - `autosnippet_search` - unified search (mode=auto/context/keyword/semantic)
51
- - `autosnippet_graph(operation=query/impact)` - knowledge graph
52
-
53
- ### 4. Record Usage Telemetry
54
- - `autosnippet_knowledge(operation=confirm_usage)` - record when user adopts/applies a Recipe
55
- - `usageType: "adoption"` - user adopted the Recipe
56
- - `usageType: "application"` - user applied the Recipe in code
57
-
58
- ---
59
-
60
- ## Agent Role: What You CANNOT Do
61
-
62
- | Forbidden Action | Why | Human Alternative |
63
- |-----------------|-----|-------------------|
64
- | Create Recipe directly | Agent produces candidates, not Recipes | Dashboard: approve candidate |
65
- | Modify Recipe content | Recipe content is human-controlled | Dashboard: edit Recipe |
66
- | Publish Recipe (draft -> active) | Publishing is a human review decision | Dashboard: publish button |
67
- | Deprecate Recipe | Deprecation is a human lifecycle decision | Dashboard: deprecate button |
68
- | Delete Recipe | Deletion is irreversible, human-only | Dashboard: delete button |
69
- | Update quality scores | Quality assessment is human-controlled | Dashboard: quality panel |
70
- | Write to `AutoSnippet/recipes/` directly | Bypass candidate review process | Submit as candidate first |
71
-
72
- ---
73
-
74
- ## Typical Agent Workflows
75
-
76
- ### Workflow 1: User asks to add a code pattern
77
- 1. Analyze the code pattern
78
- 2. Generate structured candidate with rationale, steps, etc.
79
- 3. `autosnippet_submit_knowledge` - submit to candidate pool (auto-validates + dedup check)
80
- 4. Tell user: "Candidate submitted. Review in Dashboard Candidates page."
81
-
82
- ### Workflow 2: User asks about an existing Recipe
83
- 1. `autosnippet_search` or `autosnippet_knowledge(operation=list)` to find it
84
- 2. `autosnippet_knowledge(operation=get, id)` to get full details
85
- 3. Present the Recipe content to user
86
- 4. If user adopts it: `autosnippet_knowledge(operation=confirm_usage)` with usageType=adoption
87
-
88
- ### Workflow 3: User asks to update a Recipe
89
- 1. Explain: "I cannot modify Recipes directly. I can submit an improved version as a new candidate."
90
- 2. `autosnippet_knowledge(operation=get, id)` to read current content
91
- 3. Generate improved candidate based on user's feedback
92
- 4. `autosnippet_submit_knowledge` - submit improved version
93
- 5. Tell user: "Improved version submitted as candidate. Update the Recipe in Dashboard."
94
-
95
- ---
96
-
97
- ## Related Skills
98
-
99
- - **autosnippet-recipes**: Project context, Recipe lookup, MCP tools reference
100
- - **autosnippet-candidates**: Candidate generation workflow (single file / batch scan)
@@ -1,66 +0,0 @@
1
- <!-- autosnippet:begin -->
2
- <!-- MANDATORY: On EVERY human message, call autosnippet_task({ operation: "prime" }) FIRST. -->
3
-
4
- # {{projectName}} — AutoSnippet 项目指引
5
-
6
- ## CRITICAL: You Operate autosnippet_task — The User Doesn't
7
-
8
- You are the task operator. Users speak naturally; you translate to task operations.
9
- DO NOT tell users to call autosnippet_task. That's YOUR job.
10
-
11
- - WRONG: "你可以调用 autosnippet_task({ operation: 'create' }) 来创建任务"
12
- - RIGHT: *(你自己调用 create,然后告诉用户 "已创建任务 asd-42: 修复登录 bug")*
13
-
14
- ## Task Tracking Rules (MANDATORY)
15
-
16
- 1. **MUST prime on EVERY message** — `autosnippet_task({ operation: "prime" })` BEFORE doing anything else. No exceptions.
17
- 2. **MUST create a task for non-trivial work** — If work involves ≥2 files OR ≥10 lines, create BEFORE starting.
18
- 3. **MUST claim before coding** — `autosnippet_task({ operation: "claim", id })` then code.
19
- 4. **MUST close when done** — `autosnippet_task({ operation: "close", id, reason })` with meaningful reason.
20
- 5. **MUST handle unfinished tasks first** — If prime returns in-progress tasks, ask user: Continue, Defer, or Abandon? Do NOT auto-resume.
21
- 6. **NEVER skip prime** — Even for follow-up messages.
22
- 7. **NEVER start new work with open in-progress tasks** — Handle existing first.
23
- 8. **NEVER leave tasks in in_progress when session ends** — Close or defer everything.
24
- 9. **NEVER tell the user to run task commands** — You are the operator.
25
-
26
- When in doubt → create a task. When idle → `autosnippet_task({ operation: "ready" })`.
27
-
28
- ### When NOT to Create Tasks
29
-
30
- Quick questions, single-file trivial fixes (<10 lines), code explanation, running existing tests.
31
- Rule: <2min AND ≤1 file AND <10 lines → no task. Everything else → create.
32
-
33
- ## User Says → You Run
34
-
35
- | User Says | Your Action |
36
- |---|---|
37
- | "帮我修 bug" / "fix this" | `create` → `claim` → code → `close` |
38
- | "做功能" / "implement" | `create` → `claim` → code → `close` |
39
- | "继续" / "continue" | resume in-progress task → code → `close` |
40
- | "先不做了" / "pause" | `defer(id, reason)` |
41
- | "不做了" / "abandon" | `fail(id, reason)` |
42
- | "太大了" / "break down" | `decompose(id, subtasks)` |
43
- | "有什么要做的" / "what's next" | `ready()` → present |
44
- | "就这么定了" / "agreed" | `record_decision(...)` |
45
- | Quick question | No task. Just answer. |
46
-
47
- ## Session Closing Protocol
48
-
49
- Before ending work, you MUST complete this checklist:
50
-
51
- - [ ] Close every claimed task: `autosnippet_task({ operation: "close", id, reason: "what was accomplished" })`
52
- - [ ] Defer any incomplete task: `autosnippet_task({ operation: "defer", id, reason: "why and what remains" })`
53
- - [ ] Verify: zero tasks in in_progress state
54
- - [ ] If prime showed ready tasks, mention them to the user for next session
55
-
56
- **Work is not done until all tasks are closed or deferred.**
57
-
58
- ## Knowledge Rules
59
-
60
- - **禁止直接修改** `AutoSnippet/recipes/`、`.autosnippet/` 等知识库目录
61
- - **优先使用 Recipe**;搜索用 `autosnippet_search`
62
- - MCP 调用失败时**不要重试**,回退到已有上下文
63
-
64
- <!-- autosnippet:end -->
65
- <!-- REMINDER: If you have not yet called autosnippet_task({ operation: "prime" }), do it NOW. -->
66
- <!-- REMINDER: If user agreed/disagreed with a plan → autosnippet_task({ operation: "record_decision" | "revise_decision" | "unpin_decision" }) immediately. -->
@@ -1,172 +0,0 @@
1
- ---
2
- description: AutoSnippet conventions — Skills for semantics, MCP for capabilities; do not edit Knowledge directly
3
- alwaysApply: true
4
- ---
5
-
6
- # AutoSnippet Conventions
7
-
8
- These rules are aligned with `.github/copilot-instructions.md` and jointly provide the AI with basic project cognition and required guardrails.
9
-
10
- These rules are written when installing AutoSnippet Skills (`asd install:cursor-skill`) and should be followed in Cursor sessions.
11
-
12
- ## 强制规则(必须遵守)
13
-
14
- 1. **每次收到用户消息,第一步调 `autosnippet_task({ operation: "prime" })`** — 加载最新决策和任务上下文,跳过会导致回答与团队约定矛盾。
15
- 2. **当用户明确同意/否决某方案时,立即调用 `autosnippet_task({ operation: "record_decision" })` 持久化**(record_decision/revise_decision/unpin_decision)— 先写入团队记忆,再继续后续动作。
16
- 3. **禁止直接修改** 知识库目录内容(`AutoSnippet/recipes/`、`.autosnippet/` 等)。
17
- 4. **优先使用 Recipe** 作为项目标准;源代码仅作补充。
18
- 5. MCP 检索优先:使用 `autosnippet_search`(auto 融合模式)。
19
- 6. MCP 调用失败时,**不要在同一轮重复重试**,回退到已读文档或静态上下文。
20
- 7. Skills 负责语义与流程,MCP 负责能力与调用;不要在 Skill 内硬编码 URL/HTTP。
21
-
22
- ## CRITICAL: You Operate autosnippet_task — The User Doesn't
23
-
24
- You are the task operator. Users speak naturally; you translate to task operations.
25
- DO NOT tell users to call autosnippet_task. That's YOUR job.
26
-
27
- - WRONG: "你可以调用 autosnippet_task({ operation: 'create' }) 来创建任务"
28
- - RIGHT: *(你自己调用 create,然后告诉用户 "已创建任务 asd-42: 修复登录 bug")*
29
-
30
- ## Task Tracking Rules (MANDATORY)
31
-
32
- 1. **MUST prime on EVERY message** — No exceptions. Even follow-up messages.
33
- 2. **MUST create task for non-trivial work** — ≥2 files OR ≥10 lines → create BEFORE starting.
34
- 3. **MUST claim before coding** — `claim(id)` then code.
35
- 4. **MUST close when done** — `close(id, reason)` with meaningful reason.
36
- 5. **MUST handle unfinished tasks first** — prime shows in-progress → ask user: Continue, Defer, Abandon? Do NOT auto-resume.
37
- 6. **NEVER skip prime** — Even for simple questions.
38
- 7. **NEVER start new work with open in-progress tasks** — Handle existing first.
39
- 8. **NEVER leave tasks in in_progress when session ends** — Close or defer everything.
40
- 9. **NEVER tell the user to run task commands** — You are the operator.
41
-
42
- When in doubt → create a task. When idle → `autosnippet_task({ operation: "ready" })`.
43
-
44
- **When NOT to create**: Quick questions, single-file trivial fixes (<10 lines), code explanation, running tests. Rule: <2min AND ≤1 file AND <10 lines → no task.
45
-
46
- ## User Says → You Run
47
-
48
- | User Says | Your Action |
49
- |---|---|
50
- | "帮我修 bug" / "fix this" | `create` → `claim` → code → `close` |
51
- | "做功能" / "implement" | `create` → `claim` → code → `close` |
52
- | "继续" / "continue" | resume in-progress → code → `close` |
53
- | "先不做了" / "pause" | `defer(id, reason)` |
54
- | "不做了" / "abandon" | `fail(id, reason)` |
55
- | "太大了" / "break down" | `decompose(id, subtasks)` |
56
- | "有什么要做的" / "next" | `ready()` → present list |
57
- | "就这么定了" / "agreed" | `record_decision(...)` |
58
- | Quick question | No task. Just answer. |
59
-
60
- ## Session Closing Protocol
61
-
62
- Before ending work, you MUST complete this checklist:
63
-
64
- - [ ] Close every claimed task: `close(id, reason)` with what was accomplished
65
- - [ ] Defer any incomplete task: `defer(id, reason)` with why and what remains
66
- - [ ] Verify: zero tasks in in_progress state
67
- - [ ] If prime showed ready tasks, mention them for next session
68
-
69
- **Work is not done until all tasks are closed or deferred.**
70
-
71
- ## Semantics vs capabilities
72
-
73
- - **Skills provide semantics**: When to use, workflows, and comparisons are described in Skills. Use natural language prompts in Cursor (e.g. "scan targets", "find recipe examples", "batch extract candidates") to trigger the appropriate Skill; AI intelligently interprets your request and activates the corresponding Skill logic.
74
- - **MCP provides capabilities**: Connection and tools are provided by MCP. Do not hardcode URLs/HTTP in Skills.
75
-
76
- ## Project basics (for AI)
77
-
78
- - **Project root**: directory containing `boxspec.json`.
79
- - **Knowledge base**: `AutoSnippet/` (read-only for AI).
80
- - **Recipes**: `AutoSnippet/recipes/*.md` (Markdown + Frontmatter + Snippet + Usage Guide).
81
- - **Frontmatter required fields (7)**: `title` (English, ≤50 chars, verb-based), `trigger` (MUST start with `@`), `category` (MUST be one of: `View`, `Service`, `Tool`, `Model`, `Network`, `Storage`, `UI`, `Utility`), `language`, `summary_cn` (≤100 chars), `summary_en` (≤100 words), `headers` (complete import statements, e.g. `["import Foundation"]`, `["#import <UIKit/UIKit.h>"]`, `["import \"fmt\""]`, `["import express from 'express'"]`).
82
- - **V3 required Cursor Delivery fields**: `kind` (rule/pattern/fact), `doClause` (English imperative ≤60 tokens), `dontClause` (what NOT to do), `whenClause` (when this applies), `coreCode` (3-8 line code skeleton), `usageGuide` (### section format guide), `knowledgeType` (code-pattern/architecture/best-practice/code-standard/code-relation/data-flow/module-dependency/boundary-constraint/code-style/solution/anti-pattern/event-and-data-flow), `reasoning` ({ whyStandard, sources, confidence }).
83
- - **Placeholders**: Use IDE-appropriate placeholders in snippets — Xcode format `<#URL#>` (auto-converted to VSCode `${N:...}` on install). Explain them in Usage Guide.
84
- - **Usage Guide depth**: Go beyond "When/Key Points"; include dependencies, steps/config, error handling, performance, security, pitfalls, and related Recipes when applicable. MUST use `###` headings and list format.
85
- - **Constitution**: `AutoSnippet/constitution.yaml` (权限宪法: roles + capabilities + governance rules).
86
- - **Runtime DB**: `.autosnippet/autosnippet.db` (SQLite index cache for recipes/candidates/snippets).
87
- - **Vector index**: `.autosnippet/context/` (`asd embed`).
88
- - **Recipe stats**: `.autosnippet/recipe-stats.json` (usage + authority).
89
-
90
- ## Knowledge categories (kind)
91
-
92
- Recipes are classified into three kinds:
93
- - **rule** — Guard rules (boundary-constraint), used for code quality checks
94
- - **pattern** — Reusable code patterns (code-pattern, architecture, best-practice, etc.)
95
- - **fact** — Structural knowledge (code-relation, inheritance, call-chain, data-flow, etc.)
96
-
97
- ## Knowledge base and submission
98
-
99
- - **Do not edit** `AutoSnippet/recipes/` or `.autosnippet/` directly; all Recipe/Snippet changes go through Dashboard or MCP tools and are saved after human review.
100
- - **Search**: Use MCP tools `autosnippet_search` (recommended, auto mode BM25 + semantic fusion) or `autosnippet_context_search` (context-aware with session history). Also available: `autosnippet_keyword_search` (exact match) and `autosnippet_semantic_search` (vector).
101
- - **Retry policy**: If an MCP call fails, do not retry within the same agent turn; fall back to static docs or already-read context.
102
- - **Decision persistence**: When the user explicitly agrees/disagrees with a plan, call `autosnippet_task({ operation: "record_decision" | "revise_decision" | "unpin_decision" })` **immediately** before continuing. Persist first, execute second.
103
- - **Adoption tracking**: Tool `autosnippet_confirm_usage` records that a Recipe was adopted or applied (affects usage stats and authority ranking). Show it when the user explicitly adopts a recipe, not immediately after presenting one.
104
- - **Batch scan**: Ask Cursor in natural language (e.g. "scan all targets in this project", "batch extract candidates") to trigger the batch-scan workflow. The workflow calls `autosnippet_get_targets` → `autosnippet_get_target_files` → extract per file → `autosnippet_submit_candidates` automatically.
105
- - **Cold start**: Use `autosnippet_bootstrap_knowledge` for full project knowledge initialization covering 9 dimensions. Phase 5.5 auto-generates 4 Project Skills (code-standard, architecture, project-profile, agent-guidelines) to `AutoSnippet/skills/`.
106
-
107
- ## Project Skills
108
-
109
- - **Skills 目录**: `AutoSnippet/skills/<name>/SKILL.md` — 跟随项目 Git 管理
110
- - **发现**: `autosnippet_list_skills` — 列出所有可用 Skills(内置 + 项目级)
111
- - **加载**: `autosnippet_load_skill(skillName)` — 获取 Skill 完整文档
112
- - **创建**: `autosnippet_create_skill(name, description, content)` — 创建项目级 Skill
113
- - **推荐**: `autosnippet_suggest_skills` — 基于使用模式推荐创建 Skill
114
- - **优先级**: 项目级 Skill 同名覆盖内置 Skill;Skill > Recipe(宏观知识优先查 Skill)
115
- - **Bootstrap 自动生成**: 冷启动会自动生成 `project-code-standard`、`project-architecture`、`project-profile`、`project-agent-guidelines` 四个 Project Skills
116
-
117
- ## MCP tools (36 total)
118
-
119
- ### Search (prefer search / context_search)
120
- - `autosnippet_search` — Unified search (auto: BM25 + semantic fusion)
121
- - `autosnippet_context_search` — Context-aware retrieval (intent recognition + 4-layer funnel + session continuity)
122
- - `autosnippet_keyword_search` — SQL LIKE exact keyword
123
- - `autosnippet_semantic_search` — Vector semantic search
124
-
125
- ### Knowledge lists & details
126
- - `autosnippet_list_recipes` / `autosnippet_get_recipe` / `autosnippet_recipe_insights`
127
- - `autosnippet_list_rules` / `autosnippet_list_patterns` / `autosnippet_list_facts`
128
-
129
- ### Knowledge graph
130
- - `autosnippet_graph_query` / `autosnippet_graph_impact` / `autosnippet_graph_path` / `autosnippet_graph_stats`
131
-
132
- ### Candidate submission & validation
133
- - `autosnippet_validate_candidate` — Pre-validate (5 layers)
134
- - `autosnippet_check_duplicate` — Similarity detection
135
- - `autosnippet_submit_candidate` — Single submission (reasoning required)
136
- - `autosnippet_submit_candidates` — Batch submission (dedup + rate limit)
137
- - `autosnippet_submit_draft_recipes` — Parse draft Markdown files
138
- - `autosnippet_enrich_candidates` — AI-fill missing semantic fields
139
-
140
- ### Project scanning & bootstrap
141
- - `autosnippet_get_targets` / `autosnippet_get_target_files` / `autosnippet_get_target_metadata`
142
- - `autosnippet_scan_project` — Lightweight probe (file list + Guard audit)
143
- - `autosnippet_bootstrap_knowledge` — Cold-start knowledge initialization (9 dimensions + auto Project Skills)
144
- - `autosnippet_bootstrap_refine` — AI refinement for bootstrap candidates (summary/insight/relations)
145
-
146
- ### Guard & governance
147
- - `autosnippet_guard_check` / `autosnippet_guard_audit_files` / `autosnippet_compliance_report`
148
-
149
- ### Skills
150
- - `autosnippet_list_skills` — List all available Skills (builtin + project)
151
- - `autosnippet_load_skill` — Load a Skill's full document
152
- - `autosnippet_create_skill` — Create a project-level Skill in `AutoSnippet/skills/`
153
- - `autosnippet_suggest_skills` — Recommend Skills based on usage patterns
154
-
155
- ### Other
156
- - `autosnippet_health` / `autosnippet_capabilities` / `autosnippet_confirm_usage`
157
-
158
- ## Recipe over code
159
-
160
- When both a Recipe and the codebase have relevant implementations, prefer the Recipe. Recipes are the project's agreed standard; source code may be legacy or non-standard.
161
-
162
- ## Guard 诊断响应
163
-
164
- 当编辑器出现 "AutoSnippet Guard" 诊断时:
165
- 1. 读取 ruleId → `autosnippet_search(query: ruleId)`
166
- 2. 按 Recipe 的 doClause + coreCode 修改代码
167
- 3. 保存并确认诊断消失
168
-
169
- ## 上下文压力应对
170
-
171
- - `_contextHint` 包含 `CONTEXT_PRESSURE:WARNING` → 总结已完成工作,继续。
172
- - `_contextHint` 包含 `CONTEXT_PRESSURE:CRITICAL` → 立即 prime 恢复上下文。
@@ -1,76 +0,0 @@
1
- ---
2
- description: AutoSnippet Task Tracking — 任务管理 + 行为规则
3
- alwaysApply: true
4
- ---
5
-
6
- # AutoSnippet Task Workflow
7
-
8
- ## CRITICAL: You Operate autosnippet_task — The User Doesn't
9
-
10
- You are the task operator. Users speak naturally; you translate to task operations.
11
- DO NOT tell users to call autosnippet_task. That's YOUR job.
12
-
13
- ## Task Tracking Rules (MANDATORY)
14
-
15
- 1. **MUST prime on EVERY message** — `autosnippet_task({ operation: "prime" })` BEFORE anything else. No exceptions.
16
- 2. **MUST create task for non-trivial work** — ≥2 files OR ≥10 lines → create BEFORE starting.
17
- 3. **MUST claim before coding** — `claim(id)` then code.
18
- 4. **MUST close when done** — `close(id, reason)` with meaningful reason.
19
- 5. **MUST handle unfinished tasks first** — prime shows in-progress → ask user: Continue, Defer, Abandon?
20
- 6. **NEVER skip prime** — Even for follow-up messages.
21
- 7. **NEVER start new work with open in-progress tasks** — Handle existing first.
22
- 8. **NEVER leave tasks in in_progress when session ends** — Close or defer everything.
23
- 9. **NEVER tell the user to run task commands** — You are the operator.
24
-
25
- When in doubt → create a task. When idle → `autosnippet_task({ operation: "ready" })`.
26
- **When NOT to create**: <2min AND ≤1 file AND <10 lines → no task.
27
-
28
- ## User Says → You Run
29
-
30
- | User Says | Your Action |
31
- |---|---|
32
- | "帮我修 bug" / "fix this" | `create` → `claim` → code → `close` |
33
- | "做功能" / "implement" | `create` → `claim` → code → `close` |
34
- | "继续" / "continue" | resume in-progress → code → `close` |
35
- | "先不做了" / "pause" | `defer(id, reason)` |
36
- | "不做了" / "abandon" | `fail(id, reason)` |
37
- | "太大了" / "break down" | `decompose(id, subtasks)` |
38
- | "有什么要做的" / "next" | `ready()` → present list |
39
- | "就这么定了" / "agreed" | `record_decision(...)` |
40
- | Quick question | No task. Just answer. |
41
-
42
- ## Decision Persistence
43
-
44
- **用户同意/否决方案时** → `autosnippet_task({ operation: "record_decision" | "revise_decision" | "unpin_decision" })` 先持久化决策再继续
45
-
46
- ## Session Closing Protocol
47
-
48
- Before ending work, you MUST complete this checklist:
49
-
50
- - [ ] Close every claimed task: `close(id, reason)` with what was accomplished
51
- - [ ] Defer any incomplete task: `defer(id, reason)` with why and what remains
52
- - [ ] Verify: zero tasks in in_progress state
53
- - [ ] If prime showed ready tasks, mention them for next session
54
-
55
- **Work is not done until all tasks are closed or deferred.**
56
-
57
- ## 上下文压力
58
-
59
- - `_contextHint` 包含 `CONTEXT_PRESSURE:WARNING` → 总结已完成工作,继续
60
- - `_contextHint` 包含 `CONTEXT_PRESSURE:CRITICAL` → 立即 prime 恢复上下文
61
-
62
- ## 任务操作速查
63
-
64
- | 操作 | 用途 |
65
- |------|------|
66
- | `autosnippet_task({ operation: "prime" })` | **每次收到消息第一步调用** — 加载决策 + 就绪任务 + 规则提醒 |
67
- | `autosnippet_task({ operation: "record_decision" / "revise_decision" / "unpin_decision" })` | **用户同意/否决方案时立即调用** — 先持久化再继续 |
68
- | `create(title)` | 创建新任务 |
69
- | `claim(id)` | 开始处理任务 |
70
- | `close(id, reason)` | 完成任务 → 返回 newlyReady |
71
- | `fail(id, reason)` | 标记失败 |
72
- | `defer(id, reason)` | 延后处理 |
73
- | `progress(id, desc)` | 更新进度 |
74
- | `ready` | 获取就绪任务 |
75
- | `decompose(id, subtasks)` | 拆分大任务 |
76
- | `stats` | 项目统计 |