Skip to content

Commit c7698f0

Browse files
phase3devclaude
andcommitted
docs: launcher README, per-fix READMEs with Maintenance Contracts, fix template
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent c90b94c commit c7698f0

4 files changed

Lines changed: 178 additions & 0 deletions

File tree

‎fixes/_template/README.md‎

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# <fix-name>
2+
3+
> Copy this folder to `fixes/<fix-name>/` to start a new fix.
4+
5+
## What it fixes
6+
7+
<symptom the user sees, and where (VS Code extension / headless / SDK)>
8+
9+
## Standalone usage
10+
11+
<the one-shot tool in this folder, with example commands and --revert>
12+
13+
## Launcher toggle
14+
15+
<the CC_PATCH_<NAME> env var, default, and what 0 does>
16+
17+
## Maintenance Contract
18+
19+
- Anchors / selectors: <exact stable string(s) or class prefixes this fix keys off>
20+
- Ownership marker: <the sentinel/marker this fix's apply embeds, e.g. `/* cc-<name> v1 */`>
21+
- Failure mode if an anchor moves: <what happens - must fail safe / no-op, never corrupt>
22+
- Launcher registry entry: <feature id, the file(s) it touches, apply/undo summary>
23+
- Test fixture: <the test(s) in tests/ that cover this fix>

‎fixes/context-icon/README.md‎

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# context-icon
2+
3+
## What it fixes
4+
5+
Restores the always-visible context-usage icon in the VS Code chat input.
6+
Extension builds 2.1.165+ hide that icon until you have used more than 50% of the
7+
context window. With the 1M context window that is ~500k tokens, so it is
8+
effectively never shown. This fix flips the threshold so the icon renders
9+
whenever a context window is known, at any usage level.
10+
11+
## Standalone usage
12+
13+
```
14+
python3 fixes/context-icon/fix-context-icon.py # auto-discover & patch all installs
15+
python3 fixes/context-icon/fix-context-icon.py --revert # restore from .bak-context-icon
16+
python3 fixes/context-icon/fix-context-icon.py /path/to/webview/index.js # explicit target(s)
17+
```
18+
19+
The patch is idempotent and atomic (same-directory temp + replace, owner/group/
20+
mode preserved). VS Code auto-updates the extension and an update reinstalls a
21+
fresh bundle, so re-run after updates (or use the launcher, which re-applies on
22+
every launch). After patching, reload the webview: Command Palette ->
23+
"Developer: Reload Window".
24+
25+
## Launcher toggle
26+
27+
`CC_PATCH_CONTEXT_ICON` (default `1`). `0` leaves the icon unpatched, and the
28+
launcher reverts our edit on the next launch.
29+
30+
## Maintenance Contract
31+
32+
- Anchors / selectors: `>=50)return null}` (component `FJe` in `webview/index.js`).
33+
- Ownership marker: `/*ccwa-context-icon*/`. Apply rewrites `>=50)return null}` ->
34+
`>=101)return null}/*ccwa-context-icon*/`; undo reverses only that marked form.
35+
- Failure mode if an anchor moves: if the anchor string changes, apply no-ops with
36+
a one-line warning (the icon goes missing again) until the anchor is updated. A
37+
bare upstream `>=101)return null}` with no marker is never touched.
38+
- Launcher registry entry: feature id `context-icon`, file `webview/index.js`,
39+
apply = marked swap, undo = reverse of the marked form only.
40+
- Test fixture: `tests/test_reconcile.py` (launcher engine, both platforms) and
41+
`tests/test_regressions.py::PatcherRegressionTests` (standalone patcher).

‎fixes/thinking-summaries/README.md‎

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# thinking-summaries
2+
3+
## What it fixes
4+
5+
Restores extended-thinking summaries on Opus 4.7 / 4.8, where the "Thinking"
6+
section otherwise renders empty in the VS Code extension and in headless `-p` /
7+
SDK runs. The fix injects `--thinking-display summarized` into the launch args -
8+
the one lever that is not interactivity-gated. It edits no files.
9+
10+
## Standalone usage
11+
12+
The launcher (option 1) is what most people want. These standalone tools cover
13+
the other delivery paths:
14+
15+
```
16+
./patch-extension.sh # idempotent edit to the extension's extension.js
17+
./patch-extension.sh --revert # restore the most recent .bak
18+
./patch-extension.sh --dry-run # show what would change, touch nothing
19+
20+
node proxy.js # advanced: localhost proxy that injects thinking.display
21+
# into every request (sits in the path of your live token)
22+
23+
./test-thinking-display.sh # live A/B tester (sends 2 small requests, uses tokens)
24+
```
25+
26+
`proxy.js` sees your live auth token; read the security notes in `proxy.js` and
27+
`TECHNICAL.md` before relying on it. After running `patch-extension.sh`, reload
28+
the VS Code window.
29+
30+
## Launcher toggle
31+
32+
`CC_THINKING_DISPLAY` (default `summarized`; `omitted` disables injection). This
33+
is an argument-injection feature: no file is patched, so there is nothing to
34+
reconcile.
35+
36+
## Maintenance Contract
37+
38+
- Anchors / selectors: the launcher detects a real agent run via
39+
`--thinking adaptive|enabled`, `-p` / `--print`, and
40+
`--max-thinking-tokens N` / `=N`. `patch-extension.sh` keys off
41+
`if(l.type!=="disabled"&&l.display)<var>.push("--thinking-display",l.display)`,
42+
with the array variable captured by a regex group so a minifier rename does not
43+
break it.
44+
- Ownership marker: none in the bundle (this is argument injection).
45+
`patch-extension.sh` keeps timestamped `.bak.<epoch>` backups.
46+
- Failure mode if an anchor moves: injection is skipped when `--thinking-display`
47+
is already present, when thinking is disabled, or for subcommands/probes; the
48+
standalone patch no-ops if its target string is absent.
49+
- Launcher registry entry: argument-injection feature, gated by
50+
`CC_THINKING_DISPLAY` and `CC_WORKAROUNDS`.
51+
- Test fixture: `tests/test_regressions.py` (thinking-arg parsing, proxy header
52+
filtering, patch-extension, and the A/B-script cases).

‎launcher/README.md‎

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
# The unified launcher
2+
3+
One bash launcher (`claudemax`) and one Windows launcher (`claudemax.win.js`)
4+
carry every fix in this repo. Each fix is on by default and independently
5+
switchable at runtime with an environment variable, so the same artifact serves
6+
"I want everything" and "I want only X" without editing code and without
7+
recompiling. The Windows launcher compiles to a single `claudemax.exe` with
8+
`pkg`.
9+
10+
Both launchers are drop-in process wrappers: they find the real `claude`, peel
11+
the process-wrapper convention args, inject the thinking-display flag when a real
12+
agent run is detected, reconcile the webview bundle, then exec the real CLI.
13+
14+
## Wiring (process wrapper)
15+
16+
VS Code, official "Claude Code" extension:
17+
18+
- Set `claudeCode.claudeProcessWrapper` to the full path of `launcher/claudemax`
19+
(or `claudemax.exe` on Windows), then reload the window.
20+
- In a multi-root `.code-workspace`, this setting is window-scoped: put it in the
21+
workspace file's `settings` block (or in User settings), not in a folder
22+
`.vscode/settings.json`.
23+
24+
VS Code, third-party "Claude Code Chat" extension:
25+
26+
- Set `claudeCodeChat.executable.path` to the launcher.
27+
28+
Terminal:
29+
30+
- Run `claudemax` in place of `claude`.
31+
32+
## Toggles
33+
34+
| Env var | Default | Effect |
35+
| --- | --- | --- |
36+
| `CC_WORKAROUNDS` | `1` | Master switch. `0` disables every fix (argument injection and bundle patches) and reverts the webview to a clean bundle on launch. |
37+
| `CC_RECONCILE` | `1` | `0` = do not read or write the webview bundle this launch (emergency bypass). Argument injection still runs. |
38+
| `CC_THINKING_DISPLAY` | `summarized` | `summarized` shows extended-thinking summaries; `omitted` hides them (no injection). |
39+
| `CC_PATCH_CONTEXT_ICON` | `1` | `0` leaves the context-usage icon unpatched (and reverts ours on the next launch). |
40+
41+
Setting toggles without touching the script:
42+
43+
- Use the extension's existing `claudeCode.environmentVariables` setting to set
44+
any `CC_*` toggle from the settings UI on any OS, including against the compiled
45+
`claudemax.exe`.
46+
- Source-script users can instead edit the `FEATURE DEFAULTS` block near the top
47+
of `claudemax` / `claudemax.win.js`.
48+
49+
## Overriding the real binary
50+
51+
- `CLAUDE_REAL_BIN` - full path to the real `claude`, if autodetection fails.
52+
- `CC_NODE_BIN` (Windows) - path to `node.exe`, used when resolving a `.cmd` /
53+
`.bat` shim without going through a shell.
54+
55+
## Building the exe
56+
57+
```
58+
npm i -g pkg
59+
pkg launcher/claudemax.win.js --targets node18-win-x64 --output claudemax.exe
60+
```
61+
62+
The exe is distributed through GitHub Releases, not committed to the repo.

0 commit comments

Comments
 (0)