memory-bank-skill 7.0.0 → 7.0.1
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/cli.js +51 -23
- package/package.json +1 -1
- package/skills/memory-bank/SKILL.md +2 -2
- package/skills/memory-bank/references/writer.md +21 -13
package/dist/cli.js
CHANGED
|
@@ -27,7 +27,7 @@ import { fileURLToPath } from "url";
|
|
|
27
27
|
// package.json
|
|
28
28
|
var package_default = {
|
|
29
29
|
name: "memory-bank-skill",
|
|
30
|
-
version: "7.0.
|
|
30
|
+
version: "7.0.1",
|
|
31
31
|
description: "Memory Bank - \u9879\u76EE\u8BB0\u5FC6\u7CFB\u7EDF\uFF0C\u8BA9 AI \u52A9\u624B\u5728\u6BCF\u6B21\u5BF9\u8BDD\u4E2D\u90FD\u80FD\u5FEB\u901F\u7406\u89E3\u9879\u76EE\u4E0A\u4E0B\u6587",
|
|
32
32
|
type: "module",
|
|
33
33
|
main: "dist/plugin.js",
|
|
@@ -402,7 +402,9 @@ async function writeManifest(manifestFiles, undoStack) {
|
|
|
402
402
|
`, undoStack);
|
|
403
403
|
}
|
|
404
404
|
var MEMORY_BANK_KEY_TRIGGER_MARKER = "Memory Bank Key Triggers";
|
|
405
|
-
var
|
|
405
|
+
var MEMORY_BANK_KEY_TRIGGER_BEGIN = "<!-- BEGIN_MEMORY_BANK_KEY_TRIGGERS -->";
|
|
406
|
+
var MEMORY_BANK_KEY_TRIGGER_END = "<!-- END_MEMORY_BANK_KEY_TRIGGERS -->";
|
|
407
|
+
var MEMORY_BANK_KEY_TRIGGER = `${MEMORY_BANK_KEY_TRIGGER_BEGIN}
|
|
406
408
|
### ${MEMORY_BANK_KEY_TRIGGER_MARKER} (SYNC Task Tool)
|
|
407
409
|
|
|
408
410
|
These triggers use proxy_task (the Task tool) for synchronous subagent execution.
|
|
@@ -449,27 +451,35 @@ Step W1 Trigger (any):
|
|
|
449
451
|
- New/changed commands/workflow/project structure
|
|
450
452
|
|
|
451
453
|
Step W2 Skip (Loop Guards):
|
|
452
|
-
- Request is about Memory Bank itself (same keywords as R2
|
|
453
|
-
- You already included "Memory Bank
|
|
454
|
-
- User already declined in this thread (
|
|
455
|
-
- User message is
|
|
456
|
-
- Previous assistant message has
|
|
454
|
+
- Request is about Memory Bank itself (same keywords as R2)
|
|
455
|
+
- You already included "\uD83D\uDCBE" or "Memory Bank" write prompt in this assistant message
|
|
456
|
+
- User already declined in this thread (\u4E0D\u7528/\u4E0D\u8981/\u8DF3\u8FC7/no/skip/mb:no)
|
|
457
|
+
- User message is a confirmation or rejection (handle via W4 instead)
|
|
458
|
+
- Previous assistant message has write prompt and user hasn't responded yet
|
|
457
459
|
|
|
458
460
|
Step W3 Propose ONLY (do not write yet):
|
|
459
|
-
Append this
|
|
461
|
+
Append this at end of your answer (natural language, Chinese preferred):
|
|
460
462
|
|
|
461
463
|
\`\`\`
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
464
|
+
---
|
|
465
|
+
\uD83D\uDCBE \u8981\u628A\u8FD9\u6B21\u7684\u53D1\u73B0\u5199\u5165 Memory Bank \u5417\uFF1F
|
|
466
|
+
\u2192 {target_file}
|
|
467
|
+
\u2192 \u5185\u5BB9\uFF1A{\u8981\u70B91}\uFF1B{\u8981\u70B92}
|
|
468
|
+
|
|
469
|
+
\u56DE\u590D"\u597D"\u6216"\u5199"\u5373\u53EF\uFF0C\u4E0D\u9700\u8981\u53EF\u5FFD\u7565\u3002
|
|
470
|
+
---
|
|
469
471
|
\`\`\`
|
|
470
472
|
|
|
471
|
-
Step W4 On confirmation (next turn
|
|
472
|
-
|
|
473
|
+
Step W4 On confirmation (next turn):
|
|
474
|
+
**Prerequisite**: Only interpret confirmation/rejection if your immediately previous message contained the \uD83D\uDCBE write prompt block. Otherwise treat user message as normal conversation.
|
|
475
|
+
|
|
476
|
+
Confirmation words: \u597D/\u5199/\u786E\u8BA4/\u53EF\u4EE5/\u884C/yes/ok/sure/mb:write
|
|
477
|
+
Rejection words: \u4E0D\u7528/\u4E0D\u8981/\u8DF3\u8FC7/\u7B97\u4E86/no/skip/mb:no
|
|
478
|
+
Ignore: User continues to next topic without addressing the prompt (treat as skip)
|
|
479
|
+
|
|
480
|
+
**Mixed intent**: If user confirms AND asks another question (e.g., "\u5199\u5427\uFF0C\u987A\u4FBF\u95EE\u4E00\u4E0B..."), execute the write first, then answer their question in the same response.
|
|
481
|
+
|
|
482
|
+
On confirmation, execute writer synchronously:
|
|
473
483
|
\`\`\`
|
|
474
484
|
proxy_task({
|
|
475
485
|
subagent_type: "memory-bank-writer",
|
|
@@ -481,7 +491,7 @@ proxy_task({
|
|
|
481
491
|
Step W5 After execution:
|
|
482
492
|
- Show which file(s) updated and brief preview.
|
|
483
493
|
- Do NOT emit another Proposal in same message.
|
|
484
|
-
`;
|
|
494
|
+
${MEMORY_BANK_KEY_TRIGGER_END}`;
|
|
485
495
|
async function findOmoConfigPath() {
|
|
486
496
|
const projectPath = join(process.cwd(), ".opencode", "oh-my-opencode.json");
|
|
487
497
|
const userPath = join(homedir(), ".config", "opencode", "oh-my-opencode.json");
|
|
@@ -517,16 +527,34 @@ async function injectOmoKeyTrigger(undoStack) {
|
|
|
517
527
|
const injected = [];
|
|
518
528
|
for (const orchestrator of orchestrators) {
|
|
519
529
|
const existingAppend = config.agents[orchestrator]?.prompt_append ?? "";
|
|
520
|
-
if (existingAppend.includes(MEMORY_BANK_KEY_TRIGGER_MARKER)) {
|
|
521
|
-
continue;
|
|
522
|
-
}
|
|
523
530
|
if (!config.agents[orchestrator]) {
|
|
524
531
|
config.agents[orchestrator] = {};
|
|
525
532
|
}
|
|
526
|
-
|
|
533
|
+
let newAppend;
|
|
534
|
+
const beginIdx = existingAppend.indexOf(MEMORY_BANK_KEY_TRIGGER_BEGIN);
|
|
535
|
+
const endIdx = existingAppend.indexOf(MEMORY_BANK_KEY_TRIGGER_END);
|
|
536
|
+
if (beginIdx !== -1 && endIdx !== -1 && endIdx > beginIdx) {
|
|
537
|
+
const before = existingAppend.slice(0, beginIdx);
|
|
538
|
+
const after = existingAppend.slice(endIdx + MEMORY_BANK_KEY_TRIGGER_END.length);
|
|
539
|
+
newAppend = before + MEMORY_BANK_KEY_TRIGGER + after;
|
|
540
|
+
injected.push(`${orchestrator} (upgraded)`);
|
|
541
|
+
} else if (existingAppend.includes(MEMORY_BANK_KEY_TRIGGER_MARKER)) {
|
|
542
|
+
const markerIdx = existingAppend.indexOf(`### ${MEMORY_BANK_KEY_TRIGGER_MARKER}`);
|
|
543
|
+
if (markerIdx !== -1) {
|
|
544
|
+
const before = existingAppend.slice(0, markerIdx);
|
|
545
|
+
newAppend = before + MEMORY_BANK_KEY_TRIGGER;
|
|
546
|
+
injected.push(`${orchestrator} (migrated)`);
|
|
547
|
+
} else {
|
|
548
|
+
newAppend = existingAppend + `
|
|
549
|
+
` + MEMORY_BANK_KEY_TRIGGER;
|
|
550
|
+
injected.push(orchestrator);
|
|
551
|
+
}
|
|
552
|
+
} else {
|
|
553
|
+
newAppend = existingAppend ? existingAppend + `
|
|
527
554
|
` + MEMORY_BANK_KEY_TRIGGER : MEMORY_BANK_KEY_TRIGGER;
|
|
555
|
+
injected.push(orchestrator);
|
|
556
|
+
}
|
|
528
557
|
config.agents[orchestrator].prompt_append = newAppend;
|
|
529
|
-
injected.push(orchestrator);
|
|
530
558
|
}
|
|
531
559
|
if (injected.length === 0) {
|
|
532
560
|
return {
|
package/package.json
CHANGED
|
@@ -116,8 +116,8 @@ proxy_task({
|
|
|
116
116
|
**核心约束**:主 Agent **禁止直接写入** `memory-bank/`,必须 delegate 给 `memory-bank-writer`。
|
|
117
117
|
|
|
118
118
|
流程(跨 turn):
|
|
119
|
-
1. 主 Agent
|
|
120
|
-
2.
|
|
119
|
+
1. 主 Agent 检测到写入时机,用自然语言询问是否写入(含目标文件 + 要点)
|
|
120
|
+
2. 用户自然语言确认("好"/"写"/"确认")或跳过("不用"/"跳过"/继续下一话题)
|
|
121
121
|
3. 下一 turn 调用:`proxy_task({ subagent_type: "memory-bank-writer", description: "Memory Bank write", prompt: "Target: ...\nDraft: ..." })`
|
|
122
122
|
|
|
123
123
|
详见 [writer.md](references/writer.md)
|
|
@@ -26,29 +26,37 @@ proxy_task({
|
|
|
26
26
|
| ✅ | 新/变更的命令、工作流、项目结构 |
|
|
27
27
|
| ❌ | 问题是关于 Memory Bank 本身 |
|
|
28
28
|
| ❌ | 本消息已包含 Proposal |
|
|
29
|
-
| ❌ |
|
|
30
|
-
| ❌ |
|
|
29
|
+
| ❌ | 用户已拒绝(不用/跳过/mb:no 等) |
|
|
30
|
+
| ❌ | 用户消息是确认或拒绝词(直接执行/跳过) |
|
|
31
31
|
| ❌ | 上一条消息有 Proposal 且用户未回应 |
|
|
32
32
|
|
|
33
33
|
### 流程
|
|
34
34
|
|
|
35
35
|
**Step 1: 提议(本 turn)**
|
|
36
36
|
|
|
37
|
-
|
|
37
|
+
在完成主要任务后,用自然语言询问是否写入:
|
|
38
38
|
|
|
39
39
|
```
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
40
|
+
---
|
|
41
|
+
💾 要把这次的发现写入 Memory Bank 吗?
|
|
42
|
+
→ {target_file}
|
|
43
|
+
→ 内容:{要点1};{要点2}
|
|
44
|
+
|
|
45
|
+
回复"好"或"写"即可,不需要可忽略。
|
|
46
|
+
---
|
|
47
47
|
```
|
|
48
48
|
|
|
49
49
|
**Step 2: 确认(用户 turn)**
|
|
50
50
|
|
|
51
|
-
|
|
51
|
+
**前提**:只有当上一条 assistant 消息包含 💾 写入提示时,才把用户回复解释为确认/拒绝。否则正常处理用户消息。
|
|
52
|
+
|
|
53
|
+
| 类型 | 触发词 |
|
|
54
|
+
|------|--------|
|
|
55
|
+
| 确认 | 好 / 写 / 确认 / 可以 / 行 / yes / ok / sure / mb:write |
|
|
56
|
+
| 拒绝 | 不用 / 不要 / 跳过 / 算了 / no / skip / mb:no |
|
|
57
|
+
| 忽略 | 用户继续下一话题但未回应提示(视为跳过) |
|
|
58
|
+
|
|
59
|
+
**混合意图**:如果用户确认同时问了其他问题(如"写吧,顺便问一下..."),先执行写入,再回答问题。
|
|
52
60
|
|
|
53
61
|
**Step 3: 执行(下一 turn)**
|
|
54
62
|
|
|
@@ -210,8 +218,8 @@ Memory Bank Write Proposal
|
|
|
210
218
|
|
|
211
219
|
| 步骤 | 负责方 | 动作 |
|
|
212
220
|
|------|--------|------|
|
|
213
|
-
| 1 | 主 Agent |
|
|
214
|
-
| 2 | 用户 |
|
|
221
|
+
| 1 | 主 Agent | 检测写入时机,自然语言询问是否写入 |
|
|
222
|
+
| 2 | 用户 | 自然语言确认("好"/"写")或拒绝("不用"/"跳过") |
|
|
215
223
|
| 3 | 主 Agent | 调用 `proxy_task({ subagent_type: "memory-bank-writer", ... })` |
|
|
216
224
|
| 4 | **Writer** | 执行写入(可顺带更新 index.md / MEMORY.md) |
|
|
217
225
|
|