agentdb 2.0.0-alpha.1 → 2.0.0-alpha.2

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 (208) hide show
  1. package/dist/agentdb.min.js +4 -4
  2. package/dist/simulation/cli.js +0 -0
  3. package/dist/src/cli/lib/config-manager.d.ts.map +1 -1
  4. package/dist/src/cli/lib/config-manager.js.map +1 -1
  5. package/dist/src/cli/lib/history-tracker.d.ts.map +1 -1
  6. package/dist/src/cli/lib/history-tracker.js +7 -1
  7. package/dist/src/cli/lib/history-tracker.js.map +1 -1
  8. package/examples/README.md +105 -0
  9. package/examples/quickstart.js +43 -0
  10. package/package.json +6 -2
  11. package/simulation/.claude-flow/metrics/agent-metrics.json +1 -0
  12. package/simulation/.claude-flow/metrics/performance.json +87 -0
  13. package/simulation/.claude-flow/metrics/task-metrics.json +10 -0
  14. package/simulation/COMPLETION-STATUS.md +139 -0
  15. package/simulation/FINAL-RESULTS.md +414 -0
  16. package/simulation/FINAL-STATUS.md +281 -0
  17. package/simulation/INTEGRATION-COMPLETE.md +452 -0
  18. package/simulation/MIGRATION-STATUS.md +231 -0
  19. package/simulation/OPTIMIZATION-RESULTS.md +397 -0
  20. package/simulation/PHASE1-COMPLETE.md +163 -0
  21. package/simulation/README.md +848 -0
  22. package/simulation/SIMULATION-RESULTS.md +239 -0
  23. package/simulation/cli.ts +78 -0
  24. package/simulation/configs/default.json +37 -0
  25. package/simulation/data/advanced/aidefence.graph +0 -0
  26. package/simulation/data/advanced/bmssp.graph +0 -0
  27. package/simulation/data/advanced/consciousness.graph +0 -0
  28. package/simulation/data/advanced/goalie.graph +0 -0
  29. package/simulation/data/advanced/psycho-symbolic.graph +0 -0
  30. package/simulation/data/advanced/research-swarm.graph +0 -0
  31. package/simulation/data/advanced/sublinear.graph +0 -0
  32. package/simulation/data/advanced/temporal.graph +0 -0
  33. package/simulation/data/causal.graph +0 -0
  34. package/simulation/data/graph-traversal.graph +0 -0
  35. package/simulation/data/lean-agentic.graph +0 -0
  36. package/simulation/data/reflexion.graph +0 -0
  37. package/simulation/data/skills.graph +0 -0
  38. package/simulation/data/stock-market.graph +0 -0
  39. package/simulation/data/strange-loops.graph +0 -0
  40. package/simulation/data/swarm.graph +0 -0
  41. package/simulation/data/voting-consensus.graph +0 -0
  42. package/simulation/docs/CLI-INTEGRATION-PLAN.md +1038 -0
  43. package/simulation/docs/COMPREHENSIVE-LATENT-SPACE-COMPLETION.md +354 -0
  44. package/simulation/docs/DOCUMENTATION-INDEX.md +226 -0
  45. package/simulation/docs/IMPLEMENTATION-COMPLETE.md +521 -0
  46. package/simulation/docs/OPTIMIZATION-SUMMARY.md +279 -0
  47. package/simulation/docs/README.md +229 -0
  48. package/simulation/docs/SWARM-5-INTEGRATION-SUMMARY.md +528 -0
  49. package/simulation/docs/TESTING-SUMMARY.md +304 -0
  50. package/simulation/docs/architecture/EXTENSION-API.md +868 -0
  51. package/simulation/docs/architecture/INTEGRATION-ARCHITECTURE.md +1138 -0
  52. package/simulation/docs/architecture/OPTIMIZATION-STRATEGY.md +778 -0
  53. package/simulation/docs/architecture/SIMULATION-ARCHITECTURE.md +892 -0
  54. package/simulation/docs/guides/CLI-REFERENCE.md +896 -0
  55. package/simulation/docs/guides/CUSTOM-SIMULATIONS.md +931 -0
  56. package/simulation/docs/guides/DEPLOYMENT.md +832 -0
  57. package/simulation/docs/guides/IMPLEMENTATION-SUMMARY.md +544 -0
  58. package/simulation/docs/guides/MIGRATION-GUIDE.md +591 -0
  59. package/simulation/docs/guides/QUICK-START.md +361 -0
  60. package/simulation/docs/guides/README.md +736 -0
  61. package/simulation/docs/guides/TROUBLESHOOTING.md +817 -0
  62. package/simulation/docs/guides/WIZARD-GUIDE.md +869 -0
  63. package/simulation/docs/reports/latent-space/MASTER-SYNTHESIS.md +345 -0
  64. package/simulation/docs/reports/latent-space/README.md +132 -0
  65. package/simulation/docs/reports/latent-space/attention-analysis-RESULTS.md +238 -0
  66. package/simulation/docs/reports/latent-space/clustering-analysis-RESULTS.md +210 -0
  67. package/simulation/docs/reports/latent-space/hnsw-exploration-RESULTS.md +332 -0
  68. package/simulation/docs/reports/latent-space/hypergraph-exploration-RESULTS.md +37 -0
  69. package/simulation/docs/reports/latent-space/neural-augmentation-RESULTS.md +69 -0
  70. package/simulation/docs/reports/latent-space/quantum-hybrid-RESULTS.md +91 -0
  71. package/simulation/docs/reports/latent-space/self-organizing-hnsw-RESULTS.md +51 -0
  72. package/simulation/docs/reports/latent-space/traversal-optimization-RESULTS.md +238 -0
  73. package/simulation/reports/README.md +397 -0
  74. package/simulation/reports/advanced-simulations-performance.md +1241 -0
  75. package/simulation/reports/aidefence-integration-2025-11-30T01-36-53-486Z.json +30 -0
  76. package/simulation/reports/architecture-analysis.md +1396 -0
  77. package/simulation/reports/basic-scenarios-performance.md +1840 -0
  78. package/simulation/reports/bmssp-integration-2025-11-30T01-36-27-193Z.json +30 -0
  79. package/simulation/reports/bmssp-integration-2025-11-30T03-38-12-887Z.json +30 -0
  80. package/simulation/reports/causal-reasoning-2025-11-29T23-35-21-795Z.json +36 -0
  81. package/simulation/reports/causal-reasoning-2025-11-30T00-58-42-862Z.json +30 -0
  82. package/simulation/reports/causal-reasoning-2025-11-30T00-59-12-546Z.json +40 -0
  83. package/simulation/reports/consciousness-explorer-2025-11-30T01-36-51-269Z.json +31 -0
  84. package/simulation/reports/core-benchmarks.md +727 -0
  85. package/simulation/reports/goalie-integration-2025-11-30T01-36-52-377Z.json +30 -0
  86. package/simulation/reports/graph-traversal-2025-11-29T23-35-35-279Z.json +78 -0
  87. package/simulation/reports/graph-traversal-2025-11-29T23-37-36-697Z.json +30 -0
  88. package/simulation/reports/graph-traversal-2025-11-30T01-03-59-716Z.json +30 -0
  89. package/simulation/reports/graph-traversal-2025-11-30T01-05-10-984Z.json +30 -0
  90. package/simulation/reports/graph-traversal-2025-11-30T01-06-16-334Z.json +30 -0
  91. package/simulation/reports/graph-traversal-2025-11-30T01-06-53-312Z.json +30 -0
  92. package/simulation/reports/graph-traversal-2025-11-30T01-07-51-075Z.json +24 -0
  93. package/simulation/reports/graph-traversal-2025-11-30T01-08-22-179Z.json +42 -0
  94. package/simulation/reports/lean-agentic-swarm-2025-11-29T23-37-23-804Z.json +148 -0
  95. package/simulation/reports/lean-agentic-swarm-2025-11-30T01-31-24-401Z.json +31 -0
  96. package/simulation/reports/lean-agentic-swarm-2025-11-30T03-38-01-470Z.json +31 -0
  97. package/simulation/reports/multi-agent-swarm-2025-11-29T23-35-28-093Z.json +78 -0
  98. package/simulation/reports/multi-agent-swarm-2025-11-30T01-03-54-062Z.json +42 -0
  99. package/simulation/reports/multi-agent-swarm-2025-11-30T01-05-06-092Z.json +42 -0
  100. package/simulation/reports/psycho-symbolic-reasoner-2025-11-30T01-36-50-180Z.json +30 -0
  101. package/simulation/reports/quality-metrics.md +727 -0
  102. package/simulation/reports/reflexion-learning-2025-11-29T23-35-09-774Z.json +48 -0
  103. package/simulation/reports/reflexion-learning-2025-11-29T23-37-16-934Z.json +36 -0
  104. package/simulation/reports/reflexion-learning-2025-11-30T00-07-49-259Z.json +30 -0
  105. package/simulation/reports/reflexion-learning-2025-11-30T00-09-29-319Z.json +51 -0
  106. package/simulation/reports/reflexion-learning-2025-11-30T00-28-37-659Z.json +51 -0
  107. package/simulation/reports/reflexion-learning-2025-11-30T01-31-30-690Z.json +29 -0
  108. package/simulation/reports/reflexion-learning-2025-11-30T03-38-06-937Z.json +29 -0
  109. package/simulation/reports/research-foundations.md +2004 -0
  110. package/simulation/reports/research-swarm-2025-11-30T01-36-54-647Z.json +30 -0
  111. package/simulation/reports/scalability-deployment.md +2404 -0
  112. package/simulation/reports/skill-evolution-2025-11-29T23-35-15-945Z.json +36 -0
  113. package/simulation/reports/skill-evolution-2025-11-30T01-03-17-995Z.json +30 -0
  114. package/simulation/reports/skill-evolution-2025-11-30T01-03-48-441Z.json +30 -0
  115. package/simulation/reports/skill-evolution-2025-11-30T01-05-00-554Z.json +30 -0
  116. package/simulation/reports/skill-evolution-2025-11-30T01-06-11-436Z.json +30 -0
  117. package/simulation/reports/skill-evolution-2025-11-30T01-06-51-979Z.json +30 -0
  118. package/simulation/reports/skill-evolution-2025-11-30T01-07-32-695Z.json +40 -0
  119. package/simulation/reports/stock-market-emergence-2025-11-30T00-11-43-865Z.json +56 -0
  120. package/simulation/reports/stock-market-emergence-2025-11-30T00-28-57-495Z.json +56 -0
  121. package/simulation/reports/strange-loops-2025-11-29T23-37-30-621Z.json +78 -0
  122. package/simulation/reports/strange-loops-2025-11-30T00-07-55-415Z.json +30 -0
  123. package/simulation/reports/strange-loops-2025-11-30T00-09-35-133Z.json +30 -0
  124. package/simulation/reports/strange-loops-2025-11-30T00-48-50-744Z.json +24 -0
  125. package/simulation/reports/strange-loops-2025-11-30T00-54-48-044Z.json +24 -0
  126. package/simulation/reports/strange-loops-2025-11-30T00-57-27-633Z.json +24 -0
  127. package/simulation/reports/strange-loops-2025-11-30T00-57-59-135Z.json +42 -0
  128. package/simulation/reports/sublinear-solver-2025-11-30T01-36-33-134Z.json +30 -0
  129. package/simulation/reports/temporal-lead-solver-2025-11-30T01-36-38-628Z.json +30 -0
  130. package/simulation/reports/use-cases-applications.md +2212 -0
  131. package/simulation/reports/voting-system-consensus-2025-11-30T00-11-37-199Z.json +58 -0
  132. package/simulation/reports/voting-system-consensus-2025-11-30T00-28-47-735Z.json +58 -0
  133. package/simulation/runner.ts +300 -0
  134. package/simulation/scenarios/README-advanced/aidefence-integration.md +63 -0
  135. package/simulation/scenarios/README-advanced/bmssp-integration.md +58 -0
  136. package/simulation/scenarios/README-advanced/consciousness-explorer.md +53 -0
  137. package/simulation/scenarios/README-advanced/goalie-integration.md +61 -0
  138. package/simulation/scenarios/README-advanced/psycho-symbolic-reasoner.md +55 -0
  139. package/simulation/scenarios/README-advanced/research-swarm.md +63 -0
  140. package/simulation/scenarios/README-advanced/sublinear-solver.md +58 -0
  141. package/simulation/scenarios/README-advanced/temporal-lead-solver.md +55 -0
  142. package/simulation/scenarios/README-basic/causal-reasoning.md +39 -0
  143. package/simulation/scenarios/README-basic/graph-traversal.md +41 -0
  144. package/simulation/scenarios/README-basic/lean-agentic-swarm.md +122 -0
  145. package/simulation/scenarios/README-basic/multi-agent-swarm.md +34 -0
  146. package/simulation/scenarios/README-basic/reflexion-learning.md +41 -0
  147. package/simulation/scenarios/README-basic/skill-evolution.md +38 -0
  148. package/simulation/scenarios/README-basic/stock-market-emergence.md +28 -0
  149. package/simulation/scenarios/README-basic/strange-loops.md +36 -0
  150. package/simulation/scenarios/README-basic/voting-system-consensus.md +28 -0
  151. package/simulation/scenarios/README.md +438 -0
  152. package/simulation/scenarios/aidefence-integration.ts +165 -0
  153. package/simulation/scenarios/bmssp-integration.ts +137 -0
  154. package/simulation/scenarios/causal-reasoning.ts +143 -0
  155. package/simulation/scenarios/consciousness-explorer.ts +139 -0
  156. package/simulation/scenarios/domain-examples/.claude-flow/metrics/agent-metrics.json +1 -0
  157. package/simulation/scenarios/domain-examples/.claude-flow/metrics/performance.json +87 -0
  158. package/simulation/scenarios/domain-examples/.claude-flow/metrics/task-metrics.json +10 -0
  159. package/simulation/scenarios/domain-examples/README.md +525 -0
  160. package/simulation/scenarios/domain-examples/e-commerce-recommendations.ts +220 -0
  161. package/simulation/scenarios/domain-examples/index.ts +81 -0
  162. package/simulation/scenarios/domain-examples/iot-sensor-networks.ts +290 -0
  163. package/simulation/scenarios/domain-examples/medical-imaging.ts +181 -0
  164. package/simulation/scenarios/domain-examples/robotics-navigation.ts +214 -0
  165. package/simulation/scenarios/domain-examples/scientific-research.ts +250 -0
  166. package/simulation/scenarios/domain-examples/trading-systems.ts +138 -0
  167. package/simulation/scenarios/goalie-integration.ts +161 -0
  168. package/simulation/scenarios/graph-traversal.ts +129 -0
  169. package/simulation/scenarios/latent-space/OPTIMIZATION-COMPLETE.md +287 -0
  170. package/simulation/scenarios/latent-space/README-attention-analysis.md +170 -0
  171. package/simulation/scenarios/latent-space/README-clustering-analysis.md +239 -0
  172. package/simulation/scenarios/latent-space/README-hnsw-exploration.md +199 -0
  173. package/simulation/scenarios/latent-space/README-hypergraph-exploration.md +279 -0
  174. package/simulation/scenarios/latent-space/README-neural-augmentation.md +267 -0
  175. package/simulation/scenarios/latent-space/README-quantum-hybrid.md +276 -0
  176. package/simulation/scenarios/latent-space/README-self-organizing-hnsw.md +244 -0
  177. package/simulation/scenarios/latent-space/README-traversal-optimization.md +212 -0
  178. package/simulation/scenarios/latent-space/attention-analysis.ts +598 -0
  179. package/simulation/scenarios/latent-space/clustering-analysis.ts +796 -0
  180. package/simulation/scenarios/latent-space/hnsw-exploration.ts +526 -0
  181. package/simulation/scenarios/latent-space/hypergraph-exploration.ts +706 -0
  182. package/simulation/scenarios/latent-space/index.ts +47 -0
  183. package/simulation/scenarios/latent-space/neural-augmentation.ts +604 -0
  184. package/simulation/scenarios/latent-space/quantum-hybrid.ts +508 -0
  185. package/simulation/scenarios/latent-space/self-organizing-hnsw.ts +680 -0
  186. package/simulation/scenarios/latent-space/traversal-optimization.ts +782 -0
  187. package/simulation/scenarios/lean-agentic-swarm.ts +182 -0
  188. package/simulation/scenarios/multi-agent-swarm.ts +146 -0
  189. package/simulation/scenarios/psycho-symbolic-reasoner.ts +136 -0
  190. package/simulation/scenarios/reflexion-learning.ts +132 -0
  191. package/simulation/scenarios/research-swarm.ts +187 -0
  192. package/simulation/scenarios/skill-evolution.ts +135 -0
  193. package/simulation/scenarios/stock-market-emergence.ts +323 -0
  194. package/simulation/scenarios/strange-loops.ts +175 -0
  195. package/simulation/scenarios/sublinear-solver.ts +108 -0
  196. package/simulation/scenarios/temporal-lead-solver.ts +121 -0
  197. package/simulation/scenarios/voting-system-consensus.ts +251 -0
  198. package/simulation/tests/latent-space/attention-analysis.test.ts +204 -0
  199. package/simulation/tests/latent-space/clustering-analysis.test.ts +281 -0
  200. package/simulation/tests/latent-space/hnsw-exploration.test.ts +253 -0
  201. package/simulation/tests/latent-space/hypergraph-exploration.test.ts +295 -0
  202. package/simulation/tests/latent-space/neural-augmentation.test.ts +326 -0
  203. package/simulation/tests/latent-space/quantum-hybrid.test.ts +307 -0
  204. package/simulation/tests/latent-space/self-organizing-hnsw.test.ts +291 -0
  205. package/simulation/tests/latent-space/traversal-optimization.test.ts +261 -0
  206. package/simulation/types.ts +177 -0
  207. package/simulation/utils/PerformanceOptimizer.ts +269 -0
  208. package/src/cli/lib/history-tracker.ts +7 -1
@@ -0,0 +1,58 @@
1
+ {
2
+ "scenario": "voting-system-consensus",
3
+ "startTime": 1764461496465,
4
+ "endTime": 1764461497198,
5
+ "duration": 733.129295,
6
+ "iterations": 2,
7
+ "agents": 5,
8
+ "success": 2,
9
+ "failures": 0,
10
+ "metrics": {
11
+ "opsPerSec": 2.728031758709083,
12
+ "avgLatency": 356.546208,
13
+ "memoryUsage": 24.356658935546875,
14
+ "errorRate": 0
15
+ },
16
+ "details": [
17
+ {
18
+ "iteration": 1,
19
+ "duration": 447.37019699999996,
20
+ "success": true,
21
+ "data": {
22
+ "rounds": 5,
23
+ "totalVotes": 250,
24
+ "coalitionsFormed": 5,
25
+ "consensusEvolution": [
26
+ 0.58,
27
+ 0.62,
28
+ 0.54,
29
+ 0.6,
30
+ 0.6
31
+ ],
32
+ "strategicVotingDetected": 0,
33
+ "avgPreferenceShift": 0.020000000000000018,
34
+ "totalTime": 116.39697699999999
35
+ }
36
+ },
37
+ {
38
+ "iteration": 2,
39
+ "duration": 265.722219,
40
+ "success": true,
41
+ "data": {
42
+ "rounds": 5,
43
+ "totalVotes": 250,
44
+ "coalitionsFormed": 0,
45
+ "consensusEvolution": [
46
+ 0.58,
47
+ 0.52,
48
+ 0.52,
49
+ 0.52,
50
+ 0.6
51
+ ],
52
+ "strategicVotingDetected": 0,
53
+ "avgPreferenceShift": 0.020000000000000018,
54
+ "totalTime": 130.73092900000006
55
+ }
56
+ }
57
+ ]
58
+ }
@@ -0,0 +1,58 @@
1
+ {
2
+ "scenario": "voting-system-consensus",
3
+ "startTime": 1764462526691,
4
+ "endTime": 1764462527734,
5
+ "duration": 1043.194336,
6
+ "iterations": 2,
7
+ "agents": 5,
8
+ "success": 2,
9
+ "failures": 0,
10
+ "metrics": {
11
+ "opsPerSec": 1.917188323384455,
12
+ "avgLatency": 511.37594550000006,
13
+ "memoryUsage": 29.847320556640625,
14
+ "errorRate": 0
15
+ },
16
+ "details": [
17
+ {
18
+ "iteration": 1,
19
+ "duration": 693.1747210000001,
20
+ "success": true,
21
+ "data": {
22
+ "rounds": 5,
23
+ "totalVotes": 250,
24
+ "coalitionsFormed": 0,
25
+ "consensusEvolution": [
26
+ 0.58,
27
+ 0.58,
28
+ 0.58,
29
+ 0.6,
30
+ 0.56
31
+ ],
32
+ "strategicVotingDetected": 0,
33
+ "avgPreferenceShift": -0.019999999999999907,
34
+ "totalTime": 258.90011100000004
35
+ }
36
+ },
37
+ {
38
+ "iteration": 2,
39
+ "duration": 329.57717,
40
+ "success": true,
41
+ "data": {
42
+ "rounds": 5,
43
+ "totalVotes": 250,
44
+ "coalitionsFormed": 0,
45
+ "consensusEvolution": [
46
+ 0.52,
47
+ 0.62,
48
+ 0.56,
49
+ 0.56,
50
+ 0.52
51
+ ],
52
+ "strategicVotingDetected": 0,
53
+ "avgPreferenceShift": 0,
54
+ "totalTime": 213.92519600000003
55
+ }
56
+ }
57
+ ]
58
+ }
@@ -0,0 +1,300 @@
1
+ /**
2
+ * Simulation Runner
3
+ *
4
+ * Orchestrates multi-agent swarms to test AgentDB functionality
5
+ */
6
+
7
+ import * as fs from 'fs';
8
+ import * as path from 'path';
9
+ import { performance } from 'perf_hooks';
10
+
11
+ interface SimulationOptions {
12
+ config: string;
13
+ verbosity: string;
14
+ iterations: string;
15
+ swarmSize: string;
16
+ model: string;
17
+ parallel: boolean;
18
+ output: string;
19
+ stream: boolean;
20
+ optimize: boolean;
21
+ }
22
+
23
+ interface SimulationResult {
24
+ scenario: string;
25
+ startTime: number;
26
+ endTime: number;
27
+ duration: number;
28
+ iterations: number;
29
+ agents: number;
30
+ success: number;
31
+ failures: number;
32
+ metrics: {
33
+ opsPerSec: number;
34
+ avgLatency: number;
35
+ memoryUsage: number;
36
+ errorRate: number;
37
+ };
38
+ details: any[];
39
+ }
40
+
41
+ export async function runSimulation(scenario: string, options: SimulationOptions): Promise<void> {
42
+ const verbosity = parseInt(options.verbosity);
43
+
44
+ if (verbosity >= 1) {
45
+ console.log('🚀 AgentDB Simulation System v2.0.0');
46
+ console.log('═'.repeat(70));
47
+ console.log(`Scenario: ${scenario}`);
48
+ console.log(`Config: ${options.config}`);
49
+ console.log(`Model: ${options.model}`);
50
+ console.log(`Swarm Size: ${options.swarmSize}`);
51
+ console.log(`Iterations: ${options.iterations}`);
52
+ console.log(`Parallel: ${options.parallel}`);
53
+ console.log(`Streaming: ${options.stream}`);
54
+ console.log(`Optimize: ${options.optimize}`);
55
+ console.log('═'.repeat(70));
56
+ }
57
+
58
+ // Load scenario
59
+ const scenarioPath = path.join(process.cwd(), 'simulation', 'scenarios', `${scenario}.ts`);
60
+ if (!fs.existsSync(scenarioPath)) {
61
+ console.error(`❌ Scenario not found: ${scenario}`);
62
+ console.error(` Path: ${scenarioPath}`);
63
+ process.exit(1);
64
+ }
65
+
66
+ const startTime = performance.now();
67
+ const result: SimulationResult = {
68
+ scenario,
69
+ startTime: Date.now(),
70
+ endTime: 0,
71
+ duration: 0,
72
+ iterations: parseInt(options.iterations),
73
+ agents: parseInt(options.swarmSize),
74
+ success: 0,
75
+ failures: 0,
76
+ metrics: {
77
+ opsPerSec: 0,
78
+ avgLatency: 0,
79
+ memoryUsage: 0,
80
+ errorRate: 0
81
+ },
82
+ details: []
83
+ };
84
+
85
+ try {
86
+ // Import and run scenario
87
+ const scenarioModule = await import(scenarioPath);
88
+ const scenarioRunner = scenarioModule.default;
89
+
90
+ if (verbosity >= 2) {
91
+ console.log(`\n🎯 Running scenario: ${scenario}\n`);
92
+ }
93
+
94
+ // Initialize swarm
95
+ const swarmConfig = {
96
+ size: parseInt(options.swarmSize),
97
+ model: options.model,
98
+ parallel: options.parallel,
99
+ stream: options.stream,
100
+ optimize: options.optimize,
101
+ verbosity
102
+ };
103
+
104
+ // Run iterations
105
+ for (let i = 0; i < parseInt(options.iterations); i++) {
106
+ if (verbosity >= 2) {
107
+ console.log(`\n📍 Iteration ${i + 1}/${options.iterations}`);
108
+ }
109
+
110
+ const iterationStart = performance.now();
111
+
112
+ try {
113
+ const iterationResult = await scenarioRunner.run(swarmConfig);
114
+ const iterationEnd = performance.now();
115
+
116
+ result.success++;
117
+ result.details.push({
118
+ iteration: i + 1,
119
+ duration: iterationEnd - iterationStart,
120
+ success: true,
121
+ data: iterationResult
122
+ });
123
+
124
+ if (verbosity >= 3) {
125
+ console.log(` ✅ Iteration ${i + 1} completed in ${(iterationEnd - iterationStart).toFixed(2)}ms`);
126
+ console.log(` Result:`, JSON.stringify(iterationResult, null, 2));
127
+ } else if (verbosity >= 2) {
128
+ console.log(` ✅ Completed in ${(iterationEnd - iterationStart).toFixed(2)}ms`);
129
+ }
130
+ } catch (error) {
131
+ const iterationEnd = performance.now();
132
+ result.failures++;
133
+ result.details.push({
134
+ iteration: i + 1,
135
+ duration: iterationEnd - iterationStart,
136
+ success: false,
137
+ error: error instanceof Error ? error.message : String(error)
138
+ });
139
+
140
+ if (verbosity >= 1) {
141
+ console.error(` ❌ Iteration ${i + 1} failed:`, error);
142
+ }
143
+ }
144
+ }
145
+
146
+ const endTime = performance.now();
147
+ result.endTime = Date.now();
148
+ result.duration = endTime - startTime;
149
+
150
+ // Calculate metrics
151
+ const successfulIterations = result.details.filter(d => d.success);
152
+ const totalDuration = successfulIterations.reduce((sum, d) => sum + d.duration, 0);
153
+ result.metrics.avgLatency = totalDuration / successfulIterations.length;
154
+ result.metrics.opsPerSec = (result.success / (result.duration / 1000));
155
+ result.metrics.errorRate = result.failures / result.iterations;
156
+ result.metrics.memoryUsage = process.memoryUsage().heapUsed / 1024 / 1024; // MB
157
+
158
+ // Display results
159
+ if (verbosity >= 1) {
160
+ console.log('\n' + '═'.repeat(70));
161
+ console.log('📊 SIMULATION RESULTS');
162
+ console.log('═'.repeat(70));
163
+ console.log(`Total Duration: ${(result.duration / 1000).toFixed(2)}s`);
164
+ console.log(`Iterations: ${result.iterations}`);
165
+ console.log(`Success: ${result.success} (${((result.success / result.iterations) * 100).toFixed(1)}%)`);
166
+ console.log(`Failures: ${result.failures} (${((result.failures / result.iterations) * 100).toFixed(1)}%)`);
167
+ console.log(`\nMetrics:`);
168
+ console.log(` Throughput: ${result.metrics.opsPerSec.toFixed(2)} ops/sec`);
169
+ console.log(` Avg Latency: ${result.metrics.avgLatency.toFixed(2)}ms`);
170
+ console.log(` Error Rate: ${(result.metrics.errorRate * 100).toFixed(2)}%`);
171
+ console.log(` Memory Usage: ${result.metrics.memoryUsage.toFixed(2)} MB`);
172
+ console.log('═'.repeat(70));
173
+ }
174
+
175
+ // Save results
176
+ const outputDir = path.join(process.cwd(), options.output);
177
+ if (!fs.existsSync(outputDir)) {
178
+ fs.mkdirSync(outputDir, { recursive: true });
179
+ }
180
+
181
+ const timestamp = new Date().toISOString().replace(/[:.]/g, '-');
182
+ const outputPath = path.join(outputDir, `${scenario}-${timestamp}.json`);
183
+ fs.writeFileSync(outputPath, JSON.stringify(result, null, 2));
184
+
185
+ if (verbosity >= 1) {
186
+ console.log(`\n💾 Results saved to: ${outputPath}\n`);
187
+ }
188
+
189
+ } catch (error) {
190
+ console.error('\n❌ Simulation failed:', error);
191
+ process.exit(1);
192
+ }
193
+ }
194
+
195
+ export async function listScenarios(): Promise<void> {
196
+ const scenariosDir = path.join(process.cwd(), 'simulation', 'scenarios');
197
+
198
+ if (!fs.existsSync(scenariosDir)) {
199
+ console.log('No scenarios found. Create scenarios in simulation/scenarios/');
200
+ return;
201
+ }
202
+
203
+ const files = fs.readdirSync(scenariosDir).filter(f => f.endsWith('.ts'));
204
+
205
+ console.log('\n📋 Available Scenarios:\n');
206
+
207
+ for (const file of files) {
208
+ const scenarioName = file.replace('.ts', '');
209
+ const scenarioPath = path.join(scenariosDir, file);
210
+
211
+ try {
212
+ const module = await import(scenarioPath);
213
+ const description = module.default?.description || 'No description';
214
+ console.log(` ${scenarioName.padEnd(30)} - ${description}`);
215
+ } catch (error) {
216
+ console.log(` ${scenarioName.padEnd(30)} - (Error loading)`);
217
+ }
218
+ }
219
+
220
+ console.log('');
221
+ }
222
+
223
+ export async function initScenario(scenario: string, options: any): Promise<void> {
224
+ const scenarioPath = path.join(process.cwd(), 'simulation', 'scenarios', `${scenario}.ts`);
225
+
226
+ if (fs.existsSync(scenarioPath)) {
227
+ console.error(`❌ Scenario already exists: ${scenario}`);
228
+ return;
229
+ }
230
+
231
+ const template = getTemplate(options.template);
232
+ fs.writeFileSync(scenarioPath, template);
233
+
234
+ console.log(`✅ Created scenario: ${scenario}`);
235
+ console.log(` Path: ${scenarioPath}`);
236
+ console.log(` Template: ${options.template}`);
237
+ }
238
+
239
+ function getTemplate(templateName: string): string {
240
+ const templates: Record<string, string> = {
241
+ basic: `/**
242
+ * Basic Simulation Scenario
243
+ */
244
+
245
+ export default {
246
+ description: 'Basic simulation scenario',
247
+
248
+ async run(config: any) {
249
+ // Your simulation logic here
250
+ return {
251
+ status: 'success',
252
+ data: {}
253
+ };
254
+ }
255
+ };
256
+ `,
257
+ swarm: `/**
258
+ * Swarm Simulation Scenario
259
+ */
260
+
261
+ export default {
262
+ description: 'Multi-agent swarm simulation',
263
+
264
+ async run(config: any) {
265
+ const { swarmInit, agentSpawn } = await import('./swarms/coordinator.js');
266
+
267
+ // Initialize swarm
268
+ const swarm = await swarmInit({
269
+ topology: 'mesh',
270
+ maxAgents: config.size
271
+ });
272
+
273
+ // Spawn agents
274
+ const agents = [];
275
+ for (let i = 0; i < config.size; i++) {
276
+ const agent = await agentSpawn({
277
+ swarmId: swarm.id,
278
+ type: 'worker',
279
+ capabilities: ['agentdb']
280
+ });
281
+ agents.push(agent);
282
+ }
283
+
284
+ // Execute tasks
285
+ const results = await Promise.all(
286
+ agents.map(agent => agent.execute())
287
+ );
288
+
289
+ return {
290
+ status: 'success',
291
+ agents: agents.length,
292
+ results
293
+ };
294
+ }
295
+ };
296
+ `
297
+ };
298
+
299
+ return templates[templateName] || templates.basic;
300
+ }
@@ -0,0 +1,63 @@
1
+ # AIDefence Integration - Security Threat Modeling
2
+
3
+ ## Overview
4
+ Security-focused graph database for threat pattern recognition, attack vector analysis, and defense strategy optimization.
5
+
6
+ ## Purpose
7
+ Model cybersecurity threats and defenses using graph-based relationships between threats, attack vectors, and countermeasures.
8
+
9
+ ## Operations
10
+ - **Threats Detected**: 5 (SQL injection, XSS, CSRF, DDoS, privilege escalation)
11
+ - **Attack Vectors**: 4 common exploitation paths
12
+ - **Defense Strategies**: 5 countermeasures
13
+ - **Threat Level**: 91.6% average severity
14
+
15
+ ## Results
16
+ - **Throughput**: 2.26 ops/sec
17
+ - **Latency**: 432ms avg
18
+ - **Threats Detected**: 5
19
+ - **Attack Vectors**: 4
20
+ - **Defense Strategies**: 5
21
+ - **Avg Threat Level**: 91.6%
22
+
23
+ ## Technical Details
24
+
25
+ ### Threat Model
26
+ ```typescript
27
+ threat: {
28
+ type: 'sql_injection',
29
+ severity: 0.95, // High severity
30
+ detected: true
31
+ }
32
+ ```
33
+
34
+ ### Defense Strategy
35
+ ```typescript
36
+ defense: {
37
+ strategy: 'parameterized_queries',
38
+ effectiveness: 0.98 // 98% mitigation
39
+ }
40
+ ```
41
+
42
+ ### Threat Coverage
43
+ | Threat | Severity | Defense | Effectiveness |
44
+ |--------|----------|---------|---------------|
45
+ | SQL Injection | 95% | Parameterized queries | 98% |
46
+ | XSS | 88% | Input sanitization | 93% |
47
+ | CSRF | 85% | CSRF tokens | 90% |
48
+ | DDoS | 92% | Rate limiting | 88% |
49
+ | Privilege Escalation | 98% | Secure session mgmt | 95% |
50
+
51
+ ## Applications
52
+ - **Security Operations Centers**: Threat intelligence
53
+ - **Penetration Testing**: Attack surface analysis
54
+ - **Compliance**: Security audit trails
55
+ - **DevSecOps**: Security in CI/CD pipelines
56
+
57
+ ## Integration Features
58
+ - Real-time threat detection
59
+ - Defense effectiveness tracking
60
+ - Attack vector mapping
61
+ - Mitigation strategy optimization
62
+
63
+ **Status**: ✅ Operational | **Package**: aidefence
@@ -0,0 +1,58 @@
1
+ # BMSSP Integration - Biologically-Motivated Symbolic-Subsymbolic Processing
2
+
3
+ ## Overview
4
+ Hybrid symbolic-subsymbolic processing combining rule-based logic with neural pattern recognition.
5
+
6
+ ## Purpose
7
+ Model how biological brains integrate symbolic reasoning (conscious thought) with subsymbolic processing (intuition, pattern recognition).
8
+
9
+ ## Operations
10
+ - **Symbolic Rules**: 3 logical inference rules
11
+ - **Subsymbolic Patterns**: 3 neural activation patterns
12
+ - **Hybrid Inferences**: 3 combined reasoning steps
13
+ - **Confidence Scores**: 85-95% average
14
+
15
+ ## Results
16
+ - **Throughput**: 2.38 ops/sec
17
+ - **Latency**: 410ms avg
18
+ - **Memory**: 23 MB
19
+ - **Symbolic Rules**: 3
20
+ - **Subsymbolic Patterns**: 3
21
+ - **Hybrid Inferences**: 3
22
+ - **Avg Confidence**: 91.7%
23
+
24
+ ## Technical Details
25
+
26
+ ### Symbolic Layer
27
+ ```typescript
28
+ rule: 'IF temperature > 30 THEN activate_cooling'
29
+ confidence: 0.95
30
+ ```
31
+
32
+ ### Subsymbolic Layer
33
+ ```typescript
34
+ pattern: 'temperature_trend_rising'
35
+ strength: 0.88 // Neural activation level
36
+ ```
37
+
38
+ ### Integration
39
+ Combines symbolic IF-THEN rules with subsymbolic pattern detection for robust decision-making.
40
+
41
+ ## Applications
42
+ - **Smart Home Systems**: Combine rules with learned preferences
43
+ - **Medical Diagnosis**: Clinical guidelines + pattern recognition
44
+ - **Autonomous Vehicles**: Traffic rules + learned behaviors
45
+ - **Robotics**: Programmed behaviors + adaptive learning
46
+
47
+ ## Package Integration
48
+ - **@ruvnet/bmssp**: Core BMSSP algorithms
49
+ - **Graph DB**: Optimized for symbolic rule graphs
50
+ - **Distance Metric**: Cosine (best for semantic similarity)
51
+
52
+ ## Research Connections
53
+ - Connectionist AI (1980s-90s)
54
+ - Hybrid AI systems
55
+ - Cognitive architectures (ACT-R, SOAR)
56
+ - Dual-process theory (Kahneman)
57
+
58
+ **Status**: ✅ Operational | **Package**: @ruvnet/bmssp
@@ -0,0 +1,53 @@
1
+ # Consciousness Explorer - Multi-Layered Consciousness Model
2
+
3
+ ## Overview
4
+ Multi-layered graph implementing consciousness theories: Global Workspace Theory, Integrated Information Theory, and Higher-Order Thought.
5
+
6
+ ## Purpose
7
+ Model consciousness as emergent property from layered processing: perception → attention → metacognition.
8
+
9
+ ## Operations
10
+ - **Layer 1**: Perceptual processing (3 modalities)
11
+ - **Layer 2**: Attention & global workspace (3 foci)
12
+ - **Layer 3**: Metacognitive monitoring (3 processes)
13
+ - **Integration**: Integrated Information (φ) calculation
14
+
15
+ ## Results
16
+ - **Throughput**: 2.31 ops/sec
17
+ - **Latency**: 423ms avg
18
+ - **Perceptual Processes**: 3
19
+ - **Attention Processes**: 3
20
+ - **Metacognitive Processes**: 3
21
+ - **Integrated Information (φ)**: 3.00
22
+ - **Consciousness Level**: 83.3%
23
+
24
+ ## Technical Details
25
+
26
+ ### Layer Architecture
27
+ ```
28
+ Layer 1: Perception (visual, auditory, tactile)
29
+
30
+ Layer 2: Attention (salient objects, global workspace broadcast)
31
+
32
+ Layer 3: Metacognition (self-monitoring, error detection)
33
+
34
+ φ (Integrated Information) = f(L1, L2, L3)
35
+ ```
36
+
37
+ ### Consciousness Metrics
38
+ - **φ (Phi)**: 3.00 (measure of information integration)
39
+ - **Consciousness Level**: 83.3% (weighted by layer importance)
40
+
41
+ ## Applications
42
+ - **AI Safety**: Self-aware AI systems
43
+ - **Cognitive Modeling**: Brain simulation
44
+ - **Philosophy**: Consciousness studies
45
+ - **Anesthesia**: Consciousness monitoring
46
+
47
+ ## Theoretical Frameworks
48
+ 1. Global Workspace Theory (Baars, 1988)
49
+ 2. Integrated Information Theory (Tononi, 2004)
50
+ 3. Higher-Order Thought (Rosenthal, 1986)
51
+ 4. Attention Schema Theory (Graziano, 2013)
52
+
53
+ **Status**: ✅ Operational | **Package**: consciousness-explorer
@@ -0,0 +1,61 @@
1
+ # Goalie Integration - Goal-Oriented AI Learning Engine
2
+
3
+ ## Overview
4
+ Hierarchical goal decomposition with achievement trees, tracking progress from high-level objectives to actionable subgoals.
5
+
6
+ ## Purpose
7
+ Model how AI agents can break down complex goals into manageable subgoals and track achievement progress.
8
+
9
+ ## Operations
10
+ - **Primary Goals**: 3 high-level objectives
11
+ - **Subgoals**: 9 decomposed tasks (3 per goal)
12
+ - **Achievements**: 3 completed subgoals
13
+ - **Causal Links**: Subgoal → Parent goal dependencies
14
+
15
+ ## Results
16
+ - **Throughput**: 2.23 ops/sec
17
+ - **Latency**: 437ms avg
18
+ - **Primary Goals**: 3
19
+ - **Subgoals**: 9
20
+ - **Achievements**: 3
21
+ - **Avg Progress**: 33.3%
22
+
23
+ ## Technical Details
24
+
25
+ ### Goal Hierarchy
26
+ ```
27
+ Primary: build_production_system (priority: 0.95)
28
+ ├── Subgoal: setup_ci_cd ✅
29
+ ├── Subgoal: implement_logging
30
+ └── Subgoal: add_monitoring
31
+
32
+ Primary: achieve_90_percent_test_coverage (priority: 0.88)
33
+ ├── Subgoal: write_unit_tests ✅
34
+ ├── Subgoal: write_integration_tests
35
+ └── Subgoal: add_e2e_tests
36
+
37
+ Primary: optimize_performance_10x (priority: 0.92)
38
+ ├── Subgoal: profile_bottlenecks ✅
39
+ ├── Subgoal: optimize_queries
40
+ └── Subgoal: add_caching
41
+ ```
42
+
43
+ ### Achievement Tracking
44
+ ```typescript
45
+ achievement: 'setup_ci_cd'
46
+ successRate: 1.0 // 100% completed
47
+ ```
48
+
49
+ ## Applications
50
+ - **Project Management AI**: Task decomposition
51
+ - **Game AI**: Quest/objective systems
52
+ - **Robotics**: Multi-step task planning
53
+ - **Personal Assistants**: Goal tracking
54
+
55
+ ## Features
56
+ - Hierarchical goal decomposition
57
+ - Progress monitoring
58
+ - Dependency tracking (causal edges)
59
+ - Achievement unlocking
60
+
61
+ **Status**: ✅ Operational | **Package**: goalie
@@ -0,0 +1,55 @@
1
+ # Psycho-Symbolic Reasoner - Cognitive Bias Modeling
2
+
3
+ ## Overview
4
+ Hybrid reasoning combining psychological models (cognitive biases, heuristics) with symbolic logic and subsymbolic patterns.
5
+
6
+ ## Purpose
7
+ Model human-like reasoning including systematic biases, demonstrating more realistic AI decision-making.
8
+
9
+ ## Operations
10
+ - **Psychological Models**: 3 (confirmation bias, availability heuristic, anchoring)
11
+ - **Symbolic Rules**: 2 logical inference rules
12
+ - **Subsymbolic Patterns**: 5 neural activation patterns
13
+ - **Hybrid Reasoning**: 5 integrated decisions
14
+
15
+ ## Results
16
+ - **Throughput**: 2.04 ops/sec
17
+ - **Latency**: 479ms avg
18
+ - **Memory**: 23 MB
19
+ - **Psychological Models**: 3
20
+ - **Symbolic Rules**: 2
21
+ - **Subsymbolic Patterns**: 5
22
+ - **Hybrid Instances**: 5
23
+
24
+ ## Technical Details
25
+
26
+ ### Psychological Layer
27
+ ```typescript
28
+ model: 'confirmation_bias'
29
+ strength: 0.88
30
+ // Tendency to favor confirming evidence
31
+ ```
32
+
33
+ ### Symbolic Layer
34
+ ```typescript
35
+ rule: 'IF bias_detected THEN adjust_confidence'
36
+ confidence: 0.92
37
+ ```
38
+
39
+ ### Integration
40
+ Detects cognitive biases → Applies corrective symbolic rules → Uses subsymbolic patterns for nuanced decisions
41
+
42
+ ## Applications
43
+ - **Decision Support Systems**: Bias-aware recommendations
44
+ - **Educational Tools**: Teaching critical thinking
45
+ - **UX Design**: Predict user behavior patterns
46
+ - **Negotiation AI**: Model human decision-making
47
+
48
+ ## Cognitive Biases Modeled
49
+ 1. Confirmation bias
50
+ 2. Availability heuristic
51
+ 3. Anchoring effect
52
+ 4. Representativeness heuristic
53
+ 5. Framing effects
54
+
55
+ **Status**: ✅ Operational | **Package**: psycho-symbolic-reasoner