openmatrix 0.1.23 → 0.1.25

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.
@@ -20,10 +20,24 @@ export interface ProjectContext {
20
20
  packageManager: 'npm' | 'yarn' | 'pnpm' | 'pip' | 'go-mod' | 'cargo' | 'unknown';
21
21
  dependencies: Record<string, string>;
22
22
  }
23
+ /**
24
+ * 任务理解
25
+ */
26
+ export interface TaskUnderstanding {
27
+ taskType: 'feature' | 'bugfix' | 'refactor' | 'docs' | 'test' | 'config' | 'unknown';
28
+ taskTypeLabel: string;
29
+ scope: string[];
30
+ scopeLabel: string;
31
+ complexity: 'simple' | 'medium' | 'complex';
32
+ complexityLabel: string;
33
+ estimatedCommits: string;
34
+ suggestions: string[];
35
+ }
23
36
  /**
24
37
  * 分析结果
25
38
  */
26
39
  export interface AnalysisResult {
40
+ understanding: TaskUnderstanding;
27
41
  inferences: QuestionInference[];
28
42
  questionsToAsk: string[];
29
43
  skippedQuestions: string[];
@@ -51,6 +65,26 @@ export declare class SmartQuestionAnalyzer {
51
65
  * 获取项目上下文
52
66
  */
53
67
  getProjectContext(): Promise<ProjectContext>;
68
+ /**
69
+ * 分析任务理解
70
+ */
71
+ private analyzeTaskUnderstanding;
72
+ /**
73
+ * 检测任务类型
74
+ */
75
+ private detectTaskType;
76
+ /**
77
+ * 检测影响范围
78
+ */
79
+ private detectScope;
80
+ /**
81
+ * 检测复杂度
82
+ */
83
+ private detectComplexity;
84
+ /**
85
+ * 生成建议
86
+ */
87
+ private generateSuggestions;
54
88
  /**
55
89
  * 推断问题答案
56
90
  */
@@ -58,9 +58,11 @@ class SmartQuestionAnalyzer {
58
58
  async analyze(taskDescription, parsedTask) {
59
59
  // 1. 获取项目上下文
60
60
  const projectContext = await this.getProjectContext();
61
- // 2. 执行推断
61
+ // 2. 分析任务理解
62
+ const understanding = this.analyzeTaskUnderstanding(taskDescription, projectContext);
63
+ // 3. 执行推断
62
64
  const inferences = this.inferAnswers(taskDescription, projectContext);
63
- // 3. 筛选需要提问的问题
65
+ // 4. 筛选需要提问的问题
64
66
  const questionsToAsk = inferences
65
67
  .filter(i => i.confidence === 'low' || !i.inferredAnswer)
66
68
  .map(i => i.questionId);
@@ -68,6 +70,7 @@ class SmartQuestionAnalyzer {
68
70
  .filter(i => i.confidence !== 'low' && i.inferredAnswer)
69
71
  .map(i => i.questionId);
70
72
  return {
73
+ understanding,
71
74
  inferences,
72
75
  questionsToAsk,
73
76
  skippedQuestions,
@@ -160,6 +163,190 @@ class SmartQuestionAnalyzer {
160
163
  this.cachedContext = context;
161
164
  return context;
162
165
  }
166
+ /**
167
+ * 分析任务理解
168
+ */
169
+ analyzeTaskUnderstanding(taskDescription, context) {
170
+ const desc = taskDescription.toLowerCase();
171
+ // 1. 判断任务类型
172
+ const taskType = this.detectTaskType(desc);
173
+ // 2. 判断影响范围
174
+ const scope = this.detectScope(desc, context);
175
+ // 3. 判断复杂度
176
+ const complexity = this.detectComplexity(desc, taskType, scope);
177
+ // 4. 生成建议
178
+ const suggestions = this.generateSuggestions(taskType, complexity, desc);
179
+ return {
180
+ taskType: taskType.type,
181
+ taskTypeLabel: taskType.label,
182
+ scope: scope.areas,
183
+ scopeLabel: scope.label,
184
+ complexity: complexity.level,
185
+ complexityLabel: complexity.label,
186
+ estimatedCommits: complexity.estimatedCommits,
187
+ suggestions
188
+ };
189
+ }
190
+ /**
191
+ * 检测任务类型
192
+ */
193
+ detectTaskType(desc) {
194
+ // Bug 修复
195
+ if (/(fix|bug|修复|hotfix|patch|问题|报错|错误|异常)/i.test(desc)) {
196
+ return { type: 'bugfix', label: 'Bug 修复' };
197
+ }
198
+ // 重构
199
+ if (/(refactor|重构|优化|improve|改进)/i.test(desc)) {
200
+ return { type: 'refactor', label: '重构优化' };
201
+ }
202
+ // 文档
203
+ if (/(doc|文档|readme|文档|注释)/i.test(desc)) {
204
+ return { type: 'docs', label: '文档编写' };
205
+ }
206
+ // 测试
207
+ if (/(test|测试|单元|unit|coverage|覆盖率)/i.test(desc)) {
208
+ return { type: 'test', label: '测试编写' };
209
+ }
210
+ // 配置
211
+ if (/(config|配置|设置|setup|初始化)/i.test(desc)) {
212
+ return { type: 'config', label: '配置修改' };
213
+ }
214
+ // 新功能 (默认)
215
+ if (/(implement|add|新功能|实现|开发|feature|添加|创建)/i.test(desc)) {
216
+ return { type: 'feature', label: '新功能开发' };
217
+ }
218
+ return { type: 'unknown', label: '待确认' };
219
+ }
220
+ /**
221
+ * 检测影响范围
222
+ */
223
+ detectScope(desc, context) {
224
+ const areas = [];
225
+ // 从描述中检测
226
+ if (/(前端|页面|ui|样式|css|html|react|vue|component)/i.test(desc)) {
227
+ areas.push('前端');
228
+ }
229
+ if (/(后端|api|服务|server|接口|数据库|database)/i.test(desc)) {
230
+ areas.push('后端');
231
+ }
232
+ if (/(cli|命令行|终端|terminal)/i.test(desc)) {
233
+ areas.push('CLI');
234
+ }
235
+ if (/(测试|test|spec)/i.test(desc)) {
236
+ areas.push('测试');
237
+ }
238
+ if (/(文档|doc|readme)/i.test(desc)) {
239
+ areas.push('文档');
240
+ }
241
+ if (/(配置|config)/i.test(desc)) {
242
+ areas.push('配置');
243
+ }
244
+ // 从项目上下文补充
245
+ if (areas.length === 0) {
246
+ if (context.hasFrontend)
247
+ areas.push('前端');
248
+ if (context.hasBackend)
249
+ areas.push('后端');
250
+ }
251
+ // 默认
252
+ if (areas.length === 0) {
253
+ areas.push('代码');
254
+ }
255
+ const label = areas.join('、');
256
+ return { areas, label };
257
+ }
258
+ /**
259
+ * 检测复杂度
260
+ */
261
+ detectComplexity(desc, taskType, scope) {
262
+ // 简单任务判断
263
+ const simpleKeywords = /(fix|bug|修复|改|调整|样式|变量名|文案)/i;
264
+ const simpleLength = desc.length < 50;
265
+ // 复杂任务判断
266
+ const complexKeywords = /(系统|架构|模块|集成|完整|从零|重构|优化整体)/i;
267
+ const multiScope = scope.areas.length >= 3;
268
+ // Bug 修复通常是简单的
269
+ if (taskType.type === 'bugfix') {
270
+ if (simpleKeywords.test(desc) || simpleLength) {
271
+ return { level: 'simple', label: '简单', estimatedCommits: '预计 1 个 commit' };
272
+ }
273
+ return { level: 'medium', label: '中等', estimatedCommits: '预计 1-2 个 commit' };
274
+ }
275
+ // 文档、配置通常是简单的
276
+ if (taskType.type === 'docs' || taskType.type === 'config') {
277
+ return { level: 'simple', label: '简单', estimatedCommits: '预计 1 个 commit' };
278
+ }
279
+ // 测试取决于范围
280
+ if (taskType.type === 'test') {
281
+ if (multiScope) {
282
+ return { level: 'medium', label: '中等', estimatedCommits: '预计 2-3 个 commit' };
283
+ }
284
+ return { level: 'simple', label: '简单', estimatedCommits: '预计 1 个 commit' };
285
+ }
286
+ // 复杂关键词
287
+ if (complexKeywords.test(desc) || multiScope) {
288
+ return { level: 'complex', label: '复杂', estimatedCommits: '预计 3+ 个 commit' };
289
+ }
290
+ // 新功能
291
+ if (taskType.type === 'feature') {
292
+ if (simpleLength && scope.areas.length <= 1) {
293
+ return { level: 'simple', label: '简单', estimatedCommits: '预计 1-2 个 commit' };
294
+ }
295
+ if (desc.length > 100 || scope.areas.length >= 2) {
296
+ return { level: 'medium', label: '中等', estimatedCommits: '预计 2-3 个 commit' };
297
+ }
298
+ return { level: 'medium', label: '中等', estimatedCommits: '预计 2-3 个 commit' };
299
+ }
300
+ // 重构
301
+ if (taskType.type === 'refactor') {
302
+ if (multiScope) {
303
+ return { level: 'complex', label: '复杂', estimatedCommits: '预计 3+ 个 commit' };
304
+ }
305
+ return { level: 'medium', label: '中等', estimatedCommits: '预计 2-3 个 commit' };
306
+ }
307
+ // 默认中等
308
+ return { level: 'medium', label: '中等', estimatedCommits: '预计 1-2 个 commit' };
309
+ }
310
+ /**
311
+ * 生成建议
312
+ */
313
+ generateSuggestions(taskType, complexity, desc) {
314
+ const suggestions = [];
315
+ // 根据任务类型建议
316
+ switch (taskType.type) {
317
+ case 'bugfix':
318
+ suggestions.push('直接修复,无需 TDD');
319
+ suggestions.push('使用 fast 模式');
320
+ break;
321
+ case 'feature':
322
+ if (complexity.level === 'complex') {
323
+ suggestions.push('建议先头脑风暴,明确需求');
324
+ suggestions.push('使用 strict 模式保证质量');
325
+ }
326
+ else {
327
+ suggestions.push('使用 balanced 模式');
328
+ }
329
+ break;
330
+ case 'refactor':
331
+ suggestions.push('确保测试覆盖');
332
+ suggestions.push('使用 balanced 模式');
333
+ break;
334
+ case 'test':
335
+ suggestions.push('使用 fast 或 balanced 模式');
336
+ break;
337
+ case 'docs':
338
+ suggestions.push('无需测试');
339
+ suggestions.push('使用 fast 模式');
340
+ break;
341
+ case 'config':
342
+ suggestions.push('注意配置安全');
343
+ suggestions.push('使用 fast 模式');
344
+ break;
345
+ default:
346
+ suggestions.push('根据实际情况选择模式');
347
+ }
348
+ return suggestions;
349
+ }
163
350
  /**
164
351
  * 推断问题答案
165
352
  */
@@ -388,7 +575,21 @@ class SmartQuestionAnalyzer {
388
575
  * 生成推断摘要
389
576
  */
390
577
  generateSummary(result) {
391
- const lines = ['📊 AI 推断结果:\n'];
578
+ const lines = [];
579
+ // 任务理解
580
+ lines.push('🔍 我理解的任务:\n');
581
+ lines.push(`📋 类型: ${result.understanding.taskTypeLabel}`);
582
+ lines.push(`📁 范围: ${result.understanding.scopeLabel}`);
583
+ lines.push(`⚡ 复杂度: ${result.understanding.complexityLabel} (${result.understanding.estimatedCommits})`);
584
+ // 建议
585
+ if (result.understanding.suggestions.length > 0) {
586
+ lines.push('\n💡 建议执行方式:');
587
+ for (const suggestion of result.understanding.suggestions) {
588
+ lines.push(` • ${suggestion}`);
589
+ }
590
+ }
591
+ // 推断结果
592
+ lines.push('\n📊 配置推断:');
392
593
  for (const inference of result.inferences) {
393
594
  const icon = inference.confidence === 'high' ? '✅' :
394
595
  inference.confidence === 'medium' ? '🤔' : '❓';
@@ -396,15 +597,12 @@ class SmartQuestionAnalyzer {
396
597
  ? inference.inferredAnswer.join(', ')
397
598
  : inference.inferredAnswer || '待确认';
398
599
  lines.push(`${icon} ${inference.questionId}: ${answer}`);
399
- if (inference.reason) {
400
- lines.push(` └─ ${inference.reason}`);
401
- }
402
600
  }
403
601
  if (result.questionsToAsk.length > 0) {
404
- lines.push(`\n❓ 需要确认的问题: ${result.questionsToAsk.join(', ')}`);
602
+ lines.push(`\n❓ 需要确认: ${result.questionsToAsk.join(', ')}`);
405
603
  }
406
604
  else {
407
- lines.push('\n✅ 所有问题已推断,无需额外确认');
605
+ lines.push('\n✅ 配置已推断,可直接执行');
408
606
  }
409
607
  return lines.join('\n');
410
608
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openmatrix",
3
- "version": "0.1.23",
3
+ "version": "0.1.25",
4
4
  "description": "AI Agent task orchestration system with Claude Code Skills integration",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -1,167 +1,140 @@
1
- ---
2
- name: openmatrix
3
- description: "TRIGGER for ANY implementation task. User wants to build/create/add/fix/implement/refactor something? This is the DEFAULT. Examples: 'add feature', 'fix bug', 'implement login', 'refactor code', 'create command'. ALWAYS prefer this over direct coding."
4
- priority: critical
5
- always_load: true
6
- ---
7
-
8
- <EXTREMELY-IMPORTANT>
9
- This skill MUST be invoked when the user describes ANY work to be done.
10
-
11
- **If you're unsure whether to invoke → INVOKE IT.**
12
-
13
- **If user mentions: add/create/implement/fix/build/make/write/develop/refactor/optimize/update/modify/change → INVOKE THIS SKILL.**
14
-
15
- **Direct coding without OpenMatrix is ONLY allowed for:**
16
- - Simple one-line fixes (typos, variable names)
17
- - Answering questions (no code changes needed)
18
- - Information retrieval (reading files, explaining code)
19
-
20
- Everything else → smart selection between `/om:brainstorm` and `/om:start`.
21
- </EXTREMELY-IMPORTANT>
22
-
23
- <objective>
24
- Automatically detect when user wants to accomplish a development task and intelligently choose between brainstorm (for complex tasks) or start (for simple tasks).
25
- </objective>
26
-
27
- <process>
28
- 1. **检测用户输入**
29
- - 用户直接发送任务描述(不带命令前缀)
30
- - 分析是否为开发任务(写代码/改代码/做东西)
31
-
32
- 2. **判断任务复杂度**
33
-
34
- **复杂任务** (满足任一条件):
35
- - 新功能开发: "实现用户登录" / "添加支付功能"
36
- - 多模块改动: "重构用户系统" / "优化整体性能"
37
- - 架构相关: "搭建框架" / "从零开始"
38
- - 关键词: "系统" / "架构" / "模块" / "集成" / "完整"
39
-
40
- **简单任务** (满足任一条件):
41
- - Bug 修复: "修复登录bug" / "解决样式问题"
42
- - 小改动: "修改文案" / "改变量名"
43
- - 单一功能: "添加一个按钮" / "写个工具函数"
44
- - 关键词: "修复" / "解决" / "改" / "调整" / "简单"
45
-
46
- 3. **智能选择执行路径**
47
-
48
- ```
49
- 复杂任务 → 调用 /om:brainstorm
50
- 简单任务 调用 /om:start
51
- 不确定 → 默认 /om:brainstorm (宁可多问)
52
- ```
53
-
54
- 4. **执行选择的命令**
55
- - 调用 Skill 工具执行对应的 skill
56
- </process>
57
-
58
- <trigger-conditions>
59
- ## AUTO-INVOKE RULES (Mandatory)
60
-
61
- **Invoke IMMEDIATELY when user input contains ANY of these patterns:**
62
-
63
- ### Action Verbs (触发词)
64
- | Chinese | English | Action |
65
- |---------|---------|--------|
66
- | 实现/开发/做/写 | implement/build/create/make/write | → Smart Select |
67
- | 添加/增加/加 | add/append | → Smart Select |
68
- | 修复/解决/改 | fix/resolve/repair | → Smart Select |
69
- | 重构/优化/改进 | refactor/optimize/improve | → Smart Select |
70
- | 更新/修改/改 | update/modify/change | → Smart Select |
71
-
72
- ### Context Patterns (触发场景)
73
- - **Feature requests**: "用户登录" / "支付功能" / "API接口"
74
- - **Bug reports**: "报错" / "不工作" / "有问题" / "崩溃"
75
- - **Code changes**: "这段代码" / "这个文件" / "那个模块"
76
- - **Multi-step tasks**: "先做A" / "然后B" / "最后C"
77
- - **System building**: "做一个系统" / "搭建框架" / "从零开始"
78
-
79
- ### The 3-Second Test
80
- ```
81
- 用户输入 → 能在3秒内判断是"要做事情"吗?
82
- ↓ Yes ↓ No
83
- Smart Select 直接回答
84
- ```
85
- </trigger-conditions>
86
-
87
- <smart-selection>
88
- ## 智能选择:Brainstorm vs Start
89
-
90
- **根据任务复杂度自动选择执行路径:**
91
-
92
- ### 🧠 复杂任务`/om:brainstorm`
93
- **触发条件 (满足任一):**
94
- - 新功能开发: "实现用户登录" / "添加支付功能" / "开发 API"
95
- - 多模块改动: "重构用户系统" / "优化整体性能"
96
- - 架构相关: "搭建框架" / "从零开始" / "设计架构"
97
- - 不确定因素: 需要技术选型、涉及多种方案选择
98
- - 关键词: "系统" / "架构" / "模块" / "集成" / "完整" / "从零"
99
-
100
- ### 🚀 简单任务 `/om:start`
101
- **触发条件 (满足任一):**
102
- - Bug 修复: "修复登录bug" / "解决样式问题" / "改个报错"
103
- - 小改动: "修改文案" / "改变量名" / "调整配置"
104
- - 单一功能: "添加一个按钮" / "写个工具函数"
105
- - 明确需求: 需求清晰,无需额外探索
106
- - 关键词: "修复" / "解决" / "改" / "调整" / "小" / "简单"
107
-
108
- ### 选择流程
109
- ```
110
- 用户输入任务描述
111
-
112
-
113
- ┌─────────────────────┐
114
- 分析任务复杂度 │
115
- └──────────┬──────────┘
116
-
117
- ┌─────┴─────┐
118
- │ │
119
- 复杂任务 简单任务
120
- │ │
121
- ▼ ▼
122
- /om:brainstorm /om:start
123
- ```
124
-
125
- ### 判断示例
126
- | 用户输入 | 复杂度 | 执行路径 |
127
- |---------|--------|---------|
128
- | "实现用户登录功能" | 复杂 | `/om:brainstorm` |
129
- | "做一个完整的支付系统" | 复杂 | `/om:brainstorm` |
130
- | "从零搭建后台管理" | 复杂 | `/om:brainstorm` |
131
- | "修复登录页面的样式问题" | 简单 | `/om:start` |
132
- | "改一下这个变量名" | 简单 | `/om:start` |
133
- | "添加一个测试用例" | 简单 | `/om:start` |
134
- | "重构这个模块" | 中等 | `/om:brainstorm` (保守选择) |
135
- | "优化性能" | 中等 | `/om:brainstorm` (保守选择) |
136
-
137
- **不确定时的默认选择: `/om:brainstorm`** (宁可多问,不可漏问)
138
- </smart-selection>
139
-
140
- <exclusions>
141
- ## When NOT to Invoke (Rare Cases)
142
-
143
- **Do NOT invoke ONLY when:**
144
- - Pure question: "怎么实现?" / "如何配置?" / "what is..." / "为什么"
145
- - Information request: "显示配置" / "列出文件" / "show me..." / "看一下"
146
- - Status check: "状态" / "进度" / "status"
147
- - Casual chat: "你好" / "谢谢" / "hello"
148
-
149
- **Key Test:**
150
- ```
151
- 用户要我写代码/改代码/做东西吗?
152
- ↓ Yes → Smart Select (brainstorm/start)
153
- ↓ No → 直接回答
154
- ```
155
-
156
- **When in doubt → INVOKE. It handles both simple and complex tasks.**
157
- </exclusions>
158
-
159
- <examples>
160
- | User Input | Complexity | Action |
161
- |------------|------------|--------|
162
- | `实现用户登录功能` | 复杂 | → `/om:brainstorm` |
163
- | `做一个完整的订单系统` | 复杂 | → `/om:brainstorm` |
164
- | `修复登录页面的样式问题` | 简单 | → `/om:start` |
165
- | `改一下这个变量名` | 简单 | → `/om:start` |
166
- | `重构用户模块` | 中等 | → `/om:brainstorm` |
167
- | `怎么实现登录?` | - | ❌ Question, not task |
1
+ ---
2
+ name: openmatrix
3
+ description: "TRIGGER for ANY implementation task. User wants to build/create/add/fix/implement/refactor something? This is the DEFAULT. Examples: 'add feature', 'fix bug', 'implement login', 'refactor code', 'create command'. ALWAYS prefer this over direct coding."
4
+ priority: critical
5
+ always_load: true
6
+ ---
7
+
8
+ <EXTREMELY-IMPORTANT>
9
+ This skill MUST be invoked when the user describes ANY work to be done.
10
+
11
+ **If you're unsure whether to invoke → INVOKE IT.**
12
+
13
+ **If user mentions: add/create/implement/fix/build/make/write/develop/refactor/optimize/update/modify/change → INVOKE THIS SKILL.**
14
+
15
+ **Direct coding without OpenMatrix is ONLY allowed for:**
16
+ - Simple one-line fixes (typos, variable names)
17
+ - Answering questions (no code changes needed)
18
+ - Information retrieval (reading files, explaining code)
19
+
20
+ Everything else → analyze and execute.
21
+ </EXTREMELY-IMPORTANT>
22
+
23
+ <objective>
24
+ 用户想要完成开发任务时,自动分析任务,展示理解,推荐执行方式,确认后开始执行。
25
+ </objective>
26
+
27
+ <process>
28
+ 1. **分析任务并展示理解**
29
+
30
+ 调用 CLI 分析任务:
31
+ ```bash
32
+ openmatrix analyze --json
33
+ ```
34
+
35
+ **展示 AI 的理解和推荐:**
36
+ ```
37
+ 🔍 我理解的任务:
38
+
39
+ 📋 类型: Bug 修复
40
+ 📁 范围: 前端样式
41
+ 复杂度: 简单 (预计 1 个 commit)
42
+
43
+ 💡 推荐执行方式:
44
+ 直接修复,无需 TDD
45
+ • 使用 fast 模式
46
+ ```
47
+
48
+ 2. **用户确认**
49
+
50
+ 使用 AskUserQuestion 让用户选择:
51
+ ```typescript
52
+ AskUserQuestion({
53
+ questions: [{
54
+ question: "以上理解正确吗?",
55
+ header: "确认",
56
+ options: [
57
+ { label: "✅ 确认执行", description: "使用推荐配置开始执行" },
58
+ { label: "📝 补充说明", description: "提供更多任务细节" },
59
+ { label: "⚙️ 调整配置", description: "修改质量级别、文档等配置" },
60
+ { label: "🧠 先头脑风暴", description: "复杂任务,需要先探索需求" }
61
+ ],
62
+ multiSelect: false
63
+ }]
64
+ })
65
+ ```
66
+
67
+ 3. **根据选择执行**
68
+
69
+ **选择"确认执行"**:
70
+ - 直接调用 `/om:start`,使用推荐配置,无需再问问题
71
+
72
+ **选择"补充说明"**:
73
+ - 询问详情后重新分析
74
+
75
+ **选择"调整配置"**:
76
+ - 调用 `/om:start`,进入配置流程
77
+
78
+ **选择"先头脑风暴"**:
79
+ - 调用 `/om:brainstorm`
80
+ </process>
81
+
82
+ <trigger-conditions>
83
+ ## AUTO-INVOKE RULES (Mandatory)
84
+
85
+ **Invoke IMMEDIATELY when user input contains ANY of these patterns:**
86
+
87
+ ### Action Verbs (触发词)
88
+ | Chinese | English | Action |
89
+ |---------|---------|--------|
90
+ | 实现/开发/做/写 | implement/build/create/make/write | → Analyze |
91
+ | 添加/增加/加 | add/append | → Analyze |
92
+ | 修复/解决/改 | fix/resolve/repair | Analyze |
93
+ | 重构/优化/改进 | refactor/optimize/improve | → Analyze |
94
+ | 更新/修改/改 | update/modify/change | Analyze |
95
+
96
+ ### Context Patterns (触发场景)
97
+ - **Feature requests**: "用户登录" / "支付功能" / "API接口"
98
+ - **Bug reports**: "报错" / "不工作" / "有问题" / "崩溃"
99
+ - **Code changes**: "这段代码" / "这个文件" / "那个模块"
100
+ - **Multi-step tasks**: "先做A" / "然后B" / "最后C"
101
+ - **System building**: "做一个系统" / "搭建框架" / "从零开始"
102
+
103
+ ### The 3-Second Test
104
+ ```
105
+ 用户输入 能在3秒内判断是"要做事情"吗?
106
+ Yes ↓ No
107
+ Analyze & Execute 直接回答
108
+ ```
109
+ </trigger-conditions>
110
+
111
+ <exclusions>
112
+ ## When NOT to Invoke (Rare Cases)
113
+
114
+ **Do NOT invoke ONLY when:**
115
+ - Pure question: "怎么实现?" / "如何配置?" / "what is..." / "为什么"
116
+ - Information request: "显示配置" / "列出文件" / "show me..." / "看一下"
117
+ - Status check: "状态" / "进度" / "status"
118
+ - Casual chat: "你好" / "谢谢" / "hello"
119
+
120
+ **Key Test:**
121
+ ```
122
+ 用户要我写代码/改代码/做东西吗?
123
+ ↓ Yes → Analyze & Execute
124
+ ↓ No → 直接回答
125
+ ```
126
+
127
+ **When in doubt → INVOKE.**
128
+ </exclusions>
129
+
130
+ <arguments>
131
+ $ARGUMENTS
132
+ </arguments>
133
+
134
+ <examples>
135
+ | User Input | Action |
136
+ |------------|--------|
137
+ | `实现用户登录功能` | → 分析 → 展示理解 → 确认 → 执行 |
138
+ | `修复登录页面的样式问题` | → 分析 → 展示理解 → 确认 → 执行 |
139
+ | `怎么实现登录?` | ❌ Question, not task |
140
+ </examples>