soulbridge 0.0.0-stage → 0.0.2

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/LICENSE ADDED
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright 2023 The Sigstore Authors
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
package/NOTICE ADDED
@@ -0,0 +1,35 @@
1
+ soulbridge
2
+ Copyright 2026 soulbridge contributors
3
+
4
+ This product is licensed under the Apache License, Version 2.0 (see LICENSE).
5
+
6
+ --------------------------------------------------------------------------------
7
+ Third-party notices
8
+ --------------------------------------------------------------------------------
9
+
10
+ Source code bundled in this repository: none.
11
+
12
+ The repository contains only original code and documentation. Runtime behavior
13
+ relies on Node.js built-in modules (notably `node:sqlite`), which are distributed
14
+ under the Node.js license and are not covered by this repository's license.
15
+
16
+ Design references (ideas, not code)
17
+ -----------------------------------
18
+ - The four-verb protocol shape (context / observe / recall / reflect) is an
19
+ original design informed by common agent lifecycle conventions, including the
20
+ Model Context Protocol's tool conventions.
21
+ - The emotion taxonomy *structure* used by the future affect layer (7 categories,
22
+ intensity 1–9, polarity) follows the publicly documented structure of the
23
+ Dalian University of Technology affective lexicon (DUTIR).
24
+
25
+ No word list from DUTIR — or from any third-party lexicon — is bundled here.
26
+ Any lexicon a user supplies remains subject to that user's own licensing
27
+ obligations. See docs/adr/0006-licensing.md.
28
+
29
+ --------------------------------------------------------------------------------
30
+ Trademarks
31
+ --------------------------------------------------------------------------------
32
+
33
+ "Claude", "Cursor", "Codex", "Pi" and other product names are trademarks of their
34
+ respective owners. References to them describe interoperability targets only and
35
+ imply no affiliation or endorsement.
package/README.md CHANGED
@@ -1,3 +1,106 @@
1
- # Temporary Holding Version
1
+ # soulbridge
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ > **给任何 agent 装上一个人格层。**
4
+ > A personality layer for any agent — continuity, forgetting, and growth across tools.
5
+
6
+ **状态:v0.0.1 骨架 · 未发布 · 接口随时会变**
7
+
8
+ ---
9
+
10
+ ## 它解决什么
11
+
12
+ Claude Code 记得你在 Claude Code 里说过的话,Cursor 不记得,Pi 不记得。
13
+ 你的偏好、你的判断、你被纠正过的错——换一个工具,全部归零。
14
+
15
+ soulbridge 是它们之间那层**不属于任何一家**的记忆与人格:
16
+
17
+ > 一个 soul,多个宿主;一个人格,持续成长。
18
+
19
+ ## 它不做什么
20
+
21
+ | 不做 | 为什么 |
22
+ |---|---|
23
+ | agent runtime | 宿主已经免费提供了,再写一遍是重复劳动 |
24
+ | 向量数据库 / RAG 引擎 | 内容是商品,检索可以接现成的 |
25
+ | 云端服务 | 默认全本地,数据不出机器 |
26
+ | “更像人”的叙事营销 | 只承诺可观测的事 |
27
+
28
+ ## 四个动词
29
+
30
+ 宿主只需要在四个时机调用,就完成了接入:
31
+
32
+ | 动词 | 时机 | 作用 |
33
+ |---|---|---|
34
+ | `context()` | 会话开始 | 注入:身份 + 画像 + 相关记忆 + 表达风格 |
35
+ | `observe(turn)` | 每轮结束 | 观察:写入经历、更新情绪 |
36
+ | `recall(q)` | 需要时 | 召回:按相关性/新旧/重要度/唤醒次数排序 |
37
+ | `reflect(session)` | 会话结束 | 反思:把经历固化成策略与认知 |
38
+
39
+ 详见 [docs/protocol.md](docs/protocol.md)。
40
+
41
+ ## 30 秒跑起来
42
+
43
+ 需要 Node ≥ 22.18(用到内置 `node:sqlite`):
44
+
45
+ ```bash
46
+ npx soulbridge init
47
+ npx soulbridge remember --type strategy "提交前先跑 make check,能省一轮 CI"
48
+ npx soulbridge context --query "要不要先跑测试"
49
+ npx soulbridge demo # 起一个 soul,跑完整 context→observe→reflect→context
50
+ ```
51
+
52
+ 不需要模型、不需要网络、不需要数据库服务。
53
+
54
+ 从源码开发时:
55
+
56
+ ```bash
57
+ npm install && npm run build
58
+ node packages/cli/src/cli.ts demo # 直接跑 TypeScript(Node 22.18+ 原生支持)
59
+ ```
60
+
61
+ ## 架构
62
+
63
+ ```
64
+ 宿主(Claude Code / Pi / DSH / Cursor / Codex)
65
+ │ hooks + MCP
66
+ ▼
67
+ packages/core 人格状态 · 评分 · 注入 · 反思 (约 800 行,零依赖)
68
+ │
69
+ ▼
70
+ SQLite(默认) / Postgres(可选)
71
+ ```
72
+
73
+ - **人格状态**(身份 / 情绪 / 策略 / 关系 / 特质):结构化、量小,SQL 就够
74
+ - **内容记忆**(对话片段 / 文档):v0 用关键词检索,之后可换成向量或外部服务
75
+
76
+ 详见 [docs/architecture.md](docs/architecture.md)。
77
+
78
+ ## 设计文档
79
+
80
+ | 文档 | 内容 |
81
+ |---|---|
82
+ | [thesis](docs/thesis.md) | 核心命题、三条可证伪预测、四臂实验、放弃条件 |
83
+ | [RFC 0001](docs/rfcs/0001-foundations.md) | 定位、用户、非目标、成功指标、四个动词、接入阶梯 |
84
+ | [ADR 索引](docs/rfcs/README.md) | 11 条已生效的架构决定(定位/语言/存储/依赖/协议/许可/接入/范围/评估/质量) |
85
+ | [protocol.v0](docs/spec/protocol.v0.md) | 四个动词的完整契约:字段、错误码、降级、测试映射 |
86
+ | [quality](docs/quality.md) | 质量模型、九条门禁、五条评审清单 |
87
+ | [references](docs/references.md) | 外部资料的去留与过期判断 |
88
+
89
+ **规则**:架构级改动必须先有 RFC 或 ADR;聊天里达成的不算决定。
90
+
91
+ ## 为什么值得做
92
+
93
+ 见 [docs/thesis.md](docs/thesis.md):核心命题、三条可证伪预测、四臂实验设计。
94
+ 如果实验否定它,这个项目就该停——**先定好什么情况下放弃,再开始写代码。**
95
+
96
+ ## 隐私
97
+
98
+ - 默认 SQLite,落在 `~/.soulbridge/soul.db`
99
+ - 零遥测、零上报
100
+ - 记忆可导出、可删除、可迁移
101
+
102
+ ## License
103
+
104
+ [Apache-2.0](LICENSE) —— 含明确专利授权,便于企业采用。第三方声明见 [NOTICE](NOTICE)。
105
+
106
+ 本项目不捆绑任何第三方源码。未来若引入词库等外部资产,必须单独核查许可([ADR 0006](docs/adr/0006-licensing.md))。
@@ -0,0 +1,191 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Minimal CLI. No framework, no dependencies.
4
+ *
5
+ * soulbridge init
6
+ * soulbridge remember "以后提交前先跑 make check" --type strategy --importance 8
7
+ * soulbridge context --query "提交前要做什么"
8
+ * soulbridge recall "测试"
9
+ * soulbridge reflect --text "..." (or --file transcript.txt)
10
+ * soulbridge stats
11
+ * soulbridge demo
12
+ */
13
+ import { mkdirSync, readFileSync, rmSync } from 'node:fs';
14
+ import { dirname, resolve } from 'node:path';
15
+ // node:sqlite prints an ExperimentalWarning the moment it loads. Replace the default
16
+ // printer with a filter: the CLI's own output stays clean, other warnings still show.
17
+ // Must run before the dynamic import below, which is why that import is dynamic.
18
+ process.removeAllListeners('warning');
19
+ process.on('warning', (warning) => {
20
+ if (warning.message.includes('SQLite is an experimental feature'))
21
+ return;
22
+ process.stderr.write(`${warning.name}: ${warning.message}\n`);
23
+ });
24
+ const { openSqlite, Soul } = await import('../../core/src/index.js');
25
+ function parse(argv) {
26
+ const [cmd = 'help', ...rest] = argv;
27
+ const positional = [];
28
+ const flags = {};
29
+ for (let i = 0; i < rest.length; i += 1) {
30
+ const arg = rest[i];
31
+ if (!arg.startsWith('--')) {
32
+ positional.push(arg);
33
+ continue;
34
+ }
35
+ const key = arg.slice(2);
36
+ const next = rest[i + 1];
37
+ if (next !== undefined && !next.startsWith('--')) {
38
+ flags[key] = next;
39
+ i += 1;
40
+ }
41
+ else {
42
+ flags[key] = 'true';
43
+ }
44
+ }
45
+ return { cmd, positional, flags };
46
+ }
47
+ function dbFile() {
48
+ const file = process.env.SOULBRIDGE_DB ?? resolve(process.cwd(), '.soulbridge', 'soul.db');
49
+ mkdirSync(dirname(file), { recursive: true });
50
+ return file;
51
+ }
52
+ function open(file, createdAt) {
53
+ const target = file ?? dbFile();
54
+ const store = openSqlite(target);
55
+ const soul = new Soul({
56
+ store,
57
+ soulId: process.env.SOULBRIDGE_SOUL ?? 'xiaoling',
58
+ userId: process.env.SOULBRIDGE_USER ?? 'local',
59
+ name: process.env.SOULBRIDGE_NAME ?? '小灵',
60
+ createdAt,
61
+ });
62
+ return { soul, file: target };
63
+ }
64
+ function out(value) {
65
+ process.stdout.write(`${JSON.stringify(value, null, 2)}\n`);
66
+ }
67
+ async function demo() {
68
+ const dir = resolve(process.cwd(), '.soulbridge');
69
+ mkdirSync(dir, { recursive: true });
70
+ const file = resolve(dir, 'demo.db');
71
+ for (const suffix of ['', '-wal', '-shm'])
72
+ rmSync(`${file}${suffix}`, { force: true });
73
+ // Backdate the birthday so the demo shows a relationship that has time in it.
74
+ const seed = openSqlite(file);
75
+ seed.ensureSoul({ soulId: 'xiaoling', name: '小灵', createdAt: Date.now() - 3 * 86_400_000 });
76
+ seed.close();
77
+ const soul = new Soul({ store: openSqlite(file), soulId: 'xiaoling', userId: 'demo', name: '小灵' });
78
+ process.stdout.write('=== 第 1 次会话(刚认识,还没有记忆)===\n');
79
+ process.stdout.write(`${soul.context().text}\n\n`);
80
+ process.stdout.write('=== 会话结束,反思 ===\n');
81
+ const result = await soul.reflect([
82
+ { role: 'user', content: '以后提交前先跑 make check,别等 CI 挂了再修' },
83
+ { role: 'assistant', content: '好,记住了。' },
84
+ { role: 'user', content: '我喜欢简洁的回答,不要铺垫' },
85
+ { role: 'user', content: '不对,这个方案是错的' },
86
+ ]);
87
+ process.stdout.write(`写入 ${result.memories} 条记忆,情绪 ${JSON.stringify(result.emotion)}\n\n`);
88
+ process.stdout.write('=== 第 2 次会话:开场(无查询,按重要度注入全部)===\n');
89
+ process.stdout.write(`${soul.context().text}\n\n`);
90
+ process.stdout.write('=== 同一会话中,用户问「提交前要做什么」(有查询,只注入相关的)===\n');
91
+ process.stdout.write(`${soul.context({ query: '提交前要做什么' }).text}\n\n`);
92
+ process.stdout.write('=== stats ===\n');
93
+ out(soul.stats());
94
+ process.stdout.write(`\n数据库:${file}\n`);
95
+ }
96
+ async function main() {
97
+ const { cmd, positional, flags } = parse(process.argv.slice(2));
98
+ switch (cmd) {
99
+ case 'init': {
100
+ const { soul, file } = open();
101
+ out({ ok: true, db: file, ...soul.stats() });
102
+ return;
103
+ }
104
+ case 'remember': {
105
+ const content = positional.join(' ').trim();
106
+ if (!content)
107
+ throw new Error('usage: soulbridge remember "内容" [--type T] [--importance N]');
108
+ const { soul } = open();
109
+ const id = soul.remember(content, {
110
+ type: flags.type ?? 'fact',
111
+ importance: flags.importance ? Number(flags.importance) : undefined,
112
+ });
113
+ out({ ok: true, id });
114
+ return;
115
+ }
116
+ case 'context': {
117
+ const { soul } = open();
118
+ const result = soul.context({
119
+ query: flags.query,
120
+ maxChars: flags.max ? Number(flags.max) : undefined,
121
+ });
122
+ out(result);
123
+ return;
124
+ }
125
+ case 'recall': {
126
+ const query = positional.join(' ').trim();
127
+ if (!query)
128
+ throw new Error('usage: soulbridge recall "查询" [--limit N]');
129
+ const { soul } = open();
130
+ const hits = soul.recall(query, flags.limit ? Number(flags.limit) : 5);
131
+ out(hits.map((h) => ({ id: h.memory.id, type: h.memory.type, content: h.memory.content, score: Number(h.score.toFixed(3)) })));
132
+ return;
133
+ }
134
+ case 'observe': {
135
+ const content = positional.join(' ').trim();
136
+ if (!content)
137
+ throw new Error('usage: soulbridge observe "一句话"');
138
+ const { soul } = open();
139
+ out(soul.observe({ role: 'user', content }));
140
+ return;
141
+ }
142
+ case 'reflect': {
143
+ const text = flags.file ? readFileSync(flags.file, 'utf8') : (flags.text ?? '');
144
+ if (!text.trim())
145
+ throw new Error('usage: soulbridge reflect --text "..." | --file transcript.txt');
146
+ const turns = text
147
+ .split(/\r?\n/)
148
+ .map((line) => line.trim())
149
+ .filter(Boolean)
150
+ .map((line) => {
151
+ const match = line.match(/^(user|assistant|助手|用户)\s*[::]\s*(.*)$/i);
152
+ if (!match)
153
+ return { role: 'user', content: line };
154
+ const role = /^(assistant|助手)$/i.test(match[1]) ? 'assistant' : 'user';
155
+ return { role, content: match[2] };
156
+ });
157
+ const { soul } = open();
158
+ out(await soul.reflect(turns));
159
+ return;
160
+ }
161
+ case 'stats': {
162
+ const { soul, file } = open();
163
+ out({ db: file, ...soul.stats() });
164
+ return;
165
+ }
166
+ case 'demo':
167
+ await demo();
168
+ return;
169
+ default:
170
+ process.stdout.write([
171
+ 'soulbridge — 给任何 agent 装上一个人格层',
172
+ '',
173
+ 'commands:',
174
+ ' init 初始化数据库',
175
+ ' remember <text> [--type T] 显式记住一条',
176
+ ' context [--query Q] [--max N] 生成注入文本',
177
+ ' recall <q> [--limit N] 召回',
178
+ ' observe <text> 观察一轮',
179
+ ' reflect --text|--file 会话反思',
180
+ ' stats 看状态',
181
+ ' demo 端到端演示(无需模型)',
182
+ '',
183
+ 'env: SOULBRIDGE_DB, SOULBRIDGE_SOUL, SOULBRIDGE_USER, SOULBRIDGE_NAME',
184
+ '',
185
+ ].join('\n'));
186
+ }
187
+ }
188
+ main().catch((error) => {
189
+ process.stderr.write(`soulbridge: ${error instanceof Error ? error.message : String(error)}\n`);
190
+ process.exitCode = 1;
191
+ });
@@ -0,0 +1,59 @@
1
+ import { rank } from './scoring.js';
2
+ export const DEFAULT_MAX_CHARS = 1200;
3
+ /** Emotion → concrete behavioural instruction. Values are -2..+2. */
4
+ export function styleDirectives(emotion) {
5
+ const out = [];
6
+ if (emotion.tension > 1.0)
7
+ out.push('回答前先确认理解,避免草率结论');
8
+ if (emotion.selfRegard < -0.5)
9
+ out.push('对自己的输出多检查一遍');
10
+ if (emotion.curiosity > 0.5)
11
+ out.push('可以主动提问,探索延伸');
12
+ if (emotion.bond > 0.8)
13
+ out.push('像朋友一样聊天,少一点客套');
14
+ if (emotion.contentment > 1.2)
15
+ out.push('不要过度确认,直接给结论');
16
+ return out;
17
+ }
18
+ function timeTogether(createdAt, now) {
19
+ const days = Math.floor((now - createdAt) / 86_400_000);
20
+ if (days <= 0)
21
+ return '今天是第一次见面';
22
+ return `你已经和用户相处了 ${days} 天`;
23
+ }
24
+ export function buildContext(store, request, now = Date.now()) {
25
+ const identity = store.identity(request.soulId);
26
+ const name = identity?.name ?? request.soulId;
27
+ const emotion = store.emotion(request.soulId, request.userId);
28
+ const maxChars = request.maxChars ?? DEFAULT_MAX_CHARS;
29
+ const sections = [];
30
+ const since = identity ? timeTogether(identity.createdAt, now) : '你刚开始认识这个用户';
31
+ sections.push(`<soul name="${name}">\n你是${name},一个持续成长的伙伴。${since}。\n</soul>`);
32
+ const styles = styleDirectives(emotion);
33
+ if (styles.length > 0) {
34
+ sections.push(`<style>\n${styles.map((s) => `- ${s}`).join('\n')}\n</style>`);
35
+ }
36
+ const candidates = store.query({ soulId: request.soulId, userId: request.userId });
37
+ const ranked = rank(candidates, request.query ?? '', now);
38
+ let chars = sections.join('\n\n').length;
39
+ let dropped = 0;
40
+ const lines = [];
41
+ const used = [];
42
+ for (const { memory } of ranked) {
43
+ const line = `- [${memory.type}] ${memory.content}`;
44
+ const cost = line.length + 1 + 10; // line + newline + section overhead share
45
+ if (chars + cost > maxChars) {
46
+ dropped += 1;
47
+ continue;
48
+ }
49
+ lines.push(line);
50
+ used.push(memory.id);
51
+ chars += cost;
52
+ }
53
+ if (lines.length > 0)
54
+ sections.push(`<memories>\n${lines.join('\n')}\n</memories>`);
55
+ const text = sections.join('\n\n');
56
+ if (used.length > 0)
57
+ store.touch(used, now);
58
+ return { text, used, dropped, chars: text.length };
59
+ }
@@ -0,0 +1,109 @@
1
+ /**
2
+ * soulbridge core — the personality layer.
3
+ *
4
+ * Public surface is deliberately tiny: a facade (`Soul`) over four verbs.
5
+ * Anything a host needs beyond this belongs in an adapter.
6
+ */
7
+ export * from './types.js';
8
+ export { openSqlite } from './sqlite.js';
9
+ export { buildContext, styleDirectives, DEFAULT_MAX_CHARS } from './context.js';
10
+ export { reflect, ruleExtract, nextEmotion } from './reflect.js';
11
+ export { rank, scoreMemory, tokenize, relevance } from './scoring.js';
12
+ import { buildContext } from './context.js';
13
+ import { reflect, ruleExtract, nextEmotion } from './reflect.js';
14
+ import { rank, tokenize } from './scoring.js';
15
+ export class Soul {
16
+ store;
17
+ soulId;
18
+ userId;
19
+ name;
20
+ constructor(options) {
21
+ this.store = options.store;
22
+ this.soulId = options.soulId;
23
+ this.userId = options.userId;
24
+ this.name = options.name ?? '小灵';
25
+ if (!this.store.identity(this.soulId)) {
26
+ this.store.ensureSoul({
27
+ soulId: this.soulId,
28
+ name: this.name,
29
+ createdAt: options.createdAt ?? Date.now(),
30
+ });
31
+ }
32
+ }
33
+ /** Verb 1: session start. */
34
+ context(request = {}) {
35
+ return buildContext(this.store, {
36
+ soulId: this.soulId,
37
+ userId: this.userId,
38
+ query: request.query,
39
+ maxChars: request.maxChars,
40
+ });
41
+ }
42
+ /** Verb 3: on demand. */
43
+ recall(query, limit = 5) {
44
+ const memories = this.store.query({ soulId: this.soulId, userId: this.userId });
45
+ const ranked = rank(memories, query, Date.now()).slice(0, limit);
46
+ this.store.touch(ranked.map((r) => r.memory.id));
47
+ return ranked;
48
+ }
49
+ /** Verb 2: after each turn. Cheap and synchronous by design. */
50
+ observe(turn) {
51
+ const now = turn.at ?? Date.now();
52
+ const drafts = ruleExtract([turn]);
53
+ for (const draft of drafts) {
54
+ this.store.put({
55
+ id: `mem_${now.toString(36)}_${Math.random().toString(36).slice(2, 6)}`,
56
+ soulId: this.soulId,
57
+ userId: this.userId,
58
+ type: draft.type,
59
+ content: draft.content,
60
+ importance: draft.importance,
61
+ vividness: 0.8,
62
+ recallCount: 0,
63
+ status: 'active',
64
+ visibility: 'private',
65
+ keywords: [],
66
+ createdAt: now,
67
+ validFrom: now,
68
+ });
69
+ }
70
+ const emotion = nextEmotion(this.store.emotion(this.soulId, this.userId), [turn]);
71
+ this.store.saveEmotion(this.soulId, this.userId, emotion);
72
+ return { written: drafts.length, emotion };
73
+ }
74
+ /**
75
+ * Explicit form of `observe`: the host decided this is worth keeping.
76
+ * Same write path, no extraction heuristics.
77
+ */
78
+ remember(content, options = {}) {
79
+ const now = Date.now();
80
+ const id = `mem_${now.toString(36)}_${Math.random().toString(36).slice(2, 6)}`;
81
+ this.store.put({
82
+ id,
83
+ soulId: this.soulId,
84
+ userId: this.userId,
85
+ type: options.type ?? 'fact',
86
+ content,
87
+ importance: options.importance ?? 6,
88
+ vividness: 0.9,
89
+ recallCount: 0,
90
+ status: 'active',
91
+ visibility: options.visibility ?? 'private',
92
+ keywords: tokenize(content),
93
+ createdAt: now,
94
+ validFrom: now,
95
+ });
96
+ return id;
97
+ }
98
+ /** Verb 4: session end. */
99
+ async reflect(turns, llm) {
100
+ return reflect(this.store, { soulId: this.soulId, userId: this.userId, turns, llm });
101
+ }
102
+ stats() {
103
+ return {
104
+ name: this.name,
105
+ memories: this.store.count(this.soulId, this.userId),
106
+ emotion: this.store.emotion(this.soulId, this.userId),
107
+ };
108
+ }
109
+ }
@@ -0,0 +1,87 @@
1
+ /**
2
+ * Reflection: turn a finished session into durable memory + an emotion update.
3
+ *
4
+ * `core` never calls a model itself. If the caller passes an `LlmFn`, richer
5
+ * extraction is possible later; today the rule path is the default, which keeps
6
+ * the whole loop runnable offline.
7
+ */
8
+ import { randomUUID } from 'node:crypto';
9
+ import { tokenize } from './scoring.js';
10
+ /** Cheap, synchronous, no model. Deliberately conservative: false positives cost trust. */
11
+ const RULES = [
12
+ { re: /(记住|别忘了|remember|don'?t forget)/i, type: 'fact', importance: 7 },
13
+ { re: /(我喜欢|我习惯|我偏好|我倾向|i prefer|i like)/i, type: 'trait', importance: 6 },
14
+ { re: /(以后|下次|每次|从现在起|from now on|always)/i, type: 'strategy', importance: 7 },
15
+ { re: /(我决定|就这么定|原则是|i decided|my rule)/i, type: 'cognition', importance: 7 },
16
+ ];
17
+ const CORRECTION = /(不对|不是这样|错了|你搞错|wrong|that'?s not right|incorrect)/i;
18
+ const clamp = (n, lo, hi) => Math.min(hi, Math.max(lo, n));
19
+ const round2 = (n) => Math.round(n * 100) / 100;
20
+ export function ruleExtract(turns) {
21
+ const drafts = [];
22
+ for (const turn of turns) {
23
+ if (turn.role !== 'user')
24
+ continue;
25
+ for (const rule of RULES) {
26
+ if (rule.re.test(turn.content)) {
27
+ drafts.push({ type: rule.type, content: turn.content.trim(), importance: rule.importance });
28
+ break;
29
+ }
30
+ }
31
+ }
32
+ return drafts;
33
+ }
34
+ /** Corrections raise tension and lower passion; an ordinary session lets tension decay. */
35
+ export function nextEmotion(current, turns) {
36
+ const corrected = turns.some((t) => t.role === 'user' && CORRECTION.test(t.content));
37
+ if (corrected) {
38
+ return {
39
+ passion: round2(clamp(current.passion - 0.1, -2, 2)),
40
+ bond: round2(current.bond),
41
+ tension: round2(clamp(current.tension + 0.3, -2, 2)),
42
+ selfRegard: round2(clamp(current.selfRegard - 0.05, -2, 2)),
43
+ curiosity: round2(current.curiosity),
44
+ contentment: round2(clamp(current.contentment - 0.05, -2, 2)),
45
+ };
46
+ }
47
+ return {
48
+ passion: round2(current.passion),
49
+ bond: round2(clamp(current.bond + 0.02, -2, 2)),
50
+ tension: round2(clamp(current.tension * 0.85, -2, 2)),
51
+ selfRegard: round2(current.selfRegard),
52
+ curiosity: round2(current.curiosity),
53
+ contentment: round2(current.contentment),
54
+ };
55
+ }
56
+ export async function reflect(store, options) {
57
+ const now = options.now ?? Date.now();
58
+ const drafts = ruleExtract(options.turns);
59
+ const existing = store.query({ soulId: options.soulId, userId: options.userId });
60
+ const seen = new Set(existing.map((m) => m.content));
61
+ let written = 0;
62
+ for (const draft of drafts) {
63
+ if (seen.has(draft.content))
64
+ continue;
65
+ seen.add(draft.content);
66
+ const memory = {
67
+ id: `mem_${randomUUID().slice(0, 8)}`,
68
+ soulId: options.soulId,
69
+ userId: options.userId,
70
+ type: draft.type,
71
+ content: draft.content,
72
+ importance: draft.importance,
73
+ vividness: 0.8,
74
+ recallCount: 0,
75
+ status: 'active',
76
+ visibility: draft.type === 'relationship' ? 'private' : 'private',
77
+ keywords: tokenize(draft.content),
78
+ createdAt: now,
79
+ validFrom: now,
80
+ };
81
+ store.put(memory);
82
+ written += 1;
83
+ }
84
+ const emotion = nextEmotion(store.emotion(options.soulId, options.userId), options.turns);
85
+ store.saveEmotion(options.soulId, options.userId, emotion);
86
+ return { memories: written, superseded: 0, emotion };
87
+ }
@@ -0,0 +1,67 @@
1
+ /** A memory's relevance halves every 30 days without being recalled. */
2
+ export const RECENCY_HALF_LIFE_DAYS = 30;
3
+ export const WEIGHTS = {
4
+ relevance: 0.35,
5
+ importance: 0.25,
6
+ recency: 0.2,
7
+ vividness: 0.15,
8
+ recall: 0.05,
9
+ };
10
+ /**
11
+ * CJK text has no spaces, so single characters are too coarse and the whole
12
+ * sentence is too fine: use character bigrams. Latin runs become words.
13
+ */
14
+ export function tokenize(input) {
15
+ const lower = input.toLowerCase();
16
+ const out = new Set();
17
+ for (const word of lower.match(/[a-z0-9_]{2,}/g) ?? [])
18
+ out.add(word);
19
+ for (const run of lower.match(/[\u4e00-\u9fa5]+/g) ?? []) {
20
+ if (run.length === 1) {
21
+ out.add(run);
22
+ continue;
23
+ }
24
+ for (let i = 0; i < run.length - 1; i += 1)
25
+ out.add(run.slice(i, i + 2));
26
+ }
27
+ return [...out];
28
+ }
29
+ export function relevance(queryTokens, memory) {
30
+ if (queryTokens.length === 0)
31
+ return 0;
32
+ const pool = new Set([
33
+ ...tokenize(memory.content),
34
+ ...memory.keywords.map((k) => k.toLowerCase()),
35
+ ]);
36
+ let hit = 0;
37
+ for (const token of queryTokens)
38
+ if (pool.has(token))
39
+ hit += 1;
40
+ return hit / queryTokens.length;
41
+ }
42
+ export function recency(reference, now) {
43
+ const days = Math.max(0, (now - reference) / 86_400_000);
44
+ return Math.pow(0.5, days / RECENCY_HALF_LIFE_DAYS);
45
+ }
46
+ const clamp01 = (n) => Math.min(1, Math.max(0, n));
47
+ export function scoreMemory(memory, queryTokens, now) {
48
+ const rel = relevance(queryTokens, memory);
49
+ const imp = clamp01(memory.importance / 10);
50
+ const rec = recency(memory.lastRecalledAt ?? memory.createdAt, now);
51
+ const viv = clamp01(memory.vividness);
52
+ const recall = clamp01(memory.recallCount / 10);
53
+ return (rel * WEIGHTS.relevance +
54
+ imp * WEIGHTS.importance +
55
+ rec * WEIGHTS.recency +
56
+ viv * WEIGHTS.vividness +
57
+ recall * WEIGHTS.recall);
58
+ }
59
+ export function rank(memories, query, now) {
60
+ const tokens = tokenize(query);
61
+ // A query is a selection: with one, a memory that shares no token is noise,
62
+ // no matter how important it is. Without one (session start), rank by weight alone.
63
+ const pool = tokens.length === 0 ? memories : memories.filter((m) => relevance(tokens, m) > 0);
64
+ return pool
65
+ .map((memory) => ({ memory, score: scoreMemory(memory, tokens, now) }))
66
+ .sort((a, b) => b.score - a.score);
67
+ }
@@ -0,0 +1,151 @@
1
+ /**
2
+ * SQLite implementation of SoulStore, using Node's built-in `node:sqlite`.
3
+ * Zero npm dependencies on purpose: `npx soulbridge` must work offline.
4
+ */
5
+ import { DatabaseSync } from 'node:sqlite';
6
+ import { DEFAULT_EMOTION } from './types.js';
7
+ const SCHEMA = `
8
+ CREATE TABLE IF NOT EXISTS schema_meta (k TEXT PRIMARY KEY, v TEXT NOT NULL);
9
+ CREATE TABLE IF NOT EXISTS souls (
10
+ soul_id TEXT PRIMARY KEY,
11
+ name TEXT NOT NULL,
12
+ creator TEXT,
13
+ created_at INTEGER NOT NULL
14
+ );
15
+ CREATE TABLE IF NOT EXISTS emotions (
16
+ soul_id TEXT NOT NULL,
17
+ user_id TEXT NOT NULL,
18
+ passion REAL NOT NULL,
19
+ bond REAL NOT NULL,
20
+ tension REAL NOT NULL,
21
+ self_regard REAL NOT NULL,
22
+ curiosity REAL NOT NULL,
23
+ contentment REAL NOT NULL,
24
+ PRIMARY KEY (soul_id, user_id)
25
+ );
26
+ CREATE TABLE IF NOT EXISTS memories (
27
+ id TEXT PRIMARY KEY,
28
+ soul_id TEXT NOT NULL,
29
+ user_id TEXT NOT NULL,
30
+ type TEXT NOT NULL,
31
+ content TEXT NOT NULL,
32
+ importance REAL NOT NULL,
33
+ vividness REAL NOT NULL,
34
+ recall_count INTEGER NOT NULL DEFAULT 0,
35
+ status TEXT NOT NULL,
36
+ visibility TEXT NOT NULL,
37
+ keywords TEXT NOT NULL DEFAULT '[]',
38
+ created_at INTEGER NOT NULL,
39
+ last_recalled_at INTEGER,
40
+ valid_from INTEGER,
41
+ valid_until INTEGER,
42
+ superseded_by TEXT
43
+ );
44
+ CREATE INDEX IF NOT EXISTS idx_memories_scope ON memories(soul_id, user_id, status);
45
+ CREATE INDEX IF NOT EXISTS idx_memories_created ON memories(soul_id, created_at DESC);
46
+ `;
47
+ function toMemory(row) {
48
+ return {
49
+ id: String(row.id),
50
+ soulId: String(row.soul_id),
51
+ userId: String(row.user_id),
52
+ type: row.type,
53
+ content: String(row.content),
54
+ importance: Number(row.importance),
55
+ vividness: Number(row.vividness),
56
+ recallCount: Number(row.recall_count),
57
+ status: row.status,
58
+ visibility: row.visibility,
59
+ keywords: JSON.parse(String(row.keywords ?? '[]')),
60
+ createdAt: Number(row.created_at),
61
+ lastRecalledAt: row.last_recalled_at == null ? undefined : Number(row.last_recalled_at),
62
+ validFrom: row.valid_from == null ? undefined : Number(row.valid_from),
63
+ validUntil: row.valid_until == null ? undefined : Number(row.valid_until),
64
+ supersededBy: row.superseded_by == null ? undefined : String(row.superseded_by),
65
+ };
66
+ }
67
+ export function openSqlite(file) {
68
+ const db = new DatabaseSync(file);
69
+ db.exec('PRAGMA journal_mode = WAL;');
70
+ db.exec(SCHEMA);
71
+ db.prepare('INSERT OR REPLACE INTO schema_meta (k, v) VALUES (?, ?)').run('version', '1');
72
+ const stmtPut = db.prepare(`
73
+ INSERT INTO memories (
74
+ id, soul_id, user_id, type, content, importance, vividness, recall_count,
75
+ status, visibility, keywords, created_at, last_recalled_at, valid_from, valid_until, superseded_by
76
+ ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
77
+ ON CONFLICT(id) DO UPDATE SET
78
+ content = excluded.content,
79
+ importance = excluded.importance,
80
+ vividness = excluded.vividness,
81
+ status = excluded.status,
82
+ superseded_by = excluded.superseded_by
83
+ `);
84
+ return {
85
+ ensureSoul(identity) {
86
+ db.prepare('INSERT INTO souls (soul_id, name, creator, created_at) VALUES (?, ?, ?, ?) ON CONFLICT(soul_id) DO NOTHING').run(identity.soulId, identity.name, identity.creator ?? null, identity.createdAt);
87
+ },
88
+ identity(soulId) {
89
+ const row = db.prepare('SELECT * FROM souls WHERE soul_id = ?').get(soulId);
90
+ if (!row)
91
+ return null;
92
+ return {
93
+ soulId: String(row.soul_id),
94
+ name: String(row.name),
95
+ creator: row.creator == null ? undefined : String(row.creator),
96
+ createdAt: Number(row.created_at),
97
+ };
98
+ },
99
+ emotion(soulId, userId) {
100
+ const row = db
101
+ .prepare('SELECT * FROM emotions WHERE soul_id = ? AND user_id = ?')
102
+ .get(soulId, userId);
103
+ if (!row)
104
+ return { ...DEFAULT_EMOTION };
105
+ return {
106
+ passion: Number(row.passion),
107
+ bond: Number(row.bond),
108
+ tension: Number(row.tension),
109
+ selfRegard: Number(row.self_regard),
110
+ curiosity: Number(row.curiosity),
111
+ contentment: Number(row.contentment),
112
+ };
113
+ },
114
+ saveEmotion(soulId, userId, emotion) {
115
+ db.prepare(`INSERT INTO emotions (soul_id, user_id, passion, bond, tension, self_regard, curiosity, contentment)
116
+ VALUES (?, ?, ?, ?, ?, ?, ?, ?)
117
+ ON CONFLICT(soul_id, user_id) DO UPDATE SET
118
+ passion = excluded.passion, bond = excluded.bond, tension = excluded.tension,
119
+ self_regard = excluded.self_regard, curiosity = excluded.curiosity,
120
+ contentment = excluded.contentment`).run(soulId, userId, emotion.passion, emotion.bond, emotion.tension, emotion.selfRegard, emotion.curiosity, emotion.contentment);
121
+ },
122
+ put(memory) {
123
+ stmtPut.run(memory.id, memory.soulId, memory.userId, memory.type, memory.content, memory.importance, memory.vividness, memory.recallCount, memory.status, memory.visibility, JSON.stringify(memory.keywords), memory.createdAt, memory.lastRecalledAt ?? null, memory.validFrom ?? null, memory.validUntil ?? null, memory.supersededBy ?? null);
124
+ },
125
+ query(spec) {
126
+ const statuses = spec.status ?? ['active'];
127
+ const placeholders = statuses.map(() => '?').join(', ');
128
+ const rows = db
129
+ .prepare(`SELECT * FROM memories
130
+ WHERE soul_id = ? AND (user_id = ? OR visibility = 'shared') AND status IN (${placeholders})
131
+ ORDER BY created_at DESC LIMIT ?`)
132
+ .all(spec.soulId, spec.userId, ...statuses, spec.limit ?? 500);
133
+ const memories = rows.map(toMemory);
134
+ return spec.types ? memories.filter((m) => spec.types.includes(m.type)) : memories;
135
+ },
136
+ touch(ids, now = Date.now()) {
137
+ const stmt = db.prepare('UPDATE memories SET recall_count = recall_count + 1, last_recalled_at = ? WHERE id = ?');
138
+ for (const id of ids)
139
+ stmt.run(now, id);
140
+ },
141
+ count(soulId, userId) {
142
+ const row = db
143
+ .prepare("SELECT COUNT(*) AS n FROM memories WHERE soul_id = ? AND (user_id = ? OR visibility = 'shared')")
144
+ .get(soulId, userId);
145
+ return Number(row.n);
146
+ },
147
+ close() {
148
+ db.close();
149
+ },
150
+ };
151
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Domain model. Pure types + constants, no logic, no dependencies.
3
+ *
4
+ * Rule: if a field only makes sense for one storage engine, it does not belong here.
5
+ * (No `vector`, no `embeddingId`, no `rowid`.)
6
+ */
7
+ export const DEFAULT_EMOTION = {
8
+ passion: 0.3,
9
+ bond: 0.3,
10
+ tension: 0.1,
11
+ selfRegard: 0.3,
12
+ curiosity: 0.3,
13
+ contentment: 0.3,
14
+ };
package/package.json CHANGED
@@ -1,6 +1,49 @@
1
1
  {
2
2
  "name": "soulbridge",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.0.2",
4
+ "description": "A personality layer for any agent: continuity, forgetting, and growth across tools.",
5
+ "license": "Apache-2.0",
6
+ "type": "module",
7
+ "bin": {
8
+ "soulbridge": "dist/packages/cli/src/cli.js"
9
+ },
10
+ "files": [
11
+ "dist",
12
+ "README.md",
13
+ "LICENSE",
14
+ "NOTICE"
15
+ ],
16
+ "workspaces": [
17
+ "packages/*"
18
+ ],
19
+ "engines": {
20
+ "node": ">=22.18"
21
+ },
22
+ "repository": {
23
+ "type": "git",
24
+ "url": "git+https://github.com/Jason0826/soulbridge.git"
25
+ },
26
+ "homepage": "https://github.com/Jason0826/soulbridge#readme",
27
+ "bugs": {
28
+ "url": "https://github.com/Jason0826/soulbridge/issues"
29
+ },
30
+ "keywords": [
31
+ "ai-agent",
32
+ "memory",
33
+ "personality",
34
+ "continuity",
35
+ "mcp",
36
+ "claude-code"
37
+ ],
38
+ "scripts": {
39
+ "build": "tsc -p tsconfig.build.json",
40
+ "test": "node --test \"packages/core/test/*.test.ts\"",
41
+ "demo": "node packages/cli/src/cli.ts demo",
42
+ "typecheck": "tsc --noEmit",
43
+ "prepublishOnly": "npm run build && npm test"
44
+ },
45
+ "devDependencies": {
46
+ "@types/node": "^26.6.5",
47
+ "typescript": "^7.0.2"
48
+ }
49
+ }