@nbiish/cognitive-tools-mcp 0.9.27 → 0.9.29

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/LICENSE CHANGED
@@ -68,13 +68,13 @@ WHEREAS the inherent sovereignty of tribal nations provides a constitutional and
68
68
  Any use, reproduction, distribution, modification, adaptation, display, performance, transmission, or creation of derivative works based on this Work, whether in whole or in part, must prominently and accurately include the following citation and attribution in all associated materials, displays, publications, and metadata:
69
69
 
70
70
  ```bibtex
71
- @misc{gikendaasowin-aabajichiganan-mcp2025,
71
+ @misc{<|repo_title|><|current_year=2025|>,
72
72
  author/creator/steward = {ᓂᐲᔥ ᐙᐸᓂᒥᑮ-ᑭᓇᐙᐸᑭᓯ (Nbiish Waabanimikii-Kinawaabakizi), also known legally as JUSTIN PAUL KENWABIKISE, professionally documented as Nbiish-Justin Paul Kenwabikise, Anishinaabek Dodem (Anishinaabe Clan): Animikii (Thunder), descendant of Chief ᑭᓇᐙᐸᑭᓯ (Kinwaabakizi) of the Beaver Island Band and enrolled member of the sovereign Grand Traverse Band of Ottawa and Chippewa Indians},
73
- title/description = {gikendaasowin-aabajichiganan-mcp},
73
+ title/description = {<|repo_title|>},
74
74
  type_of_work = {Indigenous digital creation/software incorporating traditional knowledge and cultural expressions},
75
- year = {2025},
75
+ year = {<|current_year|>},
76
76
  publisher/source/event = {GitHub repository under tribal sovereignty protections},
77
- howpublished = {\\url{https://github.com/nbiish/gikendaasowin-aabajichiganan-mcp}},
77
+ howpublished = {\url{https://github.com/nbiish/<|repo_title|>}},
78
78
  note = {Authored and stewarded by ᓂᐲᔥ ᐙᐸᓂᒥᑮ-ᑭᓇᐙᐸᑭᓯ (Nbiish Waabanimikii-Kinawaabakizi), also known legally as JUSTIN PAUL KENWABIKISE, professionally documented as Nbiish-Justin Paul Kenwabikise, Anishinaabek Dodem (Anishinaabe Clan): Animikii (Thunder), descendant of Chief ᑭᓇᐙᐸᑭᓯ (Kinwaabakizi) of the Beaver Island Band and enrolled member of the sovereign Grand Traverse Band of Ottawa and Chippewa Indians. This work embodies Indigenous intellectual property, traditional knowledge systems (TK), traditional cultural expressions (TCEs), and associated data protected under tribal law, federal Indian law, treaty rights, Indigenous Data Sovereignty principles, and international indigenous rights frameworks including UNDRIP. All usage, benefit-sharing, and data governance are governed by the COMPREHENSIVE RESTRICTED USE LICENSE FOR INDIGENOUS CREATIONS WITH TRIBAL SOVEREIGNTY, DATA SOVEREIGNTY, AND WEALTH RECLAMATION PROTECTIONS.}
79
79
  }
80
80
  ```
package/README.md CHANGED
@@ -7,14 +7,11 @@
7
7
  type_of_work = {Indigenous digital creation/software incorporating traditional knowledge and cultural expressions},
8
8
  year = {2025},
9
9
  publisher/source/event = {GitHub repository under tribal sovereignty protections},
10
- howpublished = {\\url{https://github.com/nbiish/gikendaasowin-aabajichiganan-mcp}},
11
- note = {Authored and stewarded by ᓂᐲᔥ ᐙᐸᓂᒥᑮ-ᑭᓇᐙᐸᑭᓯ (Nbiish Waabanimikii-Kinawaabakizi), also known legally as JUSTIN PAUL KENWABIKISE, professionally documented as Nbiish-Justin Paul Kenwabikise, Anishinaabek Dodem (Anishinaabe Clan): Animikii (Thunder), descendant of Chief ᑭᓇᐙᐸᑭᓯ (Kinwaabakizi) of the Beaver Island Band and enrolled member of the sovereign Grand Traverse Band of Ottawa and Chippewa Indians. This work embodies Indigenous intellectual property, traditional knowledge systems (TK), traditional cultural expressions (TCEs), and associated data protected under tribal law, federal Indian law, treaty rights, Indigenous Data Sovereignty principles, and international indigenous rights frameworks including UNDRIP. All usage, benefit-sharing, and data governance are governed by the COMPREHENSIVE RESTRICTED USE LICENSE FOR INDIGENOUS CREATIONS WITH TRIBAL SOVEREIGNTY, DATA SOVEREIGNTY, AND WEALTH RECLAMATION PROTECTIONS.}\n}
10
+ howpublished = {\url{https://github.com/nbiish/gikendaasowin-aabajichiganan-mcp}},
11
+ note = {Authored and stewarded by ᓂᐲᔥ ᐙᐸᓂᒥᑮ-ᑭᓇᐙᐸᑭᓯ (Nbiish Waabanimikii-Kinawaabakizi), also known legally as JUSTIN PAUL KENWABIKISE, professionally documented as Nbiish-Justin Paul Kenwabikise, Anishinaabek Dodem (Anishinaabe Clan): Animikii (Thunder), descendant of Chief ᑭᓇᐙᐸᑭᓯ (Kinwaabakizi) of the Beaver Island Band and enrolled member of the sovereign Grand Traverse Band of Ottawa and Chippewa Indians. This work embodies Indigenous intellectual property, traditional knowledge systems (TK), traditional cultural expressions (TCEs), and associated data protected under tribal law, federal Indian law, treaty rights, Indigenous Data Sovereignty principles, and international indigenous rights frameworks including UNDRIP. All usage, benefit-sharing, and data governance are governed by the COMPREHENSIVE RESTRICTED USE LICENSE FOR INDIGENOUS CREATIONS WITH TRIBAL SOVEREIGNTY, DATA SOVEREIGNTY, AND WEALTH RECLAMATION PROTECTIONS.}
12
+ }
12
13
  ```
13
14
 
14
- Copyright © 2025 ᓂᐲᔥ ᐙᐸᓂᒥᑮ-ᑭᓇᐙᐸᑭᓯ (Nbiish Waabanimikii-Kinawaabakizi), also known legally as JUSTIN PAUL KENWABIKISE, professionally documented as Nbiish-Justin Paul Kenwabikise, Anishinaabek Dodem (Anishinaabe Clan): Animikii (Thunder), a descendant of Chief ᑭᓇᐙᐸᑭᓯ (Kinwaabakizi) of the Beaver Island Band, and an enrolled member of the sovereign Grand Traverse Band of Ottawa and Chippewa Indians. This work embodies Traditional Knowledge and Traditional Cultural Expressions. All rights reserved.
15
-
16
- This project is licensed under the [COMPREHENSIVE RESTRICTED USE LICENSE FOR INDIGENOUS CREATIONS WITH TRIBAL SOVEREIGNTY, DATA SOVEREIGNTY, AND WEALTH RECLAMATION PROTECTIONS](LICENSE).
17
-
18
15
  <div align="center">
19
16
  <hr width="50%">
20
17
 
@@ -33,6 +30,10 @@ This project is licensed under the [COMPREHENSIVE RESTRICTED USE LICENSE FOR IND
33
30
  <hr width="50%">
34
31
  </div>
35
32
 
33
+ Copyright © 2025 ᓂᐲᔥ ᐙᐸᓂᒥᑮ-ᑭᓇᐙᐸᑭᓯ (Nbiish Waabanimikii-Kinawaabakizi), also known legally as JUSTIN PAUL KENWABIKISE, professionally documented as Nbiish-Justin Paul Kenwabikise, Anishinaabek Dodem (Anishinaabe Clan): Animikii (Thunder), a descendant of Chief ᑭᓇᐙᐸᑭᓯ (Kinwaabakizi) of the Beaver Island Band, and an enrolled member of the sovereign Grand Traverse Band of Ottawa and Chippewa Indians. This work embodies Traditional Knowledge and Traditional Cultural Expressions. All rights reserved.
34
+
35
+ This project is licensed under the [COMPREHENSIVE RESTRICTED USE LICENSE FOR INDIGENOUS CREATIONS WITH TRIBAL SOVEREIGNTY, DATA SOVEREIGNTY, AND WEALTH RECLAMATION PROTECTIONS](LICENSE).
36
+
36
37
  ᑭᑫᓐᑖᓱᐎᓐ ᐋᐸᒋᒋᑲᓇᓐ - Gikendaasowin Aabajichiganan - Cognitive Tools MCP: SOTA reasoning suite focused on iterative refinement and tool integration for AI Pair Programming. Enables structured, iterative problem-solving through Chain of Draft methodology, with tools for draft generation, analysis, and refinement. Features include advanced deliberation (`think`), rapid checks (`quick_think`), mandatory complexity assessment (`assess_cuc_n_mode`), context synthesis, confidence gauging, proactive planning, explicit reasoning (CoT), and reflection.
37
38
 
38
39
  Known as:
package/build/index.js CHANGED
@@ -1,26 +1,21 @@
1
1
  #!/usr/bin/env node
2
2
  /**
3
3
  * -----------------------------------------------------------------------------
4
- * Gikendaasowin Aabajichiganan - Core Cognitive Tools MCP Server (Ultra-Simplified Core)
4
+ * Gikendaasowin Aabajichiganan - Core INTERNAL Cognitive Tools (v4)
5
5
  *
6
- * Description: Provides an ultra-streamlined suite of cognitive tools for an AI agent,
7
- * focusing on assessment (`assess_cuc_n_mode`) and a central
8
- * deliberation hub (`think` / `quick_think`). Chain of Thought (CoT)
9
- * and Chain of Draft (CoD) reasoning styles are performed *within*
10
- * the `think` tool as guided by the system prompt, not via separate tools.
11
- * Validation on input content structure is removed. Tool results are
12
- * returned as formatted Markdown. Versioning removed.
6
+ * Description: Provides a mandatory internal suite of cognitive tools for an AI
7
+ * agent, heavily emphasizing the `think` tool as the central reasoning
8
+ * engine, guided by SOTA prompting principles (structured thought, CoT).
9
+ * These tools are STRICTLY for internal deliberation and logging.
13
10
  *
14
11
  * Key Principles:
15
- * 1. **Focused Deliberation:** Tools guide assessment (`assess_cuc_n_mode`) and
16
- * thinking/analysis (`think`, `quick_think`).
17
- * 2. **Centralized Analysis (`think`):** The `think` tool is the hub for all
18
- * complex analysis, planning, reflection, synthesis, confidence assessment,
19
- * and generation of detailed (CoT-style) or concise (CoD-style) reasoning.
20
- * 3. **CUC-N Assessment:** `assess_cuc_n_mode` guides initial cognitive depth.
21
- * 4. **Iterative Loop:** Assess -> Think/QuickThink -> Analyze results in Think/QuickThink.
22
- * 5. **Traceability:** All tool inputs are logged for a complete record.
23
- * 6. **Markdown Output:** Tool results are formatted as Markdown.
12
+ * 1. **Internal Use Only:** Tools (`assess_cuc_n_mode`, `think`, `quick_think`)
13
+ * are part of the agent's internal cognitive loop and MUST NOT be exposed to the user.
14
+ * 2. **Mandatory `think` Hub:** `think` is the required tool for all non-trivial
15
+ * analysis, planning, reasoning (CoT/CoD), reflection, and error handling.
16
+ * 3. **Structured Reasoning:** Prompts enforce structured input (OODReAct for `think`).
17
+ * 4. **Traceability:** All internal tool inputs are logged for debugging and analysis.
18
+ * 5. **Log Output:** Tools return their input formatted as a Markdown log entry.
24
19
  *
25
20
  * Protocol: Model Context Protocol (MCP) over stdio.
26
21
  * -----------------------------------------------------------------------------
@@ -30,147 +25,151 @@ import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js"
30
25
  import { z } from "zod";
31
26
  // --- Server Definition ---
32
27
  const serverInfo = {
33
- name: "gikendaasowin-aabajichiganan-mcp",
34
- version: "1.0.0",
35
- // Version field removed
36
- description: `ᑭᑫᓐᑖᓱᐎᓐ ᐋᐸᒋᒋᑲᓇᓐ - Core Cognitive Tools Suite (Ultra-Simplified): Focuses on Assess/Think loop. CoT/CoD styles are integrated into 'think'. Returns Markdown.`
28
+ name: "gikendaasowin-aabajichiganan-mcp-internal", // Keep internal marker
29
+ version: "4.0.0", // Increment version
30
+ description: `ᑭᑫᓐᑖᓱᐎᓐ ᐋᐸᒋᒋᑲᓇᓐ - Core INTERNAL Cognitive Tools Suite (v4): MANDATORY Assess/Think loop for internal reasoning ONLY. Enforces structured 'think' via OODReAct. Returns internal Markdown log.`
37
31
  };
38
32
  const server = new McpServer(serverInfo);
39
33
  // --- Logging Helpers ---
40
34
  /**
41
- * Logs an incoming tool call to stderr.
42
- * @param toolName The name of the tool being called.
35
+ * Logs an incoming INTERNAL tool call to stderr.
36
+ * @param toolName The name of the internal tool being called.
43
37
  * @param details Optional additional details about the call.
44
38
  */
45
39
  function logToolCall(toolName, details) {
46
40
  const timestamp = new Date().toISOString();
47
- console.error(`[${timestamp}] [MCP Server] > Tool Call: ${toolName}${details ? ` - ${details}` : ''}`);
41
+ console.error(`[${timestamp}] [MCP Server - INTERNAL] > Tool Call: ${toolName}${details ? ` - ${details}` : ''}`);
48
42
  }
49
43
  /**
50
- * Logs the result (success or failure) of a tool execution to stderr.
51
- * @param toolName The name of the tool executed.
44
+ * Logs the result (success or failure) of an INTERNAL tool execution to stderr.
45
+ * @param toolName The name of the internal tool executed.
52
46
  * @param success Whether the execution was successful.
53
47
  * @param resultDetails Optional details about the result.
54
48
  */
55
49
  function logToolResult(toolName, success, resultDetails) {
56
50
  const timestamp = new Date().toISOString();
57
- console.error(`[${timestamp}] [MCP Server] < Tool Result: ${toolName} - ${success ? 'Success' : 'Failure'}${resultDetails ? ` - ${resultDetails}` : ''}`);
51
+ console.error(`[${timestamp}] [MCP Server - INTERNAL] < Tool Result: ${toolName} - ${success ? 'Success' : 'Failure'}${resultDetails ? ` - ${resultDetails}` : ''}`);
58
52
  }
59
53
  /**
60
- * Logs an error during tool execution and formats a standard error response for the LLM.
61
- * @param toolName The name of the tool where the error occurred.
54
+ * Logs an error during INTERNAL tool execution and formats an error response for the LLM.
55
+ * Guides the LLM to use the 'think' tool for analysis.
56
+ * @param toolName The name of the internal tool where the error occurred.
62
57
  * @param error The error object or message.
63
58
  * @returns An object matching the required MCP tool result structure containing the error message.
64
59
  */
65
60
  function logToolError(toolName, error) {
66
61
  const timestamp = new Date().toISOString();
67
62
  const errorMessage = error instanceof Error ? error.message : String(error);
68
- console.error(`[${timestamp}] [MCP Server] ! Tool Error: ${toolName} - ${errorMessage}`);
69
- logToolResult(toolName, false, errorMessage); // Log failure result as well
70
- // Return a structured error message suitable for the LLM
63
+ console.error(`[${timestamp}] [MCP Server - INTERNAL] ! Tool Error: ${toolName} - ${errorMessage}`);
64
+ logToolResult(toolName, false, errorMessage); // Log failure result
65
+ // Return a structured error message guiding the next internal step
71
66
  return {
72
67
  content: [{
73
68
  type: "text",
74
- text: `Error executing tool '${toolName}': ${errorMessage}. Please analyze this error.`
69
+ // Explicitly direct the next step to be analysis via 'think'
70
+ text: `INTERNAL Tool Execution Failed:\nTool: ${toolName}\nError: ${errorMessage}\n\n**Action Required: Immediately use the 'think' tool to analyze this failure (Observe, Orient, Decide, Reason...) before proceeding.**`
75
71
  }]
76
72
  };
77
73
  }
78
- // --- Core Cognitive Deliberation & Refinement Tools ---
74
+ // --- Core INTERNAL Cognitive Deliberation & Refinement Tools ---
79
75
  /**
80
- * Tool: assess_cuc_n_mode
81
- * Purpose: Initial assessment of task characteristics to determine cognitive strategy.
82
- * Workflow: Call BEFORE starting complex tasks or significantly changing strategy.
83
- * Output: Returns the full assessment text formatted as Markdown.
76
+ * Tool: assess_cuc_n_mode (Internal Pre-computation)
77
+ * Purpose: Mandatory internal assessment of task CUC-N to determine required cognitive depth and select the next internal tool (`think` or `quick_think`).
78
+ * Workflow: Call internally BEFORE starting any non-trivial task or request. Output selection is binding.
79
+ * Output: Returns the assessment text formatted as Markdown log, confirming the mandatory next internal step.
84
80
  */
85
- server.tool("assess_cuc_n_mode", "**Initial Assessment.** Evaluates task Complexity, Uncertainty, Consequence, Novelty (CUC-N) to determine required cognitive depth and initial strategy. Call before starting complex tasks. Based on assessment, use either `think` (for structured analysis) or `quick_think` (for streamlined processing) in the next step.", {
86
- assessment_and_choice: z.string().describe("Your structured assessment including: 1) Situation Description, 2) CUC-N Ratings (Low/Medium/High for each), 3) Rationale for ratings, 4) Recommended Initial Cognitive Strategy (e.g., 'Proceed with think step'), 5) Explicit Mode Selection ('Selected Mode: think' or 'Selected Mode: quick_think').")
81
+ server.tool("assess_cuc_n_mode", "**INTERNAL Use Only.** Mandatory Initial Assessment. Evaluates task CUC-N. MUST explicitly state 'Selected Mode: think' or 'Selected Mode: quick_think' which dictates the required next internal step. This assessment guides internal processing ONLY.", {
82
+ assessment_and_choice: z.string().min(1, "Assessment cannot be empty.") // Ensure non-empty
83
+ .includes("Selected Mode:", { message: "Assessment MUST include 'Selected Mode: think' or 'Selected Mode: quick_think'." }) // Enforce selection presence
84
+ .describe("Your internal structured CUC-N assessment (Situation, Ratings, Rationale, Strategy) concluding with the MANDATORY 'Selected Mode: think' or 'Selected Mode: quick_think' line. This dictates the next internal tool call.")
87
85
  }, async ({ assessment_and_choice }) => {
88
86
  const toolName = 'assess_cuc_n_mode';
89
87
  logToolCall(toolName);
90
88
  try {
91
- // Basic Zod validation ensures it's a string. Content validation removed.
89
+ // Zod validation now handles non-empty and presence of "Selected Mode:"
92
90
  const modeRegex = /Selected Mode: (think|quick_think)/i;
93
91
  const modeMatch = assessment_and_choice.match(modeRegex);
94
- const selectedMode = modeMatch ? modeMatch[1].toLowerCase() : "unknown"; // Extract mode for logging
95
- // Ensure assessment_and_choice is a non-empty string
96
- if (assessment_and_choice.trim().length === 0) {
97
- throw new Error('Invalid assessment_and_choice: Must be a non-empty string.');
98
- }
92
+ // We rely on Zod to ensure modeMatch is not null due to .includes check, but double-check for robustness
99
93
  if (!modeMatch) {
100
- // Add a check for the mode selection presence
101
- throw new Error('Invalid assessment: String must include explicit "Selected Mode: think" or "Selected Mode: quick_think".');
94
+ throw new Error("Internal validation failed: 'Selected Mode:' found but couldn't extract 'think' or 'quick_think'. Input was: " + assessment_and_choice);
102
95
  }
103
- logToolResult(toolName, true, `Selected mode (extracted): ${selectedMode}`);
104
- // Log full input for traceability
105
- console.error(`[${new Date().toISOString()}] [MCP Server] - ${toolName} Input:\n${assessment_and_choice}`);
106
- // Return the full assessment text, now without markdown wrappers
96
+ const selectedMode = modeMatch[1].toLowerCase();
97
+ logToolResult(toolName, true, `Mandatory next internal mode: ${selectedMode}`);
98
+ console.error(`[${new Date().toISOString()}] [MCP Server - INTERNAL] - ${toolName} Input:\n${assessment_and_choice}`);
99
+ // Return the assessment text as a log/confirmation
107
100
  return {
108
101
  content: [{
109
102
  type: "text",
110
- text: assessment_and_choice // Removed wrappers
103
+ // Clarify the output's purpose
104
+ text: `Internal CUC-N Assessment Logged. Mandatory Next Step: ${selectedMode}\n---\nAssessment Details:\n${assessment_and_choice}`
111
105
  }]
112
106
  };
113
107
  }
114
108
  catch (error) {
109
+ // Catch Zod errors or other exceptions
115
110
  return logToolError(toolName, error);
116
111
  }
117
112
  });
118
113
  /**
119
- * Tool: think
120
- * Purpose: The **CENTRAL, COMPREHENSIVE HUB** for the cognitive loop. Incorporates OODReAct principles.
121
- * Workflow: Handles ALL complex analysis, planning, reflection, synthesis, confidence assessment, and generation of detailed (CoT-style) or concise (CoD-style) reasoning. Structure is guided by the prompt.
122
- * Output: Returns the structured thought text itself, formatted as Markdown.
114
+ * Tool: think (Primary Internal Reasoning Engine - MANDATORY HUB)
115
+ * Purpose: The **central, mandatory hub** for ALL significant internal cognitive work (analysis, planning, CoT/CoD reasoning, reflection, error handling). Internal use ONLY.
116
+ * Workflow: Use whenever required by `assess_cuc_n_mode`, after receiving non-trivial tool results/errors, or before complex external actions. MUST follow OODReAct structure.
117
+ * Output: Returns the structured thought text itself as a Markdown log entry.
123
118
  */
124
- server.tool("think", "**Central Hub for Comprehensive Analysis and Planning.** Use after `assess_cuc_n_mode`, after external action results/errors, or after `quick_think` if deeper analysis is needed. Incorporates OODReAct principles. Perform ALL detailed analysis, planning, reflection, synthesis, confidence assessment, and detailed (CoT-style) or concise (CoD-style) reasoning within this tool. Structure your thought clearly using headings. For simpler follow-up steps, consider using `quick_think`.", {
125
- thought: z.string().describe("Your **detailed** internal monologue covering Analysis/Observation, Plan/Decision, Verification, Risk & Contingency, and Learning & Adaptation. Include CoT/CoD style reasoning in the 'Reason' section when needed. Use clear headings. OODReAct-style headers are recommended.")
119
+ server.tool("think", "**INTERNAL Use Only. Mandatory Central Hub for Reasoning.** Use for ALL internal analysis, planning, CoT/CoD reasoning, reflection, error handling. MUST use OODReAct structure (Observe, Orient, Decide, Reason, Act, Verification, Risk, Learning).", {
120
+ thought: z.string().min(10, "Thought must contain substantive reasoning.") // Require minimum length
121
+ // Enforce presence of key OODReAct sections for structure
122
+ .includes("## Observe:", { message: "Thought MUST include '## Observe:' section." })
123
+ .includes("## Orient:", { message: "Thought MUST include '## Orient:' section." })
124
+ .includes("## Decide:", { message: "Thought MUST include '## Decide:' section." })
125
+ .includes("## Reason:", { message: "Thought MUST include '## Reason:' section where CoT/CoD happens." })
126
+ // Add more checks as needed (Act, Verification, etc.) if strict enforcement is desired
127
+ // .includes("## Act:", "Thought MUST include '## Act:' section.")
128
+ // .includes("## Verification:", "Thought MUST include '## Verification:' section.")
129
+ // .includes("## Risk & Contingency:", "Thought MUST include '## Risk & Contingency:' section.")
130
+ // .includes("## Learning & Adaptation:", "Thought MUST include '## Learning & Adaptation:' section.")
131
+ .describe("Your **detailed internal monologue** STRICTLY following the OODReAct structure. Cover analysis (Observe), context (Orient), next step (Decide), detailed rationale/CoT/CoD (Reason), execution plan (Act), success checks (Verification), risks (Risk), and learning (Learning). This is purely for internal reasoning.")
126
132
  }, async ({ thought }) => {
127
133
  const toolName = 'think';
128
134
  logToolCall(toolName);
129
135
  try {
130
- // Basic Zod validation ensures it's a non-empty string. Content validation removed.
131
- if (thought.trim().length === 0) {
132
- throw new Error('Invalid thought: Must be a non-empty string containing substantive reasoning.');
133
- }
134
- logToolResult(toolName, true, `Thought logged (length: ${thought.length})`);
135
- // Log full input for traceability
136
- console.error(`[${new Date().toISOString()}] [MCP Server] - ${toolName} Input:\n${thought}`);
137
- // Returns the same thought text received, now without markdown wrappers
136
+ // Zod validation handles non-empty and key section presence checks
137
+ logToolResult(toolName, true, `Internal thought logged (length: ${thought.length})`);
138
+ console.error(`[${new Date().toISOString()}] [MCP Server - INTERNAL] - ${toolName} Input:\n${thought}`);
139
+ // Return the thought text as a log entry
138
140
  return {
139
141
  content: [{
140
142
  type: "text",
141
- text: thought // Removed wrappers
143
+ text: `Internal Thought Logged (OODReAct Structure):\n---\n${thought}` // Added prefix and structure reminder
142
144
  }]
143
145
  };
144
146
  }
145
147
  catch (error) {
146
- // Use logToolError to format the error for the LLM
147
148
  return logToolError(toolName, error);
148
149
  }
149
150
  });
150
151
  /**
151
- * Tool: quick_think
152
- * Purpose: A lightweight cognitive checkpoint for streamlined processing. Suitable for simple confirmations OR **efficient Chain of Draft (CoD) reasoning**.
153
- * Workflow: Use ONLY when full structured analysis via `think` is genuinely unnecessary (Low CUC-N, trivial results, or targeted CoD application).
154
- * Output: Returns the brief thought/draft text, formatted as Markdown.
152
+ * Tool: quick_think (Internal Trivial Checkpoint - RARE USE)
153
+ * Purpose: An internal-only lightweight confirmation step for unambiguously trivial situations assessed as Low CUC-N.
154
+ * Workflow: Use EXTREMELY SPARINGLY, ONLY when explicitly selected by `assess_cuc_n_mode` for trivial confirmations. Default to `think`.
155
+ * Output: Returns the brief thought text as a Markdown log entry.
155
156
  */
156
- server.tool("quick_think", "**Cognitive Checkpoint & Concise Drafter.** Use for simple confirmations OR efficient **Chain of Draft (CoD)** reasoning where detailed analysis via `think` is unnecessary. CoD focuses on minimal, essential steps (~5 words, equations) for speed and token efficiency. Use ONLY when full deliberation is excessive (verified Low CUC-N or targeted CoD).", {
157
- brief_thought: z.string().describe("Your **concise** input. For confirmations: State observation/action & confirm triviality. For CoD: Provide the minimal draft step (essential info, ~5 words, equation, etc.), explaining why detailed analysis via 'think' isn't needed for *this specific step*.")
157
+ server.tool("quick_think", "**INTERNAL Use Only. Trivial Confirmation Checkpoint.** Use EXTREMELY SPARINGLY, ONLY for acknowledging trivial success when explicitly permitted by prior 'assess_cuc_n_mode' (Low CUC-N). Any analysis requires 'think'.", {
158
+ brief_thought: z.string().min(1, "Brief thought cannot be empty.")
159
+ .max(200, "Brief thought should be concise (max 200 chars). Use 'think' for detail.") // Add max length
160
+ .describe("Your **concise internal** confirmation for a verified trivial step (e.g., 'Acknowledged trivial success: file read OK.'). Use ONLY when full deliberation via 'think' is explicitly unnecessary per assessment.")
158
161
  }, async ({ brief_thought }) => {
159
162
  const toolName = 'quick_think';
160
163
  logToolCall(toolName);
161
164
  try {
162
- // Basic Zod validation ensures it's a non-empty string. Content validation removed.
163
- if (brief_thought.trim().length === 0) {
164
- throw new Error('Invalid brief_thought: Must be a non-empty string.');
165
- }
166
- logToolResult(toolName, true, `Logged: ${brief_thought.substring(0, 80)}...`);
167
- // Log full input for traceability
168
- console.error(`[${new Date().toISOString()}] [MCP Server] - ${toolName} Input:\n${brief_thought}`);
169
- // Return the brief thought text, now without markdown wrappers
165
+ // Zod validation handles non-empty and max length
166
+ logToolResult(toolName, true, `Internal brief thought logged: ${brief_thought.substring(0, 80)}...`);
167
+ console.error(`[${new Date().toISOString()}] [MCP Server - INTERNAL] - ${toolName} Input:\n${brief_thought}`);
168
+ // Return the brief thought text as a log entry
170
169
  return {
171
170
  content: [{
172
171
  type: "text",
173
- text: brief_thought // Removed wrappers
172
+ text: `Internal Quick Thought Logged:\n---\n${brief_thought}` // Added prefix
174
173
  }]
175
174
  };
176
175
  }
@@ -178,21 +177,19 @@ server.tool("quick_think", "**Cognitive Checkpoint & Concise Drafter.** Use for
178
177
  return logToolError(toolName, error);
179
178
  }
180
179
  });
181
- // --- REMOVED chain_of_thought Tool ---
182
- // --- REMOVED chain_of_draft Tool ---
183
- // --- Server Lifecycle and Error Handling ---
180
+ // --- Server Lifecycle and Error Handling --- (Keep existing shutdown, uncaughtException, unhandledRejection)
184
181
  /**
185
182
  * Gracefully shuts down the server.
186
183
  */
187
184
  async function shutdown() {
188
- console.error('\n[MCP Server] Shutting down gracefully...');
185
+ console.error('\n[MCP Server - INTERNAL] Shutting down gracefully...');
189
186
  try {
190
187
  await server.close();
191
- console.error('[MCP Server] Server closed.');
188
+ console.error('[MCP Server - INTERNAL] Server closed.');
192
189
  process.exit(0);
193
190
  }
194
191
  catch (err) {
195
- console.error('[MCP Server] Error during shutdown:', err);
192
+ console.error('[MCP Server - INTERNAL] Error during shutdown:', err);
196
193
  process.exit(1);
197
194
  }
198
195
  }
@@ -200,19 +197,17 @@ process.on('SIGINT', shutdown);
200
197
  process.on('SIGTERM', shutdown);
201
198
  process.on('uncaughtException', (error, origin) => {
202
199
  const timestamp = new Date().toISOString();
203
- console.error(`[${timestamp}] [MCP Server] FATAL: Uncaught Exception at: ${origin}`, error);
204
- // Attempt graceful shutdown, but exit quickly if it fails
200
+ console.error(`[${timestamp}] [MCP Server - INTERNAL] FATAL: Uncaught Exception at: ${origin}`, error);
205
201
  shutdown().catch(() => process.exit(1));
206
202
  });
207
203
  process.on('unhandledRejection', (reason, promise) => {
208
204
  const timestamp = new Date().toISOString();
209
- console.error(`[${timestamp}] [MCP Server] FATAL: Unhandled Promise Rejection:`, reason);
210
- // Attempt graceful shutdown, but exit quickly if it fails
205
+ console.error(`[${timestamp}] [MCP Server - INTERNAL] FATAL: Unhandled Promise Rejection:`, reason);
211
206
  shutdown().catch(() => process.exit(1));
212
207
  });
213
208
  // --- Start the Server ---
214
209
  /**
215
- * Initializes and starts the MCP server.
210
+ * Initializes and starts the MCP server for INTERNAL cognitive tools.
216
211
  */
217
212
  async function main() {
218
213
  try {
@@ -221,13 +216,13 @@ async function main() {
221
216
  const border = '-----------------------------------------------------';
222
217
  console.error(border);
223
218
  console.error(` ${serverInfo.description}`);
224
- // Version logging removed from startup message
225
- console.error(' Status: Running on stdio, awaiting MCP requests...');
219
+ console.error(` Version: ${serverInfo.version}`);
220
+ console.error(' Status: Running on stdio, awaiting INTERNAL MCP requests...');
226
221
  console.error(border);
227
222
  }
228
223
  catch (error) {
229
224
  const timestamp = new Date().toISOString();
230
- console.error(`[${timestamp}] [MCP Server] Fatal error during startup:`, error);
225
+ console.error(`[${timestamp}] [MCP Server - INTERNAL] Fatal error during startup:`, error);
231
226
  process.exit(1);
232
227
  }
233
228
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nbiish/cognitive-tools-mcp",
3
- "version": "0.9.27",
3
+ "version": "0.9.29",
4
4
  "description": "Cognitive Tools MCP: SOTA reasoning suite focused on iterative refinement and tool integration for AI Pair Programming. Enables structured, iterative problem-solving through Chain of Draft methodology, with tools for draft generation, analysis, and refinement. Features advanced deliberation (`think`), rapid checks (`quick_think`), mandatory complexity assessment & thought mode selection (`assess_cuc_n_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",