@link-assistant/hive-mind 1.17.1 → 1.17.2

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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @link-assistant/hive-mind
2
2
 
3
+ ## 1.17.2
4
+
5
+ ### Patch Changes
6
+
7
+ - ae013b3: Default thinking budget to zero (thinking disabled by default), align Opus 4.6 max thinking budget with standard models (31999), change `opus` alias to map to Opus 4.5 by default (supports both `opus-4-5` and `opus-4-6` aliases)
8
+
3
9
  ## 1.17.1
4
10
 
5
11
  ### Patch Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@link-assistant/hive-mind",
3
- "version": "1.17.1",
3
+ "version": "1.17.2",
4
4
  "description": "AI-powered issue solver and hive mind for collaborative problem solving",
5
5
  "main": "src/hive.mjs",
6
6
  "type": "module",
@@ -911,23 +911,20 @@ export const executeClaudeCommand = async params => {
911
911
  try {
912
912
  // Resolve thinking settings (handles translation between --think and --thinking-budget based on Claude version)
913
913
  // See issue #1146 for details on thinking budget translation
914
- const { thinkingBudget: resolvedThinkingBudget, thinkLevel, isNewVersion } = await resolveThinkingSettings(argv, log);
914
+ const { thinkingBudget: resolvedThinkingBudget, thinkLevel, isNewVersion, maxBudget } = await resolveThinkingSettings(argv, log);
915
915
 
916
916
  // Set CLAUDE_CODE_MAX_OUTPUT_TOKENS (see issue #1076), MAX_THINKING_TOKENS (see issue #1146),
917
- // and MCP timeout configurations (see issue #1066)
917
+ // MCP timeout configurations (see issue #1066), and CLAUDE_CODE_EFFORT_LEVEL for Opus 4.6 (Issue #1238)
918
918
  // Pass model for model-specific max output tokens (Issue #1221)
919
- const claudeEnv = getClaudeEnv({ thinkingBudget: resolvedThinkingBudget, model: mappedModel });
919
+ // Pass thinkLevel and maxBudget for Opus 4.6 effort level conversion (Issue #1238)
920
+ const claudeEnv = getClaudeEnv({ thinkingBudget: resolvedThinkingBudget, model: mappedModel, thinkLevel, maxBudget });
920
921
  const modelMaxOutputTokens = getMaxOutputTokensForModel(mappedModel);
921
922
  if (argv.verbose) await log(`📊 CLAUDE_CODE_MAX_OUTPUT_TOKENS: ${modelMaxOutputTokens}`, { verbose: true });
922
923
  if (argv.verbose) await log(`📊 MCP_TIMEOUT: ${claudeCode.mcpTimeout}ms (server startup)`, { verbose: true });
923
924
  if (argv.verbose) await log(`📊 MCP_TOOL_TIMEOUT: ${claudeCode.mcpToolTimeout}ms (tool execution)`, { verbose: true });
924
- if (resolvedThinkingBudget !== undefined) {
925
- await log(`📊 MAX_THINKING_TOKENS: ${resolvedThinkingBudget}`, { verbose: true });
926
- }
927
- // Log thinking level for older Claude Code versions that use thinking keywords
928
- if (!isNewVersion && thinkLevel) {
929
- await log(`📊 Thinking level (via keywords): ${thinkLevel}`, { verbose: true });
930
- }
925
+ if (resolvedThinkingBudget !== undefined) await log(`📊 MAX_THINKING_TOKENS: ${resolvedThinkingBudget}`, { verbose: true });
926
+ if (claudeEnv.CLAUDE_CODE_EFFORT_LEVEL) await log(`📊 CLAUDE_CODE_EFFORT_LEVEL: ${claudeEnv.CLAUDE_CODE_EFFORT_LEVEL}`, { verbose: true });
927
+ if (!isNewVersion && thinkLevel) await log(`📊 Thinking level (via keywords): ${thinkLevel}`, { verbose: true });
931
928
  if (argv.resume) {
932
929
  // When resuming, pass prompt directly with -p flag. Escape double quotes for shell.
933
930
  const simpleEscapedPrompt = prompt.replace(/"/g, '\\"');
@@ -119,21 +119,24 @@ export const claudeCode = {
119
119
  // Can be overridden via --max-thinking-budget option
120
120
  export const DEFAULT_MAX_THINKING_BUDGET = 31999;
121
121
 
122
- // Default max thinking budget for Opus 4.6 (Issue #1221)
123
- // Opus 4.6 supports higher thinking budgets due to 128K max output tokens
122
+ // Default max thinking budget for Opus 4.6 (Issue #1221, updated in Issue #1238)
123
+ // Aligned with standard models (31999) for consistency.
124
+ // Opus 4.6 uses CLAUDE_CODE_EFFORT_LEVEL for thinking depth instead of MAX_THINKING_TOKENS
125
+ // (MAX_THINKING_TOKENS is ignored for Opus 4.6 unless set to 0 to disable thinking).
124
126
  // Can be overridden via --max-thinking-budget option or HIVE_MIND_MAX_THINKING_BUDGET_OPUS_46
125
- export const DEFAULT_MAX_THINKING_BUDGET_OPUS_46 = parseIntWithDefault('HIVE_MIND_MAX_THINKING_BUDGET_OPUS_46', 64000);
127
+ export const DEFAULT_MAX_THINKING_BUDGET_OPUS_46 = parseIntWithDefault('HIVE_MIND_MAX_THINKING_BUDGET_OPUS_46', 31999);
126
128
 
127
129
  /**
128
- * Check if a model is Opus 4.6 or later (Issue #1221)
130
+ * Check if a model is Opus 4.6 or later (Issue #1221, updated in Issue #1238)
129
131
  * @param {string} model - The model name or ID
130
132
  * @returns {boolean} True if the model is Opus 4.6 or later
131
133
  */
132
134
  export const isOpus46OrLater = model => {
133
135
  if (!model) return false;
134
136
  const normalizedModel = model.toLowerCase();
135
- // Check for opus alias (which maps to 4.6) or explicit opus-4-6
136
- return normalizedModel === 'opus' || normalizedModel.includes('opus-4-6') || normalizedModel.includes('opus-4-7') || normalizedModel.includes('opus-5');
137
+ // Check for explicit opus-4-6 or later versions
138
+ // Note: The 'opus' alias now maps to Opus 4.5 (Issue #1238), so we only check explicit version identifiers
139
+ return normalizedModel.includes('opus-4-6') || normalizedModel.includes('opus-4-7') || normalizedModel.includes('opus-5');
137
140
  };
138
141
 
139
142
  /**
@@ -202,6 +205,59 @@ export const getTokensToThinkingLevel = (maxBudget = DEFAULT_MAX_THINKING_BUDGET
202
205
  // Default tokens to thinking level function (using default max budget)
203
206
  export const tokensToThinkingLevel = getTokensToThinkingLevel(DEFAULT_MAX_THINKING_BUDGET);
204
207
 
208
+ /**
209
+ * Valid effort levels for Opus 4.6 (Issue #1238)
210
+ * Opus 4.6 uses CLAUDE_CODE_EFFORT_LEVEL for thinking depth control
211
+ * @type {string[]}
212
+ */
213
+ export const OPUS_46_EFFORT_LEVELS = ['low', 'medium', 'high'];
214
+
215
+ /**
216
+ * Convert thinking level to Opus 4.6 effort level (Issue #1238)
217
+ * Opus 4.6 uses CLAUDE_CODE_EFFORT_LEVEL (low/medium/high) instead of MAX_THINKING_TOKENS
218
+ * @param {string|undefined} thinkLevel - The thinking level (off/low/medium/high/max)
219
+ * @returns {string|undefined} The effort level (low/medium/high) or undefined if thinking is off
220
+ */
221
+ export const thinkLevelToEffortLevel = thinkLevel => {
222
+ if (!thinkLevel || thinkLevel === 'off') {
223
+ // No effort level when thinking is disabled
224
+ return undefined;
225
+ }
226
+
227
+ // Map hive-mind thinking levels to Opus 4.6 effort levels
228
+ // Note: Opus 4.6 only supports low/medium/high, not 'max'
229
+ // We map 'max' to 'high' as it's the highest available level
230
+ switch (thinkLevel) {
231
+ case 'low':
232
+ return 'low';
233
+ case 'medium':
234
+ return 'medium';
235
+ case 'high':
236
+ case 'max':
237
+ return 'high';
238
+ default:
239
+ return undefined;
240
+ }
241
+ };
242
+
243
+ /**
244
+ * Convert thinking budget (tokens) to Opus 4.6 effort level (Issue #1238)
245
+ * Uses token thresholds to determine the appropriate effort level
246
+ * @param {number|undefined} thinkingBudget - The thinking budget in tokens
247
+ * @param {number} maxBudget - Maximum thinking budget (default: 31999)
248
+ * @returns {string|undefined} The effort level (low/medium/high) or undefined if thinking is off
249
+ */
250
+ export const thinkingBudgetToEffortLevel = (thinkingBudget, maxBudget = DEFAULT_MAX_THINKING_BUDGET) => {
251
+ if (thinkingBudget === undefined || thinkingBudget === 0) {
252
+ // No effort level when thinking is disabled
253
+ return undefined;
254
+ }
255
+
256
+ // Convert tokens to thinking level, then to effort level
257
+ const thinkLevel = getTokensToThinkingLevel(maxBudget)(thinkingBudget);
258
+ return thinkLevelToEffortLevel(thinkLevel);
259
+ };
260
+
205
261
  // Check if a version supports thinking budget (>= minimum version)
206
262
  // Uses semver npm package for reliable version comparison (see issue #1146)
207
263
  export const supportsThinkingBudget = (version, minVersion = '2.1.12') => {
@@ -221,6 +277,7 @@ export const supportsThinkingBudget = (version, minVersion = '2.1.12') => {
221
277
  // Optionally sets MAX_THINKING_TOKENS when thinkingBudget is provided (see issue #1146)
222
278
  // Also sets MCP_TIMEOUT and MCP_TOOL_TIMEOUT for MCP tool execution (see issue #1066)
223
279
  // Supports model-specific max output tokens for Opus 4.6 (Issue #1221)
280
+ // Sets CLAUDE_CODE_EFFORT_LEVEL for Opus 4.6 models (Issue #1238)
224
281
  export const getClaudeEnv = (options = {}) => {
225
282
  // Get max output tokens based on model (Issue #1221)
226
283
  const maxOutputTokens = options.model ? getMaxOutputTokensForModel(options.model) : claudeCode.maxOutputTokens;
@@ -235,12 +292,29 @@ export const getClaudeEnv = (options = {}) => {
235
292
  MCP_TIMEOUT: String(claudeCode.mcpTimeout),
236
293
  MCP_TOOL_TIMEOUT: String(claudeCode.mcpToolTimeout),
237
294
  };
238
- // Set MAX_THINKING_TOKENS if thinkingBudget is provided
239
- // This controls Claude Code's extended thinking feature (Claude Code >= 2.1.12)
240
- // Default is 31999 (or 64000 for Opus 4.6), set to 0 to disable thinking
241
- if (options.thinkingBudget !== undefined) {
242
- env.MAX_THINKING_TOKENS = String(options.thinkingBudget);
295
+
296
+ // Set MAX_THINKING_TOKENS to control Claude Code's extended thinking feature (Claude Code >= 2.1.12)
297
+ // Default is 0 (thinking disabled) per Issue #1238. Set to 0 to disable thinking.
298
+ // Users can explicitly enable thinking via --think or --thinking-budget options.
299
+ env.MAX_THINKING_TOKENS = String(options.thinkingBudget ?? 0);
300
+
301
+ // For Opus 4.6+, also set CLAUDE_CODE_EFFORT_LEVEL to control thinking depth (Issue #1238)
302
+ // Opus 4.6 uses effort level (low/medium/high) instead of MAX_THINKING_TOKENS for thinking depth.
303
+ // MAX_THINKING_TOKENS is only used to disable thinking (when set to 0).
304
+ if (options.model && isOpus46OrLater(options.model)) {
305
+ // Convert thinkLevel or thinkingBudget to effort level
306
+ let effortLevel;
307
+ if (options.thinkLevel) {
308
+ effortLevel = thinkLevelToEffortLevel(options.thinkLevel);
309
+ } else if (options.thinkingBudget !== undefined && options.thinkingBudget > 0) {
310
+ effortLevel = thinkingBudgetToEffortLevel(options.thinkingBudget, options.maxBudget);
311
+ }
312
+
313
+ if (effortLevel) {
314
+ env.CLAUDE_CODE_EFFORT_LEVEL = effortLevel;
315
+ }
243
316
  }
317
+
244
318
  return env;
245
319
  };
246
320
 
@@ -6,10 +6,10 @@
6
6
  */
7
7
 
8
8
  // Claude models (Anthropic API)
9
- // Updated for Opus 4.6 support (Issue #1221)
9
+ // Updated for Opus 4.5/4.6 support (Issue #1221, Issue #1238)
10
10
  export const claudeModels = {
11
11
  sonnet: 'claude-sonnet-4-5-20250929', // Sonnet 4.5
12
- opus: 'claude-opus-4-6', // Opus 4.6 (latest)
12
+ opus: 'claude-opus-4-5-20251101', // Opus 4.5 (default, Issue #1238)
13
13
  haiku: 'claude-haiku-4-5-20251001', // Haiku 4.5
14
14
  'haiku-3-5': 'claude-3-5-haiku-20241022', // Haiku 3.5
15
15
  'haiku-3': 'claude-3-haiku-20240307', // Haiku 3
@@ -15,7 +15,7 @@ import { log } from './lib.mjs';
15
15
  export const CLAUDE_MODELS = {
16
16
  // Short aliases (single word)
17
17
  sonnet: 'claude-sonnet-4-5-20250929',
18
- opus: 'claude-opus-4-6', // Updated to Opus 4.6 (Issue #1221)
18
+ opus: 'claude-opus-4-5-20251101', // Changed to Opus 4.5 (Issue #1238)
19
19
  haiku: 'claude-haiku-4-5-20251001',
20
20
  'haiku-3-5': 'claude-3-5-haiku-20241022',
21
21
  'haiku-3': 'claude-3-haiku-20240307',
@@ -25,8 +25,8 @@ export const CLAUDE_MODELS = {
25
25
  'sonnet-4-5': 'claude-sonnet-4-5-20250929', // Sonnet 4.5 short alias
26
26
  'haiku-4-5': 'claude-haiku-4-5-20251001', // Haiku 4.5 short alias
27
27
  // Opus version aliases (Issue #1221)
28
- 'claude-opus-4-6': 'claude-opus-4-6', // Latest Opus
29
- 'claude-opus-4-5': 'claude-opus-4-5-20251101', // Backward compatibility alias
28
+ 'claude-opus-4-6': 'claude-opus-4-6', // Opus 4.6
29
+ 'claude-opus-4-5': 'claude-opus-4-5-20251101', // Opus 4.5
30
30
  // Sonnet version aliases
31
31
  'claude-sonnet-4-5': 'claude-sonnet-4-5-20250929',
32
32
  // Haiku version aliases
@@ -39,15 +39,17 @@ export const CLAUDE_MODELS = {
39
39
  'claude-3-haiku-20240307': 'claude-3-haiku-20240307',
40
40
  };
41
41
 
42
- // Models that support 1M token context window via [1m] suffix (Issue #1221)
42
+ // Models that support 1M token context window via [1m] suffix (Issue #1221, Issue #1238)
43
43
  // See: https://code.claude.com/docs/en/model-config
44
44
  export const MODELS_SUPPORTING_1M_CONTEXT = [
45
45
  'claude-opus-4-6',
46
+ 'claude-opus-4-5-20251101',
46
47
  'claude-sonnet-4-5-20250929',
47
48
  'claude-sonnet-4-5',
48
49
  'sonnet',
49
50
  'opus',
50
51
  'opus-4-6', // Short alias (Issue #1221 - PR comment feedback)
52
+ 'opus-4-5', // Short alias (Issue #1238)
51
53
  'sonnet-4-5', // Short alias (Issue #1221 - PR comment feedback)
52
54
  ];
53
55
 
@@ -220,7 +220,7 @@ export const SOLVE_OPTION_DEFINITIONS = {
220
220
  },
221
221
  'thinking-budget': {
222
222
  type: 'number',
223
- description: 'Thinking token budget for Claude Code (0-63999). Controls MAX_THINKING_TOKENS. Default: 31999 (Claude default). Set to 0 to disable thinking. For older Claude Code versions, translated back to --think level.',
223
+ description: 'Thinking token budget for Claude Code (0-31999). Controls MAX_THINKING_TOKENS. Default: 0 (thinking disabled). For older Claude Code versions, translated back to --think level.',
224
224
  default: undefined,
225
225
  },
226
226
  'thinking-budget-claude-minimum-version': {