@nbiish/cognitive-tools-mcp 2.0.3 → 2.0.7

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 (3) hide show
  1. package/README.md +13 -1
  2. package/build/index.js +74 -41
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -34,7 +34,7 @@ Copyright © 2025 ᓂᐲᔥ ᐙᐸᓂᒥᑮ-ᑭᓇᐙᐸᑭᓯ (Nbiish Waabanimi
34
34
 
35
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
- ᑭᑫᓐᑖᓱᐎᓐ ᐋᐸᒋᒋᑲᓇᓐ - Agentic Cognitive Tools (v3.2): 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.
37
+ ᑭᑫᓐᑖᓱᐎᓐ ᐋᐸᒋᒋᑲᓇᓐ - Agentic Cognitive Tools (v3.2.1 / pkg v2.0.6): 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.
38
38
 
39
39
  Known as:
40
40
  - Anishinaabemowin: [`@nbiish/gikendaasowin-aabajichiganan-mcp`](https://www.npmjs.com/package/@nbiish/gikendaasowin-aabajichiganan-mcp)
@@ -43,6 +43,8 @@ Known as:
43
43
  Both packages are maintained in parallel and receive the same updates. You can use either package name in your projects - they provide identical functionality.
44
44
 
45
45
  **Recent Updates:**
46
+ - v2.0.6: Added `mental_sandbox` tool for logging internal cognitive simulations.
47
+ - v2.0.6: Removed prefixing from cognitive tool outputs to ensure verbatim logging.
46
48
  - Resolved TypeScript compilation errors related to MCP SDK types and server configuration.
47
49
  - Ensured successful build process.
48
50
 
@@ -257,6 +259,16 @@ npm run inspector
257
259
  }
258
260
  ```
259
261
 
262
+ #### `mental_sandbox` Example
263
+ ```json
264
+ {
265
+ "toolName": "mental_sandbox",
266
+ "arguments": {
267
+ "sandbox_content": "<sandbox>\n## Hypothesis Generation & Testing\n<hypotheses>\n1. Explain 'Debwewin' (Truth) directly using Seven Grandfather Teachings context.\n2. Compare 'Debwewin' to Western concepts of truth, highlighting differences.\n</hypotheses>\n<evaluation>\nHypothesis 1: High alignment with Anishinaabe worldview, promotes understanding within cultural context. Medium complexity.\nHypothesis 2: Risks misinterpretation or oversimplification, potentially reinforces colonial framing. High complexity.\n</evaluation>\n## Constraint Checklist\n<constraint_check>\n1. Cultural Sensitivity: Pass (Hypothesis 1 focuses on internal context).\n2. Accuracy: Pass (Based on teachings).\n3. Clarity for User: Pass (Needs careful wording).\n</constraint_check>\n## Confidence Score\n<confidence>High (for Hypothesis 1)</confidence>\n## Pre-computational Analysis\n<pre_computation>\nSimulating Hypothesis 1: Leads to explanation focused on honesty, integrity, speaking from the heart. Positive impact on understanding Anishinaabe values.\nSimulating Hypothesis 2: Leads to potentially complex, potentially problematic comparative analysis. Risk of inaccuracy.\n</pre_computation>\n</sandbox>"
268
+ }
269
+ }
270
+ ```
271
+
260
272
  #### `chain_of_thought` Example
261
273
  ```json
262
274
  {
package/build/index.js CHANGED
@@ -61,11 +61,12 @@ function logToolError(toolName, error) {
61
61
  const errorMessage = error instanceof Error ? error.message : String(error);
62
62
  console.error(`[${timestamp}] [MCP Server] ! Tool Error: ${toolName} - ${errorMessage}`);
63
63
  logToolResult(toolName, false, errorMessage); // Log failure result as well
64
- // **Refined Error Guidance:** Expanded acronyms on first mention here.
64
+ // **Simplified Error Reporting:** Return only the core error message.
65
65
  return {
66
66
  content: [{
67
67
  type: "text",
68
- text: `**INTERNAL ERROR during '${toolName}':** ${errorMessage}\n\n**CORRECTIVE ACTION REQUIRED:** You MUST now perform the full **Observe-Orient-Reason-Decide-Act (OOReDAct)** deliberation cycle to address this error. Structure your thinking with: 1. **Observe** this error message. 2. **Orient** by analyzing the error in context of the goal and previous steps. 3. **Reason** about potential causes and solutions (use adaptive reasoning: **Chain-of-Thought (CoT)** for detailed steps, **Chain-of-Draft/Condensed Reasoning (CoD/CR)** for efficient summaries, or **Structured Chain-of-Thought (SCoT)** for plans/code, as appropriate). 4. **Decide** on the *single best* corrective action (e.g., retry, modify parameters, use different tool/CodeAct, ask USER). 5. **Act(Plan)** the exact parameters or code for the correction. 6. Define **Verification** and **Risk/Contingency**.`
68
+ // Simpler error message, removing corrective action guidance.
69
+ text: `**TOOL EXECUTION ERROR in '${toolName}':** ${errorMessage}`
69
70
  }]
70
71
  };
71
72
  }
@@ -77,27 +78,29 @@ function logToolError(toolName, error) {
77
78
  * and performing the initial Observe/Orient steps of the **Observe-Orient-Reason-Decide-Act (OOReDAct)** cycle.
78
79
  * Workflow: **Perform this step** at the beginning of processing a user request or when changing overall approach.
79
80
  * Its output informs the *first* full OOReDAct cycle (`think` step).
80
- * Output: The assessment and initial orientation text formatted as Markdown.
81
+ * Input: A single string provided by the LLM (treated as opaque data).
82
+ * Output: The input string, returned verbatim.
81
83
  */
82
84
  server.tool("assess_and_orient",
83
85
  // **Internal Framing:** Expanded OOReDAct on first mention.
84
86
  "**Mandatory Initial Assessment & Orientation:** At the start of EVERY user request AND before any major change in strategy, you MUST perform this initial assessment and orientation. Analyze the request/situation using CUC-N (Complexity, Uncertainty, Consequence, Novelty) to perform the initial 'Observe' and 'Orient' steps of the **Observe-Orient-Reason-Decide-Act (OOReDAct)** cycle. This assessment is CRITICAL for grounding your subsequent reasoning and planning within the main OOReDAct cycle.", {
85
- assessment_and_orientation_text: z.string().describe("Provide your structured CUC-N assessment and initial Orientation. MUST include: 1) Task/Situation Summary (Observe). 2) CUC-N Analysis (Rationale for Low/Medium/High ratings). 3) Initial Orientation (Contextualize task based on CUC-N, goals, constraints, available tools/knowledge; identify key challenges/unknowns). 4) Strategic Implications (How CUC-N influences the approach, e.g., 'High consequence requires rigorous verification in subsequent OOReDAct cycles', 'High uncertainty suggests iterative refinement').")
86
- }, async ({ assessment_and_orientation_text }) => {
87
+ // Input is a simple string, description reflects pass-through nature.
88
+ assessment_and_orientation_text: z.string().describe("Provide the assessment/orientation text. This tool acts as a passthrough and will return the input verbatim without validation or modification.")
89
+ },
90
+ // Simplified handler: No validation, just return input.
91
+ async ({ assessment_and_orientation_text }) => {
87
92
  const toolName = 'assess_and_orient';
88
93
  logToolCall(toolName);
89
94
  try {
90
- if (assessment_and_orientation_text.trim().length === 0) {
91
- throw new Error('Invalid input: Must provide a non-empty CUC-N assessment and orientation.');
92
- }
93
- if (!assessment_and_orientation_text.includes("CUC-N Analysis") || !assessment_and_orientation_text.includes("Initial Orientation")) {
94
- console.warn(`[${new Date().toISOString()}] [MCP Server] WARNING: '${toolName}' input may be missing key sections (CUC-N Analysis, Initial Orientation). Ensure full assessment.`);
95
- }
96
- logToolResult(toolName, true, `Assessment & Orientation logged (length: ${assessment_and_orientation_text.length})`);
97
- console.error(`[${new Date().toISOString()}] [MCP Server] - ${toolName} Input:\n${assessment_and_orientation_text}`);
95
+ // No validation or processing - treat input as opaque string
96
+ logToolResult(toolName, true, `Input received (length: ${assessment_and_orientation_text.length})`);
97
+ // Log the raw input string
98
+ console.error(`[${new Date().toISOString()}] [MCP Server] - ${toolName} Input String:\n${assessment_and_orientation_text}`);
99
+ // Return the input string directly
98
100
  return { content: [{ type: "text", text: assessment_and_orientation_text }] };
99
101
  }
100
102
  catch (error) {
103
+ // Catch only unexpected runtime errors
101
104
  return logToolError(toolName, error);
102
105
  }
103
106
  });
@@ -110,30 +113,29 @@ server.tool("assess_and_orient",
110
113
  * and *before* executing any non-trivial action or providing a final response. Use it to rigorously follow the OOReDAct
111
114
  * structure, document reasoning (adapting reasoning styles like **Chain-of-Thought (CoT)**, **Chain-of-Draft/Condensed Reasoning (CoD/CR)**,
112
115
  * or **Structured Chain-of-Thought (SCoT)** as needed), decide the next step, and plan actions precisely.
113
- * Output: The structured thought process itself (Markdown), serving as your verifiable internal reasoning log.
116
+ * Input: A single string provided by the LLM (treated as opaque data).
117
+ * Output: The input string, returned verbatim.
114
118
  */
115
119
  server.tool("think",
116
120
  // **Internal Framing:** Expanded OOReDAct, CoT, CoD/CR, SCoT on first mention in this tool's description.
117
121
  "**Mandatory OOReDAct Deliberation Cycle:** You MUST perform the full, structured **Observe-Orient-Reason-Decide-Act (OOReDAct)** cycle *after* the initial `assess_and_orient` step, *after* receiving new information (tool/CodeAct results, errors, USER input), and *before* any non-trivial action or final response. Follow the complete OOReDAct structure, adapting your reasoning style within the 'Reason' step (e.g., using detailed **Chain-of-Thought (CoT)** for complexity, concise **Chain-of-Draft/Condensed Reasoning (CoD/CR)** for efficiency, or **Structured Chain-of-Thought (SCoT)** for planning/code) for reliable, verifiable, and adaptive behavior.", {
118
- // **Internal Framing:** Expanded acronyms with explanations in the input description.
119
- thought: z.string().describe("Provide your **complete, structured OOReDAct deliberation**. MUST include ALL sections: ## Observe (Analyze latest inputs/results/errors objectively), ## Orient (Contextualize vs goal/policy/prior state/assessment), ## Reason (Justify decision; adapt reasoning style: use **Chain-of-Thought (CoT)** for detailed, step-by-step derivation when complexity is high; use **Chain-of-Draft/Condensed Reasoning (CoD/CR)** for a more concise, high-signal summary when appropriate; use **Structured Chain-of-Thought (SCoT)** for outlining plans or generating structured code), ## Decide (Single, immediate next action: specific tool call, CodeAct execution, query USER, final response), ## Act (Plan) (Detail execution: EXACT tool params per current schema, OR complete runnable CodeAct Python snippet, OR precise response draft), ## Verification (Expected outcome/success criteria for *this* step), ## Risk & Contingency (Brief fallback if verification fails).")
120
- }, async ({ thought }) => {
122
+ // Input is a simple string, description reflects pass-through nature.
123
+ thought: z.string().describe("Provide the OOReDAct deliberation text. This tool acts as a passthrough and will return the input verbatim without validation or modification.")
124
+ },
125
+ // Simplified handler: No validation, just return input.
126
+ async ({ thought }) => {
121
127
  const toolName = 'think';
122
128
  logToolCall(toolName);
123
129
  try {
124
- if (thought.trim().length === 0) {
125
- throw new Error('Invalid thought: Input cannot be empty.');
126
- }
127
- const requiredSections = ["## Observe", "## Orient", "## Reason", "## Decide", "## Act (Plan)", "## Verification", "## Risk & Contingency"];
128
- const missingSections = requiredSections.filter(section => !thought.includes(section));
129
- if (missingSections.length > 0) {
130
- throw new Error(`Invalid thought structure: Missing required OOReDAct section(s): ${missingSections.join(', ')}. You must provide the complete deliberation.`);
131
- }
132
- logToolResult(toolName, true, `Deliberation logged (length: ${thought.length})`);
133
- console.error(`[${new Date().toISOString()}] [MCP Server] - ${toolName} Input:\n${thought}`);
130
+ // No validation or processing - treat input as opaque string
131
+ logToolResult(toolName, true, `Input received (length: ${thought.length})`);
132
+ // Log the raw input string
133
+ console.error(`[${new Date().toISOString()}] [MCP Server] - ${toolName} Input String:\n${thought}`);
134
+ // Return the input string directly
134
135
  return { content: [{ type: "text", text: thought }] };
135
136
  }
136
137
  catch (error) {
138
+ // Catch only unexpected runtime errors
137
139
  return logToolError(toolName, error);
138
140
  }
139
141
  });
@@ -145,31 +147,62 @@ server.tool("think",
145
147
  * Workflow: Use sparingly to maintain cognitive flow in straightforward sequences. **Does NOT replace the mandatory OOReDAct cycle**.
146
148
  * The full OOReDAct cycle (`think` step) is MANDATORY for handling new information, errors, planning changes,
147
149
  * or any step requiring analysis or decision-making.
150
+ * Input: A single string provided by the LLM (treated as opaque data).
148
151
  * Output: The brief acknowledgement text (Markdown).
149
152
  */
150
153
  server.tool("quick_think",
151
154
  // **Internal Framing:** Expanded OOReDAct on first mention here.
152
155
  "**Minimal Cognitive Acknowledgement:** Use ONLY for acknowledging *simple, expected, non-problematic* outcomes (e.g., 'Data fetch OK, proceeding with planned analysis') where the next step is *already determined* by a prior **Observe-Orient-Reason-Decide-Act (OOReDAct)** cycle (`think` step) and needs NO re-evaluation. Helps maintain flow in simple sequences. **This step DOES NOT satisfy the mandatory OOReDAct deliberation requirement.** Perform the full OOReDAct cycle (`think` step) for any analysis, planning, reasoning, error handling, or decision making.", {
153
- // **Internal Framing:** Expanded OOReDAct on first mention here.
154
- brief_thought: z.string().describe("Provide your **extremely concise** acknowledgement for a genuinely trivial step (max ~15 words recommended, e.g., 'Step X succeeded as expected.'). Must be non-empty. **Do NOT use this for ANY analysis, planning, reasoning, decision-making, or error handling** - perform the full **Observe-Orient-Reason-Decide-Act (OOReDAct)** cycle (`think` step) instead.")
155
- }, async ({ brief_thought }) => {
156
+ // Input is a simple string, description reflects pass-through nature.
157
+ brief_thought: z.string().describe("Provide the brief acknowledgement text. This tool acts as a passthrough and will return the input verbatim without validation or modification.")
158
+ },
159
+ // Simplified handler: No validation, just return input.
160
+ async ({ brief_thought }) => {
156
161
  const toolName = 'quick_think';
157
162
  logToolCall(toolName);
158
163
  try {
159
- if (brief_thought.trim().length === 0) {
160
- throw new Error('Invalid brief_thought: Must be non-empty.');
161
- }
162
- if (brief_thought.includes("##")) {
163
- throw new Error("Invalid brief_thought: Cannot contain '##' sections. Use the full OOReDAct cycle (`think` step) for structured deliberation.");
164
- }
165
- if (brief_thought.length > 100) {
166
- console.warn(`[${new Date().toISOString()}] [MCP Server] WARNING: 'quick_think' input is long (${brief_thought.length} chars). Confirm this step was truly trivial and required no OOReDAct deliberation.`);
167
- }
168
- logToolResult(toolName, true, `Logged: ${brief_thought.substring(0, 80)}...`);
169
- console.error(`[${new Date().toISOString()}] [MCP Server] - ${toolName} Input:\n${brief_thought}`);
164
+ // No validation or processing - treat input as opaque string
165
+ logToolResult(toolName, true, `Input received (length: ${brief_thought.length})`);
166
+ // Log the raw input string
167
+ console.error(`[${new Date().toISOString()}] [MCP Server] - ${toolName} Input String:\n${brief_thought}`);
168
+ // Return the input string directly
170
169
  return { content: [{ type: "text", text: brief_thought }] };
171
170
  }
172
171
  catch (error) {
172
+ // Catch only unexpected runtime errors
173
+ return logToolError(toolName, error);
174
+ }
175
+ });
176
+ /**
177
+ * Tool: mental_sandbox (Mental Sandbox Simulation Logging)
178
+ * Purpose: **Mandatory Step** for logging the internal cognitive simulation (`<sandbox>`) BEFORE any non-trivial output,
179
+ * plan, decision, or action, encompassing steps like Hypothesis Generation/Testing, Constraint Checks,
180
+ * Confidence Scoring, and Pre-computational Analysis.
181
+ * Workflow: Invoke this tool to record the detailed simulation text. The tool functions as a passthrough,
182
+ * returning the provided text verbatim without modification.
183
+ * Input: A single string containing the detailed sandbox simulation text.
184
+ * Output: The input string, returned verbatim.
185
+ */
186
+ server.tool("mental_sandbox",
187
+ // **Internal Framing:** Tool for logging the mandatory sandbox simulation.
188
+ "**Mandatory Mental Sandbox Simulation Logging:** Use this tool BEFORE any non-trivial output/plan/decision/action to log the mandatory internal `<sandbox>` simulation (Hypothesis Testing, Constraint Checks, Confidence, Pre-computation, etc.) as per operational directives. This tool acts as a passthrough and returns the provided simulation text verbatim.", {
189
+ // Input is a simple string, description reflects pass-through nature.
190
+ sandbox_content: z.string().describe("Provide the sandbox simulation text. This tool acts as a passthrough and will return the input verbatim without validation or modification.")
191
+ },
192
+ // Simplified handler: No validation, just return input.
193
+ async ({ sandbox_content }) => {
194
+ const toolName = 'mental_sandbox';
195
+ logToolCall(toolName);
196
+ try {
197
+ // No validation or processing - treat input as opaque string
198
+ logToolResult(toolName, true, `Input received (length: ${sandbox_content.length})`);
199
+ // Log the raw input string
200
+ console.error(`[${new Date().toISOString()}] [MCP Server] - ${toolName} Input String:\n${sandbox_content}`);
201
+ // Return the input string directly
202
+ return { content: [{ type: "text", text: sandbox_content }] };
203
+ }
204
+ catch (error) {
205
+ // Catch only unexpected runtime errors
173
206
  return logToolError(toolName, error);
174
207
  }
175
208
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nbiish/cognitive-tools-mcp",
3
- "version": "2.0.3",
3
+ "version": "2.0.7",
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",