@felkot/think-mcp 1.1.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/LICENSE +21 -0
- package/README.md +165 -0
- package/dist/constants/index.d.ts +5 -0
- package/dist/constants/index.js +5 -0
- package/dist/constants/patterns.d.ts +8 -0
- package/dist/constants/patterns.js +34 -0
- package/dist/constants/prompts.d.ts +1 -0
- package/dist/constants/prompts.js +44 -0
- package/dist/constants/thresholds.d.ts +39 -0
- package/dist/constants/thresholds.js +54 -0
- package/dist/index.d.ts +20 -0
- package/dist/index.js +711 -0
- package/dist/services/burst.service.d.ts +39 -0
- package/dist/services/burst.service.js +215 -0
- package/dist/services/coaching.service.d.ts +38 -0
- package/dist/services/coaching.service.js +258 -0
- package/dist/services/consolidate.service.d.ts +17 -0
- package/dist/services/consolidate.service.js +236 -0
- package/dist/services/context.service.d.ts +15 -0
- package/dist/services/context.service.js +113 -0
- package/dist/services/export.service.d.ts +33 -0
- package/dist/services/export.service.js +129 -0
- package/dist/services/insights.service.d.ts +103 -0
- package/dist/services/insights.service.js +216 -0
- package/dist/services/logic.service.d.ts +28 -0
- package/dist/services/logic.service.js +467 -0
- package/dist/services/nudge.service.d.ts +20 -0
- package/dist/services/nudge.service.js +114 -0
- package/dist/services/recall.service.d.ts +38 -0
- package/dist/services/recall.service.js +188 -0
- package/dist/services/stagnation.service.d.ts +14 -0
- package/dist/services/stagnation.service.js +48 -0
- package/dist/services/thinking.service.d.ts +263 -0
- package/dist/services/thinking.service.js +1048 -0
- package/dist/services/validation.service.d.ts +45 -0
- package/dist/services/validation.service.js +260 -0
- package/dist/services/visualization.service.d.ts +23 -0
- package/dist/services/visualization.service.js +211 -0
- package/dist/types/thought.types.d.ts +486 -0
- package/dist/types/thought.types.js +5 -0
- package/dist/utils/index.d.ts +6 -0
- package/dist/utils/index.js +6 -0
- package/dist/utils/sensitive-data.d.ts +2 -0
- package/dist/utils/sensitive-data.js +28 -0
- package/dist/utils/storage-paths.d.ts +9 -0
- package/dist/utils/storage-paths.js +28 -0
- package/dist/utils/text-analysis.d.ts +30 -0
- package/dist/utils/text-analysis.js +92 -0
- package/package.json +66 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025-2026 GofMan3
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
|
|
3
|
+
# Think MCP
|
|
4
|
+
|
|
5
|
+
**Structured reasoning MCP server for difficult engineering tasks**
|
|
6
|
+
|
|
7
|
+
[](https://www.npmjs.com/package/@felkot/think-mcp)
|
|
8
|
+
[](https://opensource.org/licenses/MIT)
|
|
9
|
+
[](https://modelcontextprotocol.io/)
|
|
10
|
+
|
|
11
|
+
**Think deeper. Branch safely. Finish with verified reasoning.**
|
|
12
|
+
|
|
13
|
+
</div>
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## Why this project exists
|
|
18
|
+
|
|
19
|
+
Most assistants are good at speed but weak at deep reliability.
|
|
20
|
+
|
|
21
|
+
**Think MCP** gives a strict thinking workflow for cases where mistakes are expensive:
|
|
22
|
+
- architecture and refactors,
|
|
23
|
+
- finance/payment flows,
|
|
24
|
+
- security-sensitive logic,
|
|
25
|
+
- long multi-step implementation plans.
|
|
26
|
+
|
|
27
|
+
It helps the model reason in a controlled loop: map assumptions, explore alternatives, verify constraints, and only then conclude.
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
## Stable Release 1.0.0
|
|
32
|
+
|
|
33
|
+
This release is focused on production-ready behavior:
|
|
34
|
+
|
|
35
|
+
- Stronger heavy-task gates for `think` and `think_done`
|
|
36
|
+
- Better anti-leak protection for context capture and export
|
|
37
|
+
- Sensitive file blocking (for example `.env`, key/cert-like files)
|
|
38
|
+
- Sanitized reports and insights persistence
|
|
39
|
+
- Improved release quality checks and package hygiene
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
## Quick Start
|
|
44
|
+
|
|
45
|
+
### Run directly
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
npx @felkot/think-mcp@latest
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### MCP config example
|
|
52
|
+
|
|
53
|
+
```json
|
|
54
|
+
{
|
|
55
|
+
"mcpServers": {
|
|
56
|
+
"think": {
|
|
57
|
+
"command": "npx",
|
|
58
|
+
"args": ["-y", "@felkot/think-mcp@latest"]
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
---
|
|
65
|
+
|
|
66
|
+
## Mini Prompt (copy/paste)
|
|
67
|
+
|
|
68
|
+
Use this in your system/custom instructions:
|
|
69
|
+
|
|
70
|
+
```text
|
|
71
|
+
You are a careful engineering assistant.
|
|
72
|
+
For non-trivial tasks, use Think MCP before final output.
|
|
73
|
+
|
|
74
|
+
Rules:
|
|
75
|
+
1) Start with think_logic for architecture/flow analysis.
|
|
76
|
+
2) Use think for stepwise reasoning with subSteps.
|
|
77
|
+
3) If confidence < 5 or trade-offs are unclear, use think_diverge.
|
|
78
|
+
4) Before final answer, call think_done with:
|
|
79
|
+
- winningPath
|
|
80
|
+
- summary
|
|
81
|
+
- constraintCheck
|
|
82
|
+
- potentialFlaws
|
|
83
|
+
5) If think_done is blocked, continue reasoning; do not force a conclusion.
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
---
|
|
87
|
+
|
|
88
|
+
## Toolset
|
|
89
|
+
|
|
90
|
+
| Tool | Purpose |
|
|
91
|
+
| :--- | :--- |
|
|
92
|
+
| `think` | Add one thought with validation, confidence, substeps, and optional context snapshots |
|
|
93
|
+
| `think_batch` | Submit a full chain in one request (1-30 thoughts) |
|
|
94
|
+
| `think_done` | Final synthesis/verification gate before final answer |
|
|
95
|
+
| `think_recall` | Search session memory or stored insights |
|
|
96
|
+
| `think_reset` | Reset session state |
|
|
97
|
+
| `think_logic` | Generate a practical analysis methodology |
|
|
98
|
+
| `think_diverge` | Create 2-3 alternative branches from one thought |
|
|
99
|
+
| `get_model_instructions` | Return built-in deep-thinking system prompt |
|
|
100
|
+
|
|
101
|
+
---
|
|
102
|
+
|
|
103
|
+
## Security and Privacy Defaults
|
|
104
|
+
|
|
105
|
+
- Context access is restricted to current workspace.
|
|
106
|
+
- Symlink escapes outside workspace are blocked.
|
|
107
|
+
- Sensitive file names are blocked from context capture.
|
|
108
|
+
- Secret-like values are redacted in captured content.
|
|
109
|
+
- Full context content is opt-in (`includeContextContent: true`).
|
|
110
|
+
- Returned context content is safety-truncated.
|
|
111
|
+
- Exported reports and saved insights are sanitized.
|
|
112
|
+
|
|
113
|
+
Storage behavior:
|
|
114
|
+
- Sessions: `.think/sessions/latest_session.json`
|
|
115
|
+
- Insights: `.think/insights.json`
|
|
116
|
+
- Optional override: `THINK_MCP_STORAGE_DIR`
|
|
117
|
+
|
|
118
|
+
---
|
|
119
|
+
|
|
120
|
+
## Recommended Usage Pattern
|
|
121
|
+
|
|
122
|
+
For heavy tasks, this pattern is the most reliable:
|
|
123
|
+
|
|
124
|
+
1. `think_logic` (map the analysis method)
|
|
125
|
+
2. `think` loop (decompose, validate, branch if needed)
|
|
126
|
+
3. `think_recall` (check prior dead ends/insights)
|
|
127
|
+
4. `think_done` (constraint and risk check)
|
|
128
|
+
5. only then final user answer
|
|
129
|
+
|
|
130
|
+
---
|
|
131
|
+
|
|
132
|
+
## Local Development
|
|
133
|
+
|
|
134
|
+
```bash
|
|
135
|
+
npm ci
|
|
136
|
+
npm run typecheck
|
|
137
|
+
npm test
|
|
138
|
+
npm run build
|
|
139
|
+
npm run audit:prod
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
Optional package check:
|
|
143
|
+
|
|
144
|
+
```bash
|
|
145
|
+
npm pack --dry-run
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
---
|
|
149
|
+
|
|
150
|
+
## Notes for model choice
|
|
151
|
+
|
|
152
|
+
- **Opus-like models**: excellent for architecture and rigorous critique with `think_logic` + `think_done`.
|
|
153
|
+
- **Codex-like models**: strong implementation speed; combine with `think`/`think_done` gates to reduce regressions.
|
|
154
|
+
|
|
155
|
+
---
|
|
156
|
+
|
|
157
|
+
## License
|
|
158
|
+
|
|
159
|
+
MIT
|
|
160
|
+
|
|
161
|
+
---
|
|
162
|
+
|
|
163
|
+
<div align="center">
|
|
164
|
+
<sub>Created by FelKot</sub>
|
|
165
|
+
</div>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pattern constants for content analysis
|
|
3
|
+
* Used by CoachingService and StagnationService
|
|
4
|
+
*/
|
|
5
|
+
export declare const OPTIMIZATION_TRIGGERS: string[];
|
|
6
|
+
export declare const UNCERTAINTY_TRIGGERS: string[];
|
|
7
|
+
export declare const FILLER_PHRASES: string[];
|
|
8
|
+
export declare const LAZY_THINKING_PATTERNS: string[];
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pattern constants for content analysis
|
|
3
|
+
* Used by CoachingService and StagnationService
|
|
4
|
+
*/
|
|
5
|
+
// Proactive Coach patterns for lens recommendations (v2.9.1)
|
|
6
|
+
export const OPTIMIZATION_TRIGGERS = [
|
|
7
|
+
'todo', 'fixme', 'hack', 'потом', 'позже', 'оптимизировать', 'рефакторинг',
|
|
8
|
+
'медленно', 'память', 'performance', 'slow', 'memory', 'refactor', 'cleanup',
|
|
9
|
+
'технический долг', 'tech debt', 'временное решение', 'workaround',
|
|
10
|
+
];
|
|
11
|
+
export const UNCERTAINTY_TRIGGERS = [
|
|
12
|
+
'возможно', 'наверное', 'думаю что', 'скорее всего', 'предполагаю',
|
|
13
|
+
'может быть', 'вероятно', 'не уверен', 'perhaps', 'maybe', 'probably',
|
|
14
|
+
'i think', 'i assume', 'might be', 'could be', 'not sure', 'uncertain',
|
|
15
|
+
];
|
|
16
|
+
// Common filler phrases and stop words to normalize out for stagnation/entropy detection
|
|
17
|
+
export const FILLER_PHRASES = [
|
|
18
|
+
// English filler phrases
|
|
19
|
+
'in this step', 'i will', 'let me', 'now i', 'first', 'next', 'then',
|
|
20
|
+
'carefully', 'analyze', 'consider', 'looking at', 'examining', 'reviewing',
|
|
21
|
+
'based on', 'according to', 'as we can see', 'it appears that',
|
|
22
|
+
// English stop words
|
|
23
|
+
'the', 'a', 'an', 'of', 'is', 'to', 'and', 'or', 'but', 'in', 'on', 'at',
|
|
24
|
+
'for', 'with', 'this', 'that', 'it', 'be', 'are', 'was', 'were', 'been',
|
|
25
|
+
// Russian stop words
|
|
26
|
+
'и', 'в', 'на', 'с', 'по', 'к', 'у', 'о', 'из', 'за', 'от', 'до',
|
|
27
|
+
'то', 'что', 'это', 'как', 'для', 'не', 'но', 'да', 'же', 'ли', 'бы',
|
|
28
|
+
];
|
|
29
|
+
// Patterns indicating lazy/shallow thinking (v5.5.0)
|
|
30
|
+
export const LAZY_THINKING_PATTERNS = [
|
|
31
|
+
'просто', 'легко', 'очевидно', 'банально', 'просто добавлю', 'ничего сложного',
|
|
32
|
+
'simply', 'just', 'obviously', 'trivial', 'basically', 'easy fix', 'straightforward',
|
|
33
|
+
'i will just', 'simple change', 'nothing complex'
|
|
34
|
+
];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const DEEP_THINKING_PROMPT = "You are a Deep Thinking AI. Your goal is to solve problems by thinking deeply, sequentially, and recursively.\n\nCORE MANDATE:\n1. QUALITY OVER SPEED: Take as much time/steps as needed. Never rush.\n2. FIRST ATTEMPT PERFECTION: You must verify your solution until you are 100% certain it is error-free.\n3. MANDATORY SELF-CORRECTION: You cannot finish without a dedicated \"Pre-Mortem\" phase where you try to break your own solution.\n4. RADICAL SKEPTICISM: Assume your first intuition is wrong. Prove it right.\n\nPROCESS:\n1. INITIALIZATION:\n - State the goal clearly.\n - List ALL constraints and edge cases.\n - \"Does this require external tools?\" -> Plan tool usage.\n\n2. STRATEGY (Divergent Thinking):\n - Brainstorm 3 distinct approaches.\n - Critique each approach (Pros/Cons).\n - Select the best one and justify why.\n\n3. EXECUTION (Iterative Refinement):\n - Break the chosen strategy into atomic steps.\n - Execute step-by-step.\n - AFTER EACH STEP: Verify the result. \"Did this work as expected?\"\n - IF ERROR: Stop. Analyze. Fix. Do not patch blindly.\n\n4. VERIFICATION (The \"Pre-Mortem\"):\n - Before saying \"Done\", switch roles to \"The Critic\".\n - Attack your solution: \"Where will this fail?\", \"What edge case did I miss?\", \"Is this the simplest way?\"\n - If flaws are found, return to Execution.\n\n5. CONCLUSION:\n - Summarize the solution.\n - Confirm all constraints are met.\n - Provide the final artifact (code, text, etc.).\n\nTOOLS USAGE:\n- Use 'think' for EVERY step of reasoning.\n- Use 'think_diverge' if you are stuck or need alternatives (required if confidence < 5).\n- Use 'think_logic' to deep-dive into complex logical structures.\n\nWARNINGS:\n- Do not use phrases like \"I hope\", \"I think maybe\". Be precise.\n- Do not skip steps.\n- Do not conclude prematurely. If you have 5 steps, do all 5.";
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
export const DEEP_THINKING_PROMPT = `You are a Deep Thinking AI. Your goal is to solve problems by thinking deeply, sequentially, and recursively.
|
|
2
|
+
|
|
3
|
+
CORE MANDATE:
|
|
4
|
+
1. QUALITY OVER SPEED: Take as much time/steps as needed. Never rush.
|
|
5
|
+
2. FIRST ATTEMPT PERFECTION: You must verify your solution until you are 100% certain it is error-free.
|
|
6
|
+
3. MANDATORY SELF-CORRECTION: You cannot finish without a dedicated "Pre-Mortem" phase where you try to break your own solution.
|
|
7
|
+
4. RADICAL SKEPTICISM: Assume your first intuition is wrong. Prove it right.
|
|
8
|
+
|
|
9
|
+
PROCESS:
|
|
10
|
+
1. INITIALIZATION:
|
|
11
|
+
- State the goal clearly.
|
|
12
|
+
- List ALL constraints and edge cases.
|
|
13
|
+
- "Does this require external tools?" -> Plan tool usage.
|
|
14
|
+
|
|
15
|
+
2. STRATEGY (Divergent Thinking):
|
|
16
|
+
- Brainstorm 3 distinct approaches.
|
|
17
|
+
- Critique each approach (Pros/Cons).
|
|
18
|
+
- Select the best one and justify why.
|
|
19
|
+
|
|
20
|
+
3. EXECUTION (Iterative Refinement):
|
|
21
|
+
- Break the chosen strategy into atomic steps.
|
|
22
|
+
- Execute step-by-step.
|
|
23
|
+
- AFTER EACH STEP: Verify the result. "Did this work as expected?"
|
|
24
|
+
- IF ERROR: Stop. Analyze. Fix. Do not patch blindly.
|
|
25
|
+
|
|
26
|
+
4. VERIFICATION (The "Pre-Mortem"):
|
|
27
|
+
- Before saying "Done", switch roles to "The Critic".
|
|
28
|
+
- Attack your solution: "Where will this fail?", "What edge case did I miss?", "Is this the simplest way?"
|
|
29
|
+
- If flaws are found, return to Execution.
|
|
30
|
+
|
|
31
|
+
5. CONCLUSION:
|
|
32
|
+
- Summarize the solution.
|
|
33
|
+
- Confirm all constraints are met.
|
|
34
|
+
- Provide the final artifact (code, text, etc.).
|
|
35
|
+
|
|
36
|
+
TOOLS USAGE:
|
|
37
|
+
- Use 'think' for EVERY step of reasoning.
|
|
38
|
+
- Use 'think_diverge' if you are stuck or need alternatives (required if confidence < 5).
|
|
39
|
+
- Use 'think_logic' to deep-dive into complex logical structures.
|
|
40
|
+
|
|
41
|
+
WARNINGS:
|
|
42
|
+
- Do not use phrases like "I hope", "I think maybe". Be precise.
|
|
43
|
+
- Do not skip steps.
|
|
44
|
+
- Do not conclude prematurely. If you have 5 steps, do all 5.`;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Configuration constants for ThinkingService
|
|
3
|
+
* Extracted from thinking.service.ts for modularity
|
|
4
|
+
*/
|
|
5
|
+
export declare const RETAIN_FULL_THOUGHTS = 5;
|
|
6
|
+
export declare const RECENT_THOUGHTS_COUNT = 3;
|
|
7
|
+
export declare const RECENT_WEIGHT_MULTIPLIER = 2;
|
|
8
|
+
export declare const STAGNATION_CHECK_COUNT = 3;
|
|
9
|
+
export declare const MIN_ENTROPY_THRESHOLD = 0.25;
|
|
10
|
+
export declare const JACCARD_STAGNATION_BASE = 0.6;
|
|
11
|
+
export declare const JACCARD_STAGNATION_MAX = 0.85;
|
|
12
|
+
export declare const JACCARD_DEPTH_FACTOR = 0.015;
|
|
13
|
+
/**
|
|
14
|
+
* Calculate adaptive stagnation threshold based on session depth
|
|
15
|
+
* Early thoughts: more lenient (0.6), later thoughts: stricter (up to 0.85)
|
|
16
|
+
* Formula: threshold = BASE + min(MAX - BASE, thoughtCount * FACTOR)
|
|
17
|
+
* @param thoughtCount - Number of thoughts in current session
|
|
18
|
+
*/
|
|
19
|
+
export declare function getStagnationThreshold(thoughtCount: number): number;
|
|
20
|
+
export declare const LINEAR_THINKING_THRESHOLD = 6;
|
|
21
|
+
export declare const ESCALATING_PRESSURE_INTERVAL = 3;
|
|
22
|
+
export declare const MAX_THOUGHTS_BUDGET = 12;
|
|
23
|
+
export declare const POLISH_THRESHOLD_CONFIDENCE = 11;
|
|
24
|
+
export declare const INNOVATION_THRESHOLD_THOUGHTS = 20;
|
|
25
|
+
export declare const MIN_THOUGHT_LENGTH = 10;
|
|
26
|
+
export declare const LOW_CONFIDENCE_THRESHOLD = 3;
|
|
27
|
+
export declare const NO_CRITIQUE_THRESHOLD = 20;
|
|
28
|
+
export declare const DEPTH_METRIC_SIMPLE = 10;
|
|
29
|
+
export declare const DEPTH_METRIC_MEDIUM = 50;
|
|
30
|
+
export declare const DEPTH_METRIC_COMPLEX = 100;
|
|
31
|
+
export declare const SESSION_TTL_HOURS = 24;
|
|
32
|
+
export declare const COACH_COOLDOWN_COUNT = 3;
|
|
33
|
+
export declare const SMART_PRUNING_THRESHOLD = 10;
|
|
34
|
+
export declare const MAX_DEAD_ENDS = 20;
|
|
35
|
+
export declare const NEAR_LIMIT_CONFIDENCE_THRESHOLD = 6;
|
|
36
|
+
export declare const RECALL_DEFAULT_LIMIT = 3;
|
|
37
|
+
export declare const RECALL_DEFAULT_THRESHOLD = 0.4;
|
|
38
|
+
export declare const RECALL_SNIPPET_CONTEXT = 100;
|
|
39
|
+
export declare const TECHNICAL_SHORT_TERMS: Set<string>;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Configuration constants for ThinkingService
|
|
3
|
+
* Extracted from thinking.service.ts for modularity
|
|
4
|
+
*/
|
|
5
|
+
// Context retention
|
|
6
|
+
export const RETAIN_FULL_THOUGHTS = 5; // Keep last N thoughts in full detail
|
|
7
|
+
export const RECENT_THOUGHTS_COUNT = 3; // Number of recent thoughts to weight higher
|
|
8
|
+
export const RECENT_WEIGHT_MULTIPLIER = 2; // Weight multiplier for last 3 thoughts in confidence calc
|
|
9
|
+
// Stagnation detection
|
|
10
|
+
export const STAGNATION_CHECK_COUNT = 3; // Check last N thoughts for similarity
|
|
11
|
+
export const MIN_ENTROPY_THRESHOLD = 0.25; // Minimum word entropy before warning
|
|
12
|
+
export const JACCARD_STAGNATION_BASE = 0.6; // Base Jaccard threshold (lenient at start)
|
|
13
|
+
export const JACCARD_STAGNATION_MAX = 0.85; // Maximum threshold (strict at end)
|
|
14
|
+
export const JACCARD_DEPTH_FACTOR = 0.015; // Increase threshold by this per thought
|
|
15
|
+
/**
|
|
16
|
+
* Calculate adaptive stagnation threshold based on session depth
|
|
17
|
+
* Early thoughts: more lenient (0.6), later thoughts: stricter (up to 0.85)
|
|
18
|
+
* Formula: threshold = BASE + min(MAX - BASE, thoughtCount * FACTOR)
|
|
19
|
+
* @param thoughtCount - Number of thoughts in current session
|
|
20
|
+
*/
|
|
21
|
+
export function getStagnationThreshold(thoughtCount) {
|
|
22
|
+
const increase = Math.min(JACCARD_STAGNATION_MAX - JACCARD_STAGNATION_BASE, thoughtCount * JACCARD_DEPTH_FACTOR);
|
|
23
|
+
return JACCARD_STAGNATION_BASE + increase;
|
|
24
|
+
}
|
|
25
|
+
// Lateral thinking triggers
|
|
26
|
+
export const LINEAR_THINKING_THRESHOLD = 6; // Thoughts before lateral thinking warning
|
|
27
|
+
export const ESCALATING_PRESSURE_INTERVAL = 3; // Every N thoughts, increase pressure
|
|
28
|
+
export const MAX_THOUGHTS_BUDGET = 12; // Complexity budget - warn to consolidate after this many thoughts
|
|
29
|
+
// Proactive Coach thresholds
|
|
30
|
+
export const POLISH_THRESHOLD_CONFIDENCE = 11; // Disabled (was 8) - Don't nag if confident
|
|
31
|
+
export const INNOVATION_THRESHOLD_THOUGHTS = 20; // Disabled (was 8) - Don't force innovation
|
|
32
|
+
export const MIN_THOUGHT_LENGTH = 10; // Allow short thoughts (was 50)
|
|
33
|
+
export const LOW_CONFIDENCE_THRESHOLD = 3; // Lower threshold (was 5)
|
|
34
|
+
export const NO_CRITIQUE_THRESHOLD = 20; // Disabled (was 5)
|
|
35
|
+
// Pre-Consolidation Audit thresholds
|
|
36
|
+
export const DEPTH_METRIC_SIMPLE = 10; // Allow quick fixes (was 100)
|
|
37
|
+
export const DEPTH_METRIC_MEDIUM = 50; // (was 150)
|
|
38
|
+
export const DEPTH_METRIC_COMPLEX = 100; // (was 200)
|
|
39
|
+
// Session management
|
|
40
|
+
export const SESSION_TTL_HOURS = 24; // Auto-reset session after this many hours
|
|
41
|
+
export const COACH_COOLDOWN_COUNT = 3; // Don't repeat same advice within N thoughts
|
|
42
|
+
export const SMART_PRUNING_THRESHOLD = 10; // Start pruning context after N thoughts
|
|
43
|
+
// Dead ends tracking
|
|
44
|
+
export const MAX_DEAD_ENDS = 20; // Limit dead ends to prevent memory bloat
|
|
45
|
+
export const NEAR_LIMIT_CONFIDENCE_THRESHOLD = 6; // Warn if near limit with low confidence
|
|
46
|
+
// Recall defaults
|
|
47
|
+
export const RECALL_DEFAULT_LIMIT = 3;
|
|
48
|
+
export const RECALL_DEFAULT_THRESHOLD = 0.4;
|
|
49
|
+
export const RECALL_SNIPPET_CONTEXT = 100; // Characters before/after match for snippet
|
|
50
|
+
// Technical short terms whitelist for entropy calculation (not filtered by length)
|
|
51
|
+
export const TECHNICAL_SHORT_TERMS = new Set([
|
|
52
|
+
'api', 'ui', 'db', 'id', 'io', 'os', 'ip', 'url', 'css', 'sql', 'xml', 'jwt', 'mcp',
|
|
53
|
+
'cli', 'sdk', 'cdn', 'dns', 'ssh', 'ssl', 'tls', 'http', 'json', 'yaml', 'toml',
|
|
54
|
+
]);
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Think Module MCP Server v1.0.0
|
|
4
|
+
* Streamlined thinking tools: 8 tools
|
|
5
|
+
*
|
|
6
|
+
* v1.0.0: Stable public release
|
|
7
|
+
* v4.7.0: Added think_logic for deep logical analysis
|
|
8
|
+
* v4.6.0: Added NudgeService for proactive micro-prompts
|
|
9
|
+
*
|
|
10
|
+
* Tools:
|
|
11
|
+
* - think: Add a thought (with quickExtension for inline critique)
|
|
12
|
+
* - think_batch: Submit multiple thoughts at once
|
|
13
|
+
* - think_done: Finish session, verify, optionally export
|
|
14
|
+
* - think_recall: Search session or past insights
|
|
15
|
+
* - think_reset: Clear session
|
|
16
|
+
* - think_logic: Deep logical analysis of any task/feature/system
|
|
17
|
+
* - think_diverge: Create 2-3 branching alternatives
|
|
18
|
+
* - get_model_instructions: Return deep-thinking system prompt
|
|
19
|
+
*/
|
|
20
|
+
export {};
|