context-doctor 0.50.0 → 0.52.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/README.md +36 -38
- package/dist/apptools.d.ts +89 -0
- package/dist/apptools.js +203 -0
- package/dist/appwindow.d.ts +6 -0
- package/dist/appwindow.js +15 -1
- package/dist/budget.d.ts +20 -2
- package/dist/budget.js +43 -3
- package/dist/cachemisses.d.ts +70 -0
- package/dist/cachemisses.js +126 -0
- package/dist/cli.js +39 -10
- package/dist/credits.d.ts +64 -2
- package/dist/credits.js +88 -3
- package/dist/doctor.d.ts +18 -6
- package/dist/doctor.js +82 -14
- package/dist/fileparams.js +15 -3
- package/dist/fix.d.ts +11 -2
- package/dist/fix.js +53 -18
- package/dist/limits.d.ts +44 -3
- package/dist/limits.js +210 -22
- package/dist/mcp.js +68 -68
- package/dist/mod/api.d.ts +1 -1
- package/dist/mod/logic.d.ts +46 -1
- package/dist/mod/logic.js +76 -4
- package/dist/mod/register.d.ts +13 -3
- package/dist/mod/register.js +39 -9
- package/dist/modelids.d.ts +15 -0
- package/dist/modelids.js +33 -0
- package/dist/modmeasure.d.ts +7 -0
- package/dist/modmeasure.js +9 -0
- package/dist/overhead.js +8 -2
- package/dist/progresssummaries.d.ts +85 -2
- package/dist/progresssummaries.js +169 -23
- package/dist/proxy.d.ts +1 -1
- package/dist/proxy.js +1 -1
- package/dist/sample.d.ts +8 -0
- package/dist/sample.js +86 -0
- package/dist/savings.d.ts +8 -1
- package/dist/savings.js +32 -7
- package/dist/spend.d.ts +4 -2
- package/dist/spend.js +33 -4
- package/dist/starts.d.ts +7 -0
- package/dist/starts.js +7 -3
- package/dist/usagepane.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -7,30 +7,34 @@
|
|
|
7
7
|
AI agents re-send their whole context on every message: old tool output, pasted files, long instructions. A 500k-token session pays for all of it again each time, and at full price after a coffee break, when the prompt cache has expired. context-doctor measures that waste on your own sessions, in dollars, and removes it at the moments it pays: before it enters the context, while it sits there, and on every request. It runs on your machine, needs no API key, sends no telemetry, and works with **Claude Code** (terminal, IDE, desktop app), **Claude Desktop, ChatGPT, Codex, Cursor, Gemini CLI, GitHub Copilot**, any app on the **Anthropic, OpenAI or Gemini API**, and **CI**. MIT licensed, Node 20+, macOS, Linux and Windows.
|
|
8
8
|
|
|
9
9
|
```bash
|
|
10
|
-
npx context-doctor savings
|
|
11
|
-
npx context-doctor fix # the fixes ranked by dollars; applies only the ones you say yes to
|
|
12
|
-
npx context-doctor spend # one bill across Claude Code, Codex, Gemini CLI, Cursor, Copilot CLI, OpenCode and Cline
|
|
10
|
+
npx context-doctor savings
|
|
13
11
|
```
|
|
14
12
|
|
|
13
|
+
What your recent Claude Code sessions cost, and what each fix would have saved: replayed request by request against what you were billed, never modelled, and with nothing to measure it says so. Nothing to measure yet? `npx context-doctor savings --sample` runs the same report on generated example sessions, labelled SAMPLE.
|
|
14
|
+
|
|
15
15
|
<img src="https://raw.githubusercontent.com/KushalP1/context-doctor/main/assets/savings.svg" alt="npx context-doctor savings: input billed, what /compact at cold resumes, autopilot and an earlier auto-compact window would have saved" width="640">
|
|
16
16
|
|
|
17
|
+
*Measured on the author's own sessions, priced the way the prompt cache billed them; `savings` replays yours the same way and, with nothing to measure, says so.*
|
|
18
|
+
|
|
17
19
|
> **Which context-doctor is this?** Several projects share the name. This one is [`context-doctor` on npm](https://www.npmjs.com/package/context-doctor) and `io.github.KushalP1/context-doctor` in the official MCP Registry ([see the entry](https://registry.modelcontextprotocol.io/v0/servers/io.github.KushalP1%2Fcontext-doctor/versions/latest)). The registry is a service, not a list in a GitHub repo: the `modelcontextprotocol/servers` repository holds only reference servers and points to the registry for the rest. Built and maintained by [gAI Ventures](https://gai.ventures).
|
|
18
20
|
|
|
19
21
|
## Quick start
|
|
20
22
|
|
|
21
23
|
**See it first, nothing installed:** in a terminal, `npx context-doctor` reads your last 30 days of Claude Code sessions on this machine and shows what the fixes with no quality cost would have saved, as one total, then asks once: `y` applies them all, `npx context-doctor fix undo` puts them back. The fixes that trade something (compacting earlier, the subagents' model) are listed with their dollars and the command for each.
|
|
22
24
|
|
|
23
|
-
|
|
25
|
+
**Claude Code** (terminal, IDE, desktop app): inside Claude Code, `/plugin marketplace add KushalP1/context-doctor`, then `/plugin install context-doctor@context-doctor`. You get the every-prompt check, the compaction hook, the MCP tools and `/context-doctor:fix`, `:spend`, `:savings`, `:checkup`, `:overhead`, `:pack`, `:autopilot`, `:compact-window`.
|
|
26
|
+
|
|
27
|
+
**Everything on this machine at once:** `npm install -g context-doctor && context-doctor install` wires Claude Code, Claude Desktop, Cursor, Codex, Gemini CLI, Google Antigravity and GitHub Copilot: MCP server, skill and hooks ([what it writes](./docs/install.md)). `context-doctor doctor` checks it; `context-doctor uninstall` removes it. Then, for Claude Code in a terminal or IDE, `context-doctor autopilot on`.
|
|
28
|
+
|
|
29
|
+
Each takes about a minute and is fully reversible. Work somewhere else? Same idea, other surfaces:
|
|
24
30
|
|
|
25
31
|
| You use | Do this |
|
|
26
32
|
|---|---|
|
|
27
|
-
| **Claude Code** (terminal, IDE, desktop app) | Inside Claude Code: `/plugin marketplace add KushalP1/context-doctor`, then `/plugin install context-doctor@context-doctor`. You get the every-prompt check, the compaction hook, the MCP tools and `/context-doctor:fix`, `:spend`, `:savings`, `:checkup`, `:overhead`, `:pack`, `:autopilot`, `:compact-window` |
|
|
28
|
-
| **Everything on this machine at once** | `npm install -g context-doctor && context-doctor install` wires Claude Code, Claude Desktop, Cursor, Codex, Gemini CLI, Google Antigravity and GitHub Copilot: MCP server, skill and hooks ([what it writes](./docs/install.md)). `context-doctor doctor` checks it; `context-doctor uninstall` removes it. Then, for Claude Code in a terminal or IDE, `context-doctor autopilot on` |
|
|
29
33
|
| **Claude Desktop, Cursor or any MCP client** | Add the server to the client's MCP config (or install the one-click `.mcpb` from the [latest release](https://github.com/KushalP1/context-doctor/releases/latest) in Claude Desktop):<br>`{"mcpServers": {"context-doctor": {"command": "npx", "args": ["-y", "context-doctor", "mcp"]}}}` |
|
|
30
34
|
| **claude.ai, ChatGPT, phone apps** | `npx context-doctor instructions --copy`, then paste into the app's personal preferences (it tells you where). ChatGPT can also reach the MCP server at a URL ([how](./docs/chat-apps.md#chatgpt)) |
|
|
31
35
|
| **Your own app on an LLM API** | Run `npx context-doctor proxy --autopilot` and point `ANTHROPIC_BASE_URL`, `OPENAI_BASE_URL` (add `/v1`) or `GOOGLE_GEMINI_BASE_URL` at the proxy on `127.0.0.1:8787`, plain HTTP ([exact values](./docs/proxy.md)). No proxy possible? Wrap the SDK client: `withContextDoctor(new Anthropic())` ([library](./docs/library.md)) |
|
|
32
36
|
| **Python / RAG pipelines** | `pip install "git+https://github.com/KushalP1/context-doctor#subdirectory=python"` (PyPI release coming), then `pack_documents(retrieved_docs, question, budget=4000)` trims LangChain or LlamaIndex results to the chunks that matter. [Python README](./python/README.md) |
|
|
33
|
-
| **GitHub pull requests** | `uses: KushalP1/context-doctor@v0.
|
|
37
|
+
| **GitHub pull requests** | `uses: KushalP1/context-doctor@v0.52.0` comments how much a PR grows CLAUDE.md, AGENTS.md and rules, and can fail over a budget ([setup](./docs/ci.md)) |
|
|
34
38
|
|
|
35
39
|
## What it does
|
|
36
40
|
|
|
@@ -40,7 +44,7 @@ Pick where you work. Each takes about a minute and is fully reversible.
|
|
|
40
44
|
- `overhead`: what every request re-reads before your message (system prompt, tools, MCP servers, CLAUDE.md, rules, memory), each file priced per month.
|
|
41
45
|
- `tasks`, `reads`, `subagents`, `compactions`: cost per commit; files read into session after session; whether each subagent was cheaper than the same steps in the parent; whether sessions work worse after compacting.
|
|
42
46
|
- `cache-misses`: requests that re-wrote the prompt cache while it should still have been warm, priced, by model and context size, with the cause where the transcript shows one. And the cold returns (back after the cache expired): each one as billed, compacted on return, and kept warm by a cache read every 55 minutes, by how long you were away; what keeping warm for up to 1-8 hours would have netted; and a compacted segment the Desktop app put back ([#107157](https://github.com/anthropics/claude-code/issues/107157)).
|
|
43
|
-
- `limits`: your plan's weekly and 5-hour windows (Claude Pro, Max and Ultra, which has no 5-hour window; recorded by the plugin's mod, the status line or the proxy) and Codex's, the pace and when each runs out, what 1M tokens of each kind cost in % of the limit, and for each weekly window the API-equivalent dollars and tokens per 1%, by entrypoint and model, with every move in that figure dated, and, when a limit ran out and Claude Code kept going on usage credits, when and about how much. `limits --report` prints it as a block to paste into a bug report, with no prompts, paths or ids.
|
|
47
|
+
- `limits`: your plan's weekly and 5-hour windows (Claude Pro, Max and Ultra, which has no 5-hour window; recorded by the plugin's mod, the status line or the proxy) and Codex's, the pace and when each runs out, what 1M tokens of each kind cost in % of the limit, and for each weekly window the API-equivalent dollars and tokens per 1%, by entrypoint and model, with every move in that figure dated and checked against the model mix (a week moved to a model that uses the limit faster per dollar is said to be the mix, not the limit draining faster), and, when a limit ran out and Claude Code kept going on usage credits, when and about how much (or, with extra usage on and the weekly limit on pace to run out early, about how much the hours until the reset would cost). `limits --report` prints it as a block to paste into a bug report, with no prompts, paths or ids.
|
|
44
48
|
- `cache-plan <request.json>`: where an Anthropic API request should carry `cache_control`, and what it saves over N calls.
|
|
45
49
|
- `session`, `watch`, `analyze`, `report`, `dashboard`: token breakdown and wasted-context findings for any session, conversation file or agent trace.
|
|
46
50
|
|
|
@@ -63,36 +67,37 @@ Pick where you work. Each takes about a minute and is fully reversible.
|
|
|
63
67
|
|
|
64
68
|
## What it saves
|
|
65
69
|
|
|
66
|
-
Measured, not modelled, on every Claude Code session on the author's machine (mostly Opus 5 and Fable 5 with the 1M window), priced the way the prompt cache bills it (cached reads at each model's read rate, 2.5-10% of input; writes 1.25x input for the 5-minute cache, 2x for the hour) at API list prices. Re-measured on 2026-
|
|
70
|
+
Measured, not modelled, on every Claude Code session on the author's machine (mostly Opus 5.5 and the Fable 5 models with the 1M window), priced the way the prompt cache bills it (cached reads at each model's read rate, 2.5-10% of input; writes 1.25x input for the 5-minute cache, 2x for the hour) at API list prices. Re-measured on 2026-11-24 with each request at its own model and current prices (Opus 5.5 is $4 per million input tokens with $0.20 reads). `context-doctor savings` runs the same measurement on yours.
|
|
67
71
|
|
|
68
|
-
**1. Compacting when you come back** (every Claude Code surface, desktop app included).
|
|
72
|
+
**1. Compacting when you come back** (every Claude Code surface, desktop app included). 146 days, 729 returns to a session over 150k tokens after its prompt cache expired (65 idle minutes on the 1-hour cache, 10 on the 5-minute one that Claude Code 2.1.295 often writes); median context at the return, 497k tokens.
|
|
69
73
|
|
|
70
74
|
| | |
|
|
71
75
|
|---|---|
|
|
72
|
-
| Net saving had you run `/compact` after the first reply | **$
|
|
73
|
-
| Returns where it paid off |
|
|
76
|
+
| Net saving had you run `/compact` after the first reply | **$3,554 (about $740 a month)** |
|
|
77
|
+
| Returns where it paid off | about 2 in 3 |
|
|
74
78
|
| Worst single case | −$1.79 (a session left a few messages later) |
|
|
75
79
|
|
|
76
80
|
Each return counts only the messages up to the next return, and the compaction request is charged as a cost. Not counted: files the model may re-read after compacting, and what the summary leaves out. That is why this is advice with the numbers attached, not something done for you.
|
|
77
81
|
|
|
78
|
-
**2. Autopilot** (Claude Code in a terminal or IDE, API apps).
|
|
82
|
+
**2. Autopilot** (Claude Code in a terminal or IDE, API apps). 146 days, 108 sessions, replayed through the shipped autopilot code with real timestamps:
|
|
79
83
|
|
|
80
84
|
| | Without autopilot | With autopilot | Saved |
|
|
81
85
|
|---|---|---|---|
|
|
82
|
-
| Input cost at API list price | $
|
|
83
|
-
| Sessions made more expensive | | | **0 of
|
|
86
|
+
| Input cost at API list price | $14,318 | $12,561 | **$1,757 (12.3%, about $365 a month)** |
|
|
87
|
+
| Sessions made more expensive | | | **0 of 108** |
|
|
84
88
|
|
|
85
|
-
|
|
89
|
+
43 of 108 sessions save something, the best 41.6%: long sessions that go idle are where the money is. These sessions ran in the desktop app, which autopilot cannot reach, so for the author this is what the same sessions would have saved in a terminal; `context-doctor savings` separates the two for you. [How it works →](./docs/autopilot.md)
|
|
86
90
|
|
|
87
91
|
**3. Compacting earlier** <a id="3-compacting-earlier-automatic"></a>(automatic, every Claude Code surface, desktop app included). The offer in 1 is advice, and on the author's machine it was followed 1 time in 33. Claude Code has a native setting that needs nobody to follow anything: `autoCompactWindow` in `~/.claude/settings.json` makes it compact as if the window were that size. `context-doctor compact-window` replays each session request by request at several sizes, priced as the cache bills (each simulated compaction pays its own request and a 20k-token summary at the output rate), and changes nothing until you pick one:
|
|
88
92
|
|
|
89
93
|
| Window | Input cost, last 30 days | Saved | Compactions a week |
|
|
90
94
|
|---|---|---|---|
|
|
91
|
-
| as now (
|
|
92
|
-
|
|
|
93
|
-
|
|
|
94
|
-
|
|
|
95
|
-
|
|
|
95
|
+
| as now (not set) | $1,680 | | 8.6 |
|
|
96
|
+
| 800k | $1,532 | $149 (9%) | 8.6 |
|
|
97
|
+
| 600k | $1,324 | $357 (21%) | 8.9 |
|
|
98
|
+
| **400k** | **$1,053** | **$628 (37%)** | **11.9** |
|
|
99
|
+
| 300k | $958 | $723 (43%) | 17.0 |
|
|
100
|
+
| 200k | $881 | $799 (48%) | 30.6 |
|
|
96
101
|
|
|
97
102
|
41 sessions. The cost is real: each compaction replaces the session's history with a summary, so a smaller window trades detail for money. That is why the command shows the table first and sets a window only when you name one (`context-doctor compact-window 400k`; `off` undoes it, and a backup of settings.json is kept).
|
|
98
103
|
|
|
@@ -107,7 +112,7 @@ On a Claude subscription you do not pay list price; the same tokens come out of
|
|
|
107
112
|
| Where you work | Automatic, every request | What you get on top |
|
|
108
113
|
|---|---|---|
|
|
109
114
|
| **Claude Code** in the terminal, VS Code or JetBrains | **Autopilot** clears stale tool output (cold cache only, never more expensive). **Hook** on every prompt: real context size, largest waste, and a `/compact` offer when you return to a large session after the cache expired. **Compaction hook** on every compaction. **`compact-window`**, if you set one | Install via npm or as a **plugin**. Status bar context meter, `/context-doctor:savings`, `session`, `watch`, `report`, dashboard, MCP tools |
|
|
110
|
-
| **Claude Code** in the desktop app's Code tab | **Hooks**, as above, the cold-resume `/compact` offer shown to you as well as the model. **`compact-window`**, if you set one: Claude Code compacts earlier by itself. Not autopilot: the app sets its own API address and ignores the one in settings | Same as above, and the plugin's mod: `/context-doctor-usage`, the usage view the app dropped (context ring, limit windows, tokens and dollars by model for today, 7 and 30 days, running subagents), `/context-doctor-fix`, and, once you apply `fix --apply desktop-tools-defer`, the app's own browser, session, preview and terminal tools kept behind tool search in new sessions (Claude Code 2.1.326
|
|
115
|
+
| **Claude Code** in the desktop app's Code tab | **Hooks**, as above, the cold-resume `/compact` offer shown to you as well as the model. **`compact-window`**, if you set one: Claude Code compacts earlier by itself. Not autopilot: the app sets its own API address and ignores the one in settings | Same as above, and the plugin's mod: `/context-doctor-usage`, the usage view the app dropped (context ring, how long the cache stays warm and what the next message costs now and after, limit windows, tokens and dollars by model for today, 7 and 30 days, running subagents), `/context-doctor-fix`, and, once you apply `fix --apply desktop-tools-defer`, the app's own browser, session, preview and terminal tools kept behind tool search in new sessions (Claude Code 2.1.326+; `fix` and `doctor` first confirm from your own Desktop sessions that it reaches them) ([Desktop](./docs/desktop.md)) |
|
|
111
116
|
| **Cursor** (agent) | A native **after-tool-call hook** (`~/.cursor/hooks.json`): in a heavy chat the agent gets the same hygiene guidance and the largest waste, once per 40% of growth. (Cursor's prompt hook can only allow or block a prompt, so this is the event where guidance reaches the model) | MCP tools, editor status bar extension, `cursor` profiler. With your own OpenAI key, autopilot too via a tokened tunnel ([how](./docs/proxy.md#putting-the-proxy-on-a-public-url-cursor-with-your-own-openai-key-remote-apps)) |
|
|
112
117
|
| **Codex** (ChatGPT app's Codex tab, IDE extension, CLI) | Every-prompt hook with the API's own token counts | MCP tools, skill, `session` reads Codex rollouts. Codex 0.171+: a footer status line from the MCP server (context, the session's cost, the plan's limits), once you turn on Codex's Custom status line experiment and pick it ([how](./docs/editor-and-statusline.md#codexs-footer-codex-0171)). On an API key, autopilot too (`autopilot on` sets `openai_base_url` in `~/.codex/config.toml`; Codex no longer reads `OPENAI_BASE_URL`) |
|
|
113
118
|
| **Gemini CLI** | Every-prompt hook (`BeforeAgent`) with the API's own token counts. On an API key, autopilot too: `GOOGLE_GEMINI_BASE_URL` set to the proxy on `127.0.0.1:8787`, plain HTTP (Google sign-in traffic goes elsewhere) | MCP tools, `session` and `watch` read its chats, `overhead` sizes GEMINI.md |
|
|
@@ -136,11 +141,11 @@ Rules 1-4 end exactly at character 512, the part ChatGPT's guide says must stand
|
|
|
136
141
|
|---|---|
|
|
137
142
|
| `context-doctor install` / `uninstall` | Wire (or remove) everything it finds: the MCP server for Claude Desktop, Claude Code, Cursor, Codex, Gemini CLI, Google Antigravity and GitHub Copilot; the Agent Skill (Claude Code, Codex, Antigravity); the every-prompt hook (Claude Code, Codex, Gemini CLI's `BeforeAgent`, Cursor's `postToolUse`, `postToolUseFailure` and `sessionStart`); Claude Code's `PreCompact`, `SessionStart`, `PreToolUse` (the subagent price) and, on 2.1.251+, `PreModelSwitch` hooks; Copilot's `sessionStart` (the standing rules). `--statusline` adds the status bar line ([details](./docs/install.md)) |
|
|
138
143
|
| `context-doctor fix [--apply ids\|all] [--share]` / `fix undo` | Every lever ranked by what it would have saved on your last 30 days (compact earlier, the cache lifetime, autopilot, MCP tool search, MCP servers set to load up front, the Desktop app's own tools kept behind tool search through the plugin's mod, unused servers, the subagents' model, long Bash output to a file, Codex's auto-compact limit, subagent progress summaries), with what each costs in quality; applies one only on a yes (the subagents' model and the two MCP deferrals only when named), `fix undo` reverts exactly what it changed, later runs show what each saved since ([details](./docs/fix.md)) |
|
|
139
|
-
| `context-doctor spend [--days n] [--by repo\|branch] [--share] [--export]`, `spend merge <folder>` | One bill across every tool on this machine: Claude Code (main conversation and subagents), Codex, Gemini CLI, Cursor (an estimate: no cache split), Copilot CLI (with the AI credits it counted), OpenCode and Cline, by tool, project (or repository or branch), model and day; `--export` writes a file of totals (no prompt or path) and `spend merge` adds up a team's files, with a month-end forecast, with what drives it, and Claude Code's own figure (its `cost-state`) beside ours with what the gap is made of: its side requests, prompt suggestions and requests that hung and were sent again, named; subagent output Claude Code 2.1.284-2.1.299 never settled in its rows, estimated from the content and counted; subagent progress summaries estimated beside the total (from Claude Code 2.1.328, short notes on Haiku 5.5). When a plan limit ran out and requests kept going (extra usage), Claude Code's dollars split into past the limit, on usage credits, and inside the plan (at API list prices, an estimate) ([docs](./docs/spend.md)) |
|
|
140
|
-
| `context-doctor budget [<$>/day\|<$>/week [--block]\|off]` | A spend budget the every-prompt hook applies: a line at 50%, 80% and 100%, and with `--block` prompts over it are held until you raise it or turn it off ([docs](./docs/spend.md#a-budget-the-hook-applies-context-doctor-budget)) |
|
|
141
|
-
| `context-doctor doctor` | Self-check the whole installation — one pasteable ✓/✗ diagnosis with fixes, including which surfaces autopilot can reach and any other program on its port,
|
|
144
|
+
| `context-doctor spend [--days n] [--by repo\|branch] [--share] [--export]`, `spend merge <folder>` | One bill across every tool on this machine: Claude Code (main conversation and subagents), Codex, Gemini CLI, Cursor (an estimate: no cache split), Copilot CLI (with the AI credits it counted), OpenCode and Cline, by tool, project (or repository or branch), model and day; `--export` writes a file of totals (no prompt or path) and `spend merge` adds up a team's files, with a month-end forecast, with what drives it, and Claude Code's own figure (its `cost-state`) beside ours with what the gap is made of: its side requests, prompt suggestions and requests that hung and were sent again, named; subagent output Claude Code 2.1.284-2.1.299 never settled in its rows, estimated from the content and counted; subagent progress summaries estimated beside the total (from Claude Code 2.1.328, short notes on Haiku 5.5 on the Anthropic API; the subagent's own model on Bedrock, Vertex or Foundry; its whole context with the small model overridden or through a proxy such as autopilot's on a Claude sign-in; a range where that cannot be told). When a plan limit ran out and requests kept going (extra usage), Claude Code's dollars split into past the limit, on usage credits, and inside the plan (at API list prices, an estimate) ([docs](./docs/spend.md)) |
|
|
145
|
+
| `context-doctor budget [<$>/day\|<$>/week [--block]\|off]` | A spend budget the every-prompt hook applies: a line at 50%, 80% and 100%, and with `--block` prompts over it are held until you raise it or turn it off; past your plan's limit, the line and `budget` say how much was paid from usage credits, and `budget` what running out before the weekly reset would cost on them ([docs](./docs/spend.md#a-budget-the-hook-applies-context-doctor-budget)) |
|
|
146
|
+
| `context-doctor doctor` | Self-check the whole installation — one pasteable ✓/✗ diagnosis with fixes, including which surfaces autopilot can reach and any other program on its port, whether extra usage (usage credits past a plan's limit) is on, which Claude Code versions sent requests the prompt cache never saw in the last 30 days and what they cost, what you answered the Desktop app's own auto-compact offer, when there is an answer on file, and which MCP servers your newest Desktop session handed the mod (their type, and whether `fix --apply desktop-tools-defer` reaches them) |
|
|
142
147
|
| `context-doctor savings [--days n] [--share [--copy]]` | What your recent Claude Code sessions cost, and what `/compact` at cold resumes, autopilot and an earlier auto-compact window would save, replayed through the shipped code against your actual billed usage (the main conversations' input: `spend` has the whole bill, output and subagents included). `--share` prints totals only (no project names or paths) to post. A bare `context-doctor` in a terminal shows `fix`'s plan instead, with one question for the fixes that cost nothing in quality |
|
|
143
|
-
| `context-doctor autopilot on\|off\|pause\|resume\|status` | Every new Claude Code session started in a terminal or IDE goes through the local proxy, which clears stale tool output only when the prompt cache is cold: measured 12.
|
|
148
|
+
| `context-doctor autopilot on\|off\|pause\|resume\|status` | Every new Claude Code session started in a terminal or IDE goes through the local proxy, which clears stale tool output only when the prompt cache is cold: measured 12.3% less input cost, no session worse ([details](./docs/autopilot.md)) |
|
|
144
149
|
| `context-doctor proxy --autopilot` | Local proxy for your own Anthropic, OpenAI and Gemini API apps: clears stale tool output only when the prompt cache is cold, so it never costs more. Plain `proxy` runs the optimizing strategies (dedupe, trim, strip base64), which can cost more on cached traffic. `--token` for a public URL; `/stats` for cumulative savings ([details](./docs/proxy.md)) |
|
|
145
150
|
| `context-doctor compact-window [status\|off\|<size>]` | Replay your last 30 days at auto-compact windows from 200k to 800k: input cost, saving, and how many more compactions each means. `400k` (or `250000`, `0.4m`) sets Claude Code's `autoCompactWindow`, with a backup; `off` removes it. Works in every Claude Code surface, the desktop app included. When you answered the Desktop app's own window offer, it says what the app offered and what you chose, and leaves that model's sessions out of the replay ([docs](./docs/fix.md#the-desktop-apps-own-window-offer-compact-window)) |
|
|
146
151
|
| `context-doctor cache-ttl [status\|1h\|5m\|off] [--subagents]` | The main conversation's (or subagents') prompt cache lifetime: what 5 minutes and 1 hour would each have cost on your last 30 days, then set or remove `promptCacheTtl` / `subagentPromptCacheTtl` (Claude Code 2.1.243+, every surface). Price only: the same content is sent ([details](./docs/fix.md)) |
|
|
@@ -154,7 +159,7 @@ Rules 1-4 end exactly at character 512, the part ChatGPT's guide says must stand
|
|
|
154
159
|
| `context-doctor analyze <file>` | Profile a conversation: token breakdown, findings, cost + latency estimates. `--exact` adds a true count; `--fail-over-budget` exits 1 on a breach, for CI |
|
|
155
160
|
| `context-doctor optimize <file>` | Apply the safe fixes; add `--strategy trim-tool-calls` for big inline file writes, `--strategy prune-history` for consented lossy compaction ([what each does](./docs/detectors.md)) |
|
|
156
161
|
| `context-doctor diff <before> <after>` | Compare two profiles: what moved by category, which findings were resolved or introduced, and what it saves in money and latency |
|
|
157
|
-
| `context-doctor overhead [--days n] [--mcp]` | What every request re-reads before your message: measured first-request size (Claude Code, Codex and Gemini CLI sessions), each memory file (CLAUDE.md and imports, rules, auto memory, AGENTS.md, Cursor rules, GEMINI.md) priced per month, MCP calls per server; each session's and subagent's start per entrypoint (Desktop app, terminal, SDK) and subagent type, priced over the period, with the MCP tool definitions sent whole and whether any setting defers them; `--mcp` sizes each configured server's tool definitions and flags unused ones |
|
|
162
|
+
| `context-doctor overhead [--days n] [--mcp]` | What every request re-reads before your message: measured first-request size (Claude Code, Codex and Gemini CLI sessions), each memory file (CLAUDE.md and imports, rules, auto memory, AGENTS.md, Cursor rules, GEMINI.md) priced per month, MCP calls per server; each session's and subagent's start per entrypoint (Desktop app, terminal, SDK) and subagent type, priced over the period as billed (the headline's one total is their sum), with the MCP tool definitions sent whole and whether any setting defers them; `--mcp` sizes each configured server's tool definitions and flags unused ones |
|
|
158
163
|
| `context-doctor overhead prune [--days n] [--write] [--undo]` | Per project, the MCP servers and skills its sessions never used in n days; `--write` switches them off for this folder's project in its `.claude/settings.local.json` (backup kept, every entry recorded), `--undo` takes exactly those out. Never the app's connectors, plugins, or context-doctor itself |
|
|
159
164
|
| `context-doctor overhead split <file> [--min-tokens n] [--write]` | Move a memory file's big or code-heavy sections word for word to `<name>.reference.md`, leaving pointers; indexes stay. A plan until `--write`, which backs up first |
|
|
160
165
|
| `context-doctor pack <files\|dirs\|-> -q "…"` | Only the chunks of big documents, logs or code a question needs, ranked and fit to `--max-tokens` (default 4000). No query: an outline; `--ids a#2,b#5` picks chunks from it. `--semantic` also ranks by meaning with a local Ollama model. Offline, no key |
|
|
@@ -163,8 +168,8 @@ Rules 1-4 end exactly at character 512, the part ChatGPT's guide says must stand
|
|
|
163
168
|
| `context-doctor reads [--days n] [--limit n]` | Files read into session after session: reads, tokens, cost, and whether a CLAUDE.md summary or `pack` pays |
|
|
164
169
|
| `context-doctor subagents [--days n]` | Which subagents paid for themselves: each one's bill vs the same steps run in the parent session (read through the transcript cache: 15 s to 0.3 s warm on the author's machine) |
|
|
165
170
|
| `context-doctor compactions [--days n]` | Do sessions work worse right after compacting? Re-reads, tool errors and your corrections, before vs after each compaction |
|
|
166
|
-
| `context-doctor cache-misses [--days n]` | Requests that re-wrote the prompt cache within its lifetime (no compaction between, previous context over 20k, over 60% of it written again): priced above the cache-read rate, by model and context size, with the cause where visible and the model versions that miss less; by Claude Code version, with step changes after an upgrade flagged (the 1-hour cache share, the first request's size, a model's miss rate). Then the cold returns, each replayed as billed, compacted on return and kept warm (a cache read every 55 min while away, 4.5 on a 5-minute cache), by time away (<1h to >8h); keeping warm for up to 1, 2, 4 and 8 hours priced with every ping a timer would send;
|
|
167
|
-
| `context-doctor limits [--days n] [--report [--copy]]` | Your plan's limits in their own unit: each window's %, pace (from the window's reset when it began within the last hour, or day for a weekly one) and run-out time (Claude's weekly and 5-hour windows, from the readings the plugin's mod, the status line or the proxy record; Ultra has no 5-hour window; Codex's from its rollouts), and % of the limit per 1M tokens of input, cache read, cache write and output, fitted on your readings with the fit's error; too-thin data is said to be thin, never quoted. Each weekly window, reset to reset: API-equivalent $ and tokens per 1%, split by entrypoint (`cli`, `claude-desktop`, `sdk-cli`) and model, and where that moved, by how much and on what date. When a limit ran out and Claude Code kept going on usage credits (extra usage), one line says when, how many requests and about how much at API list prices (an estimate), from the API's own headers where the proxy read them, else inferred from a 100% reading and said to be. `--report`: the same as a block to paste into a GitHub issue (no prompts, paths, session or account ids) |
|
|
171
|
+
| `context-doctor cache-misses [--days n]` | Requests that re-wrote the prompt cache within its lifetime (no compaction between, previous context over 20k, over 60% of it written again): priced above the cache-read rate, by model and context size, with the cause where visible and the model versions that miss less; by Claude Code version, with step changes after an upgrade flagged (the 1-hour cache share, the first request's size, a model's miss rate). Then the cold returns, each replayed as billed, compacted on return and kept warm (a cache read every 55 min while away, 4.5 on a 5-minute cache), by time away (<1h to >8h); keeping warm for up to 1, 2, 4 and 8 hours priced with every ping a timer would send; #107157's re-added compacted segment with its re-write; and requests the cache never saw (no cache write, most of the prompt billed as new input, [#111948](https://github.com/anthropics/claude-code/issues/111948)) by Claude Code version, priced against a working cache; `--json` per model and version |
|
|
172
|
+
| `context-doctor limits [--days n] [--report [--copy]]` | Your plan's limits in their own unit: each window's %, pace (from the window's reset when it began within the last hour, or day for a weekly one) and run-out time (Claude's weekly and 5-hour windows, from the readings the plugin's mod, the status line or the proxy record; Ultra has no 5-hour window; Codex's from its rollouts), and % of the limit per 1M tokens of input, cache read, cache write and output, fitted on your readings with the fit's error; too-thin data is said to be thin, never quoted. Each weekly window, reset to reset: API-equivalent $ and tokens per 1%, split by entrypoint (`cli`, `claude-desktop`, `sdk-cli`) and model, and where that moved, by how much and on what date, checked against the model mix (a move the mix explains is said to be the mix, not the limit draining faster). With extra usage on and the weekly limit on pace to run out before its reset, one line says about how many dollars the hours until the reset would go on usage credits (at the last 24 hours' pace, list prices, an estimate). When a limit ran out and Claude Code kept going on usage credits (extra usage), one line says when, how many requests and about how much at API list prices (an estimate), from the API's own headers where the proxy read them, else inferred from a 100% reading and said to be. `--report`: the same as a block to paste into a GitHub issue (no prompts, paths, session or account ids) |
|
|
168
173
|
| `context-doctor cache-plan <request.json> [--calls n] [--out file] [--explicit]` | Where an Anthropic API request should carry `cache_control` (top-level automatic caching for the moving end, unless `--explicit`), and what it saves over n calls; `--out` writes it applied |
|
|
169
174
|
| `context-doctor accuracy` | How much of what you are billed for is visible in your transcript (the fixed harness baseline, per-turn injected content), plus a tokenizer check: real chars/token per model from the API's own counts, next to the ratio the estimator uses |
|
|
170
175
|
| `context-doctor report` | Machine-wide impact report (proxy savings persist across restarts): exact proxy savings, hook activity, how often the cold-resume `/compact` offer was followed by a compaction, recoverable waste in recent sessions |
|
|
@@ -183,21 +188,14 @@ Rules 1-4 end exactly at character 512, the part ChatGPT's guide says must stand
|
|
|
183
188
|
|
|
184
189
|
## What's new
|
|
185
190
|
|
|
191
|
+
- **0.52 An honest empty state, a sample report, and one command up front**: with nothing of yours to replay, `savings` says so, offers `savings --sample`, the same report on generated example sessions, labelled SAMPLE, and says when to run it again; the measured report's footer says it too. `doctor` no longer says "All good" when nothing is protected: the verdict distinguishes no supported app, installed-but-not-wired ("not actively protecting any workflow") and wired. The README leads with one audience and one command, the savings figure captioned as measured on the author's own sessions, the other surfaces in a table. A new bug-report template asks for `doctor` output and `limits --report`, never transcripts; security reports go through private advisories ([details](./ROADMAP.md#shipped-in-0520-an-honest-empty-state-a-sample-report-and-one-command-up-front)).
|
|
192
|
+
- **0.51 Limits that tell the model mix from the limit, proof before a lever, and the cache in the usage pane**: `limits` no longer reads a switch to a hungrier model as the limit draining faster: it says when the move comes from your model mix, and claims a drain only when what is left is 1.5x or more. `limits` and `budget` say when the weekly limit would run out at your current pace and, with extra usage on, about what would go on usage credits before the reset; `budget` counts what credits already paid. The mod records which tools the Desktop app hands over, so `fix` and `doctor` confirm or withdraw `desktop-tools-defer` before you apply it. The `/context-doctor-usage` pane shows how long the cache stays warm and what your next message costs now and after it expires. `cache-misses` and `doctor` count requests the cache never saw (claude-code #111948). Progress summaries are priced in the form Claude Code really sends on your setup; `overhead` gives one total; `doctor` shows the Desktop app's auto-compact offer. Fixes: "1000k" for a 1M window, a flaky download-budget test, the ledger path `doctor` names ([details](./ROADMAP.md#shipped-in-0510-limits-that-tell-the-model-mix-from-the-limit-proof-before-a-lever-and-the-cache-in-the-usage-pane)).
|
|
186
193
|
- **0.50 The Desktop app's own tools, money past the limit, a Codex status line, and two audits**: `fix --apply desktop-tools-defer` has the mod keep the Desktop app's own tools (browser, terminal, sessions, visualize) behind tool search until a session needs them (about $70 a month on the author's history; opt-in, undo with `fix undo`). `limits` says when a plan limit ran out and usage credits paid, `spend` splits dollars inside the plan and past it, `doctor` says whether extra usage is on. `compact-window` and `fix` read the window the Desktop app offered and your answer. Progress summaries are priced on the small model Claude Code 2.1.328 uses. Codex users can turn on a status line served by the MCP server. Gemini 4 Neon is priced. Two audits fixed 14 issues: a crash on a bad date, `limits` reading pace from a burst after a reset, subagent counts that disagreed, a false "contracted rates" warning, and more ([details](./ROADMAP.md#shipped-in-0500-the-desktop-apps-own-tools-money-past-the-limit-a-codex-status-line-and-two-audits)).
|
|
187
194
|
- **0.49.1 The Desktop band off by default, and the rest of Claude Code's figure explained**: the band above the prompt in the Desktop app no longer shows unless `CONTEXT_DOCTOR_MOD_BAND=cold` (a cold return, with **Compact first**) or `always`; the mod still records limits and cost. Subagent replies Claude Code 2.1.284-2.1.299 never finished writing are counted, and the gap to Claude Code's own cost names its prompt suggestions and requests that hung ([details](./ROADMAP.md#shipped-in-0491-the-desktop-band-off-by-default-and-the-rest-of-claude-codes-figure-explained)).
|
|
188
195
|
- **0.49 Count what Claude Code counts, cold returns, limits you can paste, a Desktop usage pane, and teams**: `spend` and `doctor` show Claude Code's own cost (its `cost-state`) beside ours, 2% apart on the author's 30 days, and count the advisor's calls and replies a server-side fallback replaced. `cache-misses` replays every return after the cache expired three ways (as billed, compacted, kept warm) by time away (the author's: $894 in 183 returns), and the mod's `/context-doctor-keep-warm` keeps it warm on request only, capped in hours and dollars. `overhead` prices every session's and subagent's start ($455 a month here) and `fix` gains `mcp-defer`. `limits` gives dollars per 1% per weekly reset with the moves dated, `limits --report` a block for a bug report, and handles Ultra (no 5-hour window). `/context-doctor-usage` is a usage pane in the Desktop app. `spend` reads Copilot CLI, OpenCode and Cline, splits `--by repo|branch`, and `--export` / `spend merge` add up a team's totals with no prompt or path ([details](./ROADMAP.md#shipped-in-0490-count-what-claude-code-counts-cold-returns-limits-you-can-paste-a-desktop-usage-pane-and-teams)).
|
|
189
196
|
- **0.48 Directory-ready, quality on your own plan, and MCP SDK v2**: a build of the plugin for Anthropic's directory (strict-clean, with and without the mod); `ab --via claude-code` measures the subagent lever on your own sign-in, no API key; the price check covers OpenAI, Google, Codex and Gemini CLI and warns before a price ends; the MCP server speaks protocol 2026-07-28 to Claude Code and the old handshake to everyone else. Fixed: installing the plugin from the marketplace no longer pulls 80 MB of build tools into Claude Code's cache ([details](./ROADMAP.md#shipped-in-0480-a-directory-ready-plugin-quality-on-your-own-plan-prices-that-change-under-us-and-mcp-sdk-v2)).
|
|
190
197
|
- **0.47 One keystroke to a saving, the mod through `install`, a weekly live check, and an audit of 0.46**: a bare `context-doctor` in a terminal shows the fixes that cost no quality as one monthly total and asks once (the author's: $469 a month: long Bash output to a file, the 1-hour cache). On Claude Code 2.1.286+, `install` enables the plugin, so npm users get the mod too (limit readings and Claude Code's own cost after each turn, Compact first, `/context-doctor-fix`). A weekly canary runs the plugin and mod in the newest Claude Code against a local mock API. `spend` estimates compaction requests and, for terminal sessions, subagent progress summaries, and `fix` can switch the summaries off. An audit fixed, among others, the GitHub Action's YAML (it could not load), programs planted in a cloned repository running on Windows, `pack_context` opening network shares, a re-pricing gap after upgrades, and a test that would have failed from 2026-12-16 ([details](./ROADMAP.md#shipped-in-0470-one-keystroke-the-mod-through-install-a-weekly-live-check-and-an-audit-of-046)).
|
|
191
198
|
- **0.46 Fable 5.2, the Desktop app, and an audit**: Claude Fable 5.2 is priced (0.45 read it 1.5x too high); managed `modelPricing` is honoured; a check catches new models without a price. The plugin's new mod brings limit readings, Claude Code's own cost and `/context-doctor-fix` with Apply and Undo buttons to the Desktop app, VS Code and the terminal, and a cache-expiry band with **Compact first** to the Desktop app and the terminal (Claude Code draws a mod's band on no other surface) ([Desktop](./docs/desktop.md), [details](./ROADMAP.md#shipped-in-0460-fable-52-the-desktop-app-and-an-audit-of-045)).
|
|
192
|
-
- **0.45 Price what is billed, and a security pass**: fast mode, US-only inference, Haiku 5.5's long-prompt rates, web searches and OpenAI's and Gemini's long-prompt tiers are priced per request in every report, and prices that end on a known day say so. A security pass fixed a cloned repository approving its own MCP servers for `overhead --mcp`, a PDF's name running as a command through `pack` on macOS, the agents' API-key configs being packed, and the proxy answering a DNS-rebinding page ([details](./ROADMAP.md#shipped-in-0450-price-what-is-billed-and-a-security-pass-on-044)).
|
|
193
|
-
- **0.44 Workflow agents on the bill, current prices, and an audit**: Claude Code's workflow agents were in no report: on the author's last 30 days $1,494 of $5,542. `spend`, the budget, a session's price, `subagents` and `fix` now count them, and `spend` equals an independent sum of every transcript to the cent. Prices re-read from each provider (Sonnet 5.5's cache read $0.10, gpt-5.5 $5/$30, the gpt-6 family); estimates are labelled. An audit fixed `overhead --mcp` launching a cloned repository's unapproved MCP servers, `pack_context` returning the agents' sign-in files, and more ([details](./ROADMAP.md#shipped-in-0440-workflow-agents-on-the-bill-current-prices-and-an-audit-of-043)).
|
|
194
|
-
- **0.43 Long tool output, `fix` for Codex, and a session's price**: every Bash result stays in the conversation and is re-read on every later message until a compaction; `fix` now replays them at lower caps and, on a yes, sets Claude Code's `bashOutputMaxChars`, so longer output goes to a file the model can still open after a 2,000-character preview (the author's 30 days: $323 less at 8k, 9% of input). `fix` also works for Codex: it replays your rollouts at earlier auto-compact limits and sets `model_auto_compact_token_limit` in `config.toml`, on a machine with only Codex too. And the every-prompt hook now tells you once when a session passes $25, $100 and $500, with what each message costs from there (the author's: 15 sessions passed $25 in 30 days and spent $3,369 after).
|
|
195
|
-
- **0.42 An audit of 0.41**: each Codex request counts once (forks repeat their parent's), the budget no longer double-counts a reply streamed across midnight, unpriced models show as such instead of $0, Cursor is read after it quits, and `CODEX_HOME` is followed everywhere. `fix`'s subagent lever reads agent files the way Claude Code merges them, and every writer of `settings.json` takes one lock, so concurrent runs lose nothing ([details](./ROADMAP.md#shipped-in-0420-an-audit-of-041)).
|
|
196
|
-
- **0.41 One bill, a budget, and the subagents' model**: `context-doctor spend` puts Claude Code (subagents included), Codex, Gemini CLI and Cursor on one bill by tool, project, model and day. `context-doctor budget 50/day` has the every-prompt hook tell you at 50%, 80% and 100%, and with `--block` holds prompts over budget; the status line shows `$12/$50 today`, at about 5 ms a prompt. `fix` gains `subagent-model`: subagents run on your main conversation's model (Opus or Fable included), and `CLAUDE_CODE_SUBAGENT_MODEL` set to Sonnet 5.5 would have cost the author $632 less in 30 days (38% of the subagents' $1,658); it changes the model, so it is applied only when you name it, and `fix undo` reverts it.
|
|
197
|
-
- **0.40 Reports in under a second**: `fix`, `savings`, `compact-window`, `cache-ttl`, `cache-misses` and `overhead` read each transcript once and keep what they took from it in `~/.cache/context-doctor`, so a second run reads only what was appended: `fix` 23.5 s → 0.4 s, `savings` 41 s → 0.6 s on the author's 2.7 GB history, every figure unchanged ([details](./docs/performance.md#the-transcript-cache)). Also from a QA pass on 0.39: `install` then `uninstall` gives every config back byte for byte, and `doctor` warns about an out-of-date skill.
|
|
198
|
-
- **0.39 `fix`, the cache lifetime, the cache clock, and Antigravity**: `context-doctor fix` turns the measurements into changes: every lever ranked by what it would have saved on your own sessions, with what each costs in quality, applied only on a yes, undone with `fix undo`, and re-measured afterwards (`/context-doctor:fix` in the plugin). `cache-ttl` replays your pauses at a 5-minute and a 1-hour prompt cache and sets Claude Code's `promptCacheTtl` to the cheaper one, a price-only change. On Claude Code 2.1.251+ the status line says until when the cache is warm and what going cold costs, `cache-misses` explains misses in Claude Code's own words, and `install` wires Google Antigravity.
|
|
199
|
-
- **0.38 Your limits in their own unit, regressions after upgrades, recall, and a subagent price**: `context-doctor limits` shows each plan window's %, pace and run-out time (Claude Pro/Max through the status line, Codex from its rollouts) and what 1M tokens cost in % of it, fitted on your readings with the error; `savings` then speaks in your limit too. `cache-misses` flags step changes after a Claude Code upgrade, `recall` searches the session's own transcript (compacted turns included), a hook prices a subagent before it starts (never blocking), and `overhead prune` switches off unused MCP servers and skills per project, reversibly. OpenAI caches count as warm for up to 24 hours. An independent QA pass's findings were fixed before the release.
|
|
200
|
-
- **0.37 Desktop chat apps: a handoff, uploads, compact results, and a security pass**: a chat app's history cannot be edited, so the `handoff` prompt (Claude Desktop's **+** menu) has the model write a ≤400-token brief and save it with `save_handoff` (secrets masked, `handoff://latest` to attach in the next chat, the per-turn saving reported: a 52k-token chat drops to ~600). `ask_file` answers from a big file through `pack_context`, which over `--http` also takes ChatGPT uploads; ChatGPT gets compact results. An independent QA pass's eleven findings were fixed with tests; **behind a tunnel, `--http` now needs `--allowed-hosts <tunnel host>`** ([handoff](./docs/handoff.md)).
|
|
201
199
|
|
|
202
200
|
Every release, with the details: [docs/whats-new.md](./docs/whats-new.md).
|
|
203
201
|
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Which MCP servers Claude Code hands context-doctor's mod, and how
|
|
3
|
+
* (ROADMAP H3): the evidence `fix`'s desktop-tools-defer and `doctor` read
|
|
4
|
+
* before anyone applies the lever.
|
|
5
|
+
*
|
|
6
|
+
* The mod's `tool.describe` hook (Claude Code 2.1.326+) sees each tool once
|
|
7
|
+
* per session with its server's transport (`mcpServer.type`) and whether the
|
|
8
|
+
* engine already lists it behind tool search (`isDeferred`). It keeps that in
|
|
9
|
+
* memory, per server, and hands it to `context-doctor mod measure` after the
|
|
10
|
+
* turn (the CLI it already runs), which appends one line per session here,
|
|
11
|
+
* changes only: a second measure of the same session with the same servers
|
|
12
|
+
* writes nothing. The mod draws nothing and moves nothing for this; with
|
|
13
|
+
* CONTEXT_DOCTOR_DEFER_MCP unset it only watches.
|
|
14
|
+
*
|
|
15
|
+
* `~/.claude/.context-doctor-tools.jsonl` (beside the session-cost ledger),
|
|
16
|
+
* capped as that one is: past 128 KB it keeps its newest 96 KB (a line is
|
|
17
|
+
* ~400 bytes: months of sessions). Off: CONTEXT_DOCTOR_NO_COST_LOG=1, as the
|
|
18
|
+
* session-cost ledger.
|
|
19
|
+
*/
|
|
20
|
+
/** One server as the mod saw it in a session. */
|
|
21
|
+
export interface ToolServerSeen {
|
|
22
|
+
server: string;
|
|
23
|
+
/** `mcpServer.type`: stdio, http, sse, ws, sdk (in-process, the Desktop app's own), sse-ide, ws-ide, claudeai-proxy. */
|
|
24
|
+
type: string;
|
|
25
|
+
/** Its tools the engine described in that session. */
|
|
26
|
+
tools: number;
|
|
27
|
+
/** Every one of them came already behind tool search (the engine's own rule). */
|
|
28
|
+
deferredByHost: boolean;
|
|
29
|
+
/** The mod put them behind tool search (CONTEXT_DOCTOR_DEFER_MCP named the server). */
|
|
30
|
+
movedByUs: boolean;
|
|
31
|
+
}
|
|
32
|
+
/** One session's servers. */
|
|
33
|
+
export interface ToolsLine {
|
|
34
|
+
ts: number;
|
|
35
|
+
sid: string;
|
|
36
|
+
/** `session.start`'s surface: desktop, terminal, vscode; absent when the engine gave none. */
|
|
37
|
+
surface?: string;
|
|
38
|
+
servers: ToolServerSeen[];
|
|
39
|
+
}
|
|
40
|
+
export declare function toolsLogPath(): string;
|
|
41
|
+
/** The servers as the mod sent them, cleaned: valid names and types only, each once, sorted by name. */
|
|
42
|
+
export declare function cleanServers(list: unknown): ToolServerSeen[];
|
|
43
|
+
/**
|
|
44
|
+
* Append a session's servers, unless its last line says the same (the mod
|
|
45
|
+
* sends them again only when they changed, and a second window of the same
|
|
46
|
+
* session may send them too). Never throws. True when a line was written.
|
|
47
|
+
*/
|
|
48
|
+
export declare function recordToolServers(line: {
|
|
49
|
+
ts: number;
|
|
50
|
+
sid: string;
|
|
51
|
+
surface?: string;
|
|
52
|
+
servers: unknown;
|
|
53
|
+
}, path?: string): boolean;
|
|
54
|
+
/** Every line since `since`, each session's last only (a session's servers grow as they connect). */
|
|
55
|
+
export declare function readToolLines(since?: number, path?: string): ToolsLine[];
|
|
56
|
+
/** A Desktop session: the surface says so, or (no surface given) the app's own servers are in it. */
|
|
57
|
+
export declare function isDesktopLine(l: ToolsLine): boolean;
|
|
58
|
+
/** The newest Desktop session the mod recorded, or undefined. */
|
|
59
|
+
export declare function newestDesktop(lines: ToolsLine[]): ToolsLine | undefined;
|
|
60
|
+
/**
|
|
61
|
+
* What the newest Desktop session says of the servers the lever would name:
|
|
62
|
+
* those that arrive whole (the setting reaches them), those Claude Code
|
|
63
|
+
* already keeps behind tool search (nothing to do), those the mod was never
|
|
64
|
+
* shown (the setting would not reach them). Undefined with no Desktop session
|
|
65
|
+
* on record: not yet known.
|
|
66
|
+
*/
|
|
67
|
+
export interface AppToolsVerdict {
|
|
68
|
+
at: number;
|
|
69
|
+
reach: ToolServerSeen[];
|
|
70
|
+
hostDefers: ToolServerSeen[];
|
|
71
|
+
unseen: string[];
|
|
72
|
+
}
|
|
73
|
+
export declare function appToolsVerdict(lines: ToolsLine[], servers: readonly string[]): AppToolsVerdict | undefined;
|
|
74
|
+
/** The verdict's sentences, for fix's lines. */
|
|
75
|
+
export declare function verdictLines(v: AppToolsVerdict): string[];
|
|
76
|
+
/** Sessions in which the mod moved a server's tools behind tool search, and the first of them. */
|
|
77
|
+
export declare function movedSessions(lines: ToolsLine[]): {
|
|
78
|
+
sessions: number;
|
|
79
|
+
since?: number;
|
|
80
|
+
servers: string[];
|
|
81
|
+
};
|
|
82
|
+
/**
|
|
83
|
+
* `doctor`'s line: the servers the newest Desktop session handed the mod,
|
|
84
|
+
* their type, and what desktop-tools-defer would do with them. A fact, not a
|
|
85
|
+
* fault. Undefined when the mod recorded no Desktop session.
|
|
86
|
+
*/
|
|
87
|
+
export declare function appToolsCheckText(lines: ToolsLine[]): string | undefined;
|
|
88
|
+
/** The ledger's lines of the last `days`, never throwing. */
|
|
89
|
+
export declare function recentToolLines(days?: number, now?: number, path?: string): ToolsLine[];
|
package/dist/apptools.js
ADDED
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Which MCP servers Claude Code hands context-doctor's mod, and how
|
|
3
|
+
* (ROADMAP H3): the evidence `fix`'s desktop-tools-defer and `doctor` read
|
|
4
|
+
* before anyone applies the lever.
|
|
5
|
+
*
|
|
6
|
+
* The mod's `tool.describe` hook (Claude Code 2.1.326+) sees each tool once
|
|
7
|
+
* per session with its server's transport (`mcpServer.type`) and whether the
|
|
8
|
+
* engine already lists it behind tool search (`isDeferred`). It keeps that in
|
|
9
|
+
* memory, per server, and hands it to `context-doctor mod measure` after the
|
|
10
|
+
* turn (the CLI it already runs), which appends one line per session here,
|
|
11
|
+
* changes only: a second measure of the same session with the same servers
|
|
12
|
+
* writes nothing. The mod draws nothing and moves nothing for this; with
|
|
13
|
+
* CONTEXT_DOCTOR_DEFER_MCP unset it only watches.
|
|
14
|
+
*
|
|
15
|
+
* `~/.claude/.context-doctor-tools.jsonl` (beside the session-cost ledger),
|
|
16
|
+
* capped as that one is: past 128 KB it keeps its newest 96 KB (a line is
|
|
17
|
+
* ~400 bytes: months of sessions). Off: CONTEXT_DOCTOR_NO_COST_LOG=1, as the
|
|
18
|
+
* session-cost ledger.
|
|
19
|
+
*/
|
|
20
|
+
import { appendFileSync, closeSync, existsSync, mkdirSync, openSync, readFileSync, readSync, statSync, writeFileSync } from "node:fs";
|
|
21
|
+
import { dirname, join } from "node:path";
|
|
22
|
+
import { statePath } from "./ledger.js";
|
|
23
|
+
import { APP_TOOL_SERVERS } from "./mod/logic.js";
|
|
24
|
+
export function toolsLogPath() {
|
|
25
|
+
return join(dirname(statePath()), ".context-doctor-tools.jsonl");
|
|
26
|
+
}
|
|
27
|
+
const ROTATE_AT = 128 * 1024;
|
|
28
|
+
const KEEP_BYTES = 96 * 1024;
|
|
29
|
+
const MAX_SERVERS = 60;
|
|
30
|
+
const NAME = /^[A-Za-z0-9_.-]{1,80}$/;
|
|
31
|
+
const TYPE = /^[a-z-]{1,20}$/;
|
|
32
|
+
/** The servers as the mod sent them, cleaned: valid names and types only, each once, sorted by name. */
|
|
33
|
+
export function cleanServers(list) {
|
|
34
|
+
if (!Array.isArray(list))
|
|
35
|
+
return [];
|
|
36
|
+
const out = new Map();
|
|
37
|
+
for (const s of list) {
|
|
38
|
+
if (!s || typeof s !== "object")
|
|
39
|
+
continue;
|
|
40
|
+
const { server, type, tools, deferredByHost, movedByUs } = s;
|
|
41
|
+
if (typeof server !== "string" || !NAME.test(server) || typeof type !== "string" || !TYPE.test(type) || out.has(server))
|
|
42
|
+
continue;
|
|
43
|
+
const n = typeof tools === "number" && Number.isFinite(tools) && tools >= 0 ? Math.min(10_000, Math.round(tools)) : 0;
|
|
44
|
+
out.set(server, { server, type, tools: n, deferredByHost: deferredByHost === true, movedByUs: movedByUs === true });
|
|
45
|
+
if (out.size >= MAX_SERVERS)
|
|
46
|
+
break;
|
|
47
|
+
}
|
|
48
|
+
return [...out.values()].sort((a, b) => (a.server < b.server ? -1 : a.server > b.server ? 1 : 0));
|
|
49
|
+
}
|
|
50
|
+
function parseLine(line) {
|
|
51
|
+
let e;
|
|
52
|
+
try {
|
|
53
|
+
e = JSON.parse(line);
|
|
54
|
+
}
|
|
55
|
+
catch {
|
|
56
|
+
return undefined;
|
|
57
|
+
}
|
|
58
|
+
if (!e || typeof e !== "object" || typeof e.ts !== "number" || !Number.isFinite(e.ts) || typeof e.sid !== "string")
|
|
59
|
+
return undefined;
|
|
60
|
+
const servers = cleanServers(e.servers);
|
|
61
|
+
if (!servers.length)
|
|
62
|
+
return undefined;
|
|
63
|
+
return { ts: e.ts, sid: e.sid, ...(typeof e.surface === "string" && TYPE.test(e.surface) ? { surface: e.surface } : {}), servers };
|
|
64
|
+
}
|
|
65
|
+
function tail(path, bytes) {
|
|
66
|
+
const size = statSync(path).size;
|
|
67
|
+
const n = Math.min(size, bytes);
|
|
68
|
+
const fd = openSync(path, "r");
|
|
69
|
+
try {
|
|
70
|
+
const buf = Buffer.alloc(n);
|
|
71
|
+
readSync(fd, buf, 0, n, size - n);
|
|
72
|
+
return buf.toString("utf8");
|
|
73
|
+
}
|
|
74
|
+
finally {
|
|
75
|
+
closeSync(fd);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Append a session's servers, unless its last line says the same (the mod
|
|
80
|
+
* sends them again only when they changed, and a second window of the same
|
|
81
|
+
* session may send them too). Never throws. True when a line was written.
|
|
82
|
+
*/
|
|
83
|
+
export function recordToolServers(line, path = toolsLogPath()) {
|
|
84
|
+
if (!/^[\w.-]{1,100}$/.test(line.sid))
|
|
85
|
+
return false;
|
|
86
|
+
const servers = cleanServers(line.servers);
|
|
87
|
+
if (!servers.length)
|
|
88
|
+
return false;
|
|
89
|
+
const out = { ts: line.ts, sid: line.sid, ...(line.surface && TYPE.test(line.surface) ? { surface: line.surface } : {}), servers };
|
|
90
|
+
try {
|
|
91
|
+
if (existsSync(path)) {
|
|
92
|
+
let last;
|
|
93
|
+
for (const l of tail(path, 32 * 1024).split("\n")) {
|
|
94
|
+
const p = parseLine(l);
|
|
95
|
+
if (p && p.sid === out.sid)
|
|
96
|
+
last = p;
|
|
97
|
+
}
|
|
98
|
+
if (last && JSON.stringify(last.servers) === JSON.stringify(out.servers))
|
|
99
|
+
return false;
|
|
100
|
+
}
|
|
101
|
+
mkdirSync(dirname(path), { recursive: true });
|
|
102
|
+
if (existsSync(path) && statSync(path).size > ROTATE_AT) {
|
|
103
|
+
const text = tail(path, KEEP_BYTES);
|
|
104
|
+
writeFileSync(path, text.slice(text.indexOf("\n") + 1));
|
|
105
|
+
}
|
|
106
|
+
appendFileSync(path, JSON.stringify(out) + "\n");
|
|
107
|
+
return true;
|
|
108
|
+
}
|
|
109
|
+
catch {
|
|
110
|
+
return false;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
/** Every line since `since`, each session's last only (a session's servers grow as they connect). */
|
|
114
|
+
export function readToolLines(since = 0, path = toolsLogPath()) {
|
|
115
|
+
let text;
|
|
116
|
+
try {
|
|
117
|
+
text = readFileSync(path, "utf8");
|
|
118
|
+
}
|
|
119
|
+
catch {
|
|
120
|
+
return [];
|
|
121
|
+
}
|
|
122
|
+
const bySid = new Map();
|
|
123
|
+
for (const l of text.split("\n")) {
|
|
124
|
+
const p = parseLine(l);
|
|
125
|
+
if (p && p.ts >= since)
|
|
126
|
+
bySid.set(p.sid, p);
|
|
127
|
+
}
|
|
128
|
+
return [...bySid.values()].sort((a, b) => a.ts - b.ts);
|
|
129
|
+
}
|
|
130
|
+
/** A Desktop session: the surface says so, or (no surface given) the app's own servers are in it. */
|
|
131
|
+
export function isDesktopLine(l) {
|
|
132
|
+
return l.surface === "desktop" || (l.surface === undefined && l.servers.some((s) => APP_TOOL_SERVERS.includes(s.server)));
|
|
133
|
+
}
|
|
134
|
+
/** The newest Desktop session the mod recorded, or undefined. */
|
|
135
|
+
export function newestDesktop(lines) {
|
|
136
|
+
return [...lines].reverse().find(isDesktopLine);
|
|
137
|
+
}
|
|
138
|
+
const day = (ts) => new Date(ts).toISOString().slice(0, 10);
|
|
139
|
+
/** "Claude_Browser (sdk, 12 tools)". */
|
|
140
|
+
const seenText = (s) => `${s.server} (${s.type}, ${s.tools} tool${s.tools === 1 ? "" : "s"})`;
|
|
141
|
+
const list = (names) => (names.length <= 1 ? names.join("") : `${names.slice(0, -1).join(", ")} and ${names[names.length - 1]}`);
|
|
142
|
+
export function appToolsVerdict(lines, servers) {
|
|
143
|
+
const d = newestDesktop(lines);
|
|
144
|
+
if (!d)
|
|
145
|
+
return undefined;
|
|
146
|
+
const reach = [], hostDefers = [], unseen = [];
|
|
147
|
+
for (const name of servers) {
|
|
148
|
+
const s = d.servers.find((x) => x.server === name);
|
|
149
|
+
if (!s)
|
|
150
|
+
unseen.push(name);
|
|
151
|
+
else if (s.deferredByHost)
|
|
152
|
+
hostDefers.push(s);
|
|
153
|
+
else
|
|
154
|
+
reach.push(s);
|
|
155
|
+
}
|
|
156
|
+
return { at: d.ts, reach, hostDefers, unseen };
|
|
157
|
+
}
|
|
158
|
+
/** The verdict's sentences, for fix's lines. */
|
|
159
|
+
export function verdictLines(v) {
|
|
160
|
+
const out = [];
|
|
161
|
+
const when = `your Desktop session of ${day(v.at)}`;
|
|
162
|
+
if (v.reach.length)
|
|
163
|
+
out.push(`Seen in ${when}: ${list(v.reach.map(seenText))} ${v.reach.length === 1 ? "arrives" : "arrive"} whole${v.reach.every((s) => s.type === "sdk") ? " as in-process (sdk) servers" : ""}, and Claude Code tells context-doctor's mod which server each tool is from, so this setting reaches ${v.reach.length === 1 ? "it" : "them"}.`);
|
|
164
|
+
if (v.hostDefers.length)
|
|
165
|
+
out.push(`Claude Code already keeps ${list(v.hostDefers.map((s) => s.server))} behind tool search (${when}): nothing to move there.`);
|
|
166
|
+
if (v.unseen.length)
|
|
167
|
+
out.push(`Claude Code did not show context-doctor's mod ${list(v.unseen)}'s tools in ${when}, so the setting would not reach ${v.unseen.length === 1 ? "it" : "them"} there.`);
|
|
168
|
+
return out;
|
|
169
|
+
}
|
|
170
|
+
/** Sessions in which the mod moved a server's tools behind tool search, and the first of them. */
|
|
171
|
+
export function movedSessions(lines) {
|
|
172
|
+
const moved = lines.filter((l) => l.servers.some((s) => s.movedByUs));
|
|
173
|
+
const servers = [...new Set(moved.flatMap((l) => l.servers.filter((s) => s.movedByUs).map((s) => s.server)))].sort();
|
|
174
|
+
return { sessions: moved.length, ...(moved.length ? { since: moved[0].ts } : {}), servers };
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* `doctor`'s line: the servers the newest Desktop session handed the mod,
|
|
178
|
+
* their type, and what desktop-tools-defer would do with them. A fact, not a
|
|
179
|
+
* fault. Undefined when the mod recorded no Desktop session.
|
|
180
|
+
*/
|
|
181
|
+
export function appToolsCheckText(lines) {
|
|
182
|
+
const d = newestDesktop(lines);
|
|
183
|
+
if (!d)
|
|
184
|
+
return undefined;
|
|
185
|
+
const parts = d.servers.map((s) => `${seenText(s)}${s.movedByUs ? ", moved behind tool search by context-doctor" : s.deferredByHost ? ", behind tool search already" : ", sent whole"}`);
|
|
186
|
+
const whole = d.servers.filter((s) => !s.deferredByHost && !s.movedByUs && APP_TOOL_SERVERS.includes(s.server)).map((s) => s.server);
|
|
187
|
+
const moved = movedSessions(lines);
|
|
188
|
+
const tail = moved.sessions
|
|
189
|
+
? `; moved behind tool search in ${moved.sessions} session${moved.sessions === 1 ? "" : "s"} since ${day(moved.since)}`
|
|
190
|
+
: whole.length
|
|
191
|
+
? `; context-doctor fix --apply desktop-tools-defer would move ${list(whole)} (it reaches them)`
|
|
192
|
+
: "";
|
|
193
|
+
return `your Desktop session of ${day(d.ts)} handed context-doctor's mod ${parts.join("; ")}${tail}`;
|
|
194
|
+
}
|
|
195
|
+
/** The ledger's lines of the last `days`, never throwing. */
|
|
196
|
+
export function recentToolLines(days = 30, now = Date.now(), path = toolsLogPath()) {
|
|
197
|
+
try {
|
|
198
|
+
return readToolLines(now - days * 86_400_000, path);
|
|
199
|
+
}
|
|
200
|
+
catch {
|
|
201
|
+
return [];
|
|
202
|
+
}
|
|
203
|
+
}
|
package/dist/appwindow.d.ts
CHANGED
|
@@ -62,6 +62,12 @@ export declare const hasAppWindows: (a: AppWindows | undefined) => a is AppWindo
|
|
|
62
62
|
export declare function modelKey(model: string): string;
|
|
63
63
|
/** Whether a transcript's model is the one an answer names ("opus" and the like match their family). */
|
|
64
64
|
export declare function sameModel(answer: string, model: string): boolean;
|
|
65
|
+
/**
|
|
66
|
+
* `doctor`'s one line: each answer on file, in plain words ("on 2026-11-18
|
|
67
|
+
* the Desktop app offered a 400k auto-compact window for Opus 5.5 and you
|
|
68
|
+
* accepted it"). Undefined when there is none.
|
|
69
|
+
*/
|
|
70
|
+
export declare function appAnswerText(a: AppWindows): string | undefined;
|
|
65
71
|
/**
|
|
66
72
|
* The lines `compact-window` and `fix` say about it (none when nothing is on
|
|
67
73
|
* file). `left`: the sessions the replay left as they ran, when known.
|
package/dist/appwindow.js
CHANGED
|
@@ -112,9 +112,23 @@ export function sameModel(answer, model) {
|
|
|
112
112
|
return m.includes(a);
|
|
113
113
|
return a === m;
|
|
114
114
|
}
|
|
115
|
-
|
|
115
|
+
/** A window in tokens: "300k", "1M", "1.5M" (a 1M window read "1000k"). */
|
|
116
|
+
const k = (n) => (n >= 999_500 ? `${Number((n / 1_000_000).toFixed(1))}M` : `${Math.round(n / 1000)}k`);
|
|
116
117
|
const day = (ms) => new Date(ms).toISOString().slice(0, 10);
|
|
117
118
|
const nameOf = (m) => modelName(m) === m ? m : modelName(m);
|
|
119
|
+
/**
|
|
120
|
+
* `doctor`'s one line: each answer on file, in plain words ("on 2026-11-18
|
|
121
|
+
* the Desktop app offered a 400k auto-compact window for Opus 5.5 and you
|
|
122
|
+
* accepted it"). Undefined when there is none.
|
|
123
|
+
*/
|
|
124
|
+
export function appAnswerText(a) {
|
|
125
|
+
if (!a.answers.length)
|
|
126
|
+
return undefined;
|
|
127
|
+
const one = (x) => x.choice === "accept" ? `on ${day(x.at)} the Desktop app offered a ${k(x.tokens)} auto-compact window for ${nameOf(x.model)} and you accepted it`
|
|
128
|
+
: x.choice === "keep" ? `on ${day(x.at)} the Desktop app offered a lower auto-compact window for ${nameOf(x.model)} and you kept yours (${k(x.tokens)})`
|
|
129
|
+
: `on ${day(x.at)} you undid the lower auto-compact window the Desktop app had set for ${nameOf(x.model)} (on record: ${k(x.tokens)})`;
|
|
130
|
+
return a.answers.map(one).join("; ");
|
|
131
|
+
}
|
|
118
132
|
/**
|
|
119
133
|
* The lines `compact-window` and `fix` say about it (none when nothing is on
|
|
120
134
|
* file). `left`: the sessions the replay left as they ran, when known.
|
package/dist/budget.d.ts
CHANGED
|
@@ -23,6 +23,7 @@
|
|
|
23
23
|
* replies count once. Measured on the author's history: docs/spend.md.
|
|
24
24
|
*/
|
|
25
25
|
import { type Tool } from "./spend.js";
|
|
26
|
+
import { type CreditsAhead, type CreditsSummary } from "./credits.js";
|
|
26
27
|
import { type CompactTrack } from "./compactcost.js";
|
|
27
28
|
export type Period = "day" | "week";
|
|
28
29
|
export interface Budget {
|
|
@@ -155,6 +156,19 @@ export declare function periodSpend(period: Period, now?: number, home?: string,
|
|
|
155
156
|
export declare const THRESHOLDS: readonly [50, 80, 100];
|
|
156
157
|
/** The highest threshold `usd` has reached of `budget` (0 below the first). */
|
|
157
158
|
export declare function levelOf(usd: number, budget: number): number;
|
|
159
|
+
/**
|
|
160
|
+
* Claude Code's part of the period that ran past the plan's limit, paid from
|
|
161
|
+
* usage credits (credits.ts): already in the period's dollars, said apart.
|
|
162
|
+
* Reads the limits ledger, and the transcripts only when the ledger says a
|
|
163
|
+
* limit ran out or credits were in use. Undefined when nothing was; never
|
|
164
|
+
* throws (a damaged ledger must not cost the budget its line).
|
|
165
|
+
*/
|
|
166
|
+
export declare function periodCredits(start: number, now?: number, home?: string): CreditsSummary | undefined;
|
|
167
|
+
/**
|
|
168
|
+
* "$4.20 of this was paid from usage credits, past your plan's limit (37
|
|
169
|
+
* requests, at API list prices, an estimate)." Inferred ones say so.
|
|
170
|
+
*/
|
|
171
|
+
export declare function creditsLine(c: CreditsSummary | undefined): string | undefined;
|
|
158
172
|
export interface BudgetVerdict {
|
|
159
173
|
/** A line for the user, once per threshold per period. */
|
|
160
174
|
message?: string;
|
|
@@ -170,7 +184,11 @@ export interface BudgetVerdict {
|
|
|
170
184
|
export declare function budgetVerdict(now?: number, home?: string): BudgetVerdict | undefined;
|
|
171
185
|
/** The status line's part: "$12/$50 today", or undefined with no budget set. */
|
|
172
186
|
export declare function budgetStatus(now?: number, home?: string): string | undefined;
|
|
173
|
-
/**
|
|
174
|
-
|
|
187
|
+
/**
|
|
188
|
+
* `budget` with no argument, and after setting one: the budget and where the
|
|
189
|
+
* period stands. `ahead`: the weekly limit running out before its reset with
|
|
190
|
+
* extra usage on (credits.ts creditsAheadNow), said in one line.
|
|
191
|
+
*/
|
|
192
|
+
export declare function renderBudgetStatus(b: Budget | undefined, s: PeriodSpend | undefined, hookInstalled: boolean, credits?: CreditsSummary, ahead?: CreditsAhead, now?: number): string;
|
|
175
193
|
/** Our every-prompt hook in Claude Code, Codex or Gemini CLI, or the plugin's. */
|
|
176
194
|
export declare function promptHookInstalled(home?: string): boolean;
|