context-doctor 0.3.2 → 0.3.4
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 +18 -1
- package/dist/mcp.js +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -6,6 +6,8 @@ Every long-running LLM conversation slowly fills up with junk: duplicated docume
|
|
|
6
6
|
|
|
7
7
|
`context-doctor` is a zero-config profiler + optimizer for LLM contexts. It works with **Claude, GPT, Gemini** message formats, and plugs into **Claude Desktop, ChatGPT (developer mode), Cursor, Claude Code** — any MCP-capable app — or runs standalone from the terminal.
|
|
8
8
|
|
|
9
|
+
Built and maintained by [gAI Ventures](https://gai.ventures).
|
|
10
|
+
|
|
9
11
|
```
|
|
10
12
|
Where the tokens go
|
|
11
13
|
────────────────────────────────────────────────────────
|
|
@@ -66,6 +68,21 @@ One run of `npx context-doctor install` writes five things (each config edit mak
|
|
|
66
68
|
|
|
67
69
|
**What it never does:** delete or rewrite your history without asking (pruning is consent-only, and the model writes the replacement summary so nothing is lost silently), send data anywhere (everything runs on your machine), or touch an API key.
|
|
68
70
|
|
|
71
|
+
## Do you need MCP? Only sometimes — all the ways to use context-doctor
|
|
72
|
+
|
|
73
|
+
MCP is just one of six delivery mechanisms. It's only required when you want the AI **inside a chat app** to run the tools itself. Everything else works without it:
|
|
74
|
+
|
|
75
|
+
| How you use it | MCP needed? | What it requires |
|
|
76
|
+
|---|---|---|
|
|
77
|
+
| **CLI** — `analyze`, `optimize`, `session` on files/transcripts | ❌ No | Nothing but `npx` — works in any terminal, scripts, CI |
|
|
78
|
+
| **Proxy** — always-on optimization of your API apps | ❌ No | `context-doctor proxy` + one env var in your app |
|
|
79
|
+
| **Claude Code every-prompt hook** | ❌ No | Written by `install`; Claude Code invokes it directly |
|
|
80
|
+
| **Agent Skill** — hygiene behavior in Claude Code / claude.ai | ❌ No | A markdown file; `install` places it (or upload to claude.ai) |
|
|
81
|
+
| **Library** — `import { profileConversation } from "context-doctor"` | ❌ No | `npm install context-doctor` in your project |
|
|
82
|
+
| **In-chat tools** — Claude Desktop, ChatGPT desktop, Cursor chat | ✅ Yes | This is the only MCP piece — so the model itself can call `profile_context` / `optimize_context` mid-conversation |
|
|
83
|
+
|
|
84
|
+
Practical upshot: a developer who only wants cheaper, faster API calls never touches MCP (proxy + CLI). A Claude Code user gets the hook and skill without MCP either — the MCP server just adds in-chat tools on top. `install` sets up all of it at once precisely so you don't have to think about which mechanism is which.
|
|
85
|
+
|
|
69
86
|
## What "always-on" means, per surface
|
|
70
87
|
|
|
71
88
|
| Where you run LLMs | Mechanism | Guarantee |
|
|
@@ -259,4 +276,4 @@ Also keep the MCP server version in `src/mcp.ts` in sync with `package.json`, an
|
|
|
259
276
|
|
|
260
277
|
## License
|
|
261
278
|
|
|
262
|
-
MIT
|
|
279
|
+
MIT © [gAI Ventures](https://gai.ventures)
|
package/dist/mcp.js
CHANGED
|
@@ -31,7 +31,7 @@ const SERVER_INSTRUCTIONS = `context-doctor keeps this conversation's context wi
|
|
|
31
31
|
2. When the conversation has grown long (roughly 30+ turns) or contains several large pastes, proactively offer to profile it and call profile_context — do not wait to be asked.
|
|
32
32
|
3. When the user asks anything about token usage, cost, latency, or "what's eating my context", call profile_context immediately rather than estimating by eye.
|
|
33
33
|
4. When optimize_context returns a pruned-turns digest, YOU write the replacement summary (dense, factual, ≤150 tokens) as instructed in the result.`;
|
|
34
|
-
const server = new McpServer({ name: "context-doctor", version: "0.3.
|
|
34
|
+
const server = new McpServer({ name: "context-doctor", version: "0.3.4" }, { instructions: SERVER_INSTRUCTIONS });
|
|
35
35
|
const STRATEGY_IDS = ["dedupe", "trim-tool-results", "strip-base64", "prune-history"];
|
|
36
36
|
server.tool("profile_context", "Profile an LLM conversation or prompt: token breakdown by category, largest messages, and actionable findings about wasted context (duplicates, oversized tool results, base64 blobs, cache-unfriendly ordering). Accepts OpenAI/Anthropic conversation JSON or raw text. Call this immediately whenever the user asks about token usage, context size, LLM cost, or latency — and proactively offer it once a conversation grows long or accumulates large pasted content.", {
|
|
37
37
|
conversation: z.string().describe("Conversation JSON (OpenAI or Anthropic format, or bare message array) or raw prompt text"),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "context-doctor",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.4",
|
|
4
4
|
"description": "Profile and optimize LLM context windows. See what's eating your tokens and fix it — works with Claude, GPT, Gemini, and any MCP-capable AI app.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"llm",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"prompt-caching"
|
|
16
16
|
],
|
|
17
17
|
"license": "MIT",
|
|
18
|
-
"author": "
|
|
18
|
+
"author": "gAI Ventures (https://gai.ventures)",
|
|
19
19
|
"repository": {
|
|
20
20
|
"type": "git",
|
|
21
21
|
"url": "git+https://github.com/KushalP1/context-doctor.git"
|