@bis-code/deep-think 1.1.1
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/.claude-plugin/marketplace.json +18 -0
- package/.claude-plugin/plugin.json +19 -0
- package/.deep-think.json +24 -0
- package/.mcp.json +8 -0
- package/LICENSE +21 -0
- package/README.md +92 -0
- package/commands/checkpoints.md +13 -0
- package/commands/constraints.md +16 -0
- package/commands/practices.md +16 -0
- package/commands/start.md +15 -0
- package/hooks/hooks.json +11 -0
- package/package.json +34 -0
- package/rules/deep-think-workflow.md +35 -0
- package/server/dist/bundle.mjs +22006 -0
- package/server/dist/config/loader.d.ts +3 -0
- package/server/dist/config/loader.d.ts.map +1 -0
- package/server/dist/config/loader.js +37 -0
- package/server/dist/config/loader.js.map +1 -0
- package/server/dist/config/schema.d.ts +3 -0
- package/server/dist/config/schema.d.ts.map +1 -0
- package/server/dist/config/schema.js +33 -0
- package/server/dist/config/schema.js.map +1 -0
- package/server/dist/engine/analyzer.d.ts +15 -0
- package/server/dist/engine/analyzer.d.ts.map +1 -0
- package/server/dist/engine/analyzer.js +209 -0
- package/server/dist/engine/analyzer.js.map +1 -0
- package/server/dist/engine/strategies.d.ts +3 -0
- package/server/dist/engine/strategies.d.ts.map +1 -0
- package/server/dist/engine/strategies.js +148 -0
- package/server/dist/engine/strategies.js.map +1 -0
- package/server/dist/engine/thought-store.d.ts +33 -0
- package/server/dist/engine/thought-store.d.ts.map +1 -0
- package/server/dist/engine/thought-store.js +77 -0
- package/server/dist/engine/thought-store.js.map +1 -0
- package/server/dist/index.d.ts +3 -0
- package/server/dist/index.d.ts.map +1 -0
- package/server/dist/index.js +33 -0
- package/server/dist/index.js.map +1 -0
- package/server/dist/persistence/file-store.d.ts +15 -0
- package/server/dist/persistence/file-store.d.ts.map +1 -0
- package/server/dist/persistence/file-store.js +84 -0
- package/server/dist/persistence/file-store.js.map +1 -0
- package/server/dist/persistence/types.d.ts +8 -0
- package/server/dist/persistence/types.d.ts.map +1 -0
- package/server/dist/persistence/types.js +2 -0
- package/server/dist/persistence/types.js.map +1 -0
- package/server/dist/tools/branch.d.ts +5 -0
- package/server/dist/tools/branch.d.ts.map +1 -0
- package/server/dist/tools/branch.js +133 -0
- package/server/dist/tools/branch.js.map +1 -0
- package/server/dist/tools/checkpoint.d.ts +6 -0
- package/server/dist/tools/checkpoint.d.ts.map +1 -0
- package/server/dist/tools/checkpoint.js +95 -0
- package/server/dist/tools/checkpoint.js.map +1 -0
- package/server/dist/tools/reflect.d.ts +5 -0
- package/server/dist/tools/reflect.d.ts.map +1 -0
- package/server/dist/tools/reflect.js +41 -0
- package/server/dist/tools/reflect.js.map +1 -0
- package/server/dist/tools/strategize.d.ts +5 -0
- package/server/dist/tools/strategize.d.ts.map +1 -0
- package/server/dist/tools/strategize.js +80 -0
- package/server/dist/tools/strategize.js.map +1 -0
- package/server/dist/tools/think.d.ts +6 -0
- package/server/dist/tools/think.d.ts.map +1 -0
- package/server/dist/tools/think.js +129 -0
- package/server/dist/tools/think.js.map +1 -0
- package/server/dist/types.d.ts +148 -0
- package/server/dist/types.d.ts.map +1 -0
- package/server/dist/types.js +5 -0
- package/server/dist/types.js.map +1 -0
- package/server/package.json +36 -0
- package/skills/manage-constraints/SKILL.md +28 -0
- package/skills/manage-practices/SKILL.md +26 -0
- package/skills/restore-checkpoint/SKILL.md +25 -0
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export function registerThinkTool(server, store, config, fileStore) {
|
|
3
|
+
server.registerTool("think", {
|
|
4
|
+
title: "Think",
|
|
5
|
+
description: `Record a reasoning step in a structured thought chain. Enhanced replacement for sequential thinking.
|
|
6
|
+
|
|
7
|
+
This tool helps analyze problems through a flexible, persistent thinking process that adapts and evolves.
|
|
8
|
+
Each thought can build on, question, or revise previous insights as understanding deepens.
|
|
9
|
+
|
|
10
|
+
When to use:
|
|
11
|
+
- Breaking down complex problems into steps
|
|
12
|
+
- Planning and design with room for revision
|
|
13
|
+
- Analysis that might need course correction
|
|
14
|
+
- Problems where the full scope isn't clear initially
|
|
15
|
+
- Tasks needing persistent context across sessions
|
|
16
|
+
|
|
17
|
+
Enhanced features beyond sequential thinking:
|
|
18
|
+
- Confidence tracking (0-1) on each thought
|
|
19
|
+
- Semantic tags for cross-thought analysis
|
|
20
|
+
- Assumptions and evidence tracking
|
|
21
|
+
- Strategy-guided thinking
|
|
22
|
+
- Active feedback on reasoning patterns
|
|
23
|
+
|
|
24
|
+
Parameters:
|
|
25
|
+
- thought: Your current thinking step (analysis, revision, question, realization, hypothesis)
|
|
26
|
+
- nextThoughtNeeded: True if more thinking needed, even past the estimated end
|
|
27
|
+
- thoughtNumber: Current position in sequence (1-indexed)
|
|
28
|
+
- totalThoughts: Current estimate of thoughts needed (adjustable up/down)
|
|
29
|
+
- confidence: How confident you are in this step (0-1, optional)
|
|
30
|
+
- tags: Semantic labels for this thought (optional)
|
|
31
|
+
- assumptions: Explicit assumptions being made (optional)
|
|
32
|
+
- evidence: Supporting evidence or references (optional)
|
|
33
|
+
- isRevision: Whether this revises previous thinking
|
|
34
|
+
- revisesThought: Which thought number is being reconsidered
|
|
35
|
+
- branchFromThought: Branching point thought number
|
|
36
|
+
- branchId: Branch identifier
|
|
37
|
+
- needsMoreThoughts: Signal to extend beyond totalThoughts
|
|
38
|
+
|
|
39
|
+
You should:
|
|
40
|
+
1. Start with an initial estimate of thoughts needed, but adjust freely
|
|
41
|
+
2. Track confidence — it helps the reflect tool detect issues
|
|
42
|
+
3. Tag thoughts for better cross-thought analysis
|
|
43
|
+
4. Make assumptions explicit — they're checked during reflection
|
|
44
|
+
5. Only set nextThoughtNeeded to false when truly satisfied`,
|
|
45
|
+
inputSchema: {
|
|
46
|
+
thought: z.string().describe("Your current thinking step"),
|
|
47
|
+
nextThoughtNeeded: z.boolean().describe("Whether another thought step is needed"),
|
|
48
|
+
thoughtNumber: z.number().int().min(1).describe("Current thought number"),
|
|
49
|
+
totalThoughts: z.number().int().min(1).describe("Estimated total thoughts needed"),
|
|
50
|
+
confidence: z.number().min(0).max(1).optional().describe("Confidence in this step (0-1)"),
|
|
51
|
+
tags: z.array(z.string()).optional().describe("Semantic tags for this thought"),
|
|
52
|
+
assumptions: z.array(z.string()).optional().describe("Assumptions being made"),
|
|
53
|
+
evidence: z.array(z.string()).optional().describe("Supporting evidence"),
|
|
54
|
+
isRevision: z.boolean().optional().describe("Whether this revises previous thinking"),
|
|
55
|
+
revisesThought: z.number().int().min(1).optional().describe("Which thought is being reconsidered"),
|
|
56
|
+
branchFromThought: z.number().int().min(1).optional().describe("Branching point thought number"),
|
|
57
|
+
branchId: z.string().optional().describe("Branch identifier"),
|
|
58
|
+
needsMoreThoughts: z.boolean().optional().describe("If more thoughts are needed beyond estimate"),
|
|
59
|
+
strategy: z.string().optional().describe("Reasoning strategy to apply"),
|
|
60
|
+
dependsOn: z.array(z.number().int().min(1)).optional().describe("Thought numbers this depends on"),
|
|
61
|
+
},
|
|
62
|
+
outputSchema: {
|
|
63
|
+
thoughtNumber: z.number(),
|
|
64
|
+
totalThoughts: z.number(),
|
|
65
|
+
nextThoughtNeeded: z.boolean(),
|
|
66
|
+
branches: z.array(z.string()),
|
|
67
|
+
thoughtHistoryLength: z.number(),
|
|
68
|
+
activeStrategy: z.string().nullable(),
|
|
69
|
+
feedback: z.array(z.string()),
|
|
70
|
+
},
|
|
71
|
+
}, async (args) => {
|
|
72
|
+
if (args.strategy) {
|
|
73
|
+
store.setActiveStrategy(args.strategy);
|
|
74
|
+
}
|
|
75
|
+
const stored = store.addThought(args);
|
|
76
|
+
const history = store.getHistory();
|
|
77
|
+
const feedback = [];
|
|
78
|
+
// Feedback: chain length warning
|
|
79
|
+
if (history.length > config.thinking.maxThoughts * 0.8) {
|
|
80
|
+
feedback.push(`Approaching thought limit (${history.length}/${config.thinking.maxThoughts}). Consider reflecting or concluding.`);
|
|
81
|
+
}
|
|
82
|
+
// Feedback: confidence dropping
|
|
83
|
+
if (history.length >= 3) {
|
|
84
|
+
const recent = history.slice(-3);
|
|
85
|
+
const confidences = recent.map(t => t.confidence).filter((c) => c !== undefined);
|
|
86
|
+
if (confidences.length >= 2) {
|
|
87
|
+
const trend = confidences[confidences.length - 1] - confidences[0];
|
|
88
|
+
if (trend < -0.3) {
|
|
89
|
+
feedback.push("Confidence has dropped significantly in recent thoughts. Consider using 'reflect' to analyze the chain.");
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
// Feedback: no tags being used
|
|
94
|
+
if (history.length >= 5 && history.every(t => !t.tags || t.tags.length === 0)) {
|
|
95
|
+
feedback.push("Tip: Adding tags to thoughts improves the quality of 'reflect' analysis.");
|
|
96
|
+
}
|
|
97
|
+
// Auto-checkpoint every N thoughts
|
|
98
|
+
const autoEvery = config.thinking.autoCheckpointEvery;
|
|
99
|
+
if (autoEvery > 0 && history.length > 0 && history.length % autoEvery === 0) {
|
|
100
|
+
const state = store.serialize();
|
|
101
|
+
const cpName = `auto-${Date.now()}`;
|
|
102
|
+
await fileStore.save(cpName, {
|
|
103
|
+
name: cpName,
|
|
104
|
+
timestamp: new Date().toISOString(),
|
|
105
|
+
sessionId: store.getSessionId(),
|
|
106
|
+
thoughtHistory: state.thoughtHistory,
|
|
107
|
+
branches: state.branches,
|
|
108
|
+
activeStrategy: state.activeStrategy,
|
|
109
|
+
metadata: {},
|
|
110
|
+
projectPath: process.cwd(),
|
|
111
|
+
});
|
|
112
|
+
feedback.push(`Auto-checkpoint saved: ${cpName} (every ${autoEvery} thoughts)`);
|
|
113
|
+
}
|
|
114
|
+
const response = {
|
|
115
|
+
thoughtNumber: stored.thoughtNumber,
|
|
116
|
+
totalThoughts: stored.totalThoughts,
|
|
117
|
+
nextThoughtNeeded: stored.nextThoughtNeeded,
|
|
118
|
+
branches: store.getBranchIds(),
|
|
119
|
+
thoughtHistoryLength: history.length,
|
|
120
|
+
activeStrategy: store.getActiveStrategy(),
|
|
121
|
+
feedback,
|
|
122
|
+
};
|
|
123
|
+
return {
|
|
124
|
+
content: [{ type: "text", text: JSON.stringify(response, null, 2) }],
|
|
125
|
+
structuredContent: response,
|
|
126
|
+
};
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
//# sourceMappingURL=think.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"think.js","sourceRoot":"","sources":["../../src/tools/think.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB,MAAM,UAAU,iBAAiB,CAAC,MAAiB,EAAE,KAAmB,EAAE,MAAuB,EAAE,SAAoB;IACrH,MAAM,CAAC,YAAY,CACjB,OAAO,EACP;QACE,KAAK,EAAE,OAAO;QACd,WAAW,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4DAuCyC;QACtD,WAAW,EAAE;YACX,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,4BAA4B,CAAC;YAC1D,iBAAiB,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,CAAC,wCAAwC,CAAC;YACjF,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,wBAAwB,CAAC;YACzE,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,iCAAiC,CAAC;YAClF,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,+BAA+B,CAAC;YACzF,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,gCAAgC,CAA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AAM,WAAW,SAAS,YAAY,CAAC,CAAC;QAClF,CAAC;QAED,MAAM,QAAQ,GAAkB;YAC9B,aAAa,EAAE,MAAM,CAAC,aAAa;YACnC,aAAa,EAAE,MAAM,CAAC,aAAa;YACnC,iBAAiB,EAAE,MAAM,CAAC,iBAAiB;YAC3C,QAAQ,EAAE,KAAK,CAAC,YAAY,EAAE;YAC9B,oBAAoB,EAAE,OAAO,CAAC,MAAM;YACpC,cAAc,EAAE,KAAK,CAAC,iBAAiB,EAAE;YACzC,QAAQ;SACT,CAAC;QAEF,OAAO;YACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC;YAC7E,iBAAiB,EAAE,QAA8C;SAClE,CAAC;IACJ,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
export interface ThoughtData {
|
|
2
|
+
thought: string;
|
|
3
|
+
thoughtNumber: number;
|
|
4
|
+
totalThoughts: number;
|
|
5
|
+
nextThoughtNeeded: boolean;
|
|
6
|
+
isRevision?: boolean;
|
|
7
|
+
revisesThought?: number;
|
|
8
|
+
branchFromThought?: number;
|
|
9
|
+
branchId?: string;
|
|
10
|
+
needsMoreThoughts?: boolean;
|
|
11
|
+
strategy?: string;
|
|
12
|
+
confidence?: number;
|
|
13
|
+
tags?: string[];
|
|
14
|
+
dependsOn?: number[];
|
|
15
|
+
assumptions?: string[];
|
|
16
|
+
evidence?: string[];
|
|
17
|
+
}
|
|
18
|
+
export interface StoredThought extends ThoughtData {
|
|
19
|
+
timestamp: string;
|
|
20
|
+
sessionId: string;
|
|
21
|
+
}
|
|
22
|
+
export interface ThinkResponse {
|
|
23
|
+
thoughtNumber: number;
|
|
24
|
+
totalThoughts: number;
|
|
25
|
+
nextThoughtNeeded: boolean;
|
|
26
|
+
branches: string[];
|
|
27
|
+
thoughtHistoryLength: number;
|
|
28
|
+
activeStrategy: string | null;
|
|
29
|
+
feedback: string[];
|
|
30
|
+
}
|
|
31
|
+
export interface ReflectionResult {
|
|
32
|
+
summary: string;
|
|
33
|
+
patterns: DetectedPattern[];
|
|
34
|
+
suggestions: string[];
|
|
35
|
+
practiceViolations: PracticeViolation[];
|
|
36
|
+
progress: ProgressSummary;
|
|
37
|
+
}
|
|
38
|
+
export interface DetectedPattern {
|
|
39
|
+
type: 'circular' | 'contradiction' | 'anchoring' | 'scope-creep' | 'diminishing';
|
|
40
|
+
description: string;
|
|
41
|
+
involvedThoughts: number[];
|
|
42
|
+
severity: 'info' | 'warning' | 'critical';
|
|
43
|
+
}
|
|
44
|
+
export interface PracticeViolation {
|
|
45
|
+
rule: string;
|
|
46
|
+
thoughtNumber: number;
|
|
47
|
+
explanation: string;
|
|
48
|
+
}
|
|
49
|
+
export interface ProgressSummary {
|
|
50
|
+
totalThoughts: number;
|
|
51
|
+
uniqueTopics: number;
|
|
52
|
+
branchesExplored: number;
|
|
53
|
+
averageConfidence: number | null;
|
|
54
|
+
confidenceTrend: 'rising' | 'falling' | 'stable' | 'unknown';
|
|
55
|
+
estimatedCompletion: number;
|
|
56
|
+
}
|
|
57
|
+
export interface BranchInfo {
|
|
58
|
+
id: string;
|
|
59
|
+
fromThought: number;
|
|
60
|
+
thoughtCount: number;
|
|
61
|
+
summary: string;
|
|
62
|
+
}
|
|
63
|
+
export interface BranchComparison {
|
|
64
|
+
branchA: string;
|
|
65
|
+
branchB: string;
|
|
66
|
+
agreements: string[];
|
|
67
|
+
disagreements: string[];
|
|
68
|
+
uniqueToA: string[];
|
|
69
|
+
uniqueToB: string[];
|
|
70
|
+
}
|
|
71
|
+
export interface MergeResult {
|
|
72
|
+
mergedFrom: string[];
|
|
73
|
+
conclusion: string;
|
|
74
|
+
winningBranch: string | null;
|
|
75
|
+
rationale: string;
|
|
76
|
+
mergedThoughtNumber: number;
|
|
77
|
+
}
|
|
78
|
+
export interface CheckpointData {
|
|
79
|
+
name: string;
|
|
80
|
+
timestamp: string;
|
|
81
|
+
sessionId: string;
|
|
82
|
+
thoughtHistory: StoredThought[];
|
|
83
|
+
branches: Record<string, StoredThought[]>;
|
|
84
|
+
activeStrategy: string | null;
|
|
85
|
+
metadata: Record<string, unknown>;
|
|
86
|
+
projectPath?: string;
|
|
87
|
+
}
|
|
88
|
+
export interface CheckpointInfo {
|
|
89
|
+
name: string;
|
|
90
|
+
timestamp: string;
|
|
91
|
+
thoughtCount: number;
|
|
92
|
+
branchCount: number;
|
|
93
|
+
strategy: string | null;
|
|
94
|
+
projectPath?: string;
|
|
95
|
+
}
|
|
96
|
+
export interface Strategy {
|
|
97
|
+
name: string;
|
|
98
|
+
description: string;
|
|
99
|
+
steps: string[];
|
|
100
|
+
guidingQuestions: string[];
|
|
101
|
+
reflectChecks: string[];
|
|
102
|
+
whenToUse: string;
|
|
103
|
+
}
|
|
104
|
+
export interface DeepThinkConfig {
|
|
105
|
+
project: ProjectConfig;
|
|
106
|
+
thinking: ThinkingConfig;
|
|
107
|
+
practices: PracticesConfig;
|
|
108
|
+
strategies: StrategiesConfig;
|
|
109
|
+
reflection: ReflectionConfig;
|
|
110
|
+
persistence: PersistenceConfig;
|
|
111
|
+
}
|
|
112
|
+
export interface ProjectConfig {
|
|
113
|
+
name: string;
|
|
114
|
+
type: string;
|
|
115
|
+
language: string;
|
|
116
|
+
description: string;
|
|
117
|
+
}
|
|
118
|
+
export interface ThinkingConfig {
|
|
119
|
+
defaultStrategy: string | null;
|
|
120
|
+
maxThoughts: number;
|
|
121
|
+
autoCheckpointEvery: number;
|
|
122
|
+
confidenceThreshold: number;
|
|
123
|
+
}
|
|
124
|
+
export interface PracticesConfig {
|
|
125
|
+
rules: string[];
|
|
126
|
+
antiPatterns: string[];
|
|
127
|
+
reviewChecklist: string[];
|
|
128
|
+
}
|
|
129
|
+
export interface StrategiesConfig {
|
|
130
|
+
custom: CustomStrategy[];
|
|
131
|
+
}
|
|
132
|
+
export interface CustomStrategy {
|
|
133
|
+
name: string;
|
|
134
|
+
description: string;
|
|
135
|
+
steps: string[];
|
|
136
|
+
checkpoints: string[];
|
|
137
|
+
}
|
|
138
|
+
export interface ReflectionConfig {
|
|
139
|
+
alwaysCheck: string[];
|
|
140
|
+
circularThreshold: number;
|
|
141
|
+
contradictionSensitivity: 'low' | 'medium' | 'high';
|
|
142
|
+
}
|
|
143
|
+
export interface PersistenceConfig {
|
|
144
|
+
directory: string;
|
|
145
|
+
maxCheckpoints: number;
|
|
146
|
+
autoSave: boolean;
|
|
147
|
+
}
|
|
148
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,WAAW;IAE1B,OAAO,EAAE,MAAM,CAAC;IAChB,aAAa,EAAE,MAAM,CAAC;IACtB,aAAa,EAAE,MAAM,CAAC;IACtB,iBAAiB,EAAE,OAAO,CAAC;IAC3B,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAG5B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IACvB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;CACrB;AAED,MAAM,WAAW,aAAc,SAAQ,WAAW;IAChD,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;CACnB;AAMD,MAAM,WAAW,aAAa;IAC5B,aAAa,EAAE,MAAM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1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,qBAAqB;AACrB,+EAA+E"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "mcp-deep-think",
|
|
3
|
+
"version": "1.1.1",
|
|
4
|
+
"description": "MCP server for structured reasoning — persistent, analytical, strategy-driven thinking",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"author": "Ioan-Sorin Baicoianu <baicoianuioansorin@gmail.com>",
|
|
7
|
+
"type": "module",
|
|
8
|
+
"bin": {
|
|
9
|
+
"mcp-deep-think": "dist/index.js"
|
|
10
|
+
},
|
|
11
|
+
"main": "dist/index.js",
|
|
12
|
+
"types": "dist/index.d.ts",
|
|
13
|
+
"files": [
|
|
14
|
+
"dist"
|
|
15
|
+
],
|
|
16
|
+
"scripts": {
|
|
17
|
+
"build": "tsc && chmod +x dist/index.js",
|
|
18
|
+
"bundle": "esbuild src/index.ts --bundle --platform=node --target=node20 --format=esm --outfile=dist/bundle.mjs",
|
|
19
|
+
"dev": "tsc --watch",
|
|
20
|
+
"test": "vitest run",
|
|
21
|
+
"test:watch": "vitest",
|
|
22
|
+
"test:coverage": "vitest run --coverage",
|
|
23
|
+
"prepublishOnly": "npm run build"
|
|
24
|
+
},
|
|
25
|
+
"dependencies": {
|
|
26
|
+
"@modelcontextprotocol/sdk": "^1.26.0",
|
|
27
|
+
"zod": "^3.25.0"
|
|
28
|
+
},
|
|
29
|
+
"devDependencies": {
|
|
30
|
+
"@types/node": "^22",
|
|
31
|
+
"@vitest/coverage-v8": "^2.1.8",
|
|
32
|
+
"esbuild": "^0.27.4",
|
|
33
|
+
"typescript": "^5.3.3",
|
|
34
|
+
"vitest": "^2.1.8"
|
|
35
|
+
}
|
|
36
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: manage-constraints
|
|
3
|
+
description: Use when the user conversationally asks to add reasoning rules, constraints, or anti-patterns to their deep-think configuration. Triggers on phrases like "remember to always check X", "add a rule about Y", "from now on check Z during reasoning", "never do X when thinking through problems".
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Manage Deep Think Constraints
|
|
7
|
+
|
|
8
|
+
The user wants to add, remove, or view constraints that guide deep-think reasoning.
|
|
9
|
+
|
|
10
|
+
Constraints map to `.deep-think.json` in the current project directory:
|
|
11
|
+
- `practices.rules` — things to always check during reasoning
|
|
12
|
+
- `practices.antiPatterns` — patterns to avoid and flag during reflection
|
|
13
|
+
|
|
14
|
+
## Steps
|
|
15
|
+
|
|
16
|
+
1. Read `.deep-think.json` from the current project directory.
|
|
17
|
+
- If the file doesn't exist, start with an empty config.
|
|
18
|
+
2. Determine what the user wants: add a rule, add an anti-pattern, remove something, or view current constraints.
|
|
19
|
+
3. Make the change to the appropriate array.
|
|
20
|
+
4. Write the updated `.deep-think.json` back to disk.
|
|
21
|
+
5. Confirm what was added/removed/shown.
|
|
22
|
+
|
|
23
|
+
## Deciding: Rule vs Anti-Pattern
|
|
24
|
+
|
|
25
|
+
- **Rule**: Something to always check or consider (e.g., "always verify security implications")
|
|
26
|
+
- **Anti-pattern**: Something to avoid and flag if detected (e.g., "premature optimization")
|
|
27
|
+
|
|
28
|
+
If unclear, ask the user which category fits better.
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: manage-practices
|
|
3
|
+
description: Use when the user conversationally asks to add review checklist items, custom reasoning strategies, or modify their deep-think review process. Triggers on phrases like "add a review step for...", "create a strategy for...", "I want to always check for... during review", "add a custom thinking framework".
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Manage Deep Think Practices
|
|
7
|
+
|
|
8
|
+
The user wants to add, remove, or view review practices and custom strategies.
|
|
9
|
+
|
|
10
|
+
Practices map to `.deep-think.json` in the current project directory:
|
|
11
|
+
- `practices.reviewChecklist` — items checked during reflection
|
|
12
|
+
- `strategies.custom` — custom reasoning strategies with steps and checkpoints
|
|
13
|
+
|
|
14
|
+
## Steps
|
|
15
|
+
|
|
16
|
+
1. Read `.deep-think.json` from the current project directory.
|
|
17
|
+
- If the file doesn't exist, start with an empty config.
|
|
18
|
+
2. Determine what the user wants: add a review item, add a strategy, remove something, or view current practices.
|
|
19
|
+
3. For review items: add/remove from the `practices.reviewChecklist` array.
|
|
20
|
+
4. For strategies: each custom strategy needs:
|
|
21
|
+
- `name` — short identifier (kebab-case)
|
|
22
|
+
- `description` — when to use this strategy
|
|
23
|
+
- `steps` — ordered list of reasoning steps
|
|
24
|
+
- `checkpoints` — things to verify at each stage
|
|
25
|
+
5. Write the updated `.deep-think.json` back to disk.
|
|
26
|
+
6. Confirm what was added/removed/shown.
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: restore-checkpoint
|
|
3
|
+
description: Use when starting a new session and the user seems to be continuing previous reasoning work, mentions resuming a thought chain, or asks to restore a deep-think checkpoint. Also triggers when a user mentions picking up where they left off on a complex decision or analysis.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Restore Deep Think Checkpoint
|
|
7
|
+
|
|
8
|
+
The user may be continuing reasoning work from a previous session.
|
|
9
|
+
|
|
10
|
+
## Steps
|
|
11
|
+
|
|
12
|
+
1. Call the deep-think checkpoint tool with operation "list" to see available checkpoints.
|
|
13
|
+
2. If checkpoints exist, present them to the user with name, timestamp, project path, thought count, and strategy.
|
|
14
|
+
3. Ask if they'd like to restore one to continue their reasoning.
|
|
15
|
+
4. If yes, call checkpoint with operation "load" and the chosen name.
|
|
16
|
+
5. After restoring, call reflect with focus "progress" to show where they left off.
|
|
17
|
+
6. Suggest next steps based on the restored state.
|
|
18
|
+
|
|
19
|
+
## If No Checkpoints
|
|
20
|
+
|
|
21
|
+
If no checkpoints are found, let the user know and suggest starting fresh with `/deep-think:start`.
|
|
22
|
+
|
|
23
|
+
## Fallback
|
|
24
|
+
|
|
25
|
+
If this skill doesn't trigger automatically, users can always run `/deep-think:checkpoints` to manually access the same functionality.
|