@gotza02/sequential-thinking 2026.2.33 → 2026.2.35

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/dist/graph.js CHANGED
@@ -549,7 +549,7 @@ export class ProjectKnowledgeGraph {
549
549
  imports.push(im[1]);
550
550
  }
551
551
  // Go symbols
552
- const funcMatches = content.matchAll(/^func\s+(?:\([^\)]*\)\s+)?([A-Z][a-zA-Z0-9_]*)/gm);
552
+ const funcMatches = content.matchAll(/^func\s+(?:\([^\)]*\)\s+)?([a-zA-Z_][a-zA-Z0-9_]*)/gm);
553
553
  for (const match of funcMatches)
554
554
  symbols.push(`func:${match[1]}`);
555
555
  const typeMatches = content.matchAll(/^type\s+([A-Z][a-zA-Z0-9_]*)\s+(?:struct|interface)/gm);
package/dist/lib.js CHANGED
@@ -209,6 +209,13 @@ export class SequentialThinkingServer {
209
209
  if (this.thoughtHistory.length > 100) {
210
210
  const removed = this.thoughtHistory.splice(0, this.thoughtHistory.length - 100);
211
211
  console.error(`[AutoPrune] Removed ${removed.length} old thoughts to maintain performance.`);
212
+ // Sync blocks: Remove pruned thoughts from their respective blocks
213
+ // This prevents unbounded file growth by ensuring blocks don't retain references to deleted thoughts
214
+ const historyIds = new Set(this.thoughtHistory.map(t => t.thoughtNumber));
215
+ for (const block of this.blocks) {
216
+ // Only keep thoughts that are still in the active history
217
+ block.thoughts = block.thoughts.filter(t => historyIds.has(t.thoughtNumber));
218
+ }
212
219
  }
213
220
  }
214
221
  async clearHistory() {
@@ -465,6 +472,30 @@ ${typeof wrappedThought === 'string' && wrappedThought.startsWith('│') ? wrapp
465
472
  if (executionCount >= 3 && input.thoughtType === 'execution') {
466
473
  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.`);
467
474
  }
475
+ // Rule 8: Premature Solution Detection (Deep Thinker)
476
+ const hasObservation = blockThoughts.some(t => t.thoughtType === 'observation');
477
+ if (input.thoughtType === 'solution' && !hasObservation && blockThoughts.length < 4) {
478
+ warnings.push(`🤔 PREMATURE SOLUTION: You are concluding this block very quickly without any 'observation' (data verification). Are you hallucinating? Please verify with a tool first unless this is purely conceptual.`);
479
+ }
480
+ // Rule 9: Reflexion Quality Check
481
+ if (input.thoughtType === 'reflexion' && input.thought.length < 20) {
482
+ warnings.push(`📉 WEAK REFLEXION: Your reflexion is too short. Deepen your analysis. What went wrong? What did you learn? How does this change your plan?`);
483
+ }
484
+ // Rule 10: Mandatory Verification (Gatekeeper)
485
+ if (input.thoughtType === 'solution') {
486
+ const observations = blockThoughts.filter(t => t.thoughtType === 'observation');
487
+ if (observations.length === 0) {
488
+ warnings.push(`🚫 UNVERIFIED SOLUTION: You are attempting to solve without ANY observation/tool output in this block. You MUST verify your solution with a tool (e.g., test runner, file read, compilation) before concluding.`);
489
+ }
490
+ else {
491
+ const lastObservation = observations[observations.length - 1];
492
+ const failureKeywords = ['error', 'fail', 'exception', 'undefined', 'not found', 'enoent'];
493
+ const hasFailure = failureKeywords.some(kw => lastObservation.toolResult?.toLowerCase().includes(kw));
494
+ if (hasFailure) {
495
+ warnings.push(`⚠️ FAILURE DETECTED: The last observation contains failure signals ("${lastObservation.toolResult?.substring(0, 50)}..."). You cannot conclude with 'solution' yet. Fix the error first.`);
496
+ }
497
+ }
498
+ }
468
499
  // C. Update State
469
500
  this.addToMemory(input);
470
501
  await this.saveHistory();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gotza02/sequential-thinking",
3
- "version": "2026.2.33",
3
+ "version": "2026.2.35",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },