@kaitranntt/ccs 3.4.6 → 4.1.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.
Files changed (47) hide show
  1. package/.claude/agents/ccs-delegator.md +117 -0
  2. package/.claude/commands/ccs/glm/continue.md +22 -0
  3. package/.claude/commands/ccs/glm.md +22 -0
  4. package/.claude/commands/ccs/kimi/continue.md +22 -0
  5. package/.claude/commands/ccs/kimi.md +22 -0
  6. package/.claude/skills/ccs-delegation/SKILL.md +54 -0
  7. package/.claude/skills/ccs-delegation/references/README.md +24 -0
  8. package/.claude/skills/ccs-delegation/references/delegation-guidelines.md +99 -0
  9. package/.claude/skills/ccs-delegation/references/headless-workflow.md +174 -0
  10. package/.claude/skills/ccs-delegation/references/troubleshooting.md +268 -0
  11. package/README.ja.md +470 -146
  12. package/README.md +532 -145
  13. package/README.vi.md +484 -157
  14. package/VERSION +1 -1
  15. package/bin/auth/auth-commands.js +98 -13
  16. package/bin/auth/profile-detector.js +11 -6
  17. package/bin/ccs.js +148 -2
  18. package/bin/delegation/README.md +189 -0
  19. package/bin/delegation/delegation-handler.js +212 -0
  20. package/bin/delegation/headless-executor.js +617 -0
  21. package/bin/delegation/result-formatter.js +483 -0
  22. package/bin/delegation/session-manager.js +156 -0
  23. package/bin/delegation/settings-parser.js +109 -0
  24. package/bin/management/doctor.js +94 -1
  25. package/bin/utils/claude-symlink-manager.js +238 -0
  26. package/bin/utils/delegation-validator.js +154 -0
  27. package/bin/utils/error-codes.js +59 -0
  28. package/bin/utils/error-manager.js +38 -32
  29. package/bin/utils/helpers.js +65 -1
  30. package/bin/utils/progress-indicator.js +111 -0
  31. package/bin/utils/prompt.js +134 -0
  32. package/bin/utils/shell-completion.js +234 -0
  33. package/lib/ccs +575 -25
  34. package/lib/ccs.ps1 +381 -20
  35. package/lib/error-codes.ps1 +55 -0
  36. package/lib/error-codes.sh +63 -0
  37. package/lib/progress-indicator.ps1 +120 -0
  38. package/lib/progress-indicator.sh +117 -0
  39. package/lib/prompt.ps1 +109 -0
  40. package/lib/prompt.sh +99 -0
  41. package/package.json +2 -1
  42. package/scripts/completion/README.md +308 -0
  43. package/scripts/completion/ccs.bash +81 -0
  44. package/scripts/completion/ccs.fish +92 -0
  45. package/scripts/completion/ccs.ps1 +157 -0
  46. package/scripts/completion/ccs.zsh +130 -0
  47. package/scripts/postinstall.js +35 -0
package/README.md CHANGED
@@ -1,12 +1,12 @@
1
- # CCS - Claude Code Switch
2
-
3
1
  <div align="center">
4
2
 
3
+ # CCS - Claude Code Switch
4
+
5
5
  ![CCS Logo](docs/assets/ccs-logo-medium.png)
6
6
 
7
- **One command, zero downtime, multiple accounts**
7
+ ### One command, zero downtime, multiple accounts
8
8
 
9
- Switch between multiple Claude accounts, GLM, and Kimi instantly.<br>
9
+ **Switch between multiple Claude accounts, GLM, and Kimi instantly.**<br>
10
10
  Stop hitting rate limits. Keep working continuously.
11
11
 
12
12
 
@@ -19,27 +19,20 @@ Stop hitting rate limits. Keep working continuously.
19
19
 
20
20
  </div>
21
21
 
22
- ---
23
-
24
- ## 🚀 Quick Start
22
+ <br>
25
23
 
26
- ### 🔑 Prerequisites
27
-
28
- **Before installing CCS, make sure you're logged into Claude CLI with your subscription account:**
29
- ```bash
30
- claude /login
31
- ```
24
+ ## Quick Start
32
25
 
33
26
  ### Installation
34
27
 
35
- #### Option 1: npm Package (Recommended)
28
+ **npm Package (Recommended)**
36
29
 
37
30
  **macOS / Linux / Windows**
38
31
  ```bash
39
32
  npm install -g @kaitranntt/ccs
40
33
  ```
41
34
 
42
- All major package managers are supported:
35
+ **All major package managers are supported:**
43
36
 
44
37
  ```bash
45
38
  # yarn
@@ -52,7 +45,10 @@ pnpm add -g @kaitranntt/ccs
52
45
  bun add -g @kaitranntt/ccs
53
46
  ```
54
47
 
55
- #### Option 2: Direct Install (Traditional)
48
+ <details>
49
+ <summary><strong>Alternative: Direct Install (Traditional)</strong></summary>
50
+
51
+ <br>
56
52
 
57
53
  **macOS / Linux**
58
54
  ```bash
@@ -64,7 +60,11 @@ curl -fsSL ccs.kaitran.ca/install | bash
64
60
  irm ccs.kaitran.ca/install | iex
65
61
  ```
66
62
 
67
- > **💡 Performance Tip**: Traditional installs bypass Node.js routing for faster startup, but I prioritize npm updates due to easier deployment automation.
63
+ **Note:** Traditional installs bypass Node.js routing for faster startup, but npm is prioritized for easier deployment automation.
64
+
65
+ </details>
66
+
67
+ <br>
68
68
 
69
69
  ### Configuration (Auto-created)
70
70
 
@@ -82,7 +82,10 @@ irm ccs.kaitran.ca/install | iex
82
82
  }
83
83
  ```
84
84
 
85
- ### Custom Claude CLI Path
85
+ <details>
86
+ <summary><h3>Custom Claude CLI Path</h3></summary>
87
+
88
+ <br>
86
89
 
87
90
  If Claude CLI is installed in a non-standard location (D drive, custom directory), set `CCS_CLAUDE_PATH`:
88
91
 
@@ -91,9 +94,14 @@ export CCS_CLAUDE_PATH="/path/to/claude" # Unix
91
94
  $env:CCS_CLAUDE_PATH = "D:\Tools\Claude\claude.exe" # Windows
92
95
  ```
93
96
 
94
- **See [Troubleshooting Guide](./docs/en/troubleshooting.md#claude-cli-in-non-standard-location) for detailed setup instructions.**
97
+ **See also:** [Troubleshooting Guide](./docs/en/troubleshooting.md#claude-cli-in-non-standard-location) for detailed setup instructions.
98
+
99
+ </details>
100
+
101
+ <details>
102
+ <summary><h3>Windows Symlink Support (Developer Mode)</h3></summary>
95
103
 
96
- ### Windows Symlink Support (Developer Mode)
104
+ <br>
97
105
 
98
106
  **Windows users**: Enable Developer Mode for true symlinks (better performance, instant sync):
99
107
 
@@ -101,60 +109,197 @@ $env:CCS_CLAUDE_PATH = "D:\Tools\Claude\claude.exe" # Windows
101
109
  2. Enable **Developer Mode**
102
110
  3. Reinstall CCS: `npm install -g @kaitranntt/ccs`
103
111
 
104
- **Without Developer Mode**: CCS automatically falls back to copying directories (works but no instant sync across profiles).
112
+ **Warning:** Without Developer Mode, CCS automatically falls back to copying directories (works but no instant sync across profiles).
105
113
 
106
- ---
114
+ </details>
115
+
116
+ <br>
107
117
 
108
118
  ### Your First Switch
109
119
 
110
- > **⚠️ Important**: Before using GLM/GLMT or Kimi profiles, update API keys in settings files:
111
- > - **GLM**: Edit `~/.ccs/glm.settings.json` and add your GLM API key
112
- > - **GLMT**: Edit `~/.ccs/glmt.settings.json` and add your Z.AI API key (requires coding plan)
120
+ > [!IMPORTANT]
121
+ > **Before using alternative models, update API keys in settings files:**
122
+ >
123
+ > - **GLM**: Edit `~/.ccs/glm.settings.json` and add your Z.AI Coding Plan API Key
124
+ > - **GLMT**: Edit `~/.ccs/glmt.settings.json` and add your Z.AI Coding Plan API Key
113
125
  > - **Kimi**: Edit `~/.ccs/kimi.settings.json` and add your Kimi API key
114
126
 
127
+ <br>
128
+
129
+ **Parallel Workflow: Planning + Execution**
130
+
115
131
  ```bash
116
- # Default Claude subscription
117
- ccs "Plan microservices architecture"
132
+ # Terminal 1 - Planning (Claude Sonnet)
133
+ ccs "Plan a REST API with authentication and rate limiting"
134
+
135
+ # Terminal 2 - Execution (GLM, cost-optimized)
136
+ ccs glm "Implement the user authentication endpoints from the plan"
137
+ ```
118
138
 
119
- # Switch to GLM (cost-optimized)
120
- ccs glm "Create REST API"
139
+ <details>
140
+ <summary><strong>Thinking Models (Kimi & GLMT)</strong></summary>
121
141
 
122
- # GLM with thinking mode
123
- ccs glmt "Solve algorithmic problem"
142
+ <br>
124
143
 
125
- # Kimi for coding
126
- ccs kimi "Write integration tests"
144
+ ```bash
145
+ # Kimi - Stable thinking support
146
+ ccs kimi "Design a caching strategy with trade-off analysis"
147
+
148
+ # GLMT - Experimental (see full disclaimer below)
149
+ ccs glmt "Debug complex algorithm with reasoning steps"
127
150
  ```
128
151
 
129
- ---
152
+ **Note:** GLMT is experimental and unstable. See [GLM with Thinking (GLMT)](#glm-with-thinking-glmt) section below for full details.
153
+
154
+ </details>
155
+
156
+ <br>
130
157
 
131
158
  ## The Daily Developer Pain Point
132
159
 
133
- Developers face multiple subscription scenarios daily:
160
+ <div align="center">
161
+
162
+ ### **STOP Switching. START Orchestrating.**
163
+
164
+ **Session limits shouldn't kill your flow state.**
165
+ </div>
166
+
167
+ You're deep in implementation. Context loaded. Solution crystallizing.<br>
168
+ Then: 🔴 _"You've reached your usage limit."_
169
+
170
+ **Momentum gone. Context lost. Productivity crater.**
171
+
172
+ ## **The Solution: Parallel Workflows**
173
+
174
+ <details>
175
+ <summary><strong>❌ OLD WAY:</strong> Switch When You Hit Limits (Reactive)</summary>
176
+
177
+ <br>
178
+
179
+ ```mermaid
180
+ graph LR
181
+ A[2pm: Building features<br/>In the zone] --> B[3pm: Usage limit hit<br/>BLOCKED]
182
+ B --> C[3:05pm: Stop work<br/>Edit settings.json]
183
+ C --> D[3:15pm: Switch accounts<br/>Context lost]
184
+ D --> E[3:30pm: Restart<br/>Trying to focus]
185
+ E --> F[4pm: Finally productive<br/>Back in flow]
186
+
187
+ style A fill:#d4edda,stroke:#333,color:#000
188
+ style B fill:#f8d7da,stroke:#333,color:#000
189
+ style C fill:#fff3cd,stroke:#333,color:#000
190
+ style D fill:#f8d7da,stroke:#333,color:#000
191
+ style E fill:#fff3cd,stroke:#333,color:#000
192
+ style F fill:#d4edda,stroke:#333,color:#000
193
+ ```
194
+
195
+ **Result:** 1 hour lost, momentum destroyed, frustration builds
196
+
197
+ </details>
198
+
199
+ <details open>
200
+ <summary><strong>✨ NEW WAY:</strong> Run Parallel From Start (Proactive) - <strong>RECOMMENDED</strong></summary>
201
+
202
+ <br>
203
+
204
+ ```mermaid
205
+ graph LR
206
+ A[2pm: Start work] --> B[Terminal 1: Claude Pro<br/>Strategic planning]
207
+ A --> C[Terminal 2: GLM<br/>Code execution]
208
+ B --> D[3pm: Still shipping<br/>No interruptions]
209
+ C --> D
210
+ D --> E[4pm: Flow state<br/>Productivity peak]
211
+ E --> F[5pm: Features shipped<br/>Context maintained]
212
+
213
+ style A fill:#e7f3ff,stroke:#333,color:#000
214
+ style B fill:#cfe2ff,stroke:#333,color:#000
215
+ style C fill:#cfe2ff,stroke:#333,color:#000
216
+ style D fill:#d4edda,stroke:#333,color:#000
217
+ style E fill:#d4edda,stroke:#333,color:#000
218
+ style F fill:#d4edda,stroke:#333,color:#000
219
+ ```
220
+
221
+ **Result:** Zero downtime, continuous productivity, less frustration
222
+
223
+ ### 💰 **The Value Proposition:**
224
+ - **Setup:** Your existing Claude Pro + GLM Lite (cost-effective add-on)
225
+ - **Value:** Save 1 hour/day × 20 workdays = 20 hours/month recovered
226
+ - **ROI:** Your development time is worth more than the setup cost
227
+ - **Reality:** Shipping faster than the overhead
228
+
229
+ </details>
230
+
231
+ ## Choose Your Path
232
+
233
+ <details>
234
+ <summary><strong>Budget-Focused:</strong> GLM Only</summary>
235
+
236
+ - **Best for:** Cost-conscious development, basic code generation
237
+ - **Usage:** Just use `ccs glm` directly for cost-effective AI assistance
238
+ - **Reality:** No Claude access, but capable for many coding tasks
239
+ - **Setup:** GLM API key only, very affordable
240
+
241
+ </details>
242
+
243
+ <details open>
244
+ <summary><strong>✨ Recommended for Daily Development:</strong> 1 Claude Pro + 1 GLM Lite</summary>
245
+
246
+ - **Best for:** Daily code delivery, serious development work
247
+ - **Usage:** `ccs` for planning + `ccs glm` for execution (parallel workflow)
248
+ - **Reality:** Perfect balance of capability and cost for most developers
249
+ - **Value:** Never hit session limits, continuous productivity
250
+
251
+ </details>
252
+
253
+ <details>
254
+ <summary><strong>Power User:</strong> Multiple Claude Pro + GLM Pro</summary>
255
+
256
+ - **Best for:** Heavy workloads, concurrent projects, solo dev
257
+ - **Unlocks:** Never drain session or weekly limits
258
+ - **Workflow:** 3+ terminals running specialized tasks simultaneously
259
+
260
+ </details>
134
261
 
135
- 1. **Account Separation**: Company Claude account vs personal Claude → you must manually switch contexts to keep work and personal separate
136
- 2. **Rate Limits Hit**: Claude stops mid-project you manually edit `~/.claude/settings.json`
137
- 3. **Cost Management**: 2-3 Pro subscriptions ($20/month each) vs Claude Max at 5x cost ($100/month) → Pro tier is the practical ceiling for most developers
138
- 4. **Model Choice**: Different tasks benefit from different model strengths → manual switching
262
+ <details>
263
+ <summary><strong>Privacy-Focused:</strong> Work/Personal Isolation</summary>
139
264
 
140
- Manual context switching breaks your workflow. **CCS manages it seamlessly**.
265
+ - **When needed:** Strict separation of work and personal AI contexts
266
+ - **Setup:** `ccs auth create work` + `ccs auth create personal`
267
+ - **Note:** Advanced feature - most users don't need this
268
+
269
+ </details>
270
+
271
+ ---
141
272
 
142
273
  ## Why CCS Instead of Manual Switching?
143
274
 
144
275
  <div align="center">
145
276
 
146
- | Feature | Benefit |
147
- |---------|---------|
148
- | **Account Isolation** | Keep work separate from personal |
149
- | **Cost Optimization** | 2-3 Pro accounts vs Max at 5x cost |
150
- | **Instant Switching** | One command, no file editing |
151
- | **Zero Downtime** | Never interrupt workflow |
152
- | **Rate Limit Management** | Switch accounts when limits hit |
153
- | **Cross-Platform** | macOS, Linux, Windows |
277
+ **CCS isn't about "switching when you hit limits at 3pm."**
278
+
279
+ ## **It's about running in parallel from the start.**
154
280
 
155
281
  </div>
156
282
 
157
- ---
283
+ ### The Core Difference
284
+
285
+ | **Manual Switching** | **CCS Orchestration** |
286
+ |:---|:---|
287
+ | 🔴 Hit limits → Stop work → Edit config files → Restart | ✅ Multiple terminals running different models from the start |
288
+ | 😰 Context loss and flow state interruption | 😌 Continuous productivity with preserved context |
289
+ | 📝 Sequential task handling | ⚡ Parallel workflows (planning + execution simultaneously) |
290
+ | 🛠️ Reactive problem solving when blocked | 🎯 Proactive workflow design prevents blocks |
291
+
292
+ ### What CCS Gives You
293
+
294
+ - **Zero Context Switching**: Keep your flow state without interruption
295
+ - **Parallel Productivity**: Strategic planning in one terminal, code execution in another
296
+ - **Instant Account Management**: One command switches, no config file editing
297
+ - **Work-Life Separation**: Isolate contexts without logging out
298
+ - **Cross-Platform Consistency**: Same smooth experience on macOS, Linux, Windows
299
+
300
+ **Manual context switching breaks workflow. CCS orchestrates seamlessly.**
301
+
302
+ <br>
158
303
 
159
304
  ## Architecture
160
305
 
@@ -168,36 +313,208 @@ Manual context switching breaks your workflow. **CCS manages it seamlessly**.
168
313
  - Uses `CLAUDE_CONFIG_DIR` for isolated instances
169
314
  - Create with `ccs auth create <profile>`
170
315
 
171
- ### Shared Data (v3.1)
316
+ ### Shared Data (v3.1+)
172
317
 
173
- Commands and skills symlinked from `~/.ccs/shared/` - no duplication across profiles.
318
+ **CCS items (v4.1)**: Commands and skills symlinked from `~/.ccs/.claude/` to `~/.claude/` - **single source of truth with auto-propagation**.
174
319
 
175
- ```
320
+ **Profile access**: `~/.ccs/shared/` symlinks to `~/.claude/` - **no duplication across profiles**.
321
+
322
+ ```plaintext
176
323
  ~/.ccs/
177
- ├── shared/ # Shared across all profiles
178
- │ ├── agents/
179
- │ ├── commands/
180
- │ └── skills/
324
+ ├── .claude/ # CCS items (ships with package, v4.1)
325
+ │ ├── commands/ccs/ # Delegation commands (/ccs:glm, /ccs:kimi)
326
+ │ ├── skills/ccs-delegation/ # AI decision framework
327
+ │ └── agents/ccs-delegator.md # Proactive delegation agent
328
+ ├── shared/ # Symlinks to ~/.claude/ (for profiles)
329
+ │ ├── agents@ → ~/.claude/agents/
330
+ │ ├── commands@ → ~/.claude/commands/
331
+ │ └── skills@ → ~/.claude/skills/
181
332
  ├── instances/ # Profile-specific data
182
333
  │ └── work/
183
334
  │ ├── agents@ → shared/agents/
184
335
  │ ├── commands@ → shared/commands/
185
336
  │ ├── skills@ → shared/skills/
186
337
  │ ├── settings.json # API keys, credentials
187
- └── sessions/ # Conversation history
338
+ ├── sessions/ # Conversation history
188
339
  │ └── ...
340
+
341
+ ~/.claude/ # User's Claude directory
342
+ ├── commands/ccs@ → ~/.ccs/.claude/commands/ccs/ # Selective symlink
343
+ ├── skills/ccs-delegation@ → ~/.ccs/.claude/skills/ccs-delegation/
344
+ └── agents/ccs-delegator.md@ → ~/.ccs/.claude/agents/ccs-delegator.md
189
345
  ```
190
346
 
191
- **Shared**: commands/, skills/, agents/
192
- **Profile-specific**: settings.json, sessions/, todolists/, logs/
347
+ **Symlink Chain**: `work profile → ~/.ccs/shared/ → ~/.claude/ → ~/.ccs/.claude/` (CCS items)
193
348
 
194
- **[i] Windows**: Copies dirs if symlinks unavailable (enable Developer Mode for true symlinks)
349
+ | Type | Files |
350
+ |:-----|:------|
351
+ | **CCS items** | `~/.ccs/.claude/` (ships with package, selective symlinks to `~/.claude/`) |
352
+ | **Shared** | `~/.ccs/shared/` (symlinks to `~/.claude/`) |
353
+ | **Profile-specific** | `settings.json`, `sessions/`, `todolists/`, `logs/` |
195
354
 
196
- ---
355
+ > [!NOTE]
356
+ > **Windows**: Symlink support requires Developer Mode (v4.2 will add copy fallback)
357
+
358
+ <br>
359
+
360
+ ## Usage Examples
361
+
362
+ ### Basic Switching
363
+
364
+ ```bash
365
+ ccs # Claude subscription (default)
366
+ ccs glm # GLM (cost-optimized)
367
+ ccs kimi # Kimi (with thinking support)
368
+ ```
369
+
370
+ ### Multi-Account Setup
371
+
372
+ ```bash
373
+ # Create accounts
374
+ ccs auth create work
375
+ ccs auth create personal
376
+ ```
377
+
378
+ **Run concurrently in separate terminals:**
379
+
380
+ ```bash
381
+ # Terminal 1 - Work
382
+ ccs work "implement feature"
383
+
384
+ # Terminal 2 - Personal (concurrent)
385
+ ccs personal "review code"
386
+ ```
387
+
388
+ ### Help & Version
389
+
390
+ ```bash
391
+ ccs --version # Show version
392
+ ccs --help # Show all commands and options
393
+ ```
394
+
395
+ <br>
396
+
397
+ ## AI-Powered Delegation
398
+
399
+ > [!TIP]
400
+ > **New in v4.0**: Delegate tasks to cost-optimized models (GLM, Kimi) directly from your main Claude session. Save 81% on simple tasks with real-time visibility.
401
+
402
+ ### What is Delegation?
403
+
404
+ CCS Delegation lets you **send tasks to alternative models** (`glm`, `kimi`) **from your main Claude session** using the `-p` flag or slash commands (`/ccs:glm`, `/ccs:kimi`).
405
+
406
+ **Why use it?**
407
+ - **Token efficiency**: Simple tasks cost 81% less on GLM vs main Claude session
408
+ - **Context preservation**: Main session stays clean, no pollution from mechanical tasks
409
+ - **Real-time visibility**: See tool usage as tasks execute (`[Tool] Write: index.html`)
410
+ - **Multi-turn support**: Resume sessions with `:continue` for iterative work
411
+
412
+ ### Quick Examples
413
+
414
+ **Direct CLI:**
415
+ ```bash
416
+ # Delegate simple task to GLM (cost-optimized)
417
+ ccs glm -p "add tests for UserService"
418
+
419
+ # Delegate long-context task to Kimi
420
+ ccs kimi -p "analyze all files in src/ and document architecture"
421
+
422
+ # Continue previous session
423
+ ccs glm:continue -p "run the tests and fix any failures"
424
+ ```
425
+
426
+ **Via Slash Commands** (inside Claude sessions):
427
+ ```bash
428
+ # In your main Claude session:
429
+ /ccs:glm "refactor auth.js to use async/await"
430
+ /ccs:kimi "find all deprecated API usages across codebase"
431
+ /ccs:glm:continue "also update the README examples"
432
+ ```
433
+
434
+ **Via Natural Language** (Claude auto-delegates):
435
+ ```bash
436
+ # Claude detects delegation patterns and auto-executes:
437
+ "Use ccs glm to add tests for all *.service.js files"
438
+ "Delegate to kimi: analyze project structure"
439
+ ```
440
+
441
+ ### Real-Time Output
442
+
443
+ See exactly what's happening as tasks execute:
444
+
445
+ ```
446
+ $ ccs glm -p "/cook create a landing page"
447
+ [i] Delegating to GLM-4.6...
448
+ [Tool] Write: /home/user/project/index.html
449
+ [Tool] Write: /home/user/project/styles.css
450
+ [Tool] Write: /home/user/project/script.js
451
+ [Tool] Edit: /home/user/project/styles.css
452
+ [i] Execution completed in 45.2s
453
+
454
+ ╔══════════════════════════════════════════════════════╗
455
+ ║ Working Directory: /home/user/project ║
456
+ ║ Model: GLM-4.6 ║
457
+ ║ Duration: 45.2s ║
458
+ ║ Exit Code: 0 ║
459
+ ║ Session ID: 3a4f8c21 ║
460
+ ║ Total Cost: $0.0015 ║
461
+ ║ Turns: 3 ║
462
+ ╚══════════════════════════════════════════════════════╝
463
+ ```
464
+
465
+ ### Advanced Features
466
+
467
+ **Slash Command Support:**
468
+ Delegation preserves custom slash commands in prompts:
469
+ ```bash
470
+ ccs glm -p "/cook create responsive landing page"
471
+ # Executes /cook command in delegated GLM session
472
+ ```
473
+
474
+ **Signal Handling:**
475
+ Ctrl+C or Esc properly kills delegated processes (no orphans):
476
+ ```bash
477
+ # Hit Ctrl+C during delegation
478
+ [!] Parent process terminating, killing delegated session...
479
+ ```
480
+
481
+ **Time-Based Limits:**
482
+ 10-minute default timeout with graceful termination (supports `:continue`):
483
+ ```bash
484
+ ccs glm -p "complex task" # Auto-terminates after 10min if needed
485
+ ccs glm:continue -p "pick up where we left off"
486
+ ```
487
+
488
+ ### Cost Savings Example
489
+
490
+ **Traditional (Main Session):**
491
+ ```
492
+ Context load: 2000 tokens
493
+ Discussion: 1500 tokens
494
+ Code gen: 4500 tokens
495
+ ─────────────────────────
496
+ Total: 8000 tokens → $0.032
497
+ ```
498
+
499
+ **Delegation (GLM):**
500
+ ```
501
+ 3x tasks via GLM: 1500 tokens → $0.0045
502
+ ─────────────────────────────────────────
503
+ Savings: $0.0275 (86% reduction)
504
+ ```
505
+
506
+ ### Documentation
507
+
508
+ - **Workflow Diagrams**: See [docs/ccs-delegation-diagrams.md](docs/ccs-delegation-diagrams.md) for visual architecture
509
+ - **Skill Reference**: `.claude/skills/ccs-delegation/` for AI decision framework
510
+ - **Agent Docs**: `.claude/agents/ccs-delegator.md` for orchestration patterns
511
+
512
+ <br>
197
513
 
198
514
  ## GLM with Thinking (GLMT)
199
515
 
200
- > **[!] WARNING: NOT PRODUCTION READY**
516
+ > [!CAUTION]
517
+ > ### NOT PRODUCTION READY - EXPERIMENTAL FEATURE
201
518
  >
202
519
  > **GLMT is experimental and requires extensive debugging**:
203
520
  > - Streaming and tool support still under active development
@@ -205,13 +522,15 @@ Commands and skills symlinked from `~/.ccs/shared/` - no duplication across prof
205
522
  > - Requires frequent debugging and manual intervention
206
523
  > - **Not recommended for critical workflows or production use**
207
524
  >
208
- > **Alternative for GLM Thinking**: Consider going through the **CCR hustle** with the **Transformer of Bedolla** (ZaiTransformer) for a more stable implementation.
209
- >
210
- > **[!] Important**: GLMT requires npm installation (`npm install -g @kaitranntt/ccs`). Not available in native shell versions (requires Node.js HTTP server).
525
+ > **Alternative for GLM Thinking**: Consider going through the **CCR hustle** with the **Transformer of Bedolla** ([ZaiTransformer](https://github.com/Bedolla/ZaiTransformer/)) for a more stable implementation.
211
526
 
212
- ### Acknowledgments: The Foundation That Made GLMT Possible
527
+ > [!IMPORTANT]
528
+ > GLMT requires npm installation (`npm install -g @kaitranntt/ccs`). Not available in native shell versions (requires Node.js HTTP server).
213
529
 
214
- > **[i] Pioneering Work by [@Bedolla](https://github.com/Bedolla)**
530
+ <br>
531
+
532
+ > [!NOTE]
533
+ > ### Acknowledgments: The Foundation That Made GLMT Possible
215
534
  >
216
535
  > **CCS's GLMT implementation owes its existence to the groundbreaking work of [@Bedolla](https://github.com/Bedolla)**, who created [ZaiTransformer](https://github.com/Bedolla/ZaiTransformer/) - the **first integration** to bridge [Claude Code Router (CCR)](https://github.com/musistudio/claude-code-router) with Z.AI's reasoning capabilities.
217
536
  >
@@ -225,23 +544,35 @@ Commands and skills symlinked from `~/.ccs/shared/` - no duplication across prof
225
544
  >
226
545
  > **Recognition**: If you benefit from GLMT's thinking capabilities, you're benefiting from Bedolla's vision and engineering. Please consider starring [ZaiTransformer](https://github.com/Bedolla/ZaiTransformer/) to support pioneering work in the Claude Code ecosystem.
227
546
 
228
- ---
547
+ <br>
548
+
549
+ <details>
550
+ <summary><h3>GLM vs GLMT Comparison</h3></summary>
551
+
552
+ <br>
229
553
 
230
- ### GLM vs GLMT
554
+ <div align="center">
231
555
 
232
556
  | Feature | GLM (`ccs glm`) | GLMT (`ccs glmt`) |
233
- |---------|-----------------|-------------------|
557
+ |:--------|:----------------|:------------------|
234
558
  | **Endpoint** | Anthropic-compatible | OpenAI-compatible |
235
- | **Thinking** | No | Experimental (reasoning_content) |
559
+ | **Thinking** | No | Experimental (`reasoning_content`) |
236
560
  | **Tool Support** | Basic | **Unstable (v3.5+)** |
237
561
  | **MCP Tools** | Limited | **Buggy (v3.5+)** |
238
562
  | **Streaming** | Stable | **Experimental (v3.4+)** |
239
563
  | **TTFB** | <500ms | <500ms (sometimes), 2-10s+ (often) |
240
564
  | **Use Case** | Reliable work | **Debugging experiments only** |
241
565
 
242
- ### Tool Support (v3.5)
566
+ </div>
567
+
568
+ </details>
569
+
570
+ <details>
571
+ <summary><h3>Tool Support (v3.5) - EXPERIMENTAL</h3></summary>
243
572
 
244
- **GLMT attempts MCP tools and function calling (EXPERIMENTAL)**:
573
+ <br>
574
+
575
+ **GLMT attempts MCP tools and function calling:**
245
576
 
246
577
  - **Bidirectional Transformation**: Anthropic tools ↔ OpenAI format (unstable)
247
578
  - **MCP Integration**: MCP tools sometimes execute (often output XML garbage)
@@ -249,9 +580,14 @@ Commands and skills symlinked from `~/.ccs/shared/` - no duplication across prof
249
580
  - **Backward Compatible**: May break existing thinking support
250
581
  - **Configuration Required**: Frequent manual debugging needed
251
582
 
252
- ### Streaming Support (v3.4)
583
+ </details>
584
+
585
+ <details>
586
+ <summary><h3>Streaming Support (v3.4) - OFTEN FAILS</h3></summary>
253
587
 
254
- **GLMT attempts real-time streaming** with incremental reasoning content delivery (OFTEN FAILS).
588
+ <br>
589
+
590
+ **GLMT attempts real-time streaming** with incremental reasoning content delivery:
255
591
 
256
592
  - **Default**: Streaming enabled (TTFB <500ms when it works)
257
593
  - **Auto-fallback**: Frequently switches to buffered mode due to errors
@@ -259,19 +595,29 @@ Commands and skills symlinked from `~/.ccs/shared/` - no duplication across prof
259
595
  - May ignore `thinking.type` and `budget_tokens`
260
596
  - Precedence: CLI parameter > message tags > default (when not broken)
261
597
 
262
- **Barely working**: Z.AI (tested, tool calls frequently break, requires constant debugging)
598
+ **Status**: Z.AI (tested, tool calls frequently break, requires constant debugging)
599
+
600
+ </details>
263
601
 
264
- ### How It Works (When It Works)
602
+ <details>
603
+ <summary><h3>How It Works (When It Works)</h3></summary>
604
+
605
+ <br>
265
606
 
266
607
  1. CCS spawns embedded HTTP proxy on localhost (if not crashing)
267
608
  2. Proxy attempts to convert Anthropic format → OpenAI format (often fails)
268
609
  3. Tries to transform Anthropic tools → OpenAI function calling format (buggy)
269
610
  4. Forwards to Z.AI with reasoning parameters and tools (when not timing out)
270
611
  5. Attempts to convert `reasoning_content` → thinking blocks (partial or broken)
271
- 6. Attempts to convert OpenAI `tool_calls` → Anthropic tool_use blocks (XML garbage common)
612
+ 6. Attempts to convert OpenAI `tool_calls` → Anthropic `tool_use` blocks (XML garbage common)
272
613
  7. Thinking and tool calls sometimes appear in Claude Code UI (when not broken)
273
614
 
274
- ### Control Tags & Keywords
615
+ </details>
616
+
617
+ <details>
618
+ <summary><h3>Control Tags & Keywords</h3></summary>
619
+
620
+ <br>
275
621
 
276
622
  **Control Tags**:
277
623
  - `<Thinking:On|Off>` - Enable/disable reasoning blocks (default: On)
@@ -283,7 +629,12 @@ Commands and skills symlinked from `~/.ccs/shared/` - no duplication across prof
283
629
  - `think harder` - Sometimes enables reasoning (high effort)
284
630
  - `ultrathink` - Attempts maximum reasoning depth (often breaks)
285
631
 
286
- ### Environment Variables
632
+ </details>
633
+
634
+ <details>
635
+ <summary><h3>Environment Variables</h3></summary>
636
+
637
+ <br>
287
638
 
288
639
  **GLMT features** (all experimental):
289
640
  - Forced English output enforcement (sometimes works)
@@ -294,13 +645,21 @@ Commands and skills symlinked from `~/.ccs/shared/` - no duplication across prof
294
645
  - `CCS_DEBUG_LOG=1` - Enable debug file logging
295
646
  - `CCS_CLAUDE_PATH=/path/to/claude` - Custom Claude CLI path
296
647
 
297
- ### API Key Setup
648
+ </details>
649
+
650
+ <details>
651
+ <summary><h3>API Key Setup</h3></summary>
652
+
653
+ <br>
298
654
 
299
655
  ```bash
300
656
  # Edit GLMT settings
301
657
  nano ~/.ccs/glmt.settings.json
658
+ ```
659
+
660
+ Set Z.AI API key (requires coding plan):
302
661
 
303
- # Set Z.AI API key (requires coding plan)
662
+ ```json
304
663
  {
305
664
  "env": {
306
665
  "ANTHROPIC_AUTH_TOKEN": "your-z-ai-api-key"
@@ -308,15 +667,28 @@ nano ~/.ccs/glmt.settings.json
308
667
  }
309
668
  ```
310
669
 
311
- ### Security Limits
670
+ </details>
312
671
 
313
- **DoS protection** (v3.4):
314
- - SSE buffer: 1MB max per event
315
- - Content buffer: 10MB max per block (thinking/text)
316
- - Content blocks: 100 max per message
317
- - Request timeout: 120s (both streaming and buffered)
672
+ <details>
673
+ <summary><h3>Security Limits (DoS Protection)</h3></summary>
318
674
 
319
- ### Debugging
675
+ <br>
676
+
677
+ **v3.4 Protection Limits**:
678
+
679
+ | Limit | Value | Purpose |
680
+ |:------|:------|:--------|
681
+ | **SSE buffer** | 1MB max per event | Prevent buffer overflow |
682
+ | **Content buffer** | 10MB max per block | Limit thinking/text blocks |
683
+ | **Content blocks** | 100 max per message | Prevent DoS attacks |
684
+ | **Request timeout** | 120s | Both streaming and buffered |
685
+
686
+ </details>
687
+
688
+ <details>
689
+ <summary><h3>Debugging</h3></summary>
690
+
691
+ <br>
320
692
 
321
693
  **Enable verbose logging**:
322
694
  ```bash
@@ -341,87 +713,100 @@ ccs glmt --verbose "test"
341
713
  cat ~/.ccs/logs/*response-openai.json | jq '.choices[0].message.reasoning_content'
342
714
  ```
343
715
 
344
- **If absent**: Z.AI API issue (verify key, account status)
345
- **If present**: Transformation issue (check response-anthropic.json)
346
-
347
- ---
348
-
349
- ## Usage Examples
716
+ **Troubleshooting**:
717
+ - **If absent**: Z.AI API issue (verify key, account status)
718
+ - **If present**: Transformation issue (check `response-anthropic.json`)
350
719
 
351
- ### Basic Switching
352
- ```bash
353
- ccs # Claude subscription (default)
354
- ccs glm # GLM (no thinking)
355
- ccs glmt # GLM with thinking
356
- ccs kimi # Kimi for Coding
357
- ccs --version # Show version
358
- ```
720
+ </details>
359
721
 
360
- ### Multi-Account Setup
361
- ```bash
362
- # Create accounts
363
- ccs auth create work
364
- ccs auth create personal
722
+ <br>
365
723
 
366
- # Terminal 1
367
- ccs work "implement feature"
724
+ ## Maintenance
368
725
 
369
- # Terminal 2 (concurrent)
370
- ccs personal "review code"
371
- ```
726
+ ### Health Check
372
727
 
373
- ### Custom Claude CLI Path
728
+ Run diagnostics to verify your CCS installation:
374
729
 
375
- Non-standard installation location:
376
730
  ```bash
377
- export CCS_CLAUDE_PATH="/path/to/claude" # Unix
378
- $env:CCS_CLAUDE_PATH = "D:\Tools\Claude\claude.exe" # Windows
731
+ ccs doctor
379
732
  ```
380
733
 
381
- See [Troubleshooting Guide](./docs/en/troubleshooting.md#claude-cli-in-non-standard-location)
734
+ **Checks performed**:
735
+ - ✓ Claude CLI availability
736
+ - ✓ Configuration files (config.json, profiles)
737
+ - ✓ CCS symlinks to ~/.claude/
738
+ - ✓ Delegation system
739
+ - ✓ File permissions
382
740
 
383
- ---
741
+ **Output**:
742
+ ```
743
+ [?] Checking Claude CLI... [OK]
744
+ [?] Checking ~/.ccs/ directory... [OK]
745
+ [?] Checking config.json... [OK]
746
+ [?] Checking CCS symlinks... [OK]
747
+ ...
748
+ Status: Installation healthy
749
+ ```
384
750
 
385
- ## Configuration
751
+ ### Update CCS Items
386
752
 
387
- Auto-created during installation via npm postinstall script.
753
+ If you modify CCS items or need to re-install symlinks:
388
754
 
389
- **~/.ccs/config.json**:
390
- ```json
391
- {
392
- "profiles": {
393
- "glm": "~/.ccs/glm.settings.json",
394
- "glmt": "~/.ccs/glmt.settings.json",
395
- "kimi": "~/.ccs/kimi.settings.json",
396
- "default": "~/.claude/settings.json"
397
- }
398
- }
755
+ ```bash
756
+ ccs update
399
757
  ```
400
758
 
401
- Complete guide: [docs/en/configuration.md](./docs/en/configuration.md)
759
+ **What it does**:
760
+ - Re-creates selective symlinks from `~/.ccs/.claude/` to `~/.claude/`
761
+ - Backs up existing files before replacing
762
+ - Safe to run multiple times (idempotent)
402
763
 
403
- ---
764
+ **When to use**:
765
+ - After manual modifications to ~/.claude/
766
+ - If `ccs doctor` reports symlink issues
767
+ - After upgrading CCS to a new version
768
+
769
+ <br>
404
770
 
405
771
  ## Uninstall
406
772
 
407
- **Package Managers**
773
+ <details>
774
+ <summary><h3>Package Managers</h3></summary>
775
+
776
+ <br>
777
+
408
778
  ```bash
779
+ # npm
409
780
  npm uninstall -g @kaitranntt/ccs
781
+
782
+ # yarn
410
783
  yarn global remove @kaitranntt/ccs
784
+
785
+ # pnpm
411
786
  pnpm remove -g @kaitranntt/ccs
787
+
788
+ # bun
412
789
  bun remove -g @kaitranntt/ccs
413
790
  ```
414
791
 
415
- **Official Uninstaller**
792
+ </details>
793
+
794
+ <details>
795
+ <summary><h3>Official Uninstaller</h3></summary>
796
+
797
+ <br>
798
+
416
799
  ```bash
417
800
  # macOS / Linux
418
801
  curl -fsSL ccs.kaitran.ca/uninstall | bash
419
802
 
420
- # Windows
803
+ # Windows PowerShell
421
804
  irm ccs.kaitran.ca/uninstall | iex
422
805
  ```
423
806
 
424
- ---
807
+ </details>
808
+
809
+ <br>
425
810
 
426
811
  ## 🎯 Philosophy
427
812
 
@@ -429,8 +814,6 @@ irm ccs.kaitran.ca/uninstall | iex
429
814
  - **KISS**: Simple bash, no complexity
430
815
  - **DRY**: One source of truth (config)
431
816
 
432
- ---
433
-
434
817
  ## 📖 Documentation
435
818
 
436
819
  **Complete documentation in [docs/](./docs/)**:
@@ -442,19 +825,23 @@ irm ccs.kaitran.ca/uninstall | iex
442
825
  - [Troubleshooting](./docs/en/troubleshooting.md)
443
826
  - [Contributing](./CONTRIBUTING.md)
444
827
 
445
- ---
446
-
447
828
  ## 🤝 Contributing
448
829
 
449
830
  We welcome contributions! Please see our [Contributing Guide](./CONTRIBUTING.md) for details.
450
831
 
451
- ---
452
832
 
453
- ## 📄 License
833
+ ## Star History
454
834
 
455
- CCS is licensed under the [MIT License](LICENSE).
835
+ <div align="center">
456
836
 
457
- ---
837
+ <img src="https://api.star-history.com/svg?repos=kaitranntt/ccs&type=timeline&logscale&legend=top-left" alt="Star History Chart" width="800">
838
+
839
+ </div>
840
+
841
+
842
+ ## License
843
+
844
+ CCS is licensed under the [MIT License](LICENSE).
458
845
 
459
846
  <div align="center">
460
847