@asifkibria/claude-code-toolkit 1.0.1 → 1.0.2

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
@@ -2,73 +2,84 @@
2
2
 
3
3
  [![npm version](https://img.shields.io/npm/v/@asifkibria/claude-code-toolkit.svg)](https://www.npmjs.com/package/@asifkibria/claude-code-toolkit)
4
4
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
5
- [![Tests](https://img.shields.io/badge/tests-30%20passing-brightgreen)](https://github.com/asifkibria/claude-code-toolkit)
5
+ [![Tests](https://img.shields.io/badge/tests-38%20passing-brightgreen)](https://github.com/asifkibria/claude-code-toolkit)
6
6
 
7
7
  A comprehensive MCP server and CLI toolkit for maintaining, optimizing, and troubleshooting your Claude Code installation.
8
8
 
9
- ## Why This Toolkit?
9
+ ## The Problem This Solves
10
10
 
11
- Claude Code stores conversation history, tool results, and context in local files. Over time, these can:
11
+ When you upload an oversized image, PDF, or document to Claude Code, it gets base64-encoded into your conversation history. That corrupted data then gets sent with **every future request**, causing API errors like:
12
12
 
13
- - **Grow large** - Slowing down startup and responses
14
- - **Contain errors** - Corrupted data blocking API calls
15
- - **Accumulate clutter** - Old backups and orphaned files
16
- - **Become opaque** - Hard to understand what's using space
13
+ - `API Error: 400 - image dimensions exceed max allowed size`
14
+ - `PDF too large. Try reading the file a different way...`
15
+ - Various timeout and context errors
17
16
 
18
- This toolkit gives you visibility and control over your Claude Code data.
17
+ **The worst part?** Nothing works anymore. Not your next message. Not `/compact`. Your entire conversation is bricked.
19
18
 
20
- ## Features
19
+ The "official" fix is to clear your conversation and lose everything. This toolkit offers a better solution.
21
20
 
22
- ### Health Monitoring
23
- - Quick health checks with actionable recommendations
24
- - Identify problematic files before they cause issues
25
- - Track conversation sizes and growth
21
+ ## What It Fixes
26
22
 
27
- ### Conversation Analytics
28
- - View detailed statistics (messages, tool uses, images)
29
- - Find your largest conversations
30
- - Sort by size, activity, or modification date
23
+ | Content Type | Detection Threshold | Replacement Message |
24
+ |-------------|---------------------|---------------------|
25
+ | Images | >100KB base64 | `[Image removed - exceeded size limit]` |
26
+ | PDFs | >100KB base64 | `[PDF removed - exceeded size limit]` |
27
+ | Documents | >100KB base64 | `[Document removed - exceeded size limit]` |
28
+ | Large Text | >500KB | `[Large text content removed - exceeded size limit]` |
31
29
 
32
- ### Troubleshooting Tools
33
- - **Fix oversized images** - Resolve the infamous "image dimensions exceed max" error ([#2939](https://github.com/anthropics/claude-code/issues/2939))
34
- - **Scan for issues** - Detect problems before they break your workflow
35
- - **Restore from backups** - Recover when things go wrong
30
+ The toolkit surgically removes only the problematic content while preserving your entire conversation history, tool results, and context.
36
31
 
37
- ### Maintenance Utilities
38
- - Automatic backup creation before changes
39
- - Clean up old backup files
40
- - Free up disk space safely
32
+ ## Quick Start
41
33
 
42
- ## Installation
34
+ ### Fix Your Broken Session Right Now
43
35
 
44
- ### As MCP Server (Recommended)
36
+ ```bash
37
+ # Scan for issues
38
+ npx @asifkibria/claude-code-toolkit scan
45
39
 
46
- Add to Claude Code so you can ask Claude to maintain itself:
40
+ # Fix them (creates backups automatically)
41
+ npx @asifkibria/claude-code-toolkit fix
42
+ ```
47
43
 
48
- ```bash
49
- # Using npx (no install needed)
50
- claude mcp add --scope user toolkit -- npx -y @asifkibria/claude-code-toolkit claude-code-toolkit-server
44
+ Restart Claude Code. You're back.
51
45
 
52
- # Or install globally first
46
+ ### Install Globally (Recommended)
47
+
48
+ ```bash
53
49
  npm install -g @asifkibria/claude-code-toolkit
54
- claude mcp add --scope user toolkit -- claude-code-toolkit-server
50
+
51
+ # Use the short alias
52
+ cct health
53
+ cct scan
54
+ cct fix
55
55
  ```
56
56
 
57
- ### As CLI Tool
57
+ ## Installation Options
58
+
59
+ ### Option 1: MCP Server (Let Claude Maintain Itself)
60
+
61
+ Add to Claude Code so you can literally ask Claude to check and fix its own issues:
58
62
 
59
63
  ```bash
60
- # Using npx
61
- npx @asifkibria/claude-code-toolkit health
64
+ claude mcp add --scope user toolkit -- npx -y @asifkibria/claude-code-toolkit claude-code-toolkit-server
65
+ ```
66
+
67
+ Then just ask Claude:
68
+ - "Check your health"
69
+ - "Are there any issues with your conversation files?"
70
+ - "Fix any problems you find"
62
71
 
63
- # Or install globally
72
+ ### Option 2: CLI Tool
73
+
74
+ ```bash
75
+ # Global install
64
76
  npm install -g @asifkibria/claude-code-toolkit
65
- claude-code-toolkit health
66
77
 
67
- # Short alias
68
- cct health
78
+ # Or use npx (no install needed)
79
+ npx @asifkibria/claude-code-toolkit <command>
69
80
  ```
70
81
 
71
- ### From Source
82
+ ### Option 3: From Source
72
83
 
73
84
  ```bash
74
85
  git clone https://github.com/asifkibria/claude-code-toolkit.git
@@ -76,183 +87,237 @@ cd claude-code-toolkit
76
87
  npm install && npm run build && npm test
77
88
  ```
78
89
 
79
- ## Usage
90
+ ## CLI Commands
91
+
92
+ ### `cct health` - Quick Health Check
80
93
 
81
- ### Inside Claude Code (MCP)
94
+ Start here. Shows overall status and recommendations.
82
95
 
83
- Once installed as an MCP server, just ask Claude:
96
+ ```bash
97
+ $ cct health
84
98
 
85
- > "Check my Claude Code health"
99
+ Health Check: Issues Found
86
100
 
87
- > "Show me my conversation statistics"
101
+ Conversations: 23
102
+ Total size: 156.2 MB
103
+ Backups: 5
104
+ Oversized content: 3
88
105
 
89
- > "Scan for any issues"
106
+ Largest: -Users-me-projects-myapp/abc123.jsonl
107
+ Size: 45.2 MB
90
108
 
91
- > "Fix the problems you found"
109
+ Recommendation: Run 'cct fix' to fix 3 issue(s)
110
+ ```
92
111
 
93
- > "Clean up old backups older than 30 days"
112
+ ### `cct scan` - Scan for Issues (Dry Run)
94
113
 
95
- ### Command Line
114
+ Shows exactly what's wrong without making changes.
96
115
 
97
116
  ```bash
98
- # Quick health check - start here!
99
- cct health
117
+ $ cct scan
100
118
 
101
- # View conversation statistics
102
- cct stats
103
- cct stats --limit 20 --sort messages
119
+ Scanning 23 file(s)...
104
120
 
105
- # Scan for issues (dry run)
106
- cct scan
121
+ -Users-me-projects-myapp/conversation1.jsonl
122
+ Line 142: 🖼️ image (~2.3 MB)
123
+ Line 856: 📄 pdf (~1.1 MB)
107
124
 
108
- # Fix all detected issues
109
- cct fix
110
-
111
- # Fix specific file
112
- cct fix -f ~/.claude/projects/myproject/conversation.jsonl
125
+ -Users-me-projects-another/conversation2.jsonl
126
+ Line 45: 📎 document (~890 KB)
113
127
 
114
- # Manage backups
115
- cct backups
116
- cct restore /path/to/backup.jsonl.backup.2024-01-01T00-00-00
117
- cct cleanup --days 30 --dry-run
118
- cct cleanup --days 30
128
+ Found 3 issue(s) in 2 file(s).
129
+ Run 'cct fix' to fix them.
119
130
  ```
120
131
 
121
- ## Tool Reference
132
+ ### `cct fix` - Fix All Issues
122
133
 
123
- ### MCP Tools
134
+ Removes problematic content and creates backups.
124
135
 
125
- | Tool | Description |
126
- | ------------------------ | ------------------------------------------------ |
127
- | `health_check` | Quick health check with recommendations |
128
- | `get_conversation_stats` | Detailed statistics about all conversations |
129
- | `scan_image_issues` | Scan for oversized images and other issues |
130
- | `fix_image_issues` | Fix detected issues (creates backups) |
131
- | `list_backups` | List all backup files with sizes and dates |
132
- | `restore_backup` | Restore a conversation from backup |
133
- | `cleanup_backups` | Delete old backup files to free space |
134
-
135
- ### CLI Commands
136
+ ```bash
137
+ $ cct fix
136
138
 
137
- | Command | Description |
138
- | ---------------- | -------------------------------- |
139
- | `health` | Quick health check |
140
- | `stats` | Show conversation statistics |
141
- | `scan` | Scan for issues (dry run) |
142
- | `fix` | Fix all detected issues |
143
- | `backups` | List backup files |
144
- | `restore <path>` | Restore from backup |
145
- | `cleanup` | Delete old backups |
139
+ Processing 23 file(s)...
146
140
 
147
- ### CLI Options
141
+ -Users-me-projects-myapp/conversation1.jsonl
142
+ Fixed 2 issue(s)
143
+ Backup: conversation1.jsonl.backup.2024-01-15T10-30-00
148
144
 
149
- | Option | Description |
150
- | ------------------- | ---------------------------------------------- |
151
- | `-f, --file <path>` | Target specific file |
152
- | `-d, --dry-run` | Preview without making changes |
153
- | `--no-backup` | Skip creating backups (not recommended) |
154
- | `--days <n>` | For cleanup: delete backups older than n days |
155
- | `--limit <n>` | For stats: limit number of results |
156
- | `--sort <field>` | For stats: size, messages, images, or modified |
157
- | `-h, --help` | Show help |
158
- | `-v, --version` | Show version |
145
+ -Users-me-projects-another/conversation2.jsonl
146
+ Fixed 1 issue(s)
147
+ Backup: conversation2.jsonl.backup.2024-01-15T10-30-01
159
148
 
160
- ## Common Issues This Solves
149
+ Fixed 3 issue(s) in 2 file(s).
150
+ Restart Claude Code to apply changes.
151
+ ```
161
152
 
162
- ### "Image dimensions exceed max allowed size"
153
+ ### `cct stats` - Conversation Statistics
163
154
 
164
- This error poisons your conversation context, making all subsequent requests fail - even `/compact`. The toolkit detects and fixes these oversized images automatically.
155
+ See what's using space and resources.
165
156
 
166
157
  ```bash
167
- cct scan # See what's wrong
168
- cct fix # Fix it
158
+ $ cct stats --limit 5 --sort size
159
+
160
+ Conversation Statistics
161
+
162
+ Total: 23 conversations, 156.2 MB
163
+ Messages: 12,456, Images: 89, Documents: 23
164
+ Problematic content: 3
165
+
166
+ Top 5 by size:
167
+
168
+ -Users-me-projects-myapp/abc123.jsonl
169
+ Size: 45.2 MB, Messages: 2,341
170
+ Images: 34, Documents: 12 (2 oversized)
171
+ Modified: 2024-01-15 10:30:00
172
+ ...
169
173
  ```
170
174
 
171
- ### "My Claude Code is slow to start"
175
+ ### `cct backups` - List Backups
172
176
 
173
- Large conversation files slow everything down. Use stats to find the culprits:
177
+ See all backup files.
174
178
 
175
179
  ```bash
176
- cct stats --sort size --limit 5
180
+ $ cct backups
181
+
182
+ Backup Files (5 files, 89.3 MB total)
183
+
184
+ conversation1.jsonl.backup.2024-01-15T10-30-00
185
+ Size: 23.4 MB, Created: 2024-01-15 10:30:00
186
+ ...
177
187
  ```
178
188
 
179
- ### "I accidentally broke something"
189
+ ### `cct restore <path>` - Restore from Backup
180
190
 
181
- Backups are created automatically before any fix. Restore anytime:
191
+ Undo a fix if needed.
182
192
 
183
193
  ```bash
184
- cct backups # Find your backup
185
- cct restore /path/to/backup # Restore it
194
+ $ cct restore ~/.claude/projects/-Users-me-myapp/conversation.jsonl.backup.2024-01-15T10-30-00
195
+
196
+ ✓ Restored /Users/me/.claude/projects/-Users-me-myapp/conversation.jsonl
197
+ Restart Claude Code to apply changes.
186
198
  ```
187
199
 
188
- ### "My disk is filling up"
200
+ ### `cct cleanup` - Delete Old Backups
189
201
 
190
- Clean up old backups:
202
+ Free up disk space.
191
203
 
192
204
  ```bash
193
- cct cleanup --days 7 --dry-run # Preview
194
- cct cleanup --days 7 # Delete
205
+ # Preview what would be deleted
206
+ $ cct cleanup --days 7 --dry-run
207
+
208
+ Would delete 3 backup(s):
209
+ conversation1.jsonl.backup.2024-01-01T00-00-00
210
+ conversation2.jsonl.backup.2024-01-02T00-00-00
211
+ conversation3.jsonl.backup.2024-01-03T00-00-00
212
+
213
+ Run without --dry-run to delete.
214
+
215
+ # Actually delete them
216
+ $ cct cleanup --days 7
217
+
218
+ ✓ Deleted 3 backup(s)
195
219
  ```
196
220
 
221
+ ## CLI Options Reference
222
+
223
+ | Option | Description |
224
+ |--------|-------------|
225
+ | `-f, --file <path>` | Target a specific file instead of all conversations |
226
+ | `-d, --dry-run` | Preview changes without making them |
227
+ | `--no-backup` | Skip creating backups when fixing (not recommended) |
228
+ | `--days <n>` | For cleanup: delete backups older than n days (default: 7) |
229
+ | `--limit <n>` | For stats: limit number of results (default: 10) |
230
+ | `--sort <field>` | For stats: sort by `size`, `messages`, `images`, or `modified` |
231
+ | `-h, --help` | Show help message |
232
+ | `-v, --version` | Show version |
233
+
234
+ ## MCP Server Tools
235
+
236
+ When installed as an MCP server, these tools are available to Claude:
237
+
238
+ | Tool | Description |
239
+ |------|-------------|
240
+ | `health_check` | Quick health check with recommendations |
241
+ | `get_conversation_stats` | Detailed statistics about conversations |
242
+ | `scan_image_issues` | Scan for oversized content (images, PDFs, documents) |
243
+ | `fix_image_issues` | Fix detected issues with automatic backups |
244
+ | `list_backups` | List all backup files |
245
+ | `restore_backup` | Restore a conversation from backup |
246
+ | `cleanup_backups` | Delete old backups to free space |
247
+
197
248
  ## How It Works
198
249
 
199
- 1. **Scans** `~/.claude/projects/` for conversation files (`.jsonl`)
200
- 2. **Analyzes** each message for issues (oversized images, malformed data)
201
- 3. **Reports** findings with actionable recommendations
202
- 4. **Fixes** issues by replacing problematic content with placeholders
203
- 5. **Backs up** original files before any modifications
250
+ 1. **Locates** your Claude Code data in `~/.claude/projects/`
251
+ 2. **Scans** conversation files (`.jsonl`) line by line
252
+ 3. **Detects** oversized content:
253
+ - Images with base64 data >100KB
254
+ - PDFs with base64 data >100KB
255
+ - Documents with base64 data >100KB
256
+ - Text content >500KB
257
+ 4. **Reports** findings with file paths, line numbers, and sizes
258
+ 5. **Fixes** by replacing problematic content with placeholder text
259
+ 6. **Backs up** original files before any modification
204
260
 
205
- ## Development
261
+ ## Common Scenarios
262
+
263
+ ### My Claude Code session is completely broken
206
264
 
207
265
  ```bash
208
- # Install dependencies
209
- npm install
266
+ cct scan # See what's wrong
267
+ cct fix # Fix it
268
+ # Restart Claude Code
269
+ ```
210
270
 
211
- # Build
212
- npm run build
271
+ ### I want to prevent issues before they happen
213
272
 
214
- # Run tests (30 tests)
215
- npm test
273
+ ```bash
274
+ cct health # Quick check
275
+ ```
216
276
 
217
- # Watch mode for development
218
- npm run dev
277
+ ### I accidentally uploaded a huge file
219
278
 
220
- # Test coverage
221
- npm run test:coverage
279
+ ```bash
280
+ cct fix -f ~/.claude/projects/path/to/conversation.jsonl
222
281
  ```
223
282
 
224
- ## Contributing
283
+ ### I want to undo a fix
225
284
 
226
- Contributions are welcome! Please read our [Contributing Guide](CONTRIBUTING.md) for details on:
285
+ ```bash
286
+ cct backups # Find your backup
287
+ cct restore /path/to/backup # Restore it
288
+ ```
227
289
 
228
- - How to report issues
229
- - How to suggest features
230
- - How to submit pull requests
231
- - Code style and testing requirements
290
+ ### My disk is filling up
232
291
 
233
- ## Roadmap
292
+ ```bash
293
+ cct cleanup --days 30 --dry-run # Preview
294
+ cct cleanup --days 30 # Delete
295
+ ```
234
296
 
235
- Future features under consideration:
297
+ ## Development
236
298
 
237
- - [ ] Conversation export (markdown, JSON)
238
- - [ ] Context size estimation
239
- - [ ] Duplicate detection
240
- - [ ] Conversation archiving
241
- - [ ] Usage analytics dashboard
242
- - [ ] Automatic scheduled maintenance
299
+ ```bash
300
+ npm install # Install dependencies
301
+ npm run build # Build TypeScript
302
+ npm test # Run tests (38 tests)
303
+ npm run dev # Watch mode
304
+ npm run test:coverage # Coverage report
305
+ ```
306
+
307
+ ## Contributing
243
308
 
244
- Have an idea? [Open an issue](https://github.com/asifkibria/claude-code-toolkit/issues)!
309
+ Contributions welcome! See [CONTRIBUTING.md](CONTRIBUTING.md).
245
310
 
246
311
  ## License
247
312
 
248
313
  MIT - see [LICENSE](LICENSE)
249
314
 
250
- ## Related Resources
315
+ ## Links
251
316
 
252
- - [Claude Code Documentation](https://docs.anthropic.com/claude-code)
253
- - [Model Context Protocol](https://modelcontextprotocol.io/)
254
- - [Claude Code GitHub Issues](https://github.com/anthropics/claude-code/issues)
317
+ - [npm package](https://www.npmjs.com/package/@asifkibria/claude-code-toolkit)
318
+ - [GitHub repository](https://github.com/asifkibria/claude-code-toolkit)
319
+ - [Original issue #2939](https://github.com/anthropics/claude-code/issues/2939)
255
320
 
256
321
  ---
257
322
 
258
- **Made with care for the Claude Code community**
323
+ **Made for the Claude Code community**