openmatrix 0.1.65 → 0.1.67
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 +1 -3
- package/dist/agents/agent-runner.js +10 -31
- package/dist/cli/commands/complete.js +19 -18
- package/dist/cli/commands/start.js +41 -55
- package/package.json +1 -1
- package/skills/start.md +123 -60
|
@@ -68,9 +68,7 @@ export declare class AgentRunner {
|
|
|
68
68
|
*/
|
|
69
69
|
buildExecutionPrompt(task: Task): Promise<string>;
|
|
70
70
|
/**
|
|
71
|
-
* 构建累积上下文 -
|
|
72
|
-
*
|
|
73
|
-
* 读取所有已完成任务的 context.md,为当前 Agent 提供前序 Agent 的决策和知识
|
|
71
|
+
* 构建累积上下文 - 从全局 context.md 读取前序 Agent 的决策和知识
|
|
74
72
|
*/
|
|
75
73
|
private buildAccumulatedContext;
|
|
76
74
|
/**
|
|
@@ -168,43 +168,22 @@ ${agentPrompt.instructions}
|
|
|
168
168
|
|
|
169
169
|
1. 完成任务后,更新任务状态文件: \`.openmatrix/tasks/${task.id}/task.json\`
|
|
170
170
|
2. 将执行结果写入: \`.openmatrix/tasks/${task.id}/artifacts/result.md\`
|
|
171
|
-
3.
|
|
172
|
-
|
|
171
|
+
3. 如需审批,创建审批请求: \`.openmatrix/approvals/\` 目录
|
|
172
|
+
|
|
173
|
+
注意: 任务完成后,由 Skill 调用 \`openmatrix complete\` 并传入 --summary 参数,
|
|
174
|
+
该摘要会自动追加到全局 \`.openmatrix/context.md\` 供后续 Agent 参考。
|
|
173
175
|
`;
|
|
174
176
|
}
|
|
175
177
|
/**
|
|
176
|
-
* 构建累积上下文 -
|
|
177
|
-
*
|
|
178
|
-
* 读取所有已完成任务的 context.md,为当前 Agent 提供前序 Agent 的决策和知识
|
|
178
|
+
* 构建累积上下文 - 从全局 context.md 读取前序 Agent 的决策和知识
|
|
179
179
|
*/
|
|
180
180
|
async buildAccumulatedContext(currentTask) {
|
|
181
181
|
const omPath = path.join(process.cwd(), '.openmatrix');
|
|
182
|
-
const
|
|
182
|
+
const contextFile = path.join(omPath, 'context.md');
|
|
183
183
|
try {
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
}
|
|
188
|
-
catch {
|
|
189
|
-
return '';
|
|
190
|
-
}
|
|
191
|
-
const contextParts = [];
|
|
192
|
-
// 异步读取目录
|
|
193
|
-
const taskDirs = (await fs.readdir(tasksDir)).filter(name => name.startsWith('TASK-'));
|
|
194
|
-
for (const taskId of taskDirs) {
|
|
195
|
-
const contextFile = path.join(tasksDir, taskId, 'context.md');
|
|
196
|
-
try {
|
|
197
|
-
const content = await fs.readFile(contextFile, 'utf-8');
|
|
198
|
-
const trimmed = content.trim();
|
|
199
|
-
if (trimmed) {
|
|
200
|
-
contextParts.push(`### ${taskId}\n${trimmed}`);
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
catch {
|
|
204
|
-
// 文件不存在或读取失败,跳过
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
if (contextParts.length === 0)
|
|
184
|
+
const content = await fs.readFile(contextFile, 'utf-8');
|
|
185
|
+
const trimmed = content.trim();
|
|
186
|
+
if (!trimmed)
|
|
208
187
|
return '';
|
|
209
188
|
return `
|
|
210
189
|
## 前序 Agent 共享上下文 (Agent Memory)
|
|
@@ -212,7 +191,7 @@ ${agentPrompt.instructions}
|
|
|
212
191
|
以下是之前执行的 Agent 留下的上下文信息,包含它们的决策、发现和注意事项。
|
|
213
192
|
你应该基于这些信息来工作,避免重复犯错或与已有决策冲突。
|
|
214
193
|
|
|
215
|
-
${
|
|
194
|
+
${trimmed}
|
|
216
195
|
`;
|
|
217
196
|
}
|
|
218
197
|
catch {
|
|
@@ -46,6 +46,7 @@ exports.completeCommand = new commander_1.Command('complete')
|
|
|
46
46
|
.option('--success', '标记为成功完成 (默认)', true)
|
|
47
47
|
.option('--failed', '标记为失败')
|
|
48
48
|
.option('--output <text>', '执行结果摘要')
|
|
49
|
+
.option('--summary <text>', 'Agent 执行摘要 (写入 context.md)')
|
|
49
50
|
.option('--error <text>', '错误信息 (失败时)')
|
|
50
51
|
.action(async (taskId, options) => {
|
|
51
52
|
const basePath = process.cwd();
|
|
@@ -101,27 +102,27 @@ exports.completeCommand = new commander_1.Command('complete')
|
|
|
101
102
|
currentPhase: allDone ? 'completed' : 'execution',
|
|
102
103
|
...(allDone ? { completedAt: now } : {})
|
|
103
104
|
});
|
|
104
|
-
// 5.
|
|
105
|
+
// 5. 追加写入全局 context.md (Agent Memory)
|
|
105
106
|
if (isSuccess) {
|
|
106
|
-
const
|
|
107
|
-
const
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
- [待补充]
|
|
114
|
-
|
|
115
|
-
### 创建/修改的文件
|
|
116
|
-
- [待补充]
|
|
117
|
-
|
|
118
|
-
### 重要发现
|
|
119
|
-
- [待补充]
|
|
107
|
+
const contextFile = path.join(omPath, 'context.md');
|
|
108
|
+
const timestamp = new Date().toISOString();
|
|
109
|
+
// 构建上下文内容
|
|
110
|
+
const summary = options.summary || '任务已完成';
|
|
111
|
+
const contextEntry = `## ${taskId} ${task.title}
|
|
112
|
+
- 时间: ${timestamp}
|
|
113
|
+
- 摘要: ${summary}
|
|
120
114
|
|
|
121
|
-
### 对后续任务的建议
|
|
122
|
-
- [待补充]
|
|
123
115
|
`;
|
|
124
|
-
|
|
116
|
+
try {
|
|
117
|
+
// 追加写入全局 context.md
|
|
118
|
+
let existingContent = '';
|
|
119
|
+
try {
|
|
120
|
+
existingContent = await fs.readFile(contextFile, 'utf-8');
|
|
121
|
+
}
|
|
122
|
+
catch {
|
|
123
|
+
// 文件不存在,创建新文件
|
|
124
|
+
}
|
|
125
|
+
await fs.writeFile(contextFile, existingContent + contextEntry, 'utf-8');
|
|
125
126
|
}
|
|
126
127
|
catch {
|
|
127
128
|
// 忽略写入错误
|
|
@@ -40,7 +40,6 @@ const state_manager_js_1 = require("../../storage/state-manager.js");
|
|
|
40
40
|
const task_parser_js_1 = require("../../orchestrator/task-parser.js");
|
|
41
41
|
const task_planner_js_1 = require("../../orchestrator/task-planner.js");
|
|
42
42
|
const approval_manager_js_1 = require("../../orchestrator/approval-manager.js");
|
|
43
|
-
const executor_js_1 = require("../../orchestrator/executor.js");
|
|
44
43
|
const gitignore_js_1 = require("../../utils/gitignore.js");
|
|
45
44
|
const index_js_1 = require("../../types/index.js");
|
|
46
45
|
const fs = __importStar(require("fs/promises"));
|
|
@@ -253,33 +252,26 @@ async function handleTasksJson(options, stateManager, state, omPath, basePath) {
|
|
|
253
252
|
}
|
|
254
253
|
return;
|
|
255
254
|
}
|
|
256
|
-
//
|
|
257
|
-
const
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
}
|
|
268
|
-
const result = await executor.step();
|
|
255
|
+
// 无审批点,返回任务列表供 Skill 执行
|
|
256
|
+
const allTasks = await stateManager.listTasks();
|
|
257
|
+
const subagentTasks = allTasks.map(t => ({
|
|
258
|
+
taskId: t.id,
|
|
259
|
+
agentType: t.assignedAgent,
|
|
260
|
+
title: t.title,
|
|
261
|
+
description: t.description,
|
|
262
|
+
priority: t.priority,
|
|
263
|
+
dependencies: t.dependencies,
|
|
264
|
+
timeout: t.timeout
|
|
265
|
+
}));
|
|
269
266
|
if (options.json) {
|
|
270
267
|
console.log(JSON.stringify({
|
|
271
|
-
status:
|
|
272
|
-
message:
|
|
273
|
-
statistics:
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
isolation: t.isolation,
|
|
279
|
-
taskId: t.taskId,
|
|
280
|
-
agentType: t.agentType,
|
|
281
|
-
timeout: t.timeout
|
|
282
|
-
})),
|
|
268
|
+
status: 'tasks_ready',
|
|
269
|
+
message: '任务已准备就绪,等待 Skill 执行',
|
|
270
|
+
statistics: {
|
|
271
|
+
totalTasks: allTasks.length,
|
|
272
|
+
pending: allTasks.filter(t => t.status === 'pending').length
|
|
273
|
+
},
|
|
274
|
+
subagentTasks,
|
|
283
275
|
taskInfo: {
|
|
284
276
|
title: tasksInput.title,
|
|
285
277
|
description: tasksInput.description,
|
|
@@ -289,9 +281,9 @@ async function handleTasksJson(options, stateManager, state, omPath, basePath) {
|
|
|
289
281
|
}
|
|
290
282
|
else {
|
|
291
283
|
console.log(`\n📋 ${tasksInput.title} - ${subTasks.length} 个子任务已创建`);
|
|
292
|
-
console.log(`🎯
|
|
293
|
-
console.log(`
|
|
294
|
-
console.log('\n🚀
|
|
284
|
+
console.log(`🎯 执行模式:${executionMode}`);
|
|
285
|
+
console.log(` 质量级别:${qualityLevel}`);
|
|
286
|
+
console.log('\n🚀 等待 Skill 执行任务...');
|
|
295
287
|
console.log(' 使用 /om:status 查看进度');
|
|
296
288
|
}
|
|
297
289
|
}
|
|
@@ -426,32 +418,26 @@ async function handleAutoParse(input, options, stateManager, state) {
|
|
|
426
418
|
}
|
|
427
419
|
return;
|
|
428
420
|
}
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
}
|
|
440
|
-
const result = await executor.step();
|
|
421
|
+
// 无审批点,返回任务列表供 Skill 执行
|
|
422
|
+
const allTasks = await stateManager.listTasks();
|
|
423
|
+
const subagentTasks = allTasks.map(t => ({
|
|
424
|
+
taskId: t.id,
|
|
425
|
+
agentType: t.assignedAgent,
|
|
426
|
+
title: t.title,
|
|
427
|
+
description: t.description,
|
|
428
|
+
priority: t.priority,
|
|
429
|
+
dependencies: t.dependencies,
|
|
430
|
+
timeout: t.timeout
|
|
431
|
+
}));
|
|
441
432
|
if (options.json) {
|
|
442
433
|
console.log(JSON.stringify({
|
|
443
|
-
status:
|
|
444
|
-
message:
|
|
445
|
-
statistics:
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
isolation: t.isolation,
|
|
451
|
-
taskId: t.taskId,
|
|
452
|
-
agentType: t.agentType,
|
|
453
|
-
timeout: t.timeout
|
|
454
|
-
})),
|
|
434
|
+
status: 'tasks_ready',
|
|
435
|
+
message: '任务已准备就绪,等待 Skill 执行',
|
|
436
|
+
statistics: {
|
|
437
|
+
totalTasks: allTasks.length,
|
|
438
|
+
pending: allTasks.filter(t => t.status === 'pending').length
|
|
439
|
+
},
|
|
440
|
+
subagentTasks,
|
|
455
441
|
taskInfo: {
|
|
456
442
|
title: options.title || parsedTask.title,
|
|
457
443
|
description: options.description,
|
|
@@ -463,8 +449,8 @@ async function handleAutoParse(input, options, stateManager, state) {
|
|
|
463
449
|
}
|
|
464
450
|
else {
|
|
465
451
|
console.log(`\n📋 生成 ${subTasks.length} 个子任务`);
|
|
466
|
-
console.log(`🎯
|
|
467
|
-
console.log('\n🚀
|
|
452
|
+
console.log(`🎯 执行模式:${executionMode}`);
|
|
453
|
+
console.log('\n🚀 等待 Skill 执行任务...');
|
|
468
454
|
console.log(' 使用 /om:status 查看进度');
|
|
469
455
|
}
|
|
470
456
|
}
|
package/package.json
CHANGED
package/skills/start.md
CHANGED
|
@@ -13,9 +13,9 @@ description: 启动新的任务执行周期
|
|
|
13
13
|
```
|
|
14
14
|
Step 1: 初始化 .openmatrix 目录
|
|
15
15
|
Step 2: 解析任务输入(文件或描述)
|
|
16
|
-
Step 3:
|
|
17
|
-
Step 4:
|
|
18
|
-
Step 5: 展示执行计划
|
|
16
|
+
Step 3: 智能分析任务类型
|
|
17
|
+
Step 4: 必选问题(质量等级、E2E、执行模式)← 不可跳过
|
|
18
|
+
Step 5: 可选问题(仅复杂任务)+ 展示执行计划
|
|
19
19
|
Step 6: AI 提取 goals,生成 plan
|
|
20
20
|
Step 7: 写入 .openmatrix/tasks-input.json ← 必须完成
|
|
21
21
|
Step 8: 调用 openmatrix start --tasks-json ← 必须完成,不可跳过
|
|
@@ -26,13 +26,19 @@ Step 10: 逐个执行 subagentTasks(调用 Agent 工具) ← 只有这步
|
|
|
26
26
|
**违反以下任一规则将导致任务执行失败:**
|
|
27
27
|
|
|
28
28
|
❌ **禁止在 Step 8 之前写任何业务代码** — 所有代码必须在 Step 10 通过 Agent 执行
|
|
29
|
+
❌ **禁止跳过 Step 4 必选问题** — 质量等级、执行模式必须由用户选择
|
|
29
30
|
❌ **禁止跳过 Step 8** — 必须调用 CLI,不能用其他方式代替
|
|
30
31
|
❌ **禁止自行规划 Phase** — 任务由 CLI 的 TaskPlanner 拆分,AI 只提取 goals
|
|
31
32
|
❌ **禁止用 Bash/npm/write 直接写业务代码** — 业务代码只能通过 Step 10 的 Agent 执行
|
|
32
33
|
</MANDATORY-EXECUTION-ORDER>
|
|
33
34
|
|
|
34
35
|
<objective>
|
|
35
|
-
|
|
36
|
+
解析任务文档,通过必选问答确定质量等级、E2E测试、执行模式,确认后通过 CLI 拆分任务并执行。
|
|
37
|
+
|
|
38
|
+
⚠️ **Step 4 必选问题不可跳过** — 必须让用户选择:
|
|
39
|
+
1. 质量等级 (strict/balanced/fast)
|
|
40
|
+
2. E2E 测试 (当选择 strict/balanced 时必问)
|
|
41
|
+
3. 执行模式 (全自动/关键节点确认/每阶段确认)
|
|
36
42
|
</objective>
|
|
37
43
|
|
|
38
44
|
<process>
|
|
@@ -71,38 +77,72 @@ openmatrix start --init-only
|
|
|
71
77
|
|
|
72
78
|
### Step 3: 智能分析
|
|
73
79
|
|
|
74
|
-
|
|
80
|
+
根据任务内容判断是否需要额外问题(质量等级、执行模式、E2E 始终必选):
|
|
75
81
|
|
|
76
|
-
| 任务类型 |
|
|
82
|
+
| 任务类型 | 额外问题 | 默认配置 |
|
|
77
83
|
|---------|---------|---------|
|
|
78
|
-
| Bug 修复 / 小改动 |
|
|
79
|
-
| 新功能开发 |
|
|
80
|
-
| 重构 | 跳过 E2E | balanced |
|
|
81
|
-
| 测试编写 |
|
|
84
|
+
| Bug 修复 / 小改动 | 跳过复杂度问题 | fast |
|
|
85
|
+
| 新功能开发 | 询问技术栈等 | balanced |
|
|
86
|
+
| 重构 | 跳过 E2E 相关 | balanced |
|
|
87
|
+
| 测试编写 | 跳过文档相关 | 无需文档 |
|
|
88
|
+
|
|
89
|
+
### Step 4: 必选问题(所有任务都必须回答)
|
|
90
|
+
|
|
91
|
+
**⚠️ 以下问题为必选,不可跳过:**
|
|
92
|
+
|
|
93
|
+
#### 4.1 质量等级(必选)
|
|
94
|
+
|
|
95
|
+
```typescript
|
|
96
|
+
AskUserQuestion({
|
|
97
|
+
questions: [
|
|
98
|
+
{
|
|
99
|
+
question: "选择质量等级(决定测试覆盖、Lint、安全扫描等要求):",
|
|
100
|
+
header: "质量等级",
|
|
101
|
+
options: [
|
|
102
|
+
{ label: "strict", description: "TDD + >80%覆盖率 + 严格Lint + 安全扫描 — 生产级代码" },
|
|
103
|
+
{ label: "balanced (推荐)", description: ">60%覆盖率 + Lint + 安全扫描 — 日常开发" },
|
|
104
|
+
{ label: "fast", description: "无质量门禁 — 快速原型/验证" }
|
|
105
|
+
],
|
|
106
|
+
multiSelect: false
|
|
107
|
+
}
|
|
108
|
+
]
|
|
109
|
+
})
|
|
110
|
+
```
|
|
82
111
|
|
|
83
|
-
|
|
112
|
+
#### 4.2 E2E 测试(当质量等级为 strict 或 balanced 时必选)
|
|
84
113
|
|
|
85
|
-
|
|
114
|
+
如果用户选择了 `strict` 或 `balanced`,继续询问:
|
|
86
115
|
|
|
87
116
|
```typescript
|
|
88
117
|
AskUserQuestion({
|
|
89
118
|
questions: [
|
|
90
119
|
{
|
|
91
|
-
question: "
|
|
92
|
-
header: "
|
|
120
|
+
question: "是否启用端到端 (E2E) 测试?(适用于 Web/Mobile/GUI 项目,耗时较长)",
|
|
121
|
+
header: "E2E 测试",
|
|
93
122
|
options: [
|
|
94
|
-
{ label: "
|
|
95
|
-
{ label: "
|
|
96
|
-
{ label: "fast", description: "无质量门禁" }
|
|
123
|
+
{ label: "启用 E2E 测试", description: "使用 Playwright/Cypress 等框架进行端到端测试" },
|
|
124
|
+
{ label: "不启用 (推荐)", description: "仅进行单元测试和集成测试,节省时间" }
|
|
97
125
|
],
|
|
98
126
|
multiSelect: false
|
|
99
|
-
}
|
|
127
|
+
}
|
|
128
|
+
]
|
|
129
|
+
})
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
**注意:** 如果用户选择 `fast` 质量等级,跳过 E2E 问题(fast 模式不启用 E2E)。
|
|
133
|
+
|
|
134
|
+
#### 4.3 执行模式(必选)
|
|
135
|
+
|
|
136
|
+
```typescript
|
|
137
|
+
AskUserQuestion({
|
|
138
|
+
questions: [
|
|
100
139
|
{
|
|
101
|
-
question: "
|
|
102
|
-
header: "
|
|
140
|
+
question: "选择执行模式(控制 AI 执行过程中的审批节点):",
|
|
141
|
+
header: "执行模式",
|
|
103
142
|
options: [
|
|
104
|
-
{ label: "
|
|
105
|
-
{ label: "
|
|
143
|
+
{ label: "全自动执行 (推荐)", description: "全自动执行,无需人工审批,遇到阻塞自动 Meeting" },
|
|
144
|
+
{ label: "关键节点确认", description: "plan/merge/deploy 时暂停确认" },
|
|
145
|
+
{ label: "每阶段确认", description: "每个阶段(develop/verify/accept)完成后暂停" }
|
|
106
146
|
],
|
|
107
147
|
multiSelect: false
|
|
108
148
|
}
|
|
@@ -110,7 +150,14 @@ AskUserQuestion({
|
|
|
110
150
|
})
|
|
111
151
|
```
|
|
112
152
|
|
|
113
|
-
### Step 5:
|
|
153
|
+
### Step 5: 可选问题(仅复杂任务)
|
|
154
|
+
|
|
155
|
+
根据任务类型,可能需要额外询问:
|
|
156
|
+
|
|
157
|
+
- 技术栈偏好
|
|
158
|
+
- 文档级别
|
|
159
|
+
- 风险评估
|
|
160
|
+
- 验收标准
|
|
114
161
|
|
|
115
162
|
展示 AI 生成的执行计划:
|
|
116
163
|
|
|
@@ -121,27 +168,9 @@ AskUserQuestion({
|
|
|
121
168
|
📊 统计
|
|
122
169
|
Goals: N 个(将生成 N个开发 + N个测试 + 审查)
|
|
123
170
|
质量级别: xxx
|
|
171
|
+
E2E 测试: 启用/不启用
|
|
124
172
|
```
|
|
125
173
|
|
|
126
|
-
使用 AskUserQuestion 确认执行模式:
|
|
127
|
-
|
|
128
|
-
```typescript
|
|
129
|
-
AskUserQuestion({
|
|
130
|
-
questions: [{
|
|
131
|
-
question: "请选择执行模式:",
|
|
132
|
-
header: "执行模式",
|
|
133
|
-
options: [
|
|
134
|
-
{ label: "全自动执行 (推荐)", description: "无需确认,自动完成,阻塞任务 (Meeting) 留到最后统一处理" },
|
|
135
|
-
{ label: "关键节点确认", description: "plan/merge 时暂停确认" },
|
|
136
|
-
{ label: "每阶段确认", description: "每个阶段完成后暂停" }
|
|
137
|
-
],
|
|
138
|
-
multiSelect: false
|
|
139
|
-
]
|
|
140
|
-
})
|
|
141
|
-
```
|
|
142
|
-
|
|
143
|
-
**默认进入 BYPASS 模式(全自动执行),用户可选其他模式。**
|
|
144
|
-
|
|
145
174
|
### Step 6: AI 提取 goals + 生成 plan
|
|
146
175
|
|
|
147
176
|
从任务描述中提取:
|
|
@@ -203,7 +232,8 @@ CLI 返回 JSON 中 `subagentTasks` 数组包含待执行任务。
|
|
|
203
232
|
**文件持久化循环(防止上下文压缩丢失状态):**
|
|
204
233
|
```bash
|
|
205
234
|
# 每个 Agent 完成后执行:
|
|
206
|
-
|
|
235
|
+
# --summary 传入执行摘要,自动追加到全局 context.md
|
|
236
|
+
openmatrix complete TASK-XXX --success --summary "决策: xxx; 文件: xxx"
|
|
207
237
|
|
|
208
238
|
# 提交验证(防止 commit 静默失败):
|
|
209
239
|
git status --porcelain # 检查是否有未提交的文件
|
|
@@ -229,26 +259,15 @@ Agent({
|
|
|
229
259
|
每个 Agent 完成后:
|
|
230
260
|
1. **标记完成并更新统计(必须执行):**
|
|
231
261
|
```bash
|
|
232
|
-
|
|
262
|
+
# --summary 参数传入 Agent 执行摘要,自动追加到全局 context.md
|
|
263
|
+
openmatrix complete TASK-XXX --success --summary "关键决策: xxx; 创建文件: xxx"
|
|
233
264
|
```
|
|
234
|
-
2. **保存 Agent 上下文** — 将执行结果摘要写入 `.openmatrix/tasks/TASK-XXX/context.md`,格式如下:
|
|
235
265
|
|
|
236
|
-
|
|
237
|
-
|
|
266
|
+
2. **全局上下文文件** — 所有任务的上下文累积在 `.openmatrix/context.md`:
|
|
267
|
+
- 每次任务完成后,通过 `--summary` 参数追加写入
|
|
268
|
+
- 后续 Agent 可读取此文件了解前序任务的决策和发现
|
|
238
269
|
|
|
239
|
-
|
|
240
|
-
- [做出的重要决策]
|
|
241
|
-
|
|
242
|
-
### 创建/修改的文件
|
|
243
|
-
- `path/to/file1.ts` - 简述用途
|
|
244
|
-
- `path/to/file2.ts` - 简述用途
|
|
245
|
-
|
|
246
|
-
### 重要发现
|
|
247
|
-
- [发现的问题、模式、注意事项]
|
|
248
|
-
|
|
249
|
-
### 对后续任务的建议
|
|
250
|
-
- [下一个 Agent 应该注意什么]
|
|
251
|
-
```
|
|
270
|
+
3. Git 自动提交(必须使用下方统一提交格式)
|
|
252
271
|
|
|
253
272
|
3. Git 自动提交(必须使用下方统一提交格式)
|
|
254
273
|
4. **获取下一个任务(防止上下文压缩丢失):**
|
|
@@ -260,6 +279,50 @@ openmatrix step --json
|
|
|
260
279
|
如果返回 `status: "blocked"` → 有阻塞任务,处理 Meeting
|
|
261
280
|
5. 检查审批点(auto 模式自动批准,其他模式按配置暂停)
|
|
262
281
|
|
|
282
|
+
6. **审批点处理(根据执行模式):**
|
|
283
|
+
|
|
284
|
+
根据用户选择的执行模式处理审批:
|
|
285
|
+
|
|
286
|
+
| 执行模式 | 审批点 | 处理方式 |
|
|
287
|
+
|---------|--------|---------|
|
|
288
|
+
| 全自动执行 | 无 | 自动批准所有操作 |
|
|
289
|
+
| 关键节点确认 | plan, merge, deploy | 到达审批点时暂停,交互式确认 |
|
|
290
|
+
| 每阶段确认 | develop, verify, accept | 每个阶段完成后暂停,交互式确认 |
|
|
291
|
+
|
|
292
|
+
**交互式审批流程(非全自动模式):**
|
|
293
|
+
|
|
294
|
+
当到达审批点时,使用 `openmatrix approve --list` 查看待审批项,然后通过 AskUserQuestion 请求用户确认:
|
|
295
|
+
|
|
296
|
+
```typescript
|
|
297
|
+
// 检查是否有待审批项
|
|
298
|
+
// 通过 CLI: openmatrix approve --list --json
|
|
299
|
+
|
|
300
|
+
AskUserQuestion({
|
|
301
|
+
questions: [
|
|
302
|
+
{
|
|
303
|
+
question: "审批请求: [审批类型]
|
|
304
|
+
|
|
305
|
+
[审批内容摘要]
|
|
306
|
+
|
|
307
|
+
是否批准?",
|
|
308
|
+
header: "审批",
|
|
309
|
+
options: [
|
|
310
|
+
{ label: "批准", description: "同意继续执行" },
|
|
311
|
+
{ label: "拒绝", description: "拒绝并停止执行" },
|
|
312
|
+
{ label: "查看详情", description: "查看完整审批内容后再决定" }
|
|
313
|
+
],
|
|
314
|
+
multiSelect: false
|
|
315
|
+
}
|
|
316
|
+
]
|
|
317
|
+
})
|
|
318
|
+
```
|
|
319
|
+
|
|
320
|
+
用户选择后,执行对应命令:
|
|
321
|
+
- 批准: `openmatrix approve <approval-id> --approve`
|
|
322
|
+
- 拒绝: `openmatrix approve <approval-id> --reject`
|
|
323
|
+
- 查看详情: 读取 `.openmatrix/approvals/<approval-id>.json` 并展示完整内容
|
|
324
|
+
|
|
325
|
+
|
|
263
326
|
**Agent 上下文共享机制 (Agent Memory):**
|
|
264
327
|
|
|
265
328
|
每个 Agent 执行时会自动接收前序 Agent 的上下文信息(通过 `context.md` 文件)。
|