claudectx 1.1.2 → 1.1.3

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 CHANGED
@@ -80,12 +80,29 @@ claudectx convert --to cursor
80
80
 
81
81
  # Export your usage data for team-wide cost attribution
82
82
  claudectx teams export
83
+
84
+ # --- Safety: every command that modifies files backs up automatically ---
85
+
86
+ # See all automatic backups
87
+ claudectx revert --list
88
+
89
+ # Restore any backup (also backs up current file so you can undo the undo)
90
+ claudectx revert --id <id>
83
91
  ```
84
92
 
85
93
  ## Installation
86
94
 
87
95
  ```bash
96
+ # npm (recommended)
88
97
  npm install -g claudectx
98
+
99
+ # Homebrew
100
+ brew tap Horilla/claudectx
101
+ brew install claudectx
102
+
103
+ # pip (Python projects)
104
+ pip install claudectx-py
105
+ # then: npm install -g claudectx (the npm package is still required)
89
106
  ```
90
107
 
91
108
  ---
@@ -154,6 +171,8 @@ What it does:
154
171
  - **Cache advisor** — Finds date strings, timestamps, and other patterns that break prompt caching and comments them out.
155
172
  - **Hooks installer** — Installs a `PostToolUse` hook in `.claude/settings.local.json` so `claudectx watch` can track files in real time.
156
173
 
174
+ > **Safety:** `optimize` backs up your `CLAUDE.md` automatically before any changes. Run `claudectx revert --list` to restore.
175
+
157
176
  ---
158
177
 
159
178
  ### `claudectx watch` — Live token dashboard
@@ -214,6 +233,8 @@ claudectx compress --api-key <key> # Provide API key explicitly
214
233
 
215
234
  A typical 8,000-token session compresses to ~180 tokens — **97.8% reduction**.
216
235
 
236
+ > **Safety:** `compress --prune` asks for confirmation before deleting entries and backs up `MEMORY.md` first. Run `claudectx revert --list` to restore.
237
+
217
238
  ---
218
239
 
219
240
  ### `claudectx report` — Usage analytics
@@ -329,6 +350,8 @@ claudectx hooks status # Show what's instal
329
350
 
330
351
  > **Security note:** Hooks that need an API key (`compress`, `warmup`) read `ANTHROPIC_API_KEY` from your environment — no secrets are stored in `.claude/settings.local.json`.
331
352
 
353
+ > **Safety:** `hooks remove` asks for confirmation and backs up `.claude/settings.local.json` before removing. Run `claudectx revert --list` to restore.
354
+
332
355
  ---
333
356
 
334
357
  ### `claudectx convert` — Use your CLAUDE.md everywhere
@@ -344,6 +367,8 @@ claudectx convert --to cursor --dry-run # Preview without writing
344
367
 
345
368
  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.
346
369
 
370
+ > **Safety:** `convert` backs up any existing target file before overwriting. Run `claudectx revert --list` to restore.
371
+
347
372
  ---
348
373
 
349
374
  ### `claudectx teams` — Multi-developer cost attribution
@@ -368,6 +393,52 @@ Output shows per-developer spend, cache hit rate, avg request size, and top shar
368
393
 
369
394
  ---
370
395
 
396
+ ### `claudectx revert` — Restore any backup
397
+
398
+ Every command that modifies your files creates an automatic backup in `~/.claudectx/backups/` before touching anything. If something goes wrong — or you just changed your mind — you can always recover.
399
+
400
+ ```bash
401
+ claudectx revert --list # See all backups with timestamps and size
402
+ claudectx revert --id <id> # Restore a specific backup
403
+ claudectx revert # Interactive: pick from list
404
+ claudectx revert --file CLAUDE.md # Filter to backups of one file
405
+ ```
406
+
407
+ Example output of `claudectx revert --list`:
408
+
409
+ ```
410
+ claudectx — Backup History
411
+ ══════════════════════════════════════════════════════════════════
412
+ ID File Command When
413
+ ──────────────────────────────────────────────────────────────────
414
+ 20260412T083012m445-1842... CLAUDE.md optimize 2 hours ago
415
+ 20260411T211533m102-9913... MEMORY.md compress 1 day ago
416
+ 20260411T094201m773-3371... copilot-instr... convert 2 days ago
417
+ ```
418
+
419
+ When you restore, claudectx backs up the **current** file first — so you can undo the undo:
420
+
421
+ ```
422
+ ⚠ This will overwrite /path/to/CLAUDE.md with the backup from 2 hours ago.
423
+ Your current file will be backed up first (so you can undo this).
424
+ Restore? [y/N]
425
+ ```
426
+
427
+ **Safety:** Backups are kept for the 50 most recent operations, then auto-pruned. They are stored only on your local machine.
428
+
429
+ **Which commands create backups automatically:**
430
+
431
+ | Command | What gets backed up |
432
+ |---|---|
433
+ | `optimize --claudemd` | `CLAUDE.md` (before split) |
434
+ | `optimize --cache` | `CLAUDE.md` (before cache-busting lines are commented out) |
435
+ | `convert --to X` | Existing Cursor/Copilot/Windsurf config (if it exists) |
436
+ | `compress --prune` | `MEMORY.md` (before old entries are deleted) |
437
+ | `hooks remove` | `.claude/settings.local.json` (before hook is removed) |
438
+ | `drift --fix` | `CLAUDE.md.bak` (existing behaviour, now also in manifest) |
439
+
440
+ ---
441
+
371
442
  ## How it all fits together
372
443
 
373
444
  ```
@@ -387,7 +458,7 @@ End of session: End of session:
387
458
 
388
459
  ## Token Savings — Share Your Results
389
460
 
390
- Join the **[Token Savings Hall of Fame](https://github.com/Horilla/claudectx/discussions)** — share your before/after numbers.
461
+ Join the **[Token Savings Hall of Fame](HALL_OF_FAME.md)** — share your before/after numbers and see real results from other developers.
391
462
 
392
463
  ---
393
464
 
@@ -400,7 +471,7 @@ git clone https://github.com/Horilla/claudectx.git
400
471
  cd claudectx
401
472
  npm install
402
473
  npm run build
403
- npm test # 278 tests, should all pass
474
+ npm test # 293 tests, should all pass
404
475
  npm run lint # 0 errors expected
405
476
  ```
406
477