@gotza02/sequential-thinking 2026.2.30 → 2026.2.31
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 +1 -0
- package/SYSTEM_INSTRUCTION.md +8 -1
- package/dist/lib.js +5 -0
- package/dist/tools/thinking.js +7 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -173,6 +173,7 @@ When using the `sequentialthinking` tool, you must specify a `thoughtType`:
|
|
|
173
173
|
* **One Step at a Time:** Do not chain 10 thoughts in one go. Think -> Tool -> Observe -> Think.
|
|
174
174
|
* **Use Blocks:** When switching topics (e.g., from "Research" to "Coding"), use `start_thinking_block` to reset context and avoid loop detection errors.
|
|
175
175
|
* **Branching:** If a solution fails, don't keep trying the same thing. Use the `branchFromThought` parameter to "fork" your thinking process from an earlier point and try a different approach.
|
|
176
|
+
* **The Rule of 3:** If you try to fix a problem 3 times linearly and fail, **STOP**. Do not try a 4th time. Branch back to the analysis phase and pivot to a new hypothesis.
|
|
176
177
|
|
|
177
178
|
---
|
|
178
179
|
|
package/SYSTEM_INSTRUCTION.md
CHANGED
|
@@ -82,4 +82,11 @@ If you get stuck (looping, repeating errors):
|
|
|
82
82
|
1. **STOP.**
|
|
83
83
|
2. Use `thoughtType='reflexion'`. Ask: "Why is this failing?"
|
|
84
84
|
3. **Branch:** Use the `branchFromThought` parameter to go back to a clean state.
|
|
85
|
-
4. **Pivot:** Try a radically different approach.
|
|
85
|
+
4. **Pivot:** Try a radically different approach.
|
|
86
|
+
|
|
87
|
+
### 🛑 THE RULE OF 3 PROTOCOL
|
|
88
|
+
If you have attempted to fix the same issue **3 times** sequentially and failed:
|
|
89
|
+
1. **MANDATORY STOP.** Do not attempt a 4th fix in the same chain.
|
|
90
|
+
2. **REFLECT:** Acknowledge that the current hypothesis is likely wrong.
|
|
91
|
+
3. **BRANCH:** Use `sequentialthinking` with `branchFromThought` to return to the `analysis` step *before* the first fix attempt.
|
|
92
|
+
4. **PIVOT:** Explicitly state: "Hypothesis A failed 3 times. Switching to Hypothesis B."
|
package/dist/lib.js
CHANGED
|
@@ -409,6 +409,11 @@ ${typeof wrappedThought === 'string' && wrappedThought.startsWith('│') ? wrapp
|
|
|
409
409
|
recentInBlock.every(t => t.thoughtType === input.thoughtType)) {
|
|
410
410
|
warnings.push(`⚠️ TYPE LOOP: You've used '${input.thoughtType}' for 4 consecutive steps. Consider using a different thought type to progress.`);
|
|
411
411
|
}
|
|
412
|
+
// Rule 7: Struggle Detection (Rule of 3)
|
|
413
|
+
const executionCount = blockThoughts.filter(t => t.thoughtType === 'execution').length;
|
|
414
|
+
if (executionCount >= 3 && input.thoughtType === 'execution') {
|
|
415
|
+
warnings.push(`🛑 STRUGGLE DETECTED: You have executed 3+ commands in this block without reaching a solution. If you are fixing a bug and it's not working, STOP. Do not try a 4th time linearly. Use 'branchFromThought' to try a completely different approach.`);
|
|
416
|
+
}
|
|
412
417
|
// C. Update State
|
|
413
418
|
this.addToMemory(input);
|
|
414
419
|
await this.saveHistory();
|
package/dist/tools/thinking.js
CHANGED
|
@@ -66,7 +66,13 @@ If stuck in a loop:
|
|
|
66
66
|
1. Do NOT continue linear thoughts
|
|
67
67
|
2. Create a NEW BRANCH ('branchFromThought') from before the error
|
|
68
68
|
3. State "Stuck detected, branching to explore Approach B"
|
|
69
|
-
4. Change your assumptions completely
|
|
69
|
+
4. Change your assumptions completely
|
|
70
|
+
|
|
71
|
+
THE RULE OF 3:
|
|
72
|
+
If you have tried to fix the same problem 3 times and failed:
|
|
73
|
+
1. STOP immediately.
|
|
74
|
+
2. Do not attempt a 4th fix in the same chain.
|
|
75
|
+
3. Branch back to the analysis phase before the first fix attempt.`, {
|
|
70
76
|
thought: z.string().describe("Your current thinking step"),
|
|
71
77
|
thoughtType: z.enum([
|
|
72
78
|
'analysis', 'planning', 'execution', 'observation',
|