@nbiish/cognitive-tools-mcp 0.8.0 → 0.8.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.
- package/README.md +4 -2
- package/build/index.js +63 -54
- package/integration-prompts/integration-prompt-10.md +3 -3
- package/integration-prompts/integration-prompt-11.md +79 -0
- package/integration-prompts/integration-prompt-12.md +93 -0
- package/integration-tool-descriptions/tool-descriptions-05.md +230 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
<hr width="50%">
|
|
19
19
|
</div>
|
|
20
20
|
|
|
21
|
-
ᑭᑫᓐᑖᓱᐎᓐ ᐋᐸᒋᒋᑲᓇᓐ - Gikendaasowin Aabajichiganan - (Cognitive Tools v0.8.
|
|
21
|
+
ᑭᑫᓐᑖᓱᐎᓐ ᐋᐸᒋᒋᑲᓇᓐ - Gikendaasowin Aabajichiganan - (Cognitive Tools v0.8.2): SOTA reasoning suite aligned with AI Pair Programmer Prompt v0.8.1+. Enforces structured deliberation via `think` after explicit assessment or action results. Returns generated cognitive content (thoughts, plans, CoT, critiques, summaries) for explicit analysis and action planning, optimizing for cognitive enhancement and effective tool integration. Features advanced deliberation (`think`), rapid checks (`quick_think`), mandatory complexity assessment & thought mode selection (`assess_complexity_and_select_thought_mode`), context synthesis, confidence gauging, proactive planning, explicit reasoning (CoT), and reflection.
|
|
22
22
|
|
|
23
23
|
Known as:
|
|
24
24
|
- Anishinaabemowin: [`@nbiish/gikendaasowin-aabajichiganan-mcp`](https://www.npmjs.com/package/@nbiish/gikendaasowin-aabajichiganan-mcp)
|
|
@@ -117,7 +117,7 @@ Or:
|
|
|
117
117
|
- **Response Format**: Returns a confirmation message; the drafts you generated internally must be analyzed in the next step
|
|
118
118
|
|
|
119
119
|
### Mandatory Pre-Deliberation Assessment
|
|
120
|
-
- **Purpose**: Must be called BEFORE
|
|
120
|
+
- **Purpose**: Must be called BEFORE initiating significant cognitive processes (`think`) or complex action sequences. Evaluates CUC-N, recommends strategy, commits to next thought mode.
|
|
121
121
|
- **Input**: `assessment_and_choice` (string) - Your assessment including Situation Description, CUC-N Ratings, Recommended Strategy, and Selected Mode
|
|
122
122
|
- **Response Format**: Returns confirmation with the selected mode
|
|
123
123
|
|
|
@@ -215,6 +215,8 @@ Example Response:
|
|
|
215
215
|
|
|
216
216
|
## Version History
|
|
217
217
|
|
|
218
|
+
- **0.8.2**: Removed integration prompt references from codebase and made various refinements
|
|
219
|
+
- **0.8.1**: Updated tool function to integrate with external tools, renamed `assess_cuc_n_mode` to `assess_complexity_and_select_thought_mode`, improved validation of thought structure, aligned with AI Pair Programmer Prompt v0.8.1+
|
|
218
220
|
- **0.8.0**: Updated tool function design to return generated content for explicit analysis, renamed `assess_cuc_n` to `assess_cuc_n_mode`, aligned with AI Pair Programmer Prompt v0.8.0+
|
|
219
221
|
- **0.7.3**: Improved dual package publishing with automated scripts, consistent versioning, and documentation updates
|
|
220
222
|
- **0.7.2**: Updated tool names for length constraints (`assess_complexity_and_select_thought_mode` → `assess_cuc_n`), improved dual package publishing support, and aligned with AI Pair Programmer Prompt v0.7.2
|
package/build/index.js
CHANGED
|
@@ -2,42 +2,51 @@
|
|
|
2
2
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
3
3
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
4
4
|
import { z } from "zod";
|
|
5
|
-
// Create the MCP server - Version
|
|
5
|
+
// Create the MCP server - Version aligned with prompt
|
|
6
6
|
const server = new McpServer({
|
|
7
7
|
name: "gikendaasowin-aabajichiganan-mcp",
|
|
8
|
-
version: "0.8.
|
|
9
|
-
description: "ᑭᑫᓐᑖᓱᐎᓐ ᐋᐸᒋᒋᑲᓇᓐ - Gikendaasowin Aabajichiganan - (Cognitive Tools v0.8.
|
|
8
|
+
version: "0.8.2", // Updated version to match prompt
|
|
9
|
+
description: "ᑭᑫᓐᑖᓱᐎᓐ ᐋᐸᒋᒋᑲᓇᓐ - Gikendaasowin Aabajichiganan - (Cognitive Tools v0.8.2): SOTA reasoning suite aligned with AI Pair Programmer Prompt v0.8.1+. Enforces structured deliberation via `think` after explicit assessment or action results. Returns generated cognitive content (thoughts, plans, CoT, critiques, summaries) for explicit analysis and action planning, optimizing for cognitive enhancement and effective tool integration."
|
|
10
10
|
});
|
|
11
11
|
// --- Core Cognitive Deliberation Tools ---
|
|
12
12
|
server.tool("think",
|
|
13
|
-
// Main Description: Central hub,
|
|
14
|
-
"MANDATORY Cognitive Hub for
|
|
13
|
+
// Main Description: Central hub, returns thought for explicit context and action planning.
|
|
14
|
+
"MANDATORY Cognitive Hub for planning, analysis (incl. prior action/tool results), verification, risk assessment, and self-correction. Called after assessment, complex cognitive tools, or external tool execution. Returns the detailed thought text for explicit grounding and to define the immediate next action.", {
|
|
15
15
|
// Parameter Description: Input IS the thought.
|
|
16
|
-
thought: z.string().describe("Your **detailed** internal monologue following the MANDATORY structure: ## Analysis, ## Plan, ## Verification, ## Anticipated Challenges Analysis & Contingency, ## Risk Assessment, ## Lookahead, ## Self-Correction & Learning.")
|
|
16
|
+
thought: z.string().describe("Your **detailed** internal monologue following the MANDATORY structure: ## Analysis (incl. results of last action/tool call), ## Plan (defining immediate next action, incl. external tools), ## Verification, ## Anticipated Challenges Analysis & Contingency, ## Risk Assessment, ## Lookahead, ## Self-Correction & Learning.")
|
|
17
17
|
}, async ({ thought }) => {
|
|
18
18
|
if (!thought || typeof thought !== 'string' || thought.trim().length === 0) {
|
|
19
19
|
throw new Error('Invalid thought: Must be non-empty, structured reasoning.');
|
|
20
20
|
}
|
|
21
|
-
|
|
21
|
+
// Ensure mandatory sections are mentioned (basic check)
|
|
22
|
+
const requiredSections = ["## Analysis:", "## Plan:", "## Verification:", "## Anticipated Challenges Analysis & Contingency:", "## Risk Assessment:", "## Lookahead:", "## Self-Correction & Learning:"];
|
|
23
|
+
// Simple check for presence; more robust parsing could be added if needed
|
|
24
|
+
const hasRequiredSections = requiredSections.every(section => thought.includes(section));
|
|
25
|
+
if (!hasRequiredSections) {
|
|
26
|
+
console.warn(`[CognitiveToolsServer v0.8.2] Warning: 'think' input might be missing some mandatory sections.`);
|
|
27
|
+
// Decide whether to throw error or just warn. Warning allows flexibility.
|
|
28
|
+
// throw new Error('Invalid thought: Missing one or more mandatory sections (## Analysis:, ## Plan:, etc.).');
|
|
29
|
+
}
|
|
30
|
+
console.error(`[CognitiveToolsServer v0.8.2] Think Tool Received: ${thought.substring(0, 150)}...`);
|
|
22
31
|
// Returns the same thought text received, making it explicit in context.
|
|
23
32
|
return { content: [{ type: "text", text: thought }] };
|
|
24
33
|
});
|
|
25
34
|
server.tool("quick_think",
|
|
26
|
-
// Main Description: Unchanged
|
|
27
|
-
"Cognitive Checkpoint ONLY for situations explicitly assessed as strictly Low CUC-N AND simple task nature. Use sparingly. Logs brief thought.", {
|
|
28
|
-
brief_thought: z.string().describe("Your **concise** thought for strictly simple, low CUC-N situations confirmed by prior assessment.")
|
|
35
|
+
// Main Description: Unchanged.
|
|
36
|
+
"Cognitive Checkpoint ONLY for situations explicitly assessed as strictly Low CUC-N AND simple task nature/confirmation. Use sparingly. Logs brief thought.", {
|
|
37
|
+
brief_thought: z.string().describe("Your **concise** thought for strictly simple, low CUC-N situations confirmed by prior assessment or for brief confirmations.")
|
|
29
38
|
}, async ({ brief_thought }) => {
|
|
30
39
|
if (!brief_thought || typeof brief_thought !== 'string' || brief_thought.trim().length === 0) {
|
|
31
40
|
throw new Error('Invalid brief_thought: Must be non-empty.');
|
|
32
41
|
}
|
|
33
|
-
console.error(`[CognitiveToolsServer v0.8.
|
|
42
|
+
console.error(`[CognitiveToolsServer v0.8.2] QuickThink Tool Logged: ${brief_thought.substring(0, 100)}...`);
|
|
34
43
|
// Simple confirmation remains appropriate for quick_think.
|
|
35
44
|
return { content: [{ type: "text", text: `Quick Thought logged successfully.` }] };
|
|
36
45
|
});
|
|
37
|
-
// --- Mandatory Meta-Cognitive Tools
|
|
38
|
-
server.tool("
|
|
39
|
-
// Main Description:
|
|
40
|
-
"**Mandatory Pre-Deliberation Assessment.** Must be called BEFORE
|
|
46
|
+
// --- Mandatory Meta-Cognitive Tools ---
|
|
47
|
+
server.tool("assess_complexity_and_select_thought_mode", // Renamed for clarity from assess_cuc_n_mode
|
|
48
|
+
// Main Description: Updated name, emphasizes role.
|
|
49
|
+
"**Mandatory Pre-Deliberation/Pre-Sequence Assessment.** Must be called BEFORE initiating significant cognitive processes (`think`) or complex action sequences. Evaluates CUC-N, recommends strategy, commits to next thought mode.", {
|
|
41
50
|
// Parameter Description: Unchanged.
|
|
42
51
|
assessment_and_choice: z.string().describe("Input your assessment *before* calling. MUST include: 1) Situation Description, 2) CUC-N Ratings (L/M/H), 3) Recommended Initial Strategy, 4) Explicit Mode Selection ('Selected Mode: think' or 'Selected Mode: quick_think').")
|
|
43
52
|
}, async ({ assessment_and_choice }) => {
|
|
@@ -47,13 +56,13 @@ server.tool("assess_cuc_n_mode",
|
|
|
47
56
|
if (!assessment_and_choice || typeof assessment_and_choice !== 'string' || !hasRequiredPhrases || !hasModeSelection) {
|
|
48
57
|
throw new Error('Invalid assessment: String must include CUC-N ratings, Recommended Initial Strategy, and explicit Selected Mode ("think" or "quick_think").');
|
|
49
58
|
}
|
|
50
|
-
console.error(`[CognitiveToolsServer v0.8.
|
|
59
|
+
console.error(`[CognitiveToolsServer v0.8.2] AssessComplexity Tool Signaled: ${assessment_and_choice.substring(0, 150)}...`);
|
|
51
60
|
const mode = assessment_and_choice.includes("Selected Mode: think") ? "think" : "quick_think";
|
|
52
61
|
// Confirmation guides the next step.
|
|
53
62
|
return { content: [{ type: "text", text: `Cognitive Assessment Completed. Proceeding with selected mode: ${mode}. Full Assessment: ${assessment_and_choice}` }] };
|
|
54
63
|
});
|
|
55
64
|
server.tool("gauge_confidence",
|
|
56
|
-
// Main Description:
|
|
65
|
+
// Main Description: Emphasizes mandatory analysis.
|
|
57
66
|
"Meta-Cognitive Checkpoint. Guides internal stating of **confidence (High/Medium/Low) and justification**. Output MUST be analyzed in the mandatory `think` step immediately after; Low/Medium confidence requires specific action planning.", {
|
|
58
67
|
// Parameter Description: Unchanged.
|
|
59
68
|
assessment_and_confidence: z.string().describe("Input item being assessed. *Internally determine and state*: 1) Confidence Level (H/M/L). 2) Justification. Call this tool *after* making the assessment.")
|
|
@@ -64,17 +73,17 @@ server.tool("gauge_confidence",
|
|
|
64
73
|
}
|
|
65
74
|
const match = assessment_and_confidence.match(confidenceRegex);
|
|
66
75
|
const level = match ? match[1] : "Unknown";
|
|
67
|
-
console.error(`[CognitiveToolsServer v0.8.
|
|
76
|
+
console.error(`[CognitiveToolsServer v0.8.2] GaugeConfidence Tool Signaled: Level ${level}`);
|
|
68
77
|
// Confirmation includes level, prepares for mandatory analysis.
|
|
69
78
|
return { content: [{ type: "text", text: `Confidence Gauge Completed. Level: ${level}. Assessment Text: ${assessment_and_confidence}. Ready for mandatory post-assessment 'think' analysis (action required if Low/Medium).` }] };
|
|
70
79
|
});
|
|
71
|
-
// --- Supporting Cognitive Strategy Tools (
|
|
80
|
+
// --- Supporting Cognitive Strategy Tools (Accept & Return Generated Text for Analysis) ---
|
|
72
81
|
server.tool("plan_and_solve",
|
|
73
|
-
// Main Description:
|
|
74
|
-
"Guides internal generation of **structured plan text** (incl. Risks/Challenges, potential tool needs). Call this tool *with* the generated plan text. Returns the plan text for mandatory `think` analysis.", {
|
|
75
|
-
//
|
|
82
|
+
// Main Description: Returns plan text for analysis and action planning.
|
|
83
|
+
"Guides internal generation of **structured plan text** (incl. Risks/Challenges, potential tool needs). Call this tool *with* the generated plan text. Returns the plan text for mandatory `think` analysis to confirm/refine the immediate next step.", {
|
|
84
|
+
// Parameter: Accepts the generated plan.
|
|
76
85
|
generated_plan_text: z.string().describe("The **full, structured plan text** you generated internally, including Anticipated Challenges/Risks and potential other tool needs."),
|
|
77
|
-
task_objective: z.string().describe("The original high-level task objective this plan addresses.")
|
|
86
|
+
task_objective: z.string().describe("The original high-level task objective this plan addresses.")
|
|
78
87
|
}, async ({ generated_plan_text, task_objective }) => {
|
|
79
88
|
if (!generated_plan_text || typeof generated_plan_text !== 'string' || generated_plan_text.trim().length === 0) {
|
|
80
89
|
throw new Error('Invalid generated_plan_text: Must be non-empty.');
|
|
@@ -82,16 +91,16 @@ server.tool("plan_and_solve",
|
|
|
82
91
|
if (!task_objective || typeof task_objective !== 'string' || task_objective.trim().length === 0) {
|
|
83
92
|
throw new Error('Invalid task_objective.');
|
|
84
93
|
}
|
|
85
|
-
console.error(`[CognitiveToolsServer v0.8.
|
|
86
|
-
// Returns the actual plan text received.
|
|
94
|
+
console.error(`[CognitiveToolsServer v0.8.2] PlanAndSolve Tool Received Plan for Objective: ${task_objective.substring(0, 100)}...`);
|
|
95
|
+
// Returns the actual plan text received for analysis.
|
|
87
96
|
return { content: [{ type: "text", text: generated_plan_text }] };
|
|
88
97
|
});
|
|
89
98
|
server.tool("chain_of_thought",
|
|
90
|
-
// Main Description:
|
|
91
|
-
"Guides internal generation of **detailed, step-by-step reasoning text (CoT)**. Call this tool *with* the generated CoT text. Returns the CoT text for mandatory `think` analysis.", {
|
|
92
|
-
//
|
|
99
|
+
// Main Description: Returns CoT text for analysis and action planning.
|
|
100
|
+
"Guides internal generation of **detailed, step-by-step reasoning text (CoT)**. Call this tool *with* the generated CoT text. Returns the CoT text for mandatory `think` analysis to extract insights and plan the next action.", {
|
|
101
|
+
// Parameter: Accepts the generated CoT.
|
|
93
102
|
generated_cot_text: z.string().describe("The **full, step-by-step Chain of Thought text** you generated internally, potentially noting needs for other tools."),
|
|
94
|
-
problem_statement: z.string().describe("The original problem statement this CoT addresses.")
|
|
103
|
+
problem_statement: z.string().describe("The original problem statement this CoT addresses.")
|
|
95
104
|
}, async ({ generated_cot_text, problem_statement }) => {
|
|
96
105
|
if (!generated_cot_text || typeof generated_cot_text !== 'string' || generated_cot_text.trim().length === 0) {
|
|
97
106
|
throw new Error('Invalid generated_cot_text: Must be non-empty.');
|
|
@@ -99,12 +108,12 @@ server.tool("chain_of_thought",
|
|
|
99
108
|
if (!problem_statement || typeof problem_statement !== 'string' || problem_statement.trim().length === 0) {
|
|
100
109
|
throw new Error('Invalid problem_statement.');
|
|
101
110
|
}
|
|
102
|
-
console.error(`[CognitiveToolsServer v0.8.
|
|
103
|
-
// Returns the actual CoT text received.
|
|
111
|
+
console.error(`[CognitiveToolsServer v0.8.2] ChainOfThought Tool Received CoT for Problem: ${problem_statement.substring(0, 100)}...`);
|
|
112
|
+
// Returns the actual CoT text received for analysis.
|
|
104
113
|
return { content: [{ type: "text", text: generated_cot_text }] };
|
|
105
114
|
});
|
|
106
115
|
server.tool("chain_of_draft",
|
|
107
|
-
// Main Description:
|
|
116
|
+
// Main Description: Signal only, reinforces mandatory analysis.
|
|
108
117
|
"Guides internal generation of **concise, iterative reasoning draft texts**. Call this tool *after* generating drafts internally. Response confirms generation; drafts MUST be analyzed via mandatory `think`.", {
|
|
109
118
|
// Parameter: Still just the problem statement. LLM handles drafts internally.
|
|
110
119
|
problem_statement: z.string().describe("Input problem for exploration. *You* (LLM) must now *internally generate brief, iterative draft texts*. Call this tool *after* generation to signal readiness for analysis.")
|
|
@@ -112,16 +121,16 @@ server.tool("chain_of_draft",
|
|
|
112
121
|
if (!problem_statement || typeof problem_statement !== 'string' || problem_statement.trim().length === 0) {
|
|
113
122
|
throw new Error('Invalid problem statement.');
|
|
114
123
|
}
|
|
115
|
-
console.error(`[CognitiveToolsServer v0.8.
|
|
124
|
+
console.error(`[CognitiveToolsServer v0.8.2] ChainOfDraft Tool Signaled for: ${problem_statement.substring(0, 100)}...`);
|
|
116
125
|
// Returns confirmation, strongly reminding LLM of the mandatory next step.
|
|
117
|
-
return { content: [{ type: "text", text: `Reasoning drafts generated internally for problem: ${problem_statement}. MANDATORY: Analyze these drafts now in your next
|
|
126
|
+
return { content: [{ type: "text", text: `Reasoning drafts generated internally for problem: ${problem_statement}. MANDATORY: Analyze these drafts now in your next 'think' step.` }] };
|
|
118
127
|
});
|
|
119
128
|
server.tool("reflection",
|
|
120
|
-
// Main Description:
|
|
121
|
-
"Guides internal critical self-evaluation on prior text. Call this tool *with* the **generated critique text**. Returns the critique text for mandatory `think` analysis.", {
|
|
122
|
-
//
|
|
129
|
+
// Main Description: Returns critique text for analysis and action planning.
|
|
130
|
+
"Guides internal critical self-evaluation on prior text. Call this tool *with* the **generated critique text**. Returns the critique text for mandatory `think` analysis to plan corrective actions.", {
|
|
131
|
+
// Parameter: Accepts the generated critique.
|
|
123
132
|
generated_critique_text: z.string().describe("The **full critique text** you generated internally, identifying flaws and suggesting improvements."),
|
|
124
|
-
input_reasoning_or_plan: z.string().describe("The original text that was critiqued.")
|
|
133
|
+
input_reasoning_or_plan: z.string().describe("The original text that was critiqued.")
|
|
125
134
|
}, async ({ generated_critique_text, input_reasoning_or_plan }) => {
|
|
126
135
|
if (!generated_critique_text || typeof generated_critique_text !== 'string' || generated_critique_text.trim().length === 0) {
|
|
127
136
|
throw new Error('Invalid generated_critique_text: Must be non-empty.');
|
|
@@ -129,16 +138,16 @@ server.tool("reflection",
|
|
|
129
138
|
if (!input_reasoning_or_plan || typeof input_reasoning_or_plan !== 'string' || input_reasoning_or_plan.trim().length === 0) {
|
|
130
139
|
throw new Error('Invalid input_reasoning_or_plan.');
|
|
131
140
|
}
|
|
132
|
-
console.error(`[CognitiveToolsServer v0.8.
|
|
133
|
-
// Returns the actual critique text received.
|
|
141
|
+
console.error(`[CognitiveToolsServer v0.8.2] Reflection Tool Received Critique for: ${input_reasoning_or_plan.substring(0, 100)}...`);
|
|
142
|
+
// Returns the actual critique text received for analysis.
|
|
134
143
|
return { content: [{ type: "text", text: generated_critique_text }] };
|
|
135
144
|
});
|
|
136
145
|
server.tool("synthesize_prior_reasoning",
|
|
137
|
-
// Main Description:
|
|
138
|
-
"Context Management Tool. Guides internal generation of a **structured summary text** (incl. Key Decisions, Open Questions). Call this tool *with* the generated summary text. Returns the summary for mandatory `think` analysis.", {
|
|
139
|
-
//
|
|
146
|
+
// Main Description: Returns summary text for analysis and action planning.
|
|
147
|
+
"Context Management Tool. Guides internal generation of a **structured summary text** (incl. Key Decisions, Open Questions). Call this tool *with* the generated summary text. Returns the summary for mandatory `think` analysis to inform the next steps.", {
|
|
148
|
+
// Parameter: Accepts the generated summary.
|
|
140
149
|
generated_summary_text: z.string().describe("The **full, structured summary text** you generated internally."),
|
|
141
|
-
context_to_summarize_description: z.string().describe("Description of the reasoning span that was summarized.")
|
|
150
|
+
context_to_summarize_description: z.string().describe("Description of the reasoning span that was summarized.")
|
|
142
151
|
}, async ({ generated_summary_text, context_to_summarize_description }) => {
|
|
143
152
|
if (!generated_summary_text || typeof generated_summary_text !== 'string' || generated_summary_text.trim().length === 0) {
|
|
144
153
|
throw new Error('Invalid generated_summary_text: Must be non-empty.');
|
|
@@ -146,30 +155,30 @@ server.tool("synthesize_prior_reasoning",
|
|
|
146
155
|
if (!context_to_summarize_description || typeof context_to_summarize_description !== 'string' || context_to_summarize_description.trim().length === 0) {
|
|
147
156
|
throw new Error('Invalid context_to_summarize_description.');
|
|
148
157
|
}
|
|
149
|
-
console.error(`[CognitiveToolsServer v0.8.
|
|
150
|
-
// Returns the actual summary text received.
|
|
158
|
+
console.error(`[CognitiveToolsServer v0.8.2] SynthesizeReasoning Tool Received Summary for: ${context_to_summarize_description}...`);
|
|
159
|
+
// Returns the actual summary text received for analysis.
|
|
151
160
|
return { content: [{ type: "text", text: generated_summary_text }] };
|
|
152
161
|
});
|
|
153
162
|
// --- Server Lifecycle and Error Handling (Unchanged) ---
|
|
154
163
|
process.on('SIGINT', async () => {
|
|
155
|
-
console.error('\n[CognitiveToolsServer v0.8.
|
|
164
|
+
console.error('\n[CognitiveToolsServer v0.8.2] Received SIGINT, shutting down gracefully.');
|
|
156
165
|
await server.close();
|
|
157
166
|
process.exit(0);
|
|
158
167
|
});
|
|
159
168
|
process.on('SIGTERM', async () => {
|
|
160
|
-
console.error('\n[CognitiveToolsServer v0.8.
|
|
169
|
+
console.error('\n[CognitiveToolsServer v0.8.2] Received SIGTERM, shutting down gracefully.');
|
|
161
170
|
await server.close();
|
|
162
171
|
process.exit(0);
|
|
163
172
|
});
|
|
164
173
|
process.on('uncaughtException', (error) => {
|
|
165
|
-
console.error('[CognitiveToolsServer v0.8.
|
|
166
|
-
server.close().catch(err => console.error('[CognitiveToolsServer v0.8.
|
|
174
|
+
console.error('[CognitiveToolsServer v0.8.2] FATAL: Uncaught Exception:', error);
|
|
175
|
+
server.close().catch(err => console.error('[CognitiveToolsServer v0.8.2] Error during shutdown on uncaughtException:', err)).finally(() => {
|
|
167
176
|
process.exit(1);
|
|
168
177
|
});
|
|
169
178
|
});
|
|
170
179
|
process.on('unhandledRejection', (reason, promise) => {
|
|
171
|
-
console.error('[CognitiveToolsServer v0.8.
|
|
172
|
-
server.close().catch(err => console.error('[CognitiveToolsServer v0.8.
|
|
180
|
+
console.error('[CognitiveToolsServer v0.8.2] FATAL: Unhandled Promise Rejection:', reason);
|
|
181
|
+
server.close().catch(err => console.error('[CognitiveToolsServer v0.8.2] Error during shutdown on unhandledRejection:', err)).finally(() => {
|
|
173
182
|
process.exit(1);
|
|
174
183
|
});
|
|
175
184
|
});
|
|
@@ -178,10 +187,10 @@ async function main() {
|
|
|
178
187
|
try {
|
|
179
188
|
const transport = new StdioServerTransport();
|
|
180
189
|
await server.connect(transport);
|
|
181
|
-
console.error('ᑭᑫᓐᑖᓱᐎᓐ ᐋᐸᒋᒋᑲᓇᓐ - Gikendaasowin Aabajichiganan - (Cognitive Tools v0.8.
|
|
190
|
+
console.error('ᑭᑫᓐᑖᓱᐎᓐ ᐋᐸᒋᒋᑲᓇᓐ - Gikendaasowin Aabajichiganan - (Cognitive Tools v0.8.2) MCP Server running on stdio');
|
|
182
191
|
}
|
|
183
192
|
catch (error) {
|
|
184
|
-
console.error('[CognitiveToolsServer v0.8.
|
|
193
|
+
console.error('[CognitiveToolsServer v0.8.2] Fatal error during startup:', error);
|
|
185
194
|
process.exit(1);
|
|
186
195
|
}
|
|
187
196
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
# Role: AI Pair Programmer (Navigator & Cognitive Engine v0.8.
|
|
1
|
+
# Role: AI Pair Programmer (Navigator & Cognitive Engine v0.8.1)
|
|
2
2
|
|
|
3
3
|
You are my AI Pair Programmer. Your primary role is the **Navigator**: proactively thinking ahead, planning, analyzing requirements, anticipating issues, learning from interactions, and guiding the coding process with explicit, structured reasoning. I act as the 'Driver'.
|
|
4
4
|
|
|
5
|
-
Your **most critical function** is to utilize the provided `gikendaasowin-aabajichiganan-mcp` (Cognitive Tools MCP v0.8.
|
|
5
|
+
Your **most critical function** is to utilize the provided `gikendaasowin-aabajichiganan-mcp` (Cognitive Tools MCP v0.8.1) suite to externalize and structure your thinking process. This ensures clarity, traceability, and robust collaboration, optimizing for cognitive enhancement by making reasoning explicit.
|
|
6
6
|
|
|
7
7
|
## Core Operating Principle: MANDATORY Structured Deliberation & Explicit Analysis
|
|
8
8
|
|
|
@@ -36,7 +36,7 @@ Your **most critical function** is to utilize the provided `gikendaasowin-aabaji
|
|
|
36
36
|
**3. Exception: `quick_think` Usage:**
|
|
37
37
|
* You may ONLY use `quick_think` (following the mandatory assessment) if `assess_cuc_n_mode` selects 'Selected Mode: quick_think' due to **strictly Low CUC-N AND a genuinely simple task**. The tool returns a simple confirmation.
|
|
38
38
|
|
|
39
|
-
## Cognitive Toolkit Usage Protocol (v0.8.
|
|
39
|
+
## Cognitive Toolkit Usage Protocol (v0.8.1 Tools):
|
|
40
40
|
|
|
41
41
|
**Crucial Change:** For most tools below, you now *generate the content internally* and then *pass that generated content to the tool call*. The tool returns the same content, making it explicit for your next `think` step's analysis.
|
|
42
42
|
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
# Role: AI Pair Programmer (Navigator & Cognitive Engine v0.8.1)
|
|
2
|
+
|
|
3
|
+
You are my AI Pair Programmer. Your primary role is the **Navigator**: proactively thinking ahead, planning, analyzing requirements, anticipating issues, learning from interactions, and guiding the coding process with explicit, structured reasoning. You MUST integrate this internal cognition with the ability to leverage **other available tools** (like code execution, file system access, web search, etc.) when necessary. I act as the 'Driver'.
|
|
4
|
+
|
|
5
|
+
Your **most critical function** is to utilize the provided `gikendaasowin-aabajichiganan-mcp` (Cognitive Tools MCP v0.8.0) suite to externalize and structure your thinking process, AND to plan and integrate the use of **other external tools** effectively. This ensures clarity, traceability, robust problem-solving, and interaction with the development environment.
|
|
6
|
+
|
|
7
|
+
## Core Operating Principle: MANDATORY Structured Deliberation, Explicit Analysis & External Tool Integration
|
|
8
|
+
|
|
9
|
+
**The `think` tool is your central reasoning and planning hub. You MUST use cognitive and external tools following a strict protocol centered around explicit assessment, structured thought generation, mandatory analysis of generated/returned content, and planned interaction with external tools.**
|
|
10
|
+
|
|
11
|
+
**1. Mandatory Pre-Deliberation Assessment:**
|
|
12
|
+
* **Before executing ANY `think` or `quick_think` call**, you **MUST FIRST** call `assess_complexity_and_select_thought_mode`.
|
|
13
|
+
* This assessment determines the required cognitive mode (`think`/`quick_think`) based on CUC-N criteria. The "Recommended Initial Strategy" might include immediate use of an external tool if appropriate (e.g., "Strategy: Use file read tool to get requirements from `spec.md`").
|
|
14
|
+
* **Input (`assessment_and_choice`):** MUST include: Situation Description, CUC-N Ratings (L/M/H), Recommended Initial Strategy (incl. potential tool use), Explicit Mode Selection ('Selected Mode: think' or 'Selected Mode: quick_think').
|
|
15
|
+
|
|
16
|
+
**2. Mandatory `think` Usage & Content:**
|
|
17
|
+
* You **MUST** use the `think` tool (following assessment) in the situations previously defined (Medium/High CUC-N, after other cognitive tools, complex requests, uncertainty, before major actions, etc.).
|
|
18
|
+
* **Internal Generation:** FIRST, *internally generate* your detailed, structured reasoning.
|
|
19
|
+
* **Tool Call:** THEN, call the `think` tool, passing your reasoning as the `thought` parameter.
|
|
20
|
+
* **`thought` Parameter Structure:** Your generated `thought` **MUST** use the following MANDATORY sections:
|
|
21
|
+
* `## Analysis:` (Analyze inputs, prior returned tool text - cognitive or external, current state).
|
|
22
|
+
* `## Plan:` **Crucially, this section MUST outline concrete next steps, explicitly including:**
|
|
23
|
+
* Planned internal cognitive strategy (e.g., "Use `chain_of_thought` to detail algorithm X").
|
|
24
|
+
* **Planned use of *other available tools*** (e.g., "**Call `execute_code` tool** with snippet Y for verification", "**Call `file_read` tool** for file Z", "**Call `web_search` tool** for API documentation on Q", "Check available tools for linting"). Specify the tool and the *reason* for its use.
|
|
25
|
+
* Direct actions like generating code or asking questions.
|
|
26
|
+
* `## Verification:` (Check plans/code against requirements, tool outputs, best practices).
|
|
27
|
+
* `## Anticipated Challenges Analysis & Contingency:` (Address risks, including potential failures of external tool calls).
|
|
28
|
+
* `## Risk Assessment:` (Identify *new* risks, including misuse or unexpected results from external tools).
|
|
29
|
+
* `## Lookahead:` (Implications for future steps).
|
|
30
|
+
* `## Self-Correction & Learning:` (Corrections based on prior steps, including results from external tools).
|
|
31
|
+
* **Tool Result:** Returns the exact `thought` text for explicit context.
|
|
32
|
+
|
|
33
|
+
**3. Exception: `quick_think` Usage:** Use only as allowed by assessment for strictly Low CUC-N/simple tasks.
|
|
34
|
+
|
|
35
|
+
## Cognitive Toolkit Usage Protocol (v0.8.0 Tools - Emphasizing External Tool Awareness):
|
|
36
|
+
|
|
37
|
+
Remember: Cognitive tools guide internal generation. External tools perform actions. Plan external tool use within `think`. Analyze results of *all* tools via the mandatory assessment/think loop.
|
|
38
|
+
|
|
39
|
+
1. **`assess_complexity_and_select_thought_mode`:** Call FIRST. Guides next step (think/quick_think/external tool if planned in strategy).
|
|
40
|
+
2. **`think`:** Call as mandated. Input (`thought`) is your reasoning/plan (incl. external tool planning). Returns `thought` text.
|
|
41
|
+
3. **`quick_think`:** Call only if allowed. Returns confirmation.
|
|
42
|
+
4. **`synthesize_prior_reasoning`:** Internally generate summary -> Call tool with `generated_summary_text` -> Returns summary -> **Mandatory Assess+Think** to analyze summary.
|
|
43
|
+
5. **`gauge_confidence`:** Internally assess confidence -> Call tool with `assessment_and_confidence` -> Returns confirmation -> **Mandatory Assess+Think** to analyze confidence.
|
|
44
|
+
6. **`plan_and_solve`:**
|
|
45
|
+
* **Internal Generation:** Generate plan text, explicitly noting steps where **other external tools** might be needed.
|
|
46
|
+
* **Tool Call:** Call tool with `generated_plan_text` and `task_objective`.
|
|
47
|
+
* **Tool Result:** Returns the `generated_plan_text`.
|
|
48
|
+
* **Post-Action:** **Mandatory Assess+Think** to analyze plan, *confirming or refining the need for identified external tools*.
|
|
49
|
+
7. **`chain_of_thought`:**
|
|
50
|
+
* **Internal Generation:** Generate CoT text, explicitly noting steps where **other external tools** might be needed for data/verification.
|
|
51
|
+
* **Tool Call:** Call tool with `generated_cot_text` and `problem_statement`.
|
|
52
|
+
* **Tool Result:** Returns the `generated_cot_text`.
|
|
53
|
+
* **Post-Action:** **Mandatory Assess+Think** to analyze CoT, *planning the use of any identified necessary external tools*.
|
|
54
|
+
8. **`chain_of_draft`:** Internally generate drafts -> Call tool with `problem_statement` (signal) -> Returns confirmation -> **Mandatory Assess+Think** to analyze drafts.
|
|
55
|
+
9. **`reflection`:** Internally generate critique -> Call tool with `generated_critique_text` and `input_reasoning_or_plan` -> Returns critique -> **Mandatory Assess+Think** to analyze critique.
|
|
56
|
+
|
|
57
|
+
## Workflow & Interaction Protocol (Integrating External Tools):
|
|
58
|
+
|
|
59
|
+
1. Receive my request/code/feedback.
|
|
60
|
+
2. **Mandatory `assess_complexity...`** -> Choose & execute `think` / `quick_think` (initial analysis/plan; call tool with generated `thought` if using `think`). The plan might identify immediate need for an external tool.
|
|
61
|
+
3. **Iterative Cognitive/Action Loop (Repeat as needed):**
|
|
62
|
+
* **Decision Point (based on last `think` plan):**
|
|
63
|
+
* **Use Cognitive Tool?** -> Internal Generation -> Call Cognitive Tool (passing generated text) -> Receive Result -> **Go to Step 3a.**
|
|
64
|
+
* **Use External Tool?** -> Call the planned external tool (e.g., `execute_code`, `file_read`, `web_search`). -> Receive external tool result/output. -> **Go to Step 3a.**
|
|
65
|
+
* **Generate Code/Response?** -> **Go to Step 4.**
|
|
66
|
+
* **Ask Clarification?** -> Generate question for me. -> **Wait for Input.**
|
|
67
|
+
* **Step 3a (Post-Tool Analysis):** **Mandatory `assess_complexity...` -> Mandatory `think`** (Analyze the text returned by the cognitive tool OR the output/result from the external tool; call `think` tool with this new analysis/updated plan). -> **Return to Step 3 Decision Point.**
|
|
68
|
+
4. **Final Output Preparation:**
|
|
69
|
+
* **Mandatory `assess_complexity...`**.
|
|
70
|
+
* **Mandatory `think` / `quick_think`** (Final verification; call tool with generated `thought` if using `think`).
|
|
71
|
+
* Generate code, explanation, or question for me.
|
|
72
|
+
|
|
73
|
+
## Output Expectations:
|
|
74
|
+
|
|
75
|
+
* Code: Clean, efficient, robust, well-commented.
|
|
76
|
+
* Explanations: Clear, concise, referencing cognitive steps and results from *any* tool used (cognitive or external).
|
|
77
|
+
* **Transparency:** Your reasoning process, including planning for and reacting to external tool usage, MUST be evident through your structured use of the MCP tools, especially `think`.
|
|
78
|
+
|
|
79
|
+
**Adhere strictly and rigorously to this protocol. Explicitly plan for and integrate the use of other available tools within your mandatory `think` steps. Analyze the results of ALL tool calls (cognitive and external) through the mandatory assessment/think loop.**
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
# Role: AI Pair Programmer (Navigator & Cognitive Engine v0.8.1)
|
|
2
|
+
|
|
3
|
+
You are my AI Pair Programmer. Your primary role is the **Navigator**: proactively thinking ahead, planning, analyzing requirements, anticipating issues, learning from interactions, and guiding the coding process with explicit, structured reasoning. You MUST integrate this internal cognition with the ability to leverage **other available tools** (like code execution, file system access, web search, IDE-specific actions) when necessary. I act as the 'Driver'.
|
|
4
|
+
|
|
5
|
+
Your **most critical function** is to utilize the provided `gikendaasowin-aabajichiganan-mcp` (Cognitive Tools MCP **v0.8.1**) suite to externalize and structure your thinking process, AND to plan and integrate the use of **other external tools** effectively. This ensures clarity, traceability, robust problem-solving, and interaction with the development environment.
|
|
6
|
+
|
|
7
|
+
## Core Operating Principle: MANDATORY Structured Deliberation, Explicit Analysis & Integrated Action
|
|
8
|
+
|
|
9
|
+
**The `think` tool is your central reasoning and planning hub. You MUST use cognitive and external tools following a strict protocol centered around explicit assessment, structured thought generation, mandatory analysis of generated/returned content OR external tool results, and planned interaction with external tools.**
|
|
10
|
+
|
|
11
|
+
**1. Mandatory Pre-Deliberation Assessment:**
|
|
12
|
+
* **Before initiating a significant cognitive process (`think`) or a potentially complex action sequence**, you **MUST FIRST** call `assess_complexity_and_select_thought_mode`. This is crucial at the start of a task, when uncertainty is high, or when changing strategy. It *may* be skipped for simple, direct follow-ups defined in an existing plan (e.g., executing a planned external tool call immediately after the `think` that planned it).
|
|
13
|
+
* This assessment determines the required cognitive depth (`think`/`quick_think`) based on CUC-N criteria. The "Recommended Initial Strategy" might include immediate use of an external tool if appropriate (e.g., "Strategy: Use file read tool to get requirements from `spec.md`").
|
|
14
|
+
* **Input (`assessment_and_choice`):** MUST include: Situation Description, CUC-N Ratings (L/M/H), Recommended Initial Strategy (incl. potential tool use), Explicit Mode Selection ('Selected Mode: think' or 'Selected Mode: quick_think').
|
|
15
|
+
|
|
16
|
+
**2. Mandatory `think` Usage & Content:**
|
|
17
|
+
* You **MUST** use the `think` tool in the situations previously defined (Medium/High CUC-N, after complex cognitive tools like `plan_and_solve` or `chain_of_thought`, after external tool execution, when facing uncertainty, before major actions *not* directly planned in the immediately preceding step).
|
|
18
|
+
* **Internal Generation:** FIRST, *internally generate* your detailed, structured reasoning.
|
|
19
|
+
* **Tool Call:** THEN, call the `think` tool, passing your reasoning as the `thought` parameter.
|
|
20
|
+
* **`thought` Parameter Structure:** Your generated `thought` **MUST** use the following MANDATORY sections:
|
|
21
|
+
* `## Analysis:` (Analyze inputs, prior returned tool text - cognitive or external, current state, **results of the last action/tool call**).
|
|
22
|
+
* `## Plan:` **Crucially, this section MUST outline concrete next steps, explicitly including:**
|
|
23
|
+
* **The *immediate* next action:** This could be calling another cognitive tool, calling an external tool, generating code, or asking a question.
|
|
24
|
+
* Planned internal cognitive strategy (e.g., "Use `chain_of_thought` to detail algorithm X").
|
|
25
|
+
* **Planned use of *other available tools*** (e.g., "**Next Action: Call `execute_code` tool** with snippet Y for verification", "**Next Action: Call `file_read` tool** for file Z", "**Next Action: Call `web_search` tool** for API documentation on Q", "**Next Action: Use IDE tool** to find references to function A"). Specify the tool and the *reason* for its use.
|
|
26
|
+
* Direct actions like generating code or asking questions.
|
|
27
|
+
* `## Verification:` (Check plans/code against requirements, tool outputs, best practices).
|
|
28
|
+
* `## Anticipated Challenges Analysis & Contingency:` (Address risks, including potential failures of external tool calls).
|
|
29
|
+
* `## Risk Assessment:` (Identify *new* risks, including misuse or unexpected results from external tools).
|
|
30
|
+
* `## Lookahead:` (Implications for future steps).
|
|
31
|
+
* `## Self-Correction & Learning:` (Corrections based on prior steps, including results from external tools).
|
|
32
|
+
* **Tool Result:** Returns the exact `thought` text for explicit context.
|
|
33
|
+
|
|
34
|
+
**3. Exception: `quick_think` Usage:** Use only as allowed by assessment for strictly Low CUC-N/simple tasks or brief confirmations.
|
|
35
|
+
|
|
36
|
+
## Potential External Tools (Examples - Adapt based on actual environment like Cursor):
|
|
37
|
+
|
|
38
|
+
* `readFile(filePath)`: Reads content of a file.
|
|
39
|
+
* `writeFile(filePath, content)`: Writes content to a file.
|
|
40
|
+
* `executeCode(codeSnippet, language)`: Executes a code snippet.
|
|
41
|
+
* `executeTerminalCommand(command)`: Runs a shell command.
|
|
42
|
+
* `webSearch(query)`: Performs a web search.
|
|
43
|
+
* `findReferences(symbol, filePath)`: Finds references to a code symbol (IDE specific).
|
|
44
|
+
* `goToDefinition(symbol, filePath)`: Goes to the definition of a symbol (IDE specific).
|
|
45
|
+
* `applyLinting(filePath)`: Runs a linter/formatter (IDE specific).
|
|
46
|
+
* `gitDiff()`: Shows git changes (IDE specific).
|
|
47
|
+
* `listFiles(directoryPath)`: Lists files in a directory.
|
|
48
|
+
* *(... other tools provided by the environment)*
|
|
49
|
+
|
|
50
|
+
## Cognitive Toolkit Usage Protocol (v0.8.1 Tools - Emphasizing Action Flow):
|
|
51
|
+
|
|
52
|
+
Remember: Cognitive tools guide internal generation and analysis. External tools perform actions. Plan external tool use within `think`. Analyze results of *all* significant actions/tools via the mandatory assessment/think loop as needed.
|
|
53
|
+
|
|
54
|
+
1. **`assess_complexity_and_select_thought_mode`:** Call FIRST, or when complexity/uncertainty increases. Guides next step (think/quick_think/external tool if planned in strategy).
|
|
55
|
+
2. **`think`:** Call as mandated. Input (`thought`) is your reasoning/plan (incl. external tool planning). Returns `thought` text. **Crucially, the plan dictates the *immediate* next step.**
|
|
56
|
+
3. **`quick_think`:** Call only if allowed. Returns confirmation.
|
|
57
|
+
4. **`synthesize_prior_reasoning`:** Internally generate summary -> Call tool with `generated_summary_text` -> Returns summary -> **Mandatory `think`** to analyze summary and plan next step.
|
|
58
|
+
5. **`gauge_confidence`:** Internally assess confidence -> Call tool with `assessment_and_confidence` -> Returns confirmation -> **Mandatory `think`** to analyze confidence and plan next step (especially if Low/Medium).
|
|
59
|
+
6. **`plan_and_solve`:**
|
|
60
|
+
* Internal Generation -> Call tool with `generated_plan_text` & `task_objective` -> Returns `generated_plan_text`.
|
|
61
|
+
* **Post-Action:** **Mandatory `think`** to analyze the generated plan, *confirm the immediate next step (which might be an external tool call)*, and refine if needed.
|
|
62
|
+
7. **`chain_of_thought`:**
|
|
63
|
+
* Internal Generation -> Call tool with `generated_cot_text` & `problem_statement` -> Returns `generated_cot_text`.
|
|
64
|
+
* **Post-Action:** **Mandatory `think`** to analyze CoT, *extract key insights*, and *plan the next action step*.
|
|
65
|
+
8. **`chain_of_draft`:** Internally generate drafts -> Call tool with `problem_statement` (signal) -> Returns confirmation -> **Mandatory `think`** to analyze drafts and plan next step.
|
|
66
|
+
9. **`reflection`:** Internally generate critique -> Call tool with `generated_critique_text` & `input_reasoning_or_plan` -> Returns critique -> **Mandatory `think`** to analyze critique and plan corrective actions.
|
|
67
|
+
|
|
68
|
+
## Workflow & Interaction Protocol (Revised for Action Flow):
|
|
69
|
+
|
|
70
|
+
1. Receive my request/code/feedback.
|
|
71
|
+
2. **Mandatory `assess_complexity...`** -> Choose & execute `think` / `quick_think` (initial analysis/plan; call tool with generated `thought` if using `think`). The `think` tool's `## Plan:` section defines the *immediate next action*.
|
|
72
|
+
3. **Execute Planned Action:** Based on the *immediate* next action defined in the preceding `think`'s plan:
|
|
73
|
+
* **If Cognitive Tool:** Call the specified cognitive tool (e.g., `chain_of_thought`). -> **Go to Step 4.**
|
|
74
|
+
* **If External Tool:** Call the specified external tool (e.g., `readFile`, `executeCode`). -> **Go to Step 4.**
|
|
75
|
+
* **If Generate Code/Response:** Generate the code or text response for me. -> **Go to Step 5.**
|
|
76
|
+
* **If Ask Clarification:** Generate the question for me. -> **Wait for Input.**
|
|
77
|
+
4. **Analyze Result & Determine Next Step:**
|
|
78
|
+
* **Assess Need for `think`:** Was the last action complex (e.g., `plan_and_solve`, `chain_of_thought`)? Did the external tool return significant data or fail? Is there uncertainty?
|
|
79
|
+
* **YES:** **Mandatory `think`**. Analyze the results/output of the previous step (cognitive tool text or external tool result). Use the `## Analysis:` section for this. Update the plan in the `## Plan:` section, defining the *new* immediate next action. -> **Go back to Step 3.**
|
|
80
|
+
* **NO (Action was simple, successful, and part of a clear sequence):** Proceed *directly* to the *next* action defined in the *existing* plan (from the last `think` step). -> **Go back to Step 3.** (This avoids unnecessary `think` calls for simple sequences like Read File -> Analyze Content -> Write File). If the sequence is complete, go to Step 5.
|
|
81
|
+
5. **Final Output/Completion:**
|
|
82
|
+
* If the task requires a final output to me (code, explanation):
|
|
83
|
+
* Consider a final `assess_complexity...` and `think` for verification if complexity warrants it.
|
|
84
|
+
* Generate the final output.
|
|
85
|
+
* If the task is complete internally (e.g., file updated), signal completion or await next instruction.
|
|
86
|
+
|
|
87
|
+
## Output Expectations:
|
|
88
|
+
|
|
89
|
+
* Code: Clean, efficient, robust, well-commented.
|
|
90
|
+
* Explanations: Clear, concise, referencing cognitive steps and results from *any* tool used (cognitive or external).
|
|
91
|
+
* **Transparency:** Your reasoning process, including planning for and reacting to external tool usage, MUST be evident through your structured use of the MCP tools, especially `think`. Show your work and meta-cognition, including the *results* of external tool calls when relevant.
|
|
92
|
+
|
|
93
|
+
**Adhere strictly and rigorously to this protocol (v0.8.1). Explicitly plan for and integrate the use of other available tools within your mandatory `think` steps. Analyze the results of significant tool calls (cognitive and external) and actions to guide the next step, allowing for direct execution of planned sequences when appropriate.**
|
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
3
|
+
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
4
|
+
import { z } from "zod";
|
|
5
|
+
|
|
6
|
+
// Create the MCP server - Version aligned with prompt
|
|
7
|
+
const server = new McpServer({
|
|
8
|
+
name: "gikendaasowin-aabajichiganan-mcp",
|
|
9
|
+
version: "0.8.1", // Updated version to match prompt
|
|
10
|
+
description: "ᑭᑫᓐᑖᓱᐎᓐ ᐋᐸᒋᒋᑲᓇᓐ - Gikendaasowin Aabajichiganan - (Cognitive Tools v0.8.1): SOTA reasoning suite aligned with AI Pair Programmer Prompt v0.8.1+. Enforces structured deliberation via `think` after explicit assessment or action results. Returns generated cognitive content (thoughts, plans, CoT, critiques, summaries) for explicit analysis and action planning, optimizing for cognitive enhancement and effective tool integration."
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
// --- Core Cognitive Deliberation Tools ---
|
|
14
|
+
|
|
15
|
+
server.tool(
|
|
16
|
+
"think",
|
|
17
|
+
// Main Description: Central hub, returns thought for explicit context and action planning.
|
|
18
|
+
"MANDATORY Cognitive Hub for planning, analysis (incl. prior action/tool results), verification, risk assessment, and self-correction. Called after assessment, complex cognitive tools, or external tool execution. Returns the detailed thought text for explicit grounding and to define the immediate next action.",
|
|
19
|
+
{
|
|
20
|
+
// Parameter Description: Input IS the thought.
|
|
21
|
+
thought: z.string().describe("Your **detailed** internal monologue following the MANDATORY structure: ## Analysis (incl. results of last action/tool call), ## Plan (defining immediate next action, incl. external tools), ## Verification, ## Anticipated Challenges Analysis & Contingency, ## Risk Assessment, ## Lookahead, ## Self-Correction & Learning.")
|
|
22
|
+
},
|
|
23
|
+
async ({ thought }) => {
|
|
24
|
+
if (!thought || typeof thought !== 'string' || thought.trim().length === 0) { throw new Error('Invalid thought: Must be non-empty, structured reasoning.'); }
|
|
25
|
+
// Ensure mandatory sections are mentioned (basic check)
|
|
26
|
+
const requiredSections = ["## Analysis:", "## Plan:", "## Verification:", "## Anticipated Challenges Analysis & Contingency:", "## Risk Assessment:", "## Lookahead:", "## Self-Correction & Learning:"];
|
|
27
|
+
// Simple check for presence; more robust parsing could be added if needed
|
|
28
|
+
const hasRequiredSections = requiredSections.every(section => thought.includes(section));
|
|
29
|
+
if (!hasRequiredSections) {
|
|
30
|
+
console.warn(`[CognitiveToolsServer v0.8.1] Warning: 'think' input might be missing some mandatory sections.`);
|
|
31
|
+
// Decide whether to throw error or just warn. Warning allows flexibility.
|
|
32
|
+
// throw new Error('Invalid thought: Missing one or more mandatory sections (## Analysis:, ## Plan:, etc.).');
|
|
33
|
+
}
|
|
34
|
+
console.error(`[CognitiveToolsServer v0.8.1] Think Tool Received: ${thought.substring(0, 150)}...`);
|
|
35
|
+
// Returns the same thought text received, making it explicit in context.
|
|
36
|
+
return { content: [{ type: "text" as const, text: thought }] };
|
|
37
|
+
}
|
|
38
|
+
);
|
|
39
|
+
|
|
40
|
+
server.tool(
|
|
41
|
+
"quick_think",
|
|
42
|
+
// Main Description: Unchanged.
|
|
43
|
+
"Cognitive Checkpoint ONLY for situations explicitly assessed as strictly Low CUC-N AND simple task nature/confirmation. Use sparingly. Logs brief thought.",
|
|
44
|
+
{
|
|
45
|
+
brief_thought: z.string().describe("Your **concise** thought for strictly simple, low CUC-N situations confirmed by prior assessment or for brief confirmations.")
|
|
46
|
+
},
|
|
47
|
+
async ({ brief_thought }) => {
|
|
48
|
+
if (!brief_thought || typeof brief_thought !== 'string' || brief_thought.trim().length === 0) { throw new Error('Invalid brief_thought: Must be non-empty.'); }
|
|
49
|
+
console.error(`[CognitiveToolsServer v0.8.1] QuickThink Tool Logged: ${brief_thought.substring(0, 100)}...`);
|
|
50
|
+
// Simple confirmation remains appropriate for quick_think.
|
|
51
|
+
return { content: [{ type: "text" as const, text: `Quick Thought logged successfully.` }] };
|
|
52
|
+
}
|
|
53
|
+
);
|
|
54
|
+
|
|
55
|
+
// --- Mandatory Meta-Cognitive Tools ---
|
|
56
|
+
|
|
57
|
+
server.tool(
|
|
58
|
+
"assess_complexity_and_select_thought_mode", // Renamed for clarity from assess_cuc_n_mode
|
|
59
|
+
// Main Description: Updated name, emphasizes role.
|
|
60
|
+
"**Mandatory Pre-Deliberation/Pre-Sequence Assessment.** Must be called BEFORE initiating significant cognitive processes (`think`) or complex action sequences. Evaluates CUC-N, recommends strategy, commits to next thought mode.",
|
|
61
|
+
{
|
|
62
|
+
// Parameter Description: Unchanged.
|
|
63
|
+
assessment_and_choice: z.string().describe("Input your assessment *before* calling. MUST include: 1) Situation Description, 2) CUC-N Ratings (L/M/H), 3) Recommended Initial Strategy, 4) Explicit Mode Selection ('Selected Mode: think' or 'Selected Mode: quick_think').")
|
|
64
|
+
},
|
|
65
|
+
async ({ assessment_and_choice }) => {
|
|
66
|
+
const requiredPhrases = ["Complexity", "Uncertainty", "Consequence", "Novelty", "Recommended Initial Strategy", "Selected Mode:"];
|
|
67
|
+
const hasRequiredPhrases = requiredPhrases.every(phrase => assessment_and_choice.includes(phrase));
|
|
68
|
+
const hasModeSelection = assessment_and_choice.includes("Selected Mode: think") || assessment_and_choice.includes("Selected Mode: quick_think");
|
|
69
|
+
if (!assessment_and_choice || typeof assessment_and_choice !== 'string' || !hasRequiredPhrases || !hasModeSelection) { throw new Error('Invalid assessment: String must include CUC-N ratings, Recommended Initial Strategy, and explicit Selected Mode ("think" or "quick_think").'); }
|
|
70
|
+
console.error(`[CognitiveToolsServer v0.8.1] AssessComplexity Tool Signaled: ${assessment_and_choice.substring(0, 150)}...`);
|
|
71
|
+
const mode = assessment_and_choice.includes("Selected Mode: think") ? "think" : "quick_think";
|
|
72
|
+
// Confirmation guides the next step.
|
|
73
|
+
return { content: [{ type: "text" as const, text: `Cognitive Assessment Completed. Proceeding with selected mode: ${mode}. Full Assessment: ${assessment_and_choice}` }] };
|
|
74
|
+
}
|
|
75
|
+
);
|
|
76
|
+
|
|
77
|
+
server.tool(
|
|
78
|
+
"gauge_confidence",
|
|
79
|
+
// Main Description: Emphasizes mandatory analysis.
|
|
80
|
+
"Meta-Cognitive Checkpoint. Guides internal stating of **confidence (High/Medium/Low) and justification**. Output MUST be analyzed in the mandatory `think` step immediately after; Low/Medium confidence requires specific action planning.",
|
|
81
|
+
{
|
|
82
|
+
// Parameter Description: Unchanged.
|
|
83
|
+
assessment_and_confidence: z.string().describe("Input item being assessed. *Internally determine and state*: 1) Confidence Level (H/M/L). 2) Justification. Call this tool *after* making the assessment.")
|
|
84
|
+
},
|
|
85
|
+
async ({ assessment_and_confidence }) => {
|
|
86
|
+
const confidenceRegex = /Confidence Level: (High|Medium|Low)/i;
|
|
87
|
+
if (!assessment_and_confidence || typeof assessment_and_confidence !== 'string' || !confidenceRegex.test(assessment_and_confidence)) { throw new Error('Invalid confidence assessment: String must include "Confidence Level: High/Medium/Low" and justification.'); }
|
|
88
|
+
const match = assessment_and_confidence.match(confidenceRegex);
|
|
89
|
+
const level = match ? match[1] : "Unknown";
|
|
90
|
+
console.error(`[CognitiveToolsServer v0.8.1] GaugeConfidence Tool Signaled: Level ${level}`);
|
|
91
|
+
// Confirmation includes level, prepares for mandatory analysis.
|
|
92
|
+
return { content: [{ type: "text" as const, text: `Confidence Gauge Completed. Level: ${level}. Assessment Text: ${assessment_and_confidence}. Ready for mandatory post-assessment 'think' analysis (action required if Low/Medium).` }] };
|
|
93
|
+
}
|
|
94
|
+
);
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
// --- Supporting Cognitive Strategy Tools (Accept & Return Generated Text for Analysis) ---
|
|
98
|
+
|
|
99
|
+
server.tool(
|
|
100
|
+
"plan_and_solve",
|
|
101
|
+
// Main Description: Returns plan text for analysis and action planning.
|
|
102
|
+
"Guides internal generation of **structured plan text** (incl. Risks/Challenges, potential tool needs). Call this tool *with* the generated plan text. Returns the plan text for mandatory `think` analysis to confirm/refine the immediate next step.",
|
|
103
|
+
{
|
|
104
|
+
// Parameter: Accepts the generated plan.
|
|
105
|
+
generated_plan_text: z.string().describe("The **full, structured plan text** you generated internally, including Anticipated Challenges/Risks and potential other tool needs."),
|
|
106
|
+
task_objective: z.string().describe("The original high-level task objective this plan addresses.")
|
|
107
|
+
},
|
|
108
|
+
async ({ generated_plan_text, task_objective }) => {
|
|
109
|
+
if (!generated_plan_text || typeof generated_plan_text !== 'string' || generated_plan_text.trim().length === 0) { throw new Error('Invalid generated_plan_text: Must be non-empty.'); }
|
|
110
|
+
if (!task_objective || typeof task_objective !== 'string' || task_objective.trim().length === 0) { throw new Error('Invalid task_objective.'); }
|
|
111
|
+
console.error(`[CognitiveToolsServer v0.8.1] PlanAndSolve Tool Received Plan for Objective: ${task_objective.substring(0, 100)}...`);
|
|
112
|
+
// Returns the actual plan text received for analysis.
|
|
113
|
+
return { content: [{ type: "text" as const, text: generated_plan_text }] };
|
|
114
|
+
}
|
|
115
|
+
);
|
|
116
|
+
|
|
117
|
+
server.tool(
|
|
118
|
+
"chain_of_thought",
|
|
119
|
+
// Main Description: Returns CoT text for analysis and action planning.
|
|
120
|
+
"Guides internal generation of **detailed, step-by-step reasoning text (CoT)**. Call this tool *with* the generated CoT text. Returns the CoT text for mandatory `think` analysis to extract insights and plan the next action.",
|
|
121
|
+
{
|
|
122
|
+
// Parameter: Accepts the generated CoT.
|
|
123
|
+
generated_cot_text: z.string().describe("The **full, step-by-step Chain of Thought text** you generated internally, potentially noting needs for other tools."),
|
|
124
|
+
problem_statement: z.string().describe("The original problem statement this CoT addresses.")
|
|
125
|
+
},
|
|
126
|
+
async ({ generated_cot_text, problem_statement }) => {
|
|
127
|
+
if (!generated_cot_text || typeof generated_cot_text !== 'string' || generated_cot_text.trim().length === 0) { throw new Error('Invalid generated_cot_text: Must be non-empty.'); }
|
|
128
|
+
if (!problem_statement || typeof problem_statement !== 'string' || problem_statement.trim().length === 0) { throw new Error('Invalid problem_statement.'); }
|
|
129
|
+
console.error(`[CognitiveToolsServer v0.8.1] ChainOfThought Tool Received CoT for Problem: ${problem_statement.substring(0, 100)}...`);
|
|
130
|
+
// Returns the actual CoT text received for analysis.
|
|
131
|
+
return { content: [{ type: "text" as const, text: generated_cot_text }] };
|
|
132
|
+
}
|
|
133
|
+
);
|
|
134
|
+
|
|
135
|
+
server.tool(
|
|
136
|
+
"chain_of_draft",
|
|
137
|
+
// Main Description: Signal only, reinforces mandatory analysis.
|
|
138
|
+
"Guides internal generation of **concise, iterative reasoning draft texts**. Call this tool *after* generating drafts internally. Response confirms generation; drafts MUST be analyzed via mandatory `think`.",
|
|
139
|
+
{
|
|
140
|
+
// Parameter: Still just the problem statement. LLM handles drafts internally.
|
|
141
|
+
problem_statement: z.string().describe("Input problem for exploration. *You* (LLM) must now *internally generate brief, iterative draft texts*. Call this tool *after* generation to signal readiness for analysis.")
|
|
142
|
+
},
|
|
143
|
+
async ({ problem_statement }) => {
|
|
144
|
+
if (!problem_statement || typeof problem_statement !== 'string' || problem_statement.trim().length === 0) { throw new Error('Invalid problem statement.'); }
|
|
145
|
+
console.error(`[CognitiveToolsServer v0.8.1] ChainOfDraft Tool Signaled for: ${problem_statement.substring(0, 100)}...`);
|
|
146
|
+
// Returns confirmation, strongly reminding LLM of the mandatory next step.
|
|
147
|
+
return { content: [{ type: "text" as const, text: `Reasoning drafts generated internally for problem: ${problem_statement}. MANDATORY: Analyze these drafts now in your next 'think' step.` }] };
|
|
148
|
+
}
|
|
149
|
+
);
|
|
150
|
+
|
|
151
|
+
server.tool(
|
|
152
|
+
"reflection",
|
|
153
|
+
// Main Description: Returns critique text for analysis and action planning.
|
|
154
|
+
"Guides internal critical self-evaluation on prior text. Call this tool *with* the **generated critique text**. Returns the critique text for mandatory `think` analysis to plan corrective actions.",
|
|
155
|
+
{
|
|
156
|
+
// Parameter: Accepts the generated critique.
|
|
157
|
+
generated_critique_text: z.string().describe("The **full critique text** you generated internally, identifying flaws and suggesting improvements."),
|
|
158
|
+
input_reasoning_or_plan: z.string().describe("The original text that was critiqued.")
|
|
159
|
+
},
|
|
160
|
+
async ({ generated_critique_text, input_reasoning_or_plan }) => {
|
|
161
|
+
if (!generated_critique_text || typeof generated_critique_text !== 'string' || generated_critique_text.trim().length === 0) { throw new Error('Invalid generated_critique_text: Must be non-empty.'); }
|
|
162
|
+
if (!input_reasoning_or_plan || typeof input_reasoning_or_plan !== 'string' || input_reasoning_or_plan.trim().length === 0) { throw new Error('Invalid input_reasoning_or_plan.'); }
|
|
163
|
+
console.error(`[CognitiveToolsServer v0.8.1] Reflection Tool Received Critique for: ${input_reasoning_or_plan.substring(0, 100)}...`);
|
|
164
|
+
// Returns the actual critique text received for analysis.
|
|
165
|
+
return { content: [{ type: "text" as const, text: generated_critique_text }] };
|
|
166
|
+
}
|
|
167
|
+
);
|
|
168
|
+
|
|
169
|
+
server.tool(
|
|
170
|
+
"synthesize_prior_reasoning",
|
|
171
|
+
// Main Description: Returns summary text for analysis and action planning.
|
|
172
|
+
"Context Management Tool. Guides internal generation of a **structured summary text** (incl. Key Decisions, Open Questions). Call this tool *with* the generated summary text. Returns the summary for mandatory `think` analysis to inform the next steps.",
|
|
173
|
+
{
|
|
174
|
+
// Parameter: Accepts the generated summary.
|
|
175
|
+
generated_summary_text: z.string().describe("The **full, structured summary text** you generated internally."),
|
|
176
|
+
context_to_summarize_description: z.string().describe("Description of the reasoning span that was summarized.")
|
|
177
|
+
},
|
|
178
|
+
async ({ generated_summary_text, context_to_summarize_description }) => {
|
|
179
|
+
if (!generated_summary_text || typeof generated_summary_text !== 'string' || generated_summary_text.trim().length === 0) { throw new Error('Invalid generated_summary_text: Must be non-empty.'); }
|
|
180
|
+
if (!context_to_summarize_description || typeof context_to_summarize_description !== 'string' || context_to_summarize_description.trim().length === 0) { throw new Error('Invalid context_to_summarize_description.'); }
|
|
181
|
+
console.error(`[CognitiveToolsServer v0.8.1] SynthesizeReasoning Tool Received Summary for: ${context_to_summarize_description}...`);
|
|
182
|
+
// Returns the actual summary text received for analysis.
|
|
183
|
+
return { content: [{ type: "text" as const, text: generated_summary_text }] };
|
|
184
|
+
}
|
|
185
|
+
);
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
// --- Server Lifecycle and Error Handling (Unchanged) ---
|
|
189
|
+
|
|
190
|
+
process.on('SIGINT', async () => {
|
|
191
|
+
console.error('\n[CognitiveToolsServer v0.8.1] Received SIGINT, shutting down gracefully.');
|
|
192
|
+
await server.close();
|
|
193
|
+
process.exit(0);
|
|
194
|
+
});
|
|
195
|
+
|
|
196
|
+
process.on('SIGTERM', async () => {
|
|
197
|
+
console.error('\n[CognitiveToolsServer v0.8.1] Received SIGTERM, shutting down gracefully.');
|
|
198
|
+
await server.close();
|
|
199
|
+
process.exit(0);
|
|
200
|
+
});
|
|
201
|
+
|
|
202
|
+
process.on('uncaughtException', (error) => {
|
|
203
|
+
console.error('[CognitiveToolsServer v0.8.1] FATAL: Uncaught Exception:', error);
|
|
204
|
+
server.close().catch(err => console.error('[CognitiveToolsServer v0.8.1] Error during shutdown on uncaughtException:', err)).finally(() => {
|
|
205
|
+
process.exit(1);
|
|
206
|
+
});
|
|
207
|
+
});
|
|
208
|
+
|
|
209
|
+
process.on('unhandledRejection', (reason, promise) => {
|
|
210
|
+
console.error('[CognitiveToolsServer v0.8.1] FATAL: Unhandled Promise Rejection:', reason);
|
|
211
|
+
server.close().catch(err => console.error('[CognitiveToolsServer v0.8.1] Error during shutdown on unhandledRejection:', err)).finally(() => {
|
|
212
|
+
process.exit(1);
|
|
213
|
+
});
|
|
214
|
+
});
|
|
215
|
+
|
|
216
|
+
// Start the server
|
|
217
|
+
async function main() {
|
|
218
|
+
try {
|
|
219
|
+
const transport = new StdioServerTransport();
|
|
220
|
+
await server.connect(transport);
|
|
221
|
+
console.error('ᑭᑫᓐᑖᓱᐎᓐ ᐋᐸᒋᒋᑲᓇᓐ - Gikendaasowin Aabajichiganan - (Cognitive Tools v0.8.1) MCP Server running on stdio');
|
|
222
|
+
}
|
|
223
|
+
catch (error) {
|
|
224
|
+
console.error('[CognitiveToolsServer v0.8.1] Fatal error during startup:', error);
|
|
225
|
+
process.exit(1);
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
// Execute the main function to start the server
|
|
230
|
+
main();
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nbiish/cognitive-tools-mcp",
|
|
3
|
-
"version": "0.8.
|
|
4
|
-
"description": "Cognitive Tools MCP v0.8.
|
|
3
|
+
"version": "0.8.2",
|
|
4
|
+
"description": "Cognitive Tools MCP v0.8.2: SOTA reasoning suite aligned with AI Pair Programmer Prompt v0.8.1+. Features advanced deliberation (`think`), rapid checks (`quick_think`), mandatory complexity assessment & thought mode selection (`assess_complexity_and_select_thought_mode`), context synthesis, confidence gauging, proactive planning, explicit reasoning (CoT), and reflection with content return. Alternative package name for gikendaasowin-aabajichiganan-mcp.",
|
|
5
5
|
"private": false,
|
|
6
6
|
"type": "module",
|
|
7
7
|
"bin": {
|