openmatrix 0.2.15 → 0.2.16
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/dist/agents/agent-runner.d.ts +4 -0
- package/dist/agents/agent-runner.js +86 -0
- package/dist/orchestrator/executor.d.ts +32 -2
- package/dist/orchestrator/executor.js +119 -1
- package/dist/orchestrator/meeting-manager.d.ts +16 -1
- package/dist/orchestrator/meeting-manager.js +113 -0
- package/dist/types/index.d.ts +66 -1
- package/package.json +2 -1
- package/skills/auto.md +64 -3
- package/skills/debug.md +1 -1
- package/skills/feature.md +153 -52
- package/skills/resume-feature.md +227 -0
- package/skills/start.md +66 -3
|
@@ -136,8 +136,11 @@ class AgentRunner {
|
|
|
136
136
|
const agentPrompt = this.buildAgentPrompt(task);
|
|
137
137
|
const phaseContext = this.buildPhaseContext(task);
|
|
138
138
|
const accumulatedContext = await this.buildAccumulatedContext(task);
|
|
139
|
+
const ambiguityInstruction = this.buildAmbiguityDetectionInstruction(task);
|
|
139
140
|
return `# 任务执行
|
|
140
141
|
|
|
142
|
+
${ambiguityInstruction}
|
|
143
|
+
|
|
141
144
|
## 任务信息
|
|
142
145
|
- ID: ${task.id}
|
|
143
146
|
- 标题: ${task.title}
|
|
@@ -172,6 +175,89 @@ ${agentPrompt.instructions}
|
|
|
172
175
|
注意: 任务完成后,由 Skill 调用 \`openmatrix complete\` 并传入 --summary 参数,
|
|
173
176
|
该摘要会自动追加到全局 \`.openmatrix/context.md\` 供后续 Agent 参考。
|
|
174
177
|
`;
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* 构建歧义检测指令
|
|
181
|
+
*/
|
|
182
|
+
buildAmbiguityDetectionInstruction(task) {
|
|
183
|
+
return `## 🚨 歧义检测指令(必须在执行前完成)
|
|
184
|
+
|
|
185
|
+
在开始执行任务之前,你必须完成歧义检测。检测以下 5 种歧义类型:
|
|
186
|
+
|
|
187
|
+
### 检测清单
|
|
188
|
+
|
|
189
|
+
1. **需求歧义** (requirement)
|
|
190
|
+
- 任务描述是否清晰可理解?
|
|
191
|
+
- 是否有缺少的关键信息?
|
|
192
|
+
- 验收标准是否明确?
|
|
193
|
+
|
|
194
|
+
2. **技术歧义** (technical)
|
|
195
|
+
- 技术选型是否明确?
|
|
196
|
+
- 实现方案是否有多种选择?
|
|
197
|
+
- 是否需要特定的技术决策?
|
|
198
|
+
|
|
199
|
+
3. **依赖歧义** (dependency)
|
|
200
|
+
- 依赖任务是否已完成?
|
|
201
|
+
- 依赖代码是否可找到?
|
|
202
|
+
- 是否有缺失的依赖项?
|
|
203
|
+
|
|
204
|
+
4. **验收歧义** (acceptance)
|
|
205
|
+
- 验收标准是否明确?
|
|
206
|
+
- 成功定义是否清晰?
|
|
207
|
+
- 是否有模糊的边界条件?
|
|
208
|
+
|
|
209
|
+
5. **测试结果歧义** (test_result)
|
|
210
|
+
- 测试失败原因是否明确?
|
|
211
|
+
- 测试通过是否可信?
|
|
212
|
+
- 是否需要额外的验证?
|
|
213
|
+
|
|
214
|
+
### 严重程度定义
|
|
215
|
+
|
|
216
|
+
| 级别 | 说明 | 处理方式 |
|
|
217
|
+
|-----|------|---------|
|
|
218
|
+
| **Critical** | 无法继续执行,必须澄清 | 立即报告,等待澄清 |
|
|
219
|
+
| **High** | 可能导致错误结果 | 报告并建议处理方案 |
|
|
220
|
+
| **Medium** | 影响执行效率 | 记录并尝试解决 |
|
|
221
|
+
| **Low** | 轻微不确定性 | 继续执行,备注说明 |
|
|
222
|
+
|
|
223
|
+
### 输出格式
|
|
224
|
+
|
|
225
|
+
如果检测到歧义,在任务执行前输出:
|
|
226
|
+
\`\`\`xml
|
|
227
|
+
<ambiguity_report>
|
|
228
|
+
{
|
|
229
|
+
"hasAmbiguity": true,
|
|
230
|
+
"taskId": "${task.id}",
|
|
231
|
+
"detectionPhase": "pre_execution",
|
|
232
|
+
"ambiguities": [
|
|
233
|
+
{
|
|
234
|
+
"type": "requirement|technical|dependency|acceptance|test_result",
|
|
235
|
+
"severity": "Critical|High|Medium|Low",
|
|
236
|
+
"description": "歧义描述",
|
|
237
|
+
"suggestedResolution": "建议的处理方案"
|
|
238
|
+
}
|
|
239
|
+
],
|
|
240
|
+
"maxSeverity": "Critical|High|Medium|Low",
|
|
241
|
+
"suggestedStrategy": "ask_immediate|write_meeting|continue",
|
|
242
|
+
"detectedAt": "<ISO timestamp>"
|
|
243
|
+
}
|
|
244
|
+
</ambiguity_report>
|
|
245
|
+
\`\`\`
|
|
246
|
+
|
|
247
|
+
如果没有歧义,输出:
|
|
248
|
+
\`\`\`xml
|
|
249
|
+
<ambiguity_report>
|
|
250
|
+
{ "hasAmbiguity": false }
|
|
251
|
+
</ambiguity_report>
|
|
252
|
+
\`\`\`
|
|
253
|
+
|
|
254
|
+
### 处理策略
|
|
255
|
+
|
|
256
|
+
- **Critical/High**: 输出报告后暂停,等待用户决策
|
|
257
|
+
- **Medium**: 输出报告后继续执行,采用合理假设
|
|
258
|
+
- **Low**: 记录并继续执行
|
|
259
|
+
|
|
260
|
+
**重要**: 如果无法解析歧义检测结果,视为无歧义继续执行。`;
|
|
175
261
|
}
|
|
176
262
|
/**
|
|
177
263
|
* 构建累积上下文 - 从全局 context.md 读取前序 Agent 的决策和知识
|
|
@@ -4,6 +4,7 @@ import type { SubagentTask } from '../types/index.js';
|
|
|
4
4
|
import { StateManager } from '../storage/state-manager.js';
|
|
5
5
|
import { ApprovalManager } from './approval-manager.js';
|
|
6
6
|
import { PhaseExecutor } from './phase-executor.js';
|
|
7
|
+
import type { AmbiguityReport } from '../types/index.js';
|
|
7
8
|
export interface ExecutorConfig {
|
|
8
9
|
maxConcurrent: number;
|
|
9
10
|
taskTimeout: number;
|
|
@@ -16,7 +17,7 @@ export interface ExecutorStatus {
|
|
|
16
17
|
waitingApprovals: number;
|
|
17
18
|
}
|
|
18
19
|
export interface ExecutionResult {
|
|
19
|
-
status: 'continue' | 'waiting_approval' | 'completed' | 'failed';
|
|
20
|
+
status: 'continue' | 'waiting_approval' | 'completed' | 'failed' | 'ambiguity_ask_user';
|
|
20
21
|
subagentTasks: SubagentTask[];
|
|
21
22
|
message: string;
|
|
22
23
|
statistics: {
|
|
@@ -26,6 +27,8 @@ export interface ExecutionResult {
|
|
|
26
27
|
pending: number;
|
|
27
28
|
failed: number;
|
|
28
29
|
};
|
|
30
|
+
/** 歧义报告 (仅 status 为 'ambiguity_ask_user' 时存在) */
|
|
31
|
+
ambiguityReport?: AmbiguityReport;
|
|
29
32
|
}
|
|
30
33
|
/**
|
|
31
34
|
* OrchestratorExecutor - 执行循环核心
|
|
@@ -41,6 +44,7 @@ export declare class OrchestratorExecutor {
|
|
|
41
44
|
private phaseExecutor;
|
|
42
45
|
private retryManager;
|
|
43
46
|
private aiReviewer;
|
|
47
|
+
private meetingManager;
|
|
44
48
|
private config;
|
|
45
49
|
private taskTimers;
|
|
46
50
|
constructor(stateManager: StateManager, approvalManager: ApprovalManager, config?: Partial<ExecutorConfig>);
|
|
@@ -94,7 +98,9 @@ export declare class OrchestratorExecutor {
|
|
|
94
98
|
/**
|
|
95
99
|
* 标记任务完成
|
|
96
100
|
*
|
|
97
|
-
*
|
|
101
|
+
* 增强:
|
|
102
|
+
* 1. 对于 reviewer 任务,自动解析 Review 报告并生成修复任务
|
|
103
|
+
* 2. 解析歧义报告并根据执行模式处理
|
|
98
104
|
*/
|
|
99
105
|
completeTask(taskId: string, result: {
|
|
100
106
|
success: boolean;
|
|
@@ -102,6 +108,10 @@ export declare class OrchestratorExecutor {
|
|
|
102
108
|
error?: string;
|
|
103
109
|
}): Promise<{
|
|
104
110
|
createdFixTasks?: string[];
|
|
111
|
+
ambiguityResult?: {
|
|
112
|
+
status: 'ambiguity_ask_user' | 'ambiguity_handled';
|
|
113
|
+
report: AmbiguityReport;
|
|
114
|
+
};
|
|
105
115
|
}>;
|
|
106
116
|
/**
|
|
107
117
|
* 处理 Review 结果:解析报告,如有 critical/major 问题则自动创建修复任务
|
|
@@ -111,6 +121,26 @@ export declare class OrchestratorExecutor {
|
|
|
111
121
|
* 获取当前阶段
|
|
112
122
|
*/
|
|
113
123
|
private getCurrentPhase;
|
|
124
|
+
/**
|
|
125
|
+
* 解析歧义报告
|
|
126
|
+
*
|
|
127
|
+
* 从 Agent 输出中提取歧义报告 JSON
|
|
128
|
+
* 支持多种标记格式:
|
|
129
|
+
* - <ambiguity_report>...</ambiguity_report>
|
|
130
|
+
* - AMBIGUITY_REPORT: {...}
|
|
131
|
+
* - 直接 JSON 块
|
|
132
|
+
*/
|
|
133
|
+
private parseAmbiguityReport;
|
|
134
|
+
/**
|
|
135
|
+
* 处理歧义
|
|
136
|
+
*
|
|
137
|
+
* 根据执行模式和严重程度选择处理策略:
|
|
138
|
+
* - auto 模式:所有歧义写入 Meeting,继续执行
|
|
139
|
+
* - 其他模式:
|
|
140
|
+
* - Critical/High:返回 ambiguity_ask_user 状态,让 Skill 层用 AskUserQuestion 处理
|
|
141
|
+
* - Medium/Low:写入 Meeting,继续执行
|
|
142
|
+
*/
|
|
143
|
+
private handleAmbiguity;
|
|
114
144
|
/**
|
|
115
145
|
* 获取执行器状态
|
|
116
146
|
*/
|
|
@@ -8,6 +8,7 @@ const state_machine_js_1 = require("./state-machine.js");
|
|
|
8
8
|
const phase_executor_js_1 = require("./phase-executor.js");
|
|
9
9
|
const retry_manager_js_1 = require("./retry-manager.js");
|
|
10
10
|
const ai_reviewer_js_1 = require("./ai-reviewer.js");
|
|
11
|
+
const meeting_manager_js_1 = require("./meeting-manager.js");
|
|
11
12
|
const logger_js_1 = require("../utils/logger.js");
|
|
12
13
|
/**
|
|
13
14
|
* OrchestratorExecutor - 执行循环核心
|
|
@@ -23,11 +24,13 @@ class OrchestratorExecutor {
|
|
|
23
24
|
phaseExecutor;
|
|
24
25
|
retryManager;
|
|
25
26
|
aiReviewer;
|
|
27
|
+
meetingManager;
|
|
26
28
|
config;
|
|
27
29
|
taskTimers = new Map();
|
|
28
30
|
constructor(stateManager, approvalManager, config) {
|
|
29
31
|
this.stateManager = stateManager;
|
|
30
32
|
this.approvalManager = approvalManager;
|
|
33
|
+
this.meetingManager = new meeting_manager_js_1.MeetingManager(stateManager, approvalManager);
|
|
31
34
|
// 从 state.config 读取 taskTimeout,如果未定义则使用默认值
|
|
32
35
|
const stateConfig = stateManager.getState().then(s => s.config).catch(() => null);
|
|
33
36
|
const defaultTaskTimeout = 600000; // 10 分钟(毫秒)
|
|
@@ -265,13 +268,25 @@ class OrchestratorExecutor {
|
|
|
265
268
|
/**
|
|
266
269
|
* 标记任务完成
|
|
267
270
|
*
|
|
268
|
-
*
|
|
271
|
+
* 增强:
|
|
272
|
+
* 1. 对于 reviewer 任务,自动解析 Review 报告并生成修复任务
|
|
273
|
+
* 2. 解析歧义报告并根据执行模式处理
|
|
269
274
|
*/
|
|
270
275
|
async completeTask(taskId, result) {
|
|
271
276
|
const task = await this.stateManager.getTask(taskId);
|
|
272
277
|
if (!task) {
|
|
273
278
|
throw new Error(`Task ${taskId} not found`);
|
|
274
279
|
}
|
|
280
|
+
// 检查输出中是否包含歧义报告(仅匹配 XML 标签作为唯一触发标记)
|
|
281
|
+
if (result.output?.includes('<ambiguity_report>')) {
|
|
282
|
+
const ambiguityReport = this.parseAmbiguityReport(taskId, result.output);
|
|
283
|
+
if (ambiguityReport?.hasAmbiguity) {
|
|
284
|
+
const ambiguityResult = await this.handleAmbiguity(task, ambiguityReport);
|
|
285
|
+
if (ambiguityResult) {
|
|
286
|
+
return { ambiguityResult };
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
}
|
|
275
290
|
if (result.success) {
|
|
276
291
|
// 清除超时计时器
|
|
277
292
|
this.clearTaskTimeout(taskId);
|
|
@@ -370,6 +385,109 @@ class OrchestratorExecutor {
|
|
|
370
385
|
return 'verify';
|
|
371
386
|
return 'accept';
|
|
372
387
|
}
|
|
388
|
+
// ============ Ambiguity Management ============
|
|
389
|
+
/**
|
|
390
|
+
* 解析歧义报告
|
|
391
|
+
*
|
|
392
|
+
* 从 Agent 输出中提取歧义报告 JSON
|
|
393
|
+
* 支持多种标记格式:
|
|
394
|
+
* - <ambiguity_report>...</ambiguity_report>
|
|
395
|
+
* - AMBIGUITY_REPORT: {...}
|
|
396
|
+
* - 直接 JSON 块
|
|
397
|
+
*/
|
|
398
|
+
parseAmbiguityReport(taskId, output) {
|
|
399
|
+
try {
|
|
400
|
+
// 尝试提取 XML 标记格式
|
|
401
|
+
const xmlMatch = output.match(/<ambiguity_report>([\s\S]*?)<\/ambiguity_report>/);
|
|
402
|
+
if (xmlMatch) {
|
|
403
|
+
const jsonStr = xmlMatch[1].trim();
|
|
404
|
+
const report = JSON.parse(jsonStr);
|
|
405
|
+
return { ...report, taskId };
|
|
406
|
+
}
|
|
407
|
+
// 尝试提取 AMBIGUITY_REPORT: 格式
|
|
408
|
+
const prefixMatch = output.match(/AMBIGUITY_REPORT:\s*([\s\S]*?)(?:\n\n|\n---|$)/);
|
|
409
|
+
if (prefixMatch) {
|
|
410
|
+
const jsonStr = prefixMatch[1].trim();
|
|
411
|
+
const report = JSON.parse(jsonStr);
|
|
412
|
+
return { ...report, taskId };
|
|
413
|
+
}
|
|
414
|
+
// 尝试查找包含 hasAmbiguity 的 JSON 块(平衡括号匹配,作为最后兜底)
|
|
415
|
+
const hasAmbiguityIdx = output.indexOf('"hasAmbiguity"');
|
|
416
|
+
if (hasAmbiguityIdx !== -1) {
|
|
417
|
+
// 向前扫描找到深度为 1 的最外层 {
|
|
418
|
+
let start = -1;
|
|
419
|
+
let depth = 0;
|
|
420
|
+
for (let i = hasAmbiguityIdx; i >= 0; i--) {
|
|
421
|
+
if (output[i] === '}')
|
|
422
|
+
depth++;
|
|
423
|
+
else if (output[i] === '{') {
|
|
424
|
+
depth--;
|
|
425
|
+
if (depth < 0) {
|
|
426
|
+
start = i;
|
|
427
|
+
break;
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
if (start !== -1) {
|
|
432
|
+
let d = 0;
|
|
433
|
+
let end = -1;
|
|
434
|
+
for (let i = start; i < output.length; i++) {
|
|
435
|
+
if (output[i] === '{')
|
|
436
|
+
d++;
|
|
437
|
+
else if (output[i] === '}') {
|
|
438
|
+
d--;
|
|
439
|
+
if (d === 0) {
|
|
440
|
+
end = i;
|
|
441
|
+
break;
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
if (end !== -1) {
|
|
446
|
+
const report = JSON.parse(output.slice(start, end + 1));
|
|
447
|
+
return { ...report, taskId };
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
return null;
|
|
452
|
+
}
|
|
453
|
+
catch (error) {
|
|
454
|
+
console.warn(`⚠️ 解析歧义报告失败: ${taskId}`, error);
|
|
455
|
+
return null;
|
|
456
|
+
}
|
|
457
|
+
}
|
|
458
|
+
/**
|
|
459
|
+
* 处理歧义
|
|
460
|
+
*
|
|
461
|
+
* 根据执行模式和严重程度选择处理策略:
|
|
462
|
+
* - auto 模式:所有歧义写入 Meeting,继续执行
|
|
463
|
+
* - 其他模式:
|
|
464
|
+
* - Critical/High:返回 ambiguity_ask_user 状态,让 Skill 层用 AskUserQuestion 处理
|
|
465
|
+
* - Medium/Low:写入 Meeting,继续执行
|
|
466
|
+
*/
|
|
467
|
+
async handleAmbiguity(task, report) {
|
|
468
|
+
const state = await this.stateManager.getState();
|
|
469
|
+
const mode = state.config.approvalPoints.length === 0 ? 'auto' : 'interactive';
|
|
470
|
+
console.log(`🔍 检测到歧义: ${task.id} - 最高严重程度: ${report.maxSeverity || 'unknown'}`);
|
|
471
|
+
// auto 模式:所有歧义写入 Meeting,继续执行
|
|
472
|
+
if (mode === 'auto') {
|
|
473
|
+
await this.meetingManager.createAmbiguityMeeting(task.id, report);
|
|
474
|
+
console.log(`📝 [auto模式] 歧义已写入 Meeting,继续执行`);
|
|
475
|
+
return { status: 'ambiguity_handled', report };
|
|
476
|
+
}
|
|
477
|
+
// 其他模式:根据严重程度处理
|
|
478
|
+
const severity = report.maxSeverity;
|
|
479
|
+
if (severity === 'critical' || severity === 'high') {
|
|
480
|
+
// Critical/High: 返回特殊状态让 Skill 层用 AskUserQuestion 处理
|
|
481
|
+
console.log(`⚠️ [interactive模式] Critical/High 歧义,需用户确认`);
|
|
482
|
+
return { status: 'ambiguity_ask_user', report };
|
|
483
|
+
}
|
|
484
|
+
else {
|
|
485
|
+
// Medium/Low: 写入 Meeting,继续执行
|
|
486
|
+
await this.meetingManager.createAmbiguityMeeting(task.id, report);
|
|
487
|
+
console.log(`📝 [interactive模式] Medium/Low 歧义已写入 Meeting,继续执行`);
|
|
488
|
+
return { status: 'ambiguity_handled', report };
|
|
489
|
+
}
|
|
490
|
+
}
|
|
373
491
|
/**
|
|
374
492
|
* 获取执行器状态
|
|
375
493
|
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { StateManager } from '../storage/state-manager.js';
|
|
2
2
|
import { ApprovalManager } from './approval-manager.js';
|
|
3
|
-
import type { Approval, Meeting } from '../types/index.js';
|
|
3
|
+
import type { Approval, Meeting, AmbiguityReport } from '../types/index.js';
|
|
4
4
|
/**
|
|
5
5
|
* MeetingManager - Meeting 管理器
|
|
6
6
|
*
|
|
@@ -28,6 +28,21 @@ export declare class MeetingManager {
|
|
|
28
28
|
meeting: Meeting;
|
|
29
29
|
approval: Approval;
|
|
30
30
|
}>;
|
|
31
|
+
/**
|
|
32
|
+
* 获取严重程度对应的图标和标题前缀
|
|
33
|
+
*/
|
|
34
|
+
private getSeverityPrefix;
|
|
35
|
+
/**
|
|
36
|
+
* 格式化歧义报告为 Markdown 描述
|
|
37
|
+
*/
|
|
38
|
+
private formatAmbiguityReport;
|
|
39
|
+
/**
|
|
40
|
+
* 创建歧义 Meeting
|
|
41
|
+
*/
|
|
42
|
+
createAmbiguityMeeting(taskId: string, ambiguityReport: AmbiguityReport): Promise<{
|
|
43
|
+
meeting: Meeting;
|
|
44
|
+
approval: Approval;
|
|
45
|
+
}>;
|
|
31
46
|
/**
|
|
32
47
|
* 开始 Meeting
|
|
33
48
|
*/
|
|
@@ -104,6 +104,119 @@ ${options.map((opt, i) => `${i + 1}. ${opt}`).join('\n')}
|
|
|
104
104
|
});
|
|
105
105
|
return { meeting, approval };
|
|
106
106
|
}
|
|
107
|
+
/**
|
|
108
|
+
* 获取严重程度对应的图标和标题前缀
|
|
109
|
+
*/
|
|
110
|
+
getSeverityPrefix(severity) {
|
|
111
|
+
const prefixes = {
|
|
112
|
+
critical: '🔴 Critical',
|
|
113
|
+
high: '🟠 High',
|
|
114
|
+
medium: '🟡 Medium',
|
|
115
|
+
low: '🟢 Low'
|
|
116
|
+
};
|
|
117
|
+
return prefixes[severity];
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* 格式化歧义报告为 Markdown 描述
|
|
121
|
+
*/
|
|
122
|
+
formatAmbiguityReport(report) {
|
|
123
|
+
const lines = [];
|
|
124
|
+
lines.push('## 歧义检测结果');
|
|
125
|
+
lines.push('');
|
|
126
|
+
lines.push(`**检测阶段**: ${report.detectionPhase === 'pre_execution' ? '执行前' : '执行中'}`);
|
|
127
|
+
lines.push(`**检测时间**: ${report.detectedAt}`);
|
|
128
|
+
lines.push(`**歧义数量**: ${report.ambiguities.length}`);
|
|
129
|
+
if (report.maxSeverity) {
|
|
130
|
+
lines.push(`**最高严重程度**: ${this.getSeverityPrefix(report.maxSeverity)}`);
|
|
131
|
+
}
|
|
132
|
+
lines.push('');
|
|
133
|
+
lines.push('## 歧义详情');
|
|
134
|
+
lines.push('');
|
|
135
|
+
for (const ambiguity of report.ambiguities) {
|
|
136
|
+
const severityIcon = this.getSeverityPrefix(ambiguity.severity);
|
|
137
|
+
lines.push(`### ${severityIcon} ${ambiguity.type}`);
|
|
138
|
+
lines.push('');
|
|
139
|
+
lines.push(`**描述**: ${ambiguity.description}`);
|
|
140
|
+
lines.push('');
|
|
141
|
+
if (ambiguity.impactScope.length > 0) {
|
|
142
|
+
lines.push('**影响范围**:');
|
|
143
|
+
for (const scope of ambiguity.impactScope) {
|
|
144
|
+
lines.push(`- ${scope}`);
|
|
145
|
+
}
|
|
146
|
+
lines.push('');
|
|
147
|
+
}
|
|
148
|
+
if (ambiguity.possibleSolutions && ambiguity.possibleSolutions.length > 0) {
|
|
149
|
+
lines.push('**可能的解决方案**:');
|
|
150
|
+
for (let i = 0; i < ambiguity.possibleSolutions.length; i++) {
|
|
151
|
+
lines.push(`${i + 1}. ${ambiguity.possibleSolutions[i]}`);
|
|
152
|
+
}
|
|
153
|
+
lines.push('');
|
|
154
|
+
}
|
|
155
|
+
if (ambiguity.relatedFiles && ambiguity.relatedFiles.length > 0) {
|
|
156
|
+
lines.push(`**相关文件**: ${ambiguity.relatedFiles.join(', ')}`);
|
|
157
|
+
lines.push('');
|
|
158
|
+
}
|
|
159
|
+
if (ambiguity.relatedTaskIds && ambiguity.relatedTaskIds.length > 0) {
|
|
160
|
+
lines.push(`**相关任务**: ${ambiguity.relatedTaskIds.join(', ')}`);
|
|
161
|
+
lines.push('');
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
if (report.suggestedStrategy) {
|
|
165
|
+
lines.push('## 建议处理策略');
|
|
166
|
+
lines.push('');
|
|
167
|
+
const strategyMap = {
|
|
168
|
+
ask_immediate: '立即提问 (ask_immediate)',
|
|
169
|
+
write_meeting: '写入 Meeting (write_meeting)',
|
|
170
|
+
continue: '继续执行 (continue)'
|
|
171
|
+
};
|
|
172
|
+
lines.push(strategyMap[report.suggestedStrategy] || report.suggestedStrategy);
|
|
173
|
+
lines.push('');
|
|
174
|
+
}
|
|
175
|
+
if (report.suggestedQuestions && report.suggestedQuestions.length > 0) {
|
|
176
|
+
lines.push('## 建议的问题');
|
|
177
|
+
lines.push('');
|
|
178
|
+
for (let i = 0; i < report.suggestedQuestions.length; i++) {
|
|
179
|
+
lines.push(`${i + 1}. ${report.suggestedQuestions[i]}`);
|
|
180
|
+
}
|
|
181
|
+
lines.push('');
|
|
182
|
+
}
|
|
183
|
+
return lines.join('\n');
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* 创建歧义 Meeting
|
|
187
|
+
*/
|
|
188
|
+
async createAmbiguityMeeting(taskId, ambiguityReport) {
|
|
189
|
+
const meetingId = `meeting-${Date.now().toString(36)}`;
|
|
190
|
+
const now = new Date().toISOString();
|
|
191
|
+
// 根据最高严重程度生成标题
|
|
192
|
+
const severity = ambiguityReport.maxSeverity || 'medium';
|
|
193
|
+
const severityPrefix = this.getSeverityPrefix(severity);
|
|
194
|
+
const titleSummary = ambiguityReport.ambiguities[0]?.description.slice(0, 50) || '歧义检测';
|
|
195
|
+
const meeting = {
|
|
196
|
+
id: meetingId,
|
|
197
|
+
type: 'ambiguity',
|
|
198
|
+
status: 'pending',
|
|
199
|
+
taskId,
|
|
200
|
+
title: `${severityPrefix}: ${titleSummary}...`,
|
|
201
|
+
description: `任务 ${taskId} 检测到歧义,需要用户确认处理方式`,
|
|
202
|
+
impactScope: ambiguityReport.ambiguities.flatMap(a => a.impactScope),
|
|
203
|
+
participants: ['user'],
|
|
204
|
+
createdAt: now,
|
|
205
|
+
ambiguityReport,
|
|
206
|
+
suggestedQuestions: ambiguityReport.suggestedQuestions
|
|
207
|
+
};
|
|
208
|
+
// 保存 Meeting
|
|
209
|
+
await this.stateManager.saveMeeting(meeting);
|
|
210
|
+
// 创建审批
|
|
211
|
+
const approval = await this.approvalManager.createApproval({
|
|
212
|
+
type: 'meeting',
|
|
213
|
+
taskId,
|
|
214
|
+
title: meeting.title,
|
|
215
|
+
description: this.formatAmbiguityReport(ambiguityReport),
|
|
216
|
+
content: JSON.stringify({ meetingId, ambiguityReport })
|
|
217
|
+
});
|
|
218
|
+
return { meeting, approval };
|
|
219
|
+
}
|
|
107
220
|
/**
|
|
108
221
|
* 开始 Meeting
|
|
109
222
|
*/
|
package/dist/types/index.d.ts
CHANGED
|
@@ -204,7 +204,7 @@ export interface ApprovalOption {
|
|
|
204
204
|
label: string;
|
|
205
205
|
}
|
|
206
206
|
export type MeetingStatus = 'pending' | 'in_progress' | 'resolved' | 'cancelled';
|
|
207
|
-
export type MeetingType = 'blocking' | 'decision' | 'review' | 'planning';
|
|
207
|
+
export type MeetingType = 'blocking' | 'decision' | 'review' | 'planning' | 'ambiguity';
|
|
208
208
|
export interface Meeting {
|
|
209
209
|
id: string;
|
|
210
210
|
type: MeetingType;
|
|
@@ -219,6 +219,10 @@ export interface Meeting {
|
|
|
219
219
|
createdAt: string;
|
|
220
220
|
startedAt?: string;
|
|
221
221
|
resolvedAt?: string;
|
|
222
|
+
/** 歧义报告 (仅 type 为 'ambiguity' 时使用) */
|
|
223
|
+
ambiguityReport?: AmbiguityReport;
|
|
224
|
+
/** 建议的问题列表 (用于歧义处理) */
|
|
225
|
+
suggestedQuestions?: string[];
|
|
222
226
|
}
|
|
223
227
|
export interface ParsedTask {
|
|
224
228
|
title: string;
|
|
@@ -311,3 +315,64 @@ export interface DebugSession {
|
|
|
311
315
|
updatedAt: string;
|
|
312
316
|
completedAt?: string;
|
|
313
317
|
}
|
|
318
|
+
/**
|
|
319
|
+
* 歧义类型
|
|
320
|
+
* - requirement: 需求歧义 (需求描述不清晰、存在多种解读)
|
|
321
|
+
* - technical: 技术歧义 (技术方案选择、实现方式不明确)
|
|
322
|
+
* - dependency: 依赖歧义 (依赖项版本、接口契约不明确)
|
|
323
|
+
* - acceptance: 验收歧义 (验收标准不清晰、无法验证)
|
|
324
|
+
* - test_result: 测试结果歧义 (测试结果不一致、无法判断)
|
|
325
|
+
*/
|
|
326
|
+
export type AmbiguityType = 'requirement' | 'technical' | 'dependency' | 'acceptance' | 'test_result';
|
|
327
|
+
/**
|
|
328
|
+
* 歧义严重程度
|
|
329
|
+
* - critical: 严重歧义,必须立即解决,否则任务无法继续
|
|
330
|
+
* - high: 高优先级歧义,影响核心功能,应尽快解决
|
|
331
|
+
* - medium: 中等优先级歧义,影响非核心功能,可稍后解决
|
|
332
|
+
* - low: 低优先级歧义,影响较小,可在后续处理
|
|
333
|
+
*/
|
|
334
|
+
export type AmbiguitySeverity = 'critical' | 'high' | 'medium' | 'low';
|
|
335
|
+
/**
|
|
336
|
+
* 歧义项 - 描述单个歧义点
|
|
337
|
+
*/
|
|
338
|
+
export interface AmbiguityItem {
|
|
339
|
+
/** 歧义唯一标识 */
|
|
340
|
+
id: string;
|
|
341
|
+
/** 歧义类型 */
|
|
342
|
+
type: AmbiguityType;
|
|
343
|
+
/** 严重程度 */
|
|
344
|
+
severity: AmbiguitySeverity;
|
|
345
|
+
/** 歧义描述 */
|
|
346
|
+
description: string;
|
|
347
|
+
/** 影响范围 */
|
|
348
|
+
impactScope: string[];
|
|
349
|
+
/** 可能的解决方案 */
|
|
350
|
+
possibleSolutions?: string[];
|
|
351
|
+
/** 相关文件 */
|
|
352
|
+
relatedFiles?: string[];
|
|
353
|
+
/** 相关任务 ID */
|
|
354
|
+
relatedTaskIds?: string[];
|
|
355
|
+
}
|
|
356
|
+
/**
|
|
357
|
+
* 歧义报告 - Agent 输出的歧义检测结果
|
|
358
|
+
*/
|
|
359
|
+
export interface AmbiguityReport {
|
|
360
|
+
/** 报告唯一标识 */
|
|
361
|
+
id: string;
|
|
362
|
+
/** 关联的任务 ID */
|
|
363
|
+
taskId: string;
|
|
364
|
+
/** 检测阶段: 'pre_execution' 执行前 | 'during_execution' 执行中 */
|
|
365
|
+
detectionPhase: 'pre_execution' | 'during_execution';
|
|
366
|
+
/** 检测到的歧义列表 */
|
|
367
|
+
ambiguities: AmbiguityItem[];
|
|
368
|
+
/** 是否存在歧义 */
|
|
369
|
+
hasAmbiguity: boolean;
|
|
370
|
+
/** 最高严重程度 (用于快速判断) */
|
|
371
|
+
maxSeverity?: AmbiguitySeverity;
|
|
372
|
+
/** 检测时间 */
|
|
373
|
+
detectedAt: string;
|
|
374
|
+
/** 建议的处理策略 */
|
|
375
|
+
suggestedStrategy?: 'ask_immediate' | 'write_meeting' | 'continue';
|
|
376
|
+
/** 建议的问题列表 (用于 AskUserQuestion) */
|
|
377
|
+
suggestedQuestions?: string[];
|
|
378
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "openmatrix",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.16",
|
|
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",
|
|
@@ -51,6 +51,7 @@
|
|
|
51
51
|
"devDependencies": {
|
|
52
52
|
"@typescript-eslint/eslint-plugin": "^8.58.1",
|
|
53
53
|
"@typescript-eslint/parser": "^8.58.1",
|
|
54
|
+
"@vitest/coverage-v8": "^1.6.1",
|
|
54
55
|
"eslint": "^10.2.0",
|
|
55
56
|
"vitest": "^1.6.0"
|
|
56
57
|
},
|
package/skills/auto.md
CHANGED
|
@@ -154,7 +154,7 @@ openmatrix complete TASK-XXX --success # 标记完成 + 更新统计(含
|
|
|
154
154
|
# 提交验证(防止 commit 静默失败):
|
|
155
155
|
git status --porcelain # 检查是否有未提交的文件
|
|
156
156
|
# 如果有未提交文件 → 必须手动提交:
|
|
157
|
-
git add
|
|
157
|
+
git add . && git commit -m "feat(TASK-XXX): 任务标题"
|
|
158
158
|
|
|
159
159
|
openmatrix step --json # 获取下一个任务 + 检查是否全部完成
|
|
160
160
|
```
|
|
@@ -167,7 +167,68 @@ openmatrix step --json # 获取下一个任务 + 检查是
|
|
|
167
167
|
4. 如果返回 `status: "blocked"` → 有阻塞任务需要处理
|
|
168
168
|
</LOOP-ENFORCEMENT>
|
|
169
169
|
|
|
170
|
-
|
|
170
|
+
#### 6.1 歧义检测机制(全自动模式)
|
|
171
|
+
|
|
172
|
+
**Agent 输出中可能包含歧义报告(JSON 格式):**
|
|
173
|
+
|
|
174
|
+
当 Agent 输出包含以下标记时,表示检测到歧义:
|
|
175
|
+
```
|
|
176
|
+
<AMBIGUITY_REPORT>
|
|
177
|
+
{
|
|
178
|
+
"ambiguities": [
|
|
179
|
+
{
|
|
180
|
+
"type": "missing_info" | "conflicting_req" | "unclear_scope" | "tech_choice" | "edge_case",
|
|
181
|
+
"severity": "critical" | "high" | "medium" | "low",
|
|
182
|
+
"description": "歧义描述",
|
|
183
|
+
"suggestions": ["建议1", "建议2"]
|
|
184
|
+
}
|
|
185
|
+
],
|
|
186
|
+
"overallSeverity": "critical" | "high" | "medium" | "low"
|
|
187
|
+
}
|
|
188
|
+
</AMBIGUITY_REPORT>
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
**5 种歧义类型说明:**
|
|
192
|
+
|
|
193
|
+
| 类型 | 说明 | 示例 |
|
|
194
|
+
|------|------|------|
|
|
195
|
+
| `missing_info` | 缺失关键信息 | "未指定数据库类型" |
|
|
196
|
+
| `conflicting_req` | 需求冲突 | "既要高性能又要低成本" |
|
|
197
|
+
| `unclear_scope` | 范围不清晰 | "是否包含历史数据处理?" |
|
|
198
|
+
| `tech_choice` | 技术选型歧义 | "用 REST 还是 GraphQL?" |
|
|
199
|
+
| `edge_case` | 边界情况未定义 | "超过限制时如何处理?" |
|
|
200
|
+
|
|
201
|
+
#### 6.2 歧义处理策略(全自动模式)
|
|
202
|
+
|
|
203
|
+
**在 `/om:auto` 全自动模式下,所有歧义都写入 Meeting 继续执行,不中断流程:**
|
|
204
|
+
|
|
205
|
+
| 严重程度 | 处理方式 |
|
|
206
|
+
|---------|---------|
|
|
207
|
+
| **Critical** | Meeting + 继续执行其他任务 |
|
|
208
|
+
| **High** | Meeting + 继续执行其他任务 |
|
|
209
|
+
| **Medium** | Meeting + 继续执行其他任务 |
|
|
210
|
+
| **Low** | Meeting + 继续执行其他任务 |
|
|
211
|
+
|
|
212
|
+
**全自动模式特点:**
|
|
213
|
+
- ❌ **不使用 AskUserQuestion** — 全自动执行,零人工干预
|
|
214
|
+
- ✅ **所有歧义写入 Meeting** — 执行完成后统一展示
|
|
215
|
+
- ✅ **继续执行其他任务** — 最大化并行度,无阻塞等待
|
|
216
|
+
|
|
217
|
+
**Meeting 处理流程:**
|
|
218
|
+
```bash
|
|
219
|
+
# 检测到歧义时,写入 Meeting 记录并继续执行
|
|
220
|
+
openmatrix meeting --create --task TASK-XXX --reason "歧义: ${description}" --severity ${overallSeverity}
|
|
221
|
+
|
|
222
|
+
# 继续执行下一个任务
|
|
223
|
+
openmatrix step --json
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
**执行完成后提示用户:**
|
|
227
|
+
```
|
|
228
|
+
⚠️ 检测到 N 个歧义记录,请使用 `/om:meeting` 统一处理
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
#### 6.3 执行 Agent 任务
|
|
171
232
|
|
|
172
233
|
```typescript
|
|
173
234
|
Agent({
|
|
@@ -246,7 +307,7 @@ openmatrix step --json
|
|
|
246
307
|
Agent-1 完成 → 写入 context.md → Agent-2 读取 Agent-1 的上下文 → 写入 context.md → ...
|
|
247
308
|
```
|
|
248
309
|
```bash
|
|
249
|
-
git add
|
|
310
|
+
git add . && git commit -m "$(cat <<'EOF'
|
|
250
311
|
feat: 任务标题
|
|
251
312
|
|
|
252
313
|
改动点1
|
package/skills/debug.md
CHANGED
package/skills/feature.md
CHANGED
|
@@ -20,6 +20,7 @@ priority: high
|
|
|
20
20
|
## 执行顺序 - 必须严格按此顺序,不得跳过
|
|
21
21
|
|
|
22
22
|
```
|
|
23
|
+
Step 0: Git 前置检查与持久化初始化(必须执行)
|
|
23
24
|
Step 1: 接收任务输入(参数、文件、或询问用户)
|
|
24
25
|
Step 2: AI 自动判断任务边界(不符合条件才询问切换)
|
|
25
26
|
Step 3: 收集项目上下文(技术栈、目录结构、CLAUDE.md)
|
|
@@ -45,6 +46,39 @@ Step 11: 输出执行摘要并清理
|
|
|
45
46
|
|
|
46
47
|
<process>
|
|
47
48
|
|
|
49
|
+
## Step 0: Git 前置检查与持久化初始化(必须执行)
|
|
50
|
+
|
|
51
|
+
**检查 Git 仓库:**
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
ls -la .git 2>/dev/null || echo "NOT_INITIALIZED"
|
|
55
|
+
git status --porcelain
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
| 检查结果 | 处理 |
|
|
59
|
+
|---------|------|
|
|
60
|
+
| `NOT_INITIALIZED` | AskUserQuestion 是否初始化 git |
|
|
61
|
+
| 有未提交文件 | AskUserQuestion 处理方式(暂存/忽略/取消) |
|
|
62
|
+
| 干净 | 继续执行 |
|
|
63
|
+
|
|
64
|
+
**初始化持久化状态:**
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
mkdir -p .openmatrix
|
|
68
|
+
cat > .openmatrix/feature-session.json << 'EOF'
|
|
69
|
+
{
|
|
70
|
+
"sessionId": "FEATURE-$(date +%Y%m%d%H%M%S)",
|
|
71
|
+
"status": "running",
|
|
72
|
+
"tasks": [],
|
|
73
|
+
"currentTaskIndex": 0,
|
|
74
|
+
"quality": null,
|
|
75
|
+
"failureCount": {}
|
|
76
|
+
}
|
|
77
|
+
EOF
|
|
78
|
+
echo '' > .openmatrix/feature-context.md
|
|
79
|
+
echo '' > .openmatrix/feature-progress.md
|
|
80
|
+
```
|
|
81
|
+
|
|
48
82
|
## Step 1: 接收任务输入
|
|
49
83
|
|
|
50
84
|
**检查 `$ARGUMENTS`:**
|
|
@@ -96,35 +130,33 @@ AskUserQuestion: `header: "任务复杂度"`, `multiSelect: false`
|
|
|
96
130
|
| 切换到 /om:start | 使用完整流程 |
|
|
97
131
|
| 继续用 /om:feature | 强制使用轻量流程(可能无法完整追踪) |
|
|
98
132
|
|
|
99
|
-
## Step 3:
|
|
133
|
+
## Step 3: 收集项目上下文并写入文件
|
|
100
134
|
|
|
101
|
-
|
|
135
|
+
**收集并写入上下文文件:**
|
|
102
136
|
|
|
103
137
|
```bash
|
|
104
|
-
|
|
105
|
-
cat package.json | grep -E '"(react|vue|angular|next|express|fastify|koa|typeorm|prisma|sequelize|mongoose|jest|vitest|playwright|cypress)"' || echo "未检测到常见框架"
|
|
138
|
+
mkdir -p .openmatrix
|
|
106
139
|
|
|
107
|
-
#
|
|
108
|
-
|
|
140
|
+
# 写入上下文文件头
|
|
141
|
+
echo "# 项目上下文" > .openmatrix/feature-context.md
|
|
142
|
+
echo "" >> .openmatrix/feature-context.md
|
|
109
143
|
|
|
110
|
-
#
|
|
111
|
-
|
|
112
|
-
|
|
144
|
+
# 收集技术栈并写入文件
|
|
145
|
+
echo "## 技术栈" >> .openmatrix/feature-context.md
|
|
146
|
+
cat package.json 2>/dev/null | grep -E '"(react|vue|angular|next|express|fastify|koa|typeorm|prisma|sequelize|mongoose|jest|vitest|playwright|cypress)"' >> .openmatrix/feature-context.md || echo "未检测到常见框架" >> .openmatrix/feature-context.md
|
|
147
|
+
echo "" >> .openmatrix/feature-context.md
|
|
113
148
|
|
|
114
|
-
|
|
149
|
+
# 收集目录结构并写入文件
|
|
150
|
+
echo "## 目录结构" >> .openmatrix/feature-context.md
|
|
151
|
+
find . -maxdepth 2 -type d -not -path '*/node_modules/*' -not -path '*/.git/*' -not -path '*/dist/*' -not -path '*/.openmatrix/*' 2>/dev/null | head -30 >> .openmatrix/feature-context.md
|
|
152
|
+
echo "" >> .openmatrix/feature-context.md
|
|
115
153
|
|
|
154
|
+
# 读取 CLAUDE.md 并写入文件
|
|
155
|
+
echo "## 项目规范(来自 CLAUDE.md)" >> .openmatrix/feature-context.md
|
|
156
|
+
cat CLAUDE.md 2>/dev/null | head -50 >> .openmatrix/feature-context.md || echo "无 CLAUDE.md" >> .openmatrix/feature-context.md
|
|
116
157
|
```
|
|
117
|
-
## 项目上下文
|
|
118
158
|
|
|
119
|
-
|
|
120
|
-
${从 package.json 提取的关键依赖}
|
|
121
|
-
|
|
122
|
-
### 目录结构
|
|
123
|
-
${顶层目录结构}
|
|
124
|
-
|
|
125
|
-
### 项目规范(来自 CLAUDE.md)
|
|
126
|
-
${CLAUDE.md 前 50 行,包含构建/测试命令、架构概述、开发约定}
|
|
127
|
-
```
|
|
159
|
+
上下文已写入 `.openmatrix/feature-context.md`,后续 Agent 会读取此文件。
|
|
128
160
|
|
|
129
161
|
## Step 4: AI 拆分为 2-5 个小任务块
|
|
130
162
|
|
|
@@ -191,7 +223,7 @@ TodoWrite({
|
|
|
191
223
|
})
|
|
192
224
|
```
|
|
193
225
|
|
|
194
|
-
|
|
226
|
+
状态同时在会话和 `.openmatrix/feature-session.json` 中管理。
|
|
195
227
|
|
|
196
228
|
## Step 6: 问答确认
|
|
197
229
|
|
|
@@ -241,7 +273,56 @@ AskUserQuestion: `header: "确认计划"`, `multiSelect: false`
|
|
|
241
273
|
TodoWrite({ todos: [...] }) // 当前任务标记 in_progress
|
|
242
274
|
```
|
|
243
275
|
|
|
244
|
-
**7.2
|
|
276
|
+
**7.2 歧义检测与处理**
|
|
277
|
+
|
|
278
|
+
Agent 输出中可能包含歧义报告:
|
|
279
|
+
|
|
280
|
+
当 Agent 输出包含以下标记时,表示检测到歧义:
|
|
281
|
+
```
|
|
282
|
+
<AMBIGUITY_REPORT>
|
|
283
|
+
{
|
|
284
|
+
"ambiguities": [
|
|
285
|
+
{
|
|
286
|
+
"type": "missing_info" | "conflicting_req" | "unclear_scope" | "tech_choice" | "edge_case",
|
|
287
|
+
"severity": "critical" | "high" | "medium" | "low",
|
|
288
|
+
"description": "歧义描述",
|
|
289
|
+
"suggestions": ["建议1", "建议2"]
|
|
290
|
+
}
|
|
291
|
+
],
|
|
292
|
+
"overallSeverity": "critical" | "high" | "medium" | "low"
|
|
293
|
+
}
|
|
294
|
+
</AMBIGUITY_REPORT>
|
|
295
|
+
```
|
|
296
|
+
|
|
297
|
+
**5 种歧义类型说明:**
|
|
298
|
+
|
|
299
|
+
| 类型 | 说明 | 示例 |
|
|
300
|
+
|------|------|------|
|
|
301
|
+
| `missing_info` | 缺失关键信息 | "未指定数据库类型" |
|
|
302
|
+
| `conflicting_req` | 需求冲突 | "既要高性能又要低成本" |
|
|
303
|
+
| `unclear_scope` | 范围不清晰 | "是否包含历史数据处理?" |
|
|
304
|
+
| `tech_choice` | 技术选型歧义 | "用 REST 还是 GraphQL?" |
|
|
305
|
+
| `edge_case` | 边界情况未定义 | "超过限制时如何处理?" |
|
|
306
|
+
|
|
307
|
+
**歧义处理策略(轻量模式):**
|
|
308
|
+
|
|
309
|
+
| 严重程度 | 处理方式 |
|
|
310
|
+
|---------|---------|
|
|
311
|
+
| **Critical/High** | AskUserQuestion 立即确认 |
|
|
312
|
+
| **Medium/Low** | 写入进度文件,继续执行 |
|
|
313
|
+
|
|
314
|
+
**AskUserQuestion 处理(仅 Critical/High):**
|
|
315
|
+
|
|
316
|
+
AskUserQuestion: `header: "歧义确认"`, `multiSelect: false`
|
|
317
|
+
**question:** 检测到 ${severity} 级歧义:${description}。请确认处理方式
|
|
318
|
+
|
|
319
|
+
| label | description |
|
|
320
|
+
|-------|-------------|
|
|
321
|
+
| 提供信息 | 回答歧义相关问题,继续执行 |
|
|
322
|
+
| 跳过任务块 | 标记当前任务块为可选,继续执行下一个 |
|
|
323
|
+
| 修改方案 | 根据歧义调整方案后继续 |
|
|
324
|
+
|
|
325
|
+
**7.3 调用 Agent 执行**
|
|
245
326
|
|
|
246
327
|
```typescript
|
|
247
328
|
Agent({
|
|
@@ -249,6 +330,12 @@ Agent({
|
|
|
249
330
|
description: task.content,
|
|
250
331
|
prompt: `你是实现专家。执行以下任务块。
|
|
251
332
|
|
|
333
|
+
## 项目上下文(请读取文件)
|
|
334
|
+
请先读取 .openmatrix/feature-context.md 了解项目上下文。
|
|
335
|
+
|
|
336
|
+
## 前序任务结果(请读取文件)
|
|
337
|
+
请读取 .openmatrix/feature-progress.md 了解前序 Agent 的决策和发现。
|
|
338
|
+
|
|
252
339
|
## 整体任务
|
|
253
340
|
${taskDescription}
|
|
254
341
|
|
|
@@ -258,11 +345,6 @@ ${taskDescription}
|
|
|
258
345
|
- 质量等级:${quality}
|
|
259
346
|
- 前置任务完成状态:${previousTasksStatus}
|
|
260
347
|
|
|
261
|
-
${projectContext}
|
|
262
|
-
|
|
263
|
-
${agentMemory ? `## 前序任务结果(跨 Agent 上下文)
|
|
264
|
-
${agentMemory}` : ''}
|
|
265
|
-
|
|
266
348
|
## 质量要求
|
|
267
349
|
${quality === 'strict' ? `
|
|
268
350
|
- 必须使用 TDD:先写测试,再写实现
|
|
@@ -307,17 +389,19 @@ ${quality === 'strict' ? `
|
|
|
307
389
|
})
|
|
308
390
|
```
|
|
309
391
|
|
|
310
|
-
**7.3 等待 Agent
|
|
392
|
+
**7.3 等待 Agent 完成,写入进度文件**
|
|
311
393
|
|
|
312
|
-
Agent
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
${
|
|
394
|
+
Agent 完成后,将输出中的关键决策和建议写入 `.openmatrix/feature-progress.md` 文件:
|
|
395
|
+
|
|
396
|
+
```bash
|
|
397
|
+
# Agent 完成后,追加写入进度文件
|
|
398
|
+
echo "" >> .openmatrix/feature-progress.md
|
|
399
|
+
echo "## 任务 N: ${task.content}" >> .openmatrix/feature-progress.md
|
|
400
|
+
echo "${agentOutput}" >> .openmatrix/feature-progress.md
|
|
401
|
+
echo "" >> .openmatrix/feature-progress.md
|
|
318
402
|
```
|
|
319
403
|
|
|
320
|
-
这样后续 Agent
|
|
404
|
+
这样后续 Agent 能通过读取文件获取前序 Agent 的决策和发现。
|
|
321
405
|
|
|
322
406
|
## Step 8: 验证(按质量等级)
|
|
323
407
|
|
|
@@ -329,10 +413,14 @@ ${agentOutput}
|
|
|
329
413
|
|
|
330
414
|
| 质量等级 | 验证命令 |
|
|
331
415
|
|---------|---------|
|
|
332
|
-
| `strict` | `npm test -- --run && npm run lint && npm run test:coverage` |
|
|
333
|
-
| `balanced` | `npm test -- --run && npm run lint` |
|
|
416
|
+
| `strict` | `npm test -- --run && npm run lint && npm run test:coverage && npm audit --audit-level=moderate` |
|
|
417
|
+
| `balanced` | `npm test -- --run && npm run lint && npm audit --audit-level=moderate` |
|
|
334
418
|
| `fast` | 跳过验证 |
|
|
335
419
|
|
|
420
|
+
**覆盖率阈值检查说明:**
|
|
421
|
+
- strict 模式要求 >80% 覆盖率,`npm run test:coverage` 命令应输出覆盖率报告
|
|
422
|
+
- balanced 模式要求 >60% 覆盖率,建议定期检查覆盖率报告
|
|
423
|
+
|
|
336
424
|
**8.2 E2E 验证(如果用户选择)**
|
|
337
425
|
- 功能测试:`npm run test:e2e`
|
|
338
426
|
- 视觉验证:启动 Playwright 截图对比
|
|
@@ -357,7 +445,7 @@ fi
|
|
|
357
445
|
**验证失败处理:**
|
|
358
446
|
- 自动展示验证失败详情(最后 30 行输出)
|
|
359
447
|
- 停止执行流程
|
|
360
|
-
- 提示用户修复后使用 `/om:resume` 继续
|
|
448
|
+
- 提示用户修复后使用 `/om:resume-feature` 继续
|
|
361
449
|
|
|
362
450
|
**验证成功处理:**
|
|
363
451
|
- 继续执行 Step 9 Git 提交
|
|
@@ -366,8 +454,14 @@ fi
|
|
|
366
454
|
|
|
367
455
|
**⛔ 验证通过后必须立即提交,不得积累多个任务块**
|
|
368
456
|
|
|
457
|
+
**只提交本次任务修改的文件(而非 `git add -A`):**
|
|
458
|
+
|
|
369
459
|
```bash
|
|
370
|
-
|
|
460
|
+
# 获取本次任务修改的文件列表(从 Agent 输出中提取)
|
|
461
|
+
git status --porcelain
|
|
462
|
+
|
|
463
|
+
# 只提交任务涉及的文件
|
|
464
|
+
git add ${modifiedFiles}
|
|
371
465
|
git commit -m "$(cat <<'EOF'
|
|
372
466
|
feat(feature): ${originalTask} - ${currentChunk}
|
|
373
467
|
|
|
@@ -420,8 +514,8 @@ ${decisions}
|
|
|
420
514
|
|
|
421
515
|
**清理操作:**
|
|
422
516
|
- TodoWrite 所有任务保持 completed 状态
|
|
423
|
-
-
|
|
424
|
-
-
|
|
517
|
+
- 持久化文件可选择保留或手动清理
|
|
518
|
+
- 任务完成后状态标记为 `completed`
|
|
425
519
|
|
|
426
520
|
</process>
|
|
427
521
|
|
|
@@ -474,12 +568,12 @@ $ARGUMENTS
|
|
|
474
568
|
|
|
475
569
|
## 与其他指令的区别
|
|
476
570
|
|
|
477
|
-
| 指令 | 适用场景 | 任务文件 | 问答 | 验证 |
|
|
478
|
-
|
|
479
|
-
| `/om:feature` | 小需求(≤100字,单一功能) | ❌ | 质量+E2E | 按等级 |
|
|
480
|
-
| `/om:start` | 标准任务 | ✅ | 质量+E2E+模式 | 按等级 |
|
|
481
|
-
| `/om:brainstorm` | 复杂任务 | ✅ | 设计问答 | 按等级 |
|
|
482
|
-
| `/om:auto` | 全自动执行 | ✅ | 无 | 按等级 |
|
|
571
|
+
| 指令 | 适用场景 | 任务文件 | 问答 | 验证 | 持久化 |
|
|
572
|
+
|-----|---------|:-------:|:----:|:----:|:-----:|
|
|
573
|
+
| `/om:feature` | 小需求(≤100字,单一功能) | ❌ | 质量+E2E | 按等级 | 必须 |
|
|
574
|
+
| `/om:start` | 标准任务 | ✅ | 质量+E2E+模式 | 按等级 | 必须 |
|
|
575
|
+
| `/om:brainstorm` | 复杂任务 | ✅ | 设计问答 | 按等级 | 必须 |
|
|
576
|
+
| `/om:auto` | 全自动执行 | ✅ | 无 | 按等级 | 必须 |
|
|
483
577
|
|
|
484
578
|
## 路由触发条件
|
|
485
579
|
|
|
@@ -492,13 +586,14 @@ $ARGUMENTS
|
|
|
492
586
|
## 错误处理流程
|
|
493
587
|
|
|
494
588
|
```
|
|
495
|
-
验证失败 → 停止执行 → 展示错误详情 → 提示用户修复 →
|
|
589
|
+
验证失败 → 停止执行 → 展示错误详情 → 提示用户修复 → 使用 /om:resume-feature 恢复
|
|
496
590
|
```
|
|
497
591
|
|
|
498
592
|
| 错误 | 处理 |
|
|
499
593
|
|-----|-----|
|
|
500
594
|
| 测试失败 | 停止,提示用户修复 |
|
|
501
595
|
| Lint 错误 | 停止,提示用户修复 |
|
|
596
|
+
| 安全扫描失败 | 停止,提示用户修复 |
|
|
502
597
|
| Agent 超时 | 询问重试或跳过 |
|
|
503
598
|
| Git 失败 | 提示手动处理 |
|
|
504
599
|
|
|
@@ -534,8 +629,14 @@ type: feat/fix/test/refactor/docs
|
|
|
534
629
|
|
|
535
630
|
## 恢复执行
|
|
536
631
|
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
632
|
+
如果验证失败需要修复:
|
|
633
|
+
|
|
634
|
+
使用 `/om:resume-feature` 继续执行(读取 `.openmatrix/feature-session.json`)
|
|
635
|
+
|
|
636
|
+
## 挡久化文件说明
|
|
637
|
+
|
|
638
|
+
执行过程中产生以下文件:
|
|
639
|
+
- `.openmatrix/feature-session.json` - 会话状态(任务列表、当前索引、质量等级)
|
|
640
|
+
- `.openmatrix/feature-context.md` - 项目上下文
|
|
641
|
+
- `.openmatrix/feature-progress.md` - Agent 执行进度
|
|
541
642
|
</notes>
|
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: om:resume-feature
|
|
3
|
+
description: "恢复中断的 /om:feature 流程。读取 .openmatrix/feature-session.json 状态文件,继续执行剩余任务。"
|
|
4
|
+
priority: high
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
<NO-OTHER-SKILLS>
|
|
8
|
+
**绝对禁止**调用以下技能:
|
|
9
|
+
- ❌ superpowers:brainstorming → 用 /om:brainstorm 代替
|
|
10
|
+
- ❌ superpowers:* → 全部被 OpenMatrix 替代
|
|
11
|
+
- ❌ gsd:* → 全部被 OpenMatrix 替代
|
|
12
|
+
- ❌ /om:start / /om:auto → 本 skill 是轻量恢复,不调用完整流程
|
|
13
|
+
</NO-OTHER-SKILLS>
|
|
14
|
+
|
|
15
|
+
<objective>
|
|
16
|
+
恢复中断的轻量级小需求开发流程:读取持久化状态,继续执行剩余任务块。
|
|
17
|
+
</objective>
|
|
18
|
+
|
|
19
|
+
<process>
|
|
20
|
+
|
|
21
|
+
## Step 1: 检查持久化文件是否存在
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
ls -la .openmatrix/feature-session.json 2>/dev/null || echo "NOT_FOUND"
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
| 检查结果 | 处理 |
|
|
28
|
+
|---------|------|
|
|
29
|
+
| `NOT_FOUND` | 提示"未找到持久化文件,请使用 /om:feature 重新开始"并退出 |
|
|
30
|
+
| 存在 | 继续执行 |
|
|
31
|
+
|
|
32
|
+
## Step 2: 读取会话状态
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
cat .openmatrix/feature-session.json
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
读取并解析以下信息:
|
|
39
|
+
- `sessionId` - 会话 ID
|
|
40
|
+
- `status` - 当前状态(running/paused/failed)
|
|
41
|
+
- `tasks` - 任务列表
|
|
42
|
+
- `currentTaskIndex` - 当前任务索引
|
|
43
|
+
- `quality` - 质量等级
|
|
44
|
+
- `failureCount` - 各任务失败次数统计
|
|
45
|
+
|
|
46
|
+
同时读取:
|
|
47
|
+
- `.openmatrix/feature-context.md` - 项目上下文
|
|
48
|
+
- `.openmatrix/feature-progress.md` - Agent 执行进度
|
|
49
|
+
|
|
50
|
+
## Step 3: 恢复 TodoWrite 状态
|
|
51
|
+
|
|
52
|
+
根据读取的任务列表,恢复 TodoWrite 状态:
|
|
53
|
+
|
|
54
|
+
```typescript
|
|
55
|
+
TodoWrite({
|
|
56
|
+
todos: tasks.map((task, index) => ({
|
|
57
|
+
activeForm: `正在执行 ${task.content}`,
|
|
58
|
+
content: task.content,
|
|
59
|
+
status: index < currentTaskIndex ? "completed" :
|
|
60
|
+
index === currentTaskIndex ? "in_progress" : "pending"
|
|
61
|
+
}))
|
|
62
|
+
})
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## Step 4: 展示恢复状态
|
|
66
|
+
|
|
67
|
+
```
|
|
68
|
+
🔄 恢复会话:${sessionId}
|
|
69
|
+
|
|
70
|
+
📊 当前状态:
|
|
71
|
+
- 质量等级:${quality}
|
|
72
|
+
- 已完成任务:${completedCount}/${totalCount}
|
|
73
|
+
- 当前任务:${currentTask.content}
|
|
74
|
+
- 失败次数:${failureCount[currentTaskIndex] || 0}
|
|
75
|
+
|
|
76
|
+
📝 已完成的决策(来自 feature-progress.md):
|
|
77
|
+
${显示前序任务的关键决策}
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
## Step 5: 继续执行当前任务
|
|
81
|
+
|
|
82
|
+
从 `currentTaskIndex` 位置继续执行:
|
|
83
|
+
|
|
84
|
+
**5.1 如果当前任务是 in_progress 状态(之前失败):**
|
|
85
|
+
|
|
86
|
+
询问用户:
|
|
87
|
+
AskUserQuestion: `header: "继续方式"`, `multiSelect: false`
|
|
88
|
+
**question:** 当前任务之前验证失败,如何继续?
|
|
89
|
+
|
|
90
|
+
| label | description |
|
|
91
|
+
|-------|-------------|
|
|
92
|
+
| `重试当前任务` | 重新执行当前任务块 |
|
|
93
|
+
| `跳过当前任务` | 标记为完成,继续下一任务(风险较高) |
|
|
94
|
+
| `重新拆分` | 返回 /om:feature 重新规划 |
|
|
95
|
+
|
|
96
|
+
**5.2 如果当前任务是 pending 状态(正常恢复):**
|
|
97
|
+
|
|
98
|
+
直接调用 Agent 执行:
|
|
99
|
+
|
|
100
|
+
```typescript
|
|
101
|
+
Agent({
|
|
102
|
+
subagent_type: "general-purpose",
|
|
103
|
+
description: currentTask.content,
|
|
104
|
+
prompt: `你是实现专家。执行以下任务块。
|
|
105
|
+
|
|
106
|
+
## 项目上下文(请读取文件)
|
|
107
|
+
请先读取 .openmatrix/feature-context.md 了解项目上下文。
|
|
108
|
+
|
|
109
|
+
## 前序任务结果(请读取文件)
|
|
110
|
+
请读取 .openmatrix/feature-progress.md 了解前序 Agent 的决策和发现。
|
|
111
|
+
|
|
112
|
+
## 当前任务
|
|
113
|
+
- 任务名称:${currentTask.content}
|
|
114
|
+
- 预估文件:${currentTask.files}
|
|
115
|
+
- 质量等级:${quality}
|
|
116
|
+
|
|
117
|
+
## 质量要求
|
|
118
|
+
${quality === 'strict' ? `
|
|
119
|
+
- 必须使用 TDD:先写测试,再写实现
|
|
120
|
+
- 测试覆盖率要求:>80%
|
|
121
|
+
- 必须通过严格 Lint
|
|
122
|
+
- 必须通过安全扫描
|
|
123
|
+
` : quality === 'balanced' ? `
|
|
124
|
+
- 测试覆盖率要求:>60%
|
|
125
|
+
- 必须通过 Lint
|
|
126
|
+
- 必须通过安全扫描
|
|
127
|
+
` : `
|
|
128
|
+
- 无质量门禁要求
|
|
129
|
+
`}
|
|
130
|
+
|
|
131
|
+
## 实施原则
|
|
132
|
+
1. 先阅读预估文件中的现有代码,理解上下文后再动手
|
|
133
|
+
2. 只修改当前任务相关的文件
|
|
134
|
+
3. 不做"顺便"的重构或优化
|
|
135
|
+
|
|
136
|
+
## 禁止行为
|
|
137
|
+
❌ 执行 git commit(由主流程处理)
|
|
138
|
+
❌ 执行 git checkout/merge/pull/push/rebase/branch
|
|
139
|
+
❌ 修改与当前任务无关的文件
|
|
140
|
+
|
|
141
|
+
✅ 允许:git status, git diff, git log`,
|
|
142
|
+
run_in_background: true
|
|
143
|
+
})
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
## Step 6: 验证(按质量等级)
|
|
147
|
+
|
|
148
|
+
| 质量等级 | 验证命令 |
|
|
149
|
+
|---------|---------|
|
|
150
|
+
| `strict` | `npm test -- --run && npm run lint && npm run test:coverage && npm audit --audit-level=moderate` |
|
|
151
|
+
| `balanced` | `npm test -- --run && npm run lint && npm audit --audit-level=moderate` |
|
|
152
|
+
| `fast` | 跳过验证 |
|
|
153
|
+
|
|
154
|
+
验证失败处理:
|
|
155
|
+
- 更新 `.openmatrix/feature-session.json` 的 `failureCount`
|
|
156
|
+
- 如果同一任务失败 3 次,提示用户质疑拆分方案
|
|
157
|
+
- 停止执行,提示再次使用 `/om:resume-feature`
|
|
158
|
+
|
|
159
|
+
## Step 7: Git 提交
|
|
160
|
+
|
|
161
|
+
验证通过后:
|
|
162
|
+
|
|
163
|
+
```bash
|
|
164
|
+
git status --porcelain
|
|
165
|
+
git add ${modifiedFiles}
|
|
166
|
+
git commit -m "feat(feature): ${sessionId} - ${currentTask.content}"
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
## Step 8: 更新持久化状态
|
|
170
|
+
|
|
171
|
+
```bash
|
|
172
|
+
# 更新 currentTaskIndex
|
|
173
|
+
cat > .openmatrix/feature-session.json << EOF
|
|
174
|
+
{
|
|
175
|
+
"sessionId": "${sessionId}",
|
|
176
|
+
"status": "running",
|
|
177
|
+
"tasks": ${tasks},
|
|
178
|
+
"currentTaskIndex": ${currentTaskIndex + 1},
|
|
179
|
+
"quality": "${quality}",
|
|
180
|
+
"failureCount": ${failureCount}
|
|
181
|
+
}
|
|
182
|
+
EOF
|
|
183
|
+
|
|
184
|
+
# 更新进度文件
|
|
185
|
+
echo "## 任务 ${currentTaskIndex}: ${currentTask.content}" >> .openmatrix/feature-progress.md
|
|
186
|
+
echo "${agentOutput}" >> .openmatrix/feature-progress.md
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
## Step 9: 继续下一任务或完成
|
|
190
|
+
|
|
191
|
+
- 如果还有 pending 任务:回到 Step 5
|
|
192
|
+
- 如果所有任务完成:执行 Step 10
|
|
193
|
+
|
|
194
|
+
## Step 10: 全部任务完成
|
|
195
|
+
|
|
196
|
+
```bash
|
|
197
|
+
# 最终整体验证
|
|
198
|
+
npm test -- --run
|
|
199
|
+
|
|
200
|
+
# 清理持久化文件(可选)
|
|
201
|
+
# 用户可选择保留或删除
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
输出执行摘要并更新状态为 `completed`。
|
|
205
|
+
|
|
206
|
+
</process>
|
|
207
|
+
|
|
208
|
+
<notes>
|
|
209
|
+
## 恢复条件
|
|
210
|
+
|
|
211
|
+
- 必须存在 `.openmatrix/feature-session.json`
|
|
212
|
+
- 必须由 `/om:feature` 启用持久化后产生
|
|
213
|
+
|
|
214
|
+
## 失败次数限制
|
|
215
|
+
|
|
216
|
+
同一任务失败 3 次以上:
|
|
217
|
+
- 建议用户质疑拆分方案
|
|
218
|
+
- 提示可能需要切换到 `/om:start`
|
|
219
|
+
|
|
220
|
+
## 持久化文件说明
|
|
221
|
+
|
|
222
|
+
| 文件 | 内容 |
|
|
223
|
+
|-----|------|
|
|
224
|
+
| `feature-session.json` | 会话状态、任务列表、当前索引、质量等级、失败次数 |
|
|
225
|
+
| `feature-context.md` | 项目上下文(技术栈、目录结构、CLAUDE.md) |
|
|
226
|
+
| `feature-progress.md` | 各 Agent 的执行决策和发现 |
|
|
227
|
+
</notes>
|
package/skills/start.md
CHANGED
|
@@ -382,14 +382,77 @@ openmatrix complete TASK-XXX --success --summary "决策: xxx; 文件: xxx"
|
|
|
382
382
|
# 提交验证(防止 commit 静默失败):
|
|
383
383
|
git status --porcelain # 检查是否有未提交的文件
|
|
384
384
|
# 如果有未提交文件 → 必须手动提交:
|
|
385
|
-
git add
|
|
385
|
+
git add . && git commit -m "feat(TASK-XXX): 任务标题"
|
|
386
386
|
|
|
387
387
|
openmatrix step --json # 获取下一个任务 + 检查是否全部完成
|
|
388
388
|
```
|
|
389
389
|
`openmatrix step` 会从磁盘读取真实状态,不依赖上下文记忆。
|
|
390
390
|
</LOOP-ENFORCEMENT>
|
|
391
391
|
|
|
392
|
-
|
|
392
|
+
#### 11.1 歧义检测机制
|
|
393
|
+
|
|
394
|
+
**Agent 输出中可能包含歧义报告(JSON 格式):**
|
|
395
|
+
|
|
396
|
+
当 Agent 输出包含以下标记时,表示检测到歧义:
|
|
397
|
+
```
|
|
398
|
+
<AMBIGUITY_REPORT>
|
|
399
|
+
{
|
|
400
|
+
"ambiguities": [
|
|
401
|
+
{
|
|
402
|
+
"type": "missing_info" | "conflicting_req" | "unclear_scope" | "tech_choice" | "edge_case",
|
|
403
|
+
"severity": "critical" | "high" | "medium" | "low",
|
|
404
|
+
"description": "歧义描述",
|
|
405
|
+
"suggestions": ["建议1", "建议2"]
|
|
406
|
+
}
|
|
407
|
+
],
|
|
408
|
+
"overallSeverity": "critical" | "high" | "medium" | "low"
|
|
409
|
+
}
|
|
410
|
+
</AMBIGUITY_REPORT>
|
|
411
|
+
```
|
|
412
|
+
|
|
413
|
+
**5 种歧义类型说明:**
|
|
414
|
+
|
|
415
|
+
| 类型 | 说明 | 示例 |
|
|
416
|
+
|------|------|------|
|
|
417
|
+
| `missing_info` | 缺失关键信息 | "未指定数据库类型" |
|
|
418
|
+
| `conflicting_req` | 需求冲突 | "既要高性能又要低成本" |
|
|
419
|
+
| `unclear_scope` | 范围不清晰 | "是否包含历史数据处理?" |
|
|
420
|
+
| `tech_choice` | 技术选型歧义 | "用 REST 还是 GraphQL?" |
|
|
421
|
+
| `edge_case` | 边界情况未定义 | "超过限制时如何处理?" |
|
|
422
|
+
|
|
423
|
+
#### 11.2 歧义处理策略
|
|
424
|
+
|
|
425
|
+
根据 `overallSeverity` 和执行模式选择处理方式:
|
|
426
|
+
|
|
427
|
+
| 执行模式 | Critical/High | Medium/Low |
|
|
428
|
+
|---------|--------------|------------|
|
|
429
|
+
| **全自动执行** | Meeting + 继续执行 | Meeting + 继续执行 |
|
|
430
|
+
| **关键节点确认** | AskUserQuestion | Meeting + 继续执行 |
|
|
431
|
+
| **每阶段确认** | AskUserQuestion | Meeting + 继续执行 |
|
|
432
|
+
|
|
433
|
+
**Meeting 处理(写入阻塞记录):**
|
|
434
|
+
```bash
|
|
435
|
+
# 将歧义信息写入 Meeting 记录,继续执行其他任务
|
|
436
|
+
openmatrix meeting --create --task TASK-XXX --reason "歧义: ${description}" --severity ${severity}
|
|
437
|
+
```
|
|
438
|
+
|
|
439
|
+
**AskUserQuestion 处理(交互确认):**
|
|
440
|
+
|
|
441
|
+
AskUserQuestion: `header: "歧义确认"`, `multiSelect: false`
|
|
442
|
+
**question:** 检测到 ${severity} 级歧义:${description}。请确认处理方式
|
|
443
|
+
|
|
444
|
+
| label | description |
|
|
445
|
+
|-------|-------------|
|
|
446
|
+
| 提供信息 | 回答歧义相关问题,继续执行 |
|
|
447
|
+
| 跳过任务 | 标记当前任务为可选,继续执行其他任务 |
|
|
448
|
+
| 修改方案 | 根据歧义调整任务方案后继续 |
|
|
449
|
+
|
|
450
|
+
用户选择后:
|
|
451
|
+
- **提供信息** → 将用户输入作为上下文注入,继续执行当前任务
|
|
452
|
+
- **跳过任务** → `openmatrix complete TASK-XXX --skip --reason "用户选择跳过"`
|
|
453
|
+
- **修改方案** → 更新任务方案,重新执行当前任务
|
|
454
|
+
|
|
455
|
+
#### 11.3 执行 Agent 任务
|
|
393
456
|
|
|
394
457
|
```typescript
|
|
395
458
|
Agent({
|
|
@@ -538,7 +601,7 @@ openmatrix meeting --list
|
|
|
538
601
|
|
|
539
602
|
所有任务完成后,执行最终 Git 提交(**必须使用 HEREDOC 格式**):
|
|
540
603
|
```bash
|
|
541
|
-
git add
|
|
604
|
+
git add . && git commit -m "$(cat <<'EOF'
|
|
542
605
|
feat: 完成所有任务 - 任务总标题
|
|
543
606
|
|
|
544
607
|
改动点1
|