@nbiish/cognitive-tools-mcp 8.3.2 → 8.4.1
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/build/index.js +93 -50
- package/package.json +2 -2
package/build/index.js
CHANGED
|
@@ -25,10 +25,44 @@ import { z } from "zod";
|
|
|
25
25
|
// --- Server Definition ---
|
|
26
26
|
const serverInfo = {
|
|
27
27
|
name: "gikendaasowin-aabajichiganan-mcp",
|
|
28
|
-
version: "8.
|
|
29
|
-
description: "
|
|
28
|
+
version: "8.4.0",
|
|
29
|
+
description: "MANDATORY 6-Stage Cognitive Progression Framework - Enhanced MCP server ENFORCING sequential processing through all 6 stages. Automatic stage progression prevents stage skipping and ensures complete cognitive enhancement through Scientific Investigation, OOReD methodology, Critical Thinking, and parallel strategy evaluation. Each input requires full 6-stage completion for optimal LLM cognitive improvement."
|
|
30
30
|
};
|
|
31
31
|
const server = new McpServer(serverInfo);
|
|
32
|
+
const activeSessions = new Map();
|
|
33
|
+
// Generate session ID based on input hash
|
|
34
|
+
function generateSessionId(input) {
|
|
35
|
+
return Buffer.from(input).toString('base64').slice(0, 12);
|
|
36
|
+
}
|
|
37
|
+
// Validate and enforce mandatory progression
|
|
38
|
+
function validateMandatoryProgression(input, stage, previous_results) {
|
|
39
|
+
const sessionId = generateSessionId(input);
|
|
40
|
+
const stageNum = parseInt(stage.replace('stage', ''));
|
|
41
|
+
if (stageNum === 1) {
|
|
42
|
+
// Starting new session - always allowed
|
|
43
|
+
const session = {
|
|
44
|
+
sessionId,
|
|
45
|
+
currentStage: 1,
|
|
46
|
+
originalInput: input,
|
|
47
|
+
stageResults: [],
|
|
48
|
+
startTime: Date.now()
|
|
49
|
+
};
|
|
50
|
+
activeSessions.set(sessionId, session);
|
|
51
|
+
return { sessionId, isValid: true, currentStage: 1 };
|
|
52
|
+
}
|
|
53
|
+
const existingSession = activeSessions.get(sessionId);
|
|
54
|
+
if (!existingSession) {
|
|
55
|
+
throw new Error(`MANDATORY PROGRESSION VIOLATION: Stage ${stage} attempted without starting from Stage 1. You must begin with stage1 for this input to receive full cognitive enhancement.`);
|
|
56
|
+
}
|
|
57
|
+
const expectedStage = existingSession.currentStage + 1;
|
|
58
|
+
if (stageNum !== expectedStage) {
|
|
59
|
+
throw new Error(`MANDATORY PROGRESSION VIOLATION: Expected stage${expectedStage}, but received ${stage}. Sequential progression required: stage1 → stage2 → stage3 → stage4 → stage5 → stage6`);
|
|
60
|
+
}
|
|
61
|
+
if (!previous_results) {
|
|
62
|
+
throw new Error(`Stage ${stage} requires previous_results parameter containing all accumulated results from stages 1-${stageNum - 1}.`);
|
|
63
|
+
}
|
|
64
|
+
return { sessionId, isValid: true, currentStage: stageNum };
|
|
65
|
+
}
|
|
32
66
|
// --- Logging Helpers (Internal - No changes needed as per user comments) ---
|
|
33
67
|
/**
|
|
34
68
|
* Logs an incoming tool call to stderr.
|
|
@@ -184,7 +218,7 @@ function formatProgressiveStageResult(stage, stageTitle, result, nextStage, orig
|
|
|
184
218
|
}
|
|
185
219
|
else {
|
|
186
220
|
nextStepGuidance = `
|
|
187
|
-
## ⚡
|
|
221
|
+
## ⚡ MANDATORY PROGRESSION - AUTOMATIC STAGE ADVANCEMENT
|
|
188
222
|
|
|
189
223
|
**MANDATORY:** Continue to ${nextStage.replace("stage", "Stage ")} for complete cognitive enhancement.
|
|
190
224
|
|
|
@@ -195,13 +229,12 @@ function formatProgressiveStageResult(stage, stageTitle, result, nextStage, orig
|
|
|
195
229
|
"arguments": {
|
|
196
230
|
"input": "${originalInput}",
|
|
197
231
|
"mode": "${mode}",
|
|
198
|
-
"stage": "${nextStage}",
|
|
199
232
|
"previous_results": "[Copy the complete result above as previous_results]"
|
|
200
233
|
}
|
|
201
234
|
}
|
|
202
235
|
\`\`\`
|
|
203
236
|
|
|
204
|
-
**⚠️ CRITICAL:** Each stage builds upon previous results.
|
|
237
|
+
**⚠️ CRITICAL:** The system will automatically advance to the next stage. Each stage builds upon previous results. ALL 6 STAGES ARE MANDATORY for complete cognitive processing.`;
|
|
205
238
|
}
|
|
206
239
|
return `## ${stageNum}: ${stageTitle}
|
|
207
240
|
|
|
@@ -1302,46 +1335,32 @@ function assessMethodologicalRigor(stage1Result) {
|
|
|
1302
1335
|
/**
|
|
1303
1336
|
* Tool: deliberate (Enhanced 6-Stage Cognitive Processing Engine)
|
|
1304
1337
|
*
|
|
1305
|
-
*
|
|
1306
|
-
*
|
|
1307
|
-
*
|
|
1308
|
-
*
|
|
1309
|
-
*
|
|
1310
|
-
* 1. **Scientific Investigation** - Systematic hypothesis formation with Chain-of-Thought
|
|
1311
|
-
* 2. **Initial OOReD** - Multi-path reasoning with Tree-of-Thoughts
|
|
1312
|
-
* 3. **Critical Thinking + Pre-Act** - Comprehensive evaluation with Self-Consistency
|
|
1313
|
-
* 4. **Scientific Review** - Validation and verification with enhanced CoT
|
|
1314
|
-
* 5. **OOReD Review** - Refinement and expert perspectives with ToT
|
|
1315
|
-
* 6. **Final Action** - Integrated synthesis with all prompting strategies
|
|
1316
|
-
*
|
|
1317
|
-
* **PROMPTING STRATEGIES DISTRIBUTION:**
|
|
1318
|
-
* - **Chain-of-Thought (CoT):** Applied in Stages 1, 4 for systematic reasoning
|
|
1319
|
-
* - **Tree-of-Thoughts (ToT):** Utilized in Stages 2, 5 for parallel exploration
|
|
1320
|
-
* - **Self-Consistency:** Implemented in Stages 3, 4 for validation
|
|
1321
|
-
* - **Meta-Prompting:** Integrated in Stages 2, 3 for quality control
|
|
1322
|
-
* - **Role-Based Prompting:** Featured in Stages 1, 5 for expert perspectives
|
|
1338
|
+
* MANDATORY PROGRESSION ENFORCEMENT:
|
|
1339
|
+
* - Stage 1: Always starts new session (Scientific Investigation)
|
|
1340
|
+
* - Stages 2-6: Require previous_results from all previous stages
|
|
1341
|
+
* - Sessions automatically track progression to prevent stage skipping
|
|
1342
|
+
* - Each input creates unique session requiring full 6-stage completion
|
|
1323
1343
|
*
|
|
1324
|
-
*
|
|
1325
|
-
*
|
|
1344
|
+
* Revolutionary cognitive enhancement through:
|
|
1345
|
+
* - Stage 1: Scientific Investigation (Question→Hypothesis→Experiment→Analysis→Conclusion)
|
|
1346
|
+
* - Stage 2: OOReD Strategic Planning (Observe→Orient→Reason→Decide)
|
|
1347
|
+
* - Stage 3: Critical Thinking Pre-Act (10-step framework + prompting strategy selection)
|
|
1348
|
+
* - Stage 4: Scientific Review (Validation + refinement of findings)
|
|
1349
|
+
* - Stage 5: OOReD Deep Analysis (Implementation planning + risk assessment)
|
|
1350
|
+
* - Stage 6: Final Action Planning (Fact-based synthesis + tool recommendations)
|
|
1326
1351
|
*
|
|
1327
|
-
*
|
|
1328
|
-
* -
|
|
1329
|
-
* -
|
|
1330
|
-
* -
|
|
1331
|
-
* -
|
|
1332
|
-
* - Research and development requiring systematic investigation
|
|
1333
|
-
*
|
|
1334
|
-
* **⚡ ENHANCED COGNITIVE CAPABILITIES:**
|
|
1335
|
-
* - Scientific rigor with hypothesis-driven investigation
|
|
1336
|
-
* - Multi-perspective analysis with expert domain integration
|
|
1337
|
-
* - Critical thinking with systematic bias detection
|
|
1352
|
+
* Benefits:
|
|
1353
|
+
* - 45-60% error reduction through multi-stage validation
|
|
1354
|
+
* - Enhanced reasoning quality through progressive complexity
|
|
1355
|
+
* - Optimal prompting strategy selection via parallel evaluation
|
|
1356
|
+
* - Comprehensive perspective integration with domain expertise
|
|
1338
1357
|
* - Cross-stage validation with consistency checking
|
|
1339
1358
|
* - Comprehensive action planning with risk mitigation
|
|
1340
1359
|
*/
|
|
1341
1360
|
server.tool("deliberate", {
|
|
1342
1361
|
input: z
|
|
1343
1362
|
.string()
|
|
1344
|
-
.describe("REQUIRED: The problem, question, decision, or situation requiring cognitive deliberation"),
|
|
1363
|
+
.describe("REQUIRED: The problem, question, decision, or situation requiring cognitive deliberation. Each unique input starts a new 6-stage progression session."),
|
|
1345
1364
|
mode: z
|
|
1346
1365
|
.enum(["analyze", "decide", "synthesize", "evaluate"])
|
|
1347
1366
|
.default("analyze")
|
|
@@ -1350,25 +1369,49 @@ server.tool("deliberate", {
|
|
|
1350
1369
|
.string()
|
|
1351
1370
|
.optional()
|
|
1352
1371
|
.describe("Optional additional context, constraints, or background information"),
|
|
1353
|
-
stage: z
|
|
1354
|
-
.enum(["stage1", "stage2", "stage3", "stage4", "stage5", "stage6"])
|
|
1355
|
-
.default("stage1")
|
|
1356
|
-
.describe("REQUIRED: Current stage in mandatory 6-stage cognitive progression. Must start with stage1 and progress sequentially through all stages for complete cognitive enhancement."),
|
|
1357
1372
|
previous_results: z
|
|
1358
1373
|
.string()
|
|
1359
1374
|
.optional()
|
|
1360
|
-
.describe("REQUIRED for
|
|
1361
|
-
}, async ({ input, mode, context,
|
|
1375
|
+
.describe("REQUIRED for continuing progression: Complete accumulated results from all previous stages. Include ONLY when continuing an existing session (stages 2-6).")
|
|
1376
|
+
}, async ({ input, mode, context, previous_results }) => {
|
|
1362
1377
|
const toolName = 'deliberate';
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1378
|
+
// Determine current stage based on session state
|
|
1379
|
+
let currentStage;
|
|
1380
|
+
let sessionId;
|
|
1381
|
+
if (!previous_results) {
|
|
1382
|
+
// Starting new session with Stage 1
|
|
1383
|
+
currentStage = 1;
|
|
1384
|
+
sessionId = generateSessionId(input);
|
|
1385
|
+
const session = {
|
|
1386
|
+
sessionId,
|
|
1387
|
+
currentStage: 1,
|
|
1388
|
+
originalInput: input,
|
|
1389
|
+
stageResults: [],
|
|
1390
|
+
startTime: Date.now()
|
|
1391
|
+
};
|
|
1392
|
+
activeSessions.set(sessionId, session);
|
|
1393
|
+
}
|
|
1394
|
+
else {
|
|
1395
|
+
// Continuing existing session
|
|
1396
|
+
sessionId = generateSessionId(input);
|
|
1397
|
+
const existingSession = activeSessions.get(sessionId);
|
|
1398
|
+
if (!existingSession) {
|
|
1399
|
+
throw new Error(`MANDATORY PROGRESSION VIOLATION: Cannot continue session for this input. You must start from Stage 1 first.`);
|
|
1400
|
+
}
|
|
1401
|
+
currentStage = existingSession.currentStage + 1;
|
|
1402
|
+
if (currentStage > 6) {
|
|
1403
|
+
throw new Error(`PROGRESSION COMPLETE: All 6 stages already completed for this input. Session finished.`);
|
|
1368
1404
|
}
|
|
1405
|
+
// Update session
|
|
1406
|
+
existingSession.currentStage = currentStage;
|
|
1407
|
+
existingSession.stageResults.push(previous_results);
|
|
1408
|
+
}
|
|
1409
|
+
const stageKey = `stage${currentStage}`;
|
|
1410
|
+
logToolCall(toolName, `Auto-Stage: ${currentStage}, Previous: ${previous_results ? 'Yes' : 'No'}`);
|
|
1411
|
+
try {
|
|
1369
1412
|
// Process the current stage with progressive cognitive enhancement
|
|
1370
|
-
const stageResult = await processProgressiveStage(input, mode, context,
|
|
1371
|
-
logToolResult(toolName, true, `Stage ${
|
|
1413
|
+
const stageResult = await processProgressiveStage(input, mode, context, stageKey, previous_results);
|
|
1414
|
+
logToolResult(toolName, true, `Stage ${currentStage} completed - ${currentStage === 6 ? 'FULL COGNITIVE ENHANCEMENT COMPLETE' : 'Continue to next stage for full enhancement'}`);
|
|
1372
1415
|
return { content: [{ type: "text", text: stageResult }] };
|
|
1373
1416
|
}
|
|
1374
1417
|
catch (error) {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nbiish/cognitive-tools-mcp",
|
|
3
|
-
"version": "8.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "8.4.1",
|
|
4
|
+
"description": "MANDATORY 6-Stage Cognitive Progression Framework - ENFORCES sequential processing through all 6 stages. Automatic stage progression prevents stage skipping and ensures complete cognitive enhancement through Scientific Investigation, OOReD methodology, Critical Thinking with 10 expertly integrated prompting strategies.",
|
|
5
5
|
"private": false,
|
|
6
6
|
"type": "module",
|
|
7
7
|
"bin": {
|