crbro-memory 1.3.0 β†’ 1.5.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 (48) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +170 -121
  3. package/bin/{crbro.js β†’ crbro.mjs} +119 -47
  4. package/dist/engine/brain.d.ts +3 -0
  5. package/dist/engine/brain.d.ts.map +1 -1
  6. package/dist/engine/brain.js +15 -2
  7. package/dist/engine/brain.js.map +1 -1
  8. package/dist/engine/cortex.d.ts +61 -7
  9. package/dist/engine/cortex.d.ts.map +1 -1
  10. package/dist/engine/cortex.js +168 -23
  11. package/dist/engine/cortex.js.map +1 -1
  12. package/dist/engine/maintenance.d.ts +6 -1
  13. package/dist/engine/maintenance.d.ts.map +1 -1
  14. package/dist/engine/maintenance.js +19 -5
  15. package/dist/engine/maintenance.js.map +1 -1
  16. package/dist/engine/prefrontal.d.ts +13 -2
  17. package/dist/engine/prefrontal.d.ts.map +1 -1
  18. package/dist/engine/prefrontal.js +47 -11
  19. package/dist/engine/prefrontal.js.map +1 -1
  20. package/dist/miner/index.d.ts.map +1 -1
  21. package/dist/miner/index.js +35 -30
  22. package/dist/miner/index.js.map +1 -1
  23. package/dist/search/index.d.ts +46 -6
  24. package/dist/search/index.d.ts.map +1 -1
  25. package/dist/search/index.js +335 -74
  26. package/dist/search/index.js.map +1 -1
  27. package/dist/search/tokenize.d.ts +23 -0
  28. package/dist/search/tokenize.d.ts.map +1 -0
  29. package/dist/search/tokenize.js +83 -0
  30. package/dist/search/tokenize.js.map +1 -0
  31. package/dist/server.d.ts.map +1 -1
  32. package/dist/server.js +132 -64
  33. package/dist/server.js.map +1 -1
  34. package/dist/types/index.d.ts +39 -8
  35. package/dist/types/index.d.ts.map +1 -1
  36. package/dist/utils/fs.d.ts +3 -1
  37. package/dist/utils/fs.d.ts.map +1 -1
  38. package/dist/utils/fs.js +6 -2
  39. package/dist/utils/fs.js.map +1 -1
  40. package/dist/utils/hash.d.ts +20 -0
  41. package/dist/utils/hash.d.ts.map +1 -0
  42. package/dist/utils/hash.js +45 -0
  43. package/dist/utils/hash.js.map +1 -0
  44. package/package.json +53 -52
  45. package/dist/engine/license.d.ts +0 -56
  46. package/dist/engine/license.d.ts.map +0 -1
  47. package/dist/engine/license.js +0 -332
  48. package/dist/engine/license.js.map +0 -1
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Octonove Agency
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,121 +1,170 @@
1
- # 🧠 CRBRO β€” Persistent Neural Memory for AI
2
-
3
- **CRBRO** is a local MCP (Model Context Protocol) server that gives your AI assistant **persistent long-term memory** across sessions. It uses a biological neural architecture β€” cortex, synapses, hippocampus β€” to store, connect, and retrieve knowledge automatically.
4
-
5
-
6
- ## Features
7
-
8
- - **🧬 Biological Architecture** β€” Knowledge organized as neurons (cortex), connections (synapses), and session memory (hippocampus)
9
- - **πŸ” Hybrid Search** β€” Powered by [Orama](https://orama.com/) for fast BM25 + fuzzy text search
10
- - **πŸ”₯ Heat Scores** β€” Automatic relevance tracking based on frequency, recency, and connectivity
11
- - **πŸ—ΊοΈ Global Map** β€” Cluster detection and cross-domain bridge identification *(premium)*
12
- - **πŸ“¦ Zero Dependencies** β€” Pure Node.js, no Python, no Docker, no external databases
13
- - **πŸ’Ύ File-Based** β€” All data stored as readable JSON files in `~/.crbro/`
14
- - **πŸ”Œ MCP Native** β€” Works with Claude Desktop, Cursor, Windsurf, and any MCP-compatible client
15
-
16
- ## Quick Start
17
-
18
- ### 1. Initialize
19
-
20
- ```bash
21
- npx crbro-memory init
22
- ```
23
-
24
- ### 2. Add to your MCP config
25
-
26
- **Claude Desktop** (`~/AppData/Roaming/Claude/claude_desktop_config.json`):
27
- ```json
28
- {
29
- "mcpServers": {
30
- "crbro": {
31
- "command": "npx",
32
- "args": ["-y", "crbro-memory"]
33
- }
34
- }
35
- }
36
- ```
37
-
38
- **Cursor** (`.cursor/mcp.json`):
39
- ```json
40
- {
41
- "mcpServers": {
42
- "crbro": {
43
- "command": "npx",
44
- "args": ["-y", "crbro-memory"]
45
- }
46
- }
47
- }
48
- ```
49
-
50
- ### 3. Start using it
51
-
52
- Your AI will now have access to 15 memory tools. Start any session with `crbro_boot`.
53
-
54
- ## Tools
55
-
56
- ### Free (always available)
57
-
58
- | Tool | Description |
59
- |------|-------------|
60
- | `crbro_boot` | Boot the brain at session start β€” loads hot topics and context |
61
- | `crbro_status` | Brain status β€” neurons, synapses, sessions count |
62
- | `crbro_learn` | Store a fact, decision, pattern, or preference |
63
- | `crbro_neuron` | Read a specific neuron (topic) with all its knowledge |
64
- | `crbro_neurons` | List neurons with optional filters (domain, type, heat) |
65
- | `crbro_recall` | Search the brain using hybrid text search |
66
- | `crbro_connect` | Create or strengthen a connection between neurons |
67
- | `crbro_connections` | Get all connections for a neuron |
68
- | `crbro_session_log` | Log a session summary |
69
- | `crbro_sessions` | List recent sessions |
70
- | `crbro_context` | Read/update active working context |
71
- | `crbro_hot_topics` | Get the most active topics by heat score |
72
- | `crbro_consolidate` | End-of-session consolidation |
73
-
74
- ### Premium (requires Synthetica Zero Deck license)
75
-
76
- | Tool | Description |
77
- |------|-------------|
78
- | `crbro_global_map` | View the neural network β€” clusters and cross-domain bridges |
79
- | `crbro_maintenance` | Full brain maintenance β€” archive, prune, rebuild |
80
-
81
- ## Architecture
82
-
83
- ```
84
- ~/.crbro/
85
- β”œβ”€β”€ manifest.json ← Brain metadata
86
- β”œβ”€β”€ cortex/ ← One JSON per neuron (topic)
87
- β”‚ β”œβ”€β”€ project_octochat.json
88
- β”‚ └── tech_firebase.json
89
- β”œβ”€β”€ synapses/ ← One JSON per connection
90
- β”‚ └── syn_octochat__firebase.json
91
- β”œβ”€β”€ hippocampus/ ← One JSON per session
92
- β”‚ └── session_2026-05-06.json
93
- β”œβ”€β”€ prefrontal/ ← Working memory
94
- β”‚ β”œβ”€β”€ active_context.json
95
- β”‚ β”œβ”€β”€ hot_topics.json
96
- β”‚ └── global_map.json
97
- β”œβ”€β”€ archives/ ← Cold neurons
98
- └── .search/ ← Orama search index
99
- └── orama.index.json
100
- ```
101
-
102
- ## Heat Score Algorithm
103
-
104
- Each neuron has a heat score (0.0 - 1.0) calculated from:
105
-
106
- - **Frequency (35%)** β€” How often the neuron is accessed
107
- - **Recency (40%)** β€” When it was last accessed (today = 1.0, >3 months = 0.05)
108
- - **Connectivity (25%)** β€” How many synapses connect to it
109
-
110
- ## CLI Commands
111
-
112
- ```bash
113
- npx crbro-memory # Start MCP server
114
- npx crbro-memory init # Initialize brain
115
- npx crbro-memory status # Show brain status
116
- npx crbro-memory --help # Help
117
- ```
118
-
119
- ## License
120
-
121
- MIT β€” Part of Octonove Agency.
1
+ # 🧠 CRBRO β€” Persistent Neural Memory for AI
2
+
3
+ [![npm](https://img.shields.io/npm/v/crbro-memory)](https://www.npmjs.com/package/crbro-memory)
4
+ [![license](https://img.shields.io/github/license/Octonove/crbro-memory)](LICENSE)
5
+ [![MCP](https://img.shields.io/badge/MCP-Claude%20Code%20%C2%B7%20Claude%20Desktop%20%C2%B7%20Cursor-1E3A5F)](https://modelcontextprotocol.io)
6
+
7
+ **CRBRO** is a local MCP (Model Context Protocol) server that gives your AI assistant **persistent long-term memory** across sessions. It uses a biological neural architecture β€” cortex, synapses, hippocampus β€” to store, connect, and retrieve knowledge automatically.
8
+
9
+ ![CRBRO demo](docs/demo.gif)
10
+
11
+ Free and open source (MIT). All 16 tools included β€” no license, no account, no tiers.
12
+
13
+ > ⭐ **If CRBRO gives your AI a memory worth keeping, a star on GitHub is the best way to support it.**
14
+
15
+ ## Features
16
+
17
+ - **🧬 Biological Architecture** β€” Knowledge organized as neurons (cortex), connections (synapses), and session memory (hippocampus)
18
+ - **πŸ” Fact-Level Search** β€” Powered by [Orama](https://orama.com/). Every fact is indexed on its own, so a topic with hundreds of facts stays as findable as one with three, and each result comes back with the exact fact that matched and the date it was recorded
19
+ - **πŸ”₯ Heat Scores** β€” Automatic relevance tracking based on frequency, recency, and connectivity
20
+ - **✏️ Correctable** β€” Knowledge can be superseded or retracted, not just piled up. A memory that only appends keeps serving yesterday's answer with today's confidence
21
+ - **πŸ—ΊοΈ Global Map** β€” Cluster detection and cross-domain bridge identification
22
+ - **⛏️ Knowledge Miner** β€” Optionally scans your local `.md`/`.txt` notes and feeds them into the brain
23
+ - **πŸ”’ Fully Local** β€” Runs on Node.js alone: no Python, no Docker, no databases, no external services. Your memory never leaves your machine
24
+ - **πŸ’Ύ File-Based** β€” All data stored as readable JSON files in `~/.crbro/` β€” inspectable, diffable, and versionable with git
25
+ - **πŸ”Œ MCP Native** β€” Works with Claude Desktop, Claude Code, Cursor, Windsurf, and any MCP-compatible client
26
+
27
+ ## Quick Start
28
+
29
+ ### 1. Initialize
30
+
31
+ ```bash
32
+ npx crbro-memory init
33
+ ```
34
+
35
+ ### 2. Add to your MCP config
36
+
37
+ > **Register CRBRO at the user level, not per-project.** Your brain lives in
38
+ > `~/.crbro/` and is shared across every folder β€” but if you register the
39
+ > server inside a single project, other folders won't have the tools and it
40
+ > will *look* like the memory is gone. User-level registration makes it
41
+ > available everywhere, which is the whole point.
42
+
43
+ **Claude Code** (one command, available in every folder):
44
+ ```bash
45
+ claude mcp add --scope user crbro -- npx -y crbro-memory
46
+ ```
47
+
48
+ **Claude Desktop** (`~/AppData/Roaming/Claude/claude_desktop_config.json`):
49
+ ```json
50
+ {
51
+ "mcpServers": {
52
+ "crbro": {
53
+ "command": "npx",
54
+ "args": ["-y", "crbro-memory"]
55
+ }
56
+ }
57
+ }
58
+ ```
59
+
60
+ **Cursor** (`~/.cursor/mcp.json` β€” the one in your home folder, not a project's `.cursor/`):
61
+ ```json
62
+ {
63
+ "mcpServers": {
64
+ "crbro": {
65
+ "command": "npx",
66
+ "args": ["-y", "crbro-memory"]
67
+ }
68
+ }
69
+ }
70
+ ```
71
+
72
+ ### 3. Start using it
73
+
74
+ Your AI will now have access to 16 memory tools. Start any session with `crbro_boot`.
75
+
76
+ ## Tools
77
+
78
+ | Tool | Description |
79
+ |------|-------------|
80
+ | `crbro_boot` | Boot the brain at session start β€” loads hot topics and context |
81
+ | `crbro_status` | Brain status β€” neurons, synapses, sessions count |
82
+ | `crbro_learn` | Store a fact, decision, pattern, or preference |
83
+ | `crbro_neuron` | Read a specific neuron (topic) with all its knowledge |
84
+ | `crbro_neurons` | List neurons with optional filters (domain, type, heat) |
85
+ | `crbro_recall` | Search every stored fact, not just topic names β€” returns the fact that matched |
86
+ | `crbro_connect` | Create or strengthen a connection between neurons |
87
+ | `crbro_connections` | Get all connections for a neuron |
88
+ | `crbro_session_log` | Log a session summary |
89
+ | `crbro_sessions` | List recent sessions |
90
+ | `crbro_context` | Read/update active working context |
91
+ | `crbro_hot_topics` | Get the most active topics by heat score |
92
+ | `crbro_global_map` | View the neural network β€” clusters and cross-domain bridges |
93
+ | `crbro_revise` | Mark facts as superseded or retracted when they stop being true |
94
+ | `crbro_maintenance` | Brain maintenance β€” heat, pruning, integrity, index rebuild |
95
+ | `crbro_consolidate` | End-of-session consolidation |
96
+
97
+ ## Architecture
98
+
99
+ ```
100
+ ~/.crbro/
101
+ β”œβ”€β”€ manifest.json ← Brain metadata
102
+ β”œβ”€β”€ cortex/ ← One JSON per neuron (topic)
103
+ β”‚ β”œβ”€β”€ project_octochat.json
104
+ β”‚ └── tech_firebase.json
105
+ β”œβ”€β”€ synapses/ ← One JSON per connection
106
+ β”‚ └── syn_octochat__firebase.json
107
+ β”œβ”€β”€ hippocampus/ ← One JSON per session
108
+ β”‚ └── session_2026-05-06.json
109
+ β”œβ”€β”€ prefrontal/ ← Working memory
110
+ β”‚ β”œβ”€β”€ active_context.json
111
+ β”‚ β”œβ”€β”€ hot_topics.json
112
+ β”‚ └── global_map.json
113
+ β”œβ”€β”€ archives/ ← Cold neurons (opt-in; nothing is archived unless you ask)
114
+ └── .search/ ← Orama search index
115
+ └── chunks.index.json ← one document per fact
116
+ ```
117
+
118
+ ## Heat Score Algorithm
119
+
120
+ Each neuron has a heat score (0.0 - 1.0) calculated from:
121
+
122
+ - **Frequency (35%)** β€” How often the neuron is accessed
123
+ - **Recency (40%)** β€” When it was last accessed (today = 1.0, >3 months = 0.05)
124
+ - **Connectivity (25%)** β€” How many synapses connect to it
125
+
126
+ ## Knowledge Miner
127
+
128
+ The miner is an **optional, fully local** helper that scans a directory for `.md` and `.txt` files (notes, docs, journals) and extracts knowledge into the brain β€” so CRBRO can learn from what you already wrote, not just from conversations. It never touches the network and never leaves your machine.
129
+
130
+ ```bash
131
+ npx crbro-memory mine [dir] # One-shot scan of a directory
132
+ npx crbro-memory setup-miner # Install a scheduled auto-scan (OS task scheduler)
133
+ npx crbro-memory miner-status # Check the auto-miner status
134
+ npx crbro-memory remove-miner # Remove the scheduled task
135
+ ```
136
+
137
+ > Naming note: "miner" here means *knowledge* mining β€” extracting facts from your own text files. Nothing to do with cryptocurrency.
138
+
139
+ ## CLI Commands
140
+
141
+ ```bash
142
+ npx crbro-memory # Start MCP server (stdio)
143
+ npx crbro-memory init # Initialize brain + detect IDEs
144
+ npx crbro-memory status # Show brain status
145
+ npx crbro-memory reindex # Rebuild the search index
146
+ npx crbro-memory eval # Measure retrieval quality against your own query set
147
+ npx crbro-memory --help # Help
148
+ ```
149
+
150
+ ### Measuring retrieval
151
+
152
+ `eval` is there so you can tell a fix from a feeling. Write
153
+ `~/.crbro/.eval/queries.json` as a list of questions you would actually ask,
154
+ each naming the neuron that should answer it:
155
+
156
+ ```json
157
+ [
158
+ { "query": "how we deploy the api",
159
+ "expect_neuron": "project_octochat",
160
+ "expect_contains": "Cloud Run" }
161
+ ]
162
+ ```
163
+
164
+ Then `npx crbro-memory eval` reports how often the right neuron comes back
165
+ first, how often it makes the top three, and MRR β€” plus every miss, so you can
166
+ see what it got wrong instead of guessing.
167
+
168
+ ## License
169
+
170
+ MIT β€” see [LICENSE](LICENSE). Built by [Octonove](https://github.com/Octonove).
@@ -2,7 +2,7 @@
2
2
 
3
3
  // ─── CRBRO CLI ───────────────────────────────────────────────────
4
4
  // Command-line interface for CRBRO memory system
5
- // Supports: init, status, activate, mine, setup-miner, miner-status,
5
+ // Supports: init, status, mine, setup-miner, miner-status,
6
6
  // remove-miner, and MCP server mode (default)
7
7
 
8
8
  import { platform, homedir } from 'os';
@@ -132,9 +132,8 @@ if (command === 'init') {
132
132
  console.log('');
133
133
  console.log(' Next steps:');
134
134
  console.log(' 1. Add the config above to your IDE\'s MCP settings');
135
- console.log(' 2. npx crbro-memory activate YOUR-LICENSE-KEY');
136
- console.log(' 3. (Optional) npx crbro-memory setup-miner');
137
- console.log(' 4. Restart your IDE β€” CRBRO boots automatically!');
135
+ console.log(' 2. (Optional) npx crbro-memory setup-miner');
136
+ console.log(' 3. Restart your IDE β€” CRBRO boots automatically!');
138
137
  console.log('');
139
138
  }).catch(console.error);
140
139
 
@@ -154,7 +153,6 @@ if (command === 'init') {
154
153
  console.log(` Sessions: ${manifest.total_sessions}`);
155
154
  console.log(` Last Boot: ${manifest.last_boot || 'never'}`);
156
155
  console.log(` Last Consolidate: ${manifest.last_consolidation || 'never'}`);
157
- console.log(` License: ${manifest.license_key ? 'βœ… Active' : '❌ Not activated'}`);
158
156
  console.log('');
159
157
 
160
158
  // Show detected IDEs
@@ -175,45 +173,11 @@ if (command === 'init') {
175
173
  }).catch(console.error);
176
174
 
177
175
  } else if (command === 'activate') {
178
- // ─── Activate license key ──────────────────────────────────────
179
- const key = args[1];
180
- if (!key) {
181
- console.log('');
182
- console.log(' ❌ Usage: npx crbro-memory activate SYNTH-ZERO-XXXX-XXXX-XXXX');
183
- console.log('');
184
- console.log(' Get your license key at https://synthetica-decks.web.app');
185
- console.log('');
186
- process.exit(1);
187
- }
188
-
189
- import('../dist/engine/brain.js').then(async ({ Brain }) => {
190
- const brain = new Brain();
191
- try {
192
- await brain.getManifest();
193
- } catch {
194
- console.log(' 🧠 Brain not initialized. Initializing now...');
195
- await brain.initialize();
196
- }
197
-
198
- // Validate key format
199
- if (!key.startsWith('SYNTH-ZERO-') || key.length < 20) {
200
- console.log(' ❌ Invalid license key format.');
201
- console.log(' Keys start with SYNTH-ZERO- and are at least 20 characters.');
202
- process.exit(1);
203
- }
204
-
205
- // Persist key in manifest
206
- await brain.updateManifest({ license_key: key });
207
- console.log('');
208
- console.log(' βœ… License key activated!');
209
- console.log('');
210
- console.log(' πŸ”“ Premium features unlocked:');
211
- console.log(' β€’ crbro_global_map β€” Neural cluster visualization');
212
- console.log(' β€’ crbro_maintenance β€” Automated brain optimization');
213
- console.log('');
214
- console.log(' Restart your IDE to apply changes.');
215
- console.log('');
216
- }).catch(console.error);
176
+ // ─── Legacy command (pre-1.4.0) β€” CRBRO is now fully free ──────
177
+ console.log('');
178
+ console.log(' βœ… Good news: since v1.4.0 CRBRO is fully free.');
179
+ console.log(' All 15 tools are available β€” no license key needed.');
180
+ console.log('');
217
181
 
218
182
  } else if (command === 'mine') {
219
183
  // ─── One-shot mining ───────────────────────────────────────────
@@ -309,6 +273,111 @@ if (command === 'init') {
309
273
  console.log('');
310
274
  }).catch(console.error);
311
275
 
276
+ } else if (command === 'reindex') {
277
+ // ─── Rebuild the search index from the cortex ──────────────────
278
+ Promise.all([
279
+ import('../dist/engine/brain.js'),
280
+ import('../dist/search/index.js'),
281
+ ]).then(async ([{ Brain }, { SearchEngine }]) => {
282
+ const brain = new Brain();
283
+ const engine = new SearchEngine(brain);
284
+
285
+ console.log('');
286
+ console.log(' πŸ” Rebuilding the CRBRO search index...');
287
+ const started = Date.now();
288
+ const indexed = await engine.rebuild();
289
+ const seconds = ((Date.now() - started) / 1000).toFixed(1);
290
+
291
+ console.log('');
292
+ console.log(` βœ… ${indexed} chunks indexed in ${seconds}s`);
293
+ console.log(' Every fact, decision and pattern is now searchable on its own,');
294
+ console.log(' so a big neuron is no longer buried by short ones.');
295
+ console.log('');
296
+ }).catch(console.error);
297
+
298
+ } else if (command === 'eval') {
299
+ // ─── Measure retrieval quality against a query set ─────────────
300
+ //
301
+ // Without a number you cannot tell a fix from a feeling. The file is
302
+ // .crbro/.eval/queries.json β€” a list of { query, expect_neuron } and
303
+ // optionally expect_contains, the substring the matched fact should carry.
304
+ Promise.all([
305
+ import('../dist/engine/brain.js'),
306
+ import('../dist/search/index.js'),
307
+ import('fs/promises'),
308
+ ]).then(async ([{ Brain }, { SearchEngine }, fsp]) => {
309
+ const brain = new Brain();
310
+ const evalPath = join(brain.paths.root, '.eval', 'queries.json');
311
+
312
+ let queries;
313
+ try {
314
+ queries = JSON.parse(await fsp.readFile(evalPath, 'utf-8'));
315
+ } catch {
316
+ console.log('');
317
+ console.log(` No query set found at ${evalPath}`);
318
+ console.log(' Create it as a JSON array, for example:');
319
+ console.log('');
320
+ console.log(' [');
321
+ console.log(' { "query": "how we deploy the api", "expect_neuron": "project_octochat",');
322
+ console.log(' "expect_contains": "Cloud Run" }');
323
+ console.log(' ]');
324
+ console.log('');
325
+ console.log(' Build it from facts you already saved: take six or eight words');
326
+ console.log(' out of a real fact and name the neuron that holds it.');
327
+ console.log('');
328
+ return;
329
+ }
330
+
331
+ const engine = new SearchEngine(brain);
332
+ await engine.init();
333
+
334
+ let atOne = 0, atThree = 0, reciprocal = 0, contentOk = 0;
335
+ const misses = [];
336
+
337
+ for (const q of queries) {
338
+ const results = await engine.search(q.query, { limit: 10 });
339
+ const rank = results.findIndex(r => r.neuron_id === q.expect_neuron);
340
+
341
+ if (rank === 0) atOne++;
342
+ if (rank >= 0 && rank < 3) atThree++;
343
+ if (rank >= 0) reciprocal += 1 / (rank + 1);
344
+
345
+ if (rank === 0 && q.expect_contains) {
346
+ if (results[0].matching_content.includes(q.expect_contains)) contentOk++;
347
+ else misses.push(` ~ "${q.query}" β€” right neuron, wrong fact returned`);
348
+ }
349
+
350
+ if (rank !== 0) {
351
+ const got = results[0] ? results[0].neuron_id : '(nothing)';
352
+ misses.push(` βœ— "${q.query}" β€” expected ${q.expect_neuron}, got ${got}` +
353
+ (rank > 0 ? ` (it was #${rank + 1})` : ''));
354
+ }
355
+ }
356
+
357
+ const n = queries.length;
358
+ const pct = (x) => `${((x / n) * 100).toFixed(1)}%`;
359
+
360
+ console.log('');
361
+ console.log(' πŸ“Š CRBRO retrieval eval');
362
+ console.log(' ───────────────────────');
363
+ console.log(` Queries: ${n}`);
364
+ console.log(` Right first hit: ${atOne}/${n} (${pct(atOne)})`);
365
+ console.log(` In the top 3: ${atThree}/${n} (${pct(atThree)})`);
366
+ console.log(` MRR: ${(reciprocal / n).toFixed(3)}`);
367
+ if (queries.some(q => q.expect_contains)) {
368
+ const withContent = queries.filter(q => q.expect_contains).length;
369
+ console.log(` Right fact shown: ${contentOk}/${withContent}`);
370
+ }
371
+
372
+ if (misses.length > 0) {
373
+ console.log('');
374
+ console.log(' Misses:');
375
+ for (const m of misses.slice(0, 25)) console.log(m);
376
+ if (misses.length > 25) console.log(` ... and ${misses.length - 25} more`);
377
+ }
378
+ console.log('');
379
+ }).catch(console.error);
380
+
312
381
  } else if (command === '--help' || command === '-h') {
313
382
  // ─── Help ──────────────────────────────────────────────────────
314
383
  console.log('');
@@ -316,8 +385,7 @@ if (command === 'init') {
316
385
  console.log(' ═══════════════════════════════════════════');
317
386
  console.log('');
318
387
  console.log(' Setup:');
319
- console.log(' npx crbro-memory init Initialize brain + detect IDEs');
320
- console.log(' npx crbro-memory activate KEY Activate premium license');
388
+ console.log(' npx crbro-memory init Initialize brain + detect IDEs');
321
389
  console.log(' npx crbro-memory status Show brain status');
322
390
  console.log('');
323
391
  console.log(' Auto-Mining:');
@@ -326,10 +394,14 @@ if (command === 'init') {
326
394
  console.log(' npx crbro-memory miner-status Check auto-miner status');
327
395
  console.log(' npx crbro-memory remove-miner Remove auto-miner');
328
396
  console.log('');
397
+ console.log(' Search:');
398
+ console.log(' npx crbro-memory reindex Rebuild the search index');
399
+ console.log(' npx crbro-memory eval Measure retrieval against .crbro/.eval/queries.json');
400
+ console.log('');
329
401
  console.log(' Server:');
330
402
  console.log(' npx crbro-memory Start MCP server (stdio)');
331
403
  console.log('');
332
- console.log(' Part of Synthetica Decks β€” https://synthetica-decks.web.app');
404
+ console.log(' Open source (MIT) β€” https://github.com/Octonove/crbro-memory');
333
405
  console.log('');
334
406
 
335
407
  } else {
@@ -16,7 +16,10 @@ export declare class BrainPaths {
16
16
  activeContext(): string;
17
17
  hotTopics(): string;
18
18
  globalMap(): string;
19
+ /** Pre-v2 index. Kept only so the migration can delete it. */
19
20
  searchIndex(): string;
21
+ /** Chunk-level index (v2+). Separate filename so an old index is never loaded. */
22
+ chunksIndex(): string;
20
23
  }
21
24
  export declare class Brain {
22
25
  private manifest;
@@ -1 +1 @@
1
- {"version":3,"file":"brain.d.ts","sourceRoot":"","sources":["../../src/engine/brain.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAoC,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAQnH,qBAAa,UAA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,IAAI,OAAO,CAAC,iBAAiB,EAAE,CAAC;CA4CpD"}
@@ -53,9 +53,14 @@ class BrainPaths {
53
53
  globalMap() {
54
54
  return node_path_1.default.join(this.prefrontal, 'global_map.json');
55
55
  }
56
+ /** Pre-v2 index. Kept only so the migration can delete it. */
56
57
  searchIndex() {
57
58
  return node_path_1.default.join(this.search, 'orama.index.json');
58
59
  }
60
+ /** Chunk-level index (v2+). Separate filename so an old index is never loaded. */
61
+ chunksIndex() {
62
+ return node_path_1.default.join(this.search, 'chunks.index.json');
63
+ }
59
64
  }
60
65
  exports.BrainPaths = BrainPaths;
61
66
  // ─── Brain Manager ───────────────────────────────────────────────
@@ -94,7 +99,6 @@ class Brain {
94
99
  total_sessions: 0,
95
100
  last_boot: null,
96
101
  last_consolidation: null,
97
- license_key: null,
98
102
  };
99
103
  await (0, fs_js_1.writeJSON)(this.paths.manifest(), manifest);
100
104
  this.manifest = manifest;
@@ -145,6 +149,11 @@ class Brain {
145
149
  const activeContext = await (0, fs_js_1.readJSON)(this.paths.activeContext());
146
150
  // Load active protocols
147
151
  const activeProtocols = await this.loadProtocols();
152
+ // Pending items, split into what is open and what was just closed.
153
+ const openItems = (activeContext?.pending_tasks || []).map(t => typeof t === 'string'
154
+ ? { id: '', text: t, added: '' }
155
+ : t);
156
+ const recentlyClosed = activeContext?.recently_closed || [];
148
157
  // Update boot timestamp
149
158
  this.manifest.last_boot = (0, fs_js_1.now)();
150
159
  await (0, fs_js_1.writeJSON)(this.paths.manifest(), this.manifest);
@@ -157,7 +166,11 @@ class Brain {
157
166
  last_session: activeContext?.last_session || null,
158
167
  active_context: activeContext,
159
168
  active_protocols: activeProtocols,
160
- message: `CRBRO boot complete. ${this.manifest.total_neurons} neurons, ${this.manifest.total_synapses} synapses, ${this.manifest.total_sessions} sessions. ${activeProtocols.length} active protocol(s).`,
169
+ open_items: openItems,
170
+ recently_closed: recentlyClosed,
171
+ message: `CRBRO boot complete. ${this.manifest.total_neurons} neurons, ${this.manifest.total_synapses} synapses, ` +
172
+ `${this.manifest.total_sessions} sessions. ${activeProtocols.length} active protocol(s). ` +
173
+ `${openItems.length} open item(s), ${recentlyClosed.length} recently closed.`,
161
174
  };
162
175
  }
163
176
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"brain.js","sourceRoot":"","sources":["../../src/engine/brain.ts"],"names":[],"mappings":";AAAA,oEAAoE;AACpE,gEAAgE;;;;;;AAEhE,0DAA6B;AAC7B,qCAAyC;AACzC,0CAAsE;AAGtE,MAAM,SAAS,GAAG,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC,IAAI,mBAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,IAAI,GAAG,EAAE,QAAQ,CAAC,CAAC;AAC7H,MAAM,aAAa,GAAG,eAAe,CAAC;AACtC,MAAM,aAAa,GAAG,OAAO,CAAC;AAE9B,oEAAoE;AAEpE,MAAa,UAAU;IACZ,IAAI,CAAS;IACb,MAAM,CAAS;IACf,QAAQ,CAAS;IACjB,WAAW,CAAS;IACpB,UAAU,CAAS;IACnB,QAAQ,CAAS;IACjB,MAAM,CAAS;IACf,OAAO,CAAS;IAEzB,YAAY,OAAgB;QAC1B,IAAI,CAAC,IAAI,GAAG,OAAO,IAAI,SAAS,CAAC;QACjC,IAAI,CAAC,MAAM,GAAG,mBAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;QAC7C,IAAI,CAAC,QAAQ,GAAG,mBAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;QACjD,IAAI,CAAC,WAAW,GAAG,mBAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,aAAa,CAAC,CAAC;QACvD,IAAI,CAAC,UAAU,GAAG,mBAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC;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