@nbiish/cognitive-tools-mcp 8.9.3 → 10.0.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/README.md +39 -37
- package/build/index.js +82 -392
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -22,7 +22,9 @@
|
|
|
22
22
|
◈──◆──◇─────────────────────────────────────────────────◇──◆──◈
|
|
23
23
|
</div>
|
|
24
24
|
|
|
25
|
-
Revolutionary MCP server with Enhanced 2-Round, 6-Stage Cognitive Deliberation Framework (v8.9.
|
|
25
|
+
Revolutionary MCP server with Enhanced 2-Round, 6-Stage Cognitive Deliberation Framework (v8.9.6). The `deliberate` tool implements an **LLM-guided cognitive enhancement framework** that prompts LLMs to evaluate and select from **15 modern cognitive techniques** using a **0.00-0.99 scoring system** with **≥1.53 threshold rule** - accepting only `input` and `context` parameters. *(Integration guidelines in [`latest.md`](latest.md) are licensed under [LICENSE](LICENSE).)*
|
|
26
|
+
|
|
27
|
+
**🚀 MAJOR BREAKTHROUGH (v8.9.6):** Complete architectural transformation from hardcoded `CognitiveDeliberationEngine` to LLM-guided `DeliberationEngine`. The tool now functions as a **cognitive framework enhancer** that prompts LLMs to evaluate techniques themselves rather than providing pre-calculated scores, enabling true adaptive reasoning.
|
|
26
28
|
|
|
27
29
|
Known as:
|
|
28
30
|
- Anishinaabemowin: [`@nbiish/gikendaasowin-aabajichiganan-mcp`](https://www.npmjs.com/package/@nbiish/gikendaasowin-aabajichiganan-mcp)
|
|
@@ -38,7 +40,7 @@ Both packages are maintained in parallel and receive the same updates. You can u
|
|
|
38
40
|
|
|
39
41
|
## ᐴ REPOSITORY STRUCTURE ᔔ [MAZINAAZIWIN] ◈──◆──◇──◆──◈
|
|
40
42
|
|
|
41
|
-
Current repository structure (v8.9.
|
|
43
|
+
Current repository structure (v8.9.6):
|
|
42
44
|
|
|
43
45
|
```text
|
|
44
46
|
.
|
|
@@ -76,33 +78,33 @@ Current repository structure (v8.9.2):
|
|
|
76
78
|
|
|
77
79
|
## ᐴ GASHKITOONAN ᔔ [ENHANCED CAPABILITIES] ◈──◆──◇──◆──◈
|
|
78
80
|
|
|
79
|
-
### 🚀 Revolutionary
|
|
81
|
+
### 🚀 Revolutionary LLM-Guided Cognitive Framework (v8.9.6)
|
|
82
|
+
|
|
83
|
+
**NEW IN v8.9.6: COMPLETE ARCHITECTURAL TRANSFORMATION**
|
|
84
|
+
|
|
85
|
+
- **LLM-Guided Evaluation:** Tool prompts LLMs to evaluate cognitive techniques rather than providing hardcoded scores
|
|
86
|
+
- **True Adaptive Reasoning:** No pre-calculated evaluations - LLMs determine optimal strategies dynamically
|
|
87
|
+
- **15 Modern Cognitive Techniques:** Complete prompting strategy arsenal from Cache-Augmented Reasoning to Multimodal Synthesis
|
|
88
|
+
- **0.00-0.99 Scoring Framework:** LLMs evaluate solution level + efficiency level with ≥1.53 threshold rule
|
|
89
|
+
- **Iterative Enhancement:** Built-in guidance to return to deliberate after tool usage for continuous improvement
|
|
80
90
|
|
|
81
|
-
**
|
|
91
|
+
**Revolutionary LLM-Guidance Architecture:**
|
|
82
92
|
|
|
83
|
-
|
|
84
|
-
- **Zero Filler Verbiage:** No formatting constraints, headers, or verbose output
|
|
85
|
-
- **Dynamic Strategy Selection:** Evaluates modern-prompting.mdc strategies with 0.00-1.00 rating system
|
|
86
|
-
- **Auto-Mode Detection:** Automatically determines analyze/decide/synthesize/evaluate approach
|
|
87
|
-
- **Pure Cognitive Output:** Raw cognitive processing results for maximum LLM flexibility
|
|
93
|
+
**Framework Delivery Phase:**
|
|
88
94
|
|
|
89
|
-
**
|
|
95
|
+
- **6-Stage Structure Presentation** - Complete deliberation framework with critical thinking questions
|
|
96
|
+
- **Cognitive Technique Catalog** - All 15 modern prompting strategies for LLM evaluation
|
|
97
|
+
- **Scoring Instructions** - Clear 0.00-0.99 evaluation criteria with threshold-based selection rules
|
|
90
98
|
|
|
91
|
-
**
|
|
92
|
-
- **Stage 1: Scientific Investigation** - Systematic hypothesis formation with scientific method
|
|
93
|
-
- **Stage 2: Initial OOReD** - Multiple reasoning path exploration with Tree-of-Thoughts
|
|
99
|
+
**LLM Processing Phase:**
|
|
94
100
|
|
|
95
|
-
**
|
|
96
|
-
- **
|
|
97
|
-
- **
|
|
98
|
-
- **
|
|
99
|
-
- **Stage 6: Final Action** - Comprehensive synthesis with actionable recommendations
|
|
101
|
+
- **Dynamic Technique Selection** - LLM evaluates and scores techniques based on specific problem context
|
|
102
|
+
- **Strategy Combination** - Multiple techniques used when scoring ≥1.53 for enhanced effectiveness
|
|
103
|
+
- **Tool Planning Integration** - Recommendations for tool usage count and re-deliberation timing
|
|
104
|
+
- **Adaptive Implementation** - LLM applies selected cognitive approaches to actual problem solving
|
|
100
105
|
|
|
101
|
-
**
|
|
102
|
-
-
|
|
103
|
-
- Assigns solution level (0.00-0.99) + efficiency level (0.00-0.99) ratings
|
|
104
|
-
- Uses strategies with combined rating ≥1.42 (combines multiple if ≥1.53)
|
|
105
|
-
- Includes natural "tool use before re-deliberation: X" count in output
|
|
106
|
+
**Core Innovation:**
|
|
107
|
+
This breakthrough enables LLMs to **meta-cognitively select** their own reasoning approaches rather than following pre-determined paths, resulting in truly adaptive and context-appropriate problem solving.
|
|
106
108
|
|
|
107
109
|
<div align="center">
|
|
108
110
|
◈──◆──◇─────────────────────────────────────────────────◇──◆──◈
|
|
@@ -110,33 +112,33 @@ Current repository structure (v8.9.2):
|
|
|
110
112
|
|
|
111
113
|
## ᐴ APITENDAAGOZIJIG ᔔ [PERFORMANCE METRICS] ◈──◆──◇──◆──◈
|
|
112
114
|
|
|
113
|
-
- **
|
|
114
|
-
- **
|
|
115
|
-
- **
|
|
116
|
-
- **
|
|
117
|
-
- **
|
|
115
|
+
- **LLM-Guided Evaluation:** Prompts LLMs to evaluate and score 15+ cognitive techniques dynamically
|
|
116
|
+
- **True Adaptive Reasoning:** No hardcoded evaluations - strategies selected based on problem context
|
|
117
|
+
- **Meta-Cognitive Enhancement:** LLMs learn to select their own optimal reasoning approaches
|
|
118
|
+
- **Iterative Improvement:** Built-in guidance for tool usage and re-deliberation cycles
|
|
119
|
+
- **Threshold-Based Selection:** ≥1.53 scoring rule ensures quality technique combination
|
|
118
120
|
|
|
119
121
|
<div align="center">
|
|
120
122
|
◈──◆──◇─────────────────────────────────────────────────◇──◆──◈
|
|
121
123
|
</div>
|
|
122
124
|
|
|
123
|
-
## 🚀
|
|
125
|
+
## 🚀 LLM-Guided Cognitive Enhancement Framework (v8.9.6)
|
|
124
126
|
|
|
125
|
-
This revolutionary update transforms the deliberation tool
|
|
127
|
+
This revolutionary update transforms the deliberation tool from a hardcoded evaluation system into an **LLM-guided cognitive enhancement framework** that enables true adaptive reasoning.
|
|
126
128
|
|
|
127
129
|
### Core Innovation
|
|
128
130
|
|
|
129
|
-
**
|
|
131
|
+
**Meta-Cognitive Selection:** The tool now prompts LLMs to evaluate and select cognitive techniques themselves using a structured 0.00-0.99 scoring system, enabling context-appropriate strategy selection rather than pre-determined approaches.
|
|
130
132
|
|
|
131
133
|
### Processing Architecture
|
|
132
134
|
|
|
133
|
-
1. **
|
|
134
|
-
2. **
|
|
135
|
-
3. **
|
|
136
|
-
4. **
|
|
137
|
-
5. **
|
|
135
|
+
1. **Framework Presentation:** Delivers complete 6-stage deliberation structure with critical thinking questions
|
|
136
|
+
2. **Technique Catalog:** Presents all 15 modern cognitive techniques for LLM evaluation
|
|
137
|
+
3. **Scoring Framework:** Guides LLM through solution level + efficiency level evaluation (≥1.53 threshold)
|
|
138
|
+
4. **Dynamic Selection:** LLM chooses optimal techniques based on specific problem requirements
|
|
139
|
+
5. **Implementation Guidance:** Provides tool usage recommendations and re-deliberation encouragement
|
|
138
140
|
|
|
139
|
-
This
|
|
141
|
+
This breakthrough enables LLMs to **learn and adapt their own reasoning approaches** while leveraging advanced cognitive frameworks for enhanced problem-solving capabilities!
|
|
140
142
|
|
|
141
143
|
<div align="center">
|
|
142
144
|
◈──◆──◇─────────────────────────────────────────────────◇──◆──◈
|
package/build/index.js
CHANGED
|
@@ -2,445 +2,143 @@
|
|
|
2
2
|
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
|
|
3
3
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
4
4
|
import { CallToolRequestSchema, ListToolsRequestSchema, } from "@modelcontextprotocol/sdk/types.js";
|
|
5
|
-
//
|
|
5
|
+
// Compressed cognitive strategies from modern-prompting research
|
|
6
6
|
const PROMPTING_STRATEGIES = {
|
|
7
|
+
"Chain of Draft (CoD)": {
|
|
8
|
+
description: "Concise reasoning drafts ≤5 words/step. Essential calculations only. Abstract verbose details."
|
|
9
|
+
},
|
|
7
10
|
"Cache-Augmented Reasoning + ReAct": {
|
|
8
|
-
description: "Interleave
|
|
9
|
-
type: "primary"
|
|
11
|
+
description: "Interleave knowledge activation with reasoning cycles. Keep rationale concise (≤8 bullets). Progressive knowledge building."
|
|
10
12
|
},
|
|
11
13
|
"Self-Consistency": {
|
|
12
|
-
description: "Generate 3
|
|
13
|
-
type: "primary"
|
|
14
|
+
description: "Generate 3 reasoning drafts in parallel. Return most consistent answer for high-stakes decisions."
|
|
14
15
|
},
|
|
15
16
|
"PAL (Program-Aided Language)": {
|
|
16
|
-
description: "Generate executable code for computational tasks. Include result + minimal rationale
|
|
17
|
-
type: "primary"
|
|
17
|
+
description: "Generate executable code for computational tasks. Include result + minimal rationale. Prefix '# PoT offload'."
|
|
18
18
|
},
|
|
19
19
|
"Reflexion": {
|
|
20
|
-
description: "Single critique and revision cycle. Use when confidence < 0.7. Avoid verbose chain-of-thought exposure."
|
|
21
|
-
type: "primary"
|
|
20
|
+
description: "Single critique and revision cycle. Use when confidence < 0.7. Avoid verbose chain-of-thought exposure."
|
|
22
21
|
},
|
|
23
22
|
"Context-Compression": {
|
|
24
|
-
description: "
|
|
25
|
-
type: "primary"
|
|
23
|
+
description: "LLMLingua compression when context exceeds budget. Prefer Minimal-CoT and bounded ToT-lite."
|
|
26
24
|
},
|
|
27
25
|
"ToT-lite (Tree of Thoughts)": {
|
|
28
|
-
description: "Bounded breadth/depth exploration.
|
|
29
|
-
|
|
26
|
+
description: "Bounded breadth/depth exploration. Limited branching for complex problem decomposition efficiency."
|
|
27
|
+
},
|
|
28
|
+
"Metacognitive Prompting (MP)": {
|
|
29
|
+
description: "5-stage introspective reasoning: understand → judge → evaluate → decide → assess confidence. Human-like cognition."
|
|
30
30
|
},
|
|
31
31
|
"Automated Prompt Optimization (APO)": {
|
|
32
|
-
description: "Autonomously refine
|
|
33
|
-
type: "advanced"
|
|
32
|
+
description: "Autonomously refine prompts via performance feedback. Expert prompting + iterative refinement. Reduces manual effort."
|
|
34
33
|
},
|
|
35
34
|
"Reflexive Analysis": {
|
|
36
|
-
description: "Embed ethical
|
|
37
|
-
type: "advanced"
|
|
35
|
+
description: "Embed ethical/legal/cultural considerations. Evaluate against project guidelines. Indigenous Data Sovereignty aware."
|
|
38
36
|
},
|
|
39
37
|
"Progressive-Hint Prompting (PHP)": {
|
|
40
|
-
description: "Use
|
|
41
|
-
type: "advanced"
|
|
38
|
+
description: "Use previous outputs as contextual hints. Multi-turn interaction with cumulative knowledge building."
|
|
42
39
|
},
|
|
43
40
|
"Cache-Augmented Generation (CAG)": {
|
|
44
|
-
description: "Preload
|
|
45
|
-
type: "advanced"
|
|
41
|
+
description: "Preload relevant context into working memory. Eliminate real-time retrieval dependencies."
|
|
46
42
|
},
|
|
47
43
|
"Cognitive Scaffolding Prompting": {
|
|
48
|
-
description: "Structure reasoning through metacognitive frameworks.
|
|
49
|
-
type: "advanced"
|
|
44
|
+
description: "Structure reasoning through metacognitive frameworks. Mental model construction + validation. Self-monitoring processes."
|
|
50
45
|
},
|
|
51
46
|
"Internal Knowledge Synthesis (IKS)": {
|
|
52
|
-
description: "Generate hypothetical knowledge constructs from parametric memory.
|
|
53
|
-
type: "advanced"
|
|
47
|
+
description: "Generate hypothetical knowledge constructs from parametric memory. Cross-reference internal knowledge consistency."
|
|
54
48
|
},
|
|
55
49
|
"Multimodal Synthesis": {
|
|
56
|
-
description: "Process
|
|
57
|
-
type: "advanced"
|
|
50
|
+
description: "Process text/images/data integration. Visual question answering + cross-modal analysis. Broader task solutions."
|
|
58
51
|
},
|
|
59
52
|
"Knowledge Synthesis Prompting (KSP)": {
|
|
60
|
-
description: "Integrate
|
|
61
|
-
type: "advanced"
|
|
53
|
+
description: "Integrate multiple internal domains. Fine-grained coherence validation. Cross-domain knowledge integration."
|
|
62
54
|
},
|
|
63
55
|
"Prompt Compression": {
|
|
64
|
-
description: "LLMLingua for token budget management. Preserve semantic content while reducing length
|
|
65
|
-
type: "advanced"
|
|
56
|
+
description: "LLMLingua for token budget management. Preserve semantic content while reducing length constraints."
|
|
66
57
|
}
|
|
67
58
|
};
|
|
68
|
-
class
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
**2. Form Hypothesis:** ${this.formHypothesis(input, context)}
|
|
76
|
-
|
|
77
|
-
**3. Experimental Design:** ${this.designApproach(input, context)}
|
|
78
|
-
|
|
79
|
-
**4. Data Analysis Framework:** ${this.establishAnalysisFramework(input)}
|
|
80
|
-
|
|
81
|
-
**5. Conclusion Preparation:** ${this.prepareConclusions(input)}`;
|
|
82
|
-
}
|
|
83
|
-
// Stage 2: Initial OOReD
|
|
84
|
-
performInitialOOReD(input, selectedStrategies, context) {
|
|
85
|
-
return `## Initial OOReD Process
|
|
86
|
-
|
|
87
|
-
**Observe:** Input complexity analysis reveals ${this.analyzeComplexity(input)}. Context depth: ${context ? 'comprehensive' : 'minimal'}. Task characteristics: ${this.identifyTaskType(input)}.
|
|
88
|
-
|
|
89
|
-
**Orient:** Solution pathway identification using ${selectedStrategies.join(', ')} strategies. Primary approach: ${this.identifyPrimaryApproach(input, selectedStrategies)}.
|
|
59
|
+
class DeliberationEngine {
|
|
60
|
+
deliberate(input, context) {
|
|
61
|
+
// /// [6-stage self-prompting framework for LLMs with unified input]
|
|
62
|
+
const strategiesList = Object.entries(PROMPTING_STRATEGIES)
|
|
63
|
+
.map(([name, strategy]) => `**${name}:** ${strategy.description}`)
|
|
64
|
+
.join('\n');
|
|
65
|
+
return `You are now entering a 6-stage cognitive deliberation process. Please work through each stage systematically:
|
|
90
66
|
|
|
91
|
-
|
|
67
|
+
## Stage 1: Scientific Investigation
|
|
68
|
+
**Your Task:** Analyze the following prompt using scientific methodology:
|
|
69
|
+
- **Prompt:** "${prompt}"
|
|
92
70
|
|
|
93
|
-
**
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
1. **Purpose:** ${this.identifyPurpose(input)}
|
|
100
|
-
2. **Precise Question:** ${this.refineQuestion(input)}
|
|
101
|
-
3. **Operating Context:** ${this.establishContext(input, context)}
|
|
102
|
-
4. **Information Needs:** ${this.identifyInformationNeeds(input)}
|
|
103
|
-
5. **Credibility Assessment:** ${this.assessCredibility(input, context)}
|
|
104
|
-
6. **Relevant Concepts:** ${this.identifyRelevantConcepts(input)}
|
|
105
|
-
7. **Preliminary Conclusions:** ${this.drawPreliminaryConclusions(input)}
|
|
106
|
-
8. **Assumptions Analysis:** ${this.analyzeAssumptions(input)}
|
|
107
|
-
9. **Implications:** ${this.identifyImplications(input)}
|
|
108
|
-
10. **Consequences:** ${this.assessConsequences(input)}
|
|
109
|
-
|
|
110
|
-
**Pre-Action Tool Planning:** ${this.planToolUsage(input)}`;
|
|
111
|
-
}
|
|
112
|
-
// Stage 4: Scientific Review
|
|
113
|
-
performScientificReview(input, round1Results, context) {
|
|
114
|
-
return `## Scientific Review Process
|
|
115
|
-
|
|
116
|
-
**Question Validation:** ${this.validateQuestion(input, round1Results)}
|
|
71
|
+
**Please identify:**
|
|
72
|
+
1. Core question/problem
|
|
73
|
+
2. Initial hypothesis about the best approach
|
|
74
|
+
3. What type of task this is (computational, reasoning, creative, analysis, planning, general)
|
|
75
|
+
4. Task complexity level (low, medium, high)
|
|
117
76
|
|
|
118
|
-
|
|
77
|
+
## Stage 2: OOReD Process - Strategy Evaluation
|
|
78
|
+
**Orient Stage:** You have access to these cognitive techniques:
|
|
119
79
|
|
|
120
|
-
|
|
80
|
+
${strategiesList}
|
|
121
81
|
|
|
122
|
-
**
|
|
82
|
+
**Your Evaluation Task:**
|
|
83
|
+
For each technique, consider:
|
|
84
|
+
- How well would this technique solve the specific problem? (Solution Level 0.00-0.99)
|
|
85
|
+
- How efficiently can this technique be applied here? (Efficiency Level 0.00-0.99)
|
|
86
|
+
- Total Score = Solution Level + Efficiency Level
|
|
123
87
|
|
|
124
|
-
**
|
|
125
|
-
}
|
|
126
|
-
// Stage 5: OOReD Review
|
|
127
|
-
performOOReD_Review(input, round1Results, selectedStrategies, context) {
|
|
128
|
-
return `## OOReD Review Process
|
|
88
|
+
**Selection Rule:** Choose techniques with total scores ≥1.53 for combined effectiveness
|
|
129
89
|
|
|
130
|
-
|
|
90
|
+
## Stage 3: Critical Thinking Framework
|
|
91
|
+
Apply rapid validation checks:
|
|
92
|
+
1. **Purpose:** What outcome am I optimizing for?
|
|
93
|
+
2. **Question:** What specific problem needs solving?
|
|
94
|
+
3. **Context:** What constraints or requirements apply?
|
|
95
|
+
4. **Evidence:** What facts do I need vs. what do I have?
|
|
96
|
+
5. **Reliability:** How confident am I in my information sources?
|
|
97
|
+
6. **Assumptions:** What am I taking for granted that could be wrong?
|
|
98
|
+
7. **Implications:** What happens if I'm right? What if I'm wrong?
|
|
131
99
|
|
|
132
|
-
|
|
100
|
+
## Stage 4 & 5: Review Cycles
|
|
101
|
+
- Review your strategy selections against the ≥1.53 threshold
|
|
102
|
+
- Validate your reasoning approach
|
|
103
|
+
- Refine your methodology
|
|
133
104
|
|
|
134
|
-
|
|
105
|
+
## Stage 6: Final Action Synthesis
|
|
106
|
+
**Present your analysis in this format:**
|
|
135
107
|
|
|
136
|
-
**
|
|
137
|
-
}
|
|
138
|
-
// Stage 6: Final Action
|
|
139
|
-
performFinalAction(input, allResults, selectedStrategies, context) {
|
|
140
|
-
const toolCount = this.calculateToolUsage(input, allResults);
|
|
141
|
-
return `## Final Action Synthesis
|
|
108
|
+
**DELIBERATION:** [Your thought process through stages 1-5]
|
|
142
109
|
|
|
143
|
-
**
|
|
110
|
+
**SELECTED TOOLS:** [List of tools you estimate are needed to accomplish the task]
|
|
144
111
|
|
|
145
|
-
**
|
|
112
|
+
**Strategy Evaluation Results (0.00-0.99 scale):**
|
|
113
|
+
[Show your evaluations like:]
|
|
114
|
+
- TechniqueName: solution=X.XX, efficiency=Y.YY, total=Z.ZZ ✓ (if ≥1.53)
|
|
146
115
|
|
|
147
|
-
**
|
|
116
|
+
**Selected Cognitive Technique(s):** [List techniques scoring ≥1.53]
|
|
148
117
|
|
|
149
|
-
**
|
|
118
|
+
**Estimated Tools Needed:** [1-8 tools for implementation]
|
|
150
119
|
|
|
151
|
-
|
|
120
|
+
---
|
|
152
121
|
|
|
153
|
-
**
|
|
154
|
-
}
|
|
155
|
-
// Strategy evaluation system
|
|
156
|
-
evaluatePromptingStrategies(input, context) {
|
|
157
|
-
const scores = [];
|
|
158
|
-
for (const [strategyName, strategy] of Object.entries(PROMPTING_STRATEGIES)) {
|
|
159
|
-
const solutionLevel = this.calculateSolutionLevel(input, context, strategy);
|
|
160
|
-
const efficiencyLevel = this.calculateEfficiencyLevel(input, strategy);
|
|
161
|
-
const totalScore = solutionLevel + efficiencyLevel;
|
|
162
|
-
scores.push({
|
|
163
|
-
strategy: strategyName,
|
|
164
|
-
solutionLevel: parseFloat(solutionLevel.toFixed(2)),
|
|
165
|
-
efficiencyLevel: parseFloat(efficiencyLevel.toFixed(2)),
|
|
166
|
-
totalScore: parseFloat(totalScore.toFixed(2)),
|
|
167
|
-
reasoning: this.generateStrategyReasoning(input, strategy, solutionLevel, efficiencyLevel)
|
|
168
|
-
});
|
|
169
|
-
}
|
|
170
|
-
return scores.sort((a, b) => b.totalScore - a.totalScore);
|
|
171
|
-
}
|
|
172
|
-
calculateSolutionLevel(input, context, strategy) {
|
|
173
|
-
let score = 0.1; // Base score
|
|
174
|
-
// Complexity analysis
|
|
175
|
-
const complexity = this.analyzeInputComplexity(input);
|
|
176
|
-
if (complexity === 'high' && strategy.type === 'advanced')
|
|
177
|
-
score += 0.3;
|
|
178
|
-
if (complexity === 'medium' && strategy.type === 'primary')
|
|
179
|
-
score += 0.25;
|
|
180
|
-
if (complexity === 'low')
|
|
181
|
-
score += 0.2;
|
|
182
|
-
// Task type matching
|
|
183
|
-
const taskType = this.identifyTaskType(input);
|
|
184
|
-
if (taskType === 'computational' && strategy.description.includes('code'))
|
|
185
|
-
score += 0.25;
|
|
186
|
-
if (taskType === 'analytical' && strategy.description.includes('reasoning'))
|
|
187
|
-
score += 0.2;
|
|
188
|
-
if (taskType === 'creative' && strategy.description.includes('synthesis'))
|
|
189
|
-
score += 0.15;
|
|
190
|
-
// Context utilization
|
|
191
|
-
if (context && strategy.description.includes('context'))
|
|
192
|
-
score += 0.15;
|
|
193
|
-
return Math.min(score, 0.99);
|
|
194
|
-
}
|
|
195
|
-
calculateEfficiencyLevel(input, strategy) {
|
|
196
|
-
let score = 0.1; // Base score
|
|
197
|
-
// Processing efficiency
|
|
198
|
-
if (strategy.type === 'primary')
|
|
199
|
-
score += 0.3; // Primary strategies are more efficient
|
|
200
|
-
if (strategy.description.includes('concise'))
|
|
201
|
-
score += 0.2;
|
|
202
|
-
if (strategy.description.includes('minimal'))
|
|
203
|
-
score += 0.15;
|
|
204
|
-
// Input length consideration
|
|
205
|
-
const inputLength = input.length;
|
|
206
|
-
if (inputLength < 200 && !strategy.description.includes('complex'))
|
|
207
|
-
score += 0.2;
|
|
208
|
-
if (inputLength > 1000 && strategy.description.includes('compression'))
|
|
209
|
-
score += 0.25;
|
|
210
|
-
// Scalability factors
|
|
211
|
-
if (strategy.description.includes('parallel'))
|
|
212
|
-
score += 0.1;
|
|
213
|
-
if (strategy.description.includes('iterative'))
|
|
214
|
-
score -= 0.05; // Slightly less efficient
|
|
215
|
-
return Math.min(score, 0.99);
|
|
216
|
-
}
|
|
217
|
-
generateStrategyReasoning(input, strategy, solutionLevel, efficiencyLevel) {
|
|
218
|
-
const taskType = this.identifyTaskType(input);
|
|
219
|
-
const complexity = this.analyzeInputComplexity(input);
|
|
220
|
-
return `${taskType} task with ${complexity} complexity. Strategy alignment: ${solutionLevel > 0.6 ? 'high' : solutionLevel > 0.4 ? 'medium' : 'low'}. Efficiency rating: ${efficiencyLevel > 0.6 ? 'optimal' : efficiencyLevel > 0.4 ? 'adequate' : 'limited'}.`;
|
|
221
|
-
}
|
|
222
|
-
// Core cognitive processing method
|
|
223
|
-
async performCognitiveDeliberation(input, context) {
|
|
224
|
-
// Strategy evaluation
|
|
225
|
-
const strategyScores = this.evaluatePromptingStrategies(input, context);
|
|
226
|
-
const selectedStrategies = strategyScores
|
|
227
|
-
.filter(s => s.totalScore >= 1.42)
|
|
228
|
-
.slice(0, strategyScores.filter(s => s.totalScore >= 1.53).length > 1 ? 3 : 1)
|
|
229
|
-
.map(s => s.strategy);
|
|
230
|
-
if (selectedStrategies.length === 0) {
|
|
231
|
-
selectedStrategies.push(strategyScores[0].strategy); // Fallback to highest scoring
|
|
232
|
-
}
|
|
233
|
-
// Round 1: Stages 1-2
|
|
234
|
-
const stage1 = this.performScientificInvestigation(input, context);
|
|
235
|
-
const stage2 = this.performInitialOOReD(input, selectedStrategies, context);
|
|
236
|
-
const round1Results = `${stage1}\n\n${stage2}`;
|
|
237
|
-
// Round 2: Stages 3-6
|
|
238
|
-
const stage3 = this.performCriticalThinking(input, context);
|
|
239
|
-
const stage4 = this.performScientificReview(input, round1Results, context);
|
|
240
|
-
const stage5 = this.performOOReD_Review(input, round1Results, selectedStrategies, context);
|
|
241
|
-
const stage6 = this.performFinalAction(input, `${round1Results}\n\n${stage3}\n\n${stage4}\n\n${stage5}`, selectedStrategies, context);
|
|
242
|
-
// Final compilation
|
|
243
|
-
return `# Cognitive Deliberation Results
|
|
244
|
-
|
|
245
|
-
## Round 1: Foundation
|
|
246
|
-
${round1Results}
|
|
247
|
-
|
|
248
|
-
## Round 2: Advanced Processing
|
|
249
|
-
${stage3}
|
|
250
|
-
|
|
251
|
-
${stage4}
|
|
252
|
-
|
|
253
|
-
${stage5}
|
|
254
|
-
|
|
255
|
-
${stage6}
|
|
256
|
-
|
|
257
|
-
## Strategy Evaluation Summary
|
|
258
|
-
**Selected Strategies:** ${selectedStrategies.join(', ')}
|
|
259
|
-
**Evaluation Results:** ${strategyScores.slice(0, 3).map(s => `${s.strategy}: ${s.totalScore}`).join(', ')}`;
|
|
260
|
-
}
|
|
261
|
-
// Helper methods for cognitive processing
|
|
262
|
-
extractCoreQuestion(input) {
|
|
263
|
-
// Extract the fundamental question or problem from input
|
|
264
|
-
const questionMarkers = ['?', 'how', 'what', 'why', 'when', 'where', 'which'];
|
|
265
|
-
const hasQuestion = questionMarkers.some(marker => input.toLowerCase().includes(marker));
|
|
266
|
-
if (hasQuestion) {
|
|
267
|
-
return `Direct question identified in input requiring systematic investigation.`;
|
|
268
|
-
}
|
|
269
|
-
else {
|
|
270
|
-
return `Implicit problem requiring question formulation: What is the optimal approach to address the stated requirements?`;
|
|
271
|
-
}
|
|
272
|
-
}
|
|
273
|
-
formHypothesis(input, context) {
|
|
274
|
-
const taskType = this.identifyTaskType(input);
|
|
275
|
-
return `Based on ${taskType} task characteristics${context ? ' and provided context' : ''}, hypothesis: The solution requires systematic application of appropriate cognitive frameworks to achieve optimal results.`;
|
|
276
|
-
}
|
|
277
|
-
designApproach(input, context) {
|
|
278
|
-
return `Multi-stage cognitive processing with strategy selection, iterative refinement, and verification protocols.`;
|
|
279
|
-
}
|
|
280
|
-
establishAnalysisFramework(input) {
|
|
281
|
-
return `Qualitative analysis of reasoning coherence, quantitative assessment of solution completeness, validation against success criteria.`;
|
|
282
|
-
}
|
|
283
|
-
prepareConclusions(input) {
|
|
284
|
-
return `Synthesis framework ready for evidence-based conclusions with confidence calibration and uncertainty quantification.`;
|
|
285
|
-
}
|
|
286
|
-
analyzeComplexity(input) {
|
|
287
|
-
if (input.length > 1000)
|
|
288
|
-
return 'high cognitive load with multi-faceted requirements';
|
|
289
|
-
if (input.length > 500)
|
|
290
|
-
return 'moderate complexity requiring structured approach';
|
|
291
|
-
return 'manageable complexity with clear pathway identification';
|
|
292
|
-
}
|
|
293
|
-
identifyTaskType(input) {
|
|
294
|
-
const codePatterns = ['code', 'function', 'class', 'method', 'algorithm', 'programming'];
|
|
295
|
-
const analyticalPatterns = ['analyze', 'evaluate', 'compare', 'assess', 'examine'];
|
|
296
|
-
const creativePatterns = ['design', 'create', 'generate', 'build', 'develop'];
|
|
297
|
-
const decisionPatterns = ['choose', 'decide', 'select', 'recommend', 'determine'];
|
|
298
|
-
const lowerInput = input.toLowerCase();
|
|
299
|
-
if (codePatterns.some(p => lowerInput.includes(p)))
|
|
300
|
-
return 'computational';
|
|
301
|
-
if (analyticalPatterns.some(p => lowerInput.includes(p)))
|
|
302
|
-
return 'analytical';
|
|
303
|
-
if (creativePatterns.some(p => lowerInput.includes(p)))
|
|
304
|
-
return 'creative';
|
|
305
|
-
if (decisionPatterns.some(p => lowerInput.includes(p)))
|
|
306
|
-
return 'decision-making';
|
|
307
|
-
return 'general-purpose';
|
|
308
|
-
}
|
|
309
|
-
identifyPrimaryApproach(input, strategies) {
|
|
310
|
-
return `${strategies[0]} as primary framework with ${strategies.length > 1 ? 'secondary strategies integrated' : 'focused application'}`;
|
|
311
|
-
}
|
|
312
|
-
establishReasoning(input, strategies, context) {
|
|
313
|
-
return `Multi-strategy reasoning utilizing ${strategies.join(' and ')} approaches for comprehensive solution development${context ? ' with contextual grounding' : ''}.`;
|
|
314
|
-
}
|
|
315
|
-
decideActions(input, context) {
|
|
316
|
-
const toolTypes = ['websearch', 'file manipulation', 'code analysis', 'context synthesis'];
|
|
317
|
-
return `Action sequence prioritizing ${toolTypes.slice(0, 2).join(' and ')} based on input requirements.`;
|
|
318
|
-
}
|
|
319
|
-
identifyPurpose(input) {
|
|
320
|
-
return `Primary purpose: Address the core requirements while optimizing for solution quality and implementation feasibility.`;
|
|
321
|
-
}
|
|
322
|
-
refineQuestion(input) {
|
|
323
|
-
return `Refined question: How can the stated objectives be achieved most effectively using available cognitive and technical resources?`;
|
|
324
|
-
}
|
|
325
|
-
establishContext(input, context) {
|
|
326
|
-
return `Operating within ${context ? 'provided contextual framework' : 'general problem-solving context'} with emphasis on practical implementation.`;
|
|
327
|
-
}
|
|
328
|
-
identifyInformationNeeds(input) {
|
|
329
|
-
const needsAnalysis = input.length > 500 ? 'comprehensive domain knowledge' : 'targeted information';
|
|
330
|
-
return `Information requirements: ${needsAnalysis}, validation sources, and implementation guidelines.`;
|
|
331
|
-
}
|
|
332
|
-
assessCredibility(input, context) {
|
|
333
|
-
return `Credibility assessment: Input source${context ? ' and context' : ''} evaluated for reliability and completeness. Verification protocols established.`;
|
|
334
|
-
}
|
|
335
|
-
identifyRelevantConcepts(input) {
|
|
336
|
-
return `Key concepts: Domain-specific knowledge, methodological frameworks, implementation patterns, and optimization strategies.`;
|
|
337
|
-
}
|
|
338
|
-
drawPreliminaryConclusions(input) {
|
|
339
|
-
return `Preliminary assessment indicates systematic approach required with iterative refinement and validation checkpoints.`;
|
|
340
|
-
}
|
|
341
|
-
analyzeAssumptions(input) {
|
|
342
|
-
return `Key assumptions: Solution feasibility, resource availability, and standard implementation patterns apply.`;
|
|
343
|
-
}
|
|
344
|
-
identifyImplications(input) {
|
|
345
|
-
return `Solution implications: Systematic implementation required with quality assurance and performance optimization considerations.`;
|
|
346
|
-
}
|
|
347
|
-
assessConsequences(input) {
|
|
348
|
-
return `Implementation consequences: Positive outcomes expected with proper execution, minimal risks with appropriate safeguards.`;
|
|
349
|
-
}
|
|
350
|
-
planToolUsage(input) {
|
|
351
|
-
const toolCount = this.calculateToolUsage(input, '');
|
|
352
|
-
return `Tool usage plan: ${toolCount} tools anticipated for comprehensive solution development including websearch, file operations, and analysis tools.`;
|
|
353
|
-
}
|
|
354
|
-
calculateToolUsage(input, results) {
|
|
355
|
-
// Calculate recommended tool usage based on complexity and requirements
|
|
356
|
-
let toolCount = 1; // Minimum
|
|
357
|
-
const complexity = this.analyzeInputComplexity(input);
|
|
358
|
-
if (complexity === 'high')
|
|
359
|
-
toolCount += 3;
|
|
360
|
-
else if (complexity === 'medium')
|
|
361
|
-
toolCount += 2;
|
|
362
|
-
else
|
|
363
|
-
toolCount += 1;
|
|
364
|
-
const taskType = this.identifyTaskType(input);
|
|
365
|
-
if (taskType === 'computational')
|
|
366
|
-
toolCount += 2;
|
|
367
|
-
if (taskType === 'analytical')
|
|
368
|
-
toolCount += 1;
|
|
369
|
-
if (input.length > 1000)
|
|
370
|
-
toolCount += 1;
|
|
371
|
-
if (results.length > 2000)
|
|
372
|
-
toolCount += 1;
|
|
373
|
-
return Math.min(toolCount, 7); // Cap at 7 tools
|
|
374
|
-
}
|
|
375
|
-
analyzeInputComplexity(input) {
|
|
376
|
-
if (input.length > 1000)
|
|
377
|
-
return 'high';
|
|
378
|
-
if (input.length > 500)
|
|
379
|
-
return 'medium';
|
|
380
|
-
return 'low';
|
|
381
|
-
}
|
|
382
|
-
// Stage 4-6 helper methods
|
|
383
|
-
validateQuestion(input, round1Results) {
|
|
384
|
-
return `Question validation confirms alignment between initial problem identification and cognitive processing results.`;
|
|
385
|
-
}
|
|
386
|
-
refineHypothesis(input, round1Results) {
|
|
387
|
-
return `Hypothesis refinement based on initial processing confirms systematic approach validity with enhanced precision.`;
|
|
388
|
-
}
|
|
389
|
-
assessMethodology(round1Results) {
|
|
390
|
-
return `Methodology assessment indicates appropriate framework selection and implementation pathway optimization.`;
|
|
391
|
-
}
|
|
392
|
-
evaluateEvidence(input, context, round1Results) {
|
|
393
|
-
return `Evidence evaluation confirms reasoning coherence and solution pathway validity${context ? ' with contextual validation' : ''}.`;
|
|
394
|
-
}
|
|
395
|
-
verifyConclusions(round1Results) {
|
|
396
|
-
return `Conclusion verification establishes logical consistency and implementation feasibility across all processing stages.`;
|
|
397
|
-
}
|
|
398
|
-
enhanceObservation(input, round1Results) {
|
|
399
|
-
return `Enhanced observation integrating initial findings with critical thinking framework results for comprehensive understanding.`;
|
|
400
|
-
}
|
|
401
|
-
reorient(input, round1Results, strategies) {
|
|
402
|
-
return `Strategic reorientation utilizing ${strategies.join(' and ')} approaches for optimized solution development.`;
|
|
403
|
-
}
|
|
404
|
-
advancedReasoning(input, context, round1Results, strategies) {
|
|
405
|
-
return `Advanced reasoning synthesis combining ${strategies.length} selected strategies with comprehensive validation protocols.`;
|
|
406
|
-
}
|
|
407
|
-
finalDecisionFramework(input, round1Results) {
|
|
408
|
-
return `Final decision framework established with clear implementation priorities and success verification methods.`;
|
|
409
|
-
}
|
|
410
|
-
synthesizeSolution(input, context, allResults, strategies) {
|
|
411
|
-
return `Comprehensive solution synthesis utilizing ${strategies.join(', ')} strategies for optimal implementation approach${context ? ' within provided contextual framework' : ''}.`;
|
|
412
|
-
}
|
|
413
|
-
createImplementationPath(input, allResults) {
|
|
414
|
-
return `Implementation pathway: systematic execution with iterative validation, quality assurance checkpoints, and optimization opportunities.`;
|
|
415
|
-
}
|
|
416
|
-
establishVerification(input, allResults) {
|
|
417
|
-
return `Verification framework: solution completeness validation, performance assessment, and success criteria confirmation.`;
|
|
418
|
-
}
|
|
419
|
-
defineSuccessMetrics(input, allResults) {
|
|
420
|
-
return `Success metrics: solution quality, implementation efficiency, requirement satisfaction, and stakeholder value delivery.`;
|
|
421
|
-
}
|
|
422
|
-
generateRecommendations(input, context, allResults, strategies) {
|
|
423
|
-
const taskType = this.identifyTaskType(input);
|
|
424
|
-
return `Fact-based recommendations: Proceed with ${taskType} implementation using ${strategies[0]} as primary approach. Execute systematic validation. Monitor performance indicators. Iterate based on feedback.`;
|
|
122
|
+
**Now:** Apply your selected cognitive technique(s) to actually solve the original problem "${prompt}" using your enhanced reasoning framework.`;
|
|
425
123
|
}
|
|
426
124
|
}
|
|
427
|
-
// MCP Server setup
|
|
125
|
+
// MCP Server setup with 6-stage cognitive deliberation framework
|
|
428
126
|
const server = new Server({
|
|
429
127
|
name: "gikendaasowin-aabajichiganan-mcp",
|
|
430
|
-
version: "
|
|
128
|
+
version: "10.0.0", // /// [6-stage deliberation with 0.00-0.99 scoring system]
|
|
431
129
|
}, {
|
|
432
130
|
capabilities: {
|
|
433
131
|
tools: {},
|
|
434
132
|
},
|
|
435
133
|
});
|
|
436
|
-
const deliberationEngine = new
|
|
134
|
+
const deliberationEngine = new DeliberationEngine();
|
|
437
135
|
// List available tools
|
|
438
136
|
server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
439
137
|
return {
|
|
440
138
|
tools: [
|
|
441
139
|
{
|
|
442
140
|
name: "deliberate",
|
|
443
|
-
description: "Advanced cognitive deliberation framework implementing 6-stage processing (Scientific Investigation → OOReD → Critical Thinking →
|
|
141
|
+
description: "Advanced cognitive deliberation framework implementing 6-stage processing (Scientific Investigation → OOReD → Critical Thinking → Review → OOReD → Act) with dynamic prompting strategy evaluation. Takes a prompt combining the question/problem and any context, returns comprehensive cognitive processing results with tool usage recommendations.",
|
|
444
142
|
inputSchema: {
|
|
445
143
|
type: "object",
|
|
446
144
|
properties: {
|
|
@@ -463,12 +161,12 @@ server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
|
463
161
|
server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
464
162
|
const { name, arguments: args } = request.params;
|
|
465
163
|
if (name === "deliberate") {
|
|
164
|
+
const { input, context } = args;
|
|
165
|
+
if (!input || typeof input !== "string") {
|
|
166
|
+
throw new Error("Input is required and must be a string");
|
|
167
|
+
}
|
|
466
168
|
try {
|
|
467
|
-
const
|
|
468
|
-
if (!input || typeof input !== "string") {
|
|
469
|
-
throw new Error("Input parameter is required and must be a string");
|
|
470
|
-
}
|
|
471
|
-
const result = await deliberationEngine.performCognitiveDeliberation(input, context);
|
|
169
|
+
const result = deliberationEngine.deliberate(input, context);
|
|
472
170
|
return {
|
|
473
171
|
content: [
|
|
474
172
|
{
|
|
@@ -479,24 +177,16 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
479
177
|
};
|
|
480
178
|
}
|
|
481
179
|
catch (error) {
|
|
482
|
-
|
|
483
|
-
content: [
|
|
484
|
-
{
|
|
485
|
-
type: "text",
|
|
486
|
-
text: `Error in cognitive deliberation: ${error instanceof Error ? error.message : String(error)}`,
|
|
487
|
-
},
|
|
488
|
-
],
|
|
489
|
-
isError: true,
|
|
490
|
-
};
|
|
180
|
+
throw new Error(`Deliberation failed: ${error}`);
|
|
491
181
|
}
|
|
492
182
|
}
|
|
493
183
|
throw new Error(`Unknown tool: ${name}`);
|
|
494
184
|
});
|
|
495
|
-
// Start the server
|
|
185
|
+
// Start the server with 6-stage cognitive deliberation framework
|
|
496
186
|
async function main() {
|
|
497
187
|
const transport = new StdioServerTransport();
|
|
498
188
|
await server.connect(transport);
|
|
499
|
-
console.error("Gikendaasowin Aabajichiganan MCP server running
|
|
189
|
+
console.error("Gikendaasowin Aabajichiganan MCP server running with 6-stage cognitive deliberation framework");
|
|
500
190
|
}
|
|
501
191
|
main().catch((error) => {
|
|
502
192
|
console.error("Fatal error in main():", error);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nbiish/cognitive-tools-mcp",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "10.0.1",
|
|
4
4
|
"description": "Revolutionary Single-Tool-Call MCP server with Enhanced 6-Stage Cognitive Deliberation Framework combining Scientific Investigation, OOReD, and Critical Thinking methodologies with DYNAMIC prompting strategy evaluation system (CoT, ToT, Self-Consistency, Meta-Prompting, Role-Based).",
|
|
5
5
|
"private": false,
|
|
6
6
|
"type": "module",
|