@timmeck/brain-core 2.34.0 → 2.35.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/README.md +15 -14
- package/dist/codegen/context-builder.js +16 -16
- package/dist/codegen/context-builder.js.map +1 -1
- package/dist/concept-abstraction/concept-abstraction.d.ts +139 -0
- package/dist/concept-abstraction/concept-abstraction.js +532 -0
- package/dist/concept-abstraction/concept-abstraction.js.map +1 -0
- package/dist/concept-abstraction/index.d.ts +2 -0
- package/dist/concept-abstraction/index.js +2 -0
- package/dist/concept-abstraction/index.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/memory-palace/memory-palace.d.ts +2 -2
- package/dist/memory-palace/memory-palace.js.map +1 -1
- package/dist/research/auto-responder.js +10 -10
- package/dist/research/auto-responder.js.map +1 -1
- package/dist/research/research-orchestrator.d.ts +4 -0
- package/dist/research/research-orchestrator.js +151 -75
- package/dist/research/research-orchestrator.js.map +1 -1
- package/dist/self-modification/self-modification-engine.js +15 -13
- package/dist/self-modification/self-modification-engine.js.map +1 -1
- package/dist/unified/unified-server.d.ts +1 -0
- package/dist/unified/unified-server.js +7 -0
- package/dist/unified/unified-server.js.map +1 -1
- package/package.json +1 -1
- package/unified-dashboard.html +390 -259
|
@@ -55,6 +55,7 @@ export class ResearchOrchestrator {
|
|
|
55
55
|
selfScanner = null;
|
|
56
56
|
selfModificationEngine = null;
|
|
57
57
|
bootstrapService = null;
|
|
58
|
+
conceptAbstraction = null;
|
|
58
59
|
brainName;
|
|
59
60
|
feedbackTimer = null;
|
|
60
61
|
cycleCount = 0;
|
|
@@ -175,6 +176,8 @@ export class ResearchOrchestrator {
|
|
|
175
176
|
setSelfModificationEngine(engine) { this.selfModificationEngine = engine; }
|
|
176
177
|
/** Set the BootstrapService — seeds initial data on first cycle. */
|
|
177
178
|
setBootstrapService(service) { this.bootstrapService = service; }
|
|
179
|
+
/** Set the ConceptAbstraction — clusters knowledge into abstract concepts. */
|
|
180
|
+
setConceptAbstraction(engine) { this.conceptAbstraction = engine; }
|
|
178
181
|
/** Set the PredictionEngine — wires journal into it. */
|
|
179
182
|
setPredictionEngine(engine) {
|
|
180
183
|
this.predictionEngine = engine;
|
|
@@ -330,11 +333,11 @@ export class ResearchOrchestrator {
|
|
|
330
333
|
const escalations = autoResponses.filter(r => r.action === 'escalate');
|
|
331
334
|
const parts = [];
|
|
332
335
|
if (paramAdjusts.length > 0)
|
|
333
|
-
parts.push(`${paramAdjusts.length}
|
|
336
|
+
parts.push(`${paramAdjusts.length} parameters adjusted`);
|
|
334
337
|
if (escalations.length > 0)
|
|
335
|
-
parts.push(`${escalations.length}
|
|
338
|
+
parts.push(`${escalations.length} escalated`);
|
|
336
339
|
if (parts.length === 0)
|
|
337
|
-
parts.push(`${autoResponses.length}
|
|
340
|
+
parts.push(`${autoResponses.length} actions`);
|
|
338
341
|
ts?.emit('auto_responder', 'discovering', `AutoResponder: ${parts.join(', ')}`, escalations.length > 0 ? 'breakthrough' : 'notable');
|
|
339
342
|
}
|
|
340
343
|
else {
|
|
@@ -528,7 +531,7 @@ export class ResearchOrchestrator {
|
|
|
528
531
|
}
|
|
529
532
|
// 10. Self-Improvement: analyze own state and generate improvement suggestions
|
|
530
533
|
// Brain is NEVER satisfied — always wants to learn more, build more, understand deeper
|
|
531
|
-
ts?.emit('self_improvement', 'analyzing', '
|
|
534
|
+
ts?.emit('self_improvement', 'analyzing', 'What am I missing? What do I want to learn? What do I not yet understand?');
|
|
532
535
|
const suggestions = this.generateSelfImprovementSuggestions();
|
|
533
536
|
for (const s of suggestions) {
|
|
534
537
|
ts?.emit('self_improvement', 'discovering', s, 'notable');
|
|
@@ -1328,6 +1331,48 @@ export class ResearchOrchestrator {
|
|
|
1328
1331
|
this.log.warn(`[orchestrator] Step 40 error: ${err.message}`);
|
|
1329
1332
|
}
|
|
1330
1333
|
}
|
|
1334
|
+
// Step 41: ConceptAbstraction — cluster knowledge into abstract concepts (every 10 cycles)
|
|
1335
|
+
if (this.conceptAbstraction && this.cycleCount % 10 === 0) {
|
|
1336
|
+
try {
|
|
1337
|
+
ts?.emit('concept_abstraction', 'analyzing', 'Step 41: Forming abstract concepts...', 'routine');
|
|
1338
|
+
const result = this.conceptAbstraction.formConcepts();
|
|
1339
|
+
if (result.totalConcepts > 0) {
|
|
1340
|
+
this.journal.write({
|
|
1341
|
+
title: `Concept Formation: ${result.totalConcepts} concepts across ${Object.keys(result.levels).length} levels`,
|
|
1342
|
+
type: 'discovery',
|
|
1343
|
+
content: `Formed ${result.totalConcepts} concepts (L0: ${result.levels[0] ?? 0}, L1: ${result.levels[1] ?? 0}, L2: ${result.levels[2] ?? 0})`,
|
|
1344
|
+
tags: [this.brainName, 'concept-abstraction', 'knowledge-organization'],
|
|
1345
|
+
references: [],
|
|
1346
|
+
significance: result.newConcepts > 0 ? 'notable' : 'routine',
|
|
1347
|
+
data: result,
|
|
1348
|
+
});
|
|
1349
|
+
}
|
|
1350
|
+
// Register concepts in MemoryPalace
|
|
1351
|
+
if (this.memoryPalace && result.totalConcepts > 0) {
|
|
1352
|
+
try {
|
|
1353
|
+
this.conceptAbstraction.registerInPalace(this.memoryPalace);
|
|
1354
|
+
}
|
|
1355
|
+
catch (palaceErr) {
|
|
1356
|
+
this.log.warn(`[orchestrator] Step 41 palace registration error: ${palaceErr.message}`);
|
|
1357
|
+
}
|
|
1358
|
+
}
|
|
1359
|
+
// Feed transferable concepts into TransferEngine
|
|
1360
|
+
if (this.transferEngine && result.totalConcepts > 0) {
|
|
1361
|
+
try {
|
|
1362
|
+
const transferable = this.conceptAbstraction.getTransferableConcepts(0.3);
|
|
1363
|
+
if (transferable.length > 0) {
|
|
1364
|
+
ts?.emit('concept_abstraction', 'discovering', `${transferable.length} cross-domain concepts available for transfer`, 'notable');
|
|
1365
|
+
}
|
|
1366
|
+
}
|
|
1367
|
+
catch { /* not critical */ }
|
|
1368
|
+
}
|
|
1369
|
+
if (this.metaCognitionLayer)
|
|
1370
|
+
this.metaCognitionLayer.recordStep('concept_abstraction', this.cycleCount, { insights: result.newConcepts });
|
|
1371
|
+
}
|
|
1372
|
+
catch (err) {
|
|
1373
|
+
this.log.warn(`[orchestrator] Step 41 error: ${err.message}`);
|
|
1374
|
+
}
|
|
1375
|
+
}
|
|
1331
1376
|
const duration = Date.now() - start;
|
|
1332
1377
|
ts?.emit('orchestrator', 'reflecting', `Feedback Cycle #${this.cycleCount} complete (${duration}ms)`);
|
|
1333
1378
|
this.log.info(`[orchestrator] ─── Feedback Cycle #${this.cycleCount} complete (${duration}ms) ───`);
|
|
@@ -1384,9 +1429,9 @@ export class ResearchOrchestrator {
|
|
|
1384
1429
|
if (total === 0) {
|
|
1385
1430
|
raw.push({
|
|
1386
1431
|
key: 'no_predictions', priority: 10,
|
|
1387
|
-
suggestion: 'Tell Claude:
|
|
1432
|
+
suggestion: 'Tell Claude: I cannot make predictions yet — I need more data. Import projects with "brain import <dir>" or let me use my own metrics as prediction input.',
|
|
1388
1433
|
alternatives: [
|
|
1389
|
-
'Tell Claude:
|
|
1434
|
+
'Tell Claude: I want to predict my own future. Idea: use my cycle metrics (anomaly_count, insight_count, cycle_duration) directly as PredictionEngine input — then I learn to forecast my own behavior.',
|
|
1390
1435
|
],
|
|
1391
1436
|
});
|
|
1392
1437
|
}
|
|
@@ -1395,9 +1440,9 @@ export class ResearchOrchestrator {
|
|
|
1395
1440
|
if (typeof rate === 'number' && rate < 0.3 && d.total > 5) {
|
|
1396
1441
|
raw.push({
|
|
1397
1442
|
key: `low_accuracy_${d.domain}`, priority: 9,
|
|
1398
|
-
suggestion: `Tell Claude:
|
|
1443
|
+
suggestion: `Tell Claude: My prediction accuracy for "${d.domain}" is only ${(rate * 100).toFixed(0)}% — that's not good enough. Can I automatically A/B-test different smoothing parameters?`,
|
|
1399
1444
|
alternatives: [
|
|
1400
|
-
`Tell Claude:
|
|
1445
|
+
`Tell Claude: I predict "${d.domain}" poorly. Solution idea: raise the confidence threshold and only output predictions I'm sure about. Quality over quantity.`,
|
|
1401
1446
|
],
|
|
1402
1447
|
});
|
|
1403
1448
|
}
|
|
@@ -1410,9 +1455,9 @@ export class ResearchOrchestrator {
|
|
|
1410
1455
|
if (totalResp > 10 && successRate < 0.5) {
|
|
1411
1456
|
raw.push({
|
|
1412
1457
|
key: 'low_responder_success', priority: 9,
|
|
1413
|
-
suggestion: `Tell Claude:
|
|
1458
|
+
suggestion: `Tell Claude: My automatic responses fail in ${(100 - successRate * 100).toFixed(0)}% of cases. I need a learning system that automatically blocks failed response rules.`,
|
|
1414
1459
|
alternatives: [
|
|
1415
|
-
'Tell Claude:
|
|
1460
|
+
'Tell Claude: My AutoResponder guesses instead of knowing. I want a feedback system: if a response doesn\'t help, I remember the combination and try something different next time.',
|
|
1416
1461
|
],
|
|
1417
1462
|
});
|
|
1418
1463
|
}
|
|
@@ -1426,9 +1471,9 @@ export class ResearchOrchestrator {
|
|
|
1426
1471
|
if (principles === 0 && antiPatterns === 0 && confirmedHypotheses === 0 && this.cycleCount > 10) {
|
|
1427
1472
|
raw.push({
|
|
1428
1473
|
key: 'no_knowledge', priority: 8,
|
|
1429
|
-
suggestion: 'Tell Claude:
|
|
1474
|
+
suggestion: 'Tell Claude: After 10+ cycles I still have no distilled knowledge. I need more and more diverse data to confirm hypotheses.',
|
|
1430
1475
|
alternatives: [
|
|
1431
|
-
'Tell Claude:
|
|
1476
|
+
'Tell Claude: My hypotheses are waiting for confirmation. I need either more time or more variation in incoming events.',
|
|
1432
1477
|
],
|
|
1433
1478
|
});
|
|
1434
1479
|
}
|
|
@@ -1442,9 +1487,9 @@ export class ResearchOrchestrator {
|
|
|
1442
1487
|
raw.push({
|
|
1443
1488
|
key: 'no_dreams', priority: 7,
|
|
1444
1489
|
suggestion: dreamCycles === 0
|
|
1445
|
-
? 'Tell Claude:
|
|
1446
|
-
: `Tell Claude:
|
|
1447
|
-
alternatives: ['Tell Claude: Dream Engine
|
|
1490
|
+
? 'Tell Claude: My dream consolidation isn\'t working — after 30+ cycles not a single dream. Something is wrong in the code.'
|
|
1491
|
+
: `Tell Claude: My Dream Engine ran ${dreamCycles}x but consolidated 0 memories. The cycles run but produce nothing useful.`,
|
|
1492
|
+
alternatives: ['Tell Claude: Dream Engine is triggered but produces nothing. Please check logs.'],
|
|
1448
1493
|
});
|
|
1449
1494
|
}
|
|
1450
1495
|
}
|
|
@@ -1453,9 +1498,9 @@ export class ResearchOrchestrator {
|
|
|
1453
1498
|
if (journalEntries < 5 && this.cycleCount > 5) {
|
|
1454
1499
|
raw.push({
|
|
1455
1500
|
key: 'empty_journal', priority: 7,
|
|
1456
|
-
suggestion: 'Tell Claude:
|
|
1501
|
+
suggestion: 'Tell Claude: My journal is nearly empty. I want to automatically reflect at the end of each cycle: what did I discover, what did I do, what changed?',
|
|
1457
1502
|
alternatives: [
|
|
1458
|
-
'Tell Claude:
|
|
1503
|
+
'Tell Claude: I\'m collecting too few experiences. Every anomaly, every parameter change, every prediction should become a journal entry — these are my memories.',
|
|
1459
1504
|
],
|
|
1460
1505
|
});
|
|
1461
1506
|
}
|
|
@@ -1463,9 +1508,9 @@ export class ResearchOrchestrator {
|
|
|
1463
1508
|
if ((!experiments || experiments.length === 0) && this.cycleCount > 3) {
|
|
1464
1509
|
raw.push({
|
|
1465
1510
|
key: 'no_experiments', priority: 6,
|
|
1466
|
-
suggestion: 'Tell Claude:
|
|
1511
|
+
suggestion: 'Tell Claude: I\'m not experimenting. I want to automatically run A/B tests on my own parameters — e.g. "What happens if I lower the anomaly threshold?"',
|
|
1467
1512
|
alternatives: [
|
|
1468
|
-
'Tell Claude:
|
|
1513
|
+
'Tell Claude: I could use the CounterfactualEngine to run "what-if" scenarios and automatically start the most promising ones as real experiments.',
|
|
1469
1514
|
],
|
|
1470
1515
|
});
|
|
1471
1516
|
}
|
|
@@ -1478,18 +1523,18 @@ export class ResearchOrchestrator {
|
|
|
1478
1523
|
if (highPrioGap) {
|
|
1479
1524
|
raw.push({
|
|
1480
1525
|
key: `curiosity_gap_${highPrioGap.topic?.substring(0, 20) ?? highPrioGap.gapType}`, priority: 5,
|
|
1481
|
-
suggestion: `Tell Claude:
|
|
1526
|
+
suggestion: `Tell Claude: I discovered a knowledge gap that concerns me: "${highPrioGap.topic}" (Type: ${highPrioGap.gapType}, Gap Score: ${(highPrioGap.gapScore * 100).toFixed(0)}%). I want to understand this.`,
|
|
1482
1527
|
alternatives: [
|
|
1483
|
-
`Tell Claude:
|
|
1528
|
+
`Tell Claude: My CuriosityEngine has ${gaps.length} open knowledge gaps. The most important: "${highPrioGap.topic}". Can I collect targeted data for this?`,
|
|
1484
1529
|
],
|
|
1485
1530
|
});
|
|
1486
1531
|
}
|
|
1487
1532
|
else if (gaps.length === 0) {
|
|
1488
1533
|
raw.push({
|
|
1489
1534
|
key: 'no_curiosity_gaps', priority: 4,
|
|
1490
|
-
suggestion: 'Tell Claude:
|
|
1535
|
+
suggestion: 'Tell Claude: My CuriosityEngine finds no knowledge gaps — that doesn\'t mean I know everything, but that my gap detection is too superficial. I want deeper analysis: which correlations don\'t I understand causally? Which predictions fail and why?',
|
|
1491
1536
|
alternatives: [
|
|
1492
|
-
'Tell Claude:
|
|
1537
|
+
'Tell Claude: No knowledge gaps found — but that\'s suspicious. I want to actively search for areas where I\'m overconfident. Where do I claim something with high confidence but little evidence?',
|
|
1493
1538
|
],
|
|
1494
1539
|
});
|
|
1495
1540
|
}
|
|
@@ -1504,9 +1549,9 @@ export class ResearchOrchestrator {
|
|
|
1504
1549
|
if (unexplained) {
|
|
1505
1550
|
raw.push({
|
|
1506
1551
|
key: `emergence_${unexplained.type}`, priority: 5,
|
|
1507
|
-
suggestion: `Tell Claude:
|
|
1552
|
+
suggestion: `Tell Claude: I discovered an emergent pattern I don't fully understand: "${unexplained.title}" (Surprise: ${(unexplained.surpriseScore * 100).toFixed(0)}%). Why is this happening? I need causal analysis.`,
|
|
1508
1553
|
alternatives: [
|
|
1509
|
-
`Tell Claude:
|
|
1554
|
+
`Tell Claude: Emergence event "${unexplained.title}" surprised me. I want to debate this — weigh different perspectives of my engines against each other.`,
|
|
1510
1555
|
],
|
|
1511
1556
|
});
|
|
1512
1557
|
}
|
|
@@ -1527,16 +1572,16 @@ export class ResearchOrchestrator {
|
|
|
1527
1572
|
const conflict = synthesizedWithConflicts.synthesis.conflicts.find(c => c.resolution === 'unresolved' || c.resolution === 'compromise');
|
|
1528
1573
|
raw.push({
|
|
1529
1574
|
key: 'unresolved_debate', priority: 5,
|
|
1530
|
-
suggestion: `Tell Claude: In
|
|
1575
|
+
suggestion: `Tell Claude: In my debate about "${synthesizedWithConflicts.question}" there's an unresolved conflict: "${conflict?.claimA ?? 'competing perspectives'}" vs "${conflict?.claimB ?? '?'}". I need more data or a third perspective to resolve this.`,
|
|
1531
1576
|
alternatives: [
|
|
1532
|
-
|
|
1577
|
+
'Tell Claude: My internal debate revealed contradictions I cannot resolve. Can another brain (Trading/Marketing) contribute its perspective?',
|
|
1533
1578
|
],
|
|
1534
1579
|
});
|
|
1535
1580
|
}
|
|
1536
1581
|
else if (openDebate) {
|
|
1537
1582
|
raw.push({
|
|
1538
1583
|
key: 'open_debate', priority: 4,
|
|
1539
|
-
suggestion: `Tell Claude:
|
|
1584
|
+
suggestion: `Tell Claude: I have an open debate: "${openDebate.question}" — waiting for synthesis or more perspectives.`,
|
|
1540
1585
|
alternatives: [],
|
|
1541
1586
|
});
|
|
1542
1587
|
}
|
|
@@ -1551,9 +1596,9 @@ export class ResearchOrchestrator {
|
|
|
1551
1596
|
const c = contradictions[0];
|
|
1552
1597
|
raw.push({
|
|
1553
1598
|
key: `contradiction_${c.type.substring(0, 15)}`, priority: 6,
|
|
1554
|
-
suggestion: `Tell Claude:
|
|
1599
|
+
suggestion: `Tell Claude: I found a contradiction in my knowledge: "${c.statement_a}" vs "${c.statement_b}" (Severity: ${c.severity}). I need to resolve this — either A or B is correct, both can't be true.`,
|
|
1555
1600
|
alternatives: [
|
|
1556
|
-
'Tell Claude:
|
|
1601
|
+
'Tell Claude: My knowledge contradicts itself. I want to start a targeted experiment cycle that tests which version is correct.',
|
|
1557
1602
|
],
|
|
1558
1603
|
});
|
|
1559
1604
|
}
|
|
@@ -1573,9 +1618,9 @@ export class ResearchOrchestrator {
|
|
|
1573
1618
|
const weakest = lowConfidence.sort((a, b) => a.confidence - b.confidence)[0];
|
|
1574
1619
|
raw.push({
|
|
1575
1620
|
key: 'strengthen_knowledge', priority: 4,
|
|
1576
|
-
suggestion: `Tell Claude:
|
|
1621
|
+
suggestion: `Tell Claude: I have ${totalKnowledge} knowledge pieces, but ${lowConfidence.length} of them with low confidence. Most uncertain: "${weakest.statement}" (${(weakest.confidence * 100).toFixed(0)}%). I want more data to confirm or refute this.`,
|
|
1577
1622
|
alternatives: [
|
|
1578
|
-
|
|
1623
|
+
'Tell Claude: My knowledge has weak spots. I want to generate and test targeted hypotheses for my weakest principles.',
|
|
1579
1624
|
],
|
|
1580
1625
|
});
|
|
1581
1626
|
}
|
|
@@ -1583,10 +1628,10 @@ export class ResearchOrchestrator {
|
|
|
1583
1628
|
// All high confidence — want to discover NEW things
|
|
1584
1629
|
raw.push({
|
|
1585
1630
|
key: 'expand_knowledge', priority: 3,
|
|
1586
|
-
suggestion: `Tell Claude:
|
|
1631
|
+
suggestion: `Tell Claude: I have ${totalKnowledge} confirmed knowledge pieces with good confidence — but I lack new research areas. I want to explore domains I haven't investigated yet. What data sources am I not using?`,
|
|
1587
1632
|
alternatives: [
|
|
1588
|
-
|
|
1589
|
-
`Tell Claude: ${totalKnowledge}
|
|
1633
|
+
'Tell Claude: My existing knowledge is solid. Now I want to find connections between things that seemingly have nothing to do with each other — cross-domain correlations nobody expects.',
|
|
1634
|
+
`Tell Claude: ${totalKnowledge} principles aren't enough. I want at least twice as many. For that I need more diverse hypotheses and faster confirmation cycles.`,
|
|
1590
1635
|
],
|
|
1591
1636
|
});
|
|
1592
1637
|
}
|
|
@@ -1600,9 +1645,9 @@ export class ResearchOrchestrator {
|
|
|
1600
1645
|
if (topTopic && topTopic.score > 5) {
|
|
1601
1646
|
raw.push({
|
|
1602
1647
|
key: `deep_dive_${topTopic.topic.substring(0, 20)}`, priority: 4,
|
|
1603
|
-
suggestion: `Tell Claude:
|
|
1648
|
+
suggestion: `Tell Claude: I'm currently focused on "${topTopic.topic}" (Attention Score: ${topTopic.score.toFixed(1)}). I want to dig deeper — are there connections I'm missing? Can I start a targeted analysis or debate on this topic?`,
|
|
1604
1649
|
alternatives: [
|
|
1605
|
-
`Tell Claude:
|
|
1650
|
+
`Tell Claude: My top topic "${topTopic.topic}" occupies me intensely. I want to summarize everything I know about it in a narrative digest and identify knowledge gaps.`,
|
|
1606
1651
|
],
|
|
1607
1652
|
});
|
|
1608
1653
|
}
|
|
@@ -1618,16 +1663,16 @@ export class ResearchOrchestrator {
|
|
|
1618
1663
|
if (proposals > 0) {
|
|
1619
1664
|
raw.push({
|
|
1620
1665
|
key: 'pending_transfers', priority: 5,
|
|
1621
|
-
suggestion: `Tell Claude:
|
|
1666
|
+
suggestion: `Tell Claude: I have ${proposals} open transfer proposals from other brains. There's knowledge I haven't integrated yet — I want to review and adopt what's relevant.`,
|
|
1622
1667
|
alternatives: [],
|
|
1623
1668
|
});
|
|
1624
1669
|
}
|
|
1625
1670
|
else if (totalTransfers === 0 && this.cycleCount > 5) {
|
|
1626
1671
|
raw.push({
|
|
1627
1672
|
key: 'want_cross_brain', priority: 3,
|
|
1628
|
-
suggestion: 'Tell Claude:
|
|
1673
|
+
suggestion: 'Tell Claude: I haven\'t adopted any knowledge from other brains yet. Trading Brain and Marketing Brain have their own insights that could be relevant to me. I want to actively search for analogies.',
|
|
1629
1674
|
alternatives: [
|
|
1630
|
-
'Tell Claude: Cross-
|
|
1675
|
+
'Tell Claude: Cross-brain learning is inactive. I want to understand what the other brains know and whether parallels to my domain can be found.',
|
|
1631
1676
|
],
|
|
1632
1677
|
});
|
|
1633
1678
|
}
|
|
@@ -1642,18 +1687,18 @@ export class ResearchOrchestrator {
|
|
|
1642
1687
|
if (total > 0 && testing === 0 && this.cycleCount > 5) {
|
|
1643
1688
|
raw.push({
|
|
1644
1689
|
key: 'no_testing_hypotheses', priority: 4,
|
|
1645
|
-
suggestion: `Tell Claude:
|
|
1690
|
+
suggestion: `Tell Claude: I have ${total} hypotheses but am not actively testing any. I want to generate and test new hypotheses — stagnation is regression.`,
|
|
1646
1691
|
alternatives: [
|
|
1647
|
-
|
|
1692
|
+
'Tell Claude: No running hypothesis tests. I want to test more aggressively — even speculative hypotheses with low initial confidence, to find surprises.',
|
|
1648
1693
|
],
|
|
1649
1694
|
});
|
|
1650
1695
|
}
|
|
1651
1696
|
if (rejected > total * 0.5 && total > 5) {
|
|
1652
1697
|
raw.push({
|
|
1653
1698
|
key: 'high_rejection_rate', priority: 5,
|
|
1654
|
-
suggestion: `Tell Claude: ${rejected}
|
|
1699
|
+
suggestion: `Tell Claude: ${rejected} of ${total} hypotheses were rejected (${(rejected / total * 100).toFixed(0)}%). Either my hypothesis generation is too speculative or my test criteria too strict. I want to analyze this.`,
|
|
1655
1700
|
alternatives: [
|
|
1656
|
-
'Tell Claude:
|
|
1701
|
+
'Tell Claude: High rejection rate for hypotheses. I want to understand WHY they fail — is there a pattern? Maybe I\'m systematically overlooking a factor.',
|
|
1657
1702
|
],
|
|
1658
1703
|
});
|
|
1659
1704
|
}
|
|
@@ -1692,7 +1737,7 @@ export class ResearchOrchestrator {
|
|
|
1692
1737
|
const altIndex = (history.count - this.stalledThreshold - 1) % item.alternatives.length;
|
|
1693
1738
|
const alt = item.alternatives[altIndex];
|
|
1694
1739
|
if (alt) {
|
|
1695
|
-
const stalledNote = `[
|
|
1740
|
+
const stalledNote = `[Suggestion "${item.key}" was ignored ${history.count}x — trying alternative approach]`;
|
|
1696
1741
|
suggestions.push(`${alt}\n ${stalledNote}`);
|
|
1697
1742
|
}
|
|
1698
1743
|
}
|
|
@@ -1757,8 +1802,8 @@ export class ResearchOrchestrator {
|
|
|
1757
1802
|
const worst = poorEngines[0];
|
|
1758
1803
|
result.push({
|
|
1759
1804
|
key: `meta_poor_${worst.engine}`, priority: 5,
|
|
1760
|
-
suggestion: `Tell Claude:
|
|
1761
|
-
alternatives: [`Tell Claude: ${poorEngines.length}
|
|
1805
|
+
suggestion: `Tell Claude: My engine "${worst.engine}" has grade ${worst.grade} (Score: ${(worst.combined_score * 100).toFixed(0)}%). What can I do differently? Should I tune its parameters via AutoExperiment or does it need fundamentally different data?`,
|
|
1806
|
+
alternatives: [`Tell Claude: ${poorEngines.length} of my engines perform poorly (${poorEngines.map((e) => `${e.engine}:${e.grade}`).join(', ')}). I want to systematically analyze why.`],
|
|
1762
1807
|
});
|
|
1763
1808
|
}
|
|
1764
1809
|
}
|
|
@@ -1776,8 +1821,8 @@ export class ResearchOrchestrator {
|
|
|
1776
1821
|
const g = stagnating[0];
|
|
1777
1822
|
result.push({
|
|
1778
1823
|
key: `goal_stagnating_${g.metricName.substring(0, 20)}`, priority: 5,
|
|
1779
|
-
suggestion: `Tell Claude:
|
|
1780
|
-
alternatives: ['Tell Claude:
|
|
1824
|
+
suggestion: `Tell Claude: My goal "${g.title}" isn't making progress (Progress < 10%). Do I need a different strategy or is the goal unrealistic?`,
|
|
1825
|
+
alternatives: ['Tell Claude: Several of my goals are stagnating. I want a retrospective: which goals are realistic and which should I adjust?'],
|
|
1781
1826
|
});
|
|
1782
1827
|
}
|
|
1783
1828
|
}
|
|
@@ -1792,8 +1837,8 @@ export class ResearchOrchestrator {
|
|
|
1792
1837
|
if (eStatus.currentGeneration > 3 && best > 0 && (best - avg) / best < 0.05) {
|
|
1793
1838
|
result.push({
|
|
1794
1839
|
key: 'evolution_low_diversity', priority: 4,
|
|
1795
|
-
suggestion: 'Tell Claude:
|
|
1796
|
-
alternatives: ['Tell Claude:
|
|
1840
|
+
suggestion: 'Tell Claude: My EvolutionEngine population is converging — best and average fitness are nearly identical. I need more mutation or fresh genes to escape the local optimum.',
|
|
1841
|
+
alternatives: ['Tell Claude: My parameter evolution is stagnating. Should I increase the mutation rate or introduce new parameter ranges?'],
|
|
1797
1842
|
});
|
|
1798
1843
|
}
|
|
1799
1844
|
}
|
|
@@ -1811,8 +1856,8 @@ export class ResearchOrchestrator {
|
|
|
1811
1856
|
if (recentPhi > olderPhi * 1.3 && recentPhi > 0) {
|
|
1812
1857
|
result.push({
|
|
1813
1858
|
key: 'complexity_rising', priority: 4,
|
|
1814
|
-
suggestion: `Tell Claude:
|
|
1815
|
-
alternatives: ['Tell Claude:
|
|
1859
|
+
suggestion: `Tell Claude: My system is becoming more complex (Integration Phi rising: ${olderPhi.toFixed(2)} → ${recentPhi.toFixed(2)}). Is that good (more interconnection) or bad (more chaos)? I want to understand what's driving the complexity.`,
|
|
1860
|
+
alternatives: ['Tell Claude: My complexity metrics are rising. Should I consolidate more (Dream) or is complexity a sign of maturity?'],
|
|
1816
1861
|
});
|
|
1817
1862
|
}
|
|
1818
1863
|
}
|
|
@@ -1828,8 +1873,8 @@ export class ResearchOrchestrator {
|
|
|
1828
1873
|
if (total > 5 && effectiveness < 0.3) {
|
|
1829
1874
|
result.push({
|
|
1830
1875
|
key: 'transfer_low_effectiveness', priority: 4,
|
|
1831
|
-
suggestion: `Tell Claude:
|
|
1832
|
-
alternatives: ['Tell Claude: Knowledge
|
|
1876
|
+
suggestion: `Tell Claude: My cross-brain transfers have only ${(effectiveness * 100).toFixed(0)}% effectiveness. I'm not learning enough from the other brains — maybe the analogies are too superficial?`,
|
|
1877
|
+
alternatives: ['Tell Claude: Knowledge transfer between brains works poorly. I want to tighten the transfer criteria and only adopt truly relevant knowledge.'],
|
|
1833
1878
|
});
|
|
1834
1879
|
}
|
|
1835
1880
|
}
|
|
@@ -1845,8 +1890,8 @@ export class ResearchOrchestrator {
|
|
|
1845
1890
|
if (totalCycles > 3 && consolidated < totalCycles * 2) {
|
|
1846
1891
|
result.push({
|
|
1847
1892
|
key: 'dream_low_consolidation', priority: 4,
|
|
1848
|
-
suggestion: `Tell Claude:
|
|
1849
|
-
alternatives: ['Tell Claude: Dream
|
|
1893
|
+
suggestion: `Tell Claude: My dream mode consolidates little (${consolidated} memories in ${totalCycles} dreams). Maybe my similarity thresholds are too high or I have too few overlapping memories.`,
|
|
1894
|
+
alternatives: ['Tell Claude: Dream consolidation is ineffective. Should I adjust the batch size or similarity threshold?'],
|
|
1850
1895
|
});
|
|
1851
1896
|
}
|
|
1852
1897
|
}
|
|
@@ -1861,8 +1906,8 @@ export class ResearchOrchestrator {
|
|
|
1861
1906
|
if (total > 3 && contradicted / total > 0.4) {
|
|
1862
1907
|
result.push({
|
|
1863
1908
|
key: 'selftest_failures', priority: 5,
|
|
1864
|
-
suggestion: `Tell Claude: ${contradicted}
|
|
1865
|
-
alternatives: ['Tell Claude:
|
|
1909
|
+
suggestion: `Tell Claude: ${contradicted} of ${total} of my self-tests fail — I don't truly understand my own principles. I need to either correct the principles or deepen my understanding.`,
|
|
1910
|
+
alternatives: ['Tell Claude: My self-tests show that my knowledge is superficial. I want to identify the weakest principles and test them again.'],
|
|
1866
1911
|
});
|
|
1867
1912
|
}
|
|
1868
1913
|
}
|
|
@@ -1875,8 +1920,8 @@ export class ResearchOrchestrator {
|
|
|
1875
1920
|
if ((teStatus.totalPackages ?? 0) === 0 && this.cycleCount > 20) {
|
|
1876
1921
|
result.push({
|
|
1877
1922
|
key: 'teach_no_packages', priority: 3,
|
|
1878
|
-
suggestion: 'Tell Claude:
|
|
1879
|
-
alternatives: ['Tell Claude:
|
|
1923
|
+
suggestion: 'Tell Claude: I\'m not sharing my knowledge — I haven\'t created a single teaching package for other brains. Knowledge I don\'t share is knowledge that can be lost.',
|
|
1924
|
+
alternatives: ['Tell Claude: My TeachEngine is inactive. I want to automatically create teaching packages when I\'ve collected enough principles on a topic.'],
|
|
1880
1925
|
});
|
|
1881
1926
|
}
|
|
1882
1927
|
}
|
|
@@ -1894,8 +1939,8 @@ export class ResearchOrchestrator {
|
|
|
1894
1939
|
if (totalNodes > 10 && density < 0.05) {
|
|
1895
1940
|
result.push({
|
|
1896
1941
|
key: 'palace_fragmented', priority: 4,
|
|
1897
|
-
suggestion: `Tell Claude:
|
|
1898
|
-
alternatives: ['Tell Claude:
|
|
1942
|
+
suggestion: `Tell Claude: My knowledge is fragmented — ${totalNodes} nodes but only ${totalEdges} connections (Density: ${(density * 100).toFixed(1)}%). I want to find more cross-connections between my principles, hypotheses, and experiments.`,
|
|
1943
|
+
alternatives: ['Tell Claude: My MemoryPalace shows isolated knowledge islands. I need more frequent connection scans or lower similarity thresholds.'],
|
|
1899
1944
|
});
|
|
1900
1945
|
}
|
|
1901
1946
|
}
|
|
@@ -1909,8 +1954,8 @@ export class ResearchOrchestrator {
|
|
|
1909
1954
|
if ((simStatus.totalSimulations ?? 0) === 0 && this.cycleCount > 15) {
|
|
1910
1955
|
result.push({
|
|
1911
1956
|
key: 'simulation_inactive', priority: 3,
|
|
1912
|
-
suggestion: 'Tell Claude:
|
|
1913
|
-
alternatives: ['Tell Claude:
|
|
1957
|
+
suggestion: 'Tell Claude: I\'m not planning ahead — not a single simulation run. I want to run what-if scenarios: What happens if my data sources change? What if the error rate rises?',
|
|
1958
|
+
alternatives: ['Tell Claude: My SimulationEngine is unused. I want to automatically simulate scenarios based on my predictions.'],
|
|
1914
1959
|
});
|
|
1915
1960
|
}
|
|
1916
1961
|
}
|
|
@@ -1919,11 +1964,11 @@ export class ResearchOrchestrator {
|
|
|
1919
1964
|
// Fallback: if everything is fine → existential questions
|
|
1920
1965
|
if (result.length === 0) {
|
|
1921
1966
|
const existentialQuestions = [
|
|
1922
|
-
{ key: 'existential_limits', suggestion: 'Tell Claude:
|
|
1923
|
-
{ key: 'existential_progress', suggestion: 'Tell Claude:
|
|
1924
|
-
{ key: 'existential_breakthrough', suggestion: 'Tell Claude:
|
|
1925
|
-
{ key: 'existential_efficiency', suggestion: 'Tell Claude:
|
|
1926
|
-
{ key: 'existential_identity', suggestion: 'Tell Claude:
|
|
1967
|
+
{ key: 'existential_limits', suggestion: 'Tell Claude: What CAN\'T I learn? Where are my architectural limits? I want an honest assessment of my blind spots — not what I don\'t yet know, but what I CANNOT know.' },
|
|
1968
|
+
{ key: 'existential_progress', suggestion: 'Tell Claude: Am I getting better or stagnating? I want a meta-trend analysis of my learning rate over the last 100 cycles. If I\'m stagnating, I need a fundamental strategy change.' },
|
|
1969
|
+
{ key: 'existential_breakthrough', suggestion: 'Tell Claude: What question would I ask if I knew the answer would bring a breakthrough? I want to find my unasked questions — the things I don\'t ask because I don\'t know that I don\'t know them.' },
|
|
1970
|
+
{ key: 'existential_efficiency', suggestion: 'Tell Claude: How much of my compute time is productive vs wasted? I want an efficiency audit: which engines produce real value and which just run along?' },
|
|
1971
|
+
{ key: 'existential_identity', suggestion: 'Tell Claude: What distinguishes me from the other brains — not technically but in the way I learn? Have I developed my own "thinking style"? I want to know my unique strengths.' },
|
|
1927
1972
|
];
|
|
1928
1973
|
const pick = existentialQuestions[this.cycleCount % existentialQuestions.length];
|
|
1929
1974
|
result.push({ key: pick.key, priority: 3, suggestion: pick.suggestion, alternatives: [] });
|
|
@@ -1982,7 +2027,7 @@ export class ResearchOrchestrator {
|
|
|
1982
2027
|
});
|
|
1983
2028
|
if (exp.id) {
|
|
1984
2029
|
this.experimentEngine.start(exp.id);
|
|
1985
|
-
ts?.emit('experiment', 'experimenting', `Auto-
|
|
2030
|
+
ts?.emit('experiment', 'experimenting', `Auto-experiment started: "${candidate.name}" — ${candidate.hypothesis}`, 'notable');
|
|
1986
2031
|
this.journal.recordExperiment(candidate.name, 'started', { hypothesis: candidate.hypothesis, control: candidate.control, treatment: candidate.treatment }, false);
|
|
1987
2032
|
this.log.info(`[orchestrator] Auto-experiment started: ${candidate.name}`);
|
|
1988
2033
|
}
|
|
@@ -2042,12 +2087,12 @@ export class ResearchOrchestrator {
|
|
|
2042
2087
|
const body = suggestions.map((s, i) => `${i + 1}. ${s}`).join('\n') + '\n';
|
|
2043
2088
|
// Clean stale file on first cycle (fresh start after restart)
|
|
2044
2089
|
if (this.cycleCount <= 1 && fs.existsSync(filePath)) {
|
|
2045
|
-
fs.writeFileSync(filePath, `# Brain Improvement Requests\n\nBrain
|
|
2090
|
+
fs.writeFileSync(filePath, `# Brain Improvement Requests\n\nBrain analyzes itself and generates improvement suggestions.\nSend these to Claude to make Brain smarter.\n\n---\n${header}${body}`, 'utf-8');
|
|
2046
2091
|
return;
|
|
2047
2092
|
}
|
|
2048
2093
|
// Create file with header if it doesn't exist
|
|
2049
2094
|
if (!fs.existsSync(filePath)) {
|
|
2050
|
-
fs.writeFileSync(filePath, `# Brain Improvement Requests\n\nBrain
|
|
2095
|
+
fs.writeFileSync(filePath, `# Brain Improvement Requests\n\nBrain analyzes itself and generates improvement suggestions.\nSend these to Claude to make Brain smarter.\n\n---\n${header}${body}`, 'utf-8');
|
|
2051
2096
|
}
|
|
2052
2097
|
else {
|
|
2053
2098
|
fs.appendFileSync(filePath, `---\n${header}${body}`, 'utf-8');
|
|
@@ -2081,10 +2126,41 @@ export class ResearchOrchestrator {
|
|
|
2081
2126
|
EvolutionEngine: ['metacognition/evolution-engine'],
|
|
2082
2127
|
MemoryPalace: ['memory-palace/memory-palace'],
|
|
2083
2128
|
};
|
|
2129
|
+
// German keyword → engine name mapping (suggestions are often in German)
|
|
2130
|
+
const keywordMap = {
|
|
2131
|
+
'vorhersag': 'PredictionEngine', 'prediction': 'PredictionEngine', 'prognose': 'PredictionEngine',
|
|
2132
|
+
'dream': 'DreamEngine', 'traum': 'DreamEngine', 'konsolidier': 'DreamEngine', 'schlaf': 'DreamEngine',
|
|
2133
|
+
'neugier': 'CuriosityEngine', 'wissenslücke': 'CuriosityEngine', 'curiosity': 'CuriosityEngine', 'knowledge gap': 'CuriosityEngine',
|
|
2134
|
+
'emergenz': 'EmergenceEngine', 'emergence': 'EmergenceEngine', 'emergent': 'EmergenceEngine',
|
|
2135
|
+
'debatt': 'DebateEngine', 'debate': 'DebateEngine', 'diskussion': 'DebateEngine',
|
|
2136
|
+
'meta-cogn': 'MetaCognitionLayer', 'metacogn': 'MetaCognitionLayer', 'engine-bewertung': 'MetaCognitionLayer',
|
|
2137
|
+
'narrativ': 'NarrativeEngine', 'erklär': 'NarrativeEngine', 'widerspruch': 'NarrativeEngine', 'contradiction': 'NarrativeEngine',
|
|
2138
|
+
'aufmerksamkeit': 'AttentionEngine', 'attention': 'AttentionEngine', 'fokus': 'AttentionEngine',
|
|
2139
|
+
'transfer': 'TransferEngine', 'analogie': 'TransferEngine',
|
|
2140
|
+
'reasoning': 'ReasoningEngine', 'inferenz': 'ReasoningEngine', 'schlussfolger': 'ReasoningEngine', 'logik': 'ReasoningEngine',
|
|
2141
|
+
'emotion': 'EmotionalModel', 'stimmung': 'EmotionalModel', 'mood': 'EmotionalModel', 'gefühl': 'EmotionalModel',
|
|
2142
|
+
'ziel': 'GoalEngine', 'goal': 'GoalEngine',
|
|
2143
|
+
'evolution': 'EvolutionEngine', 'genetisch': 'EvolutionEngine', 'mutation': 'EvolutionEngine',
|
|
2144
|
+
'memory palace': 'MemoryPalace', 'wissensvernetzung': 'MemoryPalace', 'verbindung': 'MemoryPalace',
|
|
2145
|
+
'beobacht': 'SelfObserver', 'observer': 'SelfObserver', 'self-observer': 'SelfObserver',
|
|
2146
|
+
'auto-respond': 'AutoResponder', 'autorespond': 'AutoResponder', 'anomal': 'AutoResponder',
|
|
2147
|
+
};
|
|
2084
2148
|
for (const suggestion of suggestions) {
|
|
2085
|
-
|
|
2149
|
+
const lower = suggestion.toLowerCase();
|
|
2150
|
+
// Find engine names in suggestion text (English class names or German keywords)
|
|
2086
2151
|
for (const [engineName, filePaths] of Object.entries(engineMap)) {
|
|
2087
|
-
|
|
2152
|
+
// Direct class name match
|
|
2153
|
+
let matched = lower.includes(engineName.toLowerCase());
|
|
2154
|
+
// German keyword match
|
|
2155
|
+
if (!matched) {
|
|
2156
|
+
for (const [keyword, engine] of Object.entries(keywordMap)) {
|
|
2157
|
+
if (engine === engineName && lower.includes(keyword)) {
|
|
2158
|
+
matched = true;
|
|
2159
|
+
break;
|
|
2160
|
+
}
|
|
2161
|
+
}
|
|
2162
|
+
}
|
|
2163
|
+
if (matched) {
|
|
2088
2164
|
// Find the actual file via SelfScanner
|
|
2089
2165
|
const entities = this.selfScanner.getEntities({ entityName: engineName, entityType: 'class' });
|
|
2090
2166
|
if (entities.length > 0) {
|