claudectx 1.0.0 → 1.1.1
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 +132 -1
- package/dist/index.js +1423 -27
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1423 -27
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -28,6 +28,10 @@ A typical Claude Code session costs **$2–$15 in tokens**. Most of it is wasted
|
|
|
28
28
|
| Full file reads for small questions | 70% overhead from unnecessary lines | `claudectx mcp` |
|
|
29
29
|
| No prompt caching configured | Paying 10× for static context | `claudectx optimize --cache` |
|
|
30
30
|
| No cross-session memory | Repeating the same context every session | `claudectx compress` |
|
|
31
|
+
| Dead `@refs` and stale sections in CLAUDE.md | Silent token waste on every request | `claudectx drift` |
|
|
32
|
+
| Unknown cost before running a big task | Surprise bills after the fact | `claudectx budget` |
|
|
33
|
+
| Cache cold at session start | First request always a full miss | `claudectx warmup` |
|
|
34
|
+
| No visibility into team-wide spend | Can't attribute cost across devs | `claudectx teams` |
|
|
31
35
|
|
|
32
36
|
### Where your tokens actually go
|
|
33
37
|
|
|
@@ -59,6 +63,23 @@ claudectx compress
|
|
|
59
63
|
|
|
60
64
|
# Review your token spend for the last 7 days
|
|
61
65
|
claudectx report
|
|
66
|
+
|
|
67
|
+
# --- v1.1.0 additions ---
|
|
68
|
+
|
|
69
|
+
# Know the cost before you start a task
|
|
70
|
+
claudectx budget "src/**/*.ts" "tests/**/*.ts"
|
|
71
|
+
|
|
72
|
+
# Pre-warm your prompt cache so the first request is free
|
|
73
|
+
claudectx warmup --api-key $ANTHROPIC_API_KEY
|
|
74
|
+
|
|
75
|
+
# Find dead references and stale sections in CLAUDE.md
|
|
76
|
+
claudectx drift
|
|
77
|
+
|
|
78
|
+
# Convert CLAUDE.md to Cursor / Copilot / Windsurf format
|
|
79
|
+
claudectx convert --to cursor
|
|
80
|
+
|
|
81
|
+
# Export your usage data for team-wide cost attribution
|
|
82
|
+
claudectx teams export
|
|
62
83
|
```
|
|
63
84
|
|
|
64
85
|
## Installation
|
|
@@ -229,6 +250,116 @@ DAILY USAGE
|
|
|
229
250
|
|
|
230
251
|
---
|
|
231
252
|
|
|
253
|
+
### `claudectx budget` — Know the cost before you start
|
|
254
|
+
|
|
255
|
+
Before running a big task, see exactly which files will be read, how many tokens they'll consume, and what it'll cost.
|
|
256
|
+
|
|
257
|
+
```bash
|
|
258
|
+
claudectx budget "src/**/*.ts" # Estimate all TypeScript files
|
|
259
|
+
claudectx budget "**/*.py" --threshold 20000 # Warn if total exceeds 20K tokens
|
|
260
|
+
claudectx budget "src/**" --model opus --json # JSON output for scripting
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
Output shows per-file token counts, cache hit likelihood (based on your recent reads), total cost estimate, and `.claudeignore` recommendations for files that are large but rarely useful.
|
|
264
|
+
|
|
265
|
+
---
|
|
266
|
+
|
|
267
|
+
### `claudectx warmup` — Pre-warm the prompt cache
|
|
268
|
+
|
|
269
|
+
Start each session with a cache hit instead of a full miss. Sends a silent priming request to Anthropic so your CLAUDE.md is cached before Claude Code touches it.
|
|
270
|
+
|
|
271
|
+
```bash
|
|
272
|
+
claudectx warmup --api-key $ANTHROPIC_API_KEY # 5-min cache TTL (default)
|
|
273
|
+
claudectx warmup --ttl 60 --api-key $ANTHROPIC_API_KEY # 60-min extended TTL
|
|
274
|
+
claudectx warmup --cron "0 9 * * 1-5" --api-key ... # Install as daily cron job
|
|
275
|
+
claudectx warmup --json # Output result as JSON
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
Reports tokens warmed, write cost, savings per cache hit, and break-even request count.
|
|
279
|
+
|
|
280
|
+
---
|
|
281
|
+
|
|
282
|
+
### `claudectx drift` — CLAUDE.md stays fresh, not stale
|
|
283
|
+
|
|
284
|
+
Over time CLAUDE.md accumulates dead references and sections nobody reads. `drift` finds them.
|
|
285
|
+
|
|
286
|
+
```bash
|
|
287
|
+
claudectx drift # Scan current project
|
|
288
|
+
claudectx drift --days 14 # Use 14-day read window (default: 30)
|
|
289
|
+
claudectx drift --fix # Interactively remove flagged lines
|
|
290
|
+
claudectx drift --json # JSON output
|
|
291
|
+
```
|
|
292
|
+
|
|
293
|
+
Detects 4 types of drift:
|
|
294
|
+
|
|
295
|
+
| Type | Example |
|
|
296
|
+
|---|---|
|
|
297
|
+
| **Dead `@ref`** | `@src/old-service.ts` — file deleted |
|
|
298
|
+
| **Git-deleted mention** | `legacy-auth.py` appears in prose but was removed in git |
|
|
299
|
+
| **Stale section** | `## Android Setup` — zero reads in 30 days |
|
|
300
|
+
| **Dead inline path** | `src/utils/helper.py` mentioned in text, no longer exists |
|
|
301
|
+
|
|
302
|
+
---
|
|
303
|
+
|
|
304
|
+
### `claudectx hooks` — Hook marketplace
|
|
305
|
+
|
|
306
|
+
Install named, pre-configured hooks beyond the basic read logger.
|
|
307
|
+
|
|
308
|
+
```bash
|
|
309
|
+
claudectx hooks list # Show all available hooks
|
|
310
|
+
claudectx hooks add auto-compress --config apiKey=sk-... # Install a hook
|
|
311
|
+
claudectx hooks remove slack-digest # Remove an installed hook
|
|
312
|
+
claudectx hooks status # Show what's installed
|
|
313
|
+
```
|
|
314
|
+
|
|
315
|
+
**Built-in hooks:**
|
|
316
|
+
|
|
317
|
+
| Hook | Trigger | What it does |
|
|
318
|
+
|---|---|---|
|
|
319
|
+
| `auto-compress` | PostToolUse (Read) | Runs `claudectx compress` after each session |
|
|
320
|
+
| `daily-budget` | PreToolUse | Checks token budget before each tool call |
|
|
321
|
+
| `slack-digest` | Stop | Posts session report to a Slack webhook |
|
|
322
|
+
| `session-warmup` | PostToolUse (Read) | Re-warms the cache after each read |
|
|
323
|
+
|
|
324
|
+
---
|
|
325
|
+
|
|
326
|
+
### `claudectx convert` — Use your CLAUDE.md everywhere
|
|
327
|
+
|
|
328
|
+
You wrote great instructions for Claude. Use them with Cursor, Copilot, or Windsurf too.
|
|
329
|
+
|
|
330
|
+
```bash
|
|
331
|
+
claudectx convert --to cursor # → .cursor/rules/<section>.mdc (one per ## section)
|
|
332
|
+
claudectx convert --to copilot # → .github/copilot-instructions.md
|
|
333
|
+
claudectx convert --to windsurf # → .windsurfrules
|
|
334
|
+
claudectx convert --to cursor --dry-run # Preview without writing
|
|
335
|
+
```
|
|
336
|
+
|
|
337
|
+
Each `##` section in CLAUDE.md becomes a separate Cursor `.mdc` file with `alwaysApply: true` frontmatter. `@file` references are stripped for assistants that don't support them.
|
|
338
|
+
|
|
339
|
+
---
|
|
340
|
+
|
|
341
|
+
### `claudectx teams` — Multi-developer cost attribution
|
|
342
|
+
|
|
343
|
+
See where the money goes across your whole team — without sharing session content.
|
|
344
|
+
|
|
345
|
+
```bash
|
|
346
|
+
# Step 1: each developer runs this on their own machine
|
|
347
|
+
claudectx teams export
|
|
348
|
+
|
|
349
|
+
# Step 2: collect the JSON files in a shared directory, then aggregate
|
|
350
|
+
claudectx teams aggregate --dir ./reports/
|
|
351
|
+
|
|
352
|
+
# Optional: copy your export to a shared location
|
|
353
|
+
claudectx teams share --to /shared/reports/
|
|
354
|
+
|
|
355
|
+
# Anonymize for review
|
|
356
|
+
claudectx teams aggregate --dir ./reports/ --anonymize
|
|
357
|
+
```
|
|
358
|
+
|
|
359
|
+
Output shows per-developer spend, cache hit rate, avg request size, and top shared files. Exports are lightweight JSON — no session content, no prompts, just aggregated token counts.
|
|
360
|
+
|
|
361
|
+
---
|
|
362
|
+
|
|
232
363
|
## How it all fits together
|
|
233
364
|
|
|
234
365
|
```
|
|
@@ -261,7 +392,7 @@ git clone https://github.com/Horilla/claudectx.git
|
|
|
261
392
|
cd claudectx
|
|
262
393
|
npm install
|
|
263
394
|
npm run build
|
|
264
|
-
npm test #
|
|
395
|
+
npm test # 278 tests, should all pass
|
|
265
396
|
npm run lint # 0 errors expected
|
|
266
397
|
```
|
|
267
398
|
|