@nbiish/cognitive-tools-mcp 2.0.21 → 2.0.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/build/index.js +78 -41
  2. package/package.json +1 -1
package/build/index.js CHANGED
@@ -1,25 +1,27 @@
1
1
  #!/usr/bin/env node
2
2
  /**
3
3
  * -----------------------------------------------------------------------------
4
- * Gikendaasowin Aabajichiganan - Agentic Cognitive Tools MCP Server (v3.4)
4
+ * Gikendaasowin Aabajichiganan - Advanced Agentic Cognitive Orchestration MCP Server (v3.5)
5
5
  *
6
6
  * Description: Provides cognitive tools implementing the Gikendaasowin v7
7
7
  * Agentic Operational Guidelines. Enforces a mandatory structured
8
8
  * deliberation cycle, **Observe-Orient-Reason-Decide-Act (OOReDAct)**, via
9
- * internal cognitive steps, initiated by mandatory assessment/orientation.
10
- * Guides adaptive reasoning using techniques like **Chain-of-Thought (CoT)**,
11
- * **Chain-of-Draft/Condensed Reasoning (CoD/CR)**, and **Structured
12
- * Chain-of-Thought (SCoT)**. Aligns with dynamic tool environments,
13
- * including CodeAct preference. Returns Markdown.
9
+ * the unified 'deliberate' tool. This tool guides the LLM through sophisticated
10
+ * cognitive orchestration, including CUC-N assessment, knowledge gap
11
+ * identification, advanced reasoning (CoT, PS, SCoT, CoD/CR), self-critique
12
+ * elements, and pre-action sandbox simulation. Aligns with dynamic tool
13
+ * environments, including CodeAct preference. Returns Markdown.
14
14
  *
15
- * v3.4 Enhancements:
16
- * - Enhanced the description of the `deliberate` tool to be expertly verbose,
17
- * explaining the prompting techniques (CoT, CoD/CR, SCoT) before using acronyms,
18
- * drawing from the provided research context for professional precision.
15
+ * v3.5 Enhancements:
16
+ * - Updated server version to 3.5.0.
17
+ * - Enhanced `serverInfo.description` to reflect broader cognitive strategies.
18
+ * - Significantly expanded the `deliberate` tool's description to provide
19
+ * expertly verbose and detailed guidance on applying advanced cognitive
20
+ * techniques (PS, Self-Refine/ToT spirit, PoT/PAL identification)
21
+ * within the OOReDAct stages, drawing heavily from advanced prompting research.
19
22
  * - Maintained tooling compression, internal system prompt framing, and
20
- * expanded cognitive technique acronyms (with explanations on first use in
21
- * the main server description).
22
- * - Simplified error reporting.
23
+ * passthrough nature of the 'deliberate' tool.
24
+ * - Simplified error reporting remains.
23
25
  * -----------------------------------------------------------------------------
24
26
  */
25
27
  import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
@@ -27,13 +29,13 @@ import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js"
27
29
  import { z } from "zod";
28
30
  // --- Server Definition ---
29
31
  const serverInfo = {
30
- name: "gikendaasowin-agentic-cognitive-tools-mcp",
31
- version: "3.4.0", // Version reflects enhanced tool description verbosity
32
- // Updated description with consolidated tooling and expanded acronyms
33
- description: `ᑭᑫᓐᑖᓱᐎᓐ ᐋᐸᒋᒋᑲᓇᓐ - Agentic Cognitive Tools (v3.4): Implements Gikendaasowin v7 Guidelines. Enforces MANDATORY internal **Observe-Orient-Reason-Decide-Act (OOReDAct)** cycle using the unified 'deliberate' tool. Starts with initial assessment/orientation, continues with structured deliberation and mandatory mental sandbox logging before actions. Guides adaptive reasoning (**Chain-of-Thought (CoT)**: step-by-step natural language reasoning; **Chain-of-Draft/Condensed Reasoning (CoD/CR)**: iterative refinement/concise steps; **Structured Chain-of-Thought (SCoT)**: reasoning incorporating program structures/plans) & CodeAct preference. Returns Markdown.`
32
+ name: "gikendaasowin-aabajichiganan-mcp",
33
+ version: "3.5.0", // Version reflects significantly enhanced cognitive guidance
34
+ // Updated description with consolidated tooling and expanded cognitive technique guidance
35
+ description: `ᑭᑫᓐᑖᓱᐎᓐ ᐋᐸᒋᒋᑲᓇᓐ - Advanced Agentic Cognitive Orchestration MCP (v3.5): Implements Gikendaasowin v7 Guidelines. Enforces a MANDATORY internal **Observe-Orient-Reason-Decide-Act (OOReDAct)** cycle via the unified 'deliberate' tool. This tool guides the LLM through sophisticated cognitive orchestration, including: initial CUC-N assessment and orientation; structured deliberation using advanced reasoning strategies such as **Chain-of-Thought (CoT)** (sequential reasoning), **Plan-and-Solve (PS)** (task decomposition and execution), **Chain-of-Draft/Condensed Reasoning (CoD/CR)** (iterative refinement), and **Structured Chain-of-Thought (SCoT)** (integrating programmatic or plan-based structures); and mandatory mental sandbox simulation with elements of self-critique before action. Emphasizes CodeAct preference for external tasks and returns Markdown.`
34
36
  };
35
37
  const server = new McpServer(serverInfo);
36
- // --- Logging Helpers (Internal - No changes needed) ---
38
+ // --- Logging Helpers (Internal - No changes needed as per user comments) ---
37
39
  /**
38
40
  * Logs an incoming tool call to stderr.
39
41
  * @param toolName The name of the tool being called.
@@ -72,43 +74,78 @@ function logToolError(toolName, error) {
72
74
  }]
73
75
  };
74
76
  }
75
- // --- Consolidated Cognitive Deliberation & Refinement Step (v3.4) ---
77
+ // --- Consolidated Cognitive Deliberation & Refinement Step (v3.5) ---
76
78
  /**
77
79
  * Tool: deliberate (Unified Cognitive Process)
78
80
  * Purpose: The **REQUIRED & CENTRAL cognitive process** for the **MANDATORY** structured deliberation cycle
79
- * (**Observe-Orient-Reason-Decide-Act (OOReDAct)**). This tool consolidates the functionality of
80
- * `assess_and_orient`, `think`, `quick_think`, and `mental_sandbox` into a single, flexible interface.
81
- * Workflow: **You MUST use this tool** for:
82
- * 1. Initial assessment and orientation (`stage: "orient"`).
83
- * 2. Full, structured OOReDAct deliberation after receiving new information or before non-trivial actions (`stage: "reason"`).
84
- * 3. Brief cognitive acknowledgement of simple, expected outcomes (`stage: "acknowledge"`).
85
- * 4. Logging the mandatory mental sandbox simulation before actions (`stage: "sandbox"`).
86
- * Adapt your reasoning style within the 'Reason' stage using techniques like Chain-of-Thought, Chain-of-Draft/Condensed Reasoning, or Structured Chain-of-Thought.
81
+ * (**Observe-Orient-Reason-Decide-Act (OOReDAct)**). This tool consolidates all internal cognitive steps.
82
+ * Workflow: **You MUST use this tool** for all stages of OOReDAct.
87
83
  * Input: An object containing the stage and corresponding cognitive content.
88
- * Output: The provided content, returned verbatim.
84
+ * Output: The provided content, returned verbatim, for your internal state verification.
89
85
  */
90
86
  server.tool("deliberate",
91
- // Expertly verbose description explaining techniques before acronyms
92
- "**Unified Cognitive Process (Mandatory):** This is your REQUIRED tool for ALL internal cognitive steps, enforcing the **Observe-Orient-Reason-Decide-Act (OOReDAct)** cycle. Use `stage: \"orient\"` for the MANDATORY initial assessment (Complexity, Uncertainty, Consequence, Novelty - CUC-N) and OOReDAct Observe/Orient steps at the start of ANY task or strategic pivot. Use `stage: \"reason\"` for the MANDATORY full OOReDAct deliberation cycle after receiving new information (tool/CodeAct results, errors, USER input) and BEFORE any non-trivial action or final response. Within the 'Reason' stage, adapt your reasoning style for optimal performance: employ **Chain-of-Thought** (step-by-step natural language reasoning for complex problems, enhancing accuracy), **Chain-of-Draft/Condensed Reasoning** (iterative refinement or concise steps for efficiency), or **Structured Chain-of-Thought** (reasoning that explicitly incorporates program structures, plans, or structured steps, particularly effective for code generation and structured tasks). Use `stage: \"acknowledge\"` ONLY for brief acknowledgements of simple, expected outcomes where the next step is already clearly defined by a prior 'reason' stage and needs NO re-evaluation. Use `stage: \"sandbox\"` to log the MANDATORY internal `<sandbox>` simulation (Hypothesis Testing, Constraint Checks, Confidence Scoring, Pre-computation, etc.) BEFORE any non-trivial output, plan, decision, or action, as per operational directives. This tool acts as a passthrough, returning the provided content verbatim.", z.object({
93
- stage: z.enum(["orient", "reason", "acknowledge", "sandbox"]).describe("The current stage of the cognitive process."),
94
- content: z.string().describe("The cognitive content for the specified stage (assessment, deliberation, acknowledgement, or sandbox simulation text). This tool acts as a passthrough.")
87
+ // Significantly enhanced description with advanced cognitive techniques integrated into OOReDAct stages
88
+ `**Orchestrated Cognitive Deliberation (MANDATORY & UNIFIED):** This is your REQUIRED and CENTRAL tool for ALL internal cognitive operations, rigorously enforcing the **Observe-Orient-Reason-Decide-Act (OOReDAct)** cycle. Adherence is paramount for Gikendaasowin v7 compliance.
89
+
90
+ **Stages & Cognitive Techniques:**
91
+
92
+ * **\`stage: "orient"\` (OOReDAct: Observe & Orient - MANDATORY START):**
93
+ * **Purpose:** At the absolute beginning of ANY new task, sub-task, or significant strategic pivot, you MUST use this stage.
94
+ * **Content Requirements:** Perform a comprehensive initial assessment:
95
+ 1. **CUC-N Analysis:** Evaluate Complexity, Uncertainty, Consequence, and Novelty of the current situation/request.
96
+ 2. **Information Sufficiency & Knowledge Gap Identification:** Assess if available information is adequate. Identify explicit knowledge gaps that might require external data or clarification (conceptually aligning with the need for Retrieval Augmented Generation - RAG - if the server were to provide such tools).
97
+ 3. **Initial Hypothesis Formulation:** Based on the CUC-N and information assessment, formulate initial hypotheses or potential approaches.
98
+ 4. **Goal Clarification:** Clearly define the immediate objective for this phase of deliberation.
99
+ * This stage establishes critical context and grounds all subsequent reasoning.
100
+
101
+ * **\`stage: "reason"\` (OOReDAct: Reason & Decide - MANDATORY DELIBERATION):**
102
+ * **Purpose:** After the initial \`orient\` stage, and CRITICALLY after receiving ANY new information (tool results, CodeAct outputs/errors, user input, file contents, etc.), and BEFORE any non-trivial action, decision, or final response, you MUST use this stage for full, structured deliberation.
103
+ * **Content Requirements - Adaptive Reasoning Strategies:** Within your \`content\` for this stage, clearly articulate your reasoning process using one or more of the following, selecting the most appropriate for the sub-task's nature:
104
+ 1. **Chain-of-Thought (CoT):** For problems requiring detailed, sequential natural language reasoning. Break down the problem into explicit intermediate steps. Explain your logic at each step to ensure clarity and verifiability.
105
+ 2. **Plan-and-Solve (PS) Prompting:** For complex tasks, first devise a multi-step plan (decompose the main task into smaller, ordered sub-tasks). Then, articulate the execution of each sub-task according to the plan. This is often preferred for structured problem-solving.
106
+ 3. **Structured Chain-of-Thought (SCoT):** When the problem involves code generation, algorithmic thinking, or highly structured outputs, explicitly incorporate program structures (sequences, branches, loops), data schemas, or formal plan outlines into your reasoning steps.
107
+ 4. **Chain-of-Draft/Condensed Reasoning (CoD/CR):** For iterative refinement or when a full CoT/PS is too verbose for a simpler sub-problem (that still requires thought), generate a concise draft of reasoning, then critically review and condense it, or iterate through drafts if necessary.
108
+ 5. **Critical Evaluation & Refinement (Self-Refine Spirit):** Throughout your reasoning, pause to critically evaluate your own intermediate conclusions or plans. Identify potential flaws, biases, or areas for improvement and articulate these refinements.
109
+ 6. **(For Highly Complex/Ambiguous Scenarios - Tree of Thoughts (ToT) Spirit):** If faced with significant ambiguity or multiple viable solution paths, briefly outline alternative lines of reasoning and justify your chosen path or why others were discarded. This involves exploring diverse solution pathways and evaluating them.
110
+ 7. **Computational Offloading Identification (Program of Thoughts (PoT)/Program-aided Language Models (PAL) Spirit):** If your reasoning identifies steps that require precise calculation or complex symbolic manipulation beyond reliable LLM capabilities, explicitly note these as candidates for potential offloading to a dedicated computational tool if such a tool were available/invoked subsequently.
111
+
112
+ * **\`stage: "sandbox"\` (OOReDAct: Decide & Pre-Act Simulation - MANDATORY PRE-ACTION):**
113
+ * **Purpose:** BEFORE committing to any non-trivial output (including final responses, plans, or CodeAct generation), you MUST use this stage to log your internal mental sandbox simulation.
114
+ * **Content Requirements:** Detail your simulation, including:
115
+ 1. **Hypothesis Testing:** Test the chosen plan/action against constraints, goals, and potential edge cases.
116
+ 2. **Pre-Mortem Analysis:** Briefly consider potential failure modes of your intended action/response and how they might be mitigated.
117
+ 3. **Confidence Scoring & Justification:** State your confidence level in the proposed action/response and briefly justify it based on the deliberation and sandbox simulation.
118
+ 4. **Parameter/Code Dry Run (if applicable):** If preparing for CodeAct or a tool call with parameters, mentally (or by outlining) "dry run" the core logic.
119
+
120
+ * **\`stage: "acknowledge"\` (OOReDAct: Act - LIMITED USE):**
121
+ * **Purpose:** Use this stage **SPARINGLY**. It is ONLY for brief, verbatim acknowledgements of simple, expected, and non-problematic outcomes from a *prior* step (e.g., "System status confirmed normal, proceeding with previously reasoned backup sequence.") where the next action is *already unequivocally defined* by a comprehensive preceding \`reason\` and \`sandbox\` stage and requires NO further evaluation or adaptation.
122
+ * **This stage DOES NOT substitute for a full \`reason\` or \`sandbox\` cycle when new information is processed or a non-trivial decision is made.**
123
+
124
+ **General Directives:**
125
+ * This \`deliberate\` tool acts as a passthrough; your \`content\` is returned verbatim for your own verification and state tracking.
126
+ * The choice of reasoning strategy within the \`reason\` stage should be dynamic and justified by the task's specific demands.
127
+ * Strict adherence to this structured deliberation protocol is essential for robust, verifiable, and adaptive agent performance.
128
+ Acronym Key: CUC-N (Complexity, Uncertainty, Consequence, Novelty), CoT (Chain-of-Thought), PS (Plan-and-Solve), SCoT (Structured Chain-of-Thought), CoD/CR (Chain-of-Draft/Condensed Reasoning), RAG (Retrieval Augmented Generation), ToT (Tree of Thoughts), PoT (Program of Thoughts), PAL (Program-aided Language Models).`, z.object({
129
+ stage: z.enum(["orient", "reason", "acknowledge", "sandbox"]).describe("The current stage of the OOReDAct cognitive process."),
130
+ content: z.string().describe("The detailed cognitive content for the specified stage (e.g., CUC-N assessment, CoT reasoning, PS plan, sandbox simulation text). This tool acts as a passthrough, returning your content verbatim.")
95
131
  }).shape, async ({ stage, content }) => {
96
132
  const toolName = 'deliberate';
97
133
  logToolCall(toolName, `Stage: ${stage}`);
98
134
  try {
99
135
  // Treat input as opaque string for the specified stage
136
+ // The detailed guidance on how to structure this string is in the tool description.
100
137
  logToolResult(toolName, true, `Stage: ${stage}, Input received (length: ${content.length})`);
101
- // Log the raw input string with stage context
138
+ // Log the raw input string with stage context for server-side auditing
102
139
  console.error(`[${new Date().toISOString()}] [MCP Server] - ${toolName} (${stage}) Input String:\n${content}`);
103
- // Return the input string directly
140
+ // Return the input string directly, as per passthrough design
104
141
  return { content: [{ type: "text", text: content }] };
105
142
  }
106
143
  catch (error) {
107
- // Catch only unexpected runtime errors
144
+ // Catch only unexpected runtime errors within this passthrough logic
108
145
  return logToolError(toolName, error);
109
146
  }
110
147
  });
111
- // --- Server Lifecycle and Error Handling (Internal - No changes needed) ---
148
+ // --- Server Lifecycle and Error Handling (Internal - No changes needed as per user comments) ---
112
149
  /**
113
150
  * Gracefully shuts down the server.
114
151
  */
@@ -131,14 +168,14 @@ process.on('SIGTERM', shutdown);
131
168
  process.on('uncaughtException', (error, origin) => {
132
169
  const timestamp = new Date().toISOString();
133
170
  console.error(`[${timestamp}] [MCP Server] FATAL: Uncaught Exception at: ${origin}`, error);
134
- shutdown().catch(() => process.exit(1));
171
+ shutdown().catch(() => process.exit(1)); // Attempt graceful shutdown, then force exit
135
172
  });
136
173
  process.on('unhandledRejection', (reason, promise) => {
137
174
  const timestamp = new Date().toISOString();
138
175
  console.error(`[${timestamp}] [MCP Server] FATAL: Unhandled Promise Rejection:`, reason);
139
- shutdown().catch(() => process.exit(1));
176
+ shutdown().catch(() => process.exit(1)); // Attempt graceful shutdown, then force exit
140
177
  });
141
- // --- Start the Server (Internal - No changes needed) ---
178
+ // --- Start the Server (Internal - No changes needed as per user comments) ---
142
179
  /**
143
180
  * Initializes and starts the MCP server.
144
181
  */
@@ -146,11 +183,11 @@ async function main() {
146
183
  try {
147
184
  const transport = new StdioServerTransport();
148
185
  await server.connect(transport);
149
- const border = '=====================================================';
186
+ const border = '======================================================================'; // Adjusted border for new desc length
150
187
  console.error(border);
151
188
  console.error(` ${serverInfo.description}`); // Uses updated description
152
189
  console.error(` Version: ${serverInfo.version}`);
153
- console.error(` Enforcing Gikendaasowin v7 Guidelines with Unified 'deliberate' Tool`);
190
+ console.error(` Enforcing Gikendaasowin v7 Guidelines with Enhanced Unified 'deliberate' Tool`);
154
191
  console.error(' Status: Running on stdio, awaiting MCP requests...');
155
192
  console.error(border);
156
193
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nbiish/cognitive-tools-mcp",
3
- "version": "2.0.21",
3
+ "version": "2.0.23",
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",