simple-deep-think.js•5.61 kB
/**
* Simple Deep Think Commander
* Basic implementation of a thinking tool for Claude
*/
const fs = require('fs');
const path = require('path');
// Global variables
let processingRequest = false;
let buffer = '';
// Logging to stderr
function log(...args) {
process.stderr.write(args.map(arg =>
typeof arg === 'object' ? JSON.stringify(arg, null, 2) : String(arg)
).join(' ') + '\n');
}
// Basic thinking tools
const thinkingTools = {
// Basic analysis
analyze: (theme) => {
log(`Analyzing theme: ${theme}`);
return {
theme,
perspectives: [
{ name: "Factual", analysis: "Objective examination of facts and evidence." },
{ name: "Creative", analysis: "Exploration of novel possibilities and connections." },
{ name: "Critical", analysis: "Evaluation of strengths, weaknesses, and limitations." }
],
mainHypothesis: `A primary framework for understanding ${theme}.`,
alternativeHypotheses: [
`An alternative perspective on ${theme} considering different variables.`,
`A contrasting viewpoint that challenges conventional understanding of ${theme}.`
],
nextSteps: [
"Evaluate evidence supporting the main hypothesis",
"Explore the implications of the alternative hypotheses",
"Consider practical applications of these insights"
]
};
},
// Counter arguments
counter: (hypothesis) => {
log(`Generating counterarguments for: ${hypothesis}`);
return {
hypothesis,
counterArguments: [
{
point: "Logical critique",
description: "This hypothesis contains logical fallacies",
details: ["Assumes correlation implies causation", "Overlooks alternative explanations"]
},
{
point: "Evidence limitations",
description: "The evidence supporting this hypothesis is limited",
details: ["Based on small sample size", "Ignores contradictory evidence"]
},
{
point: "Boundary conditions",
description: "Conditions where this hypothesis may not apply",
conditions: ["Different cultural contexts", "Changing technological conditions"]
}
],
refinementSuggestions: [
"Clarify the scope and limitations",
"Address potential counterexamples",
"Incorporate more diverse evidence"
]
};
},
// Multiple perspectives
perspective: (theme) => {
log(`Exploring perspectives on: ${theme}`);
return {
theme,
perspectives: [
{
name: "Scientific",
analysis: "Evidence-based analysis focusing on empirical data",
insights: "This approach reveals patterns supported by research"
},
{
name: "Humanistic",
analysis: "Focus on human experience and values",
insights: "Considers ethical implications and lived experiences"
},
{
name: "Systems Thinking",
analysis: "Examines interconnections and feedback loops",
insights: "Reveals emergent properties and complex interactions"
},
{
name: "Historical",
analysis: "Contextualizes within temporal development",
insights: "Shows evolution of ideas and precedents"
}
],
synthesis: {
commonPoints: "Themes that appear across multiple perspectives",
tensions: "Points of disagreement or incongruity between perspectives",
integratedView: "A more comprehensive understanding incorporating multiple viewpoints"
}
};
},
// SWOT analysis
swotAnalysis: (topic) => {
log(`Performing SWOT analysis on: ${topic}`);
return {
topic,
strengths: {
specific: ["Key advantage 1", "Key advantage 2", "Key advantage 3"],
description: "Internal positive attributes and resources"
},
weaknesses: {
specific: ["Key limitation 1", "Key limitation 2", "Key limitation 3"],
description: "Internal negative attributes and limitations"
},
opportunities: {
specific: ["Key opportunity 1", "Key opportunity 2", "Key opportunity 3"],
description: "External factors that could enhance potential"
},
threats: {
specific: ["Key threat 1", "Key threat 2", "Key threat 3"],
description: "External factors that could undermine success"
},
strategicImplications: "Insights on how to leverage strengths and opportunities while addressing weaknesses and threats"
};
},
// 5W1H analysis
analysis5W1H: (topic) => {
log(`Performing 5W1H analysis on: ${topic}`);
return {
topic,
what: {
description: "Definition and explanation",
details: `Detailed explanation of what ${topic} involves and its key aspects`
},
why: {
description: "Purpose and rationale",
details: `Reasons and motivations behind ${topic}`
},
who: {
description: "People and entities involved",
details: `Main stakeholders and actors related to ${topic}`
},
when: {
description: "Temporal context",
details: `Timing considerations and historical context of ${topic}`
},
where: {
description: "Spatial and contextual setting",
details: `Geographical and environmental factors related to ${topic}`
},
how: {
description: "Methods and processes",
details: `Approaches, techniques, and mechanisms involved in ${topic}`
}
};
}
};