You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 7723e69
Browse filesBrowse the repository at this point in the historyBrowse files
Fix empty thinking on official VS Code extension (--max-thinking-tokens + process-wrapper convention) (#1)
The 2.1.16x VS Code extension signals the VS Code path with --max-thinking-tokens
(not --thinking adaptive) and uses a process-wrapper convention
(<wrapper> <REAL_CLAUDE> <args...>). The launcher now triggers on
--max-thinking-tokens (nonzero) and strips the leading real-binary path
(native claude, or node + cli.js). patch-extension.sh matches the minified
array variable generically (B -> q). Docs cover claudeProcessWrapper
(window-scoped, multi-root note) and the safe undo (clear the setting).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: README.md
+78-31Lines changed: 78 additions & 31 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -47,16 +47,18 @@ No PATH changes are required.
47
47
48
48
1. Open the Command Palette with Ctrl/Cmd + Shift + P.
49
49
2. Select "Preferences: Open User Settings (JSON)".
50
-
3. Add this line, replacing `YOUR_USERNAME`:
50
+
3. Add this line, replacing `YOUR_USERNAME`. This is the official "Claude Code" extension's setting (shown in the UI as "Claude Code: Claude Process Wrapper"):
You can also use the "Claude Code: Claude Process Wrapper" setting in the VS Code app and enter `/home/YOUR_USERNAME/.local/bin/claudemax`.
56
+
If you use the third-party "Claude Code Chat" extension instead, set `"claudeCodeChat.executable.path"` to the same path.
57
57
58
58
4. Reload the VS Code window by opening the Command Palette and selecting "Developer: Reload Window".
59
-
5. To undo the change, point the setting back to your normal `claude` binary and reload.
59
+
5. To undo the change, clear or remove the `claudeCode.claudeProcessWrapper` setting, then reload. Do not point this setting at `claude` directly: under the process-wrapper convention the extension would launch `claude <REAL_CLAUDE> <args...>` and the real CLI would receive its own path as a stray argument. (If you used the third-party `claudeCodeChat.executable.path` instead, that one can simply be pointed back to your normal `claude` binary or removed.)
60
+
61
+
> Multi-root note: `claudeCode.claudeProcessWrapper` is window-scoped. In a single folder, User or Workspace settings both work. In a multi-root `.code-workspace`, set it in the `.code-workspace` file's `"settings"` block (or User settings); VS Code ignores it in a folder's `.vscode/settings.json`.
60
62
61
63
### Use it in a terminal
62
64
@@ -73,14 +75,18 @@ Run `claudemax` in place of `claude`.
73
75
# How it works: the VS Code extension and the headless CLI build the request
74
76
# without thinking.display, so the API defaults to "omitted" and you get empty
75
77
# thinking. This wrapper injects `--thinking-display summarized` into the launch
76
-
# args. That is the one lever that is not interactivity-gated, so summaries
77
-
# render again without editing Claude Code files. It covers the VS Code extension
78
-
# and the headless CLI (`-p` / `--print` / SDK). The interactive terminal already
79
-
# honors the showThinkingSummaries setting and needs no injection.
78
+
# args (the one lever that is NOT interactivity-gated), so summaries render again
79
+
# WITHOUT editing Claude's files, so it keeps working across Claude Code
80
+
# updates. It covers the VS Code extension AND the headless CLI (`-p` / `--print`
81
+
# / SDK). The interactive terminal already honors the showThinkingSummaries
82
+
# setting and needs no injection.
80
83
#
81
84
# Use it:
82
-
# - VS Code: set "claudeCodeChat.executable.path" to the full path of this
83
-
# file, then reload the window.
85
+
# - VS Code (official "Claude Code" extension): set "claudeCode.claudeProcessWrapper"
86
+
# to the FULL path of this file, then reload the window. In a multi-root
87
+
# .code-workspace this setting is window-scoped, so put it in the workspace
88
+
# file's "settings" block (or User settings), not a folder .vscode/settings.json.
89
+
# - VS Code (third-party "Claude Code Chat"): set "claudeCodeChat.executable.path".
84
90
# - Terminal: run `claudemax` in place of `claude`.
85
91
#
86
92
# Toggle off:
@@ -89,15 +95,40 @@ Run `claudemax` in place of `claude`.
89
95
# Default:
90
96
# CC_THINKING_DISPLAY=summarized
91
97
#
92
-
# The real `claude` must be installed. This wrapper finds it automatically. If it
98
+
# The real `claude` must be installed. This wrapper finds it automatically; if it
93
99
# cannot, set CLAUDE_REAL_BIN to the full path of your real claude binary.
94
100
95
101
set -euo pipefail
96
102
97
103
# --- Locate the real claude binary -----------------------------------------
98
104
99
105
self="$(readlink -f "$0"2>/dev/null ||echo"$0")"
106
+
107
+
# Process-wrapper convention: the official VS Code extension invokes the wrapper
108
+
# as <wrapper> <REAL_CLAUDE...> <args...>, passing the real CLI ahead of the
109
+
# args. <REAL_CLAUDE...> is either a single native-binary path (".../claude") or
110
+
# a node interpreter followed by the bundled cli.js (".../node .../cli.js").
111
+
# Peel that off so it is not forwarded as a stray positional argument, and
112
+
# prefer it as the real claude. (Plain "claudemax <args>" use is unaffected:
113
+
# <args> never begins with an existing claude/node binary path.)
@@ -202,12 +241,14 @@ The same result can be achieved by using a compiled `.exe` version of the wrappe
202
241
1. Download `claudemax.exe` from this repository's [Releases](../../releases), or build it yourself by following [Building claudemax.exe](#building-claudemaxexe).
203
242
2. Put `claudemax.exe` somewhere stable, such as `C:\Users\YOU\.local\bin\claudemax.exe`.
204
243
3. Open the Command Palette and select "Preferences: Open User Settings (JSON)".
205
-
4. Add the following setting. Use double backslashes in the path.
244
+
4. Add the following setting (the official "Claude Code" extension setting). Use double backslashes in the path.
If you use the third-party "Claude Code Chat" extension instead, set `"claudeCodeChat.executable.path"` to the same path. In a multi-root `.code-workspace`, put `claudeCode.claudeProcessWrapper` in the workspace file's `"settings"` block or in User settings, not a folder's `.vscode/settings.json`.
251
+
211
252
5. Reload the VS Code window by opening the Command Palette and selecting "Developer: Reload Window".
212
253
6. To use it in a terminal, run `claudemax.exe` in place of `claude`.
213
254
@@ -222,13 +263,13 @@ The launcher reads one environment variable, `CC_THINKING_DISPLAY`:
222
263
* unset or `summarized`: show thinking summaries, which is the default
223
264
*`omitted`: hide thinking summaries
224
265
225
-
Set the variable in the same environment where Claude Code launches, such as your shell profile or the VS Code extension environment, then reload. To disable the launcher entirely, point the VS Code setting back to your normal `claude`binary.
266
+
Set the variable in the same environment where Claude Code launches, such as your shell profile or the VS Code extension environment, then reload. To disable the launcher entirely, clear or remove the `claudeCode.claudeProcessWrapper` setting (do not point it at `claude`, for the reason in the undo note above); if you used `claudeCodeChat.executable.path`, point it back to `claude`or remove it.
226
267
227
268
### What the launcher does
228
269
229
-
Claude Code already puts `--thinking adaptive`, `-p`, or `--print` on the command line when it starts a real agent run. It does not add the matching `--thinking-display` flag, so the API defaults the display to `"omitted"` and the Thinking section comes back empty.
270
+
When Claude Code starts a real agent run it puts one of these markers on the command line: `--max-thinking-tokens N` (the current VS Code extension's budget thinking mode), `--thinking adaptive` or `enabled` (the SDK and older extensions), or `-p` / `--print` (headless). It does not add the matching `--thinking-display` flag, so the API defaults the display to `"omitted"` and the Thinking section comes back empty.
230
271
231
-
The launcher inspects the arguments and, when it detects a real run, appends `--thinking-display summarized` before handing off to the real `claude` binary. See [Technical details](#technical-details) and [TECHNICAL.md](TECHNICAL.md) for more information.
272
+
The launcher inspects the arguments and, when it detects a real run via any of those markers, appends `--thinking-display summarized` before handing off to the real `claude` binary. The official extension also launches the wrapper with the real CLI path as a leading argument (a "process wrapper" convention); the launcher detects and consumes that path so it is not forwarded as a stray positional. See [Technical details](#technical-details) and [TECHNICAL.md](TECHNICAL.md) for more information.
> The extension is minified, so the array variable name varies by build (`B` in 2.0.x, `q` in 2.1.16x, and so on). Match the surrounding text and keep whatever variable name your build uses; `patch-extension.sh` does this automatically. This version fragility is one reason Option 1 is preferred.
296
+
254
297
### Automatic patching on Linux, macOS, WSL, or Git Bash
255
298
256
299
[`patch-extension.sh`](patch-extension.sh) finds every installed Claude Code extension, backs each one up, and applies the patch:
The setting-to-display mapping is gated on `isInteractive`. The VS Code extension launches the CLI non-interactively with `--input-format stream-json`, so that branch never runs. The extension only forwards `--thinking-display` when its own `display` value is already set:
414
+
The setting-to-display mapping is gated on `isInteractive`. The VS Code extension launches the CLI non-interactively with `--input-format stream-json`, so that branch never runs. The extension only forwards `--thinking-display` when its own `display` value is already set (the array variable is minified, shown here as `q`, as in extension 2.1.16x):
372
415
373
416
```js
374
417
// extension.js, simplified:
375
-
if (l.type!=="disabled"&&l.display) B.push("--thinking-display", l.display);
418
+
if (l.type!=="disabled"&&l.display) q.push("--thinking-display", l.display);
376
419
```
377
420
378
421
`l.display` is never populated from `showThinkingSummaries`; the literal string `"summarized"` appears zero times in `extension.js`. The result on the extension and headless paths is that `display` is never sent, the API omits summaries, and the Thinking section is empty even with `showThinkingSummaries:true`.
379
422
423
+
The current extension signals a real run on the VS Code path with `--max-thinking-tokens <budgetTokens>` (its budget thinking mode) rather than `--thinking adaptive`, and it launches a configured `claudeProcessWrapper` with the real CLI path as a leading argument. Both matter for the launcher: it triggers on `--max-thinking-tokens` and strips the leading binary path.
424
+
380
425
The ungated lever is the `--thinking-display summarized` CLI flag, which works headless. Each fix in this repository forces that flag, or the equivalent request field, to be present.
381
426
382
427
### Behavior matrix
@@ -387,14 +432,16 @@ The ungated lever is the `--thinking-display summarized` CLI flag, which works h
387
432
| `claude -p` / headless / SDK | Ignored because it is non-interactive | Works |
388
433
| VS Code extension | Ignored because it is non-interactive and never mapped | Works, but the extension does not send it by default |
389
434
435
+
> On the VS Code path the current extension signals a real run with `--max-thinking-tokens`, not `--thinking adaptive`, and launches the wrapper with the real CLI path as a leading argument. The launcher handles both.
436
+
390
437
### How each option applies the lever
391
438
392
-
* **Option 1: Launcher.** Appends `--thinking-display summarized` to the arguments before executing the real CLI. It operates outside the app, survives updates, and covers VS Code plus headless runs.
393
-
* **Option 2: Patch.** Changes the extension so it always forwards the flag with `l.display||"summarized"`. It modifies the bundle, is wiped by updates, and fixes VS Code only.
439
+
* **Option 1: Launcher.** Appends `--thinking-display summarized` to the arguments before executing the real CLI, triggering on `--max-thinking-tokens` (nonzero), `--thinking adaptive`/`enabled`, or `-p`/`--print`, and stripping the leading real-binary path the official extension passes. It operates outside the app, survives updates, and covers VS Code plus headless runs.
440
+
* **Option 2: Patch.** Changes the extension so it always forwards the flag with `l.display||"summarized"`. It modifies the bundle, is wiped by updates, is fragile against the minified variable rename (`B`, `q`, ...), and fixes VS Code only.
394
441
* **Option 3: Proxy.** Sets `body.thinking.display="summarized"` on the wire for every `/v1/messages` request. It is surface-agnostic.
395
442
396
443
For the live A/B confirmation, deeper design notes, proxy security model, and notes on summary length versus effort level, see [TECHNICAL.md](TECHNICAL.md).
397
444
398
445
## Confirmation
399
446
400
-
Confirmed on Opus 4.7 and Opus 4.8 with native-installer CLI `2.1.166`and VS Code extension `2.1.165` / `2.1.167`, on Windows 11 and Ubuntu 24.04. Behavior may change in future Claude Code releases.
447
+
Confirmed on Opus 4.7 and Opus 4.8 with VS Code extension `2.1.169` (native-binary CLI), via the `claudeCode.claudeProcessWrapper` setting, on Windows 11 and Ubuntu 24.04. Earlier builds (`2.1.165` / `2.1.167`) signaled thinking with `--thinking adaptive`; `2.1.169` uses `--max-thinking-tokens` on the VS Code path. Behavior may change in future Claude Code releases.
0 commit comments