@soulcraft/brainy 3.18.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.
- package/CHANGELOG.md +2 -0
- package/README.md +52 -3
- package/dist/brainy.d.ts +18 -0
- package/dist/brainy.js +24 -0
- package/dist/conversation/conversationManager.d.ts +176 -0
- package/dist/conversation/conversationManager.js +666 -0
- package/dist/conversation/index.d.ts +8 -0
- package/dist/conversation/index.js +8 -0
- package/dist/conversation/types.d.ts +231 -0
- package/dist/conversation/types.js +8 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +3 -0
- package/dist/mcp/conversationTools.d.ts +88 -0
- package/dist/mcp/conversationTools.js +470 -0
- package/dist/types/mcpTypes.d.ts +7 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
## [3.19.0](https://github.com/soulcraftlabs/brainy/compare/v3.18.0...v3.19.0) (2025-09-29)
|
|
6
|
+
|
|
5
7
|
## [3.17.0](https://github.com/soulcraftlabs/brainy/compare/v3.16.0...v3.17.0) (2025-09-27)
|
|
6
8
|
|
|
7
9
|
## [3.15.0](https://github.com/soulcraftlabs/brainy/compare/v3.14.2...v3.15.0) (2025-09-26)
|
package/README.md
CHANGED
|
@@ -19,6 +19,14 @@
|
|
|
19
19
|
|
|
20
20
|
## ๐ Key Features
|
|
21
21
|
|
|
22
|
+
### ๐ฌ **Infinite Agent Memory** (NEW!)
|
|
23
|
+
|
|
24
|
+
- **Never Lose Context**: Conversations preserved with semantic search
|
|
25
|
+
- **Smart Context Retrieval**: Triple Intelligence finds relevant past work
|
|
26
|
+
- **Claude Code Integration**: One command (`brainy conversation setup`) enables infinite memory
|
|
27
|
+
- **Automatic Artifact Linking**: Code and files connected to conversations
|
|
28
|
+
- **Scales to Millions**: Messages indexed and searchable in <100ms
|
|
29
|
+
|
|
22
30
|
### ๐ง **Triple Intelligenceโข Engine**
|
|
23
31
|
|
|
24
32
|
- **Vector Search**: HNSW-powered semantic similarity
|
|
@@ -44,6 +52,42 @@
|
|
|
44
52
|
|
|
45
53
|
```bash
|
|
46
54
|
npm install @soulcraft/brainy
|
|
55
|
+
|
|
56
|
+
# For Claude Code infinite memory (optional):
|
|
57
|
+
brainy conversation setup
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### ๐ฌ **Infinite Memory for Claude Code**
|
|
61
|
+
|
|
62
|
+
```javascript
|
|
63
|
+
// One-time setup:
|
|
64
|
+
// $ brainy conversation setup
|
|
65
|
+
|
|
66
|
+
// Claude Code now automatically:
|
|
67
|
+
// - Saves every conversation with embeddings
|
|
68
|
+
// - Retrieves relevant past context
|
|
69
|
+
// - Links code artifacts to conversations
|
|
70
|
+
// - Never loses context or momentum
|
|
71
|
+
|
|
72
|
+
// Use programmatically:
|
|
73
|
+
import { Brainy } from '@soulcraft/brainy'
|
|
74
|
+
|
|
75
|
+
const brain = new Brainy()
|
|
76
|
+
await brain.init()
|
|
77
|
+
|
|
78
|
+
// Save conversations
|
|
79
|
+
await brain.conversation.saveMessage(
|
|
80
|
+
"How do I implement JWT authentication?",
|
|
81
|
+
"user",
|
|
82
|
+
{ conversationId: "conv_123" }
|
|
83
|
+
)
|
|
84
|
+
|
|
85
|
+
// Get relevant context (semantic + temporal + graph)
|
|
86
|
+
const context = await brain.conversation.getRelevantContext(
|
|
87
|
+
"JWT token validation",
|
|
88
|
+
{ limit: 10, includeArtifacts: true }
|
|
89
|
+
)
|
|
90
|
+
// Returns: Ranked messages, linked code, similar conversations
|
|
47
91
|
```
|
|
48
92
|
|
|
49
93
|
### ๐ฏ **True Zero Configuration**
|
|
@@ -762,10 +806,15 @@ We welcome contributions! See [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.
|
|
|
762
806
|
|
|
763
807
|
## ๐ Documentation
|
|
764
808
|
|
|
809
|
+
### Infinite Agent Memory ๐ฌ
|
|
810
|
+
- [Conversation API Overview](docs/conversation/README.md) - **NEW!** Complete conversation management guide
|
|
811
|
+
- [MCP Integration for Claude Code](docs/conversation/MCP_INTEGRATION.md) - **NEW!** One-command setup
|
|
812
|
+
- [API Reference](docs/conversation/API_REFERENCE.md) - **NEW!** Full API documentation
|
|
813
|
+
|
|
765
814
|
### Framework Integration
|
|
766
|
-
- [Framework Integration Guide](docs/guides/framework-integration.md) -
|
|
767
|
-
- [Next.js Integration](docs/guides/nextjs-integration.md) -
|
|
768
|
-
- [Vue.js Integration](docs/guides/vue-integration.md) -
|
|
815
|
+
- [Framework Integration Guide](docs/guides/framework-integration.md) - Complete framework setup guide
|
|
816
|
+
- [Next.js Integration](docs/guides/nextjs-integration.md) - React and Next.js examples
|
|
817
|
+
- [Vue.js Integration](docs/guides/vue-integration.md) - Vue and Nuxt examples
|
|
769
818
|
|
|
770
819
|
### Virtual Filesystem (Semantic VFS) ๐ง ๐
|
|
771
820
|
- [VFS Core Documentation](docs/vfs/VFS_CORE.md) - Complete filesystem architecture and API
|
package/dist/brainy.d.ts
CHANGED
|
@@ -38,6 +38,7 @@ export declare class Brainy<T = any> implements BrainyInterface<T> {
|
|
|
38
38
|
private _extractor?;
|
|
39
39
|
private _tripleIntelligence?;
|
|
40
40
|
private _vfs?;
|
|
41
|
+
private _conversation?;
|
|
41
42
|
private initialized;
|
|
42
43
|
private dimensions?;
|
|
43
44
|
constructor(config?: BrainyConfig);
|
|
@@ -644,6 +645,23 @@ export declare class Brainy<T = any> implements BrainyInterface<T> {
|
|
|
644
645
|
* Virtual File System API - Knowledge Operating System
|
|
645
646
|
*/
|
|
646
647
|
vfs(): VirtualFileSystem;
|
|
648
|
+
/**
|
|
649
|
+
* Conversation Manager API - Infinite Agent Memory
|
|
650
|
+
*
|
|
651
|
+
* Provides conversation and context management for AI agents:
|
|
652
|
+
* - Save and retrieve conversation messages
|
|
653
|
+
* - Semantic search across conversation history
|
|
654
|
+
* - Smart context retrieval with relevance ranking
|
|
655
|
+
* - Artifact management (code, files, documents)
|
|
656
|
+
* - Conversation themes and clustering
|
|
657
|
+
*
|
|
658
|
+
* @returns ConversationManager instance
|
|
659
|
+
* @example
|
|
660
|
+
* const conv = brain.conversation
|
|
661
|
+
* await conv.saveMessage("How do I implement auth?", "user", { conversationId: "conv_123" })
|
|
662
|
+
* const context = await conv.getRelevantContext("authentication implementation")
|
|
663
|
+
*/
|
|
664
|
+
conversation(): any;
|
|
647
665
|
/**
|
|
648
666
|
* Data Management API - backup, restore, import, export
|
|
649
667
|
*/
|
package/dist/brainy.js
CHANGED
|
@@ -1419,6 +1419,30 @@ export class Brainy {
|
|
|
1419
1419
|
}
|
|
1420
1420
|
return this._vfs;
|
|
1421
1421
|
}
|
|
1422
|
+
/**
|
|
1423
|
+
* Conversation Manager API - Infinite Agent Memory
|
|
1424
|
+
*
|
|
1425
|
+
* Provides conversation and context management for AI agents:
|
|
1426
|
+
* - Save and retrieve conversation messages
|
|
1427
|
+
* - Semantic search across conversation history
|
|
1428
|
+
* - Smart context retrieval with relevance ranking
|
|
1429
|
+
* - Artifact management (code, files, documents)
|
|
1430
|
+
* - Conversation themes and clustering
|
|
1431
|
+
*
|
|
1432
|
+
* @returns ConversationManager instance
|
|
1433
|
+
* @example
|
|
1434
|
+
* const conv = brain.conversation
|
|
1435
|
+
* await conv.saveMessage("How do I implement auth?", "user", { conversationId: "conv_123" })
|
|
1436
|
+
* const context = await conv.getRelevantContext("authentication implementation")
|
|
1437
|
+
*/
|
|
1438
|
+
conversation() {
|
|
1439
|
+
if (!this._conversation) {
|
|
1440
|
+
// Lazy-load ConversationManager to avoid circular dependencies
|
|
1441
|
+
const { ConversationManager } = require('./conversation/conversationManager.js');
|
|
1442
|
+
this._conversation = new ConversationManager(this);
|
|
1443
|
+
}
|
|
1444
|
+
return this._conversation;
|
|
1445
|
+
}
|
|
1422
1446
|
/**
|
|
1423
1447
|
* Data Management API - backup, restore, import, export
|
|
1424
1448
|
*/
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ConversationManager - Infinite Agent Memory
|
|
3
|
+
*
|
|
4
|
+
* Production-ready conversation and context management for AI agents.
|
|
5
|
+
* Built on Brainy's existing infrastructure: Triple Intelligence, Neural API, VFS.
|
|
6
|
+
*
|
|
7
|
+
* REAL IMPLEMENTATION - No stubs, no mocks, no TODOs
|
|
8
|
+
*/
|
|
9
|
+
import { Brainy } from '../brainy.js';
|
|
10
|
+
import { MessageRole, ConversationThread, ConversationContext, SaveMessageOptions, ContextRetrievalOptions, ConversationSearchOptions, ConversationSearchResult, ConversationTheme, ArtifactOptions, ConversationStats } from './types.js';
|
|
11
|
+
/**
|
|
12
|
+
* ConversationManager - High-level API for conversation operations
|
|
13
|
+
*
|
|
14
|
+
* Uses existing Brainy infrastructure:
|
|
15
|
+
* - brain.add() for messages
|
|
16
|
+
* - brain.relate() for threading
|
|
17
|
+
* - brain.find() with Triple Intelligence for context
|
|
18
|
+
* - brain.neural for clustering and similarity
|
|
19
|
+
* - brain.vfs() for artifacts
|
|
20
|
+
*/
|
|
21
|
+
export declare class ConversationManager {
|
|
22
|
+
private brain;
|
|
23
|
+
private initialized;
|
|
24
|
+
private _vfs;
|
|
25
|
+
/**
|
|
26
|
+
* Create a ConversationManager instance
|
|
27
|
+
* @param brain Brainy instance to use
|
|
28
|
+
*/
|
|
29
|
+
constructor(brain: Brainy);
|
|
30
|
+
/**
|
|
31
|
+
* Initialize the conversation manager
|
|
32
|
+
* Lazy initialization pattern - only called when first used
|
|
33
|
+
*/
|
|
34
|
+
init(): Promise<void>;
|
|
35
|
+
/**
|
|
36
|
+
* Save a message to the conversation history
|
|
37
|
+
*
|
|
38
|
+
* Uses: brain.add() with NounType.Message
|
|
39
|
+
* Real implementation - stores message with embedding
|
|
40
|
+
*
|
|
41
|
+
* @param content Message content
|
|
42
|
+
* @param role Message role (user, assistant, system, tool)
|
|
43
|
+
* @param options Save options (conversationId, metadata, etc.)
|
|
44
|
+
* @returns Message ID
|
|
45
|
+
*/
|
|
46
|
+
saveMessage(content: string, role: MessageRole, options?: SaveMessageOptions): Promise<string>;
|
|
47
|
+
/**
|
|
48
|
+
* Link two messages in temporal sequence
|
|
49
|
+
*
|
|
50
|
+
* Uses: brain.relate() with VerbType.Precedes
|
|
51
|
+
* Real implementation - creates graph relationship
|
|
52
|
+
*
|
|
53
|
+
* @param prevMessageId ID of previous message
|
|
54
|
+
* @param nextMessageId ID of next message
|
|
55
|
+
* @returns Relationship ID
|
|
56
|
+
*/
|
|
57
|
+
linkMessages(prevMessageId: string, nextMessageId: string): Promise<string>;
|
|
58
|
+
/**
|
|
59
|
+
* Get a full conversation thread
|
|
60
|
+
*
|
|
61
|
+
* Uses: brain.getNoun() and brain.getConnections()
|
|
62
|
+
* Real implementation - traverses graph relationships
|
|
63
|
+
*
|
|
64
|
+
* @param conversationId Conversation ID
|
|
65
|
+
* @param options Options (includeArtifacts, etc.)
|
|
66
|
+
* @returns Complete conversation thread
|
|
67
|
+
*/
|
|
68
|
+
getConversationThread(conversationId: string, options?: {
|
|
69
|
+
includeArtifacts?: boolean;
|
|
70
|
+
}): Promise<ConversationThread>;
|
|
71
|
+
/**
|
|
72
|
+
* Get relevant context for a query
|
|
73
|
+
*
|
|
74
|
+
* Uses: brain.find() with Triple Intelligence
|
|
75
|
+
* Real implementation - semantic + temporal + graph ranking
|
|
76
|
+
*
|
|
77
|
+
* @param query Query string or context options
|
|
78
|
+
* @param options Retrieval options
|
|
79
|
+
* @returns Ranked context messages with artifacts
|
|
80
|
+
*/
|
|
81
|
+
getRelevantContext(query: string | ContextRetrievalOptions, options?: ContextRetrievalOptions): Promise<ConversationContext>;
|
|
82
|
+
/**
|
|
83
|
+
* Search messages semantically
|
|
84
|
+
*
|
|
85
|
+
* Uses: brain.find() with semantic search
|
|
86
|
+
* Real implementation - vector similarity search
|
|
87
|
+
*
|
|
88
|
+
* @param options Search options
|
|
89
|
+
* @returns Search results with scores
|
|
90
|
+
*/
|
|
91
|
+
searchMessages(options: ConversationSearchOptions): Promise<ConversationSearchResult[]>;
|
|
92
|
+
/**
|
|
93
|
+
* Find similar conversations using Neural API
|
|
94
|
+
*
|
|
95
|
+
* Uses: brain.neural.neighbors()
|
|
96
|
+
* Real implementation - semantic similarity with embeddings
|
|
97
|
+
*
|
|
98
|
+
* @param conversationId Conversation ID to find similar to
|
|
99
|
+
* @param limit Maximum number of similar conversations
|
|
100
|
+
* @param threshold Minimum similarity threshold
|
|
101
|
+
* @returns Similar conversations with relevance scores
|
|
102
|
+
*/
|
|
103
|
+
findSimilarConversations(conversationId: string, limit?: number, threshold?: number): Promise<Array<{
|
|
104
|
+
id: string;
|
|
105
|
+
relevance: number;
|
|
106
|
+
metadata?: any;
|
|
107
|
+
}>>;
|
|
108
|
+
/**
|
|
109
|
+
* Get conversation themes via clustering
|
|
110
|
+
*
|
|
111
|
+
* Uses: brain.neural.clusters()
|
|
112
|
+
* Real implementation - semantic clustering
|
|
113
|
+
*
|
|
114
|
+
* @param conversationId Conversation ID
|
|
115
|
+
* @returns Discovered themes
|
|
116
|
+
*/
|
|
117
|
+
getConversationThemes(conversationId: string): Promise<ConversationTheme[]>;
|
|
118
|
+
/**
|
|
119
|
+
* Save an artifact (code, file, etc.) to VFS
|
|
120
|
+
*
|
|
121
|
+
* Uses: brain.vfs()
|
|
122
|
+
* Real implementation - stores in virtual filesystem
|
|
123
|
+
*
|
|
124
|
+
* @param path VFS path
|
|
125
|
+
* @param content File content
|
|
126
|
+
* @param options Artifact options
|
|
127
|
+
* @returns Artifact entity ID
|
|
128
|
+
*/
|
|
129
|
+
saveArtifact(path: string, content: string | Buffer, options: ArtifactOptions): Promise<string>;
|
|
130
|
+
/**
|
|
131
|
+
* Get conversation statistics
|
|
132
|
+
*
|
|
133
|
+
* Uses: brain.find() with aggregations
|
|
134
|
+
* Real implementation - queries and aggregates data
|
|
135
|
+
*
|
|
136
|
+
* @param conversationId Optional conversation ID to filter
|
|
137
|
+
* @returns Conversation statistics
|
|
138
|
+
*/
|
|
139
|
+
getConversationStats(conversationId?: string): Promise<ConversationStats>;
|
|
140
|
+
/**
|
|
141
|
+
* Delete a message
|
|
142
|
+
*
|
|
143
|
+
* Uses: brain.deleteNoun()
|
|
144
|
+
* Real implementation - removes from graph
|
|
145
|
+
*
|
|
146
|
+
* @param messageId Message ID to delete
|
|
147
|
+
*/
|
|
148
|
+
deleteMessage(messageId: string): Promise<void>;
|
|
149
|
+
/**
|
|
150
|
+
* Export conversation to JSON
|
|
151
|
+
*
|
|
152
|
+
* Uses: getConversationThread()
|
|
153
|
+
* Real implementation - serializes conversation
|
|
154
|
+
*
|
|
155
|
+
* @param conversationId Conversation ID
|
|
156
|
+
* @returns JSON-serializable conversation object
|
|
157
|
+
*/
|
|
158
|
+
exportConversation(conversationId: string): Promise<any>;
|
|
159
|
+
/**
|
|
160
|
+
* Import conversation from JSON
|
|
161
|
+
*
|
|
162
|
+
* Uses: saveMessage() and linkMessages()
|
|
163
|
+
* Real implementation - recreates conversation
|
|
164
|
+
*
|
|
165
|
+
* @param data Exported conversation data
|
|
166
|
+
* @returns New conversation ID
|
|
167
|
+
*/
|
|
168
|
+
importConversation(data: any): Promise<string>;
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Create a ConversationManager instance
|
|
172
|
+
*
|
|
173
|
+
* @param brain Brainy instance
|
|
174
|
+
* @returns ConversationManager instance
|
|
175
|
+
*/
|
|
176
|
+
export declare function createConversationManager(brain: Brainy): ConversationManager;
|