@nbiish/cognitive-tools-mcp 2.0.21 → 2.0.25

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 CHANGED
@@ -53,7 +53,7 @@ This project is licensed under the [COMPREHENSIVE RESTRICTED USE LICENSE FOR IND
53
53
  ◈──◆──◇─────────────────────────────────────────────────◇──◆──◈
54
54
  </div>
55
55
 
56
- ᑭᑫᓐᑖᓱᐎᓐ ᐋᐸᒋᒋᑲᓇᓐ - Agentic Cognitive Tools (v2.0.17): Implements Gikendaasowin v7 Guidelines. Enforces MANDATORY internal **Observe-Orient-Reason-Decide-Act (OOReDAct)** cycle: Starts with 'assess_and_orient', continues with 'think' deliberation before actions. Guides adaptive reasoning (**Chain-of-Thought (CoT)**, **Chain-of-Draft/Condensed Reasoning (CoD/CR)**, **Structured Chain-of-Thought (SCoT)**) & CodeAct preference. Returns Markdown. *(Note: The integration prompt and operational guidelines detailed in [`latest.md`](latest.md) are also covered by the [project LICENSE](LICENSE).)*
56
+ ᑭᑫᓐᑖᓱᐎᓐ ᐋᐸᒋᒋᑲᓇᓐ - Agentic Cognitive Tools (v2.0.24): Implements Gikendaasowin v7 Guidelines. Enforces 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. *(Note: The integration prompt and operational guidelines detailed in [`latest.md`](latest.md) are also covered by the [project LICENSE](LICENSE).)*
57
57
 
58
58
  Known as:
59
59
  - Anishinaabemowin: [`@nbiish/gikendaasowin-aabajichiganan-mcp`](https://www.npmjs.com/package/@nbiish/gikendaasowin-aabajichiganan-mcp)
@@ -62,6 +62,7 @@ Known as:
62
62
  Both packages are maintained in parallel and receive the same updates. You can use either package name in your projects - they provide identical functionality.
63
63
 
64
64
  **◇ Recent Updates ◇**
65
+ - **◇ v2.0.24 ◇** Fixed MCP server tool registration format - corrected from incorrect `server.tool(name, description, schema.shape, handler)` to proper `server.tool(name, schema, handler)` format. Updated comprehensive tool documentation and version synchronization.
65
66
  - **◇ v2.0.17 ◇** Applied Anishinaabe-Cyberpunk styling and updated pre-publish workflow.
66
67
  - **◇ v2.0.16 ◇** Minor fixes and build process updates.
67
68
  - **◇ v2.0.15 ◇** Updated Zod schema usage in `server.tool` to fix type error and rebuilt.
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,73 @@ 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
- * 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.
87
- * Input: An object containing the stage and corresponding cognitive content.
88
- * Output: The provided content, returned verbatim.
80
+ *
81
+ * **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.
82
+ *
83
+ * **Stages & Cognitive Techniques:**
84
+ *
85
+ * * **`stage: "orient"` (OOReDAct: Observe & Orient - MANDATORY START):**
86
+ * * **Purpose:** At the absolute beginning of ANY new task, sub-task, or significant strategic pivot, you MUST use this stage.
87
+ * * **Content Requirements:** Perform a comprehensive initial assessment:
88
+ * 1. **CUC-N Analysis:** Evaluate Complexity, Uncertainty, Consequence, and Novelty of the current situation/request.
89
+ * 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).
90
+ * 3. **Initial Hypothesis Formulation:** Based on the CUC-N and information assessment, formulate initial hypotheses or potential approaches.
91
+ * 4. **Goal Clarification:** Clearly define the immediate objective for this phase of deliberation.
92
+ * * This stage establishes critical context and grounds all subsequent reasoning.
93
+ *
94
+ * * **`stage: "reason"` (OOReDAct: Reason & Decide - MANDATORY DELIBERATION):**
95
+ * * **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.
96
+ * * **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:
97
+ * 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.
98
+ * 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.
99
+ * 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.
100
+ * 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.
101
+ * 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.
102
+ * 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.
103
+ * 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.
104
+ *
105
+ * * **`stage: "sandbox"` (OOReDAct: Decide & Pre-Act Simulation - MANDATORY PRE-ACTION):**
106
+ * * **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.
107
+ * * **Content Requirements:** Detail your simulation, including:
108
+ * 1. **Hypothesis Testing:** Test the chosen plan/action against constraints, goals, and potential edge cases.
109
+ * 2. **Pre-Mortem Analysis:** Briefly consider potential failure modes of your intended action/response and how they might be mitigated.
110
+ * 3. **Confidence Scoring & Justification:** State your confidence level in the proposed action/response and briefly justify it based on the deliberation and sandbox simulation.
111
+ * 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.
112
+ *
113
+ * * **`stage: "acknowledge"` (OOReDAct: Act - LIMITED USE):**
114
+ * * **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.
115
+ * * **This stage DOES NOT substitute for a full `reason` or `sandbox` cycle when new information is processed or a non-trivial decision is made.**
116
+ *
117
+ * **General Directives:**
118
+ * * This `deliberate` tool acts as a passthrough; your `content` is returned verbatim for your own verification and state tracking.
119
+ * * The choice of reasoning strategy within the `reason` stage should be dynamic and justified by the task's specific demands.
120
+ * * Strict adherence to this structured deliberation protocol is essential for robust, verifiable, and adaptive agent performance.
121
+ * 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).
89
122
  */
90
- 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.")
95
- }).shape, async ({ stage, content }) => {
123
+ server.tool("deliberate", {
124
+ stage: z.enum(["orient", "reason", "acknowledge", "sandbox"]).describe("The current stage of the OOReDAct cognitive process."),
125
+ 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.")
126
+ }, async ({ stage, content }) => {
96
127
  const toolName = 'deliberate';
97
128
  logToolCall(toolName, `Stage: ${stage}`);
98
129
  try {
99
130
  // Treat input as opaque string for the specified stage
131
+ // The detailed guidance on how to structure this string is in the tool description.
100
132
  logToolResult(toolName, true, `Stage: ${stage}, Input received (length: ${content.length})`);
101
- // Log the raw input string with stage context
133
+ // Log the raw input string with stage context for server-side auditing
102
134
  console.error(`[${new Date().toISOString()}] [MCP Server] - ${toolName} (${stage}) Input String:\n${content}`);
103
- // Return the input string directly
135
+ // Return the input string directly, as per passthrough design
104
136
  return { content: [{ type: "text", text: content }] };
105
137
  }
106
138
  catch (error) {
107
- // Catch only unexpected runtime errors
139
+ // Catch only unexpected runtime errors within this passthrough logic
108
140
  return logToolError(toolName, error);
109
141
  }
110
142
  });
111
- // --- Server Lifecycle and Error Handling (Internal - No changes needed) ---
143
+ // --- Server Lifecycle and Error Handling (Internal - No changes needed as per user comments) ---
112
144
  /**
113
145
  * Gracefully shuts down the server.
114
146
  */
@@ -131,14 +163,14 @@ process.on('SIGTERM', shutdown);
131
163
  process.on('uncaughtException', (error, origin) => {
132
164
  const timestamp = new Date().toISOString();
133
165
  console.error(`[${timestamp}] [MCP Server] FATAL: Uncaught Exception at: ${origin}`, error);
134
- shutdown().catch(() => process.exit(1));
166
+ shutdown().catch(() => process.exit(1)); // Attempt graceful shutdown, then force exit
135
167
  });
136
168
  process.on('unhandledRejection', (reason, promise) => {
137
169
  const timestamp = new Date().toISOString();
138
170
  console.error(`[${timestamp}] [MCP Server] FATAL: Unhandled Promise Rejection:`, reason);
139
- shutdown().catch(() => process.exit(1));
171
+ shutdown().catch(() => process.exit(1)); // Attempt graceful shutdown, then force exit
140
172
  });
141
- // --- Start the Server (Internal - No changes needed) ---
173
+ // --- Start the Server (Internal - No changes needed as per user comments) ---
142
174
  /**
143
175
  * Initializes and starts the MCP server.
144
176
  */
@@ -146,11 +178,11 @@ async function main() {
146
178
  try {
147
179
  const transport = new StdioServerTransport();
148
180
  await server.connect(transport);
149
- const border = '=====================================================';
181
+ const border = '======================================================================'; // Adjusted border for new desc length
150
182
  console.error(border);
151
183
  console.error(` ${serverInfo.description}`); // Uses updated description
152
184
  console.error(` Version: ${serverInfo.version}`);
153
- console.error(` Enforcing Gikendaasowin v7 Guidelines with Unified 'deliberate' Tool`);
185
+ console.error(` Enforcing Gikendaasowin v7 Guidelines with Enhanced Unified 'deliberate' Tool`);
154
186
  console.error(' Status: Running on stdio, awaiting MCP requests...');
155
187
  console.error(border);
156
188
  }
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.25",
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",