memory-bank-skill 5.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,112 @@
1
+ # Memory Bank 结构化输出 Schema
2
+
3
+ > 此文件定义 Memory Bank 操作的结构化输出格式,用于决策审计和工具集成。
4
+
5
+ ---
6
+
7
+ ## 文件选择输出
8
+
9
+ 当 AI 决定加载哪些文件时,输出此格式:
10
+
11
+ ```json
12
+ {
13
+ "schemaVersion": "1.0",
14
+ "action": "select_files",
15
+ "files": [
16
+ "requirements/REQ-003-payment.md",
17
+ "learnings/bugs/2024-01-20-payment-timeout.md"
18
+ ],
19
+ "reason": "用户讨论支付超时,加载相关需求和历史 bug 经验",
20
+ "budget": {
21
+ "filesSelected": 2,
22
+ "filesLimit": 5,
23
+ "linesSelected": 270,
24
+ "linesLimit": 500
25
+ },
26
+ "riskAlerts": [
27
+ {
28
+ "level": "warning",
29
+ "file": "learnings/bugs/2024-01-20-payment-timeout.md",
30
+ "message": "历史上支付模块有超时问题,建议查看"
31
+ }
32
+ ]
33
+ }
34
+ ```
35
+
36
+ ### 字段说明
37
+
38
+ | 字段 | 类型 | 说明 |
39
+ |------|------|------|
40
+ | `schemaVersion` | string | Schema 版本号 |
41
+ | `action` | string | 操作类型,固定为 `select_files` |
42
+ | `files` | string[] | 选中的文件路径列表(相对于 memory-bank/) |
43
+ | `reason` | string | 选择这些文件的原因 |
44
+ | `budget.filesSelected` | number | 已选文件数 |
45
+ | `budget.filesLimit` | number | 文件数上限(5) |
46
+ | `budget.linesSelected` | number | 已选文件总行数 |
47
+ | `budget.linesLimit` | number | 行数上限(500) |
48
+ | `riskAlerts` | object[] | 风险提示列表 |
49
+ | `riskAlerts[].level` | string | 风险级别:info / warning / error |
50
+ | `riskAlerts[].file` | string | 相关文件 |
51
+ | `riskAlerts[].message` | string | 提示消息 |
52
+
53
+ ---
54
+
55
+ ## 写入计划输出
56
+
57
+ 当 AI 计划写入 Memory Bank 时,输出此格式:
58
+
59
+ ```json
60
+ {
61
+ "schemaVersion": "1.0",
62
+ "action": "memory_ops",
63
+ "operations": [
64
+ {
65
+ "type": "create",
66
+ "path": "requirements/REQ-004-refund.md",
67
+ "reason": "用户确认新增退款功能需求"
68
+ },
69
+ {
70
+ "type": "update",
71
+ "path": "active.md",
72
+ "block": "MACHINE_BLOCK",
73
+ "changes": "更新当前焦点为退款功能"
74
+ },
75
+ {
76
+ "type": "update",
77
+ "path": "_index.md",
78
+ "changes": "添加 REQ-004 索引条目"
79
+ }
80
+ ],
81
+ "requiresConfirmation": true
82
+ }
83
+ ```
84
+
85
+ ### 字段说明
86
+
87
+ | 字段 | 类型 | 说明 |
88
+ |------|------|------|
89
+ | `schemaVersion` | string | Schema 版本号 |
90
+ | `action` | string | 操作类型,固定为 `memory_ops` |
91
+ | `operations` | object[] | 操作列表 |
92
+ | `operations[].type` | string | 操作类型:create / update / delete |
93
+ | `operations[].path` | string | 目标文件路径(相对于 memory-bank/) |
94
+ | `operations[].block` | string | 更新哪个区块:MACHINE_BLOCK / USER_BLOCK(仅 update) |
95
+ | `operations[].changes` | string | 变更描述 |
96
+ | `operations[].reason` | string | 操作原因(仅 create) |
97
+ | `requiresConfirmation` | boolean | 是否需要用户确认(通常为 true) |
98
+
99
+ ---
100
+
101
+ ## 用户确认格式
102
+
103
+ 向用户展示写入计划时,使用此格式:
104
+
105
+ ```
106
+ [Memory Bank 更新计划]
107
+ - 创建: requirements/REQ-004-refund.md(退款功能需求)
108
+ - 更新: active.md(更新当前焦点)
109
+ - 更新: _index.md(添加新文件索引)
110
+
111
+ 是否执行?[Y/n]
112
+ ```
@@ -0,0 +1,225 @@
1
+ # Memory Bank 文件模板
2
+
3
+ > 此文件包含 Memory Bank 各文件的标准模板。创建新文件时参考此模板。
4
+
5
+ ---
6
+
7
+ ## _index.md(根索引)
8
+
9
+ ```markdown
10
+ # Memory Bank Index
11
+
12
+ > 自动维护,可手工编辑 summary 以提升检索精度
13
+
14
+ | path | title | summary | updated | size |
15
+ |------|-------|---------|---------|------|
16
+ ```
17
+
18
+ ---
19
+
20
+ ## brief.md
21
+
22
+ ```markdown
23
+ # Project Brief
24
+
25
+ <!-- MACHINE_BLOCK_START -->
26
+ ## 一句话描述
27
+ {项目是什么}
28
+
29
+ ## 核心目标
30
+ - {目标 1}
31
+ - {目标 2}
32
+
33
+ ## 边界
34
+ - 包含: {范围内}
35
+ - 不包含: {范围外}
36
+
37
+ ## 关键约束
38
+ - {约束 1}
39
+ <!-- MACHINE_BLOCK_END -->
40
+
41
+ <!-- USER_BLOCK_START -->
42
+ ## 补充说明
43
+ {用户自由编辑区}
44
+ <!-- USER_BLOCK_END -->
45
+ ```
46
+
47
+ ---
48
+
49
+ ## tech.md
50
+
51
+ ```markdown
52
+ # Tech Stack
53
+
54
+ <!-- MACHINE_BLOCK_START -->
55
+ ## 技术栈
56
+ | 层级 | 技术 |
57
+ |------|------|
58
+ | 语言 | {xxx} |
59
+ | 框架 | {xxx} |
60
+ | 数据库 | {xxx} |
61
+ | 部署 | {xxx} |
62
+
63
+ ## 常用命令
64
+ # 开发
65
+ {dev command}
66
+
67
+ # 测试
68
+ {test command}
69
+
70
+ # 构建
71
+ {build command}
72
+
73
+ ## 环境要求
74
+ - {requirement 1}
75
+ <!-- MACHINE_BLOCK_END -->
76
+
77
+ <!-- USER_BLOCK_START -->
78
+ ## 补充说明
79
+ {用户自由编辑区}
80
+ <!-- USER_BLOCK_END -->
81
+ ```
82
+
83
+ ---
84
+
85
+ ## active.md
86
+
87
+ ```markdown
88
+ # Active Context
89
+
90
+ <!-- MACHINE_BLOCK_START -->
91
+ > 更新于: {YYYY-MM-DD HH:mm}
92
+
93
+ ## 当前焦点
94
+ {正在做什么}
95
+
96
+ ## 下一步
97
+ 1. {next 1}
98
+ 2. {next 2}
99
+
100
+ ## 阻塞项
101
+ - {blocker,无则写「无」}
102
+
103
+ ## 最近变更
104
+ | 日期 | 变更 |
105
+ |------|------|
106
+ <!-- MACHINE_BLOCK_END -->
107
+
108
+ <!-- USER_BLOCK_START -->
109
+ ## 用户笔记
110
+ {用户自由编辑区}
111
+ <!-- USER_BLOCK_END -->
112
+ ```
113
+
114
+ ---
115
+
116
+ ## progress.md
117
+
118
+ ```markdown
119
+ # Progress
120
+
121
+ <!-- MACHINE_BLOCK_START -->
122
+ ## 已完成
123
+ - [x] {feature 1}
124
+
125
+ ## 进行中
126
+ - [ ] {feature 2} - {进度%}
127
+
128
+ ## 待开发
129
+ - [ ] {feature 3}
130
+
131
+ ## 已知问题
132
+ | ID | 问题 | 优先级 |
133
+ |----|------|--------|
134
+ <!-- MACHINE_BLOCK_END -->
135
+
136
+ <!-- USER_BLOCK_START -->
137
+ ## 备注
138
+ {用户自由编辑区}
139
+ <!-- USER_BLOCK_END -->
140
+ ```
141
+
142
+ ---
143
+
144
+ ## patterns.md
145
+
146
+ ```markdown
147
+ # Patterns & Decisions
148
+
149
+ <!-- MACHINE_BLOCK_START -->
150
+ ## 技术决策
151
+ | 日期 | 决策 | 原因 |
152
+ |------|------|------|
153
+
154
+ ## 代码约定
155
+ - {convention 1}
156
+ <!-- MACHINE_BLOCK_END -->
157
+
158
+ <!-- USER_BLOCK_START -->
159
+ ## 补充约定
160
+ {用户自由编辑区}
161
+ <!-- USER_BLOCK_END -->
162
+ ```
163
+
164
+ ---
165
+
166
+ ## requirements/REQ-{ID}-{slug}.md
167
+
168
+ ```markdown
169
+ # REQ-{ID}: {标题}
170
+
171
+ <!-- MACHINE_BLOCK_START -->
172
+ ## Status
173
+ {Proposed | Accepted | Implementing | Done | Deprecated}
174
+
175
+ ## Summary
176
+ {一段话描述需求}
177
+
178
+ ## Acceptance Criteria
179
+ - [ ] {criterion 1}
180
+ - [ ] {criterion 2}
181
+
182
+ ## History
183
+ | 日期 | 变更 | 原因 |
184
+ |------|------|------|
185
+ | {date} | 创建需求 | - |
186
+ <!-- MACHINE_BLOCK_END -->
187
+
188
+ <!-- USER_BLOCK_START -->
189
+ ## Notes
190
+ {用户补充说明}
191
+ <!-- USER_BLOCK_END -->
192
+ ```
193
+
194
+ ---
195
+
196
+ ## learnings/{type}/{date}-{slug}.md
197
+
198
+ ```markdown
199
+ # {标题}
200
+
201
+ <!-- MACHINE_BLOCK_START -->
202
+ > 日期: {YYYY-MM-DD}
203
+ > 类型: {bug | performance | integration}
204
+
205
+ ## 问题
206
+ {问题描述}
207
+
208
+ ## 症状
209
+ {如何发现的}
210
+
211
+ ## 根因
212
+ {根本原因}
213
+
214
+ ## 解决方案
215
+ {怎么解决的}
216
+
217
+ ## 教训
218
+ {一句话总结}
219
+ <!-- MACHINE_BLOCK_END -->
220
+
221
+ <!-- USER_BLOCK_START -->
222
+ ## 补充
223
+ {用户自由编辑区}
224
+ <!-- USER_BLOCK_END -->
225
+ ```
@@ -0,0 +1,20 @@
1
+ # Active Context
2
+
3
+ > 更新于: {YYYY-MM-DD HH:mm}
4
+
5
+ ## 当前焦点
6
+ {正在做什么,1-2 句话描述当前最重要的工作}
7
+
8
+ ## 下一步
9
+ 1. {下一步 1}
10
+ 2. {下一步 2}
11
+ 3. {下一步 3}
12
+
13
+ ## 阻塞项
14
+ - {阻塞项描述,无则写「无」}
15
+
16
+ ## 最近变更
17
+ | 日期 | 变更 |
18
+ |------|------|
19
+ | {YYYY-MM-DD} | {变更内容} |
20
+ | {YYYY-MM-DD} | {变更内容} |
@@ -0,0 +1,17 @@
1
+ # Project Brief
2
+
3
+ ## 一句话描述
4
+ {项目是什么}
5
+
6
+ ## 核心目标
7
+ - {目标 1}
8
+ - {目标 2}
9
+ - {目标 3}
10
+
11
+ ## 边界
12
+ - ✅ 包含: {范围内的功能}
13
+ - ❌ 不包含: {明确不做的事}
14
+
15
+ ## 关键约束
16
+ - {约束 1,如性能要求}
17
+ - {约束 2,如兼容性要求}
@@ -0,0 +1,32 @@
1
+ # Architecture
2
+
3
+ > 更新于: {YYYY-MM-DD}
4
+
5
+ ## 系统概览
6
+ ```
7
+ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐
8
+ │ Layer 1 │────▶│ Layer 2 │────▶│ Layer 3 │
9
+ │ {名称} │ │ {名称} │ │ {名称} │
10
+ └─────────────┘ └─────────────┘ └─────────────┘
11
+ ```
12
+
13
+ ## 模块划分
14
+ | 模块 | 职责 | 文档 |
15
+ |------|------|------|
16
+ | {module1} | {职责描述} | [modules/{module1}.md](modules/{module1}.md) |
17
+ | {module2} | {职责描述} | [modules/{module2}.md](modules/{module2}.md) |
18
+
19
+ ## 关键流程
20
+
21
+ ### {流程 1 名称}
22
+ ```
23
+ {步骤 1} → {步骤 2} → {步骤 3} → {步骤 4}
24
+ ```
25
+
26
+ ### {流程 2 名称}
27
+ {流程描述}
28
+
29
+ ## 变更记录
30
+ | 日期 | 变更 | 原因 | 影响 |
31
+ |------|------|------|------|
32
+ | {YYYY-MM-DD} | {变更内容} | {为什么改} | {影响范围} |
@@ -0,0 +1,34 @@
1
+ # {Module} 模块
2
+
3
+ > 更新于: {YYYY-MM-DD}
4
+
5
+ ## 职责
6
+ {模块负责什么,1-2 句话}
7
+
8
+ ## 目录结构
9
+ ```
10
+ src/{path}/
11
+ ├── components/ # {说明}
12
+ ├── hooks/ # {说明}
13
+ ├── services/ # {说明}
14
+ └── types.ts # {说明}
15
+ ```
16
+
17
+ ## 核心流程
18
+ ```
19
+ {输入} → {处理1} → {处理2} → {输出}
20
+ ```
21
+
22
+ ## 对外接口
23
+ | 接口 | 说明 | 详见 |
24
+ |------|------|------|
25
+ | {接口名} | {说明} | [specs/{spec}.md](../specs/{spec}.md) |
26
+
27
+ ## 依赖关系
28
+ - **依赖**: {本模块依赖的其他模块}
29
+ - **被依赖**: {依赖本模块的其他模块}
30
+
31
+ ## 变更记录
32
+ | 日期 | 变更 | 原因 |
33
+ |------|------|------|
34
+ | {YYYY-MM-DD} | {变更内容} | {为什么改} |
@@ -0,0 +1,47 @@
1
+ # {Spec Name}
2
+
3
+ > 更新于: {YYYY-MM-DD}
4
+
5
+ ## 接口定义
6
+
7
+ ### {接口 1}
8
+ ```typescript
9
+ // 输入
10
+ interface {Name}Input {
11
+ field1: string
12
+ field2: number
13
+ }
14
+
15
+ // 输出
16
+ interface {Name}Output {
17
+ success: boolean
18
+ data: {Type}
19
+ }
20
+ ```
21
+
22
+ ## 数据模型
23
+ ```typescript
24
+ interface {Model} {
25
+ id: string
26
+ field1: string
27
+ field2: number
28
+ createdAt: Date
29
+ updatedAt: Date
30
+ }
31
+ ```
32
+
33
+ ## 业务规则
34
+ - {规则 1}
35
+ - {规则 2}
36
+ - {规则 3}
37
+
38
+ ## 边界情况
39
+ | 情况 | 处理方式 |
40
+ |------|----------|
41
+ | {情况 1} | {处理} |
42
+ | {情况 2} | {处理} |
43
+
44
+ ## 变更记录
45
+ | 日期 | 版本 | 变更 | 原因 |
46
+ |------|------|------|------|
47
+ | {YYYY-MM-DD} | v1 | 初始版本 | - |
@@ -0,0 +1,27 @@
1
+ # {Bug 标题}
2
+
3
+ > 日期: {YYYY-MM-DD}
4
+ > 类型: bug
5
+
6
+ ## 问题
7
+ {问题描述,什么功能出了什么问题}
8
+
9
+ ## 症状
10
+ {如何发现的,用户看到什么,错误信息是什么}
11
+
12
+ ## 根因
13
+ {根本原因分析}
14
+
15
+ ## 解决方案
16
+ {怎么解决的}
17
+
18
+ ```{lang}
19
+ // 关键修复代码(如有)
20
+ ```
21
+
22
+ ## 教训
23
+ {一句话总结,下次如何避免}
24
+
25
+ ## 相关
26
+ - 需求: {REQ-xxx,如有}
27
+ - PR: {链接,如有}
@@ -0,0 +1,28 @@
1
+ # {集成名称} 集成经验
2
+
3
+ > 日期: {YYYY-MM-DD}
4
+ > 类型: integration
5
+ > 服务/库: {第三方服务或库名称}
6
+
7
+ ## 背景
8
+ {为什么需要集成这个服务/库}
9
+
10
+ ## 踩坑记录
11
+
12
+ ### 坑 1: {问题}
13
+ - **现象**: {表现}
14
+ - **原因**: {为什么}
15
+ - **解决**: {怎么解决}
16
+
17
+ ### 坑 2: {问题}
18
+ - **现象**: {表现}
19
+ - **原因**: {为什么}
20
+ - **解决**: {怎么解决}
21
+
22
+ ## 最佳实践
23
+ - {实践 1}
24
+ - {实践 2}
25
+
26
+ ## 参考链接
27
+ - 官方文档: {链接}
28
+ - 相关 issue: {链接}
@@ -0,0 +1,25 @@
1
+ # {优化标题}
2
+
3
+ > 日期: {YYYY-MM-DD}
4
+ > 类型: performance
5
+
6
+ ## 问题
7
+ {性能问题描述,慢在哪里,慢到什么程度}
8
+
9
+ ## 分析
10
+ {如何定位的,瓶颈在哪里}
11
+
12
+ ## 优化方案
13
+ {怎么优化的}
14
+
15
+ ```{lang}
16
+ // 关键优化代码(如有)
17
+ ```
18
+
19
+ ## 效果
20
+ | 指标 | 优化前 | 优化后 | 提升 |
21
+ |------|--------|--------|------|
22
+ | {指标} | {值} | {值} | {百分比} |
23
+
24
+ ## 教训
25
+ {一句话总结}
@@ -0,0 +1,11 @@
1
+ # Patterns & Decisions
2
+
3
+ ## 技术决策
4
+ | 日期 | 决策 | 原因 |
5
+ |------|------|------|
6
+ | {YYYY-MM-DD} | {决策内容} | {为什么这样选} |
7
+
8
+ ## 代码约定
9
+ - {约定 1}
10
+ - {约定 2}
11
+ - {约定 3}
@@ -0,0 +1,18 @@
1
+ # Progress
2
+
3
+ ## 已完成 ✅
4
+ - [x] {功能 1}
5
+ - [x] {功能 2}
6
+
7
+ ## 进行中 🔄
8
+ - [ ] {功能 3} - {进度%}
9
+ - [ ] {功能 4} - {进度%}
10
+
11
+ ## 待开发 📋
12
+ - [ ] {功能 5}
13
+ - [ ] {功能 6}
14
+
15
+ ## 已知问题 🐛
16
+ | ID | 问题 | 优先级 | 状态 |
17
+ |----|------|--------|------|
18
+ | #1 | {问题描述} | P0/P1/P2 | open/fixed |
@@ -0,0 +1,20 @@
1
+ # REQ-{ID}: {标题}
2
+
3
+ ## Status
4
+ {Proposed | Accepted | Implementing | Done | Deprecated}
5
+
6
+ ## Summary
7
+ {一段话描述这个需求要解决什么问题,达成什么目标}
8
+
9
+ ## Acceptance Criteria
10
+ - [ ] {验收标准 1}
11
+ - [ ] {验收标准 2}
12
+ - [ ] {验收标准 3}
13
+
14
+ ## Notes
15
+ {补充说明、技术方案要点、注意事项}
16
+
17
+ ## History
18
+ | 日期 | 变更 | 原因 |
19
+ |------|------|------|
20
+ | {YYYY-MM-DD} | 创建需求 | - |
@@ -0,0 +1,33 @@
1
+ # Tech Stack
2
+
3
+ ## 技术栈
4
+ | 层级 | 技术 |
5
+ |------|------|
6
+ | 前端 | {框架/库} |
7
+ | 后端 | {框架/语言} |
8
+ | 数据库 | {数据库} |
9
+ | 部署 | {平台} |
10
+
11
+ ## 常用命令
12
+ ```bash
13
+ # 开发
14
+ {dev command}
15
+
16
+ # 测试
17
+ {test command}
18
+
19
+ # 构建
20
+ {build command}
21
+
22
+ # 部署
23
+ {deploy command}
24
+ ```
25
+
26
+ ## 环境要求
27
+ - Node: {version}
28
+ - 包管理器: {pnpm | npm | yarn}
29
+ - 其他: {其他依赖}
30
+
31
+ ## 已知限制
32
+ - {限制 1}
33
+ - {限制 2}