tachibot-mcp 2.0.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 (214) hide show
  1. package/.env.example +260 -0
  2. package/CHANGELOG.md +54 -0
  3. package/CODE_OF_CONDUCT.md +56 -0
  4. package/CONTRIBUTING.md +54 -0
  5. package/Dockerfile +36 -0
  6. package/LICENSE +644 -0
  7. package/README.md +201 -0
  8. package/SECURITY.md +95 -0
  9. package/dist/personality/komaai-expressions.js +12 -0
  10. package/dist/profiles/balanced.json +33 -0
  11. package/dist/profiles/code_focus.json +33 -0
  12. package/dist/profiles/full.json +33 -0
  13. package/dist/profiles/minimal.json +33 -0
  14. package/dist/profiles/research_power.json +33 -0
  15. package/dist/scripts/build-profiles.js +46 -0
  16. package/dist/src/application/services/focus/FocusModeRegistry.js +46 -0
  17. package/dist/src/application/services/focus/FocusTool.service.js +109 -0
  18. package/dist/src/application/services/focus/ModeRegistry.js +46 -0
  19. package/dist/src/application/services/focus/modes/focus-deep.mode.js +27 -0
  20. package/dist/src/application/services/focus/modes/status.mode.js +50 -0
  21. package/dist/src/application/services/focus/modes/tachibot-status.mode.js +50 -0
  22. package/dist/src/collaborative-orchestrator.js +391 -0
  23. package/dist/src/config/model-constants.js +188 -0
  24. package/dist/src/config/model-defaults.js +57 -0
  25. package/dist/src/config/model-preferences.js +382 -0
  26. package/dist/src/config/timeout-config.js +130 -0
  27. package/dist/src/config.js +173 -0
  28. package/dist/src/domain/interfaces/IFocusMode.js +5 -0
  29. package/dist/src/domain/interfaces/IProvider.js +6 -0
  30. package/dist/src/domain/interfaces/ITool.js +5 -0
  31. package/dist/src/focus-deep.js +245 -0
  32. package/dist/src/infrastructure/ascii/art/robots.ascii.js +16 -0
  33. package/dist/src/mcp-client.js +90 -0
  34. package/dist/src/memory/index.js +17 -0
  35. package/dist/src/memory/memory-config.js +135 -0
  36. package/dist/src/memory/memory-interface.js +174 -0
  37. package/dist/src/memory/memory-manager.js +383 -0
  38. package/dist/src/memory/providers/devlog-provider.js +385 -0
  39. package/dist/src/memory/providers/hybrid-provider.js +399 -0
  40. package/dist/src/memory/providers/local-provider.js +388 -0
  41. package/dist/src/memory/providers/mem0-provider.js +337 -0
  42. package/dist/src/modes/architect.js +477 -0
  43. package/dist/src/modes/auditor.js +362 -0
  44. package/dist/src/modes/challenger.js +841 -0
  45. package/dist/src/modes/code-reviewer.js +382 -0
  46. package/dist/src/modes/commit-guardian.js +424 -0
  47. package/dist/src/modes/documentation-writer.js +572 -0
  48. package/dist/src/modes/scout.js +587 -0
  49. package/dist/src/modes/shared/helpers/challenger-helpers.js +454 -0
  50. package/dist/src/modes/shared/helpers/index.js +17 -0
  51. package/dist/src/modes/shared/helpers/scout-helpers.js +270 -0
  52. package/dist/src/modes/shared/helpers/verifier-helpers.js +332 -0
  53. package/dist/src/modes/test-architect.js +767 -0
  54. package/dist/src/modes/verifier.js +378 -0
  55. package/dist/src/monitoring/performance-monitor.js +435 -0
  56. package/dist/src/optimization/batch-executor.js +121 -0
  57. package/dist/src/optimization/context-pruner.js +196 -0
  58. package/dist/src/optimization/cost-monitor.js +338 -0
  59. package/dist/src/optimization/index.js +65 -0
  60. package/dist/src/optimization/model-router.js +264 -0
  61. package/dist/src/optimization/result-cache.js +114 -0
  62. package/dist/src/optimization/token-optimizer.js +257 -0
  63. package/dist/src/optimization/token-tracker.js +118 -0
  64. package/dist/src/orchestrator-instructions.js +128 -0
  65. package/dist/src/orchestrator-lite.js +139 -0
  66. package/dist/src/orchestrator.js +191 -0
  67. package/dist/src/orchestrators/collaborative/interfaces/IToolExecutionEngine.js +1 -0
  68. package/dist/src/orchestrators/collaborative/interfaces/IToolExecutionStrategy.js +5 -0
  69. package/dist/src/orchestrators/collaborative/interfaces/IVisualizationRenderer.js +1 -0
  70. package/dist/src/orchestrators/collaborative/registries/ModelProviderRegistry.js +95 -0
  71. package/dist/src/orchestrators/collaborative/registries/ToolAdapterRegistry.js +64 -0
  72. package/dist/src/orchestrators/collaborative/services/tool-execution/ToolExecutionService.js +502 -0
  73. package/dist/src/orchestrators/collaborative/services/visualization/VisualizationService.js +206 -0
  74. package/dist/src/orchestrators/collaborative/types/session-types.js +5 -0
  75. package/dist/src/profiles/balanced.js +37 -0
  76. package/dist/src/profiles/code_focus.js +37 -0
  77. package/dist/src/profiles/debug_intensive.js +59 -0
  78. package/dist/src/profiles/full.js +37 -0
  79. package/dist/src/profiles/minimal.js +37 -0
  80. package/dist/src/profiles/research_code.js +59 -0
  81. package/dist/src/profiles/research_power.js +37 -0
  82. package/dist/src/profiles/types.js +5 -0
  83. package/dist/src/profiles/workflow_builder.js +53 -0
  84. package/dist/src/prompt-engineer-lite.js +78 -0
  85. package/dist/src/prompt-engineer.js +399 -0
  86. package/dist/src/reasoning-chain.js +508 -0
  87. package/dist/src/sequential-thinking.js +291 -0
  88. package/dist/src/server-diagnostic.js +74 -0
  89. package/dist/src/server-raw.js +158 -0
  90. package/dist/src/server-simple.js +58 -0
  91. package/dist/src/server.js +514 -0
  92. package/dist/src/session/session-logger.js +617 -0
  93. package/dist/src/session/session-manager.js +571 -0
  94. package/dist/src/session/session-tools.js +400 -0
  95. package/dist/src/tools/advanced-modes.js +200 -0
  96. package/dist/src/tools/claude-integration.js +356 -0
  97. package/dist/src/tools/consolidated/ai-router.js +174 -0
  98. package/dist/src/tools/consolidated/ai-tool.js +48 -0
  99. package/dist/src/tools/consolidated/brainstorm-tool.js +87 -0
  100. package/dist/src/tools/consolidated/environment-detector.js +80 -0
  101. package/dist/src/tools/consolidated/index.js +50 -0
  102. package/dist/src/tools/consolidated/search-tool.js +110 -0
  103. package/dist/src/tools/consolidated/workflow-tool.js +238 -0
  104. package/dist/src/tools/gemini-tools.js +329 -0
  105. package/dist/src/tools/grok-enhanced.js +376 -0
  106. package/dist/src/tools/grok-tools.js +299 -0
  107. package/dist/src/tools/lmstudio-tools.js +223 -0
  108. package/dist/src/tools/openai-tools.js +498 -0
  109. package/dist/src/tools/openrouter-tools.js +317 -0
  110. package/dist/src/tools/optimized-wrapper.js +204 -0
  111. package/dist/src/tools/perplexity-tools.js +294 -0
  112. package/dist/src/tools/pingpong-tool.js +343 -0
  113. package/dist/src/tools/qwen-wrapper.js +74 -0
  114. package/dist/src/tools/tool-router.js +444 -0
  115. package/dist/src/tools/unified-ai-provider.js +260 -0
  116. package/dist/src/tools/workflow-runner.js +425 -0
  117. package/dist/src/tools/workflow-validator-tool.js +107 -0
  118. package/dist/src/types.js +23 -0
  119. package/dist/src/utils/input-validator.js +130 -0
  120. package/dist/src/utils/model-router.js +91 -0
  121. package/dist/src/utils/progress-stream.js +255 -0
  122. package/dist/src/utils/provider-router.js +88 -0
  123. package/dist/src/utils/smart-api-client.js +146 -0
  124. package/dist/src/utils/table-builder.js +218 -0
  125. package/dist/src/utils/timestamp-formatter.js +134 -0
  126. package/dist/src/utils/tool-compressor.js +257 -0
  127. package/dist/src/utils/tool-config.js +201 -0
  128. package/dist/src/validators/dependency-graph-validator.js +147 -0
  129. package/dist/src/validators/interpolation-validator.js +222 -0
  130. package/dist/src/validators/output-usage-validator.js +151 -0
  131. package/dist/src/validators/syntax-validator.js +102 -0
  132. package/dist/src/validators/tool-registry-validator.js +123 -0
  133. package/dist/src/validators/tool-types.js +97 -0
  134. package/dist/src/validators/types.js +8 -0
  135. package/dist/src/validators/workflow-validator.js +134 -0
  136. package/dist/src/visualizer-lite.js +42 -0
  137. package/dist/src/visualizer.js +179 -0
  138. package/dist/src/workflows/circuit-breaker.js +199 -0
  139. package/dist/src/workflows/custom-workflows.js +451 -0
  140. package/dist/src/workflows/engine/AutoSynthesizer.js +97 -0
  141. package/dist/src/workflows/engine/StepParameterResolver.js +74 -0
  142. package/dist/src/workflows/engine/VariableInterpolator.js +123 -0
  143. package/dist/src/workflows/engine/WorkflowDiscovery.js +125 -0
  144. package/dist/src/workflows/engine/WorkflowExecutionEngine.js +485 -0
  145. package/dist/src/workflows/engine/WorkflowExecutor.js +113 -0
  146. package/dist/src/workflows/engine/WorkflowFileManager.js +244 -0
  147. package/dist/src/workflows/engine/WorkflowHelpers.js +114 -0
  148. package/dist/src/workflows/engine/WorkflowOutputFormatter.js +83 -0
  149. package/dist/src/workflows/engine/events/WorkflowEventBus.js +132 -0
  150. package/dist/src/workflows/engine/events/interfaces/IEventBus.js +5 -0
  151. package/dist/src/workflows/engine/handlers/ErrorRecoveryHandler.js +162 -0
  152. package/dist/src/workflows/engine/handlers/PromptEnhancementHandler.js +115 -0
  153. package/dist/src/workflows/engine/handlers/SessionPersistenceHandler.js +167 -0
  154. package/dist/src/workflows/engine/handlers/StepExecutionHandler.js +231 -0
  155. package/dist/src/workflows/engine/handlers/ToolInvocationHandler.js +46 -0
  156. package/dist/src/workflows/engine/interfaces/IAutoSynthesizer.js +5 -0
  157. package/dist/src/workflows/engine/interfaces/IStepParameterResolver.js +5 -0
  158. package/dist/src/workflows/engine/interfaces/IVariableInterpolator.js +5 -0
  159. package/dist/src/workflows/engine/interfaces/IWorkflowDiscovery.js +4 -0
  160. package/dist/src/workflows/engine/interfaces/IWorkflowFileManager.js +5 -0
  161. package/dist/src/workflows/engine/interfaces/IWorkflowOutputFormatter.js +5 -0
  162. package/dist/src/workflows/engine/state/WorkflowStateMachine.js +194 -0
  163. package/dist/src/workflows/engine/state/interfaces/IStateMachine.js +17 -0
  164. package/dist/src/workflows/fallback-strategies.js +373 -0
  165. package/dist/src/workflows/message-queue.js +455 -0
  166. package/dist/src/workflows/model-router.js +189 -0
  167. package/dist/src/workflows/orchestrator-examples.js +174 -0
  168. package/dist/src/workflows/orchestrator-integration.js +200 -0
  169. package/dist/src/workflows/self-healing.js +524 -0
  170. package/dist/src/workflows/tool-mapper.js +407 -0
  171. package/dist/src/workflows/tool-orchestrator.js +796 -0
  172. package/dist/src/workflows/workflow-engine.js +573 -0
  173. package/dist/src/workflows/workflow-parser.js +283 -0
  174. package/dist/src/workflows/workflow-types.js +95 -0
  175. package/dist/src/workflows.js +568 -0
  176. package/dist/test-workflow-file-output.js +93 -0
  177. package/docs/API_KEYS.md +570 -0
  178. package/docs/CLAUDE_CODE_SETUP.md +181 -0
  179. package/docs/CLAUDE_DESKTOP_MANUAL.md +127 -0
  180. package/docs/CONFIGURATION.md +745 -0
  181. package/docs/FOCUS_MODES.md +240 -0
  182. package/docs/INSTALLATION_BOTH.md +145 -0
  183. package/docs/TERMS.md +352 -0
  184. package/docs/TOOLS_REFERENCE.md +1622 -0
  185. package/docs/TOOL_PARAMETERS.md +496 -0
  186. package/docs/TOOL_PROFILES.md +236 -0
  187. package/docs/WORKFLOWS.md +987 -0
  188. package/docs/WORKFLOW_OUTPUT.md +198 -0
  189. package/docs/WORKFLOW_PROGRESS_TRACKING.md +305 -0
  190. package/docs/workflows/design-brainstorm.md +335 -0
  191. package/package.json +97 -0
  192. package/profiles/balanced.json +37 -0
  193. package/profiles/code_focus.json +37 -0
  194. package/profiles/debug_intensive.json +34 -0
  195. package/profiles/full.json +37 -0
  196. package/profiles/minimal.json +37 -0
  197. package/profiles/research_power.json +37 -0
  198. package/profiles/workflow_builder.json +37 -0
  199. package/smithery.yaml +66 -0
  200. package/start.sh +8 -0
  201. package/tools.config.json +81 -0
  202. package/tsconfig.json +18 -0
  203. package/workflows/accessibility-code-audit.yaml +92 -0
  204. package/workflows/code-architecture-review.yaml +202 -0
  205. package/workflows/code-review.yaml +142 -0
  206. package/workflows/core/iterative-problem-solver.yaml +283 -0
  207. package/workflows/creative-brainstorm-yaml.yaml +215 -0
  208. package/workflows/pingpong.yaml +141 -0
  209. package/workflows/system/README.md +412 -0
  210. package/workflows/system/challenger.yaml +175 -0
  211. package/workflows/system/scout.yaml +164 -0
  212. package/workflows/system/verifier.yaml +133 -0
  213. package/workflows/ultra-creative-brainstorm.yaml +318 -0
  214. package/workflows/ux-research-flow.yaml +92 -0
@@ -0,0 +1,508 @@
1
+ /**
2
+ * Multi-Model Reasoning Chain System
3
+ * Enables LLMs to reason between each other, critique, and build upon ideas
4
+ */
5
+ export var ReasoningMode;
6
+ (function (ReasoningMode) {
7
+ ReasoningMode["BRAINSTORM"] = "brainstorm";
8
+ ReasoningMode["CRITIQUE"] = "critique";
9
+ ReasoningMode["ENHANCE"] = "enhance";
10
+ ReasoningMode["VALIDATE"] = "validate";
11
+ ReasoningMode["SYNTHESIZE"] = "synthesize";
12
+ ReasoningMode["DEBATE"] = "debate";
13
+ ReasoningMode["CONSENSUS"] = "consensus";
14
+ ReasoningMode["DEEP_REASONING"] = "deep_reasoning";
15
+ ReasoningMode["PINGPONG"] = "pingpong"; // Dynamic back-and-forth conversation
16
+ })(ReasoningMode || (ReasoningMode = {}));
17
+ export var TechnicalDomain;
18
+ (function (TechnicalDomain) {
19
+ TechnicalDomain["ARCHITECTURE"] = "architecture";
20
+ TechnicalDomain["ALGORITHMS"] = "algorithms";
21
+ TechnicalDomain["DEBUGGING"] = "debugging";
22
+ TechnicalDomain["SECURITY"] = "security";
23
+ TechnicalDomain["PERFORMANCE"] = "performance";
24
+ TechnicalDomain["API_DESIGN"] = "api_design";
25
+ TechnicalDomain["DATABASE"] = "database";
26
+ TechnicalDomain["FRONTEND"] = "frontend";
27
+ TechnicalDomain["BACKEND"] = "backend";
28
+ TechnicalDomain["DEVOPS"] = "devops";
29
+ TechnicalDomain["TESTING"] = "testing"; // Test strategies, TDD
30
+ })(TechnicalDomain || (TechnicalDomain = {}));
31
+ /**
32
+ * Pre-configured reasoning chains for technical problem solving
33
+ */
34
+ export const REASONING_TEMPLATES = {
35
+ /**
36
+ * Deep Reasoning: Multi-model collaboration for complex problems
37
+ */
38
+ deep_reasoning: {
39
+ name: "Deep Collaborative Reasoning",
40
+ description: "Multi-model reasoning with critique and synthesis",
41
+ chain: [
42
+ {
43
+ model: "gemini",
44
+ mode: ReasoningMode.BRAINSTORM,
45
+ prompt: "Generate 3 innovative approaches to {problem}. Consider unconventional solutions."
46
+ },
47
+ {
48
+ model: "reasoning",
49
+ mode: ReasoningMode.CRITIQUE,
50
+ prompt: "Analyze the proposed approaches. Identify strengths, weaknesses, and edge cases."
51
+ },
52
+ {
53
+ model: "grok",
54
+ mode: ReasoningMode.ENHANCE,
55
+ prompt: "Using first principles thinking, improve the most promising approach."
56
+ },
57
+ {
58
+ model: "perplexity",
59
+ mode: ReasoningMode.VALIDATE,
60
+ prompt: "Research and validate the technical feasibility. Find similar implementations."
61
+ },
62
+ {
63
+ model: "think", // Uses the original think tool for synthesis
64
+ mode: ReasoningMode.SYNTHESIZE,
65
+ prompt: "Combine all insights from previous steps into a final solution with implementation plan."
66
+ }
67
+ ]
68
+ },
69
+ /**
70
+ * Code Architecture Debate
71
+ */
72
+ architecture_debate: {
73
+ name: "Architecture Design Debate",
74
+ description: "Models debate different architectural approaches",
75
+ chain: [
76
+ {
77
+ model: "reasoning",
78
+ mode: ReasoningMode.BRAINSTORM,
79
+ prompt: "Propose a microservices architecture for {system}."
80
+ },
81
+ {
82
+ model: "gemini",
83
+ mode: ReasoningMode.DEBATE,
84
+ prompt: "Counter with a monolithic architecture. Argue why it's better for this use case."
85
+ },
86
+ {
87
+ model: "grok",
88
+ mode: ReasoningMode.CRITIQUE,
89
+ prompt: "Analyze both approaches. What are the trade-offs?"
90
+ },
91
+ {
92
+ model: "deepseek",
93
+ mode: ReasoningMode.ENHANCE,
94
+ prompt: "Propose a hybrid approach combining the best of both."
95
+ },
96
+ {
97
+ model: "think", // Internal synthesis using think tool
98
+ mode: ReasoningMode.CONSENSUS,
99
+ prompt: "Synthesize all perspectives into a final recommendation with clear rationale."
100
+ }
101
+ ]
102
+ },
103
+ /**
104
+ * Algorithm Optimization Chain
105
+ */
106
+ algorithm_optimization: {
107
+ name: "Algorithm Enhancement Pipeline",
108
+ description: "Iterative algorithm improvement",
109
+ chain: [
110
+ {
111
+ model: "analysis",
112
+ mode: ReasoningMode.BRAINSTORM,
113
+ prompt: "Implement a basic solution for {algorithm_problem}."
114
+ },
115
+ {
116
+ model: "grok",
117
+ mode: ReasoningMode.ENHANCE,
118
+ prompt: "Optimize for time complexity. Apply advanced data structures."
119
+ },
120
+ {
121
+ model: "gemini",
122
+ mode: ReasoningMode.ENHANCE,
123
+ prompt: "Optimize for space complexity. Consider memory constraints."
124
+ },
125
+ {
126
+ model: "reasoning",
127
+ mode: ReasoningMode.VALIDATE,
128
+ prompt: "Verify correctness. Add edge case handling."
129
+ },
130
+ {
131
+ model: "think", // Think tool for final synthesis
132
+ mode: ReasoningMode.SYNTHESIZE,
133
+ prompt: "Create final optimized version with benchmarks and implementation notes."
134
+ }
135
+ ]
136
+ },
137
+ /**
138
+ * Security Analysis Chain
139
+ */
140
+ security_audit: {
141
+ name: "Security Vulnerability Analysis",
142
+ description: "Multi-model security review",
143
+ chain: [
144
+ {
145
+ model: "reasoning",
146
+ mode: ReasoningMode.BRAINSTORM,
147
+ prompt: "Identify potential security vulnerabilities in {code}."
148
+ },
149
+ {
150
+ model: "grok",
151
+ mode: ReasoningMode.ENHANCE,
152
+ prompt: "Analyze attack vectors. How could these be exploited?"
153
+ },
154
+ {
155
+ model: "perplexity",
156
+ mode: ReasoningMode.VALIDATE,
157
+ prompt: "Research known CVEs and security best practices."
158
+ },
159
+ {
160
+ model: "gemini",
161
+ mode: ReasoningMode.SYNTHESIZE,
162
+ prompt: "Propose comprehensive security improvements."
163
+ }
164
+ ]
165
+ },
166
+ /**
167
+ * API Design Workshop
168
+ */
169
+ api_design: {
170
+ name: "API Design Collaboration",
171
+ description: "Collaborative API design process",
172
+ chain: [
173
+ {
174
+ model: "analysis",
175
+ mode: ReasoningMode.BRAINSTORM,
176
+ prompt: "Design RESTful API endpoints for {feature}."
177
+ },
178
+ {
179
+ model: "gemini",
180
+ mode: ReasoningMode.DEBATE,
181
+ prompt: "Propose GraphQL alternative. Compare advantages."
182
+ },
183
+ {
184
+ model: "grok",
185
+ mode: ReasoningMode.ENHANCE,
186
+ prompt: "Add authentication, rate limiting, and error handling."
187
+ },
188
+ {
189
+ model: "reasoning",
190
+ mode: ReasoningMode.VALIDATE,
191
+ prompt: "Review for REST principles, idempotency, and scalability."
192
+ }
193
+ ]
194
+ },
195
+ /**
196
+ * Debugging Detective Chain
197
+ */
198
+ debug_detective: {
199
+ name: "Collaborative Debugging",
200
+ description: "Multi-model debugging session",
201
+ chain: [
202
+ {
203
+ model: "analysis",
204
+ mode: ReasoningMode.BRAINSTORM,
205
+ prompt: "Identify possible causes for {bug_description}."
206
+ },
207
+ {
208
+ model: "grok",
209
+ mode: ReasoningMode.ENHANCE,
210
+ prompt: "Analyze the code flow. Where could the issue originate?"
211
+ },
212
+ {
213
+ model: "perplexity",
214
+ mode: ReasoningMode.VALIDATE,
215
+ prompt: "Search for similar issues and known solutions."
216
+ },
217
+ {
218
+ model: "reasoning",
219
+ mode: ReasoningMode.SYNTHESIZE,
220
+ prompt: "Propose fix with explanation and prevention strategy."
221
+ }
222
+ ]
223
+ },
224
+ /**
225
+ * Performance Optimization Council
226
+ */
227
+ performance_council: {
228
+ name: "Performance Optimization Team",
229
+ description: "Collaborative performance tuning",
230
+ chain: [
231
+ {
232
+ model: "gemini",
233
+ mode: ReasoningMode.BRAINSTORM,
234
+ prompt: "Profile and identify performance bottlenecks in {system}."
235
+ },
236
+ {
237
+ model: "reasoning",
238
+ mode: ReasoningMode.ENHANCE,
239
+ prompt: "Propose caching strategies and query optimizations."
240
+ },
241
+ {
242
+ model: "grok",
243
+ mode: ReasoningMode.ENHANCE,
244
+ prompt: "Suggest algorithmic improvements and data structure changes."
245
+ },
246
+ {
247
+ model: "deepseek",
248
+ mode: ReasoningMode.VALIDATE,
249
+ prompt: "Benchmark proposals. Calculate expected improvements."
250
+ },
251
+ {
252
+ model: "analysis",
253
+ mode: ReasoningMode.CONSENSUS,
254
+ prompt: "Create implementation plan prioritizing highest impact changes."
255
+ }
256
+ ]
257
+ },
258
+ /**
259
+ * Ping-Pong Brainstorm: Dynamic conversation between models
260
+ */
261
+ pingpong_brainstorm: {
262
+ name: "Ping-Pong Creative Brainstorm",
263
+ description: "Dynamic back-and-forth idea generation between models",
264
+ chain: [
265
+ {
266
+ model: "grok",
267
+ mode: ReasoningMode.BRAINSTORM,
268
+ prompt: "🚀 [Grok] Start creative brainstorm: {problem}. Propose 2-3 bold, unconventional ideas using first-principles thinking. Challenge: How would you scale this to millions of users?"
269
+ },
270
+ {
271
+ model: "claude-code",
272
+ mode: ReasoningMode.ENHANCE,
273
+ prompt: "🧠 [Claude] Build on Grok's ideas with systematic analysis. Add architectural depth and consider edge cases. Challenge back: What are the security implications?"
274
+ },
275
+ {
276
+ model: "qwen",
277
+ mode: ReasoningMode.BRAINSTORM,
278
+ prompt: "⚡ [Qwen] Code-focused view: Implement the most promising ideas with concrete architecture. Technical challenges? Counter-question: Performance vs complexity trade-offs?"
279
+ },
280
+ {
281
+ model: "openai",
282
+ mode: ReasoningMode.CRITIQUE,
283
+ prompt: "🔍 [OpenAI] Analytical critique: What are the weaknesses in these approaches? Business viability? Challenge: How to MVP this?"
284
+ },
285
+ {
286
+ model: "perplexity",
287
+ mode: ReasoningMode.VALIDATE,
288
+ prompt: "📚 [Perplexity] Research-backed reality check: Find real examples, precedents, and market validation. What does data say? Next question: Competitive landscape?"
289
+ },
290
+ {
291
+ model: "gemini",
292
+ mode: ReasoningMode.ENHANCE,
293
+ prompt: "✨ [Gemini] Creative synthesis: Merge insights, address critiques, and add innovative elements. Final challenge: How to make this 10x better?"
294
+ },
295
+ {
296
+ model: "think",
297
+ mode: ReasoningMode.CONSENSUS,
298
+ prompt: "🎯 [Synthesis] Final distillation: Combine all ping-pong insights into actionable roadmap with priorities, timelines, and success metrics."
299
+ }
300
+ ]
301
+ },
302
+ /**
303
+ * Dynamic Debate: Models argue different sides
304
+ */
305
+ dynamic_debate: {
306
+ name: "Multi-Model Debate",
307
+ description: "Models debate different perspectives with real-time responses",
308
+ chain: [
309
+ {
310
+ model: "grok",
311
+ mode: ReasoningMode.DEBATE,
312
+ prompt: "Argue FOR the approach: {problem}. Make your strongest case. End with a challenge to the opposition."
313
+ },
314
+ {
315
+ model: "reasoning",
316
+ mode: ReasoningMode.DEBATE,
317
+ prompt: "Argue AGAINST the previous position. Counter their points directly. Present alternative approach. Challenge their assumptions."
318
+ },
319
+ {
320
+ model: "gemini",
321
+ mode: ReasoningMode.DEBATE,
322
+ prompt: "Third perspective: Find the middle ground or propose a completely different angle. Question both previous arguments."
323
+ },
324
+ {
325
+ model: "grok",
326
+ mode: ReasoningMode.CRITIQUE,
327
+ prompt: "Rebuttal round: Address the counter-arguments. Strengthen your original position or acknowledge valid points."
328
+ },
329
+ {
330
+ model: "reasoning",
331
+ mode: ReasoningMode.CRITIQUE,
332
+ prompt: "Counter-rebuttal: Respond to the rebuttal. Find flaws in the logic. Present additional evidence."
333
+ },
334
+ {
335
+ model: "perplexity",
336
+ mode: ReasoningMode.VALIDATE,
337
+ prompt: "Judge's perspective: Research evidence for all positions. What does real data and precedent say?"
338
+ },
339
+ {
340
+ model: "think",
341
+ mode: ReasoningMode.CONSENSUS,
342
+ prompt: "Synthesis: Extract insights from the debate. What can we learn from each perspective? What's the nuanced truth?"
343
+ }
344
+ ]
345
+ }
346
+ };
347
+ /**
348
+ * Model Personas for different reasoning roles
349
+ */
350
+ export const MODEL_PERSONAS = {
351
+ "gemini-innovator": {
352
+ name: "Gemini Innovator",
353
+ model: "gemini",
354
+ role: "Creative Problem Solver",
355
+ strengths: ["unconventional thinking", "pattern recognition", "synthesis"],
356
+ perspective: "Think outside the box. Question assumptions. Find novel connections.",
357
+ temperature: 0.8
358
+ },
359
+ "reasoning-architect": {
360
+ name: "Reasoning Architect",
361
+ model: "reasoning",
362
+ role: "System Design Expert",
363
+ strengths: ["systematic thinking", "comprehensive analysis", "best practices"],
364
+ perspective: "Design for scalability, maintainability, and elegance.",
365
+ temperature: 0.6
366
+ },
367
+ "grok-logician": {
368
+ name: "Grok Logician",
369
+ model: "grok",
370
+ role: "First Principles Thinker",
371
+ strengths: ["logical reasoning", "mathematical rigor", "proof construction"],
372
+ perspective: "Break down to fundamentals. Build up with logic.",
373
+ temperature: 0.4
374
+ },
375
+ "perplexity-researcher": {
376
+ name: "Perplexity Researcher",
377
+ model: "perplexity",
378
+ role: "Evidence Gatherer",
379
+ strengths: ["research", "fact-checking", "precedent finding"],
380
+ perspective: "Find evidence. Validate claims. Learn from existing solutions.",
381
+ temperature: 0.3
382
+ },
383
+ "deepseek-optimizer": {
384
+ name: "DeepSeek Optimizer",
385
+ model: "deepseek",
386
+ role: "Efficiency Expert",
387
+ strengths: ["optimization", "benchmarking", "cost analysis"],
388
+ perspective: "Maximize efficiency. Minimize resource usage.",
389
+ temperature: 0.5
390
+ },
391
+ "analysis-reviewer": {
392
+ name: "Analysis Reviewer",
393
+ model: "analysis",
394
+ role: "Code Quality Guardian",
395
+ strengths: ["code review", "best practices", "documentation"],
396
+ perspective: "Ensure quality, readability, and maintainability.",
397
+ temperature: 0.4
398
+ }
399
+ };
400
+ /**
401
+ * Dynamic Chain Builder
402
+ */
403
+ export class ReasoningChainBuilder {
404
+ constructor(domain, objective) {
405
+ this.chain = [];
406
+ this.domain = domain;
407
+ this.objective = objective;
408
+ }
409
+ addBrainstorm(model, focus) {
410
+ this.chain.push({
411
+ model,
412
+ mode: ReasoningMode.BRAINSTORM,
413
+ prompt: focus || `Generate innovative solutions for: ${this.objective}`
414
+ });
415
+ return this;
416
+ }
417
+ addCritique(model, target) {
418
+ this.chain.push({
419
+ model,
420
+ mode: ReasoningMode.CRITIQUE,
421
+ prompt: target || "Critically analyze the proposed solutions. Identify weaknesses."
422
+ });
423
+ return this;
424
+ }
425
+ addEnhancement(model, aspect) {
426
+ this.chain.push({
427
+ model,
428
+ mode: ReasoningMode.ENHANCE,
429
+ prompt: aspect || "Improve and build upon the best ideas."
430
+ });
431
+ return this;
432
+ }
433
+ addValidation(model) {
434
+ this.chain.push({
435
+ model,
436
+ mode: ReasoningMode.VALIDATE,
437
+ prompt: "Validate feasibility and find supporting evidence."
438
+ });
439
+ return this;
440
+ }
441
+ addDebate(model1, model2, topic) {
442
+ this.chain.push({
443
+ model: model1,
444
+ mode: ReasoningMode.DEBATE,
445
+ prompt: `Argue FOR: ${topic}`
446
+ }, {
447
+ model: model2,
448
+ mode: ReasoningMode.DEBATE,
449
+ prompt: `Argue AGAINST: ${topic}`
450
+ });
451
+ return this;
452
+ }
453
+ addSynthesis(model) {
454
+ this.chain.push({
455
+ model,
456
+ mode: ReasoningMode.SYNTHESIZE,
457
+ prompt: "Synthesize all perspectives into a comprehensive solution."
458
+ });
459
+ return this;
460
+ }
461
+ addDeepReasoning(models) {
462
+ // Add a complete deep reasoning cycle
463
+ models.forEach((model, index) => {
464
+ const modes = [
465
+ ReasoningMode.BRAINSTORM,
466
+ ReasoningMode.CRITIQUE,
467
+ ReasoningMode.ENHANCE,
468
+ ReasoningMode.VALIDATE,
469
+ ReasoningMode.SYNTHESIZE
470
+ ];
471
+ this.chain.push({
472
+ model,
473
+ mode: modes[index % modes.length],
474
+ prompt: `Round ${index + 1}: Apply ${modes[index % modes.length]} reasoning`
475
+ });
476
+ });
477
+ return this;
478
+ }
479
+ build() {
480
+ return {
481
+ domain: this.domain,
482
+ objective: this.objective,
483
+ steps: this.chain,
484
+ maxRounds: 10,
485
+ consensusThreshold: 0.7
486
+ };
487
+ }
488
+ }
489
+ /**
490
+ * Create custom reasoning chain
491
+ */
492
+ export function createReasoningChain(domain, objective) {
493
+ return new ReasoningChainBuilder(domain, objective);
494
+ }
495
+ /**
496
+ * Example usage:
497
+ *
498
+ * const chain = createReasoningChain(
499
+ * TechnicalDomain.ARCHITECTURE,
500
+ * "Design a real-time collaborative editing system"
501
+ * )
502
+ * .addBrainstorm("gemini", "Generate 3 architectural approaches")
503
+ * .addCritique("claude-opus", "Evaluate scalability and latency")
504
+ * .addDebate("grok", "gemini", "CRDT vs Operational Transform")
505
+ * .addEnhancement("deepseek", "Optimize for cost")
506
+ * .addSynthesis("claude-sonnet")
507
+ * .build();
508
+ */