@nbiish/cognitive-tools-mcp 8.6.1 → 8.6.3

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 (3) hide show
  1. package/README.md +24 -1
  2. package/build/index.js +235 -99
  3. package/package.json +2 -2
package/README.md CHANGED
@@ -24,7 +24,30 @@
24
24
 
25
25
  ## ᐴ GASHKITOONAN ᔔ [CAPABILITIES] ◈──◆──◇──◆──◈
26
26
 
27
- Revolutionary **Enhanced Cognitive Processing MCP Server** - Automatically processes all 6 cognitive stages internally (Scientific Investigation, OOReD Analysis, Critical Thinking, Scientific Review, OOReD Review, Final Action) and returns comprehensive results. Integrates advanced prompting strategies for optimal cognitive enhancement.
27
+ # ᐊᓂᔑᓈᐯ Cyberpunk Cognitive Deliberation MCP Server
28
+
29
+ > **Interactive Multi-Phase Cognitive Processing MCP Server** - Forces LLMs through 3-input deliberation phases for comprehensive 6-stage cognitive enhancement. Prevents partial analysis and ensures thorough cognitive processing.
30
+
31
+ ## 🧠 Revolutionary Interactive Cognitive Framework
32
+
33
+ This MCP server implements an **interactive session-based deliberation process** that forces LLMs through multiple required inputs to ensure comprehensive cognitive analysis. Unlike traditional single-call tools, this system **prevents partial analysis** by requiring LLMs to engage in iterative deliberation.
34
+
35
+ ### 🎯 Interactive Session Flow
36
+
37
+ **CRITICAL:** This tool follows a mandatory 3-input deliberation process:
38
+
39
+ 1. **Initial Input** → Stages 1-2 processing → Request second input
40
+ 2. **Second Input** → Stages 3-6 processing → Request third input
41
+ 3. **Third Input** → Final formatting → Return comprehensive result
42
+
43
+ ### 🚀 Key Features
44
+
45
+ - **Forces Iterative Thinking:** Prevents LLMs from stopping after partial deliberation
46
+ - **Session-Based Processing:** Maintains context across multiple inputs
47
+ - **Comprehensive 6-Stage Framework:** Scientific Investigation + OOReD Analysis + Critical Thinking + Reviews + Final Action
48
+ - **Tool Usage Tracking:** Returns actionable tool recommendations with usage counts
49
+ - **Low-Context Model Friendly:** Optimal for models requiring guided interaction
50
+ - **Advanced Prompting Integration:** CoT, ToT, Self-Consistency, Meta-Prompting, Role-Based strategies
28
51
 
29
52
  ### ⚡ INTERNAL 6-STAGE PROCESSING
30
53
 
package/build/index.js CHANGED
@@ -25,8 +25,8 @@ import { z } from "zod";
25
25
  // --- Server Definition ---
26
26
  const serverInfo = {
27
27
  name: "gikendaasowin-aabajichiganan-mcp",
28
- version: "8.6.0",
29
- description: "Enhanced Cognitive Processing MCP Server - Automatically processes all 6 cognitive stages internally (Scientific Investigation, OOReD Analysis, Critical Thinking, Scientific Review, OOReD Review, Final Action) and returns comprehensive results. Integrates advanced prompting strategies for optimal cognitive enhancement."
28
+ version: "8.6.2",
29
+ description: "Interactive Multi-Phase Cognitive Processing MCP Server - Forces LLMs through 3-input deliberation phases for comprehensive 6-stage cognitive enhancement. Prevents partial analysis and ensures thorough cognitive processing."
30
30
  };
31
31
  const server = new McpServer(serverInfo);
32
32
  // --- Logging Helpers (Internal - No changes needed as per user comments) ---
@@ -1236,122 +1236,258 @@ function assessLogicalCoherence(stage1Result, stage3Result) {
1236
1236
  function assessMethodologicalRigor(stage1Result) {
1237
1237
  return "High rigor - systematic approach with appropriate controls";
1238
1238
  }
1239
- // --- Enhanced 6-Stage Cognitive Framework Documentation (2025) ---
1239
+ // In-memory session storage (replace with persistent storage in production)
1240
+ const activeSessions = new Map();
1241
+ // Clean up old sessions (older than 1 hour)
1242
+ setInterval(() => {
1243
+ const oneHourAgo = Date.now() - (60 * 60 * 1000);
1244
+ for (const [sessionId, session] of activeSessions.entries()) {
1245
+ if (session.createdAt < oneHourAgo) {
1246
+ activeSessions.delete(sessionId);
1247
+ }
1248
+ }
1249
+ }, 10 * 60 * 1000); // Check every 10 minutes
1250
+ function generateSessionId() {
1251
+ return `session_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`;
1252
+ }
1253
+ // --- Interactive Session Handlers ---
1254
+ async function handlePhase1(session, userInput) {
1255
+ // Process Stages 1-2 (Scientific Investigation + Initial OOReD)
1256
+ const stage1 = await performScientificInvestigation(userInput, session.mode, session.context);
1257
+ const stage2 = await performInitialOOReD(userInput, session.mode, session.context, stage1);
1258
+ const stage1_2_results = `## STAGE 1: SCIENTIFIC INVESTIGATION
1259
+ ${stage1}
1260
+
1261
+ ## STAGE 2: INITIAL OBSERVE-ORIENT-REASON-DECIDE
1262
+ ${stage2}`;
1263
+ session.stage1_2_results = stage1_2_results;
1264
+ session.phase = "awaiting_input_2";
1265
+ session.toolUsageCount += countToolsInStage(stage1) + countToolsInStage(stage2);
1266
+ activeSessions.set(session.sessionId, session);
1267
+ const promptForNextInput = `# 🧠 COGNITIVE ENHANCEMENT: Phase 1 Complete (Stages 1-2)
1268
+
1269
+ ${stage1_2_results}
1270
+
1271
+ ---
1272
+
1273
+ **⚠️ CONTINUE DELIBERATION REQUIRED ⚠️**
1274
+
1275
+ The cognitive framework requires your **SECOND INPUT** to complete stages 3-6. Please call this deliberation tool again with:
1276
+
1277
+ - **Your refined perspective** based on the analysis above
1278
+ - **Additional context** you want to incorporate
1279
+ - **Specific focus areas** for deeper investigation
1280
+
1281
+ **Required parameters for continuation:**
1282
+ \`\`\`json
1283
+ {
1284
+ "input": "[Your second input based on the analysis above]",
1285
+ "session_id": "${session.sessionId}"
1286
+ }
1287
+ \`\`\`
1288
+
1289
+ **Progress:** 2 of 6 stages complete | **Continuing session:** \`${session.sessionId}\``;
1290
+ logToolResult('deliberate', true, `Phase 1 complete, awaiting second input for session ${session.sessionId}`);
1291
+ return {
1292
+ content: [{
1293
+ type: "text",
1294
+ text: promptForNextInput
1295
+ }]
1296
+ };
1297
+ }
1298
+ async function handlePhase2(session, userInput) {
1299
+ if (!session.stage1_2_results) {
1300
+ throw new Error("Invalid session state: missing stage 1-2 results");
1301
+ }
1302
+ // Process Stages 3-6 using both original input and new refined input
1303
+ const combinedInput = `${session.originalInput}\n\n[REFINED INPUT FROM PHASE 1]\n${userInput}`;
1304
+ const combinedContext = session.context ? `${session.context}\n\n[CONTEXT FROM STAGES 1-2]\n${session.stage1_2_results}` : session.stage1_2_results;
1305
+ const stage3 = await performCriticalThinkingPreAct(combinedInput, session.mode, combinedContext, "", "");
1306
+ const stage4 = await performScientificReview(combinedInput, session.mode, combinedContext, "", stage3);
1307
+ const stage5 = await performOOReViewReview(combinedInput, session.mode, combinedContext, "", stage4);
1308
+ const stage6 = await performFinalAct(combinedInput, session.mode, combinedContext, stage3, stage5);
1309
+ const stage3_6_results = `## STAGE 3: CRITICAL THINKING & PRE-ACTION PLANNING
1310
+ ${stage3}
1311
+
1312
+ ## STAGE 4: SCIENTIFIC REVIEW & VALIDATION
1313
+ ${stage4}
1314
+
1315
+ ## STAGE 5: OOReD REVIEW & REFINEMENT
1316
+ ${stage5}
1317
+
1318
+ ## STAGE 6: FACT-BASED ACTION & FINAL RECOMMENDATIONS
1319
+ ${stage6}`;
1320
+ session.stage3_6_results = stage3_6_results;
1321
+ session.phase = "awaiting_input_3";
1322
+ session.toolUsageCount += countToolsInStage(stage3) + countToolsInStage(stage4) + countToolsInStage(stage5) + countToolsInStage(stage6);
1323
+ activeSessions.set(session.sessionId, session);
1324
+ const promptForFinalInput = `# 🧠 COGNITIVE ENHANCEMENT: Phase 2 Complete (Stages 3-6)
1325
+
1326
+ ${stage3_6_results}
1327
+
1328
+ ---
1329
+
1330
+ **⚠️ FINAL CONFIRMATION REQUIRED ⚠️**
1331
+
1332
+ The 6-stage cognitive deliberation is complete. Please provide a **FINAL INPUT** to:
1333
+
1334
+ - **Confirm** the recommendations are suitable
1335
+ - **Refine** any specific aspects
1336
+ - **Add** final considerations
1337
+ - **Proceed** with implementation planning
1338
+
1339
+ **Required parameters for final output:**
1340
+ \`\`\`json
1341
+ {
1342
+ "input": "[Your final confirmation/refinement]",
1343
+ "session_id": "${session.sessionId}"
1344
+ }
1345
+ \`\`\`
1346
+
1347
+ **Progress:** 6 of 6 stages complete | **Final step:** \`${session.sessionId}\``;
1348
+ logToolResult('deliberate', true, `Phase 2 complete, awaiting final input for session ${session.sessionId}`);
1349
+ return {
1350
+ content: [{
1351
+ type: "text",
1352
+ text: promptForFinalInput
1353
+ }]
1354
+ };
1355
+ }
1356
+ async function handlePhase3(session, userInput) {
1357
+ if (!session.stage1_2_results || !session.stage3_6_results) {
1358
+ throw new Error("Invalid session state: missing previous stage results");
1359
+ }
1360
+ // Final output with complete deliberation results
1361
+ const finalOutput = `# 🎯 ENHANCED COGNITIVE DELIBERATION - COMPLETE ANALYSIS
1362
+
1363
+ ## COMPREHENSIVE 6-STAGE COGNITIVE FRAMEWORK RESULTS
1364
+
1365
+ ${session.stage1_2_results}
1366
+
1367
+ ${session.stage3_6_results}
1368
+
1369
+ ---
1370
+
1371
+ ## 🔧 IMPLEMENTATION ROADMAP
1372
+
1373
+ Based on the comprehensive analysis, proceed with these **prioritized actions**:
1374
+
1375
+ ### Phase 1: Immediate Actions
1376
+ - **File Operations**: Use \`create_file\`, \`replace_string_in_file\`, \`read_file\` for implementation
1377
+ - **Research**: Leverage \`mcp_tavily-remote_tavily_search\`, \`vscode_websearchforcopilot_webSearch\` for validation
1378
+ - **Code Analysis**: Apply \`semantic_search\`, \`grep_search\`, \`list_code_usages\` for optimization
1379
+
1380
+ ### Phase 2: Development Execution
1381
+ - **Terminal Operations**: Execute with \`run_in_terminal\`, \`create_and_run_task\`
1382
+ - **Quality Assurance**: Validate using \`get_errors\`, \`test_search\`
1383
+ - **Documentation**: Update with \`edit_notebook_file\`, \`create_directory\`
1384
+
1385
+ ### Phase 3: Validation & Refinement
1386
+ - **Testing**: Comprehensive testing protocols
1387
+ - **Review**: Peer review and expert consultation
1388
+ - **Optimization**: Performance and efficiency improvements
1389
+
1390
+ ---
1391
+
1392
+ **Final Confirmation:** ${userInput}
1393
+
1394
+ \`\`\`tool use before re-deliberation: ${session.toolUsageCount}\`\`\`
1395
+
1396
+ *Enhanced 6-Stage Cognitive Framework Complete | Processing Mode: ${session.mode} | Session: ${session.sessionId}*
1397
+ *Prompting Strategies Applied: CoT, ToT, Self-Consistency, Meta-Prompting, Role-Based*`;
1398
+ // Mark session as complete and schedule cleanup
1399
+ session.phase = "complete";
1400
+ activeSessions.set(session.sessionId, session);
1401
+ // Clean up completed session after 5 minutes
1402
+ setTimeout(() => {
1403
+ activeSessions.delete(session.sessionId);
1404
+ }, 5 * 60 * 1000);
1405
+ logToolResult('deliberate', true, `Complete deliberation session ${session.sessionId} with ${session.toolUsageCount} tool recommendations`);
1406
+ return {
1407
+ content: [{
1408
+ type: "text",
1409
+ text: finalOutput
1410
+ }]
1411
+ };
1412
+ }
1413
+ // --- MCP Tool Registration ---
1240
1414
  /**
1241
- * 🚀 ENHANCED 6-STAGE COGNITIVE DELIBERATION FRAMEWORK - 2025 EDITION
1415
+ * CRITICAL: Interactive Multi-Input Cognitive Deliberation Tool
1242
1416
  *
1243
- * This implementation represents the evolution of cognitive processing, integrating:
1244
- * - Scientific Investigation methodology for systematic hypothesis formation
1245
- * - OOReD (Observe-Orient-Reason-Decide) framework for strategic analysis
1246
- * - Critical Thinking 10-step framework for comprehensive evaluation
1247
- * - Advanced prompting strategies distributed optimally across all stages
1417
+ * This tool FORCES LLMs through a 3-input deliberation process:
1418
+ * 1. Initial input Stages 1-2 processing → Request second input
1419
+ * 2. Second input → Stages 3-6 processing Request third input
1420
+ * 3. Third input Final formatting → Return comprehensive result
1248
1421
  *
1249
- * 📚 INTEGRATED PROMPTING STRATEGIES:
1250
- *
1251
- * **STAGE 1 - Scientific Investigation:** Chain-of-Thought + Role-Based Prompting
1252
- * - Systematic hypothesis formation using scientific method
1253
- * - Expert domain perspective integration
1254
- * - Step-by-step reasoning for complex problem decomposition
1255
- *
1256
- * **STAGE 2 - Initial OOReD:** Tree-of-Thoughts + Meta-Prompting
1257
- * - Multiple parallel reasoning paths exploration
1258
- * - Self-reflection on reasoning quality and consistency
1259
- * - Alternative solution pathway evaluation
1260
- *
1261
- * **STAGE 3 - Critical Thinking + Pre-Act:** Self-Consistency + Meta-Prompting
1262
- * - 10-step critical thinking framework application
1263
- * - Multiple validation approaches for reliability
1264
- * - Pre-action planning with tool identification
1265
- *
1266
- * **STAGE 4 - SCIENTIFIC REVIEW:** Chain-of-Thought + Self-Consistency
1267
- * - Systematic review of initial investigation findings
1268
- * - Cross-validation using multiple approaches
1269
- * - Enhanced evidence quality assessment
1270
- *
1271
- * **STAGE 5 - OOReD REVIEW:** Tree-of-Thoughts + Role-Based Prompting
1272
- * - Multi-path refinement of reasoning processes
1273
- * - Expert domain perspectives integration
1274
- * - Cross-stage consistency optimization
1275
- *
1276
- * **STAGE 6 - Final Action:** All Strategies Integrated
1277
- * - Comprehensive synthesis of all previous stages
1278
- * - Fact-based actionable recommendations
1279
- * - Complete quality assurance and validation
1280
- *
1281
- * 🎯 COGNITIVE ENHANCEMENT BENEFITS:
1282
- *
1283
- * **Enhanced Reliability:**
1284
- * - 6-stage validation process reduces errors by 45-60%
1285
- * - Cross-stage consistency checking improves reliability
1286
- * - Multiple prompting strategy integration enhances robustness
1287
- *
1288
- * **Improved Depth:**
1289
- * - Scientific methodology ensures systematic investigation
1290
- * - Critical thinking framework provides comprehensive analysis
1291
- * - Expert perspectives add domain-specific insights
1292
- *
1293
- * **Better Actionability:**
1294
- * - Pre-action planning identifies required tools and resources
1295
- * - Fact-based final recommendations with implementation roadmaps
1296
- * - Risk mitigation and contingency planning integrated
1297
- *
1298
- * 📊 PERFORMANCE METRICS:
1299
- * - Analysis Depth: 95% comprehensive coverage
1300
- * - Reasoning Consistency: 92% cross-stage alignment
1301
- * - Implementation Feasibility: 88% actionable recommendations
1302
- * - Quality Assurance: 94% validation success rate
1303
- */
1304
- /**
1305
- * Tool: deliberate (Enhanced 6-Stage Cognitive Processing Engine - AUTOMATIC INTERNAL PROCESSING)
1306
- *
1307
- * AUTOMATIC INTERNAL PROCESSING:
1308
- * - Internally processes all 6 stages automatically in a single call
1309
- * - Stage 1: Scientific Investigation (Chain-of-Thought + Role-Based Prompting)
1310
- * - Stage 2: Initial OOReD Analysis (Tree-of-Thoughts + Meta-Prompting)
1311
- * - Stage 3: Critical Thinking & Pre-Action Planning (Self-Consistency + Meta-Prompting)
1312
- * - Stage 4: Scientific Review & Validation (Chain-of-Thought + Self-Consistency)
1313
- * - Stage 5: OOReD Review & Refinement (Tree-of-Thoughts + Role-Based)
1314
- * - Stage 6: Final Action & Recommendations (All strategies integrated)
1315
- * - Returns comprehensive final result with all cognitive enhancement completed
1422
+ * REQUIRED FLOW:
1423
+ * - Phase 1: LLM provides problem → Tool processes stages 1-2 → Asks for second input
1424
+ * - Phase 2: LLM provides refinement Tool processes stages 3-6 → Asks for final input
1425
+ * - Phase 3: LLM provides confirmation → Tool returns final formatted output + tool count
1316
1426
  *
1317
1427
  * Benefits:
1318
- * - 45-60% error reduction through multi-stage validation
1319
- * - Enhanced reasoning quality through progressive complexity
1320
- * - Optimal prompting strategy selection via parallel evaluation
1321
- * - Comprehensive perspective integration with domain expertise
1322
- * - Cross-stage validation with consistency checking
1323
- * - Comprehensive action planning with risk mitigation
1324
- * - Single call convenience - no manual phase management required
1428
+ * - Forces iterative thinking for robust cognitive analysis
1429
+ * - Prevents LLMs from stopping after partial deliberation
1430
+ * - Ensures comprehensive 6-stage processing completion
1431
+ * - Optimal for low-context models requiring guided interaction
1432
+ * - Returns actionable tool recommendations with usage count
1325
1433
  */
1326
1434
  server.tool("deliberate", {
1327
1435
  input: z
1328
1436
  .string()
1329
- .describe("REQUIRED: The problem, question, decision, or situation requiring cognitive deliberation. Each unique input starts a new 6-stage progression session."),
1437
+ .describe("Your problem, question, or situation for cognitive enhancement. This tool will guide you through MULTIPLE required inputs for thorough analysis."),
1330
1438
  mode: z
1331
1439
  .enum(["analyze", "decide", "synthesize", "evaluate"])
1332
1440
  .default("analyze")
1333
- .describe("Cognitive processing mode: 'analyze' for breakdown, 'decide' for decision making, 'synthesize' for integration, 'evaluate' for assessment"),
1441
+ .describe("Cognitive processing mode for the deliberation session"),
1334
1442
  context: z
1335
1443
  .string()
1336
1444
  .optional()
1337
- .describe("Optional additional context, constraints, or background information")
1338
- }, async ({ input, mode, context }) => {
1445
+ .describe("Optional additional context, constraints, or background information"),
1446
+ session_id: z
1447
+ .string()
1448
+ .optional()
1449
+ .describe("Session ID for continuing multi-phase deliberation (provided by tool in previous responses)")
1450
+ }, async ({ input, mode, context, session_id }) => {
1339
1451
  const toolName = 'deliberate';
1340
- logToolCall(toolName, `Mode: ${mode}, Context: ${context ? 'Yes' : 'No'}`);
1341
- try {
1342
- // Process all 6 stages internally and automatically
1343
- const result = await performCognitiveDeliberation(input, mode, context);
1344
- logToolResult(toolName, true, `All 6 stages processed successfully`);
1345
- return {
1346
- content: [
1347
- {
1348
- type: "text",
1349
- text: result
1350
- }
1351
- ]
1452
+ // Handle session continuation or start new session
1453
+ let session;
1454
+ if (session_id && activeSessions.has(session_id)) {
1455
+ // Continue existing session
1456
+ session = activeSessions.get(session_id);
1457
+ logToolCall(toolName, `Continuing session ${session_id}, Phase: ${session.phase}`);
1458
+ }
1459
+ else {
1460
+ // Start new session
1461
+ const sessionId = generateSessionId();
1462
+ session = {
1463
+ sessionId,
1464
+ originalInput: input,
1465
+ mode,
1466
+ context,
1467
+ phase: "awaiting_input_1",
1468
+ toolUsageCount: 0,
1469
+ createdAt: Date.now()
1352
1470
  };
1471
+ activeSessions.set(sessionId, session);
1472
+ logToolCall(toolName, `New session ${sessionId}, Mode: ${mode}`);
1473
+ }
1474
+ try {
1475
+ switch (session.phase) {
1476
+ case "awaiting_input_1":
1477
+ return await handlePhase1(session, input);
1478
+ case "awaiting_input_2":
1479
+ return await handlePhase2(session, input);
1480
+ case "awaiting_input_3":
1481
+ return await handlePhase3(session, input);
1482
+ default:
1483
+ throw new Error(`Invalid session phase: ${session.phase}`);
1484
+ }
1353
1485
  }
1354
1486
  catch (error) {
1487
+ // Clean up session on error
1488
+ if (session_id) {
1489
+ activeSessions.delete(session_id);
1490
+ }
1355
1491
  return logToolError(toolName, error);
1356
1492
  }
1357
1493
  });
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@nbiish/cognitive-tools-mcp",
3
- "version": "8.6.1",
4
- "description": "Enhanced Cognitive Processing MCP Server - Automatically processes all 6 cognitive stages internally (Scientific Investigation, OOReD Analysis, Critical Thinking, Scientific Review, OOReD Review, Final Action) and returns comprehensive results. Integrates advanced prompting strategies for optimal cognitive enhancement.",
3
+ "version": "8.6.3",
4
+ "description": "Interactive Multi-Phase Cognitive Processing MCP Server - Forces LLMs through 3-input deliberation phases for comprehensive 6-stage cognitive enhancement. Prevents partial analysis and ensures thorough cognitive processing.",
5
5
  "private": false,
6
6
  "type": "module",
7
7
  "bin": {