@link-assistant/hive-mind 1.0.2 → 1.0.3

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,18 @@
1
1
  # @link-assistant/hive-mind
2
2
 
3
+ ## 1.0.3
4
+
5
+ ### Patch Changes
6
+
7
+ - 26b69f2: Fix Claude Code output token limit by setting CLAUDE_CODE_MAX_OUTPUT_TOKENS to 64000
8
+ - Claude Code CLI defaults to 32K output token limit, but Claude Sonnet/Opus/Haiku 4.5 models support 64K
9
+ - Added `claudeCode.maxOutputTokens` configuration in `config.lib.mjs` (default: 64000)
10
+ - Pass `CLAUDE_CODE_MAX_OUTPUT_TOKENS` environment variable when executing Claude CLI
11
+ - Configuration can be overridden via `CLAUDE_CODE_MAX_OUTPUT_TOKENS` or `HIVE_MIND_CLAUDE_CODE_MAX_OUTPUT_TOKENS` environment variables
12
+ - Added comprehensive case study analysis in `docs/case-studies/issue-1076/`
13
+
14
+ See: https://github.com/link-assistant/hive-mind/issues/1076
15
+
3
16
  ## 1.0.2
4
17
 
5
18
  ### Patch Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@link-assistant/hive-mind",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "description": "AI-powered issue solver and hive mind for collaborative problem solving",
5
5
  "main": "src/hive.mjs",
6
6
  "type": "module",
@@ -10,7 +10,7 @@ const path = (await use('path')).default;
10
10
  // Import log from general lib
11
11
  import { log, cleanErrorMessage } from './lib.mjs';
12
12
  import { reportError } from './sentry.lib.mjs';
13
- import { timeouts, retryLimits } from './config.lib.mjs';
13
+ import { timeouts, retryLimits, claudeCode, getClaudeEnv } from './config.lib.mjs';
14
14
  import { detectUsageLimit, formatUsageLimitMessage } from './usage-limit.lib.mjs';
15
15
  import { createInteractiveHandler } from './interactive-mode.lib.mjs';
16
16
  import { displayBudgetStats } from './claude.budget-stats.lib.mjs';
@@ -931,24 +931,17 @@ export const executeClaudeCommand = async params => {
931
931
  await log('', { verbose: true });
932
932
  }
933
933
  try {
934
+ const claudeEnv = getClaudeEnv(); // Set CLAUDE_CODE_MAX_OUTPUT_TOKENS (see issue #1076)
935
+ if (argv.verbose) await log(`📊 CLAUDE_CODE_MAX_OUTPUT_TOKENS: ${claudeCode.maxOutputTokens}`, { verbose: true });
934
936
  if (argv.resume) {
935
- // When resuming, pass prompt directly with -p flag
936
- // Use simpler escaping - just escape double quotes
937
+ // When resuming, pass prompt directly with -p flag. Escape double quotes for shell.
937
938
  const simpleEscapedPrompt = prompt.replace(/"/g, '\\"');
938
939
  const simpleEscapedSystem = systemPrompt.replace(/"/g, '\\"');
939
- execCommand = $({
940
- cwd: tempDir,
941
- mirror: false,
942
- })`${claudePath} --resume ${argv.resume} --output-format stream-json --verbose --dangerously-skip-permissions --model ${mappedModel} -p "${simpleEscapedPrompt}" --append-system-prompt "${simpleEscapedSystem}"`;
940
+ execCommand = $({ cwd: tempDir, mirror: false, env: claudeEnv })`${claudePath} --resume ${argv.resume} --output-format stream-json --verbose --dangerously-skip-permissions --model ${mappedModel} -p "${simpleEscapedPrompt}" --append-system-prompt "${simpleEscapedSystem}"`;
943
941
  } else {
944
- // When not resuming, pass prompt via stdin
945
- // For system prompt, escape it properly for shell - just escape double quotes
942
+ // When not resuming, pass prompt via stdin. Escape double quotes for shell.
946
943
  const simpleEscapedSystem = systemPrompt.replace(/"/g, '\\"');
947
- execCommand = $({
948
- cwd: tempDir,
949
- stdin: prompt,
950
- mirror: false,
951
- })`${claudePath} --output-format stream-json --verbose --dangerously-skip-permissions --model ${mappedModel} --append-system-prompt "${simpleEscapedSystem}"`;
944
+ execCommand = $({ cwd: tempDir, stdin: prompt, mirror: false, env: claudeEnv })`${claudePath} --output-format stream-json --verbose --dangerously-skip-permissions --model ${mappedModel} --append-system-prompt "${simpleEscapedSystem}"`;
952
945
  }
953
946
  await log(`${formatAligned('📋', 'Command details:', '')}`);
954
947
  await log(formatAligned('📂', 'Working directory:', tempDir, 2));
@@ -78,6 +78,20 @@ export const retryLimits = {
78
78
  initial503RetryDelayMs: parseIntWithDefault('HIVE_MIND_INITIAL_503_RETRY_DELAY_MS', 5 * 60 * 1000), // 5 minutes
79
79
  };
80
80
 
81
+ // Claude Code CLI configurations
82
+ // See: https://github.com/link-assistant/hive-mind/issues/1076
83
+ // Claude models support up to 64K output tokens, but Claude Code CLI defaults to 32K
84
+ // Setting a higher limit allows Claude to generate longer responses without hitting the limit
85
+ export const claudeCode = {
86
+ // Maximum output tokens for Claude Code CLI responses
87
+ // Default: 64000 (matches Claude Sonnet/Opus/Haiku 4.5 model capabilities)
88
+ // Set via CLAUDE_CODE_MAX_OUTPUT_TOKENS or HIVE_MIND_CLAUDE_CODE_MAX_OUTPUT_TOKENS
89
+ maxOutputTokens: parseIntWithDefault('CLAUDE_CODE_MAX_OUTPUT_TOKENS', parseIntWithDefault('HIVE_MIND_CLAUDE_CODE_MAX_OUTPUT_TOKENS', 64000)),
90
+ };
91
+
92
+ // Helper function to get Claude CLI environment with CLAUDE_CODE_MAX_OUTPUT_TOKENS set
93
+ export const getClaudeEnv = () => ({ ...process.env, CLAUDE_CODE_MAX_OUTPUT_TOKENS: String(claudeCode.maxOutputTokens) });
94
+
81
95
  // Cache TTL configurations (in milliseconds)
82
96
  // The Usage API (Claude limits) has stricter rate limiting than regular APIs
83
97
  // See: https://github.com/link-assistant/hive-mind/issues/1074
@@ -190,6 +204,7 @@ export function getAllConfigurations() {
190
204
  githubLimits,
191
205
  systemLimits,
192
206
  retryLimits,
207
+ claudeCode,
193
208
  cacheTtl,
194
209
  filePaths,
195
210
  textProcessing,