@wemake.cx/sequential-thinking 0.2.12 → 0.4.0

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
@@ -9,72 +9,43 @@ The Sequential Thinking server addresses limitations in language models' ability
9
9
  across complex, multi-step problems. It provides a framework for systematic thought progression, ensuring logical
10
10
  consistency and context preservation throughout extended reasoning processes.
11
11
 
12
- ### Core Concepts
12
+ ## Architecture: Code Mode
13
+
14
+ This server follows the "Code Mode" architecture, exposing a strict TypeScript API that allows LLMs to interact with the
15
+ thinking process directly via code, rather than just through JSON-RPC tool calls. This enables more complex, stateful,
16
+ and performant interactions.
13
17
 
14
- #### Sequential Reasoning Framework
18
+ ### Core Concepts
15
19
 
16
20
  - **Step-by-step progression**: Systematic breakdown of complex problems into manageable sequential steps
17
- - **Logical dependencies**: Clear relationships between reasoning steps and conclusions
18
21
  - **Context preservation**: Maintaining coherent context throughout multi-step processes
19
22
  - **Iterative refinement**: Support for revising and improving reasoning chains based on new insights
20
-
21
- #### Reasoning Approaches
22
-
23
- - **Analytical**: Systematic, logical analysis with clear cause-and-effect relationships
24
- - **Creative**: Exploratory thinking with divergent and convergent phases
25
- - **Diagnostic**: Problem identification and solution development through systematic elimination
26
- - **Strategic**: Long-term planning with sequential decision points and contingencies
27
-
28
- #### Thought Validation
29
-
30
- - **Consistency checking**: Ensuring logical coherence across reasoning chains
31
- - **Assumption tracking**: Identifying and validating underlying assumptions
32
- - **Evidence evaluation**: Assessing the strength of supporting evidence for each step
33
- - **Alternative consideration**: Exploring alternative reasoning paths and conclusions
23
+ - **Branching**: Support for exploring alternative lines of reasoning
34
24
 
35
25
  ## Capabilities
36
26
 
37
27
  ### Tools
38
28
 
39
- #### `sequential_thinking`
29
+ #### `sequentialthinking`
40
30
 
41
31
  Structured sequential thinking tool for complex reasoning tasks.
42
32
 
43
33
  **Input Schema:**
44
34
 
45
- ```json
46
- {
47
- "task": "string - The problem or question to analyze",
48
- "thoughts": [
49
- {
50
- "step": "number - Sequential step number",
51
- "content": "string - The thought or reasoning step",
52
- "reasoning": "string - Explanation of the reasoning behind this step",
53
- "assumptions": ["string - List of assumptions made in this step"],
54
- "evidence": ["string - Supporting evidence or data"],
55
- "confidence": "number - Confidence level (0.0-1.0)",
56
- "alternatives": ["string - Alternative approaches or interpretations"]
57
- }
58
- ],
59
- "framework": "string - Reasoning approach (analytical|creative|diagnostic|strategic)",
60
- "stage": "string - Current stage (problem-definition|analysis|synthesis|evaluation|conclusion)",
61
- "iteration": "number - Current iteration number",
62
- "confidence": "number - Overall confidence in reasoning chain (0.0-1.0)",
63
- "nextThoughtNeeded": "boolean - Whether additional thoughts are required",
64
- "suggestedNextSteps": ["string - Recommended next reasoning steps"]
35
+ ```typescript
36
+ interface ThoughtData {
37
+ thought: string; // The current thinking step
38
+ thoughtNumber: number; // Current step number
39
+ totalThoughts: number; // Estimated total steps
40
+ nextThoughtNeeded: boolean; // Whether more steps are needed
41
+ isRevision?: boolean; // Is this revising a previous thought?
42
+ revisesThought?: number; // Which thought is being revised
43
+ branchFromThought?: number; // Branching point
44
+ branchId?: string; // Branch identifier
45
+ needsMoreThoughts?: boolean; // If more thoughts are needed than estimated
65
46
  }
66
47
  ```
67
48
 
68
- **Output:** Structured reasoning analysis with validated thought progression, logical consistency assessment, and
69
- recommendations for next steps.
70
-
71
- **Error Cases:**
72
-
73
- - Invalid framework type
74
- - Missing required reasoning steps
75
- - Logical inconsistencies in thought progression
76
- - Insufficient evidence for conclusions
77
-
78
49
  ## Setup
79
50
 
80
51
  ### bunx
@@ -84,88 +55,44 @@ recommendations for next steps.
84
55
  "mcpServers": {
85
56
  "Sequential Thinking": {
86
57
  "command": "bunx",
87
- "args": ["-y", "@wemake.cx/sequential-thinking@latest"]
58
+ "args": ["@wemake.cx/sequential-thinking@latest"]
88
59
  }
89
60
  }
90
61
  }
91
62
  ```
92
63
 
93
- ### Environment Variables
64
+ ## Usage
94
65
 
95
- - `REASONING_DEPTH`: Set maximum reasoning depth (default: "10")
96
- - `VALIDATION_STRICTNESS`: Set validation level ("lenient" | "standard" | "strict", default: "standard")
97
- - `FRAMEWORK_FLEXIBILITY`: Allow framework switching mid-process ("true" | "false", default: "true")
98
- - `CONFIDENCE_THRESHOLD`: Minimum confidence for step acceptance (default: "0.6")
66
+ ### Code Mode (Recommended)
99
67
 
100
- ### System Prompt Template
68
+ LLMs can use the TypeScript API directly for better performance and type safety:
101
69
 
102
- ```markdown
103
- You are an expert in sequential thinking and systematic reasoning. Use the sequential thinking tool to:
104
-
105
- 1. Break down complex problems into logical, sequential steps
106
- 2. Maintain coherent reasoning chains with clear dependencies
107
- 3. Validate assumptions and evidence at each step
108
- 4. Consider alternative approaches and interpretations
109
- 5. Provide confidence assessments for each reasoning step
110
- 6. Suggest next steps for continued analysis
111
-
112
- Always specify the reasoning framework that best fits the problem type:
70
+ ```typescript
71
+ import { SequentialThinking } from "@wemake.cx/sequential-thinking";
113
72
 
114
- - Analytical: For systematic, logical analysis
115
- - Creative: For exploratory and innovative thinking
116
- - Diagnostic: For problem identification and troubleshooting
117
- - Strategic: For long-term planning and decision-making
73
+ const thinker = new SequentialThinking();
118
74
 
119
- Ensure each thought builds logically on previous steps and contributes to the overall reasoning objective.
120
- ```
75
+ // Step 1: Initial thought
76
+ thinker.think({
77
+ thought: "Analyzing the user's request to migrate to Code Mode",
78
+ thoughtNumber: 1,
79
+ totalThoughts: 3,
80
+ nextThoughtNeeded: true
81
+ });
121
82
 
122
- ## Example
83
+ // Step 2: Detailed planning
84
+ thinker.think({
85
+ thought: "I need to separate the Core logic from the MCP transport layer",
86
+ thoughtNumber: 2,
87
+ totalThoughts: 3,
88
+ nextThoughtNeeded: true
89
+ });
123
90
 
124
- ```typescript
125
- // Analyze a complex business problem using sequential thinking
126
- const businessAnalysis = await sequentialthinking({
127
- task: "Determine the best market entry strategy for a new SaaS product targeting small businesses",
128
- thoughts: [
129
- {
130
- step: 1,
131
- content: "Define the target market characteristics and size",
132
- reasoning: "Understanding the market is fundamental to any entry strategy",
133
- assumptions: ["Small businesses are defined as 1-50 employees", "SaaS adoption is growing in this segment"],
134
- evidence: [
135
- "Market research shows 32M small businesses in target regions",
136
- "SaaS adoption rate of 73% among small businesses"
137
- ],
138
- confidence: 0.8,
139
- alternatives: ["Focus on micro-businesses (<10 employees)", "Target specific industries first"]
140
- },
141
- {
142
- step: 2,
143
- content: "Analyze competitive landscape and positioning opportunities",
144
- reasoning: "Competitive analysis reveals differentiation opportunities and market gaps",
145
- assumptions: ["Current solutions have identifiable weaknesses", "Price sensitivity varies by business size"],
146
- evidence: ["Top 3 competitors have 45% market share", "Customer reviews indicate pain points in user experience"],
147
- confidence: 0.75,
148
- alternatives: ["Blue ocean strategy", "Direct competition with feature superiority"]
149
- },
150
- {
151
- step: 3,
152
- content: "Evaluate go-to-market channel options",
153
- reasoning: "Channel strategy determines reach, cost, and scalability of market entry",
154
- assumptions: ["Digital channels are most cost-effective", "Small businesses prefer self-service onboarding"],
155
- evidence: ["70% of small businesses research software online", "Self-service reduces CAC by 60%"],
156
- confidence: 0.7,
157
- alternatives: ["Partner channel strategy", "Hybrid direct + partner approach", "Pure direct sales model"]
158
- }
159
- ],
160
- framework: "strategic",
161
- stage: "analysis",
162
- iteration: 1,
163
- confidence: 0.75,
164
- nextThoughtNeeded: true,
165
- suggestedNextSteps: [
166
- "Develop pricing strategy based on market analysis",
167
- "Create detailed implementation timeline",
168
- "Identify key success metrics and milestones"
169
- ]
91
+ // Step 3: Execution
92
+ thinker.think({
93
+ thought: "Implementation complete. Verifying tests.",
94
+ thoughtNumber: 3,
95
+ totalThoughts: 3,
96
+ nextThoughtNeeded: false
170
97
  });
171
98
  ```