cortico-world-memory-core 0.4.4 → 0.12.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/src/config.ts CHANGED
@@ -1,258 +1,266 @@
1
- /**
2
- * worlds['memory-core'] 的形状、默认值与设置页表单。
3
- * 默认 enabled=false:没在部署配置里打开时不会运行。
4
- */
5
- import type { ConfigGroup } from 'cortico/core/types.ts';
6
-
7
- export interface MemoryCoreConfig {
8
- enabled: boolean;
9
- /** 主动开口总开关。 */
10
- proactiveEnabled: boolean;
11
- /** 两次主动之间的最小间隔(分钟)。 */
12
- proactiveMinGapMin: number;
13
- /** 在最小间隔上再加的随机抖动上限(分钟),避免准点开口。 */
14
- proactiveJitterMin: number;
15
- /** 每天主动上限(0 = 不限,不建议)。 */
16
- proactiveDailyCap: number;
17
- /** 对方刚说过话后的静默窗口(分钟)。 */
18
- idleGateMin: number;
19
- /** 只有最近这么多小时内对方说过话才主动(0 = 不限制)。 */
20
- requireRecentUserHours: number;
21
- /** 承诺到期后,隔多少天可以再提醒一次(0 = 只提醒一次)。 */
22
- promiseRepeatDays: number; /** 免打扰开始(含)。 */
23
- quietStart: string;
24
- /** 免打扰结束(不含)。 */
25
- quietEnd: string;
26
- /** 睡觉开始(含)。 */
27
- sleepStart: string;
28
- /** 睡觉结束(不含)。 */
29
- sleepEnd: string;
30
- /** 记忆总开关。 */
31
- memoryEnabled: boolean;
32
- /** 是否把最近 7 天的对话原文存到本地,供检索。 */
33
- captureTurns: boolean;
34
- /** 哪些来源算「对方在跟我说话」,正则匹配 senderKey。 */
35
- captureSenders: string;
36
- /** 短于这么多字的对话原文不存(过滤表情、单字、口令回执)。 */
37
- captureMinLength: number;
38
- /** 对话原文保留天数(热数据,超过就按天归档)。 */
39
- rawRetentionDays: number;
40
- /** 归档保留天数(0 = 永久)。 */
41
- rawArchiveDays: number;
42
- /** 启动后把历史事件重扫一遍补录(只做一次)。 */
43
- captureBackfill: boolean;
44
- /** 一次召回最多给几条。 */
45
- recallLimit: number;
46
- /** 召回结果的总字数上限。 */
47
- recallMaxChars: number;
48
- /** 排序时是否参考「上次被想起的时间」:久不用的旧卡不抢新卡的位。 */
49
- recallUseAging: boolean;
50
- /** 每隔多少分钟把状态作为一条事件投递一次(0 = 不投递,最省)。 */
51
- contextEveryMin: number;
52
- /** 夜间是否唤醒一轮让角色整理记忆(会多一次完整请求)。 */
53
- nightlyConsolidate: boolean;
54
- /** 夜间整理的小时(0-23)。 */
55
- nightlyHour: number;
56
- /** 醒着时每小时掉的精力。 */
57
- energyDecayPerHour: number;
58
- /** 检索时是否连工作区里的笔记文件一起搜。 */
59
- workspaceScanEnabled: boolean;
60
- /** 要搜的目录,逗号分隔;支持 {workspace} {bot} {data}。 */
61
- workspaceDirs: string;
62
- /** 只搜这些后缀。 */
63
- workspaceExts: string;
64
- /** 最多读多少个文件。 */
65
- workspaceMaxFiles: number;
66
- /** 单个文件超过这么多 KB 就跳过。 */
67
- workspaceMaxFileKB: number;
68
- /** 记忆地图站点开关。 */
69
- siteEnabled: boolean;
70
- /** 记忆地图站点端口,被占会自动往后试。 */
71
- sitePort: number;
72
- }
73
-
74
- export const MEMORY_CORE_DEFAULTS: MemoryCoreConfig = {
75
- enabled: false,
76
- proactiveEnabled: true,
77
- proactiveMinGapMin: 100,
78
- proactiveJitterMin: 25,
79
- proactiveDailyCap: 3,
80
- idleGateMin: 20,
81
- requireRecentUserHours: 8,
82
- promiseRepeatDays: 1,
83
- quietStart: '23:30',
84
- quietEnd: '08:00',
85
- sleepStart: '01:00',
86
- sleepEnd: '08:00',
87
- memoryEnabled: true,
88
- captureTurns: true,
89
- // 真实 senderKey 长这样:private:1940008084(QQ 私聊)、desktop-pet.chat(桌宠对话)。
90
- // 老默认值一个都匹配不上,导致原文库一直是 0 行 —— 改这个 regex 前先看一遍 data/runs/*/events.jsonl。
91
- captureSenders: '^(desktop-pet\\.(chat|message|answer|voice)|private:|qq\\.private\\.|starpost\\.private\\.)',
92
- captureMinLength: 4,
93
- rawRetentionDays: 7,
94
- rawArchiveDays: 90,
95
- captureBackfill: false,
96
- recallLimit: 5,
97
- recallMaxChars: 600,
98
- recallUseAging: true,
99
- contextEveryMin: 0,
100
- nightlyConsolidate: false,
101
- nightlyHour: 3,
102
- energyDecayPerHour: 2.2,
103
- workspaceScanEnabled: true,
104
- workspaceDirs: '{workspace}/memories,{workspace}/notes',
105
- workspaceExts: 'md,txt',
106
- workspaceMaxFiles: 300,
107
- workspaceMaxFileKB: 256,
108
- siteEnabled: true,
109
- sitePort: 7801,
110
- };
111
-
112
- const num = (
113
- title: string,
114
- description: string,
115
- minimum: number,
116
- maximum: number,
117
- suffix: string,
118
- ): Record<string, unknown> => ({
119
- type: 'integer',
120
- title,
121
- description,
122
- minimum,
123
- maximum,
124
- 'x-suffix': suffix,
125
- 'x-hot': true,
126
- });
127
-
128
- /** 设置页表单:键是 cfg 里的点分路径。全部热更新,改完不用重启。 */
129
- export const MEMORY_CORE_CONFIG_GROUP: ConfigGroup = {
130
- id: 'world:memory-core',
131
- owner: 'world:memory-core',
132
- schema: {
133
- type: 'object',
134
- title: '记忆核心',
135
- description: '四套记忆合成的一套:一张卡片表 + 4 个工具 + 一段提示词。前面那四套插件的记忆会在第一次启动时只读导入,原文件不动。',
136
- properties: {
137
- 'worlds.memory-core.proactiveEnabled': {
138
- type: 'boolean',
139
- title: '主动开口',
140
- description: '按自己的节奏找对方说一句。关掉后只在对方开口时回应。',
141
- 'x-hot': true,
142
- },
143
- 'worlds.memory-core.proactiveMinGapMin': num('两次主动的最小间隔', '默认 100 分钟。太短会显得粘人,也费 token。', 15, 720, '分钟'),
144
- 'worlds.memory-core.proactiveJitterMin': num('随机抖动', '在最小间隔上加 0 到这么多分钟的随机量,避免每天准点开口。', 0, 120, '分钟'),
145
- 'worlds.memory-core.proactiveDailyCap': num('每天主动上限', '每次主动都是一次完整请求,3 次约等于 30 万 token。0 = 不限。', 0, 12, '次'),
146
- 'worlds.memory-core.idleGateMin': num('对方刚说话后的静默', '窗口内不主动,免得打断。', 0, 240, '分钟'),
147
- 'worlds.memory-core.requireRecentUserHours': num('对方多久没说话就不主动', '超过这个时长就当没人在,主动会对着空房间说话、白花钱。0 = 不限制。', 0, 72, '小时'),
148
- 'worlds.memory-core.promiseRepeatDays': num('承诺隔几天再提一次', '到期还没做的承诺,隔这么多天再提一次,直到做完或退休。默认 1(每天最多一次);0 = 只提醒一次。', 0, 30, '天'),
149
- 'worlds.memory-core.quietStart': {
150
- type: 'string',
151
- title: '免打扰开始',
152
- description: '24 小时制 HH:MM。起止相同等于不启用。',
153
- 'x-hot': true,
154
- },
155
- 'worlds.memory-core.quietEnd': {
156
- type: 'string',
157
- title: '免打扰结束',
158
- description: '24 小时制 HH:MM。',
159
- 'x-hot': true,
160
- },
161
- 'worlds.memory-core.sleepStart': {
162
- type: 'string',
163
- title: '睡觉开始',
164
- description: '这个时段里状态会显示「在睡觉」,精力回升。',
165
- 'x-hot': true,
166
- },
167
- 'worlds.memory-core.sleepEnd': {
168
- type: 'string',
169
- title: '睡觉结束',
170
- 'x-hot': true,
171
- },
172
- 'worlds.memory-core.memoryEnabled': {
173
- type: 'boolean',
174
- title: '记忆',
175
- description: '关掉后不再读写卡片,已有记录仍留在数据目录。',
176
- 'x-hot': true,
177
- },
178
- 'worlds.memory-core.captureTurns': {
179
- type: 'boolean',
180
- title: '存对话原文',
181
- description: '把对方最近的私聊存成一行行本地文本,供「搜最近聊过什么」。只存这一个方向,不存你自己说的话。',
182
- 'x-hot': true,
183
- },
184
- 'worlds.memory-core.captureSenders': {
185
- type: 'string',
186
- title: '算作对话的来源',
187
- description: '正则匹配事件的 senderKey。默认认 QQ 私聊(private:数字)、桌宠对话(desktop-pet.chat / voice)、星邮私聊;群聊不算。填错了一个字都录不到,改完看「对话原文」页有没有进新行。',
188
- 'x-hot': true,
189
- },
190
- 'worlds.memory-core.captureMinLength': num('原文最短几个字', '短于这个长度的消息不进原文库(表情、单字、口令回执照样过滤)。', 1, 20, '字'),
191
- 'worlds.memory-core.rawRetentionDays': num('原文热数据天数', '超过这么多天的对话会挪进 archive/ 按天归档,不再直接删。', 1, 90, '天'),
192
- 'worlds.memory-core.rawArchiveDays': num('归档保留天数', '归档按天存,超过这么多天的文件在启动时删掉。0 = 永久保留(占盘,自己看着办)。', 0, 3650, '天'),
193
- 'worlds.memory-core.captureBackfill': {
194
- type: 'boolean',
195
- title: '重扫历史补录',
196
- description: '打开后重启一次:把水位倒回开头,把宿主还留着的历史消息重扫一遍。只做一次,做完自动关掉自己。',
197
- 'x-hot': false,
198
- },
199
- 'worlds.memory-core.recallLimit': num('一次召回给几条', '默认 5 条。给多了挤占上下文。', 1, 12, '条'),
200
- 'worlds.memory-core.recallMaxChars': num('召回结果字数上限', '超过就截断,默认 600 字。', 120, 2000, '字'),
201
- 'worlds.memory-core.recallUseAging': {
202
- type: 'boolean',
203
- title: '久不用的记忆让位',
204
- description: '排序时参考「上次被想起的时间」:长期没被召回、权重又低的卡排到后面。关掉就退回只看关键词、标签和权重。',
205
- },
206
- 'worlds.memory-core.contextEveryMin': num('状态投递间隔', '每隔这么多分钟把「我在做什么」推到上下文里。0 = 不推(默认,最省);推一次约 60 token,但每轮都在历史里。', 0, 240, '分钟'),
207
- 'worlds.memory-core.nightlyConsolidate': {
208
- type: 'boolean',
209
- title: '夜间整理',
210
- description: '每晚唤醒一轮,让它把当天的事写成几条 episode。会多一次完整请求(约 8-10 万 token),默认关。',
211
- 'x-hot': true,
212
- },
213
- 'worlds.memory-core.nightlyHour': num('夜间整理时间', '24 小时制的小时数。', 0, 23, '点'),
214
- 'worlds.memory-core.energyDecayPerHour': {
215
- type: 'number',
216
- title: '精力每小时下降',
217
- description: '醒着时掉的精力,睡一觉回满。',
218
- minimum: 0,
219
- maximum: 20,
220
- 'x-hot': true,
221
- },
222
- 'worlds.memory-core.workspaceScanEnabled': {
223
- type: 'boolean',
224
- title: '连工作区笔记一起搜',
225
- description: '「你还记得吗」时,除了卡片和对话原文,也去笔记目录里找。只读,不改文件;结果带 60 秒缓存。',
226
- 'x-hot': true,
227
- },
228
- 'worlds.memory-core.workspaceDirs': {
229
- type: 'string',
230
- title: '要搜的目录',
231
- description: '逗号分隔。可用 {workspace}(部署的 workspace 目录)、{bot}(部署目录)、{data}(同 {bot})。相对路径按 workspace 解析。',
232
- 'x-hot': true,
233
- },
234
- 'worlds.memory-core.workspaceExts': {
235
- type: 'string',
236
- title: '文件后缀',
237
- description: '逗号分隔,默认 md,txt。',
238
- 'x-hot': true,
239
- },
240
- 'worlds.memory-core.workspaceMaxFiles': num('最多读几个文件', '按修改时间取最近的。目录很大时调小,别让它拖慢召回。', 1, 2000, '个'),
241
- 'worlds.memory-core.workspaceMaxFileKB': num('单文件上限', '超过就跳过,避免读到几 MB 的日志。', 16, 4096, 'KB'),
242
- 'worlds.memory-core.siteEnabled': {
243
- type: 'boolean',
244
- title: '记忆地图站点',
245
- description: '在本机 127.0.0.1 起一个小站点,看图谱、时间线、原文,也能直接改卡片。改完要重载 World 才生效。',
246
- 'x-hot': false,
247
- },
248
- 'worlds.memory-core.sitePort': {
249
- type: 'integer',
250
- title: '记忆地图端口',
251
- description: '默认 7801。被占用会自动往后找 10 个。改完要重载 World 才生效。',
252
- minimum: 1024,
253
- maximum: 65535,
254
- 'x-hot': false,
255
- },
256
- },
257
- },
258
- };
1
+ /**
2
+ * worlds['memory-core'] 的形状、默认值与设置页表单。
3
+ * 默认 enabled=false:没在部署配置里打开时不会运行。
4
+ */
5
+ import type { ConfigGroup } from 'cortico/core/types.ts';
6
+
7
+ export interface MemoryCoreConfig {
8
+ enabled: boolean;
9
+ /** 主动开口总开关。 */
10
+ proactiveEnabled: boolean;
11
+ /** 两次主动之间的最小间隔(分钟)。 */
12
+ proactiveMinGapMin: number;
13
+ /** 在最小间隔上再加的随机抖动上限(分钟),避免准点开口。 */
14
+ proactiveJitterMin: number;
15
+ /** 每天主动上限(0 = 不限,不建议)。 */
16
+ proactiveDailyCap: number;
17
+ /** 对方刚说过话后的静默窗口(分钟)。 */
18
+ idleGateMin: number;
19
+ /** 只有最近这么多小时内对方说过话才主动(0 = 不限制)。 */
20
+ requireRecentUserHours: number;
21
+ /** 承诺到期后,隔多少天可以再提醒一次(0 = 只提醒一次)。 */
22
+ promiseRepeatDays: number; /** 免打扰开始(含)。 */
23
+ quietStart: string;
24
+ /** 免打扰结束(不含)。 */
25
+ quietEnd: string;
26
+ /** 睡觉开始(含)。 */
27
+ sleepStart: string;
28
+ /** 睡觉结束(不含)。 */
29
+ sleepEnd: string;
30
+ /** 记忆总开关。 */
31
+ memoryEnabled: boolean;
32
+ /** 是否把最近 7 天的对话原文存到本地,供检索。 */
33
+ captureTurns: boolean;
34
+ /** 哪些来源算「对方在跟我说话」,正则匹配 senderKey。 */
35
+ captureSenders: string;
36
+ /** 短于这么多字的对话原文不存(过滤表情、单字、口令回执)。 */
37
+ captureMinLength: number;
38
+ /** 对话原文保留天数(热数据,超过就按天归档)。 */
39
+ rawRetentionDays: number;
40
+ /** 归档保留天数(0 = 永久)。 */
41
+ rawArchiveDays: number;
42
+ /** 启动后把历史事件重扫一遍补录(只做一次)。 */
43
+ captureBackfill: boolean;
44
+ /** 一次召回最多给几条。 */
45
+ recallLimit: number;
46
+ /** 召回结果的总字数上限。 */
47
+ recallMaxChars: number;
48
+ /** 排序时是否参考「上次被想起的时间」:久不用的旧卡不抢新卡的位。 */
49
+ recallUseAging: boolean;
50
+ /** 每轮主动想起几条(0 = 关)。预激活,不占工具调用。 */
51
+ preactivateLines: number;
52
+ /** 多久没被想起就沉到冷层(天)。0 = 关闭自动分层。 */
53
+ chillAfterDays: number;
54
+ /** 每隔多少分钟把状态作为一条事件投递一次(0 = 不投递,最省)。 */
55
+ contextEveryMin: number;
56
+ /** 夜间是否唤醒一轮让角色整理记忆(会多一次完整请求)。 */
57
+ nightlyConsolidate: boolean;
58
+ /** 夜间整理的小时(0-23)。 */
59
+ nightlyHour: number;
60
+ /** 醒着时每小时掉的精力。 */
61
+ energyDecayPerHour: number;
62
+ /** 检索时是否连工作区里的笔记文件一起搜。 */
63
+ workspaceScanEnabled: boolean;
64
+ /** 要搜的目录,逗号分隔;支持 {workspace} {bot} {data}。 */
65
+ workspaceDirs: string;
66
+ /** 只搜这些后缀。 */
67
+ workspaceExts: string;
68
+ /** 最多读多少个文件。 */
69
+ workspaceMaxFiles: number;
70
+ /** 单个文件超过这么多 KB 就跳过。 */
71
+ workspaceMaxFileKB: number;
72
+ /** 记忆地图站点开关。 */
73
+ siteEnabled: boolean;
74
+ /** 记忆地图站点端口,被占会自动往后试。 */
75
+ sitePort: number;
76
+ }
77
+
78
+ export const MEMORY_CORE_DEFAULTS: MemoryCoreConfig = {
79
+ enabled: false,
80
+ proactiveEnabled: true,
81
+ proactiveMinGapMin: 100,
82
+ proactiveJitterMin: 25,
83
+ proactiveDailyCap: 3,
84
+ idleGateMin: 20,
85
+ requireRecentUserHours: 8,
86
+ promiseRepeatDays: 1,
87
+ quietStart: '23:30',
88
+ quietEnd: '08:00',
89
+ sleepStart: '01:00',
90
+ sleepEnd: '08:00',
91
+ memoryEnabled: true,
92
+ captureTurns: true,
93
+ // 真实 senderKey 长这样:private:1940008084(QQ 私聊)、desktop-pet.chat(桌宠对话)。
94
+ // 老默认值一个都匹配不上,导致原文库一直是 0 行 —— 改这个 regex 前先看一遍 data/runs/*/events.jsonl。
95
+ captureSenders: '^(desktop-pet\\.(chat|message|answer|voice)|private:|qq\\.private\\.|starpost\\.private\\.)',
96
+ captureMinLength: 4,
97
+ rawRetentionDays: 7,
98
+ rawArchiveDays: 90,
99
+ captureBackfill: false,
100
+ recallLimit: 5,
101
+ recallMaxChars: 600,
102
+ recallUseAging: true,
103
+ preactivateLines: 2,
104
+ chillAfterDays: 30,
105
+ contextEveryMin: 0,
106
+ nightlyConsolidate: false,
107
+ nightlyHour: 3,
108
+ energyDecayPerHour: 2.2,
109
+ workspaceScanEnabled: true,
110
+ workspaceDirs: '{workspace}/memories,{workspace}/notes',
111
+ workspaceExts: 'md,txt',
112
+ workspaceMaxFiles: 300,
113
+ workspaceMaxFileKB: 256,
114
+ siteEnabled: true,
115
+ sitePort: 7801,
116
+ };
117
+
118
+ const num = (
119
+ title: string,
120
+ description: string,
121
+ minimum: number,
122
+ maximum: number,
123
+ suffix: string,
124
+ ): Record<string, unknown> => ({
125
+ type: 'integer',
126
+ title,
127
+ description,
128
+ minimum,
129
+ maximum,
130
+ 'x-suffix': suffix,
131
+ 'x-hot': true,
132
+ });
133
+
134
+ /** 设置页表单:键是 cfg 里的点分路径。全部热更新,改完不用重启。 */
135
+ export const MEMORY_CORE_CONFIG_GROUP: ConfigGroup = {
136
+ id: 'world:memory-core',
137
+ owner: 'world:memory-core',
138
+ schema: {
139
+ type: 'object',
140
+ title: '记忆核心',
141
+ description: '四套记忆合成的一套:一张卡片表 + 4 个工具 + 一段提示词。前面那四套插件的记忆会在第一次启动时只读导入,原文件不动。',
142
+ properties: {
143
+ 'worlds.memory-core.proactiveEnabled': {
144
+ type: 'boolean',
145
+ title: '主动开口',
146
+ description: '按自己的节奏找对方说一句。关掉后只在对方开口时回应。',
147
+ 'x-hot': true,
148
+ },
149
+ 'worlds.memory-core.proactiveMinGapMin': num('两次主动的最小间隔', '默认 100 分钟。太短会显得粘人,也费 token。', 15, 720, '分钟'),
150
+ 'worlds.memory-core.proactiveJitterMin': num('随机抖动', '在最小间隔上加 0 到这么多分钟的随机量,避免每天准点开口。', 0, 120, '分钟'),
151
+ 'worlds.memory-core.proactiveDailyCap': num('每天主动上限', '每次主动都是一次完整请求,3 次约等于 30 万 token。0 = 不限。', 0, 12, '次'),
152
+ 'worlds.memory-core.idleGateMin': num('对方刚说话后的静默', '窗口内不主动,免得打断。', 0, 240, '分钟'),
153
+ 'worlds.memory-core.requireRecentUserHours': num('对方多久没说话就不主动', '超过这个时长就当没人在,主动会对着空房间说话、白花钱。0 = 不限制。', 0, 72, '小时'),
154
+ 'worlds.memory-core.promiseRepeatDays': num('承诺隔几天再提一次', '到期还没做的承诺,隔这么多天再提一次,直到做完或退休。默认 1(每天最多一次);0 = 只提醒一次。', 0, 30, '天'),
155
+ 'worlds.memory-core.quietStart': {
156
+ type: 'string',
157
+ title: '免打扰开始',
158
+ description: '24 小时制 HH:MM。起止相同等于不启用。',
159
+ 'x-hot': true,
160
+ },
161
+ 'worlds.memory-core.quietEnd': {
162
+ type: 'string',
163
+ title: '免打扰结束',
164
+ description: '24 小时制 HH:MM。',
165
+ 'x-hot': true,
166
+ },
167
+ 'worlds.memory-core.sleepStart': {
168
+ type: 'string',
169
+ title: '睡觉开始',
170
+ description: '这个时段里状态会显示「在睡觉」,精力回升。',
171
+ 'x-hot': true,
172
+ },
173
+ 'worlds.memory-core.sleepEnd': {
174
+ type: 'string',
175
+ title: '睡觉结束',
176
+ 'x-hot': true,
177
+ },
178
+ 'worlds.memory-core.memoryEnabled': {
179
+ type: 'boolean',
180
+ title: '记忆',
181
+ description: '关掉后不再读写卡片,已有记录仍留在数据目录。',
182
+ 'x-hot': true,
183
+ },
184
+ 'worlds.memory-core.captureTurns': {
185
+ type: 'boolean',
186
+ title: '存对话原文',
187
+ description: '把对方最近的私聊存成一行行本地文本,供「搜最近聊过什么」。只存这一个方向,不存你自己说的话。',
188
+ 'x-hot': true,
189
+ },
190
+ 'worlds.memory-core.captureSenders': {
191
+ type: 'string',
192
+ title: '算作对话的来源',
193
+ description: '正则匹配事件的 senderKey。默认认 QQ 私聊(private:数字)、桌宠对话(desktop-pet.chat / voice)、星邮私聊;群聊不算。填错了一个字都录不到,改完看「对话原文」页有没有进新行。',
194
+ 'x-hot': true,
195
+ },
196
+ 'worlds.memory-core.captureMinLength': num('原文最短几个字', '短于这个长度的消息不进原文库(表情、单字、口令回执照样过滤)。', 1, 20, '字'),
197
+ 'worlds.memory-core.rawRetentionDays': num('原文热数据天数', '超过这么多天的对话会挪进 archive/ 按天归档,不再直接删。', 1, 90, '天'),
198
+ 'worlds.memory-core.rawArchiveDays': num('归档保留天数', '归档按天存,超过这么多天的文件在启动时删掉。0 = 永久保留(占盘,自己看着办)。', 0, 3650, '天'),
199
+ 'worlds.memory-core.captureBackfill': {
200
+ type: 'boolean',
201
+ title: '重扫历史补录',
202
+ description: '打开后重启一次:把水位倒回开头,把宿主还留着的历史消息重扫一遍。只做一次,做完自动关掉自己。',
203
+ 'x-hot': false,
204
+ },
205
+ 'worlds.memory-core.recallLimit': num('一次召回给几条', '默认 5 条。给多了挤占上下文。', 1, 12, '条'),
206
+ 'worlds.memory-core.recallMaxChars': num('召回结果字数上限', '超过就截断,默认 600 字。', 120, 2000, '字'),
207
+ 'worlds.memory-core.recallUseAging': {
208
+ type: 'boolean',
209
+ title: '久不用的记忆让位',
210
+ description: '排序时参考「上次被想起的时间」:长期没被召回、权重又低的卡排到后面。关掉就退回只看关键词、标签和权重。',
211
+ },
212
+ 'worlds.memory-core.preactivateLines': num('每轮主动想起几条', '按对方刚说的话自动带出几条旧记忆,不用模型自己去查。0 = 关。每条约 20 字,默认 2 条。', 0, 3, '条'),
213
+ 'worlds.memory-core.chillAfterDays': num('多久没想起就沉到冷层', '超过这个天数没被用过的低权重「经历/临时」记忆会沉到冷层:不再主动想起、不占「最近」,但搜索仍能找到,可一键回暖。事实、自我和未完成的承诺不会被沉。0 = 关闭。', 0, 3650, '天'),
214
+ 'worlds.memory-core.contextEveryMin': num('状态投递间隔', '每隔这么多分钟把「我在做什么」推到上下文里。0 = 不推(默认,最省);推一次约 60 token,但每轮都在历史里。', 0, 240, '分钟'),
215
+ 'worlds.memory-core.nightlyConsolidate': {
216
+ type: 'boolean',
217
+ title: '夜间整理',
218
+ description: '每晚唤醒一轮,让它把当天的事写成几条 episode。会多一次完整请求(约 8-10 万 token),默认关。',
219
+ 'x-hot': true,
220
+ },
221
+ 'worlds.memory-core.nightlyHour': num('夜间整理时间', '24 小时制的小时数。', 0, 23, '点'),
222
+ 'worlds.memory-core.energyDecayPerHour': {
223
+ type: 'number',
224
+ title: '精力每小时下降',
225
+ description: '醒着时掉的精力,睡一觉回满。',
226
+ minimum: 0,
227
+ maximum: 20,
228
+ 'x-hot': true,
229
+ },
230
+ 'worlds.memory-core.workspaceScanEnabled': {
231
+ type: 'boolean',
232
+ title: '连工作区笔记一起搜',
233
+ description: '「你还记得吗」时,除了卡片和对话原文,也去笔记目录里找。只读,不改文件;结果带 60 秒缓存。',
234
+ 'x-hot': true,
235
+ },
236
+ 'worlds.memory-core.workspaceDirs': {
237
+ type: 'string',
238
+ title: '要搜的目录',
239
+ description: '逗号分隔。可用 {workspace}(部署的 workspace 目录)、{bot}(部署目录)、{data}(同 {bot})。相对路径按 workspace 解析。',
240
+ 'x-hot': true,
241
+ },
242
+ 'worlds.memory-core.workspaceExts': {
243
+ type: 'string',
244
+ title: '文件后缀',
245
+ description: '逗号分隔,默认 md,txt。',
246
+ 'x-hot': true,
247
+ },
248
+ 'worlds.memory-core.workspaceMaxFiles': num('最多读几个文件', '按修改时间取最近的。目录很大时调小,别让它拖慢召回。', 1, 2000, '个'),
249
+ 'worlds.memory-core.workspaceMaxFileKB': num('单文件上限', '超过就跳过,避免读到几 MB 的日志。', 16, 4096, 'KB'),
250
+ 'worlds.memory-core.siteEnabled': {
251
+ type: 'boolean',
252
+ title: '记忆地图站点',
253
+ description: '在本机 127.0.0.1 起一个小站点,看图谱、时间线、原文,也能直接改卡片。改完要重载 World 才生效。',
254
+ 'x-hot': false,
255
+ },
256
+ 'worlds.memory-core.sitePort': {
257
+ type: 'integer',
258
+ title: '记忆地图端口',
259
+ description: '默认 7801。被占用会自动往后找 10 个。改完要重载 World 才生效。',
260
+ minimum: 1024,
261
+ maximum: 65535,
262
+ 'x-hot': false,
263
+ },
264
+ },
265
+ },
266
+ };