crbro-memory 2.9.1 → 2.11.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 (197) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +256 -456
  3. package/SECURITY.md +135 -8
  4. package/bin/crbro.mjs +555 -299
  5. package/dist/build-id.json +10 -0
  6. package/dist/cli/common.js +211 -0
  7. package/dist/cli/export.js +522 -0
  8. package/dist/cli/import.js +683 -0
  9. package/dist/cli/markdown.js +313 -0
  10. package/dist/cli/mcpclient.js +107 -0
  11. package/dist/cli/serve.js +453 -0
  12. package/dist/cli/view.js +358 -0
  13. package/dist/cli/viewer-page.js +378 -0
  14. package/dist/daemon/daemon.js +119 -11
  15. package/dist/daemon/endpoint.js +222 -21
  16. package/dist/daemon/lines.js +102 -13
  17. package/dist/daemon/proxy.js +480 -125
  18. package/dist/daemon/surface.js +116 -0
  19. package/dist/daemon/trace.js +73 -0
  20. package/dist/engine/atrest.js +132 -0
  21. package/dist/engine/backup.js +143 -19
  22. package/dist/engine/brain.js +22 -6
  23. package/dist/engine/codexconfig.js +476 -0
  24. package/dist/engine/cortex.js +762 -311
  25. package/dist/engine/doctor.js +676 -0
  26. package/dist/engine/evidence.js +171 -0
  27. package/dist/engine/heat.js +81 -37
  28. package/dist/engine/hippocampus.js +50 -36
  29. package/dist/engine/hookrefresh.js +296 -0
  30. package/dist/engine/hookverify.js +15 -3
  31. package/dist/engine/installer.js +1022 -0
  32. package/dist/engine/installio.js +279 -0
  33. package/dist/engine/keychain.js +735 -144
  34. package/dist/engine/maintenance.js +355 -87
  35. package/dist/engine/modinstall.js +98 -45
  36. package/dist/engine/prefrontal.js +126 -69
  37. package/dist/engine/projects.js +80 -0
  38. package/dist/engine/quarantine.js +204 -0
  39. package/dist/engine/secrets.js +41 -5
  40. package/dist/engine/shelf.js +34 -11
  41. package/dist/engine/synapses.js +183 -80
  42. package/dist/engine/triggers.js +141 -11
  43. package/dist/index.js +37 -3
  44. package/dist/mcp-surface.json +1 -0
  45. package/dist/miner/extractor.js +64 -17
  46. package/dist/miner/scheduler.js +144 -68
  47. package/dist/search/index.js +810 -176
  48. package/dist/search/quality.js +31 -0
  49. package/dist/search/semantic.js +208 -18
  50. package/dist/search/tokenize.js +44 -0
  51. package/dist/server.js +649 -343
  52. package/dist/sync/git.js +203 -72
  53. package/dist/sync/materialize.js +33 -8
  54. package/dist/sync/space.js +286 -101
  55. package/dist/sync/validate.js +204 -0
  56. package/dist/utils/budget.js +15 -2
  57. package/dist/utils/fs.js +40 -6
  58. package/dist/utils/ids.js +128 -14
  59. package/dist/utils/lock.js +219 -52
  60. package/hooks/crbro-codex.mjs +284 -0
  61. package/hooks/crbro-guard.mjs +281 -173
  62. package/hooks/crbro-hooks.shipped.json +20 -0
  63. package/hooks/crbro-lifecycle.mjs +16 -4
  64. package/hooks/crbro-subagent.mjs +180 -180
  65. package/package.json +12 -8
  66. package/dist/daemon/daemon.d.ts +0 -25
  67. package/dist/daemon/daemon.d.ts.map +0 -1
  68. package/dist/daemon/daemon.js.map +0 -1
  69. package/dist/daemon/endpoint.d.ts +0 -66
  70. package/dist/daemon/endpoint.d.ts.map +0 -1
  71. package/dist/daemon/endpoint.js.map +0 -1
  72. package/dist/daemon/lines.d.ts +0 -55
  73. package/dist/daemon/lines.d.ts.map +0 -1
  74. package/dist/daemon/lines.js.map +0 -1
  75. package/dist/daemon/proxy.d.ts +0 -55
  76. package/dist/daemon/proxy.d.ts.map +0 -1
  77. package/dist/daemon/proxy.js.map +0 -1
  78. package/dist/engine/backup.d.ts +0 -68
  79. package/dist/engine/backup.d.ts.map +0 -1
  80. package/dist/engine/backup.js.map +0 -1
  81. package/dist/engine/brain.d.ts +0 -79
  82. package/dist/engine/brain.d.ts.map +0 -1
  83. package/dist/engine/brain.js.map +0 -1
  84. package/dist/engine/cortex.d.ts +0 -670
  85. package/dist/engine/cortex.d.ts.map +0 -1
  86. package/dist/engine/cortex.js.map +0 -1
  87. package/dist/engine/dates.d.ts +0 -28
  88. package/dist/engine/dates.d.ts.map +0 -1
  89. package/dist/engine/dates.js.map +0 -1
  90. package/dist/engine/heat.d.ts +0 -28
  91. package/dist/engine/heat.d.ts.map +0 -1
  92. package/dist/engine/heat.js.map +0 -1
  93. package/dist/engine/hippocampus.d.ts +0 -60
  94. package/dist/engine/hippocampus.d.ts.map +0 -1
  95. package/dist/engine/hippocampus.js.map +0 -1
  96. package/dist/engine/hookverify.d.ts +0 -42
  97. package/dist/engine/hookverify.d.ts.map +0 -1
  98. package/dist/engine/hookverify.js.map +0 -1
  99. package/dist/engine/keychain.d.ts +0 -32
  100. package/dist/engine/keychain.d.ts.map +0 -1
  101. package/dist/engine/keychain.js.map +0 -1
  102. package/dist/engine/maintenance.d.ts +0 -218
  103. package/dist/engine/maintenance.d.ts.map +0 -1
  104. package/dist/engine/maintenance.js.map +0 -1
  105. package/dist/engine/modinstall.d.ts +0 -215
  106. package/dist/engine/modinstall.d.ts.map +0 -1
  107. package/dist/engine/modinstall.js.map +0 -1
  108. package/dist/engine/postmortem.d.ts +0 -81
  109. package/dist/engine/postmortem.d.ts.map +0 -1
  110. package/dist/engine/postmortem.js.map +0 -1
  111. package/dist/engine/prefrontal.d.ts +0 -61
  112. package/dist/engine/prefrontal.d.ts.map +0 -1
  113. package/dist/engine/prefrontal.js.map +0 -1
  114. package/dist/engine/secrets.d.ts +0 -30
  115. package/dist/engine/secrets.d.ts.map +0 -1
  116. package/dist/engine/secrets.js.map +0 -1
  117. package/dist/engine/shelf.d.ts +0 -156
  118. package/dist/engine/shelf.d.ts.map +0 -1
  119. package/dist/engine/shelf.js.map +0 -1
  120. package/dist/engine/source.d.ts +0 -6
  121. package/dist/engine/source.d.ts.map +0 -1
  122. package/dist/engine/source.js.map +0 -1
  123. package/dist/engine/synapses.d.ts +0 -82
  124. package/dist/engine/synapses.d.ts.map +0 -1
  125. package/dist/engine/synapses.js.map +0 -1
  126. package/dist/engine/triggers.d.ts +0 -53
  127. package/dist/engine/triggers.d.ts.map +0 -1
  128. package/dist/engine/triggers.js.map +0 -1
  129. package/dist/engine/usage.d.ts +0 -61
  130. package/dist/engine/usage.d.ts.map +0 -1
  131. package/dist/engine/usage.js.map +0 -1
  132. package/dist/index.d.ts +0 -2
  133. package/dist/index.d.ts.map +0 -1
  134. package/dist/index.js.map +0 -1
  135. package/dist/miner/extractor.d.ts +0 -12
  136. package/dist/miner/extractor.d.ts.map +0 -1
  137. package/dist/miner/extractor.js.map +0 -1
  138. package/dist/miner/index.d.ts +0 -61
  139. package/dist/miner/index.d.ts.map +0 -1
  140. package/dist/miner/index.js.map +0 -1
  141. package/dist/miner/scheduler.d.ts +0 -30
  142. package/dist/miner/scheduler.d.ts.map +0 -1
  143. package/dist/miner/scheduler.js.map +0 -1
  144. package/dist/miner/types.d.ts +0 -11
  145. package/dist/miner/types.d.ts.map +0 -1
  146. package/dist/miner/types.js.map +0 -1
  147. package/dist/search/index.d.ts +0 -323
  148. package/dist/search/index.d.ts.map +0 -1
  149. package/dist/search/index.js.map +0 -1
  150. package/dist/search/semantic.d.ts +0 -80
  151. package/dist/search/semantic.d.ts.map +0 -1
  152. package/dist/search/semantic.js.map +0 -1
  153. package/dist/search/synonyms.d.ts +0 -2
  154. package/dist/search/synonyms.d.ts.map +0 -1
  155. package/dist/search/synonyms.js.map +0 -1
  156. package/dist/search/tokenize.d.ts +0 -39
  157. package/dist/search/tokenize.d.ts.map +0 -1
  158. package/dist/search/tokenize.js.map +0 -1
  159. package/dist/server.d.ts +0 -41
  160. package/dist/server.d.ts.map +0 -1
  161. package/dist/server.js.map +0 -1
  162. package/dist/sync/git.d.ts +0 -36
  163. package/dist/sync/git.d.ts.map +0 -1
  164. package/dist/sync/git.js.map +0 -1
  165. package/dist/sync/materialize.d.ts +0 -35
  166. package/dist/sync/materialize.d.ts.map +0 -1
  167. package/dist/sync/materialize.js.map +0 -1
  168. package/dist/sync/ops.d.ts +0 -142
  169. package/dist/sync/ops.d.ts.map +0 -1
  170. package/dist/sync/ops.js.map +0 -1
  171. package/dist/sync/space.d.ts +0 -116
  172. package/dist/sync/space.d.ts.map +0 -1
  173. package/dist/sync/space.js.map +0 -1
  174. package/dist/types/index.d.ts +0 -346
  175. package/dist/types/index.d.ts.map +0 -1
  176. package/dist/types/index.js.map +0 -1
  177. package/dist/utils/budget.d.ts +0 -44
  178. package/dist/utils/budget.d.ts.map +0 -1
  179. package/dist/utils/budget.js.map +0 -1
  180. package/dist/utils/fs.d.ts +0 -59
  181. package/dist/utils/fs.d.ts.map +0 -1
  182. package/dist/utils/fs.js.map +0 -1
  183. package/dist/utils/hash.d.ts +0 -20
  184. package/dist/utils/hash.d.ts.map +0 -1
  185. package/dist/utils/hash.js.map +0 -1
  186. package/dist/utils/ids.d.ts +0 -47
  187. package/dist/utils/ids.d.ts.map +0 -1
  188. package/dist/utils/ids.js.map +0 -1
  189. package/dist/utils/lock.d.ts +0 -11
  190. package/dist/utils/lock.d.ts.map +0 -1
  191. package/dist/utils/lock.js.map +0 -1
  192. package/dist/utils/transcripts.d.ts +0 -63
  193. package/dist/utils/transcripts.d.ts.map +0 -1
  194. package/dist/utils/transcripts.js.map +0 -1
  195. package/dist/version.d.ts +0 -26
  196. package/dist/version.d.ts.map +0 -1
  197. package/dist/version.js.map +0 -1
@@ -1,670 +0,0 @@
1
- import { AsyncLocalStorage } from 'node:async_hooks';
2
- import { type ShelfReason } from './shelf.js';
3
- import type { Brain } from './brain.js';
4
- import type { Neuron, NeuronType, FactStatus, ShelfLife } from '../types/index.js';
5
- /**
6
- * `witnessed`: "<neuron>|<fact id>" of every fact this session stored or
7
- * confirmed. A session is one witness: storing the same line again in the
8
- * same session (a retry, the post-compaction re-save) does not count twice.
9
- * Not cleared by consolidate, which ends a chapter, not the conversation.
10
- */
11
- export interface SessionTally {
12
- facts: number;
13
- decisions: number;
14
- topics: Set<string>;
15
- witnessed?: Set<string>;
16
- verifiedEmitted?: Set<string>;
17
- }
18
- export declare const newTally: () => SessionTally;
19
- /**
20
- * The connection a request belongs to, carried through every await. Empty
21
- * outside the daemon. `resumed`: this backend took over a conversation that
22
- * was already running (its daemon died), so the tally starts at zero although
23
- * the conversation did not — consolidate must not present that zero as the truth.
24
- */
25
- export declare const sessionScope: AsyncLocalStorage<{
26
- tally: SessionTally;
27
- resumed?: boolean;
28
- }>;
29
- /**
30
- * Near-duplicates of `content` among `candidates`, best first: Dice ≥ 0.8 on
31
- * lower-cased text, both sides at least NEAR_DUP_MIN_LENGTH characters. The
32
- * one rule behind learn's near_duplicates warning (inside one neuron) and
33
- * consolidate's promotion_candidates (across project neurons), so the two
34
- * cannot disagree on what "almost the same line" means.
35
- */
36
- export declare function nearDuplicatesAmong(content: string, candidates: Array<{
37
- id: string;
38
- text: string;
39
- }>): Array<{
40
- id: string;
41
- similarity: number;
42
- text: string;
43
- }>;
44
- /** Lesson kinds that can be promoted: what was learned, not what was decided or preferred. */
45
- export type LessonKind = 'fact' | 'pattern' | 'error';
46
- export interface PromotionCandidate {
47
- kind: LessonKind;
48
- /** The telling to promote: the most confirmed copy, then the longest. */
49
- text: string;
50
- /** Project neurons that hold it, the one written this session first. */
51
- neurons: string[];
52
- /** The entry id of the copy in each of `neurons`, same order. */
53
- entry_ids: string[];
54
- /** Lowest similarity in the group: 1 when every copy is the same text. */
55
- similarity: number;
56
- /** Sum of the copies' confirmations (each copy counts at least 1). */
57
- confirmations: number;
58
- }
59
- /** Most promotion candidates consolidate reports. More is a backlog, not a nudge. */
60
- export declare const MAX_PROMOTION_CANDIDATES = 5;
61
- /**
62
- * The same lesson living in two or more project neurons: the mark of
63
- * something that is not about one project at all and belongs in a tech_ or
64
- * process_ neuron where every project finds it.
65
- *
66
- * Generalises findNearDuplicates (one neuron) to many without making it
67
- * quadratic: only the lessons of `seedIds` — the project neurons this session
68
- * touched — are compared, and each only against the lessons that hold the
69
- * same numbers and most of its distinctive words (inverted indexes built
70
- * once). The bigram test then decides, as in learn. Exact copies (same
71
- * normalised text) count at any length.
72
- *
73
- * Only the user's own lessons take part. A line that arrived from a shared
74
- * space, the miner or anything that is not this machine's session is left
75
- * out: promoting it would rewrite a third party's text as the user's own
76
- * lesson, valid for every project, and drop the origin recall shows for it.
77
- *
78
- * Read-only and pure: it suggests, it never moves anything.
79
- */
80
- export declare function findPromotionCandidates(neurons: Neuron[], seedIds: Iterable<string>, max?: number): PromotionCandidate[];
81
- export type Indexer = (neuron: Neuron) => Promise<void> | void;
82
- /**
83
- * Called after a write so shared neurons can append a note to the team log.
84
- * A hook rather than a direct call, because the sync layer needs the Cortex
85
- * and the Cortex would then need the sync layer.
86
- */
87
- export type Emitter = (neuronId: string, change: {
88
- kind: 'fact';
89
- text: string;
90
- fid: string;
91
- conf: number;
92
- at: string;
93
- src?: string;
94
- keys?: string[];
95
- shelf?: ShelfLife;
96
- } | {
97
- kind: 'status';
98
- fid: string;
99
- to: 'superseded' | 'retracted';
100
- at: string;
101
- why?: string;
102
- } | {
103
- kind: 'decision';
104
- text: string;
105
- why?: string;
106
- at: string;
107
- } | {
108
- kind: 'pattern';
109
- text: string;
110
- at: string;
111
- } | {
112
- kind: 'error';
113
- text: string;
114
- at: string;
115
- } | {
116
- kind: 'debt';
117
- text: string;
118
- at: string;
119
- } | {
120
- kind: 'map';
121
- text: string;
122
- at: string;
123
- } | {
124
- kind: 'error_purge';
125
- key: string;
126
- at: string;
127
- } | {
128
- kind: 'debt_purge';
129
- key: string;
130
- at: string;
131
- } | {
132
- kind: 'decision_purge';
133
- key: string;
134
- at: string;
135
- } | {
136
- kind: 'pattern_purge';
137
- key: string;
138
- at: string;
139
- }
140
- /** A line was checked against its source and still holds (shelf life). `at` is the check. */
141
- | {
142
- kind: 'verify';
143
- eid: string;
144
- ekind: 'fact' | 'entry';
145
- at: string;
146
- }) => Promise<void> | void;
147
- /**
148
- * Called after a neuron file is deleted, so the search index drops its
149
- * chunks. The mirror of Indexer: without it a forgotten neuron kept
150
- * answering recall until the next full rebuild.
151
- */
152
- export type Remover = (neuronId: string) => Promise<void> | void;
153
- /**
154
- * Everything of `source` folded into `target`, as a new object.
155
- *
156
- * Shared by restoreNeuron (a quarantine copy back over a neuron that was
157
- * re-created since) and mergeNeurons (two neurons that turned out to be one
158
- * topic). Pure on purpose: neither input is touched, so the caller can diff
159
- * the result against what it had and emit only what actually moved.
160
- *
161
- * Facts line up by id (the content hash), falling back to normalised text;
162
- * on a collision the target's telling stays but takes the furthest-along
163
- * status (active < superseded < retracted) and the earliest `added`, and the
164
- * keys are unioned. Everything else is a set union keyed by normalised text
165
- * with the target's order first. Local observations (heat, access_count)
166
- * combine as max and sum; identity (id, name, domain, type) is the target's.
167
- */
168
- export declare function unionNeuron(target: Neuron, source: Neuron): {
169
- neuron: Neuron;
170
- moved: {
171
- facts: number;
172
- decisions: number;
173
- patterns: number;
174
- preferences: number;
175
- errors: number;
176
- debts: number;
177
- tags: number;
178
- map: 0 | 1;
179
- };
180
- };
181
- /**
182
- * Aliases a future question may use, as stored: trimmed, lower-cased, at
183
- * most 40 characters each, unique, at most eight. Order is kept.
184
- */
185
- export declare function normalizeKeys(keys?: string[]): string[];
186
- export declare class Cortex {
187
- private brain;
188
- /**
189
- * Optional hook invoked after every write. Wiring it here — rather than
190
- * calling the search engine from each caller — is what guarantees the miner
191
- * path gets indexed too. Before this, the miner wrote straight to disk and
192
- * 91% of the brain never reached the index.
193
- */
194
- private indexer;
195
- private emitter;
196
- private remover;
197
- /**
198
- * What this session has actually written, for an honest consolidate().
199
- * One per Cortex when a process serves one conversation; in the daemon one
200
- * Cortex serves every client, so the tally in force is the one the
201
- * connection carries (sessionScope) — otherwise whoever consolidated first
202
- * would log, and link with synapses, what the other conversations wrote.
203
- */
204
- private ownTally;
205
- private get tally();
206
- constructor(brain: Brain);
207
- /** Facts, decisions and neurons touched since the last consolidation. */
208
- sessionTally(): {
209
- facts: number;
210
- decisions: number;
211
- topics: string[];
212
- };
213
- resetSessionTally(): void;
214
- setIndexer(indexer: Indexer | null): void;
215
- setEmitter(emitter: Emitter | null): void;
216
- setRemover(remover: Remover | null): void;
217
- private unindex;
218
- /**
219
- * Copy a whole neuron to .quarantine/ with a timestamp, before anything
220
- * destructive. Same stamp format everywhere, so restoreNeuron can pick the
221
- * newest copy by name alone.
222
- */
223
- private quarantine;
224
- /** Remove the neuron file, drop its chunks, and keep the manifest honest. */
225
- private deleteNeuronFile;
226
- private emit;
227
- /**
228
- * Overwrite a neuron with the result of merging the team's notes.
229
- * Only the sync layer calls this, and only with a neuron that already
230
- * contains everything local plus whatever arrived.
231
- */
232
- replaceFromSync(neuron: Neuron): Promise<Neuron>;
233
- private reindex;
234
- /**
235
- * Get a neuron by ID.
236
- */
237
- get(id: string): Promise<Neuron | null>;
238
- /**
239
- * Get a neuron by ID without updating access stats.
240
- */
241
- peek(id: string): Promise<Neuron | null>;
242
- /**
243
- * Find a neuron by name.
244
- *
245
- * Returns null rather than guessing. That is the point: the previous
246
- * implementation fell back to substring containment in either direction, so
247
- * a two-word topic landed inside any long id that happened to contain it —
248
- * a short name like "SEO" was swallowed by a sixty-character neuron whose
249
- * title merely mentioned it.
250
- * Knowledge written into the wrong neuron is recalled attributed to the
251
- * wrong neuron, and no amount of index tuning repairs that. A wrong guess
252
- * is worse than a new neuron.
253
- */
254
- findByName(name: string): Promise<Neuron | null>;
255
- /**
256
- * Create a new neuron.
257
- * Refuses to clobber: two different names can slugify to the same id, and
258
- * the old code wrote straight over the existing file, losing every fact in it.
259
- */
260
- create(name: string, type: NeuronType, domain: string, summary?: string): Promise<Neuron>;
261
- /**
262
- * Learn — add a fact, decision, pattern or preference to a neuron.
263
- * Creates the neuron if it does not exist.
264
- */
265
- learn(topic: string, type: 'fact' | 'decision' | 'pattern' | 'preference' | 'error' | 'debt', content: string, options?: {
266
- confidence?: number;
267
- domain?: string;
268
- rationale?: string;
269
- neuronType?: NeuronType;
270
- /** Facts only: words a future question may use that the text does not contain. Indexed, never displayed. */
271
- keys?: string[];
272
- /**
273
- * On an exact-duplicate fact, replace its stored keys with `keys`
274
- * instead of merging them. Local only: materialize unions keys across
275
- * teammates, so a removed alias does not propagate to their brains.
276
- */
277
- keysReplace?: boolean;
278
- /** Write to this exact neuron and skip name resolution entirely. */
279
- neuronId?: string;
280
- /** Who is writing: 'session' (default), 'miner', 'manual'. */
281
- source?: string;
282
- /** Ids or verbatim texts of facts this one replaces. */
283
- supersedes?: string[];
284
- /**
285
- * Facts only: how fast this value goes stale, when the caller says so.
286
- * Stored only when given; absent, the class is inferred from the text at
287
- * read time. On an exact duplicate a different value replaces the stored one.
288
- */
289
- shelfLife?: ShelfLife;
290
- /**
291
- * Create the neuron when the topic is unknown. Default true.
292
- * The miner passes false: an automated pass guessing at topic names is
293
- * how a brain ends up with a thousand neurons called things like
294
- * `lang_pool_8_ball`, each of them shorter -- and therefore
295
- * easier to retrieve -- than the knowledge that matters.
296
- */
297
- createIfMissing?: boolean;
298
- }): Promise<{
299
- neuron: Neuron | null;
300
- /**
301
- * `skipped` — no neuron and createIfMissing was false.
302
- * `skipped_retired` — the text matches a fact or entry that was retired
303
- * (superseded or retracted); nothing was written. Re-learning a retired
304
- * line silently would undo a deliberate revision; the caller decides,
305
- * with `skipped_retired` in hand, whether to reactivate it instead.
306
- */
307
- action: 'created' | 'updated' | 'skipped' | 'skipped_retired';
308
- superseded: number;
309
- /** Supersedes targets that matched no active fact — a silent miss no more. */
310
- supersedes_unmatched: string[];
311
- /**
312
- * Active facts this one closely resembles (Dice ≥ 0.8). The fact is
313
- * stored anyway — the brain never refuses knowledge — but the caller is
314
- * told, so it can retire the older telling with supersedes/revise
315
- * instead of leaving two versions competing on recall.
316
- */
317
- near_duplicates: Array<{
318
- id: string;
319
- similarity: number;
320
- preview: string;
321
- }>;
322
- redacted: string[];
323
- /** The exact text (case-insensitive) was already an active fact of the neuron. */
324
- duplicate: boolean;
325
- /** An exact-duplicate fact had its confidence or keys changed by this call. */
326
- updated_in_place: boolean;
327
- /** Set when the text matches a retired fact/entry; nothing was written. */
328
- skipped_retired: {
329
- id: string;
330
- status: 'superseded' | 'retracted';
331
- revised?: string;
332
- note?: string;
333
- } | null;
334
- /** Exact-duplicate fact only: how many times the line has now been learned (2.7). */
335
- confirmations?: number;
336
- /** Facts only: the shelf-life class that applies, and whether it was inferred from the text (and by which rule). */
337
- shelf?: {
338
- shelf_life: ShelfLife;
339
- inferred: boolean;
340
- reason?: ShelfReason;
341
- };
342
- /** Exact-duplicate fact learned again by a session: its `verified` was stamped now. */
343
- reconfirmed?: boolean;
344
- /** An explicit shelf_life was replaced by a less volatile one (team merge restores the more volatile value). */
345
- shelf_lengthened?: boolean;
346
- }>;
347
- /**
348
- * Mark facts as no longer current.
349
- *
350
- * `superseded` — a newer fact replaces it.
351
- * `retracted` — it was never true.
352
- *
353
- * Facts are matched by id, and failing that by verbatim text, because the
354
- * caller usually has the text in front of it and not the hash.
355
- */
356
- revise(neuronRef: string, targets: string[], options?: {
357
- status?: FactStatus;
358
- note?: string;
359
- replacedBy?: string;
360
- }): Promise<{
361
- neuron: Neuron | null;
362
- revised: number;
363
- unmatched: string[];
364
- }>;
365
- /**
366
- * Reconfirm: the caller checked these lines against their source and they
367
- * still hold, so their shelf-life clock restarts now.
368
- *
369
- * `facts` match ACTIVE facts by id or exact text (trimmed, case-insensitive);
370
- * `entries` match live decisions and patterns by entry id or exact text —
371
- * the two kinds whose class is durable. A retired fact or entry is not
372
- * verifiable: it comes back in `retired` with its status (reactivate it with
373
- * status active first, if it holds again), and in `unmatched` like any miss.
374
- * Preferences, errors and debts never go stale, so there is nothing to
375
- * reconfirm on them; they are unmatched.
376
- *
377
- * Each stamp is emitted as a verify op, so on a shared neuron a teammate's
378
- * clock restarts too: the fact is shared, and so is the world it describes.
379
- */
380
- verify(neuronRef: string, targets: {
381
- facts?: string[];
382
- entries?: string[];
383
- }): Promise<{
384
- neuron: Neuron | null;
385
- verified: string[];
386
- unmatched: string[];
387
- retired: Array<{
388
- target: string;
389
- id: string;
390
- status: 'superseded' | 'retracted';
391
- }>;
392
- }>;
393
- /**
394
- * Which active facts does this text closely resemble?
395
- *
396
- * Warn-only by design. Measured on the reference brain: the heaviest
397
- * neuron held 293 facts with 1,407 near-duplicate pairs — session
398
- * summaries retelling the same thing with variations, each version as
399
- * loud as the others on recall. The fix is the writer retiring the old
400
- * telling, never the engine merging on its own.
401
- */
402
- private findNearDuplicates;
403
- /**
404
- * Flip matching facts to a non-active status.
405
- *
406
- * Also reports which targets matched nothing. Callers pass free text, and
407
- * a miss used to be indistinguishable from a hit: `supersedes` returned 0
408
- * without a word, the writer walked away believing the old version was
409
- * retired, and both versions kept surfacing on recall as equals.
410
- */
411
- private retire;
412
- /**
413
- * Bring retired facts back. The inverse of retire: only superseded or
414
- * retracted facts match, by id or by trimmed lower-cased text. Clears
415
- * superseded_by (the replacement no longer replaces it) and stamps the
416
- * revision date; the note, if given, records why it came back.
417
- */
418
- private reactivate;
419
- /**
420
- * Retire — or reactivate — decisions, patterns, errors and debts by exact
421
- * text (trimmed, case-insensitive). These are plain strings, so their
422
- * status lives in the entry_status sidecar keyed by entryId(text), the
423
- * same way their dates do. A retired entry stays in the file and leaves
424
- * recall exactly like a superseded fact; status 'active' deletes the key.
425
- *
426
- * Never emitted: the sidecar travels only through the local file and
427
- * survives a sync because applyOps copies and prunes it.
428
- */
429
- retireEntries(neuronRef: string, targets: string[], options?: {
430
- status?: FactStatus;
431
- note?: string;
432
- }): Promise<{
433
- neuron: Neuron | null;
434
- revised: number;
435
- unmatched: string[];
436
- }>;
437
- /**
438
- * Edit a neuron's metadata: summary, domain, tags, name.
439
- *
440
- * Only fields that actually differ are written and reported; a call that
441
- * changes nothing writes nothing. `tags` replaces the whole list — protocol
442
- * neurons keep their 'priority:'/'source:' tags only if the caller re-sends
443
- * them. `name` changes the display name only: the id, and with it the file,
444
- * the synapses, the shared map and the connections, never move. `domain`
445
- * replaces unconditionally, unlike learn, which only fills in 'general'.
446
- *
447
- * Not emitted: NeuronOp is only an announcement, and metadata is local.
448
- */
449
- setMeta(neuronRef: string, meta: {
450
- summary?: string;
451
- domain?: string;
452
- tags?: string[];
453
- name?: string;
454
- }): Promise<{
455
- neuron: Neuron | null;
456
- changed: Array<'summary' | 'domain' | 'tags' | 'name'>;
457
- redacted: string[];
458
- }>;
459
- /**
460
- * Replace the neuron's system map.
461
- *
462
- * Whole-document semantics on purpose: a map that can only be appended to
463
- * rots the same way facts did — old directions never die. The writer reads
464
- * the current map, rewrites it, and stores the new truth. Credentials are
465
- * redacted exactly as in learn.
466
- */
467
- setMap(neuronRef: string, content: string, options?: {
468
- domain?: string;
469
- neuronType?: NeuronType;
470
- }): Promise<{
471
- neuron: Neuron | null;
472
- action: 'created' | 'updated';
473
- redacted: string[];
474
- }>;
475
- /**
476
- * List all neurons with optional filters, and how many matched before paging.
477
- *
478
- * `list` returns only the page, which made every caller report the page size
479
- * as the total — so a client paging through 1,145 neurons was told there were
480
- * 50, and stopped. The count here is taken after the filters and before the
481
- * slice, which is the only number a pager can trust.
482
- */
483
- listWithTotal(options?: {
484
- domain?: string;
485
- type?: NeuronType;
486
- min_heat?: number;
487
- limit?: number;
488
- offset?: number;
489
- }): Promise<{
490
- total: number;
491
- rows: Awaited<ReturnType<Cortex['list']>>;
492
- }>;
493
- /**
494
- * List all neurons with optional filters.
495
- */
496
- list(options?: {
497
- domain?: string;
498
- type?: NeuronType;
499
- min_heat?: number;
500
- limit?: number;
501
- /** Rows to skip after the heat sort, for paging. Default 0. */
502
- offset?: number;
503
- }): Promise<Array<{
504
- id: string;
505
- name: string;
506
- domain: string;
507
- type: NeuronType;
508
- heat: number;
509
- last_accessed: string;
510
- facts_count: number;
511
- }>>;
512
- /**
513
- * Update a neuron's summary.
514
- */
515
- updateSummary(id: string, summary: string): Promise<Neuron | null>;
516
- /**
517
- * Add tags to a neuron.
518
- */
519
- addTags(id: string, tags: string[]): Promise<Neuron | null>;
520
- /**
521
- * Remove facts for good.
522
- *
523
- * The only destructive operation in CRBRO, so it never edits in place: the
524
- * whole neuron is copied to .quarantine/ first, with a timestamp, and can be
525
- * put back by hand. Superseding hides a fact; this is for the ones that must
526
- * not exist at all — a credential, someone's personal data.
527
- */
528
- forget(neuronRef: string, targets: string[]): Promise<{
529
- neuron_id: string | null;
530
- removed: number;
531
- backup: string | null;
532
- }>;
533
- /**
534
- * Delete a whole neuron. Quarantine copy first, then the file goes, the
535
- * index drops its chunks and the manifest is decremented.
536
- *
537
- * Synapses are not touched here (the Cortex has no Synapses): the server
538
- * calls synapses.removeAllFor(id) right after. Nor is shared state checked
539
- * — the server refuses beforehand when the neuron is shared, because the
540
- * next sync would simply re-create it from the team log. Nothing is
541
- * emitted: there is no neuron-delete op.
542
- */
543
- forgetNeuron(neuronRef: string): Promise<{
544
- neuron_id: string | null;
545
- backup: string | null;
546
- counts: {
547
- facts: number;
548
- decisions: number;
549
- patterns: number;
550
- preferences: number;
551
- errors: number;
552
- debts: number;
553
- connections: number;
554
- };
555
- }>;
556
- /**
557
- * Quarantine copies of one neuron, newest first. Stamps sort lexically, so
558
- * the file name alone orders them.
559
- */
560
- private quarantineCopies;
561
- /**
562
- * Bring a neuron back from quarantine.
563
- *
564
- * The newest copy is used unless `file` names an exact basename. If the
565
- * neuron no longer exists the copy is written back as it was; if it does
566
- * (a forget of facts, or the topic was re-created since) the copy is
567
- * unioned into it. The quarantine file stays where it is, so a restore is
568
- * repeatable. Nothing is emitted.
569
- */
570
- restoreNeuron(neuronId: string, options?: {
571
- file?: string;
572
- }): Promise<{
573
- neuron: Neuron | null;
574
- restored_from: string | null;
575
- merged_into_existing: boolean;
576
- moved: ReturnType<typeof unionNeuron>['moved'] | null;
577
- }>;
578
- /**
579
- * Fold one neuron into another and delete the first.
580
- *
581
- * `from` is quarantined, unioned into `into`, and then removed exactly like
582
- * forgetNeuron. Each element that actually moved is emitted for `into`, so
583
- * a shared target receives the knowledge (the emitter no-ops when `into`
584
- * is unshared). Synapses are not touched — the server calls
585
- * synapses.rewire(from, into) right after — and the server refuses
586
- * beforehand when `from` is shared (unshare first, or the next sync
587
- * re-creates it).
588
- */
589
- mergeNeurons(fromRef: string, intoRef: string): Promise<{
590
- from: string | null;
591
- into: string | null;
592
- backup: string | null;
593
- moved: ReturnType<typeof unionNeuron>['moved'] | null;
594
- }>;
595
- /**
596
- * Emit what a union added, by diffing the result against what the target
597
- * had. The union is pure, so this is exact: nothing the target already held
598
- * is re-announced. The emitter no-ops when the target is not shared.
599
- */
600
- private emitAdded;
601
- /**
602
- * Move entries from one neuron to another, whole: text, date, keys,
603
- * confidence, retirement. The way to split a neuron that grew past what one
604
- * read can carry — learn + forget would do it too, but every entry would be
605
- * reborn today and lose the one thing recall uses to tell old from new.
606
- *
607
- * `targets` are entry ids (factId for facts, entryId for the rest) or exact
608
- * texts, any kind. The target neuron is created when missing, with the
609
- * source's type and domain. Order is union first, removal second: a crash
610
- * in between leaves an entry in both places, never in neither. The source
611
- * is quarantined by forget() before anything leaves it. The map never
612
- * moves: it describes the system, not an entry.
613
- */
614
- moveEntries(fromRef: string, targets: string[], intoRef: string, options?: {
615
- domain?: string;
616
- }): Promise<{
617
- from: string | null;
618
- into: string | null;
619
- created: boolean;
620
- moved: number;
621
- unmatched: string[];
622
- backup: string | null;
623
- }>;
624
- /**
625
- * Fold many small neurons into one digest neuron, in a single pass.
626
- *
627
- * mergeNeurons would do it one at a time, reindexing a growing target on
628
- * every call — quadratic, and minutes on the 766 leftovers this was written
629
- * for. Here every source is quarantined, the union is built in memory,
630
- * written once and indexed once; only then do the sources go. A source's
631
- * NAME is the only context a one-line neuron had ("Phase 1 homepage audit
632
- * francortes…"), so its words travel as the fact's keys: searchable, never
633
- * shown. The caller picks the sources; nothing here judges them. Unshared
634
- * and unconnected sources only — there is no rewiring in this path.
635
- */
636
- compact(sourceIds: string[], digestName: string, options: {
637
- type: NeuronType;
638
- domain: string;
639
- }): Promise<{
640
- into: string | null;
641
- folded: string[];
642
- skipped: string[];
643
- entries: number;
644
- }>;
645
- /**
646
- * Which neurons hold something that looks like a credential.
647
- * Reports the kind and where it is, never the value.
648
- */
649
- auditSecrets(): Promise<Array<{
650
- neuron_id: string;
651
- name: string;
652
- kinds: string[];
653
- facts: number;
654
- decisions: number;
655
- patterns: number;
656
- preferences: number;
657
- errors: number;
658
- debts: number;
659
- map: number;
660
- }>>;
661
- /**
662
- * Get all neuron IDs.
663
- */
664
- allIds(): Promise<string[]>;
665
- /**
666
- * Count total neurons.
667
- */
668
- count(): Promise<number>;
669
- }
670
- //# sourceMappingURL=cortex.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"cortex.d.ts","sourceRoot":"","sources":["../../src/engine/cortex.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAMrD,OAAO,EAAoD,KAAK,WAAW,EAAE,MAAM,YAAY,CAAC;AAChG,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACxC,OAAO,KAAK,EAAE,MAAM,EAAE,UAAU,EAAkB,UAAU,EAAgC,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAgBjI;;;;;GAKG;AACH,MAAM,WAAW,YAAY;IAAG,KAAK,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAAC,SAAS,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAAC,eAAe,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;CAAE;AAC/I,eAAO,MAAM,QAAQ,QAAO,YAAqG,CAAC;AAClI;;;;;GAKG;AACH,eAAO,MAAM,YAAY;WAAkC,YAAY;cAAY,OAAO;EAAK,CAAC;AA6ChG;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,MAAM,EACf,UAAU,EAAE,KAAK,CAAC;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC,GAC9C,KAAK,CAAC;IAAE,EAAE,EAAE,MAAM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