@jonathangu/openclawbrain 0.3.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 (113) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +412 -0
  3. package/bin/openclawbrain.js +15 -0
  4. package/docs/END_STATE.md +244 -0
  5. package/docs/EVIDENCE.md +128 -0
  6. package/docs/RELEASE_CONTRACT.md +91 -0
  7. package/docs/agent-tools.md +106 -0
  8. package/docs/architecture.md +224 -0
  9. package/docs/configuration.md +178 -0
  10. package/docs/evidence/2026-03-16/3188b50c4ed30f07dea111e35ce52aabefaced63/brain-teach-session-bound/status.json +87 -0
  11. package/docs/evidence/2026-03-16/3188b50c4ed30f07dea111e35ce52aabefaced63/brain-teach-session-bound/summary.md +16 -0
  12. package/docs/evidence/2026-03-16/3188b50c4ed30f07dea111e35ce52aabefaced63/brain-teach-session-bound/trace.json +273 -0
  13. package/docs/evidence/2026-03-16/3188b50c4ed30f07dea111e35ce52aabefaced63/brain-teach-session-bound/validation-report.json +652 -0
  14. package/docs/evidence/2026-03-16/4941429588810da5d6f7ef1509f229f83fa08031/channels-status.txt +31 -0
  15. package/docs/evidence/2026-03-16/4941429588810da5d6f7ef1509f229f83fa08031/config-snapshot.json +66 -0
  16. package/docs/evidence/2026-03-16/4941429588810da5d6f7ef1509f229f83fa08031/doctor.json +14 -0
  17. package/docs/evidence/2026-03-16/4941429588810da5d6f7ef1509f229f83fa08031/gateway-probe.txt +34 -0
  18. package/docs/evidence/2026-03-16/4941429588810da5d6f7ef1509f229f83fa08031/gateway-status.txt +41 -0
  19. package/docs/evidence/2026-03-16/4941429588810da5d6f7ef1509f229f83fa08031/logs.txt +428 -0
  20. package/docs/evidence/2026-03-16/4941429588810da5d6f7ef1509f229f83fa08031/status-all.txt +60 -0
  21. package/docs/evidence/2026-03-16/4941429588810da5d6f7ef1509f229f83fa08031/status.json +223 -0
  22. package/docs/evidence/2026-03-16/4941429588810da5d6f7ef1509f229f83fa08031/summary.md +13 -0
  23. package/docs/evidence/2026-03-16/4941429588810da5d6f7ef1509f229f83fa08031/trace.json +4 -0
  24. package/docs/evidence/2026-03-16/4941429588810da5d6f7ef1509f229f83fa08031/validation-report.json +334 -0
  25. package/docs/evidence/2026-03-16/7f8dbcb27e741abdeefd5656c210639d0acdd440/channels-status.txt +25 -0
  26. package/docs/evidence/2026-03-16/7f8dbcb27e741abdeefd5656c210639d0acdd440/config-snapshot.json +91 -0
  27. package/docs/evidence/2026-03-16/7f8dbcb27e741abdeefd5656c210639d0acdd440/doctor.json +14 -0
  28. package/docs/evidence/2026-03-16/7f8dbcb27e741abdeefd5656c210639d0acdd440/gateway-probe.txt +36 -0
  29. package/docs/evidence/2026-03-16/7f8dbcb27e741abdeefd5656c210639d0acdd440/gateway-status.txt +44 -0
  30. package/docs/evidence/2026-03-16/7f8dbcb27e741abdeefd5656c210639d0acdd440/logs.txt +428 -0
  31. package/docs/evidence/2026-03-16/7f8dbcb27e741abdeefd5656c210639d0acdd440/short-static-classification/preflight-doctor.json +10 -0
  32. package/docs/evidence/2026-03-16/7f8dbcb27e741abdeefd5656c210639d0acdd440/short-static-classification/preflight-sdk-probe.json +11 -0
  33. package/docs/evidence/2026-03-16/7f8dbcb27e741abdeefd5656c210639d0acdd440/short-static-classification/preflight-setup-only.json +12 -0
  34. package/docs/evidence/2026-03-16/7f8dbcb27e741abdeefd5656c210639d0acdd440/short-static-classification/summary.md +30 -0
  35. package/docs/evidence/2026-03-16/7f8dbcb27e741abdeefd5656c210639d0acdd440/short-static-classification/validation-report.json +72 -0
  36. package/docs/evidence/2026-03-16/7f8dbcb27e741abdeefd5656c210639d0acdd440/status-all.txt +63 -0
  37. package/docs/evidence/2026-03-16/7f8dbcb27e741abdeefd5656c210639d0acdd440/status.json +200 -0
  38. package/docs/evidence/2026-03-16/7f8dbcb27e741abdeefd5656c210639d0acdd440/summary.md +13 -0
  39. package/docs/evidence/2026-03-16/7f8dbcb27e741abdeefd5656c210639d0acdd440/trace.json +4 -0
  40. package/docs/evidence/2026-03-16/7f8dbcb27e741abdeefd5656c210639d0acdd440/validation-report.json +311 -0
  41. package/docs/evidence/README.md +16 -0
  42. package/docs/fts5.md +161 -0
  43. package/docs/tui.md +506 -0
  44. package/index.ts +1372 -0
  45. package/openclaw.plugin.json +136 -0
  46. package/package.json +66 -0
  47. package/src/assembler.ts +804 -0
  48. package/src/brain-cli.ts +316 -0
  49. package/src/brain-core/decay.ts +35 -0
  50. package/src/brain-core/episode.ts +82 -0
  51. package/src/brain-core/graph.ts +321 -0
  52. package/src/brain-core/health.ts +116 -0
  53. package/src/brain-core/mutator.ts +281 -0
  54. package/src/brain-core/pack.ts +117 -0
  55. package/src/brain-core/policy.ts +153 -0
  56. package/src/brain-core/replay.ts +1 -0
  57. package/src/brain-core/teacher.ts +105 -0
  58. package/src/brain-core/trace.ts +40 -0
  59. package/src/brain-core/traverse.ts +230 -0
  60. package/src/brain-core/types.ts +405 -0
  61. package/src/brain-core/update.ts +123 -0
  62. package/src/brain-harvest/human.ts +46 -0
  63. package/src/brain-harvest/scanner.ts +98 -0
  64. package/src/brain-harvest/self.ts +147 -0
  65. package/src/brain-runtime/assembler-extension.ts +230 -0
  66. package/src/brain-runtime/evidence-detectors.ts +68 -0
  67. package/src/brain-runtime/graph-io.ts +72 -0
  68. package/src/brain-runtime/harvester-extension.ts +98 -0
  69. package/src/brain-runtime/service.ts +659 -0
  70. package/src/brain-runtime/tools.ts +109 -0
  71. package/src/brain-runtime/worker-state.ts +106 -0
  72. package/src/brain-runtime/worker-supervisor.ts +169 -0
  73. package/src/brain-store/embedding.ts +179 -0
  74. package/src/brain-store/init.ts +347 -0
  75. package/src/brain-store/migrations.ts +188 -0
  76. package/src/brain-store/store.ts +816 -0
  77. package/src/brain-worker/child-runner.ts +321 -0
  78. package/src/brain-worker/jobs.ts +12 -0
  79. package/src/brain-worker/mutation-job.ts +5 -0
  80. package/src/brain-worker/promotion-job.ts +5 -0
  81. package/src/brain-worker/protocol.ts +79 -0
  82. package/src/brain-worker/teacher-job.ts +5 -0
  83. package/src/brain-worker/update-job.ts +5 -0
  84. package/src/brain-worker/worker.ts +422 -0
  85. package/src/compaction.ts +1332 -0
  86. package/src/db/config.ts +265 -0
  87. package/src/db/connection.ts +72 -0
  88. package/src/db/features.ts +42 -0
  89. package/src/db/migration.ts +561 -0
  90. package/src/engine.ts +1995 -0
  91. package/src/expansion-auth.ts +351 -0
  92. package/src/expansion-policy.ts +303 -0
  93. package/src/expansion.ts +383 -0
  94. package/src/integrity.ts +600 -0
  95. package/src/large-files.ts +527 -0
  96. package/src/openclaw-bridge.ts +22 -0
  97. package/src/retrieval.ts +357 -0
  98. package/src/store/conversation-store.ts +748 -0
  99. package/src/store/fts5-sanitize.ts +29 -0
  100. package/src/store/full-text-fallback.ts +74 -0
  101. package/src/store/index.ts +29 -0
  102. package/src/store/summary-store.ts +918 -0
  103. package/src/summarize.ts +847 -0
  104. package/src/tools/common.ts +53 -0
  105. package/src/tools/lcm-conversation-scope.ts +76 -0
  106. package/src/tools/lcm-describe-tool.ts +234 -0
  107. package/src/tools/lcm-expand-query-tool.ts +594 -0
  108. package/src/tools/lcm-expand-tool.delegation.ts +556 -0
  109. package/src/tools/lcm-expand-tool.ts +448 -0
  110. package/src/tools/lcm-expansion-recursion-guard.ts +286 -0
  111. package/src/tools/lcm-grep-tool.ts +200 -0
  112. package/src/transcript-repair.ts +301 -0
  113. package/src/types.ts +149 -0
@@ -0,0 +1,273 @@
1
+ {
2
+ "id": "bt_1aa18542",
3
+ "episodeId": "be_f513c088-527",
4
+ "packVersion": 2,
5
+ "queryText": "deployment failed again",
6
+ "seedScores": [
7
+ {
8
+ "nodeId": "bn_b99059af-e14",
9
+ "priorScore": 1,
10
+ "learnedSeedWeight": 0,
11
+ "policyScore": 1,
12
+ "probability": 0.24999999999999417,
13
+ "chosen": false
14
+ },
15
+ {
16
+ "nodeId": "bn_630e2b18-631",
17
+ "priorScore": 1,
18
+ "learnedSeedWeight": 0,
19
+ "policyScore": 1,
20
+ "probability": 0.24999999999999417,
21
+ "chosen": true
22
+ },
23
+ {
24
+ "nodeId": "bn_dd0c12c0-ff9",
25
+ "priorScore": 1,
26
+ "learnedSeedWeight": 0,
27
+ "policyScore": 1,
28
+ "probability": 0.24999999999999417,
29
+ "chosen": false
30
+ },
31
+ {
32
+ "nodeId": "bn_326bf1a5-09c",
33
+ "priorScore": 1,
34
+ "learnedSeedWeight": 0,
35
+ "policyScore": 1,
36
+ "probability": 0.24999999999999417,
37
+ "chosen": false
38
+ }
39
+ ],
40
+ "trajectory": [
41
+ {
42
+ "stateSnapshot": {
43
+ "currentNodeId": null,
44
+ "hopCount": 0,
45
+ "budgetRemaining": 12000,
46
+ "visitedCount": 0,
47
+ "firedCount": 0
48
+ },
49
+ "candidates": [
50
+ {
51
+ "action": {
52
+ "type": "traverse",
53
+ "targetNodeId": "bn_b99059af-e14",
54
+ "seedScore": 1
55
+ },
56
+ "score": 1,
57
+ "probability": 0.24999999999999417,
58
+ "priorScore": 1,
59
+ "learnedSeedWeight": 0
60
+ },
61
+ {
62
+ "action": {
63
+ "type": "traverse",
64
+ "targetNodeId": "bn_630e2b18-631",
65
+ "seedScore": 1
66
+ },
67
+ "score": 1,
68
+ "probability": 0.24999999999999417,
69
+ "priorScore": 1,
70
+ "learnedSeedWeight": 0
71
+ },
72
+ {
73
+ "action": {
74
+ "type": "traverse",
75
+ "targetNodeId": "bn_dd0c12c0-ff9",
76
+ "seedScore": 1
77
+ },
78
+ "score": 1,
79
+ "probability": 0.24999999999999417,
80
+ "priorScore": 1,
81
+ "learnedSeedWeight": 0
82
+ },
83
+ {
84
+ "action": {
85
+ "type": "traverse",
86
+ "targetNodeId": "bn_326bf1a5-09c",
87
+ "seedScore": 1
88
+ },
89
+ "score": 1,
90
+ "probability": 0.24999999999999417,
91
+ "priorScore": 1,
92
+ "learnedSeedWeight": 0
93
+ },
94
+ {
95
+ "action": {
96
+ "type": "stop"
97
+ },
98
+ "score": -2,
99
+ "probability": 2.339405742209989e-14
100
+ }
101
+ ],
102
+ "chosenAction": {
103
+ "type": "traverse",
104
+ "targetNodeId": "bn_630e2b18-631",
105
+ "seedScore": 1
106
+ },
107
+ "chosenActionProbability": 0.24999999999999417,
108
+ "stopProbability": 2.339405742209989e-14
109
+ },
110
+ {
111
+ "stateSnapshot": {
112
+ "currentNodeId": "bn_630e2b18-631",
113
+ "hopCount": 1,
114
+ "budgetRemaining": 11985,
115
+ "visitedCount": 1,
116
+ "firedCount": 1
117
+ },
118
+ "candidates": [
119
+ {
120
+ "action": {
121
+ "type": "traverse",
122
+ "targetNodeId": "bn_ac1e95bf-03c"
123
+ },
124
+ "score": 0.8,
125
+ "probability": 4.790575057470641e-7
126
+ },
127
+ {
128
+ "action": {
129
+ "type": "traverse",
130
+ "targetNodeId": "bn_b99059af-e14"
131
+ },
132
+ "score": 2.1,
133
+ "probability": 0.2119414560848914
134
+ },
135
+ {
136
+ "action": {
137
+ "type": "traverse",
138
+ "targetNodeId": "bn_dd0c12c0-ff9"
139
+ },
140
+ "score": 2.1,
141
+ "probability": 0.2119414560848914
142
+ },
143
+ {
144
+ "action": {
145
+ "type": "traverse",
146
+ "targetNodeId": "bn_326bf1a5-09c"
147
+ },
148
+ "score": 2.2,
149
+ "probability": 0.5761166087727115
150
+ },
151
+ {
152
+ "action": {
153
+ "type": "stop"
154
+ },
155
+ "score": -1.74625,
156
+ "probability": 4.189521307147131e-18
157
+ }
158
+ ],
159
+ "chosenAction": {
160
+ "type": "traverse",
161
+ "targetNodeId": "bn_dd0c12c0-ff9"
162
+ },
163
+ "chosenActionProbability": 0.2119414560848914,
164
+ "stopProbability": 4.189521307147131e-18
165
+ },
166
+ {
167
+ "stateSnapshot": {
168
+ "currentNodeId": "bn_dd0c12c0-ff9",
169
+ "hopCount": 2,
170
+ "budgetRemaining": 11948,
171
+ "visitedCount": 2,
172
+ "firedCount": 2
173
+ },
174
+ "candidates": [
175
+ {
176
+ "action": {
177
+ "type": "traverse",
178
+ "targetNodeId": "bn_b99059af-e14"
179
+ },
180
+ "score": 2.1,
181
+ "probability": 0.268941421369995
182
+ },
183
+ {
184
+ "action": {
185
+ "type": "traverse",
186
+ "targetNodeId": "bn_326bf1a5-09c"
187
+ },
188
+ "score": 2.2,
189
+ "probability": 0.7310585786300051
190
+ },
191
+ {
192
+ "action": {
193
+ "type": "stop"
194
+ },
195
+ "score": -1.487,
196
+ "probability": 7.10419101272258e-17
197
+ }
198
+ ],
199
+ "chosenAction": {
200
+ "type": "traverse",
201
+ "targetNodeId": "bn_b99059af-e14"
202
+ },
203
+ "chosenActionProbability": 0.268941421369995,
204
+ "stopProbability": 7.10419101272258e-17
205
+ },
206
+ {
207
+ "stateSnapshot": {
208
+ "currentNodeId": "bn_b99059af-e14",
209
+ "hopCount": 3,
210
+ "budgetRemaining": 11948,
211
+ "visitedCount": 3,
212
+ "firedCount": 2
213
+ },
214
+ "candidates": [
215
+ {
216
+ "action": {
217
+ "type": "traverse",
218
+ "targetNodeId": "bn_326bf1a5-09c"
219
+ },
220
+ "score": 2.2,
221
+ "probability": 0.9999999999999989
222
+ },
223
+ {
224
+ "action": {
225
+ "type": "stop"
226
+ },
227
+ "score": -1.237,
228
+ "probability": 1.1838553932348923e-15
229
+ }
230
+ ],
231
+ "chosenAction": {
232
+ "type": "traverse",
233
+ "targetNodeId": "bn_326bf1a5-09c"
234
+ },
235
+ "chosenActionProbability": 0.9999999999999989,
236
+ "stopProbability": 1.1838553932348923e-15
237
+ },
238
+ {
239
+ "stateSnapshot": {
240
+ "currentNodeId": "bn_326bf1a5-09c",
241
+ "hopCount": 4,
242
+ "budgetRemaining": 11933,
243
+ "visitedCount": 4,
244
+ "firedCount": 3
245
+ },
246
+ "candidates": [
247
+ {
248
+ "action": {
249
+ "type": "stop"
250
+ },
251
+ "score": 0,
252
+ "probability": 1
253
+ }
254
+ ],
255
+ "chosenAction": {
256
+ "type": "stop"
257
+ },
258
+ "chosenActionProbability": 1,
259
+ "stopProbability": 1
260
+ }
261
+ ],
262
+ "firedNodes": [
263
+ "bn_630e2b18-631",
264
+ "bn_dd0c12c0-ff9",
265
+ "bn_326bf1a5-09c"
266
+ ],
267
+ "vetoedNodes": [
268
+ "bn_b99059af-e14"
269
+ ],
270
+ "contextChars": 263,
271
+ "footer": "Brain · 4 seeds · start bn_630e2b18-631 · 4 hops · 3 fired · 1 veto · 263 chars",
272
+ "createdAt": 1773634784489
273
+ }