@timmeck/brain 3.36.28 → 3.36.30
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/README.md +33 -15
- package/dist/brain.d.ts +0 -1
- package/dist/brain.js +17 -143
- package/dist/brain.js.map +1 -1
- package/dist/cli/commands/intelligence.js +56 -0
- package/dist/cli/commands/intelligence.js.map +1 -1
- package/dist/ipc/router.d.ts +2 -1
- package/dist/ipc/router.js +17 -2
- package/dist/ipc/router.js.map +1 -1
- package/dist/mcp/unified-tools.js +3 -4
- package/dist/mcp/unified-tools.js.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
**Autonomous Error Memory, Code Intelligence & Self-Improving AI for Claude Code — 162 MCP Tools, 72+ Engines**
|
|
9
9
|
|
|
10
|
-
Brain is an MCP server that gives Claude Code a persistent, self-improving memory. It remembers errors, learns solutions, and runs 72+ autonomous engines in a
|
|
10
|
+
Brain is an MCP server that gives Claude Code a persistent, self-improving memory. It remembers errors, learns solutions, and runs 72+ autonomous engines in a 50-step feedback cycle. It observes itself, detects anomalies, forms and tests hypotheses, distills principles, reasons in chains, feels emotions, evolves strategies genetically, debates itself, challenges its own principles (Advocatus Diaboli), gets curious about knowledge gaps, syncs knowledge via Borg collective, loads community plugins, absorbs code from GitHub repos, extracts reusable features, recommends missing features, and modifies its own source code. Multi-provider LLM (Anthropic + Ollama). RAG vector search across all knowledge. Knowledge Graph with transitive inference. RLHF feedback learning. Tool-use learning. User modeling. Proactive suggestions. Code assimilation with feature extraction + recommendation. Autonomous web research missions. Live tech radar scanning. 162 MCP tools. 3076 tests.
|
|
11
11
|
|
|
12
12
|
## Quick Start
|
|
13
13
|
|
|
@@ -23,14 +23,13 @@ That's it. One command configures MCP, hooks, and starts the daemon.
|
|
|
23
23
|
```
|
|
24
24
|
Claude Code ──MCP stdio──► Brain Daemon (:7777)
|
|
25
25
|
Cursor/Windsurf ─MCP SSE──► MCP HTTP Server (:7778)
|
|
26
|
-
Browser ────────HTTP──────►
|
|
27
|
-
Command Center (:7790)
|
|
26
|
+
Browser ────────HTTP──────► Command Center (:7790)
|
|
28
27
|
│
|
|
29
28
|
┌───────────────┼───────────────┐
|
|
30
29
|
▼ ▼ ▼
|
|
31
30
|
Error Memory Research Engine 72+ Engines
|
|
32
31
|
Code Intel Mission Engine ResearchOrchestrator
|
|
33
|
-
Synapse Net LLM Service
|
|
32
|
+
Synapse Net LLM Service 50-step feedback loop
|
|
34
33
|
Prevention Web Research │
|
|
35
34
|
Git Intel TechRadar ┌───┴───────────┐
|
|
36
35
|
│ ▼ ▼
|
|
@@ -80,7 +79,7 @@ Cross-brain communication via IPC named pipes (trading-brain, marketing-brain).
|
|
|
80
79
|
|
|
81
80
|
### 72+ Autonomous Engines
|
|
82
81
|
|
|
83
|
-
The ResearchOrchestrator runs a
|
|
82
|
+
The ResearchOrchestrator runs a 50-step feedback cycle every 5 minutes:
|
|
84
83
|
|
|
85
84
|
#### Core Research Engines
|
|
86
85
|
|
|
@@ -110,6 +109,15 @@ The ResearchOrchestrator runs a 40-step feedback cycle every 5 minutes:
|
|
|
110
109
|
| CuriosityEngine | Detects knowledge gaps and generates exploration questions |
|
|
111
110
|
| ResearchAgendaEngine | Prioritizes what to investigate next |
|
|
112
111
|
| CounterfactualEngine | "What if X hadn't happened?" reasoning |
|
|
112
|
+
| RAGEngine | Vector search across all knowledge (insights, memories, errors) |
|
|
113
|
+
| KnowledgeGraphEngine | Typed fact relations with transitive inference |
|
|
114
|
+
| SemanticCompressor | Deduplicates and compresses similar insights |
|
|
115
|
+
| FeedbackEngine | RLHF reward signals from user corrections |
|
|
116
|
+
| ToolTracker | Tool usage learning and pattern detection |
|
|
117
|
+
| ProactiveEngine | Trigger-based improvement suggestions |
|
|
118
|
+
| UserModel | Adaptive responses based on user skill level |
|
|
119
|
+
| CodeHealthMonitor | Codebase quality tracking with trend analysis |
|
|
120
|
+
| ActiveLearner | Gap identification and multi-strategy closing |
|
|
113
121
|
|
|
114
122
|
#### Meta-Cognition Engines
|
|
115
123
|
|
|
@@ -124,6 +132,8 @@ The ResearchOrchestrator runs a 40-step feedback cycle every 5 minutes:
|
|
|
124
132
|
| EmotionalModel | Frustration, curiosity, satisfaction — influences priorities |
|
|
125
133
|
| SelfTestEngine | Tests understanding of its own principles |
|
|
126
134
|
| TeachEngine | Packages knowledge for transfer to other brains |
|
|
135
|
+
| TeachingProtocol | Inter-brain knowledge transfer via IPC |
|
|
136
|
+
| ConsensusEngine | Multi-brain voting for critical decisions |
|
|
127
137
|
|
|
128
138
|
#### Autonomy Engines
|
|
129
139
|
|
|
@@ -136,7 +146,10 @@ The ResearchOrchestrator runs a 40-step feedback cycle every 5 minutes:
|
|
|
136
146
|
| EvolutionEngine | Genetic algorithm for strategy optimization |
|
|
137
147
|
| AdaptiveStrategyEngine | Real-time parameter adaptation based on outcomes |
|
|
138
148
|
| DreamEngine | Offline memory consolidation during idle |
|
|
139
|
-
|
|
|
149
|
+
| RepoAbsorber | Absorbs external repos and indexes their knowledge |
|
|
150
|
+
| FeatureExtractor | Extracts reusable functions, patterns, data structures |
|
|
151
|
+
| FeatureRecommender | Detects needs, matches features, builds connections |
|
|
152
|
+
| ResearchOrchestrator | Orchestrates the entire 50-step feedback cycle |
|
|
140
153
|
|
|
141
154
|
### Self-Improvement Loop
|
|
142
155
|
|
|
@@ -199,16 +212,21 @@ Automatic anomaly response system:
|
|
|
199
212
|
- **Configurable** — All providers optional, graceful fallback
|
|
200
213
|
- **Event Routing** — Different events route to different channels
|
|
201
214
|
|
|
202
|
-
###
|
|
215
|
+
### Command Center Dashboard (:7790)
|
|
203
216
|
|
|
204
|
-
|
|
205
|
-
|-----------|------|--------------|
|
|
206
|
-
| **Mission Control** | 7788 | 7-tab: Overview, Consciousness Entity, Thoughts, CodeGen, Self-Mod, Engines, Intelligence |
|
|
207
|
-
| **Command Center** | 7790 | 8-page: Ecosystem, Learning, Trading, Marketing, Cross-Brain & Borg, Debates & Challenges, Activity & Missions, Infrastructure |
|
|
217
|
+
9-page live dashboard showing the entire ecosystem:
|
|
208
218
|
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
219
|
+
| Page | What It Shows |
|
|
220
|
+
|------|--------------|
|
|
221
|
+
| Overview | All 3 brains, 72+ engines, error log, quick actions |
|
|
222
|
+
| Learning Cycle | 6-stage pipeline: Data → Analysis → Hypotheses → Experiments → Principles → Actions |
|
|
223
|
+
| Trading Flow | Signals → Analysis → Trades → P&L, equity, positions, win rate |
|
|
224
|
+
| Code Intelligence | Repo absorption, feature extraction, code health |
|
|
225
|
+
| Research | Missions, knowledge growth, research agenda |
|
|
226
|
+
| Entity | Consciousness orb — emotional state, thought streams, dimension ring |
|
|
227
|
+
| Cross-Brain & Borg | Collective sync, peer graph, Borg network |
|
|
228
|
+
| Debates & Challenges | Debate history, Advocatus Diaboli, resilience bars |
|
|
229
|
+
| Infrastructure | Watchdog monitoring, LLM usage, plugins, self-modification |
|
|
212
230
|
|
|
213
231
|
## MCP Tools (137 tools)
|
|
214
232
|
|
|
@@ -256,7 +274,7 @@ brain export Export Brain data as JSON
|
|
|
256
274
|
|
|
257
275
|
| Brain | Purpose | Ports |
|
|
258
276
|
|-------|---------|-------|
|
|
259
|
-
| **Brain** (this) | Error memory, code intelligence, full autonomy & self-modification | **7777** / 7778 /
|
|
277
|
+
| **Brain** (this) | Error memory, code intelligence, full autonomy & self-modification | **7777** / 7778 / 7790 |
|
|
260
278
|
| [Trading Brain](../trading-brain) | Adaptive trading intelligence with signal learning & paper trading | 7779 / 7780 |
|
|
261
279
|
| [Marketing Brain](../marketing-brain) | Content strategy, social engagement & cross-platform optimization | 7781 / 7782 / 7783 |
|
|
262
280
|
| [Brain Core](../brain-core) | Shared infrastructure — 72+ engines | — |
|
package/dist/brain.d.ts
CHANGED
package/dist/brain.js
CHANGED
|
@@ -56,8 +56,8 @@ import { McpHttpServer } from './mcp/http-server.js';
|
|
|
56
56
|
// Embeddings
|
|
57
57
|
import { EmbeddingEngine } from './embeddings/engine.js';
|
|
58
58
|
// Cross-Brain
|
|
59
|
-
import { CrossBrainClient, CrossBrainNotifier, CrossBrainSubscriptionManager, CrossBrainCorrelator, EcosystemService, WebhookService, ExportService, BackupService, AutonomousResearchScheduler, ResearchOrchestrator, DataMiner, BrainDataMinerAdapter, ScannerDataMinerAdapter, BootstrapService, DreamEngine, ThoughtStream, PredictionEngine, SignalScanner, CodeMiner, PatternExtractor, ContextBuilder, CodeGenerator, AttentionEngine, TransferEngine,
|
|
60
|
-
import { RAGEngine, RAGIndexer, KnowledgeGraphEngine, FactExtractor, SemanticCompressor, FeedbackEngine, ToolTracker, ToolPatternAnalyzer, ProactiveEngine, UserModel, CodeHealthMonitor, TeachingProtocol, Curriculum, ConsensusEngine, ActiveLearner, RepoAbsorber, FeatureExtractor } from '@timmeck/brain-core';
|
|
59
|
+
import { CrossBrainClient, CrossBrainNotifier, CrossBrainSubscriptionManager, CrossBrainCorrelator, EcosystemService, WebhookService, ExportService, BackupService, AutonomousResearchScheduler, ResearchOrchestrator, DataMiner, BrainDataMinerAdapter, ScannerDataMinerAdapter, BootstrapService, DreamEngine, ThoughtStream, PredictionEngine, SignalScanner, CodeMiner, PatternExtractor, ContextBuilder, CodeGenerator, AttentionEngine, TransferEngine, NarrativeEngine, CuriosityEngine, EmergenceEngine, DebateEngine, ParameterRegistry, MetaCognitionLayer, AutoExperimentEngine, SelfTestEngine, TeachEngine, DataScout, runDataScoutMigration, GitHubTrendingAdapter, NpmStatsAdapter, HackerNewsAdapter, SimulationEngine, runSimulationMigration, MemoryPalace, GoalEngine, EvolutionEngine, runEvolutionMigration, ReasoningEngine, EmotionalModel, SelfScanner, SelfModificationEngine, ConceptAbstraction, PeerNetwork, LLMService, OllamaProvider, ResearchMissionEngine, runMissionMigration, BraveSearchAdapter, JinaReaderAdapter, PlaywrightAdapter, FirecrawlAdapter, TechRadarEngine, runTechRadarMigration, NotificationService as MultiChannelNotificationService, runNotificationMigration, DiscordProvider, TelegramProvider, EmailProvider, CommandCenterServer, WatchdogService, createDefaultWatchdogConfig, PluginRegistry, BorgSyncEngine } from '@timmeck/brain-core';
|
|
60
|
+
import { RAGEngine, RAGIndexer, KnowledgeGraphEngine, FactExtractor, SemanticCompressor, FeedbackEngine, ToolTracker, ToolPatternAnalyzer, ProactiveEngine, UserModel, CodeHealthMonitor, TeachingProtocol, Curriculum, ConsensusEngine, ActiveLearner, RepoAbsorber, FeatureExtractor, FeatureRecommender } from '@timmeck/brain-core';
|
|
61
61
|
export class BrainCore {
|
|
62
62
|
db = null;
|
|
63
63
|
ipcServer = null;
|
|
@@ -75,7 +75,6 @@ export class BrainCore {
|
|
|
75
75
|
orchestrator = null;
|
|
76
76
|
attentionEngine = null;
|
|
77
77
|
transferEngine = null;
|
|
78
|
-
unifiedServer = null;
|
|
79
78
|
commandCenter = null;
|
|
80
79
|
narrativeEngine = null;
|
|
81
80
|
curiosityEngine = null;
|
|
@@ -879,6 +878,13 @@ export class BrainCore {
|
|
|
879
878
|
featureExtractor.setLLMService(services.llmService);
|
|
880
879
|
services.featureExtractor = featureExtractor;
|
|
881
880
|
repoAbsorber.setFeatureExtractor(featureExtractor);
|
|
881
|
+
// 68. FeatureRecommender — wishlist, connections, periodic need scanning
|
|
882
|
+
const featureRecommender = new FeatureRecommender(this.db);
|
|
883
|
+
featureRecommender.setFeatureExtractor(featureExtractor);
|
|
884
|
+
featureRecommender.setRAGEngine(ragEngine);
|
|
885
|
+
featureRecommender.setKnowledgeGraph(knowledgeGraph);
|
|
886
|
+
featureRecommender.setThoughtStream(thoughtStream);
|
|
887
|
+
services.featureRecommender = featureRecommender;
|
|
882
888
|
// ── Wire intelligence engines into autonomous ResearchOrchestrator ──
|
|
883
889
|
this.orchestrator.setFactExtractor(factExtractor);
|
|
884
890
|
this.orchestrator.setKnowledgeGraph(knowledgeGraph);
|
|
@@ -889,6 +895,7 @@ export class BrainCore {
|
|
|
889
895
|
this.orchestrator.setTeachingProtocol(teachingProtocol);
|
|
890
896
|
this.orchestrator.setCodeHealthMonitor(codeHealthMonitor);
|
|
891
897
|
this.orchestrator.setRepoAbsorber(repoAbsorber);
|
|
898
|
+
this.orchestrator.setFeatureRecommender(featureRecommender);
|
|
892
899
|
logger.info('Intelligence upgrade active (RAG, KG, Compression, Feedback, Tool-Learning, Proactive, UserModel, CodeHealth, Teaching, Consensus, ActiveLearning, RepoAbsorber — all wired into orchestrator)');
|
|
893
900
|
logger.info('Research orchestrator started (48+ steps, feedback loops active, DataMiner bootstrapped, Dream Mode active, Prediction Engine active)');
|
|
894
901
|
// 11k. Signal Scanner — GitHub/HN/Crypto signal tracking
|
|
@@ -973,144 +980,6 @@ export class BrainCore {
|
|
|
973
980
|
services.selfModificationEngine.setContextBuilder(selfmodCtx);
|
|
974
981
|
}
|
|
975
982
|
}
|
|
976
|
-
// 11n. Unified Dashboard — single Mission Control UI on :7788
|
|
977
|
-
const getNetworkState = () => {
|
|
978
|
-
try {
|
|
979
|
-
const nodes = [];
|
|
980
|
-
const projects = this.db.prepare('SELECT id, name AS label FROM projects LIMIT 20').all();
|
|
981
|
-
for (const p of projects)
|
|
982
|
-
nodes.push({ id: `project:${p.id}`, label: p.label, type: 'project', importance: 1.0 });
|
|
983
|
-
const errors = this.db.prepare('SELECT id, message AS label FROM errors LIMIT 50').all();
|
|
984
|
-
for (const e of errors)
|
|
985
|
-
nodes.push({ id: `error:${e.id}`, label: e.label.substring(0, 60), type: 'error', importance: 0.8 });
|
|
986
|
-
const solutions = this.db.prepare('SELECT id, description AS label FROM solutions LIMIT 30').all();
|
|
987
|
-
for (const s of solutions)
|
|
988
|
-
nodes.push({ id: `solution:${s.id}`, label: s.label.substring(0, 60), type: 'solution', importance: 0.7 });
|
|
989
|
-
const modules = this.db.prepare('SELECT id, name AS label FROM code_modules ORDER BY reusability_score DESC LIMIT 100').all();
|
|
990
|
-
for (const m of modules)
|
|
991
|
-
nodes.push({ id: `code_module:${m.id}`, label: m.label, type: 'code_module', importance: 0.5 });
|
|
992
|
-
const insights = this.db.prepare('SELECT id, title AS label, type FROM insights WHERE active = 1 ORDER BY priority DESC LIMIT 50').all();
|
|
993
|
-
for (const i of insights)
|
|
994
|
-
nodes.push({ id: `insight:${i.id}`, label: i.label.substring(0, 60), type: 'insight', importance: 0.6 });
|
|
995
|
-
const memories = this.db.prepare('SELECT id, content AS label, category AS type, importance FROM memories WHERE active = 1 LIMIT 50').all();
|
|
996
|
-
for (const m of memories)
|
|
997
|
-
nodes.push({ id: `memory:${m.id}`, label: m.label.substring(0, 60), type: m.type || 'memory', importance: m.importance });
|
|
998
|
-
const edges = this.db.prepare('SELECT source_type, source_id, target_type, target_id, weight FROM synapses ORDER BY weight DESC LIMIT 500').all();
|
|
999
|
-
const mappedEdges = edges.map(e => ({ source: `${e.source_type}:${e.source_id}`, target: `${e.target_type}:${e.target_id}`, weight: e.weight }));
|
|
1000
|
-
return { nodes, edges: mappedEdges };
|
|
1001
|
-
}
|
|
1002
|
-
catch {
|
|
1003
|
-
return { nodes: [], edges: [] };
|
|
1004
|
-
}
|
|
1005
|
-
};
|
|
1006
|
-
this.unifiedServer = new UnifiedDashboardServer({
|
|
1007
|
-
port: 7788,
|
|
1008
|
-
thoughtStream,
|
|
1009
|
-
getOverview: () => {
|
|
1010
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1011
|
-
const summary = this.orchestrator?.getSummary();
|
|
1012
|
-
const attStatus = this.attentionEngine?.getStatus();
|
|
1013
|
-
return {
|
|
1014
|
-
healthScore: typeof summary?.feedbackCycles === 'number' ? Math.min(100, 50 + summary.feedbackCycles) : null,
|
|
1015
|
-
brains: {
|
|
1016
|
-
brain: {
|
|
1017
|
-
status: this.db ? 'running' : 'stopped',
|
|
1018
|
-
cycle: summary?.feedbackCycles ?? 0,
|
|
1019
|
-
principles: summary?.knowledge?.principles ?? 0,
|
|
1020
|
-
hypotheses: summary?.hypotheses?.total ?? 0,
|
|
1021
|
-
experiments: Array.isArray(summary?.experiments) ? summary.experiments.length : 0,
|
|
1022
|
-
focus: attStatus?.currentContext ?? 'unknown',
|
|
1023
|
-
},
|
|
1024
|
-
},
|
|
1025
|
-
transfer: this.transferEngine?.getStatus(),
|
|
1026
|
-
attention: attStatus,
|
|
1027
|
-
};
|
|
1028
|
-
},
|
|
1029
|
-
getTransferStatus: () => {
|
|
1030
|
-
if (!this.transferEngine)
|
|
1031
|
-
return null;
|
|
1032
|
-
const status = this.transferEngine.getStatus();
|
|
1033
|
-
return {
|
|
1034
|
-
...status,
|
|
1035
|
-
analogies: this.transferEngine.getAnalogies(20),
|
|
1036
|
-
rules: this.transferEngine.getRules(),
|
|
1037
|
-
history: this.transferEngine.getTransferHistory(30),
|
|
1038
|
-
transferScore: this.transferEngine.getTransferScore(),
|
|
1039
|
-
};
|
|
1040
|
-
},
|
|
1041
|
-
getAttentionStatus: () => this.attentionEngine?.getStatus() ?? null,
|
|
1042
|
-
getNotifications: () => thoughtStream.getRecent(100).filter((t) => t.significance === 'breakthrough' || t.significance === 'notable'),
|
|
1043
|
-
onTriggerFeedback: () => { this.orchestrator?.runFeedbackCycle(); },
|
|
1044
|
-
getNetworkState,
|
|
1045
|
-
getEngineStatus: () => this.orchestrator?.getSummary(),
|
|
1046
|
-
codeGenerator: services.codeGenerator ?? null,
|
|
1047
|
-
codeMiner: services.codeMiner ?? null,
|
|
1048
|
-
patternExtractor: patternExtractor ?? null,
|
|
1049
|
-
selfModificationEngine: services.selfModificationEngine ?? null,
|
|
1050
|
-
getEmotionalStatus: () => services.emotionalModel?.getMood?.() ?? null,
|
|
1051
|
-
onChat: (question) => {
|
|
1052
|
-
if (!this.narrativeEngine)
|
|
1053
|
-
return { role: 'brain', content: 'NarrativeEngine not available yet.', timestamp: Date.now() };
|
|
1054
|
-
try {
|
|
1055
|
-
// Store user message as observation (Brain remembers conversations)
|
|
1056
|
-
this.orchestrator?.selfObserver?.record({
|
|
1057
|
-
event_type: 'user_chat',
|
|
1058
|
-
category: 'query_quality',
|
|
1059
|
-
metrics: { message: question, source: 'dashboard_chat' },
|
|
1060
|
-
});
|
|
1061
|
-
const explanation = this.narrativeEngine.explain(question);
|
|
1062
|
-
const answer = this.narrativeEngine.ask(question);
|
|
1063
|
-
const mood = services.emotionalModel?.getMood?.();
|
|
1064
|
-
const parts = [];
|
|
1065
|
-
if (answer.answer && answer.answer !== 'No relevant knowledge found.') {
|
|
1066
|
-
parts.push(answer.answer);
|
|
1067
|
-
}
|
|
1068
|
-
if (explanation.details.length > 0) {
|
|
1069
|
-
parts.push(explanation.details.slice(0, 5).join('\n'));
|
|
1070
|
-
}
|
|
1071
|
-
if (explanation.confidence > 0) {
|
|
1072
|
-
parts.push(`\nConfidence: ${(explanation.confidence * 100).toFixed(0)}%`);
|
|
1073
|
-
}
|
|
1074
|
-
if (parts.length === 0) {
|
|
1075
|
-
parts.push(`I don't have knowledge about "${question}" yet. This is now a research priority.`);
|
|
1076
|
-
// Add to research agenda
|
|
1077
|
-
this.orchestrator?.researchAgenda?.ask?.(`User asked: "${question}" — investigate and gather data`, 'knowledge_gap');
|
|
1078
|
-
}
|
|
1079
|
-
if (mood)
|
|
1080
|
-
parts.push(`\n[Mood: ${mood.mood}]`);
|
|
1081
|
-
return { role: 'brain', content: parts.join('\n'), timestamp: Date.now(), details: { explanation, answer } };
|
|
1082
|
-
}
|
|
1083
|
-
catch (err) {
|
|
1084
|
-
return { role: 'brain', content: `Error: ${err.message}`, timestamp: Date.now() };
|
|
1085
|
-
}
|
|
1086
|
-
},
|
|
1087
|
-
onIngest: (content, source) => {
|
|
1088
|
-
let items = 0;
|
|
1089
|
-
// Split content into lines/paragraphs and store as observations
|
|
1090
|
-
const lines = content.split(/\n+/).filter(l => l.trim().length > 5);
|
|
1091
|
-
for (const line of lines.slice(0, 100)) {
|
|
1092
|
-
this.orchestrator?.selfObserver?.record({
|
|
1093
|
-
event_type: 'data_ingest',
|
|
1094
|
-
category: 'tool_usage',
|
|
1095
|
-
metrics: { content: line.trim(), source },
|
|
1096
|
-
});
|
|
1097
|
-
items++;
|
|
1098
|
-
}
|
|
1099
|
-
// Also store as journal entry for narrative access
|
|
1100
|
-
if (this.orchestrator?.journal) {
|
|
1101
|
-
this.orchestrator.journal.recordDiscovery(`Data Ingested: ${source}`, content.slice(0, 2000), { source, items, timestamp: Date.now() }, 'routine');
|
|
1102
|
-
}
|
|
1103
|
-
// Emit thought about ingestion
|
|
1104
|
-
thoughtStream.emit('knowledge_distiller', 'discovering', `Ingested ${items} data points from "${source}"`, items > 10 ? 'notable' : 'routine');
|
|
1105
|
-
return { stored: true, items };
|
|
1106
|
-
},
|
|
1107
|
-
getLLMStats: () => services.llmService?.getStats() ?? null,
|
|
1108
|
-
getLLMHistory: (hours) => services.llmService?.getUsageHistory(hours) ?? [],
|
|
1109
|
-
getLLMByTemplate: () => services.llmService?.getUsageByTemplate() ?? [],
|
|
1110
|
-
});
|
|
1111
|
-
this.unifiedServer.start();
|
|
1112
|
-
services.unifiedServer = this.unifiedServer;
|
|
1113
|
-
logger.info('Unified Mission Control dashboard on :7788');
|
|
1114
983
|
// 11c. Watchdog — monitoring only (detect peers via PID, run health checks)
|
|
1115
984
|
const watchdogConfig = createDefaultWatchdogConfig();
|
|
1116
985
|
const watchdog = new WatchdogService(watchdogConfig);
|
|
@@ -1198,6 +1067,10 @@ export class BrainCore {
|
|
|
1198
1067
|
userModel: services.userModel?.getStatus() ?? null,
|
|
1199
1068
|
userProfile: services.userModel?.getProfile() ?? null,
|
|
1200
1069
|
}),
|
|
1070
|
+
getEmotionalStatus: () => {
|
|
1071
|
+
const mood = services.emotionalModel?.getMood?.();
|
|
1072
|
+
return mood ?? { mood: 'reflective', score: 0.5, valence: 0, arousal: 0, dimensions: {} };
|
|
1073
|
+
},
|
|
1201
1074
|
getDebateStatus: () => this.debateEngine?.getStatus() ?? null,
|
|
1202
1075
|
getDebateList: (limit = 10) => this.debateEngine?.listDebates(limit) ?? [],
|
|
1203
1076
|
getChallengeHistory: (limit = 20) => this.debateEngine?.getChallengeHistory(limit) ?? [],
|
|
@@ -1215,11 +1088,14 @@ export class BrainCore {
|
|
|
1215
1088
|
},
|
|
1216
1089
|
});
|
|
1217
1090
|
this.commandCenter.start();
|
|
1091
|
+
services.commandCenter = this.commandCenter;
|
|
1218
1092
|
logger.info('Command Center dashboard on :7790');
|
|
1219
1093
|
// 12. IPC Server
|
|
1220
1094
|
const router = new IpcRouter(services);
|
|
1221
1095
|
this.ipcServer = new IpcServer(router, config.ipc.pipeName, 'brain', 'brain');
|
|
1222
1096
|
this.ipcServer.start();
|
|
1097
|
+
// Wire local handler so cross-brain self-queries resolve locally
|
|
1098
|
+
this.crossBrain.setLocalHandler((method, params) => router.handle(method, params));
|
|
1223
1099
|
// Wire subscription manager into IPC router
|
|
1224
1100
|
router.setSubscriptionManager(this.subscriptionManager, this.ipcServer);
|
|
1225
1101
|
// 12c. Plugin Registry — load community plugins (registry created at 11d)
|
|
@@ -1442,7 +1318,6 @@ export class BrainCore {
|
|
|
1442
1318
|
this.subscriptionManager?.disconnectAll();
|
|
1443
1319
|
this.attentionEngine?.stop();
|
|
1444
1320
|
this.commandCenter?.stop();
|
|
1445
|
-
this.unifiedServer?.stop();
|
|
1446
1321
|
this.orchestrator?.stop();
|
|
1447
1322
|
this.researchScheduler?.stop();
|
|
1448
1323
|
this.researchEngine?.stop();
|
|
@@ -1460,7 +1335,6 @@ export class BrainCore {
|
|
|
1460
1335
|
this.learningEngine = null;
|
|
1461
1336
|
this.researchEngine = null;
|
|
1462
1337
|
this.orchestrator = null;
|
|
1463
|
-
this.unifiedServer = null;
|
|
1464
1338
|
this.commandCenter = null;
|
|
1465
1339
|
this.narrativeEngine = null;
|
|
1466
1340
|
this.curiosityEngine = null;
|