autosnippet 2.19.8 → 3.0.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.
- package/README.md +26 -18
- package/dashboard/dist/assets/{index-BwISScUw.js → index-_Sk_Dmg3.js} +41 -41
- package/dashboard/dist/index.html +1 -1
- package/lib/external/mcp/McpServer.js +54 -65
- package/lib/external/mcp/handlers/bootstrap.js +7 -7
- package/lib/external/mcp/handlers/consolidated.js +290 -0
- package/lib/external/mcp/handlers/guard.js +5 -5
- package/lib/external/mcp/handlers/knowledge.js +23 -8
- package/lib/external/mcp/handlers/skill.js +4 -4
- package/lib/external/mcp/handlers/structure.js +16 -16
- package/lib/external/mcp/handlers/system.js +37 -40
- package/lib/external/mcp/tools.js +250 -646
- package/lib/service/cursor/RulesGenerator.js +2 -2
- package/lib/service/skills/SkillAdvisor.js +1 -1
- package/package.json +1 -1
- package/scripts/install-cursor-skill.js +10 -10
- package/skills/autosnippet-analysis/SKILL.md +23 -18
- package/skills/autosnippet-candidates/SKILL.md +38 -39
- package/skills/autosnippet-coldstart/SKILL.md +11 -14
- package/skills/autosnippet-concepts/SKILL.md +26 -31
- package/skills/autosnippet-create/SKILL.md +4 -6
- package/skills/autosnippet-guard/SKILL.md +14 -17
- package/skills/autosnippet-intent/SKILL.md +10 -11
- package/skills/autosnippet-lifecycle/SKILL.md +13 -18
- package/skills/autosnippet-recipes/SKILL.md +29 -62
- package/skills/autosnippet-structure/SKILL.md +19 -19
- package/templates/copilot-instructions.md +42 -41
- package/templates/recipes-setup/README.md +4 -7
|
@@ -34,19 +34,18 @@ Use this skill when the user's intent is unclear or overlaps multiple capabiliti
|
|
|
34
34
|
- `autosnippet-batch-scan` / `autosnippet-recipe-candidates` → merged into autosnippet-candidates
|
|
35
35
|
- `autosnippet-dep-graph` → merged into autosnippet-structure
|
|
36
36
|
|
|
37
|
-
## MCP tools (reference only)
|
|
37
|
+
## MCP tools (reference only — 12 个整合工具)
|
|
38
38
|
|
|
39
39
|
- System: `autosnippet_health`, `autosnippet_capabilities`
|
|
40
|
-
- Search: `autosnippet_search
|
|
41
|
-
-
|
|
42
|
-
-
|
|
43
|
-
-
|
|
44
|
-
-
|
|
45
|
-
-
|
|
46
|
-
- Guard: `
|
|
47
|
-
-
|
|
48
|
-
-
|
|
49
|
-
- Skills: `autosnippet_list_skills`, `autosnippet_load_skill`, `autosnippet_create_skill`, `autosnippet_update_skill`, `autosnippet_delete_skill`, `autosnippet_suggest_skills`
|
|
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` (operation: knowledge / refine / scan)
|
|
48
|
+
- Skills: `autosnippet_skill` (operation: list / load / create / update / delete / suggest)
|
|
50
49
|
|
|
51
50
|
This skill is a router only; it does not perform actions itself.
|
|
52
51
|
|
|
@@ -37,24 +37,21 @@ 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_knowledge` - single structured candidate
|
|
40
|
+
- `autosnippet_submit_knowledge` - single structured candidate (built-in auto-validate + dedup)
|
|
41
41
|
- `autosnippet_submit_knowledge_batch` - batch structured candidates
|
|
42
|
-
- `autosnippet_submit_knowledge_batch` - submit .md files as candidates
|
|
43
42
|
|
|
44
43
|
### 2. Validate and Enhance Candidates
|
|
45
|
-
- `
|
|
46
|
-
- `autosnippet_check_duplicate` - check for duplicates
|
|
44
|
+
- Submit via `autosnippet_submit_knowledge` which auto-validates and checks duplicates
|
|
47
45
|
- Add structured content: rationale, steps, codeChanges, knowledgeType, complexity, tags, constraints, headers
|
|
48
46
|
|
|
49
47
|
### 3. Search and Query Recipes
|
|
50
|
-
- `
|
|
51
|
-
- `
|
|
52
|
-
- `
|
|
53
|
-
- `
|
|
54
|
-
- `autosnippet_graph_query` / `autosnippet_graph_impact` - knowledge graph
|
|
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
|
|
55
52
|
|
|
56
53
|
### 4. Record Usage Telemetry
|
|
57
|
-
- `
|
|
54
|
+
- `autosnippet_knowledge(operation=confirm_usage)` - record when user adopts/applies a Recipe
|
|
58
55
|
- `usageType: "adoption"` - user adopted the Recipe
|
|
59
56
|
- `usageType: "application"` - user applied the Recipe in code
|
|
60
57
|
|
|
@@ -79,20 +76,18 @@ This skill documents the Recipe lifecycle and clarifies what Agent can and canno
|
|
|
79
76
|
### Workflow 1: User asks to add a code pattern
|
|
80
77
|
1. Analyze the code pattern
|
|
81
78
|
2. Generate structured candidate with rationale, steps, etc.
|
|
82
|
-
3. `
|
|
83
|
-
4.
|
|
84
|
-
5. `autosnippet_submit_knowledge` - submit to candidate pool
|
|
85
|
-
6. Tell user: "Candidate submitted. Review in Dashboard Candidates page."
|
|
79
|
+
3. `autosnippet_submit_knowledge` - submit to candidate pool (auto-validates + dedup check)
|
|
80
|
+
4. Tell user: "Candidate submitted. Review in Dashboard Candidates page."
|
|
86
81
|
|
|
87
82
|
### Workflow 2: User asks about an existing Recipe
|
|
88
|
-
1. `
|
|
89
|
-
2. `
|
|
83
|
+
1. `autosnippet_search` or `autosnippet_knowledge(operation=list)` to find it
|
|
84
|
+
2. `autosnippet_knowledge(operation=get, id)` to get full details
|
|
90
85
|
3. Present the Recipe content to user
|
|
91
|
-
4. If user adopts it: `
|
|
86
|
+
4. If user adopts it: `autosnippet_knowledge(operation=confirm_usage)` with usageType=adoption
|
|
92
87
|
|
|
93
88
|
### Workflow 3: User asks to update a Recipe
|
|
94
89
|
1. Explain: "I cannot modify Recipes directly. I can submit an improved version as a new candidate."
|
|
95
|
-
2. `
|
|
90
|
+
2. `autosnippet_knowledge(operation=get, id)` to read current content
|
|
96
91
|
3. Generate improved candidate based on user's feedback
|
|
97
92
|
4. `autosnippet_submit_knowledge` - submit improved version
|
|
98
93
|
5. Tell user: "Improved version submitted as candidate. Update the Recipe in Dashboard."
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: autosnippet-recipes
|
|
3
|
-
description: Provides this project's Recipe-based context to the agent. Recipes are the project's standard knowledge (code patterns + usage guides + structured relations). Use when answering about project standards, Guard, conventions, or when suggesting code. Supports in-context lookup, terminal search (asd search), and on-demand semantic search via MCP tool
|
|
3
|
+
description: Provides this project's Recipe-based context to the agent. Recipes are the project's standard knowledge (code patterns + usage guides + structured relations). Use when answering about project standards, Guard, conventions, or when suggesting code. Supports in-context lookup, terminal search (asd search), and on-demand semantic search via MCP tool autosnippet_search (mode=context).
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# AutoSnippet Recipe Context (Project Context)
|
|
7
7
|
|
|
8
|
-
> Self-check and Fallback: MCP tools return unified JSON Envelope. Before heavy ops call autosnippet_health
|
|
8
|
+
> Self-check and Fallback: MCP tools return unified JSON Envelope. Before heavy ops call `autosnippet_health`. On failure do not retry in same turn; use static context or narrow scope.
|
|
9
9
|
|
|
10
10
|
This skill provides the agent with this project's context from AutoSnippet Recipes. Recipes are the project's standard knowledge base: code patterns, usage guides, and structured relations.
|
|
11
11
|
|
|
@@ -44,7 +44,7 @@ Recipe is the core knowledge unit. V3 uses a unified structured model:
|
|
|
44
44
|
|
|
45
45
|
## Instructions for the agent
|
|
46
46
|
|
|
47
|
-
1. **Project context**: Read `references/project-recipes-context.md` in this skill folder for **Recipe 轻量索引**(title/trigger/category/summary 表格)。如需 Recipe 全文,调用 MCP `
|
|
47
|
+
1. **Project context**: Read `references/project-recipes-context.md` in this skill folder for **Recipe 轻量索引**(title/trigger/category/summary 表格)。如需 Recipe 全文,调用 MCP `autosnippet_knowledge(operation=get, id)` 或 `autosnippet_search(query)`。索引缺失时,可直接读 `AutoSnippet/recipes/` 目录。
|
|
48
48
|
|
|
49
49
|
2. **Finding code on demand**: Look up matching Recipe by title/summary/usage guide, use its code as standard to suggest. Cite the Recipe title.
|
|
50
50
|
|
|
@@ -53,14 +53,14 @@ Recipe is the core knowledge unit. V3 uses a unified structured model:
|
|
|
53
53
|
4. **Search - three ways**:
|
|
54
54
|
- In-context: `references/project-recipes-context.md` 轻量索引按 title/trigger/summary 匹配
|
|
55
55
|
- Terminal: `asd search <keyword>` or `asd search --semantic <keyword>`
|
|
56
|
-
- MCP: `
|
|
56
|
+
- MCP: `autosnippet_search` (mode=auto 或 mode=context) with query and optional limit
|
|
57
57
|
|
|
58
58
|
5. **Browsing Recipes via MCP**:
|
|
59
|
-
- `
|
|
60
|
-
- `
|
|
61
|
-
- `
|
|
59
|
+
- `autosnippet_knowledge(operation=list)` - list with kind/language/category/knowledgeType/status/complexity filters
|
|
60
|
+
- `autosnippet_knowledge(operation=get, id)` - get single Recipe by ID (full content/relations/constraints)
|
|
61
|
+
- `autosnippet_knowledge(operation=list, kind=fact)` - list kind=fact structural knowledge
|
|
62
62
|
|
|
63
|
-
6. **Confirming usage**: Call `
|
|
63
|
+
6. **Confirming usage**: Call `autosnippet_knowledge(operation=confirm_usage, id, usageType)` when user adopts a Recipe. Telemetry only.
|
|
64
64
|
|
|
65
65
|
7. **Updating context**: After user changes Recipes, tell them to run `asd install:cursor-skill` to regenerate references.
|
|
66
66
|
|
|
@@ -78,71 +78,38 @@ Recipe is the core knowledge unit. V3 uses a unified structured model:
|
|
|
78
78
|
|
|
79
79
|
---
|
|
80
80
|
|
|
81
|
-
## MCP Tools Reference (
|
|
81
|
+
## MCP Tools Reference (12 个整合工具)
|
|
82
82
|
|
|
83
83
|
### Query (Agent can freely use)
|
|
84
84
|
|
|
85
85
|
| Tool | Description |
|
|
86
86
|
|------|-------------|
|
|
87
|
-
| autosnippet_health | Health check |
|
|
88
|
-
|
|
|
89
|
-
|
|
|
90
|
-
|
|
|
91
|
-
|
|
|
92
|
-
| autosnippet_semantic_search | Vector semantic search |
|
|
93
|
-
| autosnippet_list_rules | List kind=rule |
|
|
94
|
-
| autosnippet_list_patterns | List kind=pattern |
|
|
95
|
-
| autosnippet_list_facts | List kind=fact |
|
|
96
|
-
| autosnippet_list_recipes | General list (multi-filter) |
|
|
97
|
-
| autosnippet_get_recipe | Get Recipe details |
|
|
98
|
-
| autosnippet_recipe_insights | Recipe quality insights (scores, usage stats, relations summary) |
|
|
99
|
-
| autosnippet_compliance_report | Compliance assessment report |
|
|
100
|
-
| autosnippet_graph_query | Knowledge graph query |
|
|
101
|
-
| autosnippet_graph_impact | Graph impact analysis |
|
|
102
|
-
| autosnippet_graph_path | Graph path finding (BFS shortest path between Recipes) |
|
|
103
|
-
| autosnippet_graph_stats | Graph global statistics (edge count, relation distribution) |
|
|
104
|
-
| autosnippet_get_targets | List project Targets |
|
|
105
|
-
| autosnippet_get_target_files | Get Target file list |
|
|
106
|
-
| autosnippet_get_target_metadata | Get Target metadata |
|
|
107
|
-
|
|
108
|
-
### Candidate Submit/Validate (Agent core capability)
|
|
87
|
+
| `autosnippet_health` | Health check + KB stats |
|
|
88
|
+
| `autosnippet_search` | Unified search (`mode`: auto/context/keyword/semantic) |
|
|
89
|
+
| `autosnippet_knowledge` | Knowledge browse (`operation`: list/get/insights/confirm_usage) |
|
|
90
|
+
| `autosnippet_graph` | Knowledge graph (`operation`: query/impact/path/stats) |
|
|
91
|
+
| `autosnippet_structure` | Project structure (`operation`: targets/files/metadata) |
|
|
109
92
|
|
|
110
|
-
|
|
111
|
-
|------|-------------|
|
|
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
|
-
| autosnippet_save_document | Save development document (design doc, debug report, ADR) — title + markdown only |
|
|
116
|
-
| autosnippet_validate_candidate | Validate candidate quality |
|
|
117
|
-
| autosnippet_check_duplicate | Dedup check |
|
|
118
|
-
| autosnippet_enrich_candidates | AI semantic field enrichment for candidates |
|
|
119
|
-
|
|
120
|
-
### Guard & Scan
|
|
93
|
+
### Candidate Submit (Agent core capability)
|
|
121
94
|
|
|
122
95
|
| Tool | Description |
|
|
123
96
|
|------|-------------|
|
|
124
|
-
|
|
|
125
|
-
|
|
|
126
|
-
|
|
|
127
|
-
| autosnippet_bootstrap_knowledge | Cold-start knowledge base initialization (9 dimensions) |
|
|
128
|
-
| autosnippet_bootstrap_refine | AI refinement of bootstrap candidates (Phase 6) |
|
|
97
|
+
| `autosnippet_submit_knowledge` | Submit single candidate (**strict validation** — missing required fields rejected immediately, no fallback). Must provide ALL fields in one call: title, language, content(+rationale), kind, doClause, category, trigger, description, headers, usageGuide, knowledgeType |
|
|
98
|
+
| `autosnippet_submit_knowledge_batch` | Batch submit candidates (per-item strict validation + dedup + rate-limit) |
|
|
99
|
+
| `autosnippet_save_document` | Save development document (design doc, debug report, ADR) — title + markdown only |
|
|
129
100
|
|
|
130
|
-
###
|
|
101
|
+
### Guard & Scan & Bootstrap
|
|
131
102
|
|
|
132
103
|
| Tool | Description |
|
|
133
104
|
|------|-------------|
|
|
134
|
-
|
|
|
135
|
-
|
|
|
136
|
-
| autosnippet_create_skill | Create project-level Skill |
|
|
137
|
-
| autosnippet_update_skill | Update project-level Skill |
|
|
138
|
-
| autosnippet_delete_skill | Delete project-level Skill |
|
|
139
|
-
| autosnippet_suggest_skills | AI-powered Skill creation suggestions |
|
|
105
|
+
| `autosnippet_guard` | Code Guard check (`code` single / `files[]` batch — auto-routed) |
|
|
106
|
+
| `autosnippet_bootstrap` | Cold-start + scan (`operation`: knowledge/refine/scan) |
|
|
140
107
|
|
|
141
|
-
###
|
|
108
|
+
### Skills Management
|
|
142
109
|
|
|
143
110
|
| Tool | Description |
|
|
144
111
|
|------|-------------|
|
|
145
|
-
|
|
|
112
|
+
| `autosnippet_skill` | Skill management (`operation`: list/load/create/update/delete/suggest) |
|
|
146
113
|
|
|
147
114
|
---
|
|
148
115
|
|
|
@@ -150,20 +117,20 @@ Recipe is the core knowledge unit. V3 uses a unified structured model:
|
|
|
150
117
|
|
|
151
118
|
| Use | How |
|
|
152
119
|
|-----|-----|
|
|
153
|
-
| Audit | `// as:audit` in source; `asd watch` runs AI review against Recipes. Or MCP `
|
|
154
|
-
| Search | `asd search keyword` or MCP `autosnippet_search` /
|
|
120
|
+
| Audit | `// as:audit` in source; `asd watch` runs AI review against Recipes. Or MCP `autosnippet_guard` |
|
|
121
|
+
| Search | `asd search keyword` or MCP `autosnippet_search` (mode=auto/context/keyword/semantic) |
|
|
155
122
|
| AI Assistant | Dashboard RAG and AI chat use Recipes as context |
|
|
156
123
|
| Xcode | Recipes linked to Snippets; synced to Xcode CodeSnippets |
|
|
157
124
|
| Guard | kind=rule Recipes enforced by Guard checks during audit |
|
|
158
|
-
| Insights | `
|
|
159
|
-
| Graph | `
|
|
125
|
+
| Insights | `autosnippet_knowledge(operation=insights, id)` for quality scores, usage stats, and relation summary |
|
|
126
|
+
| Graph | `autosnippet_graph(operation=query/impact/path)` for relationship analysis |
|
|
160
127
|
|
|
161
128
|
---
|
|
162
129
|
|
|
163
130
|
## Auto-Extracting Headers for New Candidates
|
|
164
131
|
|
|
165
132
|
1. From code (Recommended): Extract all import statements from user's code
|
|
166
|
-
2. From existing Recipes: Check `references/project-recipes-context.md` index for matching modules, then call MCP `
|
|
167
|
-
3. Via semantic search: Call `
|
|
133
|
+
2. From existing Recipes: Check `references/project-recipes-context.md` index for matching modules, then call MCP `autosnippet_knowledge(operation=get, id)` for full content
|
|
134
|
+
3. Via semantic search: Call `autosnippet_search(mode=context)` with query like "import ModuleName headers"
|
|
168
135
|
|
|
169
136
|
Use Option 1 first, then verify with Option 2 for consistency.
|
|
@@ -5,7 +5,7 @@ description: Discover project structure (targets, files, dependency graph) and b
|
|
|
5
5
|
|
|
6
6
|
# AutoSnippet — Structure & Dependencies & Knowledge Graph
|
|
7
7
|
|
|
8
|
-
> Self-check & Fallback: MCP 工具返回统一 JSON Envelope({ success, errorCode?, message?, data?, meta })。重操作前调用 autosnippet_health
|
|
8
|
+
> Self-check & Fallback: MCP 工具返回统一 JSON Envelope({ success, errorCode?, message?, data?, meta })。重操作前调用 `autosnippet_health`;失败时不在同一轮重试,转用静态上下文或缩小范围后再试。
|
|
9
9
|
|
|
10
10
|
Use this skill when the user asks about **project structure**, **SPM targets**, **dependency graph**, or **knowledge graph relationships**.
|
|
11
11
|
|
|
@@ -25,14 +25,14 @@ Use this skill when the user asks about **project structure**, **SPM targets**,
|
|
|
25
25
|
|
|
26
26
|
| Tool | Purpose | Key Input |
|
|
27
27
|
|------|---------|-----------|
|
|
28
|
-
| `
|
|
29
|
-
| `
|
|
30
|
-
| `
|
|
28
|
+
| `autosnippet_structure(operation=targets)` | List all SPM Targets (with file count, language stats, inferred role) | `includeSummary` (default true) |
|
|
29
|
+
| `autosnippet_structure(operation=files)` | Get source files for a Target | `targetName` (required), `includeContent`, `contentMaxLines`, `maxFiles` |
|
|
30
|
+
| `autosnippet_structure(operation=metadata)` | Get Target metadata (dependencies, package info, inferred role, graph edges) | `targetName` (required) |
|
|
31
31
|
|
|
32
32
|
### Workflow: Discover project structure
|
|
33
|
-
1. `
|
|
34
|
-
2. `
|
|
35
|
-
3. `
|
|
33
|
+
1. `autosnippet_structure(operation=targets)` → see all Targets with roles
|
|
34
|
+
2. `autosnippet_structure(operation=files, targetName)` → drill into specific Target
|
|
35
|
+
3. `autosnippet_structure(operation=metadata, targetName)` → get dependencies and relations
|
|
36
36
|
|
|
37
37
|
---
|
|
38
38
|
|
|
@@ -42,22 +42,22 @@ The knowledge graph captures **relationships between Recipes** (dependencies, ex
|
|
|
42
42
|
|
|
43
43
|
| Tool | Purpose | Key Input |
|
|
44
44
|
|------|---------|-----------|
|
|
45
|
-
| `
|
|
46
|
-
| `
|
|
47
|
-
| `
|
|
48
|
-
| `
|
|
45
|
+
| `autosnippet_graph(operation=query)` | Get all relations for a Recipe node | `nodeId` (Recipe ID), `relation` (filter), `direction` (out/in/both) |
|
|
46
|
+
| `autosnippet_graph(operation=impact)` | Impact analysis: what downstream depends on this Recipe | `nodeId`, `maxDepth` (default 3) |
|
|
47
|
+
| `autosnippet_graph(operation=path)` | Find shortest path between two Recipes (BFS) | `fromId`, `toId`, `maxDepth` (1-10) |
|
|
48
|
+
| `autosnippet_graph(operation=stats)` | Global graph statistics: edge count, relation type distribution | (none) |
|
|
49
49
|
|
|
50
50
|
### Workflow: Explore knowledge graph
|
|
51
|
-
1. `
|
|
52
|
-
2. `
|
|
53
|
-
3. `
|
|
54
|
-
4. `
|
|
51
|
+
1. `autosnippet_graph(operation=stats)` → overview: how many edges, relation types
|
|
52
|
+
2. `autosnippet_graph(operation=query, nodeId)` → see all connections for a specific Recipe
|
|
53
|
+
3. `autosnippet_graph(operation=impact, nodeId)` → before changing a Recipe, check downstream impact
|
|
54
|
+
4. `autosnippet_graph(operation=path, fromId, toId)` → discover indirect relationships between Recipes
|
|
55
55
|
|
|
56
56
|
### When to use graph tools
|
|
57
|
-
- User asks "修改这个 Recipe 会影响什么?" → `
|
|
58
|
-
- User asks "这两个模块有什么关联?" → `
|
|
59
|
-
- User wants overview of knowledge connections → `
|
|
60
|
-
- User wants to see all dependencies/extends/conflicts for a Recipe → `
|
|
57
|
+
- User asks "修改这个 Recipe 会影响什么?" → `autosnippet_graph(operation=impact)`
|
|
58
|
+
- User asks "这两个模块有什么关联?" → `autosnippet_graph(operation=path)`
|
|
59
|
+
- User wants overview of knowledge connections → `autosnippet_graph(operation=stats)`
|
|
60
|
+
- User wants to see all dependencies/extends/conflicts for a Recipe → `autosnippet_graph(operation=query)`
|
|
61
61
|
|
|
62
62
|
---
|
|
63
63
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
## 项目概览
|
|
4
4
|
- 项目名称:AutoSnippet
|
|
5
|
-
- 版本:
|
|
5
|
+
- 版本:V3(ESM, SQLite, MCP 11 工具 — 整合版)
|
|
6
6
|
- 目标:通过 Recipe 知识库、Guard 规则检查、语义检索构建团队知识管理与代码复用工作流。
|
|
7
7
|
- 项目根:包含 `boxspec.json` 的目录。
|
|
8
8
|
|
|
@@ -25,50 +25,51 @@
|
|
|
25
25
|
1. **禁止直接修改** 知识库目录内容(`AutoSnippet/recipes/`、`.autosnippet/` 等)。
|
|
26
26
|
2. 创建或入库必须走 **Dashboard** 或 MCP 工具流程(`autosnippet_submit_knowledge`、`autosnippet_submit_knowledge_batch`)。
|
|
27
27
|
3. **优先使用 Recipe** 作为项目标准;源代码仅作补充。
|
|
28
|
-
4. MCP 检索优先:使用 `autosnippet_search
|
|
28
|
+
4. MCP 检索优先:使用 `autosnippet_search`(默认 auto 融合模式,也可指定 mode=context 做上下文感知检索)。
|
|
29
29
|
5. MCP 调用失败时,**不要在同一轮重复重试**,回退到已读文档或静态上下文。
|
|
30
30
|
6. Skills 负责语义与流程,MCP 负责能力与调用;不要在 Skill 内硬编码 URL/HTTP。
|
|
31
31
|
|
|
32
|
-
## MCP
|
|
32
|
+
## MCP 工具速查(12 个整合工具)
|
|
33
33
|
|
|
34
|
-
###
|
|
35
|
-
- `autosnippet_search` —
|
|
36
|
-
- `
|
|
37
|
-
- `
|
|
38
|
-
- `
|
|
34
|
+
### 检索
|
|
35
|
+
- `autosnippet_search` — 统合搜索入口(通过 `mode` 参数切换)
|
|
36
|
+
- `mode=auto`(默认)— BM25 + 语义融合去重
|
|
37
|
+
- `mode=context` — 智能上下文检索(4 层漏斗 + 会话连续性),支持 `sessionHistory`/`language`
|
|
38
|
+
- `mode=keyword` — SQL LIKE 精确关键词
|
|
39
|
+
- `mode=semantic` — 向量语义搜索
|
|
39
40
|
|
|
40
|
-
###
|
|
41
|
-
- `
|
|
42
|
-
- `
|
|
41
|
+
### 知识浏览
|
|
42
|
+
- `autosnippet_knowledge` — 统一知识访问入口(通过 `operation` 参数切换)
|
|
43
|
+
- `operation=list` — 列出 Recipe/Rule/Pattern/Fact(支持 `kind`/`language`/`category`/`status` 多条件过滤)
|
|
44
|
+
- `operation=get` — 按 ID 获取单个 Recipe 详情
|
|
45
|
+
- `operation=insights` — 获取 Recipe 质量洞察(分数/统计/关系)
|
|
46
|
+
- `operation=confirm_usage` — 确认 Recipe 被采纳/应用
|
|
47
|
+
|
|
48
|
+
### 项目结构
|
|
49
|
+
- `autosnippet_structure` — SPM Target 结构发现(`operation`: targets / files / metadata)
|
|
43
50
|
|
|
44
51
|
### 知识图谱
|
|
45
|
-
- `
|
|
52
|
+
- `autosnippet_graph` — 图谱查询(`operation`: query / impact / path / stats)
|
|
46
53
|
|
|
47
|
-
### 候选提交
|
|
48
|
-
- `
|
|
49
|
-
- `
|
|
50
|
-
- `autosnippet_submit_knowledge` — 单条提交(reasoning 必填)
|
|
51
|
-
- `autosnippet_submit_knowledge_batch` — 批量提交(含去重 + 限流)
|
|
52
|
-
- `autosnippet_submit_knowledge_batch` — 解析草稿 Markdown 文件
|
|
53
|
-
- `autosnippet_enrich_candidates` — AI 补全缺失语义字段
|
|
54
|
+
### 候选提交
|
|
55
|
+
- `autosnippet_submit_knowledge` — 单条提交(严格前置校验,缺少必要字段直接拒绝不入库。必填: title, language, content(+rationale), kind, doClause, category, trigger, description, headers, usageGuide, knowledgeType。所有字段必须在单次调用中一次性提供)
|
|
56
|
+
- `autosnippet_submit_knowledge_batch` — 批量提交(含去重 + 限流 + 逐条严格校验,缺字段的条目被拒绝)
|
|
54
57
|
|
|
55
|
-
###
|
|
56
|
-
- `
|
|
57
|
-
- `autosnippet_scan_project` — 轻量探查(文件清单 + Guard 审计)
|
|
58
|
-
- `autosnippet_bootstrap_knowledge` — 冷启动知识库初始化(9 维度 + 自动生成 Project Skills)
|
|
59
|
-
- `autosnippet_bootstrap_refine` — Bootstrap 候选 AI 润色(summary/insight/relations)
|
|
58
|
+
### 开发文档
|
|
59
|
+
- `autosnippet_save_document` — 保存开发文档(title + markdown,自动发布)
|
|
60
60
|
|
|
61
|
-
### Guard
|
|
62
|
-
- `
|
|
61
|
+
### Guard
|
|
62
|
+
- `autosnippet_guard` — 代码规范检查(传 `code` 单文件 / 传 `files[]` 批量审计,自动路由)
|
|
63
63
|
|
|
64
64
|
### Skills
|
|
65
|
-
- `
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
- `
|
|
65
|
+
- `autosnippet_skill` — Skill 管理(`operation`: list / load / create / update / delete / suggest)
|
|
66
|
+
|
|
67
|
+
### 冷启动 & 扫描
|
|
68
|
+
- `autosnippet_bootstrap` — 项目冷启动与扫描(`operation`: knowledge / refine / scan)
|
|
69
69
|
|
|
70
|
-
###
|
|
71
|
-
- `autosnippet_health`
|
|
70
|
+
### 系统
|
|
71
|
+
- `autosnippet_health` — 服务健康状态与知识库统计(可检测空 KB 触发冷启动)
|
|
72
|
+
- `autosnippet_capabilities` — 服务能力清单(列出所有可用 MCP 工具,供 Agent 自发现)
|
|
72
73
|
|
|
73
74
|
## Recipe 结构要点
|
|
74
75
|
- 必须包含:Frontmatter(`title`、`trigger` 必填)+ `## Snippet / Code Reference` + `## AI Context / Usage Guide`。
|
|
@@ -76,19 +77,19 @@
|
|
|
76
77
|
- Usage Guide 必须用 `###` 三级标题分段,列表式书写,禁止一行文字墙。
|
|
77
78
|
|
|
78
79
|
## Project Skills
|
|
79
|
-
- **发现**:`
|
|
80
|
-
- **加载**:`
|
|
81
|
-
- **创建**:`
|
|
82
|
-
- **推荐**:`
|
|
80
|
+
- **发现**:`autosnippet_skill` — `operation=list` 列出所有可用 Skills(内置 + 项目级)
|
|
81
|
+
- **加载**:`autosnippet_skill` — `operation=load, name=<skillName>` 获取 Skill 完整操作指南
|
|
82
|
+
- **创建**:`autosnippet_skill` — `operation=create, name, description, content` 创建项目级 Skill
|
|
83
|
+
- **推荐**:`autosnippet_skill` — `operation=suggest` 基于使用模式推荐创建 Skill
|
|
83
84
|
- **Bootstrap 自动生成**:冷启动 Phase 5.5 自动生成 4 个 Project Skills(code-standard, architecture, project-profile, agent-guidelines)
|
|
84
85
|
- **优先级**:项目级 Skill 同名覆盖内置;宏观知识查 Skill,微观代码模式查 Recipe
|
|
85
86
|
|
|
86
87
|
## 推荐工作流
|
|
87
|
-
- **查找**:`autosnippet_search
|
|
88
|
-
- **产出候选**:`
|
|
89
|
-
- **冷启动**:`
|
|
90
|
-
- **Skills 创建**:`
|
|
91
|
-
- **采纳反馈**:`
|
|
88
|
+
- **查找**:`autosnippet_search`(推荐 mode=auto)或 `autosnippet_search` mode=context(上下文感知)。
|
|
89
|
+
- **产出候选**:`autosnippet_submit_knowledge` 提交(严格前置校验,必须一次性提供所有必填字段,缺字段直接拒绝不入库)。
|
|
90
|
+
- **冷启动**:`autosnippet_bootstrap` op=knowledge → `autosnippet_bootstrap` op=refine → 逐 Target 深入 → `autosnippet_submit_knowledge_batch`。
|
|
91
|
+
- **Skills 创建**:`autosnippet_skill` op=suggest 分析 → `autosnippet_skill` op=create 固化知识。
|
|
92
|
+
- **采纳反馈**:`autosnippet_knowledge` op=confirm_usage(记录使用量影响排序权重)。
|
|
92
93
|
|
|
93
94
|
## 与 Cursor 规则联动
|
|
94
95
|
- 本文件与 `templates/cursor-rules/autosnippet-conventions.mdc` 保持一致。
|
|
@@ -157,14 +157,11 @@ V2 知识库中的 Recipe 按 `knowledgeType` 自动归入三类 kind,影响
|
|
|
157
157
|
|
|
158
158
|
| 工具 | 说明 |
|
|
159
159
|
|------|------|
|
|
160
|
-
| `autosnippet_search` | 统合搜索(BM25 +
|
|
161
|
-
| `
|
|
162
|
-
| `autosnippet_validate_candidate` | 候选结构化预校验 |
|
|
163
|
-
| `autosnippet_submit_knowledge` | 单条候选提交(reasoning 必填) |
|
|
160
|
+
| `autosnippet_search` | 统合搜索(mode=auto: BM25 + 语义融合,mode=context: 智能上下文检索) |
|
|
161
|
+
| `autosnippet_submit_knowledge` | 单条候选提交(严格前置校验,缺少必要字段直接拒绝不入库。必填: title, language, content(+rationale), kind, doClause, category, trigger, description, headers, usageGuide, knowledgeType) |
|
|
164
162
|
| `autosnippet_submit_knowledge_batch` | 批量候选提交 |
|
|
165
|
-
| `
|
|
166
|
-
| `
|
|
167
|
-
| `autosnippet_recipe_insights` | 获取 Recipe 质量洞察(只读) |
|
|
163
|
+
| `autosnippet_knowledge(operation=confirm_usage)` | 确认 Recipe 被采纳/应用 |
|
|
164
|
+
| `autosnippet_knowledge(operation=insights)` | 获取 Recipe 质量洞察(只读) |
|
|
168
165
|
|
|
169
166
|
---
|
|
170
167
|
|