get-shit-done-cc 1.9.11 → 1.10.0-experimental.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 (61) hide show
  1. package/README.md +10 -9
  2. package/agents/design-specialist.md +222 -0
  3. package/agents/gsd-executor.md +37 -375
  4. package/agents/gsd-planner.md +15 -108
  5. package/bin/install.js +92 -5
  6. package/commands/gsd/autopilot.md +518 -0
  7. package/commands/gsd/checkpoints.md +229 -0
  8. package/commands/gsd/design-system.md +70 -0
  9. package/commands/gsd/discuss-design.md +77 -0
  10. package/commands/gsd/extend.md +80 -0
  11. package/commands/gsd/help.md +46 -17
  12. package/commands/gsd/new-project.md +94 -8
  13. package/commands/gsd/plan-phase.md +35 -5
  14. package/get-shit-done/references/ccr-integration.md +468 -0
  15. package/get-shit-done/references/checkpoint-execution.md +369 -0
  16. package/get-shit-done/references/checkpoint-types.md +728 -0
  17. package/get-shit-done/references/deviation-rules.md +215 -0
  18. package/get-shit-done/references/framework-patterns.md +543 -0
  19. package/get-shit-done/references/ui-principles.md +258 -0
  20. package/get-shit-done/references/verification-patterns.md +1 -1
  21. package/get-shit-done/skills/gsd-extend/SKILL.md +154 -0
  22. package/get-shit-done/skills/gsd-extend/references/agent-structure.md +305 -0
  23. package/get-shit-done/skills/gsd-extend/references/extension-anatomy.md +123 -0
  24. package/get-shit-done/skills/gsd-extend/references/reference-structure.md +408 -0
  25. package/get-shit-done/skills/gsd-extend/references/template-structure.md +370 -0
  26. package/get-shit-done/skills/gsd-extend/references/validation-rules.md +140 -0
  27. package/get-shit-done/skills/gsd-extend/references/workflow-structure.md +253 -0
  28. package/get-shit-done/skills/gsd-extend/templates/agent-template.md +234 -0
  29. package/get-shit-done/skills/gsd-extend/templates/reference-template.md +239 -0
  30. package/get-shit-done/skills/gsd-extend/templates/workflow-template.md +169 -0
  31. package/get-shit-done/skills/gsd-extend/workflows/create-approach.md +332 -0
  32. package/get-shit-done/skills/gsd-extend/workflows/list-extensions.md +133 -0
  33. package/get-shit-done/skills/gsd-extend/workflows/remove-extension.md +93 -0
  34. package/get-shit-done/skills/gsd-extend/workflows/validate-extension.md +184 -0
  35. package/get-shit-done/templates/autopilot-script-simple.sh +181 -0
  36. package/get-shit-done/templates/autopilot-script.sh +1142 -0
  37. package/get-shit-done/templates/autopilot-script.sh.backup +1142 -0
  38. package/get-shit-done/templates/design-system.md +238 -0
  39. package/get-shit-done/templates/phase-design.md +205 -0
  40. package/get-shit-done/templates/phase-models-template.json +71 -0
  41. package/get-shit-done/templates/phase-prompt.md +4 -4
  42. package/get-shit-done/templates/state.md +37 -0
  43. package/get-shit-done/tui/App.tsx +169 -0
  44. package/get-shit-done/tui/README.md +107 -0
  45. package/get-shit-done/tui/build.js +37 -0
  46. package/get-shit-done/tui/components/ActivityFeed.tsx +126 -0
  47. package/get-shit-done/tui/components/PhaseCard.tsx +86 -0
  48. package/get-shit-done/tui/components/StatsBar.tsx +147 -0
  49. package/get-shit-done/tui/dist/index.js +387 -0
  50. package/get-shit-done/tui/index.tsx +12 -0
  51. package/get-shit-done/tui/package-lock.json +1074 -0
  52. package/get-shit-done/tui/package.json +22 -0
  53. package/get-shit-done/tui/utils/pipeReader.ts +129 -0
  54. package/get-shit-done/workflows/design-system.md +245 -0
  55. package/get-shit-done/workflows/discuss-design.md +330 -0
  56. package/get-shit-done/workflows/execute-phase.md +44 -1
  57. package/get-shit-done/workflows/execute-plan-auth.md +122 -0
  58. package/get-shit-done/workflows/execute-plan-checkpoints.md +541 -0
  59. package/get-shit-done/workflows/execute-plan.md +34 -856
  60. package/package.json +8 -3
  61. package/commands/gsd/whats-new.md +0 -124
@@ -323,13 +323,13 @@ questions: [
323
323
  ]
324
324
  },
325
325
  {
326
- header: "Model Profile",
327
- question: "Which AI models for planning agents?",
326
+ header: "Planning Quality",
327
+ question: "How thorough should planning agents be?",
328
328
  multiSelect: false,
329
329
  options: [
330
- { label: "Balanced (Recommended)", description: "Sonnet for most agents — good quality/cost ratio" },
331
- { label: "Quality", description: "Opus for research/roadmap — higher cost, deeper analysis" },
332
- { label: "Budget", description: "Haiku where possible — fastest, lowest cost" }
330
+ { label: "Balanced (Recommended)", description: "Good quality/cost for planning agents" },
331
+ { label: "Quality", description: "Deeper analysis, higher cost" },
332
+ { label: "Budget", description: "Faster, lower cost" }
333
333
  ]
334
334
  }
335
335
  ]
@@ -343,21 +343,43 @@ Create `.planning/config.json` with all settings:
343
343
  "depth": "quick|standard|comprehensive",
344
344
  "parallelization": true|false,
345
345
  "commit_docs": true|false,
346
- "model_profile": "quality|balanced|budget",
346
+ "model_profile": "balanced|quality|budget",
347
347
  "workflow": {
348
348
  "research": true|false,
349
349
  "plan_check": true|false,
350
350
  "verifier": true|false
351
+ },
352
+ "autopilot": {
353
+ "checkpoint_mode": "queue|skip",
354
+ "max_retries": 3,
355
+ "budget_limit_usd": 0,
356
+ "notify_webhook": "",
357
+ "model": "default"
351
358
  }
352
359
  }
353
360
  ```
354
361
 
362
+ **Autopilot settings (defaults shown):**
363
+ - `checkpoint_mode`: How to handle plans needing human input
364
+ - `queue`: Write to `.planning/checkpoints/pending/`, continue with other work
365
+ - `skip`: Skip non-autonomous plans entirely
366
+ - `max_retries`: Retry count before marking phase as failed (default: 3)
367
+ - `budget_limit_usd`: Stop if estimated cost exceeds this (0 = unlimited)
368
+ - `notify_webhook`: URL to POST notifications (empty = disabled)
369
+
355
370
  **If commit_docs = No:**
356
371
  - Set `commit_docs: false` in config.json
357
372
  - Add `.planning/` to `.gitignore` (create if needed)
358
373
 
359
374
  **If commit_docs = Yes:**
360
- - No additional gitignore entries needed
375
+ - Add autopilot transient files to `.gitignore`:
376
+ ```
377
+ # GSD autopilot (transient files)
378
+ .planning/autopilot.sh
379
+ .planning/autopilot.lock
380
+ .planning/logs/
381
+ .planning/checkpoints/
382
+ ```
361
383
 
362
384
  **Commit config.json:**
363
385
 
@@ -949,6 +971,48 @@ Present completion with next steps:
949
971
 
950
972
  ───────────────────────────────────────────────────────────────
951
973
 
974
+ **Optional:** If your project has UI, establish design foundations first:
975
+
976
+ /gsd:design-system — conversational design system creation
977
+
978
+ ───────────────────────────────────────────────────────────────
979
+ ```
980
+
981
+ Use AskUserQuestion to offer next steps:
982
+
983
+ - header: "Next"
984
+ - question: "How would you like to proceed?"
985
+ - options:
986
+ - "Run autopilot" — Execute entire milestone autonomously (Recommended)
987
+ - "Plan phase 1" — Start with manual phase-by-phase execution
988
+ - "Discuss phase 1" — Gather context before planning
989
+ - "Create design system" — Establish visual foundations first (UI projects)
990
+
991
+ **If "Run autopilot":**
992
+ ```
993
+ /gsd:autopilot
994
+ ```
995
+ Route to autopilot command.
996
+
997
+ **If "Plan phase 1":**
998
+ ```
999
+ ───────────────────────────────────────────────────────────────
1000
+
1001
+ ## ▶ Next Up
1002
+
1003
+ **Phase 1: [Phase Name]** — [Goal from ROADMAP.md]
1004
+
1005
+ /gsd:plan-phase 1
1006
+
1007
+ <sub>/clear first → fresh context window</sub>
1008
+
1009
+ ───────────────────────────────────────────────────────────────
1010
+ ```
1011
+
1012
+ **If "Discuss phase 1":**
1013
+ ```
1014
+ ───────────────────────────────────────────────────────────────
1015
+
952
1016
  ## ▶ Next Up
953
1017
 
954
1018
  **Phase 1: [Phase Name]** — [Goal from ROADMAP.md]
@@ -957,10 +1021,32 @@ Present completion with next steps:
957
1021
 
958
1022
  <sub>/clear first → fresh context window</sub>
959
1023
 
960
- ---
1024
+ ───────────────────────────────────────────────────────────────
961
1025
 
962
1026
  **Also available:**
963
1027
  - /gsd:plan-phase 1 — skip discussion, plan directly
1028
+ - /gsd:autopilot — execute entire milestone autonomously
1029
+
1030
+ ───────────────────────────────────────────────────────────────
1031
+ ```
1032
+
1033
+ **If "Create design system":**
1034
+ ```
1035
+ ───────────────────────────────────────────────────────────────
1036
+
1037
+ ## ▶ Design System
1038
+
1039
+ Establish visual foundations before building UI phases.
1040
+
1041
+ /gsd:design-system
1042
+
1043
+ <sub>/clear first → fresh context window</sub>
1044
+
1045
+ ───────────────────────────────────────────────────────────────
1046
+
1047
+ After design system is created, continue with:
1048
+ - /gsd:discuss-design 1 — design phase-specific UI
1049
+ - /gsd:plan-phase 1 — plan the first phase
964
1050
 
965
1051
  ───────────────────────────────────────────────────────────────
966
1052
  ```
@@ -246,11 +246,17 @@ REQUIREMENTS_CONTENT=$(cat .planning/REQUIREMENTS.md 2>/dev/null)
246
246
  CONTEXT_CONTENT=$(cat "${PHASE_DIR}"/*-CONTEXT.md 2>/dev/null)
247
247
  RESEARCH_CONTENT=$(cat "${PHASE_DIR}"/*-RESEARCH.md 2>/dev/null)
248
248
 
249
+ # Design context (from /gsd:discuss-design)
250
+ DESIGN_CONTENT=$(cat "${PHASE_DIR}"/*-DESIGN.md 2>/dev/null)
251
+ DESIGN_SYSTEM_CONTENT=$(cat .planning/DESIGN-SYSTEM.md 2>/dev/null)
252
+
249
253
  # Gap closure files (only if --gaps mode)
250
254
  VERIFICATION_CONTENT=$(cat "${PHASE_DIR}"/*-VERIFICATION.md 2>/dev/null)
251
255
  UAT_CONTENT=$(cat "${PHASE_DIR}"/*-UAT.md 2>/dev/null)
252
256
  ```
253
257
 
258
+ **If DESIGN.md exists:** Display `Using phase design: ${PHASE_DIR}/${PHASE}-DESIGN.md`
259
+
254
260
  ## 8. Spawn gsd-planner Agent
255
261
 
256
262
  Display stage banner:
@@ -285,6 +291,12 @@ Fill prompt with inlined content and spawn:
285
291
  **Research (if exists):**
286
292
  {research_content}
287
293
 
294
+ **Design System (if exists):**
295
+ {design_system_content}
296
+
297
+ **Phase Design (if exists):**
298
+ {design_content}
299
+
288
300
  **Gap Closure (if --gaps mode):**
289
301
  {verification_content}
290
302
  {uat_content}
@@ -474,6 +486,24 @@ Route to `<offer_next>`.
474
486
  </process>
475
487
 
476
488
  <offer_next>
489
+ **Check autopilot mode first:**
490
+
491
+ ```bash
492
+ echo $GSD_AUTOPILOT
493
+ ```
494
+
495
+ **If GSD_AUTOPILOT=1 (autopilot mode):**
496
+
497
+ Output minimal plain text confirmation:
498
+
499
+ ```
500
+ Phase {X} planned: {N} plan(s) ready
501
+ ```
502
+
503
+ Then stop. Do NOT output the "Next Up" section or any guidance.
504
+
505
+ **Otherwise (interactive mode):**
506
+
477
507
  Output this markdown directly (not as a code block):
478
508
 
479
509
  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
@@ -496,15 +526,15 @@ Verification: {Passed | Passed with override | Skipped}
496
526
 
497
527
  **Execute Phase {X}** — run all {N} plans
498
528
 
499
- /gsd:execute-phase {X}
529
+ `/gsd:execute-phase {X}`
500
530
 
501
- <sub>/clear first → fresh context window</sub>
531
+ <sub>`/clear` first → fresh context window</sub>
502
532
 
503
533
  ───────────────────────────────────────────────────────────────
504
534
 
505
535
  **Also available:**
506
- - cat .planning/phases/{phase-dir}/*-PLAN.md — review plans
507
- - /gsd:plan-phase {X} --research — re-research first
536
+ - `cat .planning/phases/{phase-dir}/*-PLAN.md` — review plans
537
+ - `/gsd:plan-phase {X} --research` — re-research first
508
538
 
509
539
  ───────────────────────────────────────────────────────────────
510
540
  </offer_next>
@@ -516,7 +546,7 @@ Verification: {Passed | Passed with override | Skipped}
516
546
  - [ ] Research completed (unless --skip-research or --gaps or exists)
517
547
  - [ ] gsd-phase-researcher spawned if research needed
518
548
  - [ ] Existing plans checked
519
- - [ ] gsd-planner spawned with context (including RESEARCH.md if available)
549
+ - [ ] gsd-planner spawned with context (including RESEARCH.md, DESIGN.md if available)
520
550
  - [ ] Plans created (PLANNING COMPLETE or CHECKPOINT handled)
521
551
  - [ ] gsd-plan-checker spawned (unless --skip-verify)
522
552
  - [ ] Verification passed OR user override OR max iterations with user decision
@@ -0,0 +1,468 @@
1
+ # CCR Integration with GSD Autopilot
2
+
3
+ ## Overview
4
+
5
+ **Claude Code Router (CCR)** enables GSD Autopilot to use different AI models for different phases, optimizing for both cost and capability. Instead of using a single model for all phases, you can route simple tasks to inexpensive models (like GLM-4.7) and complex reasoning tasks to premium models (like Claude Opus).
6
+
7
+ ## What is CCR?
8
+
9
+ CCR is a proxy router that sits between Claude Code and multiple AI model providers. It allows you to:
10
+ - Route requests to different models based on configuration
11
+ - Use multiple providers (Anthropic, OpenAI, Z-AI, OpenRouter) in one workflow
12
+ - Set up automatic model selection rules
13
+ - Save costs by matching model capability to task complexity
14
+
15
+ ## Installation & Setup
16
+
17
+ ### 1. Install CCR
18
+
19
+ ```bash
20
+ # Clone CCR repository
21
+ git clone https://github.com/musistudio/claude-code-router.git
22
+ cd claude-code-router
23
+
24
+ # Install dependencies
25
+ npm install
26
+
27
+ # Create global symlink
28
+ npm link
29
+ ```
30
+
31
+ ### 2. Configure CCR
32
+
33
+ Create `~/.claude-code-router/config.json`:
34
+
35
+ ```json
36
+ {
37
+ "APIKEY": "your-primary-api-key",
38
+ "PROXY_URL": "http://127.0.0.1:7890",
39
+ "LOG": true,
40
+ "API_TIMEOUT_MS": 600000,
41
+ "Providers": [
42
+ {
43
+ "name": "anthropic",
44
+ "api_base_url": "https://api.anthropic.com",
45
+ "api_key": "your-anthropic-key",
46
+ "models": ["claude-3-5-sonnet-latest", "claude-3-5-opus-latest"]
47
+ },
48
+ {
49
+ "name": "z-ai",
50
+ "api_base_url": "https://open.bigmodel.cn/api/paas/v4/",
51
+ "api_key": "your-z-ai-key",
52
+ "models": ["glm-4.7"]
53
+ },
54
+ {
55
+ "name": "openrouter",
56
+ "api_base_url": "https://openrouter.ai/api/v1/chat/completions",
57
+ "api_key": "your-openrouter-key",
58
+ "models": ["deepseek/deepseek-reasoner", "google/gemini-2.5-pro-preview"]
59
+ }
60
+ ],
61
+ "Router": {
62
+ "default": "anthropic,claude-3-5-sonnet-latest",
63
+ "background": "z-ai,glm-4.7",
64
+ "think": "openrouter,deepseek/deepseek-reasoner",
65
+ "longContext": "anthropic,claude-3-5-opus-latest"
66
+ }
67
+ }
68
+ ```
69
+
70
+ ### 3. Start CCR Service
71
+
72
+ ```bash
73
+ # Start the router service
74
+ ccr start
75
+
76
+ # Verify it's running
77
+ curl http://127.0.0.1:3456/health
78
+ ```
79
+
80
+ ## GSD Autopilot Integration
81
+
82
+ ### Automatic Detection
83
+
84
+ When you run `/gsd:autopilot`, it automatically:
85
+ 1. Checks if `ccr` command is available
86
+ 2. Creates `.planning/phase-models.json` from template (first run)
87
+ 3. Uses CCR for model routing if available
88
+ 4. Falls back to native `claude` command if CCR not detected
89
+
90
+ ### Phase Model Configuration
91
+
92
+ Edit `.planning/phase-models.json` to customize per-phase model selection:
93
+
94
+ ```json
95
+ {
96
+ "description": "Per-phase model configuration for GSD Autopilot",
97
+ "default_model": "claude-3-5-sonnet-latest",
98
+ "phases": {
99
+ "1": {
100
+ "model": "claude-3-5-sonnet-latest",
101
+ "reasoning": "Initial setup and architecture - Sonnet is cost-effective"
102
+ },
103
+ "2": {
104
+ "model": "claude-3-5-opus-latest",
105
+ "reasoning": "Complex implementation requiring deep reasoning"
106
+ },
107
+ "3": {
108
+ "model": "claude-3-5-sonnet-latest",
109
+ "reasoning": "Standard development work"
110
+ },
111
+ "gaps": {
112
+ "model": "glm-4.7",
113
+ "reasoning": "Gap closure is typically straightforward fixes"
114
+ },
115
+ "continuation": {
116
+ "model": "claude-3-5-sonnet-latest",
117
+ "reasoning": "Checkpoint continuations need context"
118
+ },
119
+ "verification": {
120
+ "model": "glm-4.7",
121
+ "reasoning": "Verification is systematic testing"
122
+ },
123
+ "milestone_complete": {
124
+ "model": "claude-3-5-sonnet-latest",
125
+ "reasoning": "Completion task is straightforward"
126
+ }
127
+ },
128
+ "provider_routing": {
129
+ "claude-3-5-sonnet-latest": {
130
+ "provider": "anthropic",
131
+ "base_url": "https://api.anthropic.com"
132
+ },
133
+ "claude-3-5-opus-latest": {
134
+ "provider": "anthropic",
135
+ "base_url": "https://api.anthropic.com"
136
+ },
137
+ "glm-4.7": {
138
+ "provider": "z-ai",
139
+ "base_url": "https://open.bigmodel.cn/api/paas/v4/",
140
+ "auth_header": "Authorization"
141
+ },
142
+ "deepseek-reasoner": {
143
+ "provider": "openrouter",
144
+ "model_name": "deepseek/deepseek-reasoner",
145
+ "base_url": "https://openrouter.ai/api/v1/chat/completions"
146
+ }
147
+ },
148
+ "cost_optimization": {
149
+ "enabled": true,
150
+ "auto_downgrade_on_budget": {
151
+ "threshold_percent": 80,
152
+ "fallback_model": "claude-3-5-haiku-latest"
153
+ }
154
+ }
155
+ }
156
+ ```
157
+
158
+ ### Running Autopilot with CCR
159
+
160
+ **Option 1: Direct execution (recommended)**
161
+ ```bash
162
+ cd /path/to/project
163
+ bash .planning/autopilot.sh
164
+ ```
165
+ The script automatically detects CCR and uses configured models.
166
+
167
+ **Option 2: Explicit CCR wrapper**
168
+ ```bash
169
+ cd /path/to/project
170
+ ccr code --model claude-3-5-sonnet-latest -- bash .planning/autopilot.sh
171
+ ```
172
+
173
+ **Option 3: Background execution**
174
+ ```bash
175
+ cd /path/to/project
176
+ nohup bash .planning/autopilot.sh > .planning/logs/autopilot.log 2>&1 &
177
+ ```
178
+
179
+ ## Model Selection Strategy
180
+
181
+ ### By Task Type
182
+
183
+ | Task Type | Recommended Model | Reason |
184
+ |-----------|-------------------|---------|
185
+ | **Complex Architecture** | `claude-3-5-opus-latest` | Deep reasoning, system design |
186
+ | **Implementation** | `claude-3-5-sonnet-latest` | Good balance of capability/cost |
187
+ | **Testing & Verification** | `glm-4.7` | Systematic, cost-effective |
188
+ | **Documentation** | `glm-4.7` | Straightforward generation |
189
+ | **Bug Fixes** | `claude-3-5-sonnet-latest` | Context + problem-solving |
190
+ | **Code Review** | `claude-3-5-opus-latest` | Thorough analysis needed |
191
+
192
+ ### By Phase Context
193
+
194
+ **Phase 1 (Setup/Architecture)**
195
+ - Use: `claude-3-5-sonnet-latest`
196
+ - Reasoning: Initial work is important but typically follows patterns
197
+
198
+ **Phase 2 (Core Implementation)**
199
+ - Use: `claude-3-5-opus-latest` or `deepseek-reasoner`
200
+ - Reasoning: Complex problem-solving, architectural decisions
201
+
202
+ **Phase 3+ (Development)**
203
+ - Use: `claude-3-5-sonnet-latest`
204
+ - Reasoning: Consistent quality at moderate cost
205
+
206
+ **Gap Closure**
207
+ - Use: `glm-4.7`
208
+ - Reasoning: Usually straightforward fixes based on verification feedback
209
+
210
+ **Verification**
211
+ - Use: `glm-4.7`
212
+ - Reasoning: Systematic testing doesn't require deep reasoning
213
+
214
+ ### Cost Optimization Example
215
+
216
+ For a typical 5-phase project:
217
+
218
+ ```
219
+ Phase 1: Sonnet (~$0.50)
220
+ Phase 2: Opus (~$1.50)
221
+ Phase 3: Sonnet (~$0.50)
222
+ Phase 4: Sonnet (~$0.50)
223
+ Phase 5: Sonnet (~$0.50)
224
+ Gap Closure: GLM (~$0.05)
225
+ Verification: GLM (~$0.05)
226
+
227
+ Total: ~$3.60
228
+ ```
229
+
230
+ vs. all Opus (~$7.50)
231
+ **Savings: ~52%**
232
+
233
+ ## Advanced Configuration
234
+
235
+ ### Auto-Downgrade on Budget
236
+
237
+ Enable automatic model downgrading when approaching budget limit:
238
+
239
+ ```json
240
+ {
241
+ "cost_optimization": {
242
+ "enabled": true,
243
+ "auto_downgrade_on_budget": {
244
+ "threshold_percent": 80,
245
+ "fallback_model": "claude-3-5-haiku-latest"
246
+ }
247
+ }
248
+ }
249
+ ```
250
+
251
+ ### Task-Type Routing
252
+
253
+ Automatically route by detected task type:
254
+
255
+ ```json
256
+ {
257
+ "task_type_routing": {
258
+ "research": "claude-3-5-sonnet-latest",
259
+ "planning": "claude-3-5-haiku-latest",
260
+ "coding": "claude-3-5-sonnet-latest",
261
+ "verification": "claude-3-5-haiku-latest",
262
+ "testing": "glm-4.7"
263
+ }
264
+ }
265
+ ```
266
+
267
+ ### Provider Failover
268
+
269
+ Configure automatic failover between providers:
270
+
271
+ ```json
272
+ {
273
+ "provider_routing": {
274
+ "claude-3-5-sonnet-latest": [
275
+ {
276
+ "provider": "anthropic",
277
+ "base_url": "https://api.anthropic.com",
278
+ "priority": 1
279
+ },
280
+ {
281
+ "provider": "openrouter",
282
+ "model_name": "anthropic/claude-3-5-sonnet",
283
+ "base_url": "https://openrouter.ai/api/v1/chat/completions",
284
+ "priority": 2
285
+ }
286
+ ]
287
+ }
288
+ }
289
+ ```
290
+
291
+ ## Monitoring & Debugging
292
+
293
+ ### Check CCR Status
294
+
295
+ ```bash
296
+ # Verify CCR is running
297
+ ccr status
298
+
299
+ # Test model routing
300
+ ccr model claude-3-5-sonnet-latest
301
+
302
+ # View logs
303
+ tail -f ~/.claude-code-router/logs/router.log
304
+ ```
305
+
306
+ ### Verify Model Configuration
307
+
308
+ ```bash
309
+ # Check which model will be used for a phase
310
+ grep -A 2 '"phase_number"' .planning/phase-models.json
311
+
312
+ # List all configured models
313
+ cat .planning/phase-models.json | grep '"model":' | sort | uniq
314
+ ```
315
+
316
+ ### Debug Autopilot Execution
317
+
318
+ The autopilot logs which model is used for each phase:
319
+
320
+ ```
321
+ [2025-01-26 10:15:23] [INFO] Configured CCR for model: claude-3-5-opus-latest via anthropic
322
+ [2025-01-26 10:15:24] [INFO] Planning phase 2
323
+ [2025-01-26 10:18:45] [INFO] Executing phase 2
324
+ ```
325
+
326
+ ### Cost Tracking
327
+
328
+ Each phase log includes token usage and estimated cost:
329
+
330
+ ```
331
+ [2025-01-26 10:20:15] [COST] Phase 2: 62,100 tokens (~$1.50)
332
+ ```
333
+
334
+ Total cost accumulates across all phases.
335
+
336
+ ## Troubleshooting
337
+
338
+ ### CCR Not Detected
339
+
340
+ **Symptom:** "CCR not found, using default claude command"
341
+
342
+ **Solution:**
343
+ 1. Verify CCR installation: `which ccr`
344
+ 2. Start CCR service: `ccr start`
345
+ 3. Check CCR config: `cat ~/.claude-code-router/config.json`
346
+
347
+ ### Model Not Found
348
+
349
+ **Symptom:** "Model 'glm-4.7' not available"
350
+
351
+ **Solution:**
352
+ 1. Verify model is in CCR config under `Providers[].models`
353
+ 2. Check API key is valid for the provider
354
+ 3. Test model directly: `ccr model glm-4.7`
355
+
356
+ ### Routing Failure
357
+
358
+ **Symptom:** "Provider routing failed"
359
+
360
+ **Solution:**
361
+ 1. Check `.planning/phase-models.json` syntax (use JSON validator)
362
+ 2. Verify `provider_routing` section has the model defined
363
+ 3. Check CCR service logs for detailed errors
364
+
365
+ ### API Rate Limits
366
+
367
+ **Symptom:** Requests failing with rate limit errors
368
+
369
+ **Solution:**
370
+ 1. Add delays between phase executions in autopilot script
371
+ 2. Use multiple API keys across different providers
372
+ 3. Enable provider failover in configuration
373
+
374
+ ## Best Practices
375
+
376
+ ### 1. Start Conservative, Optimize Later
377
+ - Begin with all phases using `claude-3-5-sonnet-latest`
378
+ - Profile actual costs and performance
379
+ - Gradually move suitable phases to cheaper models
380
+
381
+ ### 2. Document Model Choices
382
+ - Always include `reasoning` field explaining model choice
383
+ - Makes it easier to revisit and optimize later
384
+ - Helps team understand trade-offs
385
+
386
+ ### 3. Use Budget Tracking
387
+ - Set `budget_limit_usd` in `.planning/config.json`
388
+ - Enable `auto_downgrade_on_budget`
389
+ - Review cost after each milestone
390
+
391
+ ### 4. Test Critical Phases
392
+ - Complex architecture phases (`--from-phase 2`)
393
+ - Use premium models for unrecoverable operations
394
+ - Don't over-optimize early phases
395
+
396
+ ### 5. Keep Fallbacks
397
+ - Always configure `default_model`
398
+ - Ensure at least one provider works for all models
399
+ - Test CCR configuration before long autopilot runs
400
+
401
+ ### 6. Monitor Token Usage
402
+ - Review logs for unexpected cost spikes
403
+ - Large token usage may indicate context issues
404
+ - Consider splitting overly complex phases
405
+
406
+ ## Example Workflows
407
+
408
+ ### Budget-Conscious Project
409
+
410
+ ```json
411
+ {
412
+ "default_model": "glm-4.7",
413
+ "phases": {
414
+ "1": { "model": "glm-4.7" },
415
+ "2": { "model": "claude-3-5-sonnet-latest" },
416
+ "3": { "model": "glm-4.7" }
417
+ },
418
+ "cost_optimization": {
419
+ "enabled": true,
420
+ "auto_downgrade_on_budget": {
421
+ "threshold_percent": 70,
422
+ "fallback_model": "glm-4.7"
423
+ }
424
+ }
425
+ }
426
+ ```
427
+
428
+ ### Quality-Focused Project
429
+
430
+ ```json
431
+ {
432
+ "default_model": "claude-3-5-opus-latest",
433
+ "phases": {
434
+ "1": { "model": "claude-3-5-opus-latest" },
435
+ "2": { "model": "claude-3-5-opus-latest" },
436
+ "3": { "model": "claude-3-5-opus-latest" }
437
+ }
438
+ }
439
+ ```
440
+
441
+ ### Mixed Provider Setup
442
+
443
+ ```json
444
+ {
445
+ "provider_routing": {
446
+ "claude-3-5-sonnet-latest": {
447
+ "provider": "openrouter",
448
+ "model_name": "anthropic/claude-3-5-sonnet",
449
+ "base_url": "https://openrouter.ai/api/v1/chat/completions"
450
+ },
451
+ "glm-4.7": {
452
+ "provider": "z-ai",
453
+ "base_url": "https://open.bigmodel.cn/api/paas/v4/"
454
+ }
455
+ }
456
+ }
457
+ ```
458
+
459
+ ## Summary
460
+
461
+ CCR integration with GSD Autopilot provides:
462
+ - ✅ **Cost Optimization**: Route simple tasks to cheap models
463
+ - ✅ **Capability Matching**: Use premium models only where needed
464
+ - ✅ **Provider Flexibility**: Mix Anthropic, OpenAI, Z-AI, OpenRouter
465
+ - ✅ **Automatic Fallback**: Works without CCR if not configured
466
+ - ✅ **Transparent**: Model selection logged for debugging
467
+
468
+ Start with the template configuration, test on a small project, then optimize for your specific needs!