claude-code-pilot 3.0.0 → 3.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.
Files changed (124) hide show
  1. package/README.md +76 -97
  2. package/bin/install.js +14 -14
  3. package/manifest.json +1 -1
  4. package/package.json +17 -5
  5. package/src/agents/doc-updater.md +1 -1
  6. package/src/agents/gan-evaluator.md +209 -0
  7. package/src/agents/gan-generator.md +131 -0
  8. package/src/agents/gan-planner.md +99 -0
  9. package/src/agents/harness-optimizer.md +35 -0
  10. package/src/agents/loop-operator.md +36 -0
  11. package/src/agents/opensource-forker.md +198 -0
  12. package/src/agents/opensource-packager.md +249 -0
  13. package/src/agents/opensource-sanitizer.md +188 -0
  14. package/src/agents/performance-optimizer.md +446 -0
  15. package/src/available-rules/README.md +1 -1
  16. package/src/commands/{aside.md → ccp/aside.md} +14 -13
  17. package/src/commands/{build-fix.md → ccp/build-fix.md} +5 -0
  18. package/src/commands/{checkpoint.md → ccp/checkpoint.md} +12 -7
  19. package/src/commands/{code-review.md → ccp/code-review.md} +5 -0
  20. package/src/commands/{context-budget.md → ccp/context-budget.md} +2 -1
  21. package/src/commands/{cpp-build.md → ccp/cpp-build.md} +6 -5
  22. package/src/commands/{cpp-review.md → ccp/cpp-review.md} +7 -6
  23. package/src/commands/{cpp-test.md → ccp/cpp-test.md} +6 -5
  24. package/src/commands/ccp/docs-update.md +48 -0
  25. package/src/commands/{docs.md → ccp/docs.md} +4 -3
  26. package/src/commands/{e2e.md → ccp/e2e.md} +7 -6
  27. package/src/commands/{eval.md → ccp/eval.md} +10 -5
  28. package/src/commands/{evolve.md → ccp/evolve.md} +3 -3
  29. package/src/commands/{go-build.md → ccp/go-build.md} +6 -5
  30. package/src/commands/{go-review.md → ccp/go-review.md} +7 -6
  31. package/src/commands/{go-test.md → ccp/go-test.md} +6 -5
  32. package/src/commands/{gradle-build.md → ccp/gradle-build.md} +1 -0
  33. package/src/commands/{harness-audit.md → ccp/harness-audit.md} +6 -1
  34. package/src/commands/{kotlin-build.md → ccp/kotlin-build.md} +6 -5
  35. package/src/commands/{kotlin-review.md → ccp/kotlin-review.md} +7 -6
  36. package/src/commands/{kotlin-test.md → ccp/kotlin-test.md} +6 -5
  37. package/src/commands/{learn.md → ccp/learn.md} +7 -2
  38. package/src/commands/{model-route.md → ccp/model-route.md} +6 -1
  39. package/src/commands/{orchestrate.md → ccp/orchestrate.md} +4 -3
  40. package/src/commands/{plan.md → ccp/plan.md} +6 -5
  41. package/src/commands/ccp/profile-user.md +46 -0
  42. package/src/commands/{prompt-optimize.md → ccp/prompt-optimize.md} +3 -2
  43. package/src/commands/{prune.md → ccp/prune.md} +4 -4
  44. package/src/commands/{python-review.md → ccp/python-review.md} +7 -6
  45. package/src/commands/{quality-gate.md → ccp/quality-gate.md} +6 -1
  46. package/src/commands/{refactor-clean.md → ccp/refactor-clean.md} +5 -0
  47. package/src/commands/{resume-session.md → ccp/resume-session.md} +9 -8
  48. package/src/commands/ccp/review.md +37 -0
  49. package/src/commands/{rules-distill.md → ccp/rules-distill.md} +2 -1
  50. package/src/commands/{rust-build.md → ccp/rust-build.md} +6 -5
  51. package/src/commands/{rust-review.md → ccp/rust-review.md} +7 -6
  52. package/src/commands/{rust-test.md → ccp/rust-test.md} +6 -5
  53. package/src/commands/{save-session.md → ccp/save-session.md} +2 -1
  54. package/src/commands/ccp/secure-phase.md +35 -0
  55. package/src/commands/{sessions.md → ccp/sessions.md} +29 -24
  56. package/src/commands/{setup-pm.md → ccp/setup-pm.md} +1 -0
  57. package/src/commands/{setup-refresh.md → ccp/setup-refresh.md} +4 -3
  58. package/src/commands/{setup.md → ccp/setup.md} +24 -23
  59. package/src/commands/{skill-create.md → ccp/skill-create.md} +8 -8
  60. package/src/commands/{skill-health.md → ccp/skill-health.md} +5 -5
  61. package/src/commands/{tdd.md → ccp/tdd.md} +9 -8
  62. package/src/commands/{test-coverage.md → ccp/test-coverage.md} +5 -0
  63. package/src/commands/{tool-guide.md → ccp/tool-guide.md} +2 -1
  64. package/src/commands/{update-codemaps.md → ccp/update-codemaps.md} +5 -0
  65. package/src/commands/{update-docs.md → ccp/update-docs.md} +5 -0
  66. package/src/commands/{verify.md → ccp/verify.md} +5 -0
  67. package/src/commands/ccp/workstreams.md +68 -0
  68. package/src/examples/CLAUDE.md +4 -4
  69. package/src/examples/django-api-CLAUDE.md +5 -5
  70. package/src/examples/go-microservice-CLAUDE.md +6 -6
  71. package/src/examples/rust-api-CLAUDE.md +4 -4
  72. package/src/examples/saas-nextjs-CLAUDE.md +8 -8
  73. package/src/hooks/session-start.js +1 -1
  74. package/src/pilot/references/mcp-servers.json +1 -1
  75. package/src/pilot/workflows/docs-update.md +1165 -0
  76. package/src/pilot/workflows/help.md +48 -56
  77. package/src/pilot/workflows/profile-user.md +452 -0
  78. package/src/pilot/workflows/review.md +244 -0
  79. package/src/pilot/workflows/secure-phase.md +164 -0
  80. package/src/rules/common/code-review.md +124 -0
  81. package/src/rules/zh/README.md +108 -0
  82. package/src/rules/zh/agents.md +50 -0
  83. package/src/rules/zh/code-review.md +124 -0
  84. package/src/rules/zh/coding-style.md +48 -0
  85. package/src/rules/zh/development-workflow.md +44 -0
  86. package/src/rules/zh/git-workflow.md +24 -0
  87. package/src/rules/zh/hooks.md +30 -0
  88. package/src/rules/zh/patterns.md +31 -0
  89. package/src/rules/zh/performance.md +55 -0
  90. package/src/rules/zh/security.md +29 -0
  91. package/src/rules/zh/testing.md +29 -0
  92. package/src/skills/autonomous-agent-harness/SKILL.md +267 -0
  93. package/src/skills/autonomous-loops/SKILL.md +610 -0
  94. package/src/skills/bun-runtime/SKILL.md +84 -0
  95. package/src/skills/content-hash-cache-pattern/SKILL.md +161 -0
  96. package/src/skills/context-budget/SKILL.md +3 -3
  97. package/src/skills/continuous-learning-v2/SKILL.md +4 -4
  98. package/src/skills/continuous-learning-v2/agents/observer.md +1 -1
  99. package/src/skills/cost-aware-llm-pipeline/SKILL.md +183 -0
  100. package/src/skills/design-system/SKILL.md +82 -0
  101. package/src/skills/eval-harness/SKILL.md +270 -0
  102. package/src/skills/flutter-dart-code-review/SKILL.md +435 -0
  103. package/src/skills/gan-style-harness/SKILL.md +278 -0
  104. package/src/skills/git-workflow/SKILL.md +715 -0
  105. package/src/skills/hexagonal-architecture/SKILL.md +276 -0
  106. package/src/skills/iterative-retrieval/SKILL.md +211 -0
  107. package/src/skills/laravel-plugin-discovery/SKILL.md +229 -0
  108. package/src/skills/nextjs-turbopack/SKILL.md +44 -0
  109. package/src/skills/nuxt4-patterns/SKILL.md +100 -0
  110. package/src/skills/opensource-pipeline/SKILL.md +255 -0
  111. package/src/skills/perl-security/SKILL.md +503 -0
  112. package/src/skills/project-flow-ops/SKILL.md +111 -0
  113. package/src/skills/project-guidelines-example/SKILL.md +349 -0
  114. package/src/skills/prompt-optimizer/SKILL.md +38 -38
  115. package/src/skills/pytorch-patterns/SKILL.md +396 -0
  116. package/src/skills/regex-vs-llm-structured-text/SKILL.md +220 -0
  117. package/src/skills/repo-scan/SKILL.md +78 -0
  118. package/src/skills/rules-distill/SKILL.md +264 -0
  119. package/src/skills/rules-distill/scripts/scan-rules.sh +58 -0
  120. package/src/skills/rules-distill/scripts/scan-skills.sh +129 -0
  121. package/src/skills/swift-concurrency-6-2/SKILL.md +216 -0
  122. package/src/skills/token-budget-advisor/SKILL.md +133 -0
  123. package/src/skills/verification-loop/SKILL.md +1 -1
  124. package/src/skills/workspace-surface-audit/SKILL.md +125 -0
@@ -120,7 +120,7 @@ These commands manage the full project lifecycle: initialization, planning, exec
120
120
 
121
121
  ---
122
122
 
123
- ## Part 2: Development Workflow Commands (no prefix)
123
+ ## Part 2: Development Workflow Commands (`/ccp:` prefix)
124
124
 
125
125
  These are utility commands for day-to-day development: code quality, testing, builds, sessions, and language-specific workflows.
126
126
 
@@ -128,91 +128,83 @@ These are utility commands for day-to-day development: code quality, testing, bu
128
128
 
129
129
  | Command | Description |
130
130
  |---------|-------------|
131
- | `/code-review` | Comprehensive security and quality review of uncommitted changes |
132
- | `/tdd` | Enforce TDD workflow -- scaffold interfaces, generate tests first, then implement |
133
- | `/test-coverage` | Analyze test coverage, identify gaps, and generate missing tests for 80%+ |
134
- | `/refactor-clean` | Safely identify and remove dead code with test verification at every step |
135
- | `/prune` | Delete pending instincts older than 30 days that were never promoted |
136
- | `/rules-distill` | Scan skills to extract cross-cutting principles and distill them into rules |
131
+ | `/ccp:code-review` | Comprehensive security and quality review of uncommitted changes |
132
+ | `/ccp:tdd` | Enforce TDD workflow -- scaffold interfaces, generate tests first, then implement |
133
+ | `/ccp:test-coverage` | Analyze test coverage, identify gaps, and generate missing tests for 80%+ |
134
+ | `/ccp:refactor-clean` | Safely identify and remove dead code with test verification at every step |
135
+ | `/ccp:prune` | Delete pending instincts older than 30 days that were never promoted |
136
+ | `/ccp:rules-distill` | Scan skills to extract cross-cutting principles and distill them into rules |
137
137
 
138
138
  ### Build & Fix
139
139
 
140
140
  | Command | Description |
141
141
  |---------|-------------|
142
- | `/build-fix` | Incrementally fix build and type errors with minimal, safe changes |
143
- | `/e2e` | Generate and run end-to-end tests with Playwright |
144
- | `/docs` | Look up current documentation for a library or topic via Context7 |
145
- | `/update-docs` | Sync documentation with the codebase, generating from source-of-truth files |
146
- | `/update-codemaps` | Analyze codebase structure and generate token-lean architecture docs |
142
+ | `/ccp:build-fix` | Incrementally fix build and type errors with minimal, safe changes |
143
+ | `/ccp:e2e` | Generate and run end-to-end tests with Playwright |
144
+ | `/ccp:docs` | Look up current documentation for a library or topic via Context7 |
145
+ | `/ccp:update-docs` | Sync documentation with the codebase, generating from source-of-truth files |
146
+ | `/ccp:update-codemaps` | Analyze codebase structure and generate token-lean architecture docs |
147
147
 
148
148
  ### Planning & Orchestration
149
149
 
150
150
  | Command | Description |
151
151
  |---------|-------------|
152
- | `/plan` | Restate requirements, assess risks, and create step-by-step implementation plan |
153
- | `/orchestrate` | Sequential and tmux/worktree guidance for multi-agent workflows |
154
- | `/aside` | Answer a quick side question without losing context from the current task |
155
- | `/context-budget` | Analyze context window usage and find optimization opportunities |
156
- | `/prompt-optimize` | Analyze a draft prompt and output an optimized version |
157
-
158
- ### Multi-Agent Collaboration
159
-
160
- | Command | Description |
161
- |---------|-------------|
162
- | `/multi-plan` | Multi-model collaborative planning with dual-model analysis |
163
- | `/multi-execute` | Multi-model collaborative execution with prototype and refactor flow |
164
- | `/multi-workflow` | Multi-model collaborative development workflow with quality gates |
152
+ | `/ccp:plan` | Restate requirements, assess risks, and create step-by-step implementation plan |
153
+ | `/ccp:orchestrate` | Sequential and tmux/worktree guidance for multi-agent workflows |
154
+ | `/ccp:aside` | Answer a quick side question without losing context from the current task |
155
+ | `/ccp:context-budget` | Analyze context window usage and find optimization opportunities |
156
+ | `/ccp:prompt-optimize` | Analyze a draft prompt and output an optimized version |
165
157
 
166
158
  ### Sessions
167
159
 
168
160
  | Command | Description |
169
161
  |---------|-------------|
170
- | `/save-session` | Save current session state to a dated file for future resumption |
171
- | `/resume-session` | Load the most recent session file and resume work with full context |
172
- | `/sessions` | Manage session history -- list, load, alias, and edit sessions |
173
- | `/checkpoint` | Create or verify a checkpoint in your workflow |
162
+ | `/ccp:save-session` | Save current session state to a dated file for future resumption |
163
+ | `/ccp:resume-session` | Load the most recent session file and resume work with full context |
164
+ | `/ccp:sessions` | Manage session history -- list, load, alias, and edit sessions |
165
+ | `/ccp:checkpoint` | Create or verify a checkpoint in your workflow |
174
166
 
175
167
  ### Evaluation & Skills
176
168
 
177
169
  | Command | Description |
178
170
  |---------|-------------|
179
- | `/eval` | Manage eval-driven development workflow |
180
- | `/harness-audit` | Run a deterministic repository harness audit and return a scorecard |
181
- | `/skill-create` | Analyze git history to extract coding patterns and generate SKILL.md files |
182
- | `/skill-health` | Show skill portfolio health dashboard with charts and analytics |
171
+ | `/ccp:eval` | Manage eval-driven development workflow |
172
+ | `/ccp:harness-audit` | Run a deterministic repository harness audit and return a scorecard |
173
+ | `/ccp:skill-create` | Analyze git history to extract coding patterns and generate SKILL.md files |
174
+ | `/ccp:skill-health` | Show skill portfolio health dashboard with charts and analytics |
183
175
 
184
176
  ### Configuration & Setup
185
177
 
186
178
  | Command | Description |
187
179
  |---------|-------------|
188
- | `/setup` | First-time project setup -- scan codebase, generate CLAUDE.md, install rules |
189
- | `/setup-refresh` | Re-scan codebase and update CLAUDE.md, rules, and architecture docs |
190
- | `/setup-pm` | Configure your preferred package manager (npm/pnpm/yarn/bun) |
191
- | `/tool-guide` | MCP tool recommendations per task type -- which tools to use when |
192
- | `/model-route` | Recommend the best model tier for the current task by complexity |
193
- | `/quality-gate` | Run the quality pipeline on demand for a file or project scope |
194
- | `/verify` | Run comprehensive verification on current codebase state |
195
- | `/learn` | Analyze current session and extract patterns worth saving as skills |
196
- | `/evolve` | Analyze instincts and suggest or generate evolved structures |
180
+ | `/ccp:setup` | First-time project setup -- scan codebase, generate CLAUDE.md, install rules |
181
+ | `/ccp:setup-refresh` | Re-scan codebase and update CLAUDE.md, rules, and architecture docs |
182
+ | `/ccp:setup-pm` | Configure your preferred package manager (npm/pnpm/yarn/bun) |
183
+ | `/ccp:tool-guide` | MCP tool recommendations per task type -- which tools to use when |
184
+ | `/ccp:model-route` | Recommend the best model tier for the current task by complexity |
185
+ | `/ccp:quality-gate` | Run the quality pipeline on demand for a file or project scope |
186
+ | `/ccp:verify` | Run comprehensive verification on current codebase state |
187
+ | `/ccp:learn` | Analyze current session and extract patterns worth saving as skills |
188
+ | `/ccp:evolve` | Analyze instincts and suggest or generate evolved structures |
197
189
 
198
190
  ### Language-Specific Workflows
199
191
 
200
192
  | Command | Description |
201
193
  |---------|-------------|
202
- | `/go-build` | Fix Go build errors, go vet warnings, and linter issues |
203
- | `/go-review` | Go code review for idiomatic patterns, concurrency, and security |
204
- | `/go-test` | TDD workflow for Go -- table-driven tests, 80%+ coverage |
205
- | `/rust-build` | Fix Rust build errors, borrow checker issues, and dependencies |
206
- | `/rust-review` | Rust code review for ownership, lifetimes, and idiomatic patterns |
207
- | `/rust-test` | TDD workflow for Rust -- tests first, 80%+ coverage with cargo-llvm-cov |
208
- | `/kotlin-build` | Fix Kotlin/Gradle build errors and dependency issues |
209
- | `/kotlin-review` | Kotlin code review for null safety, coroutines, and security |
210
- | `/kotlin-test` | TDD workflow for Kotlin -- Kotest tests, 80%+ coverage with Kover |
211
- | `/cpp-build` | Fix C++ build errors, CMake issues, and linker problems |
212
- | `/cpp-review` | C++ code review for memory safety, modern idioms, and concurrency |
213
- | `/cpp-test` | TDD workflow for C++ -- GoogleTest, coverage with gcov/lcov |
214
- | `/python-review` | Python code review for PEP 8, type hints, security, and idioms |
215
- | `/gradle-build` | Fix Gradle build errors for Android and KMP projects |
194
+ | `/ccp:go-build` | Fix Go build errors, go vet warnings, and linter issues |
195
+ | `/ccp:go-review` | Go code review for idiomatic patterns, concurrency, and security |
196
+ | `/ccp:go-test` | TDD workflow for Go -- table-driven tests, 80%+ coverage |
197
+ | `/ccp:rust-build` | Fix Rust build errors, borrow checker issues, and dependencies |
198
+ | `/ccp:rust-review` | Rust code review for ownership, lifetimes, and idiomatic patterns |
199
+ | `/ccp:rust-test` | TDD workflow for Rust -- tests first, 80%+ coverage with cargo-llvm-cov |
200
+ | `/ccp:kotlin-build` | Fix Kotlin/Gradle build errors and dependency issues |
201
+ | `/ccp:kotlin-review` | Kotlin code review for null safety, coroutines, and security |
202
+ | `/ccp:kotlin-test` | TDD workflow for Kotlin -- Kotest tests, 80%+ coverage with Kover |
203
+ | `/ccp:cpp-build` | Fix C++ build errors, CMake issues, and linker problems |
204
+ | `/ccp:cpp-review` | C++ code review for memory safety, modern idioms, and concurrency |
205
+ | `/ccp:cpp-test` | TDD workflow for C++ -- GoogleTest, coverage with gcov/lcov |
206
+ | `/ccp:python-review` | Python code review for PEP 8, type hints, security, and idioms |
207
+ | `/ccp:gradle-build` | Fix Gradle build errors for Android and KMP projects |
216
208
 
217
209
  ---
218
210
 
@@ -0,0 +1,452 @@
1
+ <purpose>
2
+ Orchestrate the full developer profiling flow: consent, session analysis (or questionnaire fallback), profile generation, result display, and artifact creation.
3
+
4
+ This workflow wires Phase 1 (session pipeline) and Phase 2 (profiling engine) into a cohesive user-facing experience. All heavy lifting is done by the LLM using its standard tools (Read, Write, Bash, Glob, Grep) and the ccp-user-profiler agent -- this workflow orchestrates the sequence, handles branching, and provides the UX.
5
+ </purpose>
6
+
7
+ <required_reading>
8
+ Read all files referenced by the invoking prompt's execution_context before starting.
9
+
10
+ Key references:
11
+ - @~/.claude/pilot/references/ui-brand.md (display patterns)
12
+ <!-- ccp-user-profiler agent and user-profiling reference are planned for a future release -->
13
+ </required_reading>
14
+
15
+ <process>
16
+
17
+ ## 1. Initialize
18
+
19
+ Parse flags from $ARGUMENTS:
20
+ - Detect `--questionnaire` flag (skip session analysis, questionnaire-only)
21
+ - Detect `--refresh` flag (rebuild profile even when one exists)
22
+
23
+ Check for existing profile:
24
+
25
+ ```bash
26
+ PROFILE_PATH="./.claude/pilot/USER-PROFILE.md"
27
+ [ -f "$PROFILE_PATH" ] && echo "EXISTS" || echo "NOT_FOUND"
28
+ ```
29
+
30
+ **If profile exists AND --refresh NOT set AND --questionnaire NOT set:**
31
+
32
+ Use AskUserQuestion:
33
+ - header: "Existing Profile"
34
+ - question: "You already have a profile. What would you like to do?"
35
+ - options:
36
+ - "View it" -- Display summary card from existing profile data, then exit
37
+ - "Refresh it" -- Continue with --refresh behavior
38
+ - "Cancel" -- Exit workflow
39
+
40
+ If "View it": Read USER-PROFILE.md, display its content formatted as a summary card, then exit.
41
+ If "Refresh it": Set --refresh behavior and continue.
42
+ If "Cancel": Display "No changes made." and exit.
43
+
44
+ **If profile exists AND --refresh IS set:**
45
+
46
+ Backup existing profile:
47
+ ```bash
48
+ cp "./.claude/pilot/USER-PROFILE.md" "./.claude/pilot/USER-PROFILE.backup.md"
49
+ ```
50
+
51
+ Display: "Re-analyzing your sessions to update your profile."
52
+ Continue to step 2.
53
+
54
+ **If no profile exists:** Continue to step 2.
55
+
56
+ ---
57
+
58
+ ## 2. Consent Gate (ACTV-06)
59
+
60
+ **Skip if** `--questionnaire` flag is set (no JSONL reading occurs -- jump directly to step 4b).
61
+
62
+ Display consent screen:
63
+
64
+ ```
65
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
66
+ CCP > PROFILE YOUR CODING STYLE
67
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
68
+
69
+ Claude starts every conversation generic. A profile teaches Claude
70
+ how YOU actually work -- not how you think you work.
71
+
72
+ ## What We'll Analyze
73
+
74
+ Your recent Claude Code sessions, looking for patterns in these
75
+ 8 behavioral dimensions:
76
+
77
+ | Dimension | What It Measures |
78
+ |----------------------|---------------------------------------------|
79
+ | Communication Style | How you phrase requests (terse vs. detailed) |
80
+ | Decision Speed | How you choose between options |
81
+ | Explanation Depth | How much explanation you want with code |
82
+ | Debugging Approach | How you tackle errors and bugs |
83
+ | UX Philosophy | How much you care about design vs. function |
84
+ | Vendor Philosophy | How you evaluate libraries and tools |
85
+ | Frustration Triggers | What makes you correct Claude |
86
+ | Learning Style | How you prefer to learn new things |
87
+
88
+ ## Data Handling
89
+
90
+ ✓ Reads session files locally (read-only, nothing modified)
91
+ ✓ Analyzes message patterns (not content meaning)
92
+ ✓ Stores profile at ./.claude/pilot/USER-PROFILE.md
93
+ ✗ Nothing is sent to external services
94
+ ✗ Sensitive content (API keys, passwords) is automatically excluded
95
+ ```
96
+
97
+ **If --refresh path:**
98
+ Show abbreviated consent instead:
99
+
100
+ ```
101
+ Re-analyzing your sessions to update your profile.
102
+ Your existing profile has been backed up to USER-PROFILE.backup.md.
103
+ ```
104
+
105
+ Use AskUserQuestion:
106
+ - header: "Refresh"
107
+ - question: "Continue with profile refresh?"
108
+ - options:
109
+ - "Continue" -- Proceed to step 3
110
+ - "Cancel" -- Exit workflow
111
+
112
+ **If default (no --refresh) path:**
113
+
114
+ Use AskUserQuestion:
115
+ - header: "Ready?"
116
+ - question: "Ready to analyze your sessions?"
117
+ - options:
118
+ - "Let's go" -- Proceed to step 3 (session analysis)
119
+ - "Use questionnaire instead" -- Jump to step 4b (questionnaire path)
120
+ - "Not now" -- Display "No worries. Run /ccp:profile-user when ready." and exit
121
+
122
+ ---
123
+
124
+ ## 3. Session Scan
125
+
126
+ Display: "◆ Scanning sessions..."
127
+
128
+ Scan for Claude Code session files:
129
+ - Check `$HOME/.claude/` and `.claude/` for session JSONL files (projects/*/sessions/*.jsonl or similar)
130
+ - Use Glob to find all *.jsonl session files
131
+ - Count sessions and group by project directory
132
+ - Report: "Found N sessions across M projects"
133
+ - If 0 sessions found: display "No sessions found. Switching to questionnaire." and jump to step 4b
134
+
135
+ Display: "✓ Found N sessions across M projects"
136
+
137
+ **Determine data sufficiency:**
138
+ - Count total messages available from the scan result (sum sessions across projects)
139
+ - If 0 sessions found: Display "No sessions found. Switching to questionnaire." and jump to step 4b
140
+ - If sessions found: Continue to step 4a
141
+
142
+ ---
143
+
144
+ ## 4a. Session Analysis Path
145
+
146
+ Display: "◆ Sampling messages..."
147
+
148
+ Sample messages from discovered session files:
149
+ - Read a representative sample of messages from the discovered JSONL files (aim for ~200 messages spread across projects)
150
+ - For each JSONL file, read lines, parse JSON, extract human/assistant message pairs
151
+ - Skip messages containing sensitive patterns (API keys, passwords, tokens)
152
+ - Write sampled messages to a temp file for analysis
153
+ - Report: "Sampled N messages from M projects"
154
+
155
+ Display: "✓ Sampled N messages from M projects"
156
+
157
+ Display: "◆ Analyzing patterns..."
158
+
159
+ <!-- TODO: ccp-user-profiler agent not yet available. The profile-user workflow currently operates without a dedicated profiler agent. -->
160
+
161
+ **Analyze patterns using Task tool:**
162
+
163
+ Use the Task tool to analyze the sampled session messages. Provide it with:
164
+ - The sampled JSONL file path from profile-sample output
165
+
166
+ The agent prompt should follow this structure:
167
+ ```
168
+ Read the sampled session messages, then analyze the developer's behavioral patterns across all 8 dimensions.
169
+
170
+ Session data: {temp_dir}/profile-sample.jsonl
171
+
172
+ Analyze these messages and return your analysis in the <analysis> JSON format.
173
+ ```
174
+
175
+ **Parse the agent's output:**
176
+ - Extract the `<analysis>` JSON block from the agent's response
177
+ - Save analysis JSON to a temp file (in the same temp directory created by profile-sample)
178
+
179
+ ```bash
180
+ ANALYSIS_PATH="{temp_dir}/analysis.json"
181
+ ```
182
+
183
+ Write the analysis JSON to `$ANALYSIS_PATH`.
184
+
185
+ Display: "✓ Analysis complete (N dimensions scored)"
186
+
187
+ **Check for thin data:**
188
+ - Read the analysis JSON and check the total message count
189
+ - If < 50 messages were analyzed: Note that a questionnaire supplement could improve accuracy. Display: "Note: Limited session data (N messages). Results may have lower confidence."
190
+
191
+ Continue to step 5.
192
+
193
+ ---
194
+
195
+ ## 4b. Questionnaire Path
196
+
197
+ Display: "Using questionnaire to build your profile."
198
+
199
+ **Get questions:**
200
+
201
+ Generate 8 behavioral dimension questions directly. For each of the 8 dimensions (Communication Style, Decision Speed, Explanation Depth, Debugging Approach, UX Philosophy, Vendor Philosophy, Frustration Triggers, Learning Style), create a question with 3-4 answer options that map to behavioral ratings.
202
+
203
+ **Present each question to the user via AskUserQuestion:**
204
+
205
+ For each question in the questions array:
206
+ - header: The dimension name (e.g., "Communication Style")
207
+ - question: The question text
208
+ - options: The answer options from the question definition
209
+
210
+ Collect all answers into an answers JSON object mapping dimension keys to selected answer values.
211
+
212
+ **Save answers to temp file:**
213
+ ```bash
214
+ ANSWERS_PATH=$(mktemp /tmp/ccp-profile-answers-XXXXXX.json)
215
+ ```
216
+
217
+ Write the answers JSON to `$ANSWERS_PATH`.
218
+
219
+ **Convert answers to analysis:**
220
+
221
+ Convert the collected answers into an analysis JSON object. Map each answer to a behavioral rating and confidence level for its dimension. Build the same analysis JSON structure as the session analysis path produces.
222
+
223
+ Save analysis JSON to a temp file:
224
+ ```bash
225
+ ANALYSIS_PATH=$(mktemp /tmp/ccp-profile-analysis-XXXXXX.json)
226
+ ```
227
+
228
+ Write the analysis JSON to `$ANALYSIS_PATH`.
229
+
230
+ Continue to step 5 (skip split resolution since questionnaire handles ambiguity internally).
231
+
232
+ ---
233
+
234
+ ## 5. Split Resolution
235
+
236
+ **Skip if** questionnaire-only path (splits already handled internally).
237
+
238
+ Read the analysis JSON from `$ANALYSIS_PATH`.
239
+
240
+ Check each dimension for `cross_project_consistent: false`.
241
+
242
+ **For each split detected:**
243
+
244
+ Use AskUserQuestion:
245
+ - header: The dimension name (e.g., "Communication Style")
246
+ - question: "Your sessions show different patterns:" followed by the split context (e.g., "CLI/backend projects -> terse-direct, Frontend/UI projects -> detailed-structured")
247
+ - options:
248
+ - Rating option A (e.g., "terse-direct")
249
+ - Rating option B (e.g., "detailed-structured")
250
+ - "Context-dependent (keep both)"
251
+
252
+ **If user picks a specific rating:** Update the dimension's `rating` field in the analysis JSON to the selected value.
253
+
254
+ **If user picks "Context-dependent":** Keep the dominant rating in the `rating` field. Add a `context_note` to the dimension's summary describing the split (e.g., "Context-dependent: terse in CLI projects, detailed in frontend projects").
255
+
256
+ Write updated analysis JSON back to `$ANALYSIS_PATH`.
257
+
258
+ ---
259
+
260
+ ## 6. Profile Write
261
+
262
+ Display: "◆ Writing profile..."
263
+
264
+ Generate USER-PROFILE.md from the analysis JSON:
265
+ - Read the analysis JSON from $ANALYSIS_PATH
266
+ - Write a structured markdown profile to ./.claude/pilot/USER-PROFILE.md containing:
267
+ - Header with generation timestamp and method (session-analysis or questionnaire)
268
+ - Table of all 8 dimensions with rating, confidence, and summary
269
+ - Evidence section for each dimension (from analysis data)
270
+ - Overall profile summary paragraph
271
+
272
+ Display: "✓ Profile written to ./.claude/pilot/USER-PROFILE.md"
273
+
274
+ ---
275
+
276
+ ## 7. Result Display
277
+
278
+ Read the analysis JSON from `$ANALYSIS_PATH` to build the display.
279
+
280
+ **Show report card table:**
281
+
282
+ ```
283
+ ## Your Profile
284
+
285
+ | Dimension | Rating | Confidence |
286
+ |----------------------|----------------------|------------|
287
+ | Communication Style | detailed-structured | HIGH |
288
+ | Decision Speed | deliberate-informed | MEDIUM |
289
+ | Explanation Depth | concise | HIGH |
290
+ | Debugging Approach | hypothesis-driven | MEDIUM |
291
+ | UX Philosophy | pragmatic | LOW |
292
+ | Vendor Philosophy | thorough-evaluator | HIGH |
293
+ | Frustration Triggers | scope-creep | MEDIUM |
294
+ | Learning Style | self-directed | HIGH |
295
+ ```
296
+
297
+ (Populate with actual values from the analysis JSON.)
298
+
299
+ **Show highlight reel:**
300
+
301
+ Pick 3-4 dimensions with the highest confidence and most evidence signals. Format as:
302
+
303
+ ```
304
+ ## Highlights
305
+
306
+ - **Communication (HIGH):** You consistently provide structured context with
307
+ headers and problem statements before making requests
308
+ - **Vendor Choices (HIGH):** You research alternatives thoroughly -- comparing
309
+ docs, GitHub activity, and bundle sizes before committing
310
+ - **Frustrations (MEDIUM):** You correct Claude most often for doing things
311
+ you didn't ask for -- scope creep is your primary trigger
312
+ ```
313
+
314
+ Build highlights from the `evidence` array and `summary` fields in the analysis JSON. Use the most compelling evidence quotes. Format each as "You tend to..." or "You consistently..." with evidence attribution.
315
+
316
+ **Offer full profile view:**
317
+
318
+ Use AskUserQuestion:
319
+ - header: "Profile"
320
+ - question: "Want to see the full profile?"
321
+ - options:
322
+ - "Yes" -- Read and display the full USER-PROFILE.md content, then continue to step 8
323
+ - "Continue to artifacts" -- Proceed directly to step 8
324
+
325
+ ---
326
+
327
+ ## 8. Artifact Selection (ACTV-05)
328
+
329
+ Use AskUserQuestion with multiSelect:
330
+ - header: "Artifacts"
331
+ - question: "Which artifacts should I generate?"
332
+ - options (ALL pre-selected by default):
333
+ - "/ccp:dev-preferences command file" -- "Load your preferences in any session"
334
+ - "CLAUDE.md profile section" -- "Add profile to this project's CLAUDE.md"
335
+ - "Global CLAUDE.md" -- "Add profile to $HOME/.claude/CLAUDE.md for all projects"
336
+
337
+ **If no artifacts selected:** Display "No artifacts generated. Your profile is saved at ./.claude/pilot/USER-PROFILE.md" and jump to step 10.
338
+
339
+ ---
340
+
341
+ ## 9. Artifact Generation
342
+
343
+ Generate selected artifacts sequentially (file I/O is fast, no benefit from parallel agents):
344
+
345
+ **For /ccp:dev-preferences (if selected):**
346
+
347
+ Generate a /ccp:dev-preferences command file:
348
+ - Read the analysis JSON from $ANALYSIS_PATH
349
+ - Create ./.claude/commands/ccp/dev-preferences.md with frontmatter (name, description) and a structured prompt that loads the user's behavioral preferences into Claude's context
350
+ - The command content should describe the user's communication preferences, explanation depth preference, debugging style, etc. derived from the profile dimensions
351
+
352
+ Display: "✓ Generated /ccp:dev-preferences at ./.claude/commands/ccp/dev-preferences.md"
353
+
354
+ **For CLAUDE.md profile section (if selected):**
355
+
356
+ Generate a CLAUDE.md profile section:
357
+ - Read the analysis JSON from $ANALYSIS_PATH
358
+ - Read the existing ./CLAUDE.md file
359
+ - Append (or update) a "## Developer Profile" section with a concise summary of the user's behavioral dimensions
360
+ - Write the updated CLAUDE.md back
361
+
362
+ Display: "✓ Added profile section to CLAUDE.md"
363
+
364
+ **For Global CLAUDE.md (if selected):**
365
+
366
+ Generate a global CLAUDE.md profile section:
367
+ - Read the analysis JSON from $ANALYSIS_PATH
368
+ - Read $HOME/.claude/CLAUDE.md (create if it does not exist)
369
+ - Append (or update) a "## Developer Profile" section
370
+ - Write the updated file back
371
+
372
+ Display: "✓ Added profile section to $HOME/.claude/CLAUDE.md"
373
+
374
+ **Error handling:** If any step fails, display the error message and use AskUserQuestion to offer "Retry" or "Skip this artifact". On retry, re-run the step. On skip, continue to next artifact.
375
+
376
+ ---
377
+
378
+ ## 10. Summary & Refresh Diff
379
+
380
+ **If --refresh path:**
381
+
382
+ Read both old backup and new analysis to compare dimension ratings/confidence.
383
+
384
+ Read the backed-up profile:
385
+ ```bash
386
+ BACKUP_PATH="./.claude/pilot/USER-PROFILE.backup.md"
387
+ ```
388
+
389
+ Compare each dimension's rating and confidence between old and new. Display diff table showing only changed dimensions:
390
+
391
+ ```
392
+ ## Changes
393
+
394
+ | Dimension | Before | After |
395
+ |-----------------|-----------------------------|-----------------------------|
396
+ | Communication | terse-direct (LOW) | detailed-structured (HIGH) |
397
+ | Debugging | fix-first (MEDIUM) | hypothesis-driven (MEDIUM) |
398
+ ```
399
+
400
+ If nothing changed: Display "No changes detected -- your profile is already up to date."
401
+
402
+ **Display final summary:**
403
+
404
+ ```
405
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
406
+ CCP > PROFILE COMPLETE ✓
407
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
408
+
409
+ Your profile: ./.claude/pilot/USER-PROFILE.md
410
+ ```
411
+
412
+ Then list paths for each generated artifact:
413
+ ```
414
+ Artifacts:
415
+ ✓ /ccp:dev-preferences ./.claude/commands/ccp/dev-preferences.md
416
+ ✓ CLAUDE.md section ./CLAUDE.md
417
+ ✓ Global CLAUDE.md $HOME/.claude/CLAUDE.md
418
+ ```
419
+
420
+ (Only show artifacts that were actually generated.)
421
+
422
+ **Clean up temp files:**
423
+
424
+ Remove the temp directory created by profile-sample (contains sample JSONL and analysis JSON):
425
+ ```bash
426
+ rm -rf "$TEMP_DIR"
427
+ ```
428
+
429
+ Also remove any standalone temp files created for questionnaire answers:
430
+ ```bash
431
+ rm -f "$ANSWERS_PATH" 2>/dev/null
432
+ rm -f "$ANALYSIS_PATH" 2>/dev/null
433
+ ```
434
+
435
+ (Only clean up temp paths that were actually created during this workflow run.)
436
+
437
+ </process>
438
+
439
+ <success_criteria>
440
+ - [ ] Initialization detects existing profile and handles all three responses (view/refresh/cancel)
441
+ - [ ] Consent gate shown for session analysis path, skipped for questionnaire path
442
+ - [ ] Session scan discovers sessions and reports statistics
443
+ - [ ] Session analysis path: samples messages, spawns profiler agent, extracts analysis JSON
444
+ - [ ] Questionnaire path: presents 8 questions, collects answers, converts to analysis JSON
445
+ - [ ] Split resolution presents context-dependent splits with user resolution options
446
+ - [ ] Profile written to USER-PROFILE.md via write-profile subcommand
447
+ - [ ] Result display shows report card table and highlight reel with evidence
448
+ - [ ] Artifact selection uses multiSelect with all options pre-selected
449
+ - [ ] Artifacts generated sequentially via LLM-driven file operations
450
+ - [ ] Refresh diff shows changed dimensions when --refresh was used
451
+ - [ ] Temp files cleaned up on completion
452
+ </success_criteria>