@soulcraft/brainy 3.17.0 → 3.19.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 (50) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/README.md +58 -10
  3. package/dist/augmentations/defaultAugmentations.d.ts +0 -1
  4. package/dist/augmentations/defaultAugmentations.js +0 -5
  5. package/dist/brainy.d.ts +64 -0
  6. package/dist/brainy.js +77 -0
  7. package/dist/conversation/conversationManager.d.ts +176 -0
  8. package/dist/conversation/conversationManager.js +666 -0
  9. package/dist/conversation/index.d.ts +8 -0
  10. package/dist/conversation/index.js +8 -0
  11. package/dist/conversation/types.d.ts +231 -0
  12. package/dist/conversation/types.js +8 -0
  13. package/dist/index.d.ts +3 -0
  14. package/dist/index.js +3 -0
  15. package/dist/mcp/conversationTools.d.ts +88 -0
  16. package/dist/mcp/conversationTools.js +470 -0
  17. package/dist/neural/embeddedPatterns.d.ts +1 -1
  18. package/dist/neural/embeddedPatterns.js +1 -1
  19. package/dist/neural/naturalLanguageProcessor.js +0 -1
  20. package/dist/setup.js +0 -1
  21. package/dist/types/mcpTypes.d.ts +7 -1
  22. package/dist/unified.js +0 -1
  23. package/dist/vfs/VirtualFileSystem.d.ts +6 -4
  24. package/dist/vfs/VirtualFileSystem.js +44 -21
  25. package/dist/vfs/index.d.ts +0 -5
  26. package/dist/vfs/index.js +0 -6
  27. package/dist/vfs/semantic/ProjectionRegistry.d.ts +84 -0
  28. package/dist/vfs/semantic/ProjectionRegistry.js +118 -0
  29. package/dist/vfs/semantic/ProjectionStrategy.d.ts +69 -0
  30. package/dist/vfs/semantic/ProjectionStrategy.js +40 -0
  31. package/dist/vfs/semantic/SemanticPathParser.d.ts +73 -0
  32. package/dist/vfs/semantic/SemanticPathParser.js +285 -0
  33. package/dist/vfs/semantic/SemanticPathResolver.d.ts +99 -0
  34. package/dist/vfs/semantic/SemanticPathResolver.js +242 -0
  35. package/dist/vfs/semantic/index.d.ts +17 -0
  36. package/dist/vfs/semantic/index.js +18 -0
  37. package/dist/vfs/semantic/projections/AuthorProjection.d.ts +35 -0
  38. package/dist/vfs/semantic/projections/AuthorProjection.js +74 -0
  39. package/dist/vfs/semantic/projections/ConceptProjection.d.ts +42 -0
  40. package/dist/vfs/semantic/projections/ConceptProjection.js +87 -0
  41. package/dist/vfs/semantic/projections/RelationshipProjection.d.ts +41 -0
  42. package/dist/vfs/semantic/projections/RelationshipProjection.js +101 -0
  43. package/dist/vfs/semantic/projections/SimilarityProjection.d.ts +36 -0
  44. package/dist/vfs/semantic/projections/SimilarityProjection.js +77 -0
  45. package/dist/vfs/semantic/projections/TagProjection.d.ts +34 -0
  46. package/dist/vfs/semantic/projections/TagProjection.js +73 -0
  47. package/dist/vfs/semantic/projections/TemporalProjection.d.ts +35 -0
  48. package/dist/vfs/semantic/projections/TemporalProjection.js +89 -0
  49. package/dist/vfs/types.d.ts +1 -8
  50. package/package.json +1 -1
@@ -0,0 +1,470 @@
1
+ /**
2
+ * MCP Conversation Tools
3
+ *
4
+ * Exposes ConversationManager functionality through MCP for Claude Code integration.
5
+ * Provides 6 tools for infinite agent memory.
6
+ *
7
+ * REAL IMPLEMENTATION - Uses ConversationManager which uses real Brainy APIs
8
+ */
9
+ import { v4 as uuidv4 } from '../universal/uuid.js';
10
+ import { MCP_VERSION } from '../types/mcpTypes.js';
11
+ import { ConversationManager } from '../conversation/conversationManager.js';
12
+ /**
13
+ * MCP Conversation Toolset
14
+ *
15
+ * Provides conversation and context management tools for AI agents
16
+ */
17
+ export class MCPConversationToolset {
18
+ /**
19
+ * Create MCP Conversation Toolset
20
+ * @param brain Brainy instance
21
+ */
22
+ constructor(brain) {
23
+ this.brain = brain;
24
+ this.initialized = false;
25
+ this.conversationManager = new ConversationManager(brain);
26
+ }
27
+ /**
28
+ * Initialize the toolset
29
+ */
30
+ async init() {
31
+ if (this.initialized) {
32
+ return;
33
+ }
34
+ await this.conversationManager.init();
35
+ this.initialized = true;
36
+ }
37
+ /**
38
+ * Handle MCP tool execution request
39
+ * @param request MCP tool execution request
40
+ * @returns MCP response
41
+ */
42
+ async handleRequest(request) {
43
+ if (!this.initialized) {
44
+ await this.init();
45
+ }
46
+ try {
47
+ const { toolName, parameters } = request;
48
+ // Route to appropriate tool handler
49
+ switch (toolName) {
50
+ case 'conversation_save_message':
51
+ return await this.handleSaveMessage(request.requestId, parameters);
52
+ case 'conversation_get_context':
53
+ return await this.handleGetContext(request.requestId, parameters);
54
+ case 'conversation_search':
55
+ return await this.handleSearch(request.requestId, parameters);
56
+ case 'conversation_get_thread':
57
+ return await this.handleGetThread(request.requestId, parameters);
58
+ case 'conversation_save_artifact':
59
+ return await this.handleSaveArtifact(request.requestId, parameters);
60
+ case 'conversation_find_similar':
61
+ return await this.handleFindSimilar(request.requestId, parameters);
62
+ default:
63
+ return this.createErrorResponse(request.requestId, 'UNKNOWN_TOOL', `Unknown conversation tool: ${toolName}`);
64
+ }
65
+ }
66
+ catch (error) {
67
+ return this.createErrorResponse(request.requestId, 'INTERNAL_ERROR', error instanceof Error ? error.message : String(error));
68
+ }
69
+ }
70
+ /**
71
+ * Get available conversation tools
72
+ * @returns Array of MCP tool definitions
73
+ */
74
+ async getAvailableTools() {
75
+ return [
76
+ {
77
+ name: 'conversation_save_message',
78
+ description: 'Save a message to conversation history with automatic embedding and indexing',
79
+ parameters: {
80
+ type: 'object',
81
+ properties: {
82
+ content: {
83
+ type: 'string',
84
+ description: 'Message content'
85
+ },
86
+ role: {
87
+ type: 'string',
88
+ enum: ['user', 'assistant', 'system', 'tool'],
89
+ description: 'Message role'
90
+ },
91
+ conversationId: {
92
+ type: 'string',
93
+ description: 'Conversation ID (auto-generated if not provided)'
94
+ },
95
+ sessionId: {
96
+ type: 'string',
97
+ description: 'Session ID (optional)'
98
+ },
99
+ phase: {
100
+ type: 'string',
101
+ enum: [
102
+ 'understanding',
103
+ 'analysis',
104
+ 'planning',
105
+ 'implementation',
106
+ 'testing',
107
+ 'debugging',
108
+ 'refinement',
109
+ 'completed'
110
+ ],
111
+ description: 'Problem-solving phase'
112
+ },
113
+ confidence: {
114
+ type: 'number',
115
+ minimum: 0,
116
+ maximum: 1,
117
+ description: 'Confidence score (0-1)'
118
+ },
119
+ artifacts: {
120
+ type: 'array',
121
+ items: { type: 'string' },
122
+ description: 'Artifact IDs or paths'
123
+ },
124
+ toolsUsed: {
125
+ type: 'array',
126
+ items: { type: 'string' },
127
+ description: 'Names of tools used'
128
+ },
129
+ tags: {
130
+ type: 'array',
131
+ items: { type: 'string' },
132
+ description: 'Tags for categorization'
133
+ },
134
+ linkToPrevious: {
135
+ type: 'string',
136
+ description: 'ID of previous message to link'
137
+ }
138
+ },
139
+ required: ['content', 'role']
140
+ }
141
+ },
142
+ {
143
+ name: 'conversation_get_context',
144
+ description: 'Retrieve relevant context from conversation history using semantic search',
145
+ parameters: {
146
+ type: 'object',
147
+ properties: {
148
+ query: {
149
+ type: 'string',
150
+ description: 'Query string for context retrieval'
151
+ },
152
+ conversationId: {
153
+ type: 'string',
154
+ description: 'Limit to specific conversation'
155
+ },
156
+ limit: {
157
+ type: 'number',
158
+ description: 'Maximum messages to return (default: 10)',
159
+ default: 10
160
+ },
161
+ maxTokens: {
162
+ type: 'number',
163
+ description: 'Token budget for context (default: 50000)',
164
+ default: 50000
165
+ },
166
+ relevanceThreshold: {
167
+ type: 'number',
168
+ minimum: 0,
169
+ maximum: 1,
170
+ description: 'Minimum similarity score (default: 0.7)',
171
+ default: 0.7
172
+ },
173
+ role: {
174
+ oneOf: [
175
+ { type: 'string', enum: ['user', 'assistant', 'system', 'tool'] },
176
+ { type: 'array', items: { type: 'string' } }
177
+ ],
178
+ description: 'Filter by message role'
179
+ },
180
+ tags: {
181
+ type: 'array',
182
+ items: { type: 'string' },
183
+ description: 'Filter by tags'
184
+ },
185
+ includeArtifacts: {
186
+ type: 'boolean',
187
+ description: 'Include linked artifacts',
188
+ default: false
189
+ },
190
+ includeSimilarConversations: {
191
+ type: 'boolean',
192
+ description: 'Include similar past conversations',
193
+ default: false
194
+ }
195
+ },
196
+ required: ['query']
197
+ }
198
+ },
199
+ {
200
+ name: 'conversation_search',
201
+ description: 'Search messages semantically across all conversations',
202
+ parameters: {
203
+ type: 'object',
204
+ properties: {
205
+ query: {
206
+ type: 'string',
207
+ description: 'Search query'
208
+ },
209
+ limit: {
210
+ type: 'number',
211
+ description: 'Maximum results (default: 10)',
212
+ default: 10
213
+ },
214
+ conversationId: {
215
+ type: 'string',
216
+ description: 'Limit to specific conversation'
217
+ },
218
+ role: {
219
+ oneOf: [
220
+ { type: 'string', enum: ['user', 'assistant', 'system', 'tool'] },
221
+ { type: 'array', items: { type: 'string' } }
222
+ ],
223
+ description: 'Filter by role'
224
+ },
225
+ timeRange: {
226
+ type: 'object',
227
+ properties: {
228
+ start: { type: 'number', description: 'Start timestamp' },
229
+ end: { type: 'number', description: 'End timestamp' }
230
+ },
231
+ description: 'Time range filter'
232
+ }
233
+ },
234
+ required: ['query']
235
+ }
236
+ },
237
+ {
238
+ name: 'conversation_get_thread',
239
+ description: 'Get full conversation thread with all messages',
240
+ parameters: {
241
+ type: 'object',
242
+ properties: {
243
+ conversationId: {
244
+ type: 'string',
245
+ description: 'Conversation ID'
246
+ },
247
+ includeArtifacts: {
248
+ type: 'boolean',
249
+ description: 'Include linked artifacts',
250
+ default: false
251
+ }
252
+ },
253
+ required: ['conversationId']
254
+ }
255
+ },
256
+ {
257
+ name: 'conversation_save_artifact',
258
+ description: 'Save code/file artifact and link to conversation',
259
+ parameters: {
260
+ type: 'object',
261
+ properties: {
262
+ path: {
263
+ type: 'string',
264
+ description: 'VFS path for artifact'
265
+ },
266
+ content: {
267
+ type: 'string',
268
+ description: 'Artifact content'
269
+ },
270
+ conversationId: {
271
+ type: 'string',
272
+ description: 'Conversation ID'
273
+ },
274
+ messageId: {
275
+ type: 'string',
276
+ description: 'Message ID to link artifact to'
277
+ },
278
+ type: {
279
+ type: 'string',
280
+ enum: ['code', 'config', 'data', 'document', 'other'],
281
+ description: 'Artifact type'
282
+ },
283
+ language: {
284
+ type: 'string',
285
+ description: 'Programming language (for code artifacts)'
286
+ },
287
+ description: {
288
+ type: 'string',
289
+ description: 'Artifact description'
290
+ }
291
+ },
292
+ required: ['path', 'content', 'conversationId']
293
+ }
294
+ },
295
+ {
296
+ name: 'conversation_find_similar',
297
+ description: 'Find similar past conversations using semantic similarity',
298
+ parameters: {
299
+ type: 'object',
300
+ properties: {
301
+ conversationId: {
302
+ type: 'string',
303
+ description: 'Conversation ID to find similar to'
304
+ },
305
+ limit: {
306
+ type: 'number',
307
+ description: 'Maximum results (default: 5)',
308
+ default: 5
309
+ },
310
+ threshold: {
311
+ type: 'number',
312
+ minimum: 0,
313
+ maximum: 1,
314
+ description: 'Minimum similarity threshold (default: 0.7)',
315
+ default: 0.7
316
+ }
317
+ },
318
+ required: ['conversationId']
319
+ }
320
+ }
321
+ ];
322
+ }
323
+ /**
324
+ * Handle save_message tool
325
+ * REAL: Uses ConversationManager.saveMessage()
326
+ */
327
+ async handleSaveMessage(requestId, parameters) {
328
+ const { content, role, conversationId, sessionId, phase, confidence, artifacts, toolsUsed, tags, linkToPrevious } = parameters;
329
+ // Validate required parameters
330
+ if (!content || !role) {
331
+ return this.createErrorResponse(requestId, 'INVALID_PARAMETERS', 'Missing required parameters: content and role are required');
332
+ }
333
+ // Save message (REAL)
334
+ const messageId = await this.conversationManager.saveMessage(content, role, {
335
+ conversationId,
336
+ sessionId,
337
+ phase,
338
+ confidence,
339
+ artifacts,
340
+ toolsUsed,
341
+ tags,
342
+ linkToPrevious
343
+ });
344
+ return this.createSuccessResponse(requestId, {
345
+ messageId,
346
+ conversationId: conversationId || messageId.split('_')[0]
347
+ });
348
+ }
349
+ /**
350
+ * Handle get_context tool
351
+ * REAL: Uses ConversationManager.getRelevantContext()
352
+ */
353
+ async handleGetContext(requestId, parameters) {
354
+ const { query, ...options } = parameters;
355
+ if (!query) {
356
+ return this.createErrorResponse(requestId, 'INVALID_PARAMETERS', 'Missing required parameter: query');
357
+ }
358
+ // Get context (REAL)
359
+ const context = await this.conversationManager.getRelevantContext(query, options);
360
+ return this.createSuccessResponse(requestId, context);
361
+ }
362
+ /**
363
+ * Handle search tool
364
+ * REAL: Uses ConversationManager.searchMessages()
365
+ */
366
+ async handleSearch(requestId, parameters) {
367
+ const { query } = parameters;
368
+ if (!query) {
369
+ return this.createErrorResponse(requestId, 'INVALID_PARAMETERS', 'Missing required parameter: query');
370
+ }
371
+ // Search messages (REAL)
372
+ const results = await this.conversationManager.searchMessages(parameters);
373
+ return this.createSuccessResponse(requestId, {
374
+ results,
375
+ count: results.length
376
+ });
377
+ }
378
+ /**
379
+ * Handle get_thread tool
380
+ * REAL: Uses ConversationManager.getConversationThread()
381
+ */
382
+ async handleGetThread(requestId, parameters) {
383
+ const { conversationId, includeArtifacts = false } = parameters;
384
+ if (!conversationId) {
385
+ return this.createErrorResponse(requestId, 'INVALID_PARAMETERS', 'Missing required parameter: conversationId');
386
+ }
387
+ // Get thread (REAL)
388
+ const thread = await this.conversationManager.getConversationThread(conversationId, { includeArtifacts });
389
+ return this.createSuccessResponse(requestId, thread);
390
+ }
391
+ /**
392
+ * Handle save_artifact tool
393
+ * REAL: Uses ConversationManager.saveArtifact()
394
+ */
395
+ async handleSaveArtifact(requestId, parameters) {
396
+ const { path, content, conversationId, messageId, type, language, description } = parameters;
397
+ if (!path || !content || !conversationId) {
398
+ return this.createErrorResponse(requestId, 'INVALID_PARAMETERS', 'Missing required parameters: path, content, and conversationId are required');
399
+ }
400
+ // Save artifact (REAL)
401
+ const artifactId = await this.conversationManager.saveArtifact(path, content, {
402
+ conversationId,
403
+ messageId,
404
+ type,
405
+ language,
406
+ description
407
+ });
408
+ return this.createSuccessResponse(requestId, {
409
+ artifactId,
410
+ path
411
+ });
412
+ }
413
+ /**
414
+ * Handle find_similar tool
415
+ * REAL: Uses ConversationManager.findSimilarConversations()
416
+ */
417
+ async handleFindSimilar(requestId, parameters) {
418
+ const { conversationId, limit = 5, threshold = 0.7 } = parameters;
419
+ if (!conversationId) {
420
+ return this.createErrorResponse(requestId, 'INVALID_PARAMETERS', 'Missing required parameter: conversationId');
421
+ }
422
+ // Find similar (REAL)
423
+ const similar = await this.conversationManager.findSimilarConversations(conversationId, limit, threshold);
424
+ return this.createSuccessResponse(requestId, {
425
+ similar,
426
+ count: similar.length
427
+ });
428
+ }
429
+ /**
430
+ * Create success response
431
+ */
432
+ createSuccessResponse(requestId, data) {
433
+ return {
434
+ success: true,
435
+ requestId,
436
+ version: MCP_VERSION,
437
+ data
438
+ };
439
+ }
440
+ /**
441
+ * Create error response
442
+ */
443
+ createErrorResponse(requestId, code, message, details) {
444
+ return {
445
+ success: false,
446
+ requestId,
447
+ version: MCP_VERSION,
448
+ error: {
449
+ code,
450
+ message,
451
+ details
452
+ }
453
+ };
454
+ }
455
+ /**
456
+ * Generate request ID
457
+ */
458
+ generateRequestId() {
459
+ return uuidv4();
460
+ }
461
+ }
462
+ /**
463
+ * Create MCP conversation toolset
464
+ * @param brain Brainy instance
465
+ * @returns MCPConversationToolset instance
466
+ */
467
+ export function createConversationToolset(brain) {
468
+ return new MCPConversationToolset(brain);
469
+ }
470
+ //# sourceMappingURL=conversationTools.js.map
@@ -2,7 +2,7 @@
2
2
  * 🧠 BRAINY EMBEDDED PATTERNS
3
3
  *
4
4
  * AUTO-GENERATED - DO NOT EDIT
5
- * Generated: 2025-09-15T16:41:42.483Z
5
+ * Generated: 2025-09-29T17:05:30.153Z
6
6
  * Patterns: 220
7
7
  * Coverage: 94-98% of all queries
8
8
  *
@@ -2,7 +2,7 @@
2
2
  * 🧠 BRAINY EMBEDDED PATTERNS
3
3
  *
4
4
  * AUTO-GENERATED - DO NOT EDIT
5
- * Generated: 2025-09-15T16:41:42.483Z
5
+ * Generated: 2025-09-29T17:05:30.153Z
6
6
  * Patterns: 220
7
7
  * Coverage: 94-98% of all queries
8
8
  *
@@ -1015,7 +1015,6 @@ export class NaturalLanguageProcessor {
1015
1015
  confidence
1016
1016
  };
1017
1017
  if (options?.includeMetadata) {
1018
- ;
1019
1018
  entity.metadata = {
1020
1019
  pattern: pattern.source,
1021
1020
  contextBefore: text.substring(Math.max(0, match.index - 20), match.index),
package/dist/setup.js CHANGED
@@ -34,7 +34,6 @@ if (globalObj) {
34
34
  globalObj.TextDecoder = TextDecoder;
35
35
  }
36
36
  // Create special global constructors for library compatibility
37
- ;
38
37
  globalObj.__TextEncoder__ = TextEncoder;
39
38
  globalObj.__TextDecoder__ = TextDecoder;
40
39
  }
@@ -102,10 +102,16 @@ export interface MCPTool {
102
102
  parameters: {
103
103
  type: 'object';
104
104
  properties: Record<string, {
105
- type: string;
105
+ type?: string;
106
106
  description: string;
107
107
  enum?: string[];
108
108
  required?: boolean;
109
+ minimum?: number;
110
+ maximum?: number;
111
+ default?: any;
112
+ items?: any;
113
+ oneOf?: any[];
114
+ [key: string]: any;
109
115
  }>;
110
116
  required: string[];
111
117
  };
package/dist/unified.js CHANGED
@@ -41,7 +41,6 @@ export const environment = {
41
41
  };
42
42
  // Make environment information available globally
43
43
  if (typeof globalThis !== 'undefined') {
44
- ;
45
44
  globalThis.__ENV__ = environment;
46
45
  }
47
46
  // Log the detected environment
@@ -19,6 +19,7 @@ import { IVirtualFileSystem, VFSConfig, VFSEntity, VFSMetadata, VFSStats, VFSDir
19
19
  export declare class VirtualFileSystem implements IVirtualFileSystem {
20
20
  private brain;
21
21
  private pathResolver;
22
+ private projectionRegistry;
22
23
  private config;
23
24
  private rootEntityId?;
24
25
  private initialized;
@@ -35,6 +36,11 @@ export declare class VirtualFileSystem implements IVirtualFileSystem {
35
36
  /**
36
37
  * Create or find the root directory entity
37
38
  */
39
+ /**
40
+ * Auto-register built-in projection strategies
41
+ * Zero-config: All semantic dimensions work out of the box
42
+ */
43
+ private registerBuiltInProjections;
38
44
  private initializeRoot;
39
45
  /**
40
46
  * Read a file's content
@@ -183,10 +189,6 @@ export declare class VirtualFileSystem implements IVirtualFileSystem {
183
189
  * Merges with existing metadata
184
190
  */
185
191
  setMetadata(path: string, metadata: Partial<VFSMetadata>): Promise<void>;
186
- /**
187
- * Enable Knowledge Layer on this VFS instance
188
- */
189
- enableKnowledgeLayer(): Promise<void>;
190
192
  /**
191
193
  * Set the current user for tracking who makes changes
192
194
  */
@@ -7,8 +7,8 @@
7
7
  import crypto from 'crypto';
8
8
  import { Brainy } from '../brainy.js';
9
9
  import { NounType, VerbType } from '../types/graphTypes.js';
10
- import { PathResolver } from './PathResolver.js';
11
- // Knowledge Layer imports removed - now in KnowledgeAugmentation
10
+ import { SemanticPathResolver, ProjectionRegistry, ConceptProjection, AuthorProjection, TemporalProjection, RelationshipProjection, SimilarityProjection, TagProjection } from './semantic/index.js';
11
+ // Knowledge Layer can remain as optional augmentation for now
12
12
  import { VFSError, VFSErrorCode } from './types.js';
13
13
  /**
14
14
  * Main Virtual Filesystem Implementation
@@ -46,12 +46,12 @@ export class VirtualFileSystem {
46
46
  }
47
47
  // Create or find root entity
48
48
  this.rootEntityId = await this.initializeRoot();
49
- // Initialize path resolver
50
- this.pathResolver = new PathResolver(this.brain, this.rootEntityId, {
51
- maxCacheSize: this.config.cache?.maxPaths,
52
- cacheTTL: this.config.cache?.ttl,
53
- hotPathThreshold: 10
54
- });
49
+ // Initialize projection registry with auto-discovery of built-in projections
50
+ this.projectionRegistry = new ProjectionRegistry();
51
+ this.registerBuiltInProjections();
52
+ // Initialize semantic path resolver (zero-config, uses brain.config)
53
+ this.pathResolver = new SemanticPathResolver(this.brain, this, // Pass VFS instance for resolvePath
54
+ this.rootEntityId, this.projectionRegistry);
55
55
  // Knowledge Layer is now a separate augmentation
56
56
  // Enable with: brain.use('knowledge')
57
57
  // Start background tasks
@@ -61,6 +61,31 @@ export class VirtualFileSystem {
61
61
  /**
62
62
  * Create or find the root directory entity
63
63
  */
64
+ /**
65
+ * Auto-register built-in projection strategies
66
+ * Zero-config: All semantic dimensions work out of the box
67
+ */
68
+ registerBuiltInProjections() {
69
+ const projections = [
70
+ ConceptProjection,
71
+ AuthorProjection,
72
+ TemporalProjection,
73
+ RelationshipProjection,
74
+ SimilarityProjection,
75
+ TagProjection
76
+ ];
77
+ for (const ProjectionClass of projections) {
78
+ try {
79
+ this.projectionRegistry.register(new ProjectionClass());
80
+ }
81
+ catch (err) {
82
+ // Silently skip if already registered (e.g., in tests)
83
+ if (!(err instanceof Error && err.message.includes('already registered'))) {
84
+ throw err;
85
+ }
86
+ }
87
+ }
88
+ }
64
89
  async initializeRoot() {
65
90
  // Check if root already exists - search using where clause
66
91
  const existing = await this.brain.find({
@@ -1026,6 +1051,17 @@ export class VirtualFileSystem {
1026
1051
  metadata.lineCount = text.split('\n').length;
1027
1052
  metadata.wordCount = text.split(/\s+/).filter(w => w).length;
1028
1053
  metadata.charset = 'utf-8';
1054
+ // Extract concepts using brain.extractConcepts() (neural extraction)
1055
+ if (this.config.intelligence?.autoConcepts) {
1056
+ try {
1057
+ const concepts = await this.brain.extractConcepts(text, { limit: 20 });
1058
+ metadata.conceptNames = concepts; // Flattened for O(log n) queries
1059
+ }
1060
+ catch (error) {
1061
+ // Concept extraction is optional - don't fail if it errors
1062
+ console.debug('Concept extraction failed:', error);
1063
+ }
1064
+ }
1029
1065
  }
1030
1066
  // Extract hash for integrity
1031
1067
  const crypto = await import('crypto');
@@ -1193,9 +1229,6 @@ export class VirtualFileSystem {
1193
1229
  maxFileSize: 1000000000, // 1GB
1194
1230
  maxPathLength: 4096,
1195
1231
  maxDirectoryEntries: 100000
1196
- },
1197
- knowledgeLayer: {
1198
- enabled: false // Default to disabled
1199
1232
  }
1200
1233
  };
1201
1234
  }
@@ -1732,16 +1765,6 @@ export class VirtualFileSystem {
1732
1765
  // Invalidate caches
1733
1766
  this.invalidateCaches(path);
1734
1767
  }
1735
- // ============= Knowledge Layer =============
1736
- // Knowledge Layer methods are added by KnowledgeLayer.enable()
1737
- // This keeps VFS pure and fast while allowing optional intelligence
1738
- /**
1739
- * Enable Knowledge Layer on this VFS instance
1740
- */
1741
- async enableKnowledgeLayer() {
1742
- const { enableKnowledgeLayer } = await import('./KnowledgeLayer.js');
1743
- await enableKnowledgeLayer(this, this.brain);
1744
- }
1745
1768
  /**
1746
1769
  * Set the current user for tracking who makes changes
1747
1770
  */
@@ -11,9 +11,4 @@ export { FSCompat, createFS } from './FSCompat.js';
11
11
  export { DirectoryImporter } from './importers/DirectoryImporter.js';
12
12
  export { VFSReadStream } from './streams/VFSReadStream.js';
13
13
  export { VFSWriteStream } from './streams/VFSWriteStream.js';
14
- export { EventRecorder } from './EventRecorder.js';
15
- export { SemanticVersioning } from './SemanticVersioning.js';
16
- export { PersistentEntitySystem } from './PersistentEntitySystem.js';
17
- export { ConceptSystem } from './ConceptSystem.js';
18
- export { GitBridge } from './GitBridge.js';
19
14
  export { VirtualFileSystem as VFS } from './VirtualFileSystem.js';