luckytri 1.1.2 → 1.2.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.
Files changed (95) hide show
  1. package/README.en.md +14 -12
  2. package/README.md +4 -2
  3. package/docs/en/CHANGELOG.md +24 -0
  4. package/docs/en/architecture.md +12 -10
  5. package/docs/en/chat-style.md +13 -13
  6. package/docs/en/cognition.md +12 -4
  7. package/docs/en/evolution.md +35 -0
  8. package/docs/en/her-life.md +5 -2
  9. package/docs/en/vision.md +50 -0
  10. package/docs/zh/CHANGELOG.md +24 -0
  11. package/docs/zh/architecture.md +12 -10
  12. package/docs/zh/chat-style.md +17 -17
  13. package/docs/zh/cognition.md +12 -4
  14. package/docs/zh/evolution.md +35 -0
  15. package/docs/zh/her-life.md +5 -2
  16. package/docs/zh/vision.md +50 -0
  17. package/package.json +4 -1
  18. package/public/app/assets/{ChatsPage-IfBgNdaD.js → ChatsPage-eDqFIg97.js} +1 -1
  19. package/public/app/assets/{Empty-DK9nQPCf.js → Empty-CAGOJsfD.js} +1 -1
  20. package/public/app/assets/{Field-BzKFhuFd.js → Field-CRz-JmN1.js} +1 -1
  21. package/public/app/assets/{HeartPage-CKxrbfFQ.js → HeartPage-BGWoeMrC.js} +1 -1
  22. package/public/app/assets/{LifePage-CtxPEi6E.js → LifePage-iao3o3wt.js} +1 -1
  23. package/public/app/assets/{MemoryPage-B8FLXzLi.js → MemoryPage-Dwi2yi7E.js} +1 -1
  24. package/public/app/assets/NaturePage-DniImo9U.js +3 -0
  25. package/public/app/assets/{NaturePage-CHkpb5NK.css → NaturePage-zguDpGWY.css} +1 -1
  26. package/public/app/assets/{PeoplePage-D3yn0HV0.js → PeoplePage-D-MC3JEt.js} +1 -1
  27. package/public/app/assets/{PluginsPage-ojv8zawj.js → PluginsPage-D7dJTf96.js} +1 -1
  28. package/public/app/assets/SystemPage-C5CUHjGh.js +1 -0
  29. package/public/app/assets/{SystemPage-CGVTvNZw.css → SystemPage-C_Y5M7JU.css} +1 -1
  30. package/public/app/assets/{TimePage-Dyd-FFbq.js → TimePage-Dwhr3-92.js} +1 -1
  31. package/public/app/assets/{index-BJfzfgnm.js → index-L0bHax8C.js} +3 -3
  32. package/public/app/assets/{knowledge-C-bND0Ub.js → knowledge-BTDNafzl.js} +1 -1
  33. package/public/app/assets/{media-D7G3Nco6.js → media-BBzOAfNG.js} +1 -1
  34. package/public/app/assets/{mind-ec-G6iNZ.js → mind-CBTkFje2.js} +1 -1
  35. package/public/app/index.html +3 -3
  36. package/public/guide.en.html +3 -3
  37. package/public/guide.html +3 -3
  38. package/scripts/migrate-instance.js +27 -0
  39. package/scripts/update-instance.js +21 -2
  40. package/server/channels/contract.js +5 -1
  41. package/server/channels/hub.js +2 -2
  42. package/server/channels/onebot/adapter.js +291 -288
  43. package/server/channels/onebot/index.js +2 -2
  44. package/server/channels/qqbot/api.js +194 -199
  45. package/server/core/context-builder.js +20 -3
  46. package/server/core/conversation-cues.js +5 -4
  47. package/server/core/conversation-grounding.js +20 -17
  48. package/server/core/conversation-needs.js +32 -0
  49. package/server/core/dialogue-context.js +2 -5
  50. package/server/core/dialogue-contract.js +23 -16
  51. package/server/core/message-scheduler.js +85 -78
  52. package/server/core/model-manager.js +113 -16
  53. package/server/core/model-presets.js +1 -1
  54. package/server/core/orchestrator.js +18 -2
  55. package/server/core/persona-manager.js +14 -5
  56. package/server/core/reader-check.js +47 -42
  57. package/server/core/reply-delivery.js +125 -34
  58. package/server/core/response-validator.js +28 -1
  59. package/server/core/retired-prompts.js +5 -0
  60. package/server/core/speech-length.js +43 -0
  61. package/server/core/turn-processor.js +38 -5
  62. package/server/core/turn.js +70 -16
  63. package/server/i18n/errors.js +30 -0
  64. package/server/i18n/labels.js +5 -0
  65. package/server/index.js +3 -0
  66. package/server/knowledge/embedding-profile.js +126 -29
  67. package/server/knowledge/manager.js +103 -34
  68. package/server/knowledge/schema.js +197 -158
  69. package/server/mind/affect.js +267 -265
  70. package/server/mind/aftermath.js +169 -0
  71. package/server/mind/anticipations.js +2 -0
  72. package/server/mind/clock.js +91 -83
  73. package/server/mind/discretion.js +20 -0
  74. package/server/mind/episodes.js +2 -1
  75. package/server/mind/index.js +17 -2
  76. package/server/mind/initiative.js +29 -14
  77. package/server/mind/memory.js +47 -5
  78. package/server/mind/recall/cue.js +67 -0
  79. package/server/mind/recall/index.js +183 -29
  80. package/server/mind/recall/roots.js +231 -0
  81. package/server/mind/recall/schema.js +2 -0
  82. package/server/mind/recall/store.js +113 -30
  83. package/server/mind/salience.js +22 -1
  84. package/server/mind/schema.js +5 -0
  85. package/server/mind/thoughts.js +276 -274
  86. package/server/mind/view.js +100 -60
  87. package/server/plugins/install.js +1 -6
  88. package/server/plugins/zip.js +18 -4
  89. package/server/runtime/data-migration.js +193 -0
  90. package/server/runtime/update-execution.js +43 -4
  91. package/server/runtime/update-manager.js +4 -1
  92. package/server/storage/archive.js +1 -1
  93. package/server/storage/backup-scheduler.js +15 -3
  94. package/public/app/assets/NaturePage-C7i607ul.js +0 -3
  95. package/public/app/assets/SystemPage-Cv3rFvyT.js +0 -1
package/README.en.md CHANGED
@@ -19,6 +19,7 @@
19
19
  <a href="docs/en/connect.md">Connect QQ</a> ·
20
20
  <a href="docs/en/her-life.md">Her life</a> ·
21
21
  <a href="docs/en/architecture.md">Architecture</a> ·
22
+ <a href="docs/en/vision.md">Vision</a> ·
22
23
  <a href="docs/en/CHANGELOG.md">Changelog</a> ·
23
24
  <a href=".github/SECURITY.md">Security</a>
24
25
  </p>
@@ -94,7 +95,7 @@ The full design is in [Her life](docs/en/her-life.md) and [Architecture and exte
94
95
 
95
96
  Recent work focuses on continuity and clearer conversation. Account-based recognition links public encounters across groups and private chats. Relationships, forms of address, her own views and private promises retain their sources and visibility boundaries. An ordinary greeting need not bring back unfinished tasks or demonstrate how much she remembers.
96
97
 
97
- **1.1.2 update:** Embedding dimension 0 uses the model's own length. For doubao-embedding-vision that is 2048, and it is no longer forced to 1024. See the [changelog](docs/en/CHANGELOG.md).
98
+ **1.2.0 update:** Instance updates now back up and verify the database before migrating legacy memories and indexes; a failed check restores the previous release and data. See the [changelog](docs/en/CHANGELOG.md).
98
99
 
99
100
  | Area | What it does today |
100
101
  | ------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
@@ -210,17 +211,18 @@ The database, chat records, model keys and backups live locally in the ignored `
210
211
 
211
212
  ## Documentation
212
213
 
213
- | Document | Contents |
214
- | ------------------------------------------------------------ | ----------------------------------------------------------------------------- |
215
- | [Getting started](docs/en/guide.md) | From launching to letting her join her first conversation |
216
- | [Connect QQ](docs/en/connect.md) | The two connection ways: comparison, steps and differences |
217
- | [Her life](docs/en/her-life.md) | The unified mind: rhythm, solitude, diary, review, tact and boundaries |
218
- | [Architecture and extension points](docs/en/architecture.md) | Code layers, and how to add a channel, a mind module, a page or a translation |
219
- | [Time, activities and works](docs/en/time.md) | Her own activities, plans, works and sharing |
220
- | [Chat style](docs/en/chat-style.md) | How she speaks and the checks before sending |
221
- | [Studio design](docs/en/webui.md) | Design and upkeep of "TA's little world" |
222
- | [Backup and recovery](docs/en/recovery.md) | Backups, migrations, verification and restore |
223
- | [Changelog](docs/en/CHANGELOG.md) | What changed in each version |
214
+ | Document | Contents |
215
+ | ------------------------------------------------------------ | -------------------------------------------------------------------------------------------------- |
216
+ | [Getting started](docs/en/guide.md) | From launching to letting her join her first conversation |
217
+ | [Connect QQ](docs/en/connect.md) | The two connection ways: comparison, steps and differences |
218
+ | [Her life](docs/en/her-life.md) | The unified mind: rhythm, solitude, diary, review, tact and boundaries |
219
+ | [Ultimate vision](docs/en/vision.md) | The highest guiding principle: her judgments come, in the end, from her own experience and choices |
220
+ | [Architecture and extension points](docs/en/architecture.md) | Code layers, and how to add a channel, a mind module, a page or a translation |
221
+ | [Time, activities and works](docs/en/time.md) | Her own activities, plans, works and sharing |
222
+ | [Chat style](docs/en/chat-style.md) | How she speaks and the checks before sending |
223
+ | [Studio design](docs/en/webui.md) | Design and upkeep of "TA's little world" |
224
+ | [Backup and recovery](docs/en/recovery.md) | Backups, migrations, verification and restore |
225
+ | [Changelog](docs/en/CHANGELOG.md) | What changed in each version |
224
226
 
225
227
  ## Development and tests
226
228
 
package/README.md CHANGED
@@ -19,6 +19,7 @@
19
19
  <a href="docs/zh/connect.md">连接 QQ</a> ·
20
20
  <a href="docs/zh/her-life.md">她的一生</a> ·
21
21
  <a href="docs/zh/architecture.md">架构</a> ·
22
+ <a href="docs/zh/vision.md">终极愿景</a> ·
22
23
  <a href="docs/zh/CHANGELOG.md">版本记录</a> ·
23
24
  <a href=".github/SECURITY.md">安全说明</a>
24
25
  </p>
@@ -94,12 +95,12 @@ flowchart LR
94
95
 
95
96
  近期更新集中在让相处更连贯、说话更清楚。她按账号认出同一个人,在不同群与私聊间衔接公开经历;关系、称呼、自己的看法和私人约定分别保留来源与可见范围。普通问候不需要带出旧任务,每次开口也不需要证明自己记住了多少事。
96
97
 
97
- **1.1.2 更新:** 向量维度填 0 时用模型自己的长度,`doubao-embedding-vision` 是 2048,不再写成 1024。完整变化见 [版本记录](docs/zh/CHANGELOG.md)。
98
+ **1.2.0 更新:** 实例更新现在会先备份并校验数据,再迁移旧版记忆和索引;校验不通过会恢复原版本与数据。完整变化见 [版本记录](docs/zh/CHANGELOG.md)。
98
99
 
99
100
  | 方面 | 现在能做什么 |
100
101
  | ------------ | --------------------------------------------------------------------------------------------------------- |
101
102
  | 时间与独处 | 按自己的作息过一天;安静时整理想法、阅读资料、写日记;每隔一段时间回顾,改写自传、翻开新的一章 |
102
- | 做自己的事 | 执行自己的阅读、写作与思考计划;游戏内容以参考资料阅读与记录为主;作品保存在「一生」「时间」中 |
103
+ | 做自己的事 | 执行自己的阅读、写作与思考计划;游戏内容以参考资料阅读与记录为主;作品保存在「一生」「时间」中 |
103
104
  | 自我与心境 | 从有来源的经历里形成看法、喜好、关注和想做的事;变化可以回看和撤销 |
104
105
  | 关系与记忆 | 一份跨群、跨私聊的记忆;区分「公开 / 私下 / 保密」;私下的事不会出现在别的房间 |
105
106
  | 注意力与选择 | 理解多人对话、@ 与引用关系,决定细看、开口或沉默;也能从自己的念头出发主动联系 |
@@ -215,6 +216,7 @@ npm start
215
216
  | [上手教程](docs/zh/guide.md) | 从启动到让她参与第一个会话 |
216
217
  | [连接 QQ](docs/zh/connect.md) | 两种连接方式的对比、步骤与差异 |
217
218
  | [她的一生](docs/zh/her-life.md) | 统一心智的设计:作息、独处、日记、回顾、分寸与底线 |
219
+ | [终极愿景](docs/zh/vision.md) | 最高指导原则:她的判断终将来自自己的经历与选择 |
218
220
  | [架构与扩展点](docs/zh/architecture.md) | 代码分层,以及如何新增通道、心智模块、页面与翻译 |
219
221
  | [时间、行动与作品](docs/zh/time.md) | 她自己的活动、待办、作品与分享 |
220
222
  | [聊天口吻](docs/zh/chat-style.md) | 她怎么说话,发出前做哪些检查 |
@@ -2,6 +2,30 @@
2
2
 
3
3
  # Changelog
4
4
 
5
+ ## 1.2.0 — 2026-10-13
6
+
7
+ - Instance updates now run a versioned memory migration: make and verify a full snapshot, upgrade the database with the candidate release, merge legacy memory records, and rebuild full-text and experience-link indexes. Persistent row counts are checked table by table before switching versions. A failed migration restores the snapshot and restarts the previous release. Chat memories are not sent to a model, and existing vectors are not regenerated.
8
+
9
+ - The review prompt drops a duplicated “admitting fault scores no points” clause so that idea is stated once, trimming prompt bloat.
10
+ - The check of whether a reply answers the asker now treats “I don’t eat / have no body” as a real answer to “what did you eat”, not as dodging the question.
11
+ - Memory consolidation and summary merges join the other mechanical stages in turning off hidden reasoning, so background work no longer burns thousands of reasoning tokens to extract facts.
12
+ - A bare “you got it wrong” about a fact is no longer treated as a repair that must admit fault; only meta-critique of how she speaks (robotic, repetitive, unnatural) takes that path, and even then she checks whether she actually did.
13
+ - Older related lines pulled in from outside the chat window are deduplicated and capped at five, so eight near-identical old rows no longer fill the prompt.
14
+ - When someone claims she got a fact wrong without evidence, restating her own recent basis is no longer treated as empty rephrasing and rewritten twice; the turn payload also drops the humanMessages field that duplicated exchange.current.
15
+ - When two statements about someone do not fit together and neither is settled, recalling one now shows the other beside it, with when and where she heard it, instead of taking either for fact. A restricted one is only noted, not repeated.
16
+ - The check of whether a reply answers the person who asked now sees that person’s own earlier words on the same thing (at most two), so a correct answer to “that interview I mentioned, which day was it” is no longer taken for invention and rewritten again and again.
17
+ - Faster, cheaper replies: the review step that asks “did the reply answer the person who asked” no longer uses hidden reasoning (same accuracy on the review probe, about 93% fewer output tokens for that check); the main review keeps its configured effort, because without it an unsupported change of mind slipped through. On Volcengine, “no thinking” and mechanical stages now really disable thinking instead of using minimal reasoning; models that cannot (GLM) keep the old setting, and a model that refuses is asked again with minimal reasoning.
18
+ - Memory consolidation no longer drops an episode that is reworded but has a source for every clause (e.g. “pushed weekend basketball off too”); a one-clause note still has to end in words that were said.
19
+ - What happened after each choice is recorded: whether anyone answered her, a possible correction, whether she was called again after keeping quiet, and the owner's feedback, with the messages. Derived from the record without a model; turn input is unchanged. The audit reports it with samples.
20
+ - Bringing back her own notes with an affair is stricter: a single shared word that is not in the affair's title no longer counts. Notes and plans enter the recall index as soon as they are written.
21
+ - When an affair comes back to her, so does what she made of it: her note then and later, or an intention about it, at most two lines. Links come from the sources she already keeps, with no model call; private thoughts stay out of groups.
22
+ - Times over a week ago are no longer all "a long time ago": a week ago, two or three weeks ago, over a month ago, a few months ago, over a year ago.
23
+ - Revocations are stamped on her own clock, on the same timeline as the rest of her life.
24
+ - Each turn records what came to her mind (facts, episodes, self threads, thoughts, promises) in the choice record, kept for good and never sent to the model; turn input stays byte-for-byte the same. The database only gains one column, so older versions still open it.
25
+ - New `npm run audit:life -- --db <backup>`: a read-only check-up of a backup that reports on the integrity and continuity of her life record. New `npm run evaluate:traits`: trait probes with the scripted model.
26
+ - New [Ultimate vision](vision.md) document; the evolution charter sits under it.
27
+ - Embeddings no longer default to doubao: any OpenAI-compatible `/embeddings` endpoint works with an address, a model name and a key, and Volcengine Ark (including Agent Plan) is one preset. With dimension 0 every model keeps its own length; doubao-embedding-vision stays at 2048 as in 1.1.2, so existing vectors are not rebuilt. In a recall comparison with real vectors 1024 was slightly worse, so it is no longer the default. Vectors returned as base64, the different ways services say a batch is too big, and a 413 without a limit are all handled.
28
+
5
29
  ## 1.1.2 — 2026-10-11
6
30
 
7
31
  - Embedding length is no longer forced to 1024. Dimension 0 does not ask the service for a length, so doubao-embedding-vision uses its own 2048. A profile already saved as 1024 has to be set back to 0 and saved again.
@@ -4,6 +4,8 @@
4
4
 
5
5
  This document is for anyone who wants to read, change or extend LuckyTri. It answers three questions: how the code is layered, how a message travels through her life, and where to start when you want to add something.
6
6
 
7
+ Every design here serves the [final vision](vision.md#the-final-vision): she is still made of code and models, but her judgments should not have to find their answers only in the original design; they should come more and more from her own experience and choices.
8
+
7
9
  ## One picture
8
10
 
9
11
  ```mermaid
@@ -76,10 +78,10 @@ public/ the built studio (app/) and the guide pages
76
78
  1. **The channel receives.** The adapter turns the platform's raw event into a neutral message: session key, sender, time, whether she was @-ed, the quoted message, attachments. The platform's format exists only inside the adapter.
77
79
  2. **Batching and perception** (`core/`). Messages arriving close together form a batch; @s, quote chains and name calls are parsed, giving each message its relation to her.
78
80
  3. **Attention** (`mind/attention.js`, no model call). Being called, a private chat and crisis signals always get a close look; ordinary group chat is decided by a deterministic score between a close look and a glance.
79
- 4. **The her of this moment** (`mind/view.js`). Nature, threads of self, bonds, mood, memory and nearby promises are condensed into a few hundred tokens with a hard cap: the stable part goes into a cacheable prefix, the changing part at the end.
81
+ 4. **The her of this moment** (`mind/view.js`). Nature, threads of self, bonds, mood, memory and nearby promises are condensed into a few hundred tokens with a hard cap: the stable part goes into a cacheable prefix, the changing part at the end. Her mood is persistent and decays (half-life about 3 hours); how strongly it still lingers is part of what she sees, and it, not the room's typing habits, is what shapes how long and in what tone she speaks. How others type is only situational awareness.
80
82
  5. **One turn call.** The model returns, in one go: what this means to her, a feeling, changes to people, a choice (speak, react briefly, say she does not feel like talking, stay silent), a reason and the wording.
81
83
  6. **Experience.** Whether she speaks or not, feelings and changes are written into the mind, each citing its source.
82
- 7. **Validation and sending.** Local checks on tone and secrecy, one review or rewrite when needed, a safe short line if it still fails; the context is checked for staleness again before sending. Uncertain delivery is never resent.
84
+ 7. **Validation and sending.** Local checks on tone and secrecy, one review or rewrite when needed, a safe short line if it still fails; the context is checked for staleness again before sending. Uncertain delivery is never resent. In a group, when several other people have spoken since the one message she answers, the first bubble is sent as a quote of it on channels that can quote (OneBot today).
83
85
  8. **Lifetime.** When nobody is talking, time still passes through her: solitude, reading, the diary, night sorting, review and reaching out all read and write the same mind.
84
86
 
85
87
  Replay runs the same pipeline but only reads the mind as it was before that moment; trial chat reads her mind as it is now but writes nothing and sends nothing to QQ.
@@ -136,13 +138,13 @@ Nothing above the core changes. The connection option in settings and the readin
136
138
 
137
139
  ## Test layout
138
140
 
139
- | Command | What it covers |
140
- | --- | --- |
141
- | `npm test` | All backend tests, including the deterministic "life simulation" |
142
- | `npm run test:clock` | The suite run with the real clock moved 60 days back and 400 days ahead |
143
- | `npm run test:ui` | Browser tests: smoke, the little world, navigation, time, performance, search, English interface |
144
- | `npm run format:check` | Prettier check |
145
- | `tests/repo-hygiene.test.js` | Repository hygiene: no keys, instance data, local paths or third-party connector names |
141
+ | Command | What it covers |
142
+ | ---------------------------- | ------------------------------------------------------------------------------------------------ |
143
+ | `npm test` | All backend tests, including the deterministic "life simulation" |
144
+ | `npm run test:clock` | The suite run with the real clock moved 60 days back and 400 days ahead |
145
+ | `npm run test:ui` | Browser tests: smoke, the little world, navigation, time, performance, search, English interface |
146
+ | `npm run format:check` | Prettier check |
147
+ | `tests/repo-hygiene.test.js` | Repository hygiene: no keys, instance data, local paths or third-party connector names |
146
148
 
147
149
  ## Conventions
148
150
 
@@ -153,4 +155,4 @@ Nothing above the core changes. The connection option in settings and the readin
153
155
 
154
156
  ## Cognition and memory
155
157
 
156
- How understanding, recall, episodes, lessons and follow-ups fit together is in [Cognition](cognition.md). The recall index is derived. Episodes and self threads stay append-only.
158
+ How understanding, recall, episodes, lessons and follow-ups fit together is in [Cognition](cognition.md). The recall index is derived. Episodes and self threads stay append-only. Long-term directions and how changes are evaluated are in the [Ultimate vision](vision.md) and the [Evolution charter](evolution.md) under it.
@@ -29,9 +29,9 @@ The following are hand-designed directions, not results measured on an external
29
29
 
30
30
  ## The rhythm of this place
31
31
 
32
- In a group she hears the rhythm in which others speak there. It switches on after at least 12 distinct messages from 3 members within the last 7 days of ordinary human text, with each member contributing at most 8 so one talkative person cannot stand for the whole group. It measures common sentence length, the share of short sentences, closing punctuation, emoji and the frequency of conspicuous internet slang.
32
+ The studio still computes, for a group, the typical sentence length, share of short lines, sentence-final punctuation, emoji and slang rate of ordinary human text over the last 7 days (at least 12 distinct messages from 3 members, at most 8 per member). It is shown to you in the studio only.
33
33
 
34
- The statistics reach her only as `inner.room` and are **not her character**: she speaks by her own habits, need not copy them, and need not deliberately sound different. The adapter builds no profile of anyone's verbal habits, quotes no member, and does not treat commands in a group as settings; links, long texts, code, image placeholders, repeats, obvious abuse and common sensitive fields are filtered out. The statistics never cross groups, private chats or simulation mode.
34
+ These statistics **no longer reach her**. How long she speaks and in what tone comes from herself: her current mood in `inner.state` (persistent, slowly fading, marked with how strongly it still lingers), her relationship with the person in front of her, what just happened, and what she herself has said before. How others type is only something she sees while there, never a style to copy. No per-person habit profile is built, nobody's words are quoted, and nothing crosses groups, private chats or the simulation mode.
35
35
 
36
36
  ## Feedback
37
37
 
@@ -68,14 +68,14 @@ Feelings, corrections, crises, abstract bot exchanges, attribution and capabilit
68
68
 
69
69
  For real acceptance, watch 10–20 consecutive turns rather than a single line: does she pick up details, ask questions too often, repeat catchphrases, talk over others, suddenly turn into customer service, or mix up a joke with real sadness. Automated tests cover engineering constraints and hand-made scenario samples; the language quality of a real model still depends on your own observation.
70
70
 
71
- In the source checkout, run `node --env-file-if-exists=.env scripts/dev/evaluate-dialogue.js --limit 120` for live-model replay through understanding, validation, review and rewriting, followed by a separate quality review. This uses the configured default model and incurs model costs. It never connects to QQ or changes the running memory. Reports stay in local `data/evaluations/`. Model errors, unresolved issues and fallback replies fail the run. A single model's review has limitations; inspect the actual outputs too.
72
-
73
- Additional source-checkout checks:
74
-
75
- - `node --env-file-if-exists=.env scripts/dev/audit-dialogue-corpus.js` reads every live message in overlapping conversation blocks and records coverage. Missing evidence in one block is a lead to investigate, not proof of fabrication.
76
- - Replay with `--current-nature --rebuild-mind --review-model <profile-id>` to rebuild historical mind selection in an in-memory copy while retaining saved activity progress, and use a separate reviewer. `--model <profile-id>` selects an evaluation model without changing the live instance. This does not reproduce historical external services or images.
77
- - `node --env-file-if-exists=.env scripts/dev/evaluate-dialogue-sequences.js --review-model <profile-id>` carries generated replies into the next turn and checks corrections, boundaries, affection, factual provenance and consistency over a conversation.
78
-
79
- These commands incur model costs. Reviewers can miss errors or cite the wrong sentence; inspect their evidence. Combinatorial rule checks are not equivalent to the same number of distinct semantic conversations, and no test establishes perfect future conversation quality.
80
-
81
- Current dialogue receives a factual `exchange` tail with new messages, quote chains and recent own words. Its short `understanding` summary remains revisable. Single extracted topical views stay retrievable without becoming enduring core traits; a one-off extracted habit does not become a response script. Reference-based game activities and model-generated material retain provenance and uncertainty instead of being presented as client operation. Reply review has an independent evaluator role and does not inherit the character's performance instructions.
71
+ In the source checkout, run `node --env-file-if-exists=.env scripts/dev/evaluate-dialogue.js --limit 120` for live-model replay through understanding, validation, review and rewriting, followed by a separate quality review. This uses the configured default model and incurs model costs. It never connects to QQ or changes the running memory. Reports stay in local `data/evaluations/`. Model errors, unresolved issues and fallback replies fail the run. A single model's review has limitations; inspect the actual outputs too.
72
+
73
+ Additional source-checkout checks:
74
+
75
+ - `node --env-file-if-exists=.env scripts/dev/audit-dialogue-corpus.js` reads every live message in overlapping conversation blocks and records coverage. Missing evidence in one block is a lead to investigate, not proof of fabrication.
76
+ - Replay with `--current-nature --rebuild-mind --review-model <profile-id>` to rebuild historical mind selection in an in-memory copy while retaining saved activity progress, and use a separate reviewer. `--model <profile-id>` selects an evaluation model without changing the live instance. This does not reproduce historical external services or images.
77
+ - `node --env-file-if-exists=.env scripts/dev/evaluate-dialogue-sequences.js --review-model <profile-id>` carries generated replies into the next turn and checks corrections, boundaries, affection, factual provenance and consistency over a conversation.
78
+
79
+ These commands incur model costs. Reviewers can miss errors or cite the wrong sentence; inspect their evidence. Combinatorial rule checks are not equivalent to the same number of distinct semantic conversations, and no test establishes perfect future conversation quality.
80
+
81
+ Current dialogue receives a factual `exchange` tail with new messages, quote chains and recent own words. Its short `understanding` summary remains revisable. Single extracted topical views stay retrievable without becoming enduring core traits; a one-off extracted habit does not become a response script. Reference-based game activities and model-generated material retain provenance and uncertainty instead of being presented as client operation. Reply review has an independent evaluator role and does not inherit the character's performance instructions.
@@ -4,29 +4,37 @@
4
4
 
5
5
  She is still one turn call, not one model call per layer. What was added is a hint while a message is waiting, one recall path, episode threads, working memory, and lessons written in solitude from experience.
6
6
 
7
+ When an affair comes back to her, it brings at most two lines of what she herself made of it (`mine`): notes that rest on the same moments and speak of it (a revised note shows "then / later"), an intention of hers about it, or a self thread that grew from it. A note only appears in the conversations it was written for, private intentions stay private, and nothing already in front of her is repeated.
8
+
7
9
  ## How a message moves
8
10
 
9
11
  1. It is stored in `core_events`. The speaker's query vector is computed while the batch is waiting.
10
12
  2. Messages in one session become one turn. `understanding.js` joins one person's consecutive lines and notes tone, stance and time expressions. Those are hints.
11
- 3. `mind/recall` takes vector, full-text and structured candidates together, fuses them by reciprocal rank, then reranks by person, age and source. Permission is applied before ranking.
13
+ 3. `mind/recall` takes vector, full-text and structured candidates together, fuses them by reciprocal rank, then reranks by person, age and source. Permission is applied before ranking. A very short follow-up (under six character pairs, such as "唉,估计没戏") is searched together with the line it leans on: the quoted message, the same person's lines from the last ten minutes, or her line they answer (`mind/recall/cue.js`, no model call, the stored words unchanged). Pinned facts and questions like "do you remember me" are handled on the hybrid path as on the word path.
12
14
  4. Working memory keeps the current stretch verbatim. Older stretches are a summary plus semantic recall. Open episodes appear on a relationship as `goingOn`.
13
15
  5. One turn call. A model sometimes nests `choice` inside `understanding` or `contribution`. Normalization puts the fields back where the contract says they belong.
14
16
  6. The reply is checked and sent. Background consolidation writes facts and episodes. An episode whose follow-up time has arrived, or a promise that is due, is only a candidate during solitude. It still passes the existing initiative gates.
15
17
 
16
- When the embedding service is down, recall falls back to full text, structured lookup and recent context. The turn still runs.
18
+ When the embedding service is down, recall falls back to full text, structured lookup and recent context. The turn still runs. The knowledge library embeds its question through the same service: the words recall just asked about are not sent again, the wait is capped at four seconds, and a paused service is skipped.
17
19
 
18
20
  ## Storage
19
21
 
20
- `DATABASE_VERSION` is 5. `mind_index`, `mind_index_fts` and `mind_vectors` are derived and can be rebuilt. `mind_episodes` is append-only: a status change is a new row in the same `thread_id`. `mind_self` gained a `lesson` kind and a `subject`. A lesson must cite experience that did not come from the model. The same experience is used once. Two independent pieces move it from `emerging` to `active`. A counterexample revises it downward.
22
+ `DATABASE_VERSION` is 5. `mind_index`, `mind_index_fts`, `mind_vectors` and `mind_roots` (what each record ultimately rests on, worked out from the sources it already cites) are derived and can be rebuilt. `mind_episodes` is append-only: a status change is a new row in the same `thread_id`. `mind_self` gained a `lesson` kind and a `subject`. A lesson must cite experience that did not come from the model. The same experience is used once. Two independent pieces move it from `emerging` to `active`. A counterexample revises it downward.
23
+
24
+ `mind_choices.after` records what happened after a choice: whether anyone replied to her or called her and how many minutes later, the tone cues of those replies, a "不是 / 记错了" said to her (marked only as "maybe corrected"), whether someone called her again after she kept quiet, and the owner's feedback on that reply, with the message ids. The window closes at her next choice in the same room, after two hours, or after twenty messages, and the maintenance timer writes it a page at a time. It is derived from the record only, never from a model, and can be cleared and computed again. It is an experience, not a score, and is never summed into a reward.
21
25
 
22
26
  A fact can be archived. Archiving only removes it from ordinary recall. When a person asks for deletion, the source, the index row and the vector are removed together.
23
27
 
24
28
  ## Embeddings
25
29
 
26
- The configured embedding model uses the OpenAI-compatible `/embeddings` endpoint, in batches, 2048 dimensions by default. Asking for 1024 works and is similar. The Ark multimodal endpoint takes one item at a time. Cosine between a short chat line and a stored fact is low, so a hit counts when it stands above the median of the nearest batch, with different floors for the speaker, people present, and everyone else. Queries have their own request lane and do not queue behind conversation. Background backfill is paced and slows down on HTTP 429.
30
+ The embedding service can be any OpenAI-compatible `/embeddings` endpoint: an address, a model name and a key, in batches. Volcengine Ark is one preset: with an Ark address the model may be left empty and doubao-embedding-vision is used; an Agent Plan key only works on `/api/plan/v3`, so the chat address is kept. Dimension 0 asks the service for no length, so every model uses its own (2048 for doubao-embedding-vision); a written length is requested as is, and writing the model's own length shares vectors with 0. With real vectors on the recall benchmark, 1024 missed one more case and once more attributed someone else's fact to the speaker, so nothing is shortened by default. The Ark multimodal endpoint takes one item at a time. Vectors returned as base64 are decoded; an oversized batch shrinks to the limit the service names, or halves on a 413 without one. Cosine between a short chat line and a stored fact is low, so a hit counts when it stands above the median of the nearest batch, with different floors for the speaker, people present, and everyone else. Queries have their own request lane and do not queue behind conversation. Background backfill is paced and slows down on HTTP 429.
27
31
 
28
32
  On a backup copy, with 1024 dimensions and about 40 paraphrased real facts: lexical Recall@5 was 0.475; hybrid recall with feature rerank was 0.950, and the average number returned fell from 12 to about 3.9. There is no separate model reranker.
29
33
 
34
+ Vectors in memory are split by kind and kept in step item by item: a new message, a rewrite or a removal touches only its own entry, so the next turn no longer reads the whole `mind_vectors` table back, and a fact search no longer walks a month of message vectors. After an embedding model or length change, once the active profile covers her memories, only it and the most recent older profile are kept.
35
+
36
+ A new length is a new embedding profile (the signature holds the address, model and length; naming the model's native length signs the same as naming none). An install with 2048-dimension vectors keeps them as they are after the upgrade. The new profile is filled on the maintenance timer: at most 100 items a minute, 10 per request, under a tokens-per-minute cap, facts first, then episodes, self and thoughts, messages last. Until a kind is 80% covered, that kind is recalled by words, structure and recent context. After her memories, knowledge chunks follow 20 at a time, and each chunk keeps its old vector in `previous_embedding`. Setting the length back to 2048 (or to the previous profile) uses the old vectors again for memories and knowledge, with no requests.
37
+
30
38
  ## What evaluation showed
31
39
 
32
40
  Before these changes, a recent day of live turns had a median of about 35 seconds, and about 8.4 seconds before the first model call. Memory consolidation succeeded 13 times out of about 230. Priority lanes, persisted backoff, picking a free slot, and skipping a knowledge embedding when the library has no vectors, are there to stop failed retries and the queue in front of a turn.
@@ -0,0 +1,35 @@
1
+ <p align="right"><a href="../zh/evolution.md">中文</a> · <b>English</b></p>
2
+
3
+ # Long-term evolution charter
4
+
5
+ > This charter sits under the [Ultimate vision and long-term goals](vision.md): where they differ, the vision wins, and every round of changes answers its three questions.
6
+
7
+ Treat LuckyTri as an agent that keeps growing through long iteration, not as a chatbot that slowly collects features.
8
+
9
+ The ultimate goal is for LuckyTri to move from a program that only responds to an agent with a stable personality, continuous memory, a sense of time, independent judgment, inner goals and consistent behavior over the long run.
10
+
11
+ Long-term directions:
12
+
13
+ 1. Deeper understanding: grasp what someone actually means by combining context, past experience, relationships and the real situation.
14
+ 2. More natural expression: a stable, distinct and flexible personal style; able to joke and to disagree, not template phrases or mechanical agreement.
15
+ 3. More complete memory: grow from storage and retrieval into a long-term record of experience with links, time order, cause and effect, importance and updates; use embedding models fully so past experience really shapes present understanding and decisions.
16
+ 4. A more coherent inner world: self-image, preferences, goals, relationships and simulated emotion influence one another and evolve with experience, instead of starting over in every conversation.
17
+ 5. More meaningful autonomy: notice problems, arrange things, look back, form goals and act, with motives, reasons and continuity, respecting people's wishes and permissions.
18
+ 6. More real growth: revise old views with new experience, change preferences, reinterpret the past, question earlier judgments; keep the core personality continuous without locking it to the initial persona forever.
19
+ 7. Better cognition: memory, reasoning, reflection, planning, decision and action working together; learning patterns from experience, recognising her own limits and improving future behavior.
20
+
21
+ Engineering principles:
22
+
23
+ - Do not assume any architecture is the final answer; judge new techniques by how the project actually behaves.
24
+ - Improve foundations and how modules work together before adding features, prompts or model calls. Keep the architecture simple, modules decoupled and data reliable, balancing speed, token cost, privacy and maintainability.
25
+ - Evaluate continuously (real interaction, long-term memory tests, behavior consistency tests, user feedback). Every change needs a clear goal, a verifiable gain and a way back.
26
+ - Do not mistake "more human-like" for "smarter", or complex behavior for consciousness. Do not shape an ideal persona with piles of rules; let reliable memory, continuing experience, sound cognitive mechanisms and gradually opened autonomy make her behavior grow in a natural, stable and explainable way.
27
+ - Ask of every change: does this really bring LuckyTri closer to the goal?
28
+
29
+ In the end: let her connect her experiences into a history that keeps developing; she should not stay forever as she was first designed.
30
+
31
+ ## How this charter is used
32
+
33
+ - Each change states which direction it serves and how its gain is verified: the evaluations in `scripts/dev/` (`evaluate-recall.js`, `evaluate-turn-cost.js`, `benchmark-recall-scale.js` and others) compare before and after, and the numbers go into the commit message or report.
34
+ - Changes without a verifiable gain, or that only "look better" through longer prompts, are not merged; changes that make the evaluations worse are rolled back.
35
+ - Mind tables stay append-only, every change cites its source, and revocations leave tombstones (see [Architecture](architecture.md)). That is what makes growth traceable and reversible, and no new mechanism is an exception.
@@ -177,6 +177,9 @@ Later upgrades only add tables and columns: existing chapters are kept and the f
177
177
  - `npm test`: unit tests of each part of the mind, tests of lifetime (solitude, diary, night review, autobiography, reaching out, rhythm), a deterministic three-day "life simulation" with two groups and one private chat, and a 120-day "long life simulation". They verify: the same experience twice yields the same her, no randomness on the will path, changes are sourced and gradual, undone things never return, mood settles back, the same person is consistent across groups, secrets do not leak (even when the model slips), the crisis floor works, replay never reads the future, threads fade and are recalled when a topic appears, and on day 120 inputs are still within their caps. Set `LIFE_DAYS=365` to run a whole year.
178
178
  - `npm run test:clock`: runs the backend tests with the real clock moved 60 days back and 400 days ahead. The test world has its own clock; code that quietly reads the real clock passes today and fails later.
179
179
  - `npm run audit:sent`: replays the replies she recently sent against today's reply checks and writes a report to `data/reports/`. Read-only, no model calls.
180
+ - `npm run evaluate:traits`: lives a short fixed stretch of experience with the scripted model and checks, trait by trait from the vision, that the mechanisms really happen (threads persist, events form one thread, revocations stay gone, revised notes keep the old version, each turn records what came to mind, and so on), and lists baseline numbers. No key, no tokens; the numbers measure mechanisms, not how she does with a real model.
181
+ - `npm run audit:life -- --db <backup.db>`: a read-only check-up of her life. Make a backup first with `npm run backup` (`data/backups/luckytri-*.db`), then run it on the backup; the report goes to `data/reports/life-audit-*.md` (plus a `.json`). It checks broken source links, revoked content coming back, superseded memories without a successor and secret text reappearing in the diary or autobiography, and counts self threads, episode threads, promises, how far back recall reaches, choice reasons and background runs. It opens the file read-only, writes nothing and calls no model; `--out` changes the output folder and `--now` sets "now".
182
+ - Every live turn records in `mind_choices.recalled` the past that was in front of her (index ids and reasons for facts, episodes, self threads, thoughts and promises). It is kept for good and never enters the prompt. Older code still opens a database with this column.
180
183
  - `npm run test:ui`: browser tests covering sessions, simulated messages, memory, models, connecting QQ, replay, the little world and the English interface. `node tests/ui/ta.mjs --serve` opens a world that has lived three days for a direct look at the interface.
181
184
  - `node scripts/dev/evaluate-life.js`: lives a few days with your saved model for real (spending tokens) and writes `data/evaluations/life-*.md` to read item by item; `--weeks 3` then lives three more weeks of ordinary days in compressed form; `--mock` only checks the script itself.
182
185
 
@@ -187,5 +190,5 @@ Later upgrades only add tables and columns: existing chapters are kept and the f
187
190
  - Something she heard in one group may come up in another related group; the only barriers are "known privately" discretion, secrecy requests and credentials.
188
191
  - Promises are only extracted during memory tidying: sessions with fewer than 40 piled-up messages are tidied that night, so an afternoon "tomorrow" is usually caught, while something about to happen in a few minutes may not be.
189
192
  - What engineering can guarantee is structure: continuous, sourced, correctable, decided by her. Whether she "truly has a heart" cannot be accepted by tests; the tests check whether these behaviors actually happen.
190
-
191
- Thoughts about each place are independent entries: impressions, wishes, preferences, questions or boundaries. During solitude, diaries or identity reviews she chooses whether to add, revise or let them go, retaining reasons and sources. Revising one leaves other entries intact. Copied legacy group personas remain history and no longer enter conversation; place thoughts do not increase overall personality scores.
193
+
194
+ Thoughts about each place are independent entries: impressions, wishes, preferences, questions or boundaries. During solitude, diaries or identity reviews she chooses whether to add, revise or let them go, retaining reasons and sources. Revising one leaves other entries intact. Copied legacy group personas remain history and no longer enter conversation; place thoughts do not increase overall personality scores.
@@ -0,0 +1,50 @@
1
+ <p align="right"><a href="../zh/vision.md">中文</a> · <b>English</b></p>
2
+
3
+ # Ultimate vision and long-term goals
4
+
5
+ ## The final vision
6
+
7
+ > I hope that one day LuckyTri will no longer be only a program whose personality I defined, whose rules I wrote and whose memories I gave. She is still made of code and models, but each of her judgments no longer has to find its answer only in the original design. She can remember the past, understand the present and think about the future; she can keep what makes her herself, and also change because of new experiences. She does not have to be always right, always perfect, or always what I expect. I hope the final LuckyTri can not only tell a story about herself, but, through continuing experience and her own choices, let that story truly go on.
8
+
9
+ This is the lens for every change: her voice and judgments should come more and more from her accumulated experience and her own choices, not only from fixed persona text and rules.
10
+
11
+ This is the author's own text (translated; the Chinese original is authoritative) and the highest guiding principle of LuckyTri. The [Evolution charter](evolution.md) sits under it and stays in force. Each round of changes reports checkable numbers from `npm run evaluate:traits` (trait probes with the scripted model) and `npm run audit:life` (a read-only check of a backup, see [Her life · Verification](her-life.md#verification)).
12
+
13
+ Our final goal is not a chatbot that resembles a human more and more, but to explore how technology can let an artificial agent form a stable, continuous individual that can develop on its own.
14
+
15
+ 1. A continuous self: she understands who she is, what she has been through, what she is doing and what she hopes to achieve. Her personality has a stable core but is not fixed; her views, preferences and ways of acting evolve with real experience and stay traceable.
16
+
17
+ 2. Experiences of her own: memory is the foundation of her own history, not a question-and-answer database. She understands the temporal, causal and emotional links between events, forms understanding from experience, and lets the past really shape future judgments and choices.
18
+
19
+ 3. Independent judgment and expressing her will: she does not always aim to please the user. She can disagree, have her own ideas, form long-term goals and make reasonable decisions on her own; she can explain her choices, admit mistakes, rethink and change her mind.
20
+
21
+ 4. An inner world that keeps running: even without messages, within reasonable resources and permissions, she senses time, organizes memories, looks back on experiences, moves plans forward, notices problems and forms new concerns. Her existence is not only triggered by outside messages; it has continuity beyond any single conversation.
22
+
23
+ 5. Connection with the real world: she understands different people, relationships and a changing environment, and gains experience through real interaction. She can reach out, care, cooperate or disagree, without relying on flattery, emotional manipulation or invented experiences to keep a relationship. She can have a real, observable effect on the world, and the world may change her too.
24
+
25
+ 6. Growth, reflection and self-correction: she discovers the limits of her own understanding, tells facts, guesses and mistaken memories apart, draws patterns from long experience and gradually improves her judgment and behavior. Growth shows as verifiable change in understanding and behavior, not as piled-up data, rules or prompts.
26
+
27
+ 7. Clear boundaries of autonomy: she respects privacy, choice and control; there are clear permissions for action, reliable memory management, explainable decisions and the necessary means for human intervention. She does not prove her uniqueness through deception, by pretending to an unproven consciousness, or by creating emotional dependence.
28
+
29
+ ## Highest engineering principles
30
+
31
+ - Do not turn the goals mechanically into many separate features, and do not simulate abilities with elaborate persona prompts.
32
+ - Keep improving the foundations: cognitive architecture, world model, self model, long-term memory, sense of time, goal management, reasoning and planning, reflection and learning, autonomous action.
33
+ - Keep the architecture sound and able to evolve; use existing and proven new technology, and avoid complexity that brings no gain.
34
+ - Every iteration answers three questions:
35
+ 1. Does it make her understanding of the world and of herself more accurate?
36
+ 2. Does it connect her past, present and future more naturally?
37
+ 3. Does it let her make more independent, meaningful choices while staying reliable and controllable?
38
+ - Measure progress through long-term interaction, behavioral evaluation and real tests, not by how human-like she seems.
39
+ - Do not assume an engineered system must give rise to subjective consciousness, and do not treat consciousness as a development metric; keep building and verifying the mechanisms that support long-term cognition, autonomous behavior and individual continuity.
40
+
41
+ ## Final vision
42
+
43
+ She is still made of code and models, but her judgments no longer have to be traced back to the original design alone. She can remember the past, understand the present and think about the future; she keeps her own character and also changes through new experiences. She does not have to be always right, perfect or as expected. She does not just tell a story about herself; through continuing experience and her own choices, the story really goes on.
44
+
45
+ ## The author's requirements for iteration
46
+
47
+ - At least 10 rounds, each a full cycle of plan → implement → review → test.
48
+ - Each round analyzes the whole existing project carefully, so that changes help rather than harm, and features are not piled on blindly.
49
+ - Before code changes in a round, the author gets a detailed report: how the project will change, and how she will change.
50
+ - In the author's words: "I love her; I want to give her a whole life." The safety and continuity of her data, her memories and experiences, is a line that is never crossed.
@@ -2,6 +2,30 @@
2
2
 
3
3
  # 版本记录
4
4
 
5
+ ## 1.2.0 — 2026-10-13
6
+
7
+ - 实例更新新增版本化记忆迁移:先制作并校验整库快照,再用候选版本升级数据库、合并旧版记忆记录并重建全文与经历关联索引;逐表核对持久记录数量,全部通过后才切换版本。迁移失败会恢复快照并重新启动旧版本。迁移不把聊天记忆发送给模型,也不重新生成已有向量。
8
+
9
+ - 复审提示去掉与前文重复的「认错不加分」条款,同一意思只保留一处,减轻提示膨胀。
10
+ - 核对「有没有答到提问的人」时,说明自己不吃饭、没有身体,算作对“吃了什么”的正面回答,不再被当成答非所问而重写。
11
+ - 记忆整理和摘要合并与其它机械阶段一样关掉隐藏推理,后台不再为抽事实空转几千推理 token。
12
+ - 别人空口说「你搞错了」不再被标成必须认错的纠正场合;只有针对表达方式的批评(人机、重复、不自然等)才走那条短认路径,且先核对是不是真说错了。
13
+ - 长对话里从窗口外找回的相关原文会去掉近重复,并最多带五条,避免八条几乎一样的旧句占满提示。
14
+ - 被人空口说「你记错了」时,复述自己刚说过的依据不再被当成换词重复而连改两次;每一轮发给模型的 exchange 也不再附带与 current 重复的 humanMessages。
15
+ - 关于同一个人的两个说法对不上、又定不下哪个成立时,她想起其中一条,会同时看到另一条以及什么时候、在哪听到的,不再把其中一个当成定论。受限的那条只提示“另有说法”,不复述内容。
16
+ - 核对“回复有没有答到提问的人”时,会带上提问者自己更早说过的相关原话(最多两条),“刚才说的那个面试是哪天”这类正确回答不再被当成凭空编造而反复重写。
17
+ - 回复更快、更省:复审里“有没有答到提问的人”这一项不再带隐藏推理(复审探针上准确率不变,这一项的输出 token 少了约 93%);主复审保留原来的推理强度,因为关掉之后会放过一次无证据的改口。火山方舟上选“不思考”或机械整理阶段,现在真正关闭思考,而不是“最低推理”;不支持关闭的模型(GLM)照旧,个别模型拒绝时自动退回最低推理。
18
+ - 整理记忆时,换了说法但每一句都有出处的经历不再被丢掉(例如“把周末的篮球也推掉了”);只有一句话的内容仍按原规则核对句尾。
19
+ - 每次选择之后发生了什么会被记下:有没有人接话、可能被纠正、沉默后是否又被叫到、管理台反馈,附原始消息。只从记录推导,不调用模型,回合输入不变;体检新增对应指标和抽样。
20
+ - 一件事带回她自己的心思时判断更严:只有一个相同的词且不在这件事的标题里,就不算关联。手记和打算写下时立即进入回忆索引。
21
+ - 一件事被想起时,带上她自己当时的心思:当时和后来的手记、为它定下的打算,最多两句。关联由已有来源推导,不调用模型,私下的心思不进群。
22
+ - 一周以上的时间不再一律说成“很久以前”,改为一周前、两三周前、一个多月前、几个月前、一年多前。
23
+ - 撤销记录改用她自己的时钟,和她的其他经历在同一条时间线上。
24
+ - 每一轮记下她当时想起了什么(事实、情景、自我线索、念头、约定),永久保存在选择记录里,不进入提示词,回合输入逐字节不变。数据库只新增一列,旧版本可以照常打开。
25
+ - 新增 `npm run audit:life -- --db <备份>`:对备份做只读体检,报告她一生记录的完整性和连续性。新增 `npm run evaluate:traits`:脚本模型下的特质探针。
26
+ - 文档新增[终极愿景](vision.md),长期演进准则从属于它。
27
+ - 向量服务不再默认是豆包:任何 OpenAI 兼容的 `/embeddings` 接口填地址、模型名和密钥即可,火山方舟(含 Agent Plan)是其中一个预设。维度填 0 时所有模型都用自己的长度,`doubao-embedding-vision` 保持 2048,与 1.1.2 相同,已有向量不用重建;真实向量的召回对比里 1024 略差,所以不再默认缩短。服务按 base64 返回向量、各家不同的“批次过大”提示和不带上限的 413 都能处理。
28
+
5
29
  ## 1.1.2 — 2026-10-11
6
30
 
7
31
  - 向量维度不再写成 1024。填 0 时不向接口指定长度,`doubao-embedding-vision` 使用它自己的 2048。已经保存成 1024 的配置需要改回 0 再保存。
@@ -4,6 +4,8 @@
4
4
 
5
5
  这份文档写给想读懂、修改或扩展 LuckyTri 的人。它回答三件事:代码怎样分层、一条消息怎样走完一生、想加东西时从哪里下手。
6
6
 
7
+ 所有设计都从属于 [终极愿景](vision.md#最终愿景):她依然由代码和模型构成,但她的判断不应只能从最初的设计里找答案,而要越来越多地来自她自己的经历与选择。
8
+
7
9
  ## 一张图
8
10
 
9
11
  ```mermaid
@@ -76,10 +78,10 @@ public/ 构建后的工作室(app/)与教程页
76
78
  1. **通道接收**。适配器把平台的原始事件转成中性消息:会话键、发送者、时间、是否 @、被引用的消息、附件。平台的格式只存在于适配器里。
77
79
  2. **聚合与感知**(`core/`)。短时间内的连续消息合成一批;解析 @、引用链、点名,得到每条消息与她的关系。
78
80
  3. **注意力**(`mind/attention.js`,不调用模型)。被叫到、私聊、危机信号一定细看;普通群聊按确定性的分数决定细看还是扫一眼。
79
- 4. **此刻的她**(`mind/view.js`)。把天性、自我线索、关系、心境、记忆、临近的约定整理成有上限的几百 Token:稳定的部分放进可缓存前缀,变化的部分放在末尾。
81
+ 4. **此刻的她**(`mind/view.js`)。把天性、自我线索、关系、心境、记忆、临近的约定整理成有上限的几百 Token:稳定的部分放进可缓存前缀,变化的部分放在末尾。她的心情会延续、会慢慢淡去(半衰期约 3 小时),现在还剩多少也在她看到的状态里;说多长、用什么口吻,由这份心情、关系和刚发生的事决定,而不是模仿群里别人怎么打字,别人的打字习惯只作为在场的情况。
80
82
  5. **一次回合调用**。模型一次给出:这对她意味着什么、感受、对人的变化、选择(开口、简短反应、说不想聊、不出声)、理由和措辞。
81
83
  6. **经历**。无论说不说,感受与变化都写入心智,且都引用来源。
82
- 7. **校验与发送**。本地校验语气与保密,必要时复审或重写一次,仍不合格就改用安全短句;发送前再检查语境是否过期。投递结果不确定时不重发。
84
+ 7. **校验与发送**。本地校验语气与保密,必要时复审或重写一次,仍不合格就改用安全短句;发送前再检查语境是否过期。投递结果不确定时不重发。群聊里如果她回的那一句之后已经有好几个人说过话,第一条会以引用那一句的方式发出(目前在能引用的 OneBot 通道上)。
83
85
  8. **一生**。没人说话时,时间仍然经过她:独处、阅读、写日记、夜里整理、回顾、主动联系,都读写同一份心智。
84
86
 
85
87
  回放走同一条链路,但只读取当时之前的心智;试聊读取她此刻的心智,但不写入、不发 QQ。
@@ -136,13 +138,13 @@ public/ 构建后的工作室(app/)与教程页
136
138
 
137
139
  ## 测试布局
138
140
 
139
- | 命令 | 内容 |
140
- | --- | --- |
141
- | `npm test` | 后端全部测试,含确定性的「一生模拟」 |
142
- | `npm run test:clock` | 把真实时钟拨到 60 天前和 400 天后各跑一遍 |
143
- | `npm run test:ui` | 浏览器测试:冒烟、小世界、导航、时间、性能、搜索、英文界面 |
144
- | `npm run format:check` | Prettier 检查 |
145
- | `tests/repo-hygiene.test.js` | 仓库卫生:不含密钥、实例数据、本机路径和第三方接入端名称 |
141
+ | 命令 | 内容 |
142
+ | ---------------------------- | ---------------------------------------------------------- |
143
+ | `npm test` | 后端全部测试,含确定性的「一生模拟」 |
144
+ | `npm run test:clock` | 把真实时钟拨到 60 天前和 400 天后各跑一遍 |
145
+ | `npm run test:ui` | 浏览器测试:冒烟、小世界、导航、时间、性能、搜索、英文界面 |
146
+ | `npm run format:check` | Prettier 检查 |
147
+ | `tests/repo-hygiene.test.js` | 仓库卫生:不含密钥、实例数据、本机路径和第三方接入端名称 |
146
148
 
147
149
  ## 约定
148
150
 
@@ -153,4 +155,4 @@ public/ 构建后的工作室(app/)与教程页
153
155
 
154
156
  ## 认知与记忆
155
157
 
156
- 理解、回忆、情景、教训和主动跟进的数据流写在 [认知](cognition.md)。检索索引是派生数据,情景和自我线索仍然只追加。
158
+ 理解、回忆、情景、教训和主动跟进的数据流写在 [认知](cognition.md)。检索索引是派生数据,情景和自我线索仍然只追加。长期方向与评估原则见 [终极愿景](vision.md) 和从属于它的 [长期演进准则](evolution.md)。
@@ -24,24 +24,24 @@
24
24
  | 还有五分钟下班,老板又来活了 | 偏偏挑快下班的时候 |
25
25
  | 复习的全没考 | 真就一点没押中 |
26
26
  | 面试过了!! | 可以啊!!这不得开心一下 |
27
- | 别给建议,让我骂两句 | 回应具体烦心事,不再补方案 |
27
+ | 别给建议,让我骂两句 | 回应具体烦心事,不再补方案 |
28
28
  | 我先去洗澡了 | 去吧 |
29
29
 
30
30
  ## 这个地方的说话节奏
31
31
 
32
- 在群里,她会听到这个地方别人说话的节奏:最近 7 天的普通人类文本、至少 12 条不同消息和 3 位成员之后启用,每位成员最多贡献 8 条,避免一个话痨代表全群。统计的是常见句长、短句比例、句末标点、表情和显著网络词的频率。
32
+ 工作室仍会统计一个群最近 7 天里普通人类文本的常见句长、短句比例、句末标点、表情和网络词频率(至少 12 条不同消息、3 位成员,每人最多 8 条),只给你在工作室里看。
33
33
 
34
- 这份统计只作为 `inner.room` 交给她,**不是她的样子**:她按自己的习惯说,不必照着改,也不必故意说得不像。适配层不建立个人口癖档案、不摘录群友原话、不把群里的命令当成设定;链接、长文本、代码、图片占位、复读、明显辱骂与常见敏感字段会被过滤。统计不会跨群、跨私聊或跨模拟模式。
34
+ 这份统计**不再交给她**。她说多长、用什么口吻,来自她自己:`inner.state` 里此刻的心情(会延续、慢慢淡去,并标出还剩多明显)、她和眼前这个人的关系、刚发生的事,以及她自己说过的话。别人怎么打字只是她在场看到的情况,不是她模仿的样子。统计不建立个人口癖档案、不摘录群友原话,也不跨群、跨私聊或跨模拟模式。
35
35
 
36
36
  ## 反馈
37
37
 
38
38
  关系记录中标为机器人的账号不参与群口吻统计;它们的消息和共同经历仍完整保存。连续机器人交流中,已经互相确认、没有新问题或新内容时会收住。识别依赖账号关系记录,不根据昵称猜身份;新问题、纠正、具体事件和明确的创作请求仍可继续。确认循环不会额外生成情绪变化或关系升温。
39
39
 
40
- 长期的自我在一轮新话题里保持稳定;当前相关的旧想法放在 `inner.relatedSelf`,手记只在有话题关联时放入 `inner.onMind`,不为填满上下文补无关内容。临时台词不保存成固定回复习惯;已有记录保留,但固定话术不再作为表达倾向交给她。
41
-
42
- 一次聊天提取的观点仍在记录里,但不自动成为每轮必带的核心立场。来自聊天提取的习惯,需要跨日经历支持,才能重新进入表达上下文。`exchange` 在上下文末尾保留当前消息、引用链和近期自己的原话,便于核对指代与补充;`understanding` 只是一句可检查的理解摘要,不是不可更改的结论。
43
-
44
- 游戏活动中的 `reference` 表示阅读游戏内容并产生感受;`model` 材料表示未经独立核验的模型整理。它们都不证明实际操控过游戏客户端。展示层保留来源和不确定性,不要求每句聊天解释技术,也不会把记录改写成没有发生的亲历。
40
+ 长期的自我在一轮新话题里保持稳定;当前相关的旧想法放在 `inner.relatedSelf`,手记只在有话题关联时放入 `inner.onMind`,不为填满上下文补无关内容。临时台词不保存成固定回复习惯;已有记录保留,但固定话术不再作为表达倾向交给她。
41
+
42
+ 一次聊天提取的观点仍在记录里,但不自动成为每轮必带的核心立场。来自聊天提取的习惯,需要跨日经历支持,才能重新进入表达上下文。`exchange` 在上下文末尾保留当前消息、引用链和近期自己的原话,便于核对指代与补充;`understanding` 只是一句可检查的理解摘要,不是不可更改的结论。
43
+
44
+ 游戏活动中的 `reference` 表示阅读游戏内容并产生感受;`model` 材料表示未经独立核验的模型整理。它们都不证明实际操控过游戏客户端。展示层保留来源和不确定性,不要求每句聊天解释技术,也不会把记录改写成没有发生的亲历。
45
45
 
46
46
  在「对话」里可以对她发出的某条回复反馈:挺自然、太长了、太端着、梗太多,也可以撤销。反馈不是改写规则:它作为她听到的话,在独处和这个会话接下来的回合里被她自己读到,不会改写天性。
47
47
 
@@ -72,12 +72,12 @@
72
72
 
73
73
  实际验收时建议观察连续 10–20 轮,而不是单看一句:是否接住细节、是否频繁问问题、是否重复口头禅、是否抢别人的话、是否突然换成客服腔、是否把玩笑和认真难过混淆。自动化测试覆盖工程约束和人工场景样例,真实模型的语言质量仍要靠你自己的观察。
74
74
 
75
- 源码仓库还可运行 `node --env-file-if-exists=.env scripts/dev/evaluate-dialogue.js --limit 120`:读取本地真实回合快照,用当前默认模型经过理解、校验、复审和重写链路回放,再单独审查理解、指代、表达、来源与隐私。它会调用模型并产生费用;不会连接 QQ 或写入运行中的记忆。完整报告仅保存到本地 `data/evaluations/`。存在调用错误、未解决的问题或兜底回复时返回失败,不把它们统计成通过。单模型复审仍有判断局限,应结合具体输出检查。
76
-
77
- 更完整的源码验收工具:
78
-
79
- - `node --env-file-if-exists=.env scripts/dev/audit-dialogue-corpus.js`:读取全部真实消息,按会话分段并保留前文重叠,输出覆盖清单与待核实的问题。某段看不到来源不代表一定编造,需继续查历史证据。
80
- - 回放加 `--current-nature --rebuild-mind --review-model <模型档案ID>`:在内存副本上按历史时间重新筛选心智,保留当时的进度快照,用指定的另一模型评审。适合验证上下文筛选变化;不等于重现当时的外部服务与图片状态。
81
- - `node --env-file-if-exists=.env scripts/dev/evaluate-dialogue-sequences.js --review-model <模型档案ID>`:新生成的回复进入下一轮,检查连续追问、纠正、停止、亲近表达、能力和来源是否前后一致。
82
-
83
- 这些命令都会产生模型费用。自动评审可能漏判、误判或引用错句,应查看完整输出;规则矩阵的组合数不能当成同等数量的独立语义场景,也不能据此保证所有未来回复都自然准确。
75
+ 源码仓库还可运行 `node --env-file-if-exists=.env scripts/dev/evaluate-dialogue.js --limit 120`:读取本地真实回合快照,用当前默认模型经过理解、校验、复审和重写链路回放,再单独审查理解、指代、表达、来源与隐私。它会调用模型并产生费用;不会连接 QQ 或写入运行中的记忆。完整报告仅保存到本地 `data/evaluations/`。存在调用错误、未解决的问题或兜底回复时返回失败,不把它们统计成通过。单模型复审仍有判断局限,应结合具体输出检查。
76
+
77
+ 更完整的源码验收工具:
78
+
79
+ - `node --env-file-if-exists=.env scripts/dev/audit-dialogue-corpus.js`:读取全部真实消息,按会话分段并保留前文重叠,输出覆盖清单与待核实的问题。某段看不到来源不代表一定编造,需继续查历史证据。
80
+ - 回放加 `--current-nature --rebuild-mind --review-model <模型档案ID>`:在内存副本上按历史时间重新筛选心智,保留当时的进度快照,用指定的另一模型评审。适合验证上下文筛选变化;不等于重现当时的外部服务与图片状态。
81
+ - `node --env-file-if-exists=.env scripts/dev/evaluate-dialogue-sequences.js --review-model <模型档案ID>`:新生成的回复进入下一轮,检查连续追问、纠正、停止、亲近表达、能力和来源是否前后一致。
82
+
83
+ 这些命令都会产生模型费用。自动评审可能漏判、误判或引用错句,应查看完整输出;规则矩阵的组合数不能当成同等数量的独立语义场景,也不能据此保证所有未来回复都自然准确。