feat: add infinite agent memory with MCP integration

Implement comprehensive conversation management system enabling AI agents
like Claude Code to maintain infinite context and history. Provides semantic
search, smart context retrieval, and automatic artifact linking using Brainy's
existing Triple Intelligence infrastructure.

Core Features:
- ConversationManager API for message storage and retrieval
- MCP protocol integration with 6 tools for Claude Code
- Context ranking using semantic, temporal, and graph scoring
- Neural clustering for theme discovery and deduplication
- Virtual filesystem integration for code artifact linking
- CLI commands for setup and management

Zero new infrastructure required - uses existing Brainy features:
- Storage via brain.add() with NounType.Message
- Relationships via brain.relate() with VerbType.Precedes
- Search via brain.find() with Triple Intelligence
- Clustering via brain.neural()
- Artifacts via brain.vfs()

One-command setup: brainy conversation setup

Version: 3.19.0
This commit is contained in:
David Snelling 2025-09-29 15:37:11 -07:00
parent e3a21c6075
commit ced639cab1
15 changed files with 3304 additions and 7 deletions

View file

@ -88,6 +88,7 @@ export class Brainy<T = any> implements BrainyInterface<T> {
private _extractor?: NeuralEntityExtractor
private _tripleIntelligence?: TripleIntelligenceSystem
private _vfs?: VirtualFileSystem
private _conversation?: any // ConversationManager (lazy-loaded)
// State
private initialized = false
@ -1662,6 +1663,31 @@ export class Brainy<T = any> implements BrainyInterface<T> {
return this._vfs
}
/**
* Conversation Manager API - Infinite Agent Memory
*
* Provides conversation and context management for AI agents:
* - Save and retrieve conversation messages
* - Semantic search across conversation history
* - Smart context retrieval with relevance ranking
* - Artifact management (code, files, documents)
* - Conversation themes and clustering
*
* @returns ConversationManager instance
* @example
* const conv = brain.conversation
* await conv.saveMessage("How do I implement auth?", "user", { conversationId: "conv_123" })
* const context = await conv.getRelevantContext("authentication implementation")
*/
conversation() {
if (!this._conversation) {
// Lazy-load ConversationManager to avoid circular dependencies
const { ConversationManager } = require('./conversation/conversationManager.js')
this._conversation = new ConversationManager(this)
}
return this._conversation
}
/**
* Data Management API - backup, restore, import, export
*/