claude-code-workflow 6.1.4 → 6.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (437) hide show
  1. package/.claude/CLAUDE.md +10 -0
  2. package/.claude/agents/action-planning-agent.md +857 -778
  3. package/.claude/agents/cli-execution-agent.md +266 -269
  4. package/.claude/agents/cli-explore-agent.md +2 -2
  5. package/.claude/agents/cli-lite-planning-agent.md +142 -92
  6. package/.claude/agents/cli-planning-agent.md +4 -4
  7. package/.claude/agents/code-developer.md +7 -6
  8. package/.claude/agents/conceptual-planning-agent.md +2 -2
  9. package/.claude/agents/context-search-agent.md +31 -32
  10. package/.claude/agents/doc-generator.md +4 -4
  11. package/.claude/agents/memory-bridge.md +93 -93
  12. package/.claude/agents/test-context-search-agent.md +8 -7
  13. package/.claude/agents/test-fix-agent.md +7 -6
  14. package/.claude/commands/clean.md +516 -0
  15. package/.claude/commands/memory/compact.md +383 -0
  16. package/.claude/commands/memory/docs-full-cli.md +471 -471
  17. package/.claude/commands/memory/docs-related-cli.md +386 -386
  18. package/.claude/commands/memory/docs.md +615 -615
  19. package/.claude/commands/memory/load.md +5 -5
  20. package/.claude/commands/memory/tech-research-rules.md +310 -0
  21. package/.claude/commands/memory/update-full.md +332 -332
  22. package/.claude/commands/memory/workflow-skill-memory.md +4 -4
  23. package/.claude/commands/task/create.md +151 -151
  24. package/.claude/commands/version.md +254 -254
  25. package/.claude/commands/workflow/brainstorm/api-designer.md +587 -585
  26. package/.claude/commands/workflow/brainstorm/artifacts.md +1 -0
  27. package/.claude/commands/workflow/brainstorm/auto-parallel.md +443 -443
  28. package/.claude/commands/workflow/brainstorm/data-architect.md +220 -220
  29. package/.claude/commands/workflow/brainstorm/product-manager.md +200 -200
  30. package/.claude/commands/workflow/brainstorm/product-owner.md +200 -200
  31. package/.claude/commands/workflow/brainstorm/scrum-master.md +200 -200
  32. package/.claude/commands/workflow/brainstorm/subject-matter-expert.md +200 -200
  33. package/.claude/commands/workflow/brainstorm/system-architect.md +389 -387
  34. package/.claude/commands/workflow/brainstorm/ui-designer.md +221 -221
  35. package/.claude/commands/workflow/brainstorm/ux-expert.md +221 -221
  36. package/.claude/commands/workflow/debug.md +321 -0
  37. package/.claude/commands/workflow/execute.md +13 -0
  38. package/.claude/commands/workflow/init.md +165 -164
  39. package/.claude/commands/workflow/lite-execute.md +119 -13
  40. package/.claude/commands/workflow/lite-fix.md +623 -621
  41. package/.claude/commands/workflow/lite-plan.md +610 -592
  42. package/.claude/commands/workflow/plan.md +5 -5
  43. package/.claude/commands/workflow/review-module-cycle.md +2 -0
  44. package/.claude/commands/workflow/review-session-cycle.md +2 -0
  45. package/.claude/commands/workflow/review.md +297 -291
  46. package/.claude/commands/workflow/session/complete.md +153 -500
  47. package/.claude/commands/workflow/session/list.md +95 -95
  48. package/.claude/commands/workflow/session/resume.md +60 -60
  49. package/.claude/commands/workflow/session/start.md +199 -199
  50. package/.claude/commands/workflow/tdd-plan.md +3 -3
  51. package/.claude/commands/workflow/tdd-verify.md +23 -9
  52. package/.claude/commands/workflow/test-cycle-execute.md +2 -0
  53. package/.claude/commands/workflow/test-fix-gen.md +699 -699
  54. package/.claude/commands/workflow/tools/conflict-resolution.md +104 -18
  55. package/.claude/commands/workflow/tools/context-gather.md +436 -434
  56. package/.claude/commands/workflow/tools/task-generate-agent.md +490 -291
  57. package/.claude/commands/workflow/tools/task-generate-tdd.md +18 -10
  58. package/.claude/commands/workflow/tools/test-concept-enhanced.md +2 -1
  59. package/.claude/commands/workflow/tools/test-context-gather.md +1 -0
  60. package/.claude/commands/workflow/tools/test-task-generate.md +1 -0
  61. package/.claude/commands/workflow/ui-design/import-from-code.md +9 -6
  62. package/.claude/skills/command-guide/SKILL.md +5 -5
  63. package/.claude/skills/command-guide/index/all-commands.json +1 -1
  64. package/.claude/skills/command-guide/index/by-category.json +1 -1
  65. package/.claude/skills/command-guide/index/by-use-case.json +1 -1
  66. package/.claude/skills/command-guide/reference/agents/action-planning-agent.md +857 -778
  67. package/.claude/skills/command-guide/reference/agents/cli-execution-agent.md +266 -269
  68. package/.claude/skills/command-guide/reference/agents/cli-explore-agent.md +2 -2
  69. package/.claude/skills/command-guide/reference/agents/cli-lite-planning-agent.md +142 -92
  70. package/.claude/skills/command-guide/reference/agents/cli-planning-agent.md +4 -4
  71. package/.claude/skills/command-guide/reference/agents/code-developer.md +7 -6
  72. package/.claude/skills/command-guide/reference/agents/conceptual-planning-agent.md +2 -2
  73. package/.claude/skills/command-guide/reference/agents/context-search-agent.md +31 -32
  74. package/.claude/skills/command-guide/reference/agents/doc-generator.md +4 -4
  75. package/.claude/skills/command-guide/reference/agents/memory-bridge.md +93 -93
  76. package/.claude/skills/command-guide/reference/agents/test-context-search-agent.md +8 -7
  77. package/.claude/skills/command-guide/reference/agents/test-fix-agent.md +7 -6
  78. package/.claude/skills/command-guide/reference/commands/memory/docs-full-cli.md +471 -471
  79. package/.claude/skills/command-guide/reference/commands/memory/docs-related-cli.md +386 -386
  80. package/.claude/skills/command-guide/reference/commands/memory/docs.md +17 -16
  81. package/.claude/skills/command-guide/reference/commands/memory/load.md +5 -5
  82. package/.claude/skills/command-guide/reference/commands/memory/tech-research.md +194 -357
  83. package/.claude/skills/command-guide/reference/commands/memory/update-full.md +332 -332
  84. package/.claude/skills/command-guide/reference/commands/memory/workflow-skill-memory.md +4 -4
  85. package/.claude/skills/command-guide/reference/commands/task/create.md +151 -151
  86. package/.claude/skills/command-guide/reference/commands/version.md +254 -254
  87. package/.claude/skills/command-guide/reference/commands/workflow/brainstorm/api-designer.md +585 -585
  88. package/.claude/skills/command-guide/reference/commands/workflow/brainstorm/auto-parallel.md +443 -443
  89. package/.claude/skills/command-guide/reference/commands/workflow/brainstorm/data-architect.md +220 -220
  90. package/.claude/skills/command-guide/reference/commands/workflow/brainstorm/product-manager.md +200 -200
  91. package/.claude/skills/command-guide/reference/commands/workflow/brainstorm/product-owner.md +200 -200
  92. package/.claude/skills/command-guide/reference/commands/workflow/brainstorm/scrum-master.md +200 -200
  93. package/.claude/skills/command-guide/reference/commands/workflow/brainstorm/subject-matter-expert.md +200 -200
  94. package/.claude/skills/command-guide/reference/commands/workflow/brainstorm/system-architect.md +387 -387
  95. package/.claude/skills/command-guide/reference/commands/workflow/brainstorm/ui-designer.md +221 -221
  96. package/.claude/skills/command-guide/reference/commands/workflow/brainstorm/ux-expert.md +221 -221
  97. package/.claude/skills/command-guide/reference/commands/workflow/execute.md +25 -20
  98. package/.claude/skills/command-guide/reference/commands/workflow/init.md +164 -164
  99. package/.claude/skills/command-guide/reference/commands/workflow/lite-execute.md +748 -686
  100. package/.claude/skills/command-guide/reference/commands/workflow/lite-fix.md +664 -621
  101. package/.claude/skills/command-guide/reference/commands/workflow/lite-plan.md +645 -592
  102. package/.claude/skills/command-guide/reference/commands/workflow/plan.md +5 -5
  103. package/.claude/skills/command-guide/reference/commands/workflow/review.md +25 -18
  104. package/.claude/skills/command-guide/reference/commands/workflow/session/complete.md +547 -500
  105. package/.claude/skills/command-guide/reference/commands/workflow/session/list.md +45 -27
  106. package/.claude/skills/command-guide/reference/commands/workflow/session/resume.md +35 -19
  107. package/.claude/skills/command-guide/reference/commands/workflow/session/start.md +90 -33
  108. package/.claude/skills/command-guide/reference/commands/workflow/tdd-plan.md +3 -3
  109. package/.claude/skills/command-guide/reference/commands/workflow/tdd-verify.md +23 -9
  110. package/.claude/skills/command-guide/reference/commands/workflow/test-fix-gen.md +699 -699
  111. package/.claude/skills/command-guide/reference/commands/workflow/tools/conflict-resolution.md +103 -17
  112. package/.claude/skills/command-guide/reference/commands/workflow/tools/context-gather.md +434 -434
  113. package/.claude/skills/command-guide/reference/commands/workflow/tools/task-generate-agent.md +487 -291
  114. package/.claude/skills/command-guide/reference/commands/workflow/tools/task-generate-tdd.md +17 -10
  115. package/.claude/skills/command-guide/reference/commands/workflow/tools/test-concept-enhanced.md +1 -1
  116. package/.claude/skills/command-guide/reference/commands/workflow/ui-design/import-from-code.md +6 -6
  117. package/.claude/workflows/chinese-response.md +38 -0
  118. package/.claude/workflows/cli-templates/prompts/rules/rule-api.txt +122 -0
  119. package/.claude/workflows/cli-templates/prompts/rules/rule-components.txt +122 -0
  120. package/.claude/workflows/cli-templates/prompts/rules/rule-config.txt +89 -0
  121. package/.claude/workflows/cli-templates/prompts/rules/rule-core.txt +60 -0
  122. package/.claude/workflows/cli-templates/prompts/rules/rule-patterns.txt +70 -0
  123. package/.claude/workflows/cli-templates/prompts/rules/rule-testing.txt +81 -0
  124. package/.claude/workflows/cli-templates/prompts/rules/tech-rules-agent-prompt.txt +89 -0
  125. package/.claude/workflows/cli-templates/prompts/workflow/gemini-solution-design.txt +131 -131
  126. package/.claude/workflows/cli-templates/prompts/workflow/skill-conflict-patterns.txt +5 -9
  127. package/.claude/workflows/cli-templates/prompts/workflow/skill-lessons-learned.txt +5 -9
  128. package/.claude/workflows/cli-templates/protocols/analysis-protocol.md +112 -0
  129. package/.claude/workflows/cli-templates/protocols/write-protocol.md +201 -0
  130. package/.claude/workflows/cli-templates/schemas/conflict-resolution-schema.json +137 -0
  131. package/.claude/workflows/cli-templates/schemas/debug-log-json-schema.json +127 -0
  132. package/.claude/workflows/cli-templates/schemas/fix-plan-json-schema.json +25 -0
  133. package/.claude/workflows/cli-templates/schemas/plan-json-schema.json +25 -0
  134. package/.claude/workflows/cli-tools-usage.md +526 -0
  135. package/{CLAUDE.md → .claude/workflows/coding-philosophy.md} +24 -45
  136. package/.claude/workflows/context-tools.md +84 -0
  137. package/.claude/workflows/file-modification.md +64 -0
  138. package/.claude/workflows/tool-strategy.md +216 -79
  139. package/.claude/workflows/windows-platform.md +16 -0
  140. package/.claude/workflows/workflow-architecture.md +942 -942
  141. package/.codex/AGENTS.md +63 -330
  142. package/.codex/prompts/debug.md +318 -0
  143. package/.codex/prompts/execute.md +273 -0
  144. package/.codex/prompts/lite-execute.md +164 -0
  145. package/.codex/prompts/lite-plan.md +469 -0
  146. package/.codex/prompts.zip +0 -0
  147. package/.gemini/GEMINI.md +25 -164
  148. package/.qwen/QWEN.md +0 -139
  149. package/README.md +29 -9
  150. package/ccw/README.md +30 -6
  151. package/ccw/bin/ccw-mcp.js +7 -0
  152. package/ccw/bin/ccw.js +9 -9
  153. package/ccw/package.json +65 -47
  154. package/ccw/src/.workflow/.cli-history/history.db +0 -0
  155. package/ccw/src/.workflow/.cli-history/history.db-shm +0 -0
  156. package/ccw/src/.workflow/.cli-history/history.db-wal +0 -0
  157. package/ccw/src/cli.ts +244 -0
  158. package/ccw/src/commands/cli.ts +740 -0
  159. package/ccw/src/commands/core-memory.ts +770 -0
  160. package/ccw/src/commands/hook.ts +315 -0
  161. package/ccw/src/commands/install.ts +519 -0
  162. package/ccw/src/commands/{list.js → list.ts} +1 -1
  163. package/ccw/src/commands/memory.ts +1090 -0
  164. package/ccw/src/commands/{serve.js → serve.ts} +14 -5
  165. package/ccw/src/commands/session-path-resolver.ts +372 -0
  166. package/ccw/src/commands/session.ts +1141 -0
  167. package/ccw/src/commands/{stop.js → stop.ts} +16 -6
  168. package/ccw/src/commands/tool.ts +201 -0
  169. package/ccw/src/commands/{uninstall.js → uninstall.ts} +89 -40
  170. package/ccw/src/commands/{upgrade.js → upgrade.ts} +68 -23
  171. package/ccw/src/commands/{view.js → view.ts} +22 -8
  172. package/ccw/src/config/storage-paths.ts +670 -0
  173. package/ccw/src/core/cache-manager.ts +294 -0
  174. package/ccw/src/core/claude-freshness.ts +319 -0
  175. package/ccw/src/core/core-memory-store.ts +1528 -0
  176. package/ccw/src/core/{dashboard-generator-patch.js → dashboard-generator-patch.ts} +18 -0
  177. package/ccw/src/core/{dashboard-generator.js → dashboard-generator.ts} +69 -12
  178. package/ccw/src/core/data-aggregator.ts +584 -0
  179. package/ccw/src/core/history-importer.ts +625 -0
  180. package/ccw/src/core/{lite-scanner.js → lite-scanner-complete.ts} +162 -66
  181. package/ccw/src/core/lite-scanner.ts +469 -0
  182. package/ccw/src/core/{manifest.js → manifest.ts} +104 -34
  183. package/ccw/src/core/memory-embedder-bridge.ts +262 -0
  184. package/ccw/src/core/memory-store.ts +978 -0
  185. package/ccw/src/core/routes/ccw-routes.ts +96 -0
  186. package/ccw/src/core/routes/claude-routes.ts +1183 -0
  187. package/ccw/src/core/routes/cli-routes.ts +561 -0
  188. package/ccw/src/core/routes/codexlens-routes.ts +806 -0
  189. package/ccw/src/core/routes/core-memory-routes.ts +605 -0
  190. package/ccw/src/core/routes/files-routes.ts +428 -0
  191. package/ccw/src/core/routes/graph-routes.md +164 -0
  192. package/ccw/src/core/routes/graph-routes.ts +626 -0
  193. package/ccw/src/core/routes/help-routes.ts +308 -0
  194. package/ccw/src/core/routes/hooks-routes.ts +405 -0
  195. package/ccw/src/core/routes/mcp-routes.ts +1271 -0
  196. package/ccw/src/core/routes/mcp-routes.ts.backup +550 -0
  197. package/ccw/src/core/routes/mcp-templates-db.ts +268 -0
  198. package/ccw/src/core/routes/memory-routes.ts +1206 -0
  199. package/ccw/src/core/routes/rules-routes.ts +526 -0
  200. package/ccw/src/core/routes/session-routes.ts +467 -0
  201. package/ccw/src/core/routes/skills-routes.ts +599 -0
  202. package/ccw/src/core/routes/status-routes.ts +57 -0
  203. package/ccw/src/core/routes/system-routes.ts +427 -0
  204. package/ccw/src/core/server.ts +431 -0
  205. package/ccw/src/core/session-clustering-service.ts +1258 -0
  206. package/ccw/src/core/session-scanner.ts +283 -0
  207. package/ccw/src/core/websocket.ts +190 -0
  208. package/ccw/src/{index.js → index.ts} +1 -0
  209. package/ccw/src/mcp-server/index.ts +186 -0
  210. package/ccw/src/templates/assets/css/github-dark.min.css +10 -0
  211. package/ccw/src/templates/assets/css/github.min.css +10 -0
  212. package/ccw/src/templates/assets/js/cytoscape.min.js +32 -0
  213. package/ccw/src/templates/assets/js/d3.min.js +2 -0
  214. package/ccw/src/templates/assets/js/highlight.min.js +1244 -0
  215. package/ccw/src/templates/assets/js/lucide.min.js +12 -0
  216. package/ccw/src/templates/assets/js/marked.min.js +69 -0
  217. package/ccw/src/templates/assets/js/tailwind.js +83 -0
  218. package/ccw/src/templates/dashboard-css/01-base.css +11 -0
  219. package/ccw/src/templates/dashboard-css/02-session.css +22 -0
  220. package/ccw/src/templates/dashboard-css/04-lite-tasks.css +10 -0
  221. package/ccw/src/templates/dashboard-css/06-cards.css +10 -4
  222. package/ccw/src/templates/dashboard-css/07-managers.css +1178 -7
  223. package/ccw/src/templates/dashboard-css/09-explorer.css +23 -12
  224. package/ccw/src/templates/dashboard-css/10-cli-status.css +337 -0
  225. package/ccw/src/templates/dashboard-css/11-cli-history.css +271 -0
  226. package/ccw/src/templates/dashboard-css/12-cli-legacy.css +796 -0
  227. package/ccw/src/templates/dashboard-css/13-cli-ccw.css +199 -0
  228. package/ccw/src/templates/dashboard-css/14-cli-modals.css +258 -0
  229. package/ccw/src/templates/dashboard-css/15-cli-endpoints.css +305 -0
  230. package/ccw/src/templates/dashboard-css/16-cli-session.css +241 -0
  231. package/ccw/src/templates/dashboard-css/17-cli-conversation.css +283 -0
  232. package/ccw/src/templates/dashboard-css/18-cli-settings.css +160 -0
  233. package/ccw/src/templates/dashboard-css/19-cli-native-session.css +496 -0
  234. package/ccw/src/templates/dashboard-css/20-cli-taskqueue.css +188 -0
  235. package/ccw/src/templates/dashboard-css/21-cli-toolmgmt.css +310 -0
  236. package/ccw/src/templates/dashboard-css/22-cli-semantic.css +240 -0
  237. package/ccw/src/templates/dashboard-css/23-memory.css +2390 -0
  238. package/ccw/src/templates/dashboard-css/24-prompt-history.css +1089 -0
  239. package/ccw/src/templates/dashboard-css/25-skills-rules.css +326 -0
  240. package/ccw/src/templates/dashboard-css/26-claude-manager.css +908 -0
  241. package/ccw/src/templates/dashboard-css/27-graph-explorer.css +1678 -0
  242. package/ccw/src/templates/dashboard-css/28-mcp-manager.css +748 -0
  243. package/ccw/src/templates/dashboard-css/29-help.css +264 -0
  244. package/ccw/src/templates/dashboard-css/30-core-memory.css +1700 -0
  245. package/ccw/src/templates/dashboard-js/api.js +162 -142
  246. package/ccw/src/templates/dashboard-js/components/carousel.js +4 -4
  247. package/ccw/src/templates/dashboard-js/components/cli-history.js +876 -0
  248. package/ccw/src/templates/dashboard-js/components/cli-status.js +978 -0
  249. package/ccw/src/templates/dashboard-js/components/global-notifications.js +508 -219
  250. package/ccw/src/templates/dashboard-js/components/hook-manager.js +1277 -282
  251. package/ccw/src/templates/dashboard-js/components/index-manager.js +302 -0
  252. package/ccw/src/templates/dashboard-js/components/mcp-manager.js +718 -27
  253. package/ccw/src/templates/dashboard-js/components/modals.js +66 -0
  254. package/ccw/src/templates/dashboard-js/components/navigation.js +80 -12
  255. package/ccw/src/templates/dashboard-js/components/notifications.js +758 -194
  256. package/ccw/src/templates/dashboard-js/components/storage-manager.js +478 -0
  257. package/ccw/src/templates/dashboard-js/components/tabs-other.js +157 -6
  258. package/ccw/src/templates/dashboard-js/components/task-queue-sidebar.js +716 -0
  259. package/ccw/src/templates/dashboard-js/help-i18n.js +272 -0
  260. package/ccw/src/templates/dashboard-js/i18n.js +2807 -0
  261. package/ccw/src/templates/dashboard-js/main.js +15 -0
  262. package/ccw/src/templates/dashboard-js/state.js +243 -42
  263. package/ccw/src/templates/dashboard-js/utils.js +47 -1
  264. package/ccw/src/templates/dashboard-js/views/claude-manager.js +912 -0
  265. package/ccw/src/templates/dashboard-js/views/cli-manager.js +2272 -0
  266. package/ccw/src/templates/dashboard-js/views/codexlens-manager.js +964 -0
  267. package/ccw/src/templates/dashboard-js/views/core-memory-clusters.js +503 -0
  268. package/ccw/src/templates/dashboard-js/views/core-memory.js +782 -0
  269. package/ccw/src/templates/dashboard-js/views/explorer.js +888 -852
  270. package/ccw/src/templates/dashboard-js/views/graph-explorer.js +1157 -0
  271. package/ccw/src/templates/dashboard-js/views/help.js +856 -0
  272. package/ccw/src/templates/dashboard-js/views/history.js +337 -0
  273. package/ccw/src/templates/dashboard-js/views/home.js +61 -15
  274. package/ccw/src/templates/dashboard-js/views/hook-manager.js +311 -43
  275. package/ccw/src/templates/dashboard-js/views/lite-tasks.js +204 -28
  276. package/ccw/src/templates/dashboard-js/views/mcp-manager.js +2187 -411
  277. package/ccw/src/templates/dashboard-js/views/mcp-manager.js.backup +1729 -0
  278. package/ccw/src/templates/dashboard-js/views/mcp-manager.js.new +928 -0
  279. package/ccw/src/templates/dashboard-js/views/memory.js +1221 -0
  280. package/ccw/src/templates/dashboard-js/views/prompt-history.js +713 -0
  281. package/ccw/src/templates/dashboard-js/views/rules-manager.js +828 -0
  282. package/ccw/src/templates/dashboard-js/views/session-detail.js +54 -53
  283. package/ccw/src/templates/dashboard-js/views/skills-manager.js +819 -0
  284. package/ccw/src/templates/dashboard.html +185 -85
  285. package/ccw/src/templates/hooks-config-example.json +60 -0
  286. package/ccw/src/tools/classify-folders.ts +245 -0
  287. package/ccw/src/tools/cli-config-manager.ts +268 -0
  288. package/ccw/src/tools/cli-executor.ts +2014 -0
  289. package/ccw/src/tools/cli-history-store.ts +1195 -0
  290. package/ccw/src/tools/codex-lens.ts +1141 -0
  291. package/ccw/src/tools/{convert-tokens-to-css.js → convert-tokens-to-css.ts} +73 -23
  292. package/ccw/src/tools/core-memory.ts +444 -0
  293. package/ccw/src/tools/detect-changed-modules.ts +325 -0
  294. package/ccw/src/tools/{discover-design-files.js → discover-design-files.ts} +74 -24
  295. package/ccw/src/tools/edit-file.ts +568 -0
  296. package/ccw/src/tools/{generate-module-docs.js → generate-module-docs.ts} +207 -185
  297. package/ccw/src/tools/{get-modules-by-depth.js → get-modules-by-depth.ts} +120 -79
  298. package/ccw/src/tools/index.ts +370 -0
  299. package/ccw/src/tools/native-session-discovery.ts +795 -0
  300. package/ccw/src/tools/notifier.ts +129 -0
  301. package/ccw/src/tools/read-file.ts +410 -0
  302. package/ccw/src/tools/resume-strategy.ts +345 -0
  303. package/ccw/src/tools/session-content-parser.ts +619 -0
  304. package/ccw/src/tools/session-manager.ts +1026 -0
  305. package/ccw/src/tools/smart-context.ts +228 -0
  306. package/ccw/src/tools/smart-search.ts +2065 -0
  307. package/ccw/src/tools/smart-search.ts.backup +1233 -0
  308. package/ccw/src/tools/storage-manager.ts +455 -0
  309. package/ccw/src/tools/write-file.ts +222 -0
  310. package/ccw/src/types/config.ts +11 -0
  311. package/ccw/src/types/index.ts +3 -0
  312. package/ccw/src/types/session.ts +25 -0
  313. package/ccw/src/types/tool.ts +41 -0
  314. package/ccw/src/utils/{browser-launcher.js → browser-launcher.ts} +10 -8
  315. package/ccw/src/utils/file-utils.ts +48 -0
  316. package/ccw/src/utils/{path-resolver.js → path-resolver.ts} +114 -78
  317. package/ccw/src/utils/path-validator.ts +153 -0
  318. package/ccw/src/utils/{ui.js → ui.ts} +32 -25
  319. package/codex-lens/pyproject.toml +48 -0
  320. package/codex-lens/src/codexlens/.workflow/.cli-history/history.db +0 -0
  321. package/codex-lens/src/codexlens/__init__.py +28 -0
  322. package/codex-lens/src/codexlens/__main__.py +14 -0
  323. package/codex-lens/src/codexlens/__pycache__/__init__.cpython-313.pyc +0 -0
  324. package/codex-lens/src/codexlens/__pycache__/__main__.cpython-313.pyc +0 -0
  325. package/codex-lens/src/codexlens/__pycache__/config.cpython-313.pyc +0 -0
  326. package/codex-lens/src/codexlens/__pycache__/entities.cpython-313.pyc +0 -0
  327. package/codex-lens/src/codexlens/__pycache__/errors.cpython-313.pyc +0 -0
  328. package/codex-lens/src/codexlens/cli/__init__.py +27 -0
  329. package/codex-lens/src/codexlens/cli/__pycache__/__init__.cpython-313.pyc +0 -0
  330. package/codex-lens/src/codexlens/cli/__pycache__/commands.cpython-313.pyc +0 -0
  331. package/codex-lens/src/codexlens/cli/__pycache__/embedding_manager.cpython-313.pyc +0 -0
  332. package/codex-lens/src/codexlens/cli/__pycache__/model_manager.cpython-313.pyc +0 -0
  333. package/codex-lens/src/codexlens/cli/__pycache__/output.cpython-313.pyc +0 -0
  334. package/codex-lens/src/codexlens/cli/commands.py +1931 -0
  335. package/codex-lens/src/codexlens/cli/embedding_manager.py +620 -0
  336. package/codex-lens/src/codexlens/cli/model_manager.py +289 -0
  337. package/codex-lens/src/codexlens/cli/output.py +124 -0
  338. package/codex-lens/src/codexlens/config.py +201 -0
  339. package/codex-lens/src/codexlens/entities.py +121 -0
  340. package/codex-lens/src/codexlens/errors.py +55 -0
  341. package/codex-lens/src/codexlens/indexing/README.md +77 -0
  342. package/codex-lens/src/codexlens/indexing/__init__.py +4 -0
  343. package/codex-lens/src/codexlens/indexing/__pycache__/__init__.cpython-313.pyc +0 -0
  344. package/codex-lens/src/codexlens/indexing/__pycache__/symbol_extractor.cpython-313.pyc +0 -0
  345. package/codex-lens/src/codexlens/indexing/symbol_extractor.py +243 -0
  346. package/codex-lens/src/codexlens/parsers/__init__.py +8 -0
  347. package/codex-lens/src/codexlens/parsers/__pycache__/__init__.cpython-313.pyc +0 -0
  348. package/codex-lens/src/codexlens/parsers/__pycache__/encoding.cpython-313.pyc +0 -0
  349. package/codex-lens/src/codexlens/parsers/__pycache__/factory.cpython-313.pyc +0 -0
  350. package/codex-lens/src/codexlens/parsers/__pycache__/tokenizer.cpython-313.pyc +0 -0
  351. package/codex-lens/src/codexlens/parsers/__pycache__/treesitter_parser.cpython-313.pyc +0 -0
  352. package/codex-lens/src/codexlens/parsers/encoding.py +202 -0
  353. package/codex-lens/src/codexlens/parsers/factory.py +256 -0
  354. package/codex-lens/src/codexlens/parsers/tokenizer.py +98 -0
  355. package/codex-lens/src/codexlens/parsers/treesitter_parser.py +335 -0
  356. package/codex-lens/src/codexlens/search/__init__.py +15 -0
  357. package/codex-lens/src/codexlens/search/__pycache__/__init__.cpython-313.pyc +0 -0
  358. package/codex-lens/src/codexlens/search/__pycache__/chain_search.cpython-313.pyc +0 -0
  359. package/codex-lens/src/codexlens/search/__pycache__/enrichment.cpython-313.pyc +0 -0
  360. package/codex-lens/src/codexlens/search/__pycache__/hybrid_search.cpython-313.pyc +0 -0
  361. package/codex-lens/src/codexlens/search/__pycache__/query_parser.cpython-313.pyc +0 -0
  362. package/codex-lens/src/codexlens/search/__pycache__/ranking.cpython-313.pyc +0 -0
  363. package/codex-lens/src/codexlens/search/chain_search.py +647 -0
  364. package/codex-lens/src/codexlens/search/enrichment.py +150 -0
  365. package/codex-lens/src/codexlens/search/hybrid_search.py +313 -0
  366. package/codex-lens/src/codexlens/search/query_parser.py +242 -0
  367. package/codex-lens/src/codexlens/search/ranking.py +274 -0
  368. package/codex-lens/src/codexlens/semantic/__init__.py +39 -0
  369. package/codex-lens/src/codexlens/semantic/__pycache__/__init__.cpython-313.pyc +0 -0
  370. package/codex-lens/src/codexlens/semantic/__pycache__/ann_index.cpython-313.pyc +0 -0
  371. package/codex-lens/src/codexlens/semantic/__pycache__/chunker.cpython-313.pyc +0 -0
  372. package/codex-lens/src/codexlens/semantic/__pycache__/code_extractor.cpython-313.pyc +0 -0
  373. package/codex-lens/src/codexlens/semantic/__pycache__/embedder.cpython-313.pyc +0 -0
  374. package/codex-lens/src/codexlens/semantic/__pycache__/graph_analyzer.cpython-313.pyc +0 -0
  375. package/codex-lens/src/codexlens/semantic/__pycache__/llm_enhancer.cpython-313.pyc +0 -0
  376. package/codex-lens/src/codexlens/semantic/__pycache__/vector_store.cpython-313.pyc +0 -0
  377. package/codex-lens/src/codexlens/semantic/ann_index.py +414 -0
  378. package/codex-lens/src/codexlens/semantic/chunker.py +448 -0
  379. package/codex-lens/src/codexlens/semantic/code_extractor.py +274 -0
  380. package/codex-lens/src/codexlens/semantic/embedder.py +185 -0
  381. package/codex-lens/src/codexlens/semantic/vector_store.py +955 -0
  382. package/codex-lens/src/codexlens/storage/__init__.py +29 -0
  383. package/codex-lens/src/codexlens/storage/__pycache__/__init__.cpython-313.pyc +0 -0
  384. package/codex-lens/src/codexlens/storage/__pycache__/dir_index.cpython-313.pyc +0 -0
  385. package/codex-lens/src/codexlens/storage/__pycache__/file_cache.cpython-313.pyc +0 -0
  386. package/codex-lens/src/codexlens/storage/__pycache__/index_tree.cpython-313.pyc +0 -0
  387. package/codex-lens/src/codexlens/storage/__pycache__/migration_manager.cpython-313.pyc +0 -0
  388. package/codex-lens/src/codexlens/storage/__pycache__/path_mapper.cpython-313.pyc +0 -0
  389. package/codex-lens/src/codexlens/storage/__pycache__/registry.cpython-313.pyc +0 -0
  390. package/codex-lens/src/codexlens/storage/__pycache__/sqlite_store.cpython-313.pyc +0 -0
  391. package/codex-lens/src/codexlens/storage/__pycache__/sqlite_utils.cpython-313.pyc +0 -0
  392. package/codex-lens/src/codexlens/storage/dir_index.py +1850 -0
  393. package/codex-lens/src/codexlens/storage/file_cache.py +32 -0
  394. package/codex-lens/src/codexlens/storage/index_tree.py +776 -0
  395. package/codex-lens/src/codexlens/storage/migration_manager.py +154 -0
  396. package/codex-lens/src/codexlens/storage/migrations/__init__.py +1 -0
  397. package/codex-lens/src/codexlens/storage/migrations/__pycache__/__init__.cpython-313.pyc +0 -0
  398. package/codex-lens/src/codexlens/storage/migrations/__pycache__/migration_001_normalize_keywords.cpython-313.pyc +0 -0
  399. package/codex-lens/src/codexlens/storage/migrations/__pycache__/migration_002_add_token_metadata.cpython-313.pyc +0 -0
  400. package/codex-lens/src/codexlens/storage/migrations/__pycache__/migration_003_code_relationships.cpython-313.pyc +0 -0
  401. package/codex-lens/src/codexlens/storage/migrations/__pycache__/migration_004_dual_fts.cpython-313.pyc +0 -0
  402. package/codex-lens/src/codexlens/storage/migrations/__pycache__/migration_005_cleanup_unused_fields.cpython-313.pyc +0 -0
  403. package/codex-lens/src/codexlens/storage/migrations/migration_001_normalize_keywords.py +123 -0
  404. package/codex-lens/src/codexlens/storage/migrations/migration_002_add_token_metadata.py +48 -0
  405. package/codex-lens/src/codexlens/storage/migrations/migration_004_dual_fts.py +232 -0
  406. package/codex-lens/src/codexlens/storage/migrations/migration_005_cleanup_unused_fields.py +196 -0
  407. package/codex-lens/src/codexlens/storage/path_mapper.py +274 -0
  408. package/codex-lens/src/codexlens/storage/registry.py +670 -0
  409. package/codex-lens/src/codexlens/storage/sqlite_store.py +576 -0
  410. package/codex-lens/src/codexlens/storage/sqlite_utils.py +64 -0
  411. package/package.json +4 -1
  412. package/.claude/commands/memory/tech-research.md +0 -477
  413. package/.claude/scripts/classify-folders.sh +0 -39
  414. package/.claude/scripts/convert_tokens_to_css.sh +0 -229
  415. package/.claude/scripts/detect_changed_modules.sh +0 -161
  416. package/.claude/scripts/discover-design-files.sh +0 -87
  417. package/.claude/scripts/extract-animations.js +0 -243
  418. package/.claude/scripts/extract-computed-styles.js +0 -118
  419. package/.claude/scripts/extract-layout-structure.js +0 -411
  420. package/.claude/scripts/generate_module_docs.sh +0 -717
  421. package/.claude/scripts/get_modules_by_depth.sh +0 -170
  422. package/.claude/scripts/ui-generate-preview.sh +0 -395
  423. package/.claude/scripts/ui-instantiate-prototypes.sh +0 -815
  424. package/.claude/scripts/update_module_claude.sh +0 -337
  425. package/.claude/workflows/context-search-strategy.md +0 -77
  426. package/.claude/workflows/intelligent-tools-strategy.md +0 -662
  427. package/ccw/src/cli.js +0 -119
  428. package/ccw/src/commands/install.js +0 -324
  429. package/ccw/src/commands/tool.js +0 -138
  430. package/ccw/src/core/data-aggregator.js +0 -409
  431. package/ccw/src/core/server.js +0 -2063
  432. package/ccw/src/core/session-scanner.js +0 -235
  433. package/ccw/src/tools/classify-folders.js +0 -204
  434. package/ccw/src/tools/detect-changed-modules.js +0 -288
  435. package/ccw/src/tools/edit-file.js +0 -266
  436. package/ccw/src/tools/index.js +0 -176
  437. package/ccw/src/utils/file-utils.js +0 -48
@@ -1,592 +1,645 @@
1
- ---
2
- name: lite-plan
3
- description: Lightweight interactive planning workflow with in-memory planning, code exploration, and execution dispatch to lite-execute after user confirmation
4
- argument-hint: "[-e|--explore] \"task description\"|file.md"
5
- allowed-tools: TodoWrite(*), Task(*), SlashCommand(*), AskUserQuestion(*)
6
- ---
7
-
8
- # Workflow Lite-Plan Command (/workflow:lite-plan)
9
-
10
- ## Overview
11
-
12
- Intelligent lightweight planning command with dynamic workflow adaptation based on task complexity. Focuses on planning phases (exploration, clarification, planning, confirmation) and delegates execution to `/workflow:lite-execute`.
13
-
14
- **Core capabilities:**
15
- - Intelligent task analysis with automatic exploration detection
16
- - Dynamic code exploration (cli-explore-agent) when codebase understanding needed
17
- - Interactive clarification after exploration to gather missing information
18
- - Adaptive planning strategy (direct Claude vs cli-lite-planning-agent) based on complexity
19
- - Two-step confirmation: plan display → multi-dimensional input collection
20
- - Execution dispatch with complete context handoff to lite-execute
21
-
22
- ## Usage
23
-
24
- ```bash
25
- /workflow:lite-plan [FLAGS] <TASK_DESCRIPTION>
26
-
27
- # Flags
28
- -e, --explore Force code exploration phase (overrides auto-detection)
29
-
30
- # Arguments
31
- <task-description> Task description or path to .md file (required)
32
- ```
33
-
34
- ## Execution Process
35
-
36
- ```
37
- Phase 1: Task Analysis & Exploration
38
- ├─ Parse input (description or .md file)
39
- ├─ intelligent complexity assessment (Low/Medium/High)
40
- ├─ Exploration decision (auto-detect or --explore flag)
41
- ├─ ⚠️ Context protection: If file reading ≥50k chars → force cli-explore-agent
42
- └─ Decision:
43
- ├─ needsExploration=true → Launch parallel cli-explore-agents (1-4 based on complexity)
44
- └─ needsExploration=false → Skip to Phase 2/3
45
-
46
- Phase 2: Clarification (optional, multi-round)
47
- ├─ Aggregate clarification_needs from all exploration angles
48
- ├─ Deduplicate similar questions
49
- └─ Decision:
50
- ├─ Has clarifications → AskUserQuestion (max 4 questions per round, multiple rounds allowed)
51
- └─ No clarifications → Skip to Phase 3
52
-
53
- Phase 3: Planning (NO CODE EXECUTION - planning only)
54
- └─ Decision (based on Phase 1 complexity):
55
- ├─ Low → Load schema: cat ~/.claude/workflows/cli-templates/schemas/plan-json-schema.json → Direct Claude planning (following schema) → plan.json → MUST proceed to Phase 4
56
- └─ Medium/High → cli-lite-planning-agent → plan.json → MUST proceed to Phase 4
57
-
58
- Phase 4: Confirmation & Selection
59
- ├─ Display plan summary (tasks, complexity, estimated time)
60
- └─ AskUserQuestion:
61
- ├─ Confirm: Allow / Modify / Cancel
62
- ├─ Execution: Agent / Codex / Auto
63
- └─ Review: Gemini / Agent / Skip
64
-
65
- Phase 5: Dispatch
66
- ├─ Build executionContext (plan + explorations + clarifications + selections)
67
- └─ SlashCommand("/workflow:lite-execute --in-memory")
68
- ```
69
-
70
- ## Implementation
71
-
72
- ### Phase 1: Intelligent Multi-Angle Exploration
73
-
74
- **Session Setup** (MANDATORY - follow exactly):
75
- ```javascript
76
- // Helper: Get UTC+8 (China Standard Time) ISO string
77
- const getUtc8ISOString = () => new Date(Date.now() + 8 * 60 * 60 * 1000).toISOString()
78
-
79
- const taskSlug = task_description.toLowerCase().replace(/[^a-z0-9]+/g, '-').substring(0, 40)
80
- const dateStr = getUtc8ISOString().substring(0, 10) // Format: 2025-11-29
81
-
82
- const sessionId = `${taskSlug}-${dateStr}` // e.g., "implement-jwt-refresh-2025-11-29"
83
- const sessionFolder = `.workflow/.lite-plan/${sessionId}`
84
-
85
- bash(`mkdir -p ${sessionFolder} && test -d ${sessionFolder} && echo "SUCCESS: ${sessionFolder}" || echo "FAILED: ${sessionFolder}"`)
86
- ```
87
-
88
- **Exploration Decision Logic**:
89
- ```javascript
90
- needsExploration = (
91
- flags.includes('--explore') || flags.includes('-e') ||
92
- task.mentions_specific_files ||
93
- task.requires_codebase_context ||
94
- task.needs_architecture_understanding ||
95
- task.modifies_existing_code
96
- )
97
-
98
- if (!needsExploration) {
99
- // Skip to Phase 2 (Clarification) or Phase 3 (Planning)
100
- proceed_to_next_phase()
101
- }
102
- ```
103
-
104
- **⚠️ Context Protection**: File reading ≥50k chars → force `needsExploration=true` (delegate to cli-explore-agent)
105
-
106
- **Complexity Assessment** (Intelligent Analysis):
107
- ```javascript
108
- // analyzes task complexity based on:
109
- // - Scope: How many systems/modules are affected?
110
- // - Depth: Surface change vs architectural impact?
111
- // - Risk: Potential for breaking existing functionality?
112
- // - Dependencies: How interconnected is the change?
113
-
114
- const complexity = analyzeTaskComplexity(task_description)
115
- // Returns: 'Low' | 'Medium' | 'High'
116
- // Low: Single file, isolated change, minimal risk
117
- // Medium: Multiple files, some dependencies, moderate risk
118
- // High: Cross-module, architectural, high risk
119
-
120
- // Angle assignment based on task type (orchestrator decides, not agent)
121
- const ANGLE_PRESETS = {
122
- architecture: ['architecture', 'dependencies', 'modularity', 'integration-points'],
123
- security: ['security', 'auth-patterns', 'dataflow', 'validation'],
124
- performance: ['performance', 'bottlenecks', 'caching', 'data-access'],
125
- bugfix: ['error-handling', 'dataflow', 'state-management', 'edge-cases'],
126
- feature: ['patterns', 'integration-points', 'testing', 'dependencies']
127
- }
128
-
129
- function selectAngles(taskDescription, count) {
130
- const text = taskDescription.toLowerCase()
131
- let preset = 'feature' // default
132
-
133
- if (/refactor|architect|restructure|modular/.test(text)) preset = 'architecture'
134
- else if (/security|auth|permission|access/.test(text)) preset = 'security'
135
- else if (/performance|slow|optimi|cache/.test(text)) preset = 'performance'
136
- else if (/fix|bug|error|issue|broken/.test(text)) preset = 'bugfix'
137
-
138
- return ANGLE_PRESETS[preset].slice(0, count)
139
- }
140
-
141
- const selectedAngles = selectAngles(task_description, complexity === 'High' ? 4 : (complexity === 'Medium' ? 3 : 1))
142
-
143
- console.log(`
144
- ## Exploration Plan
145
-
146
- Task Complexity: ${complexity}
147
- Selected Angles: ${selectedAngles.join(', ')}
148
-
149
- Launching ${selectedAngles.length} parallel explorations...
150
- `)
151
- ```
152
-
153
- **Launch Parallel Explorations** - Orchestrator assigns angle to each agent:
154
-
155
- ```javascript
156
- // Launch agents with pre-assigned angles
157
- const explorationTasks = selectedAngles.map((angle, index) =>
158
- Task(
159
- subagent_type="cli-explore-agent",
160
- description=`Explore: ${angle}`,
161
- prompt=`
162
- ## Task Objective
163
- Execute **${angle}** exploration for task planning context. Analyze codebase from this specific angle to discover relevant structure, patterns, and constraints.
164
-
165
- ## Assigned Context
166
- - **Exploration Angle**: ${angle}
167
- - **Task Description**: ${task_description}
168
- - **Exploration Index**: ${index + 1} of ${selectedAngles.length}
169
- - **Output File**: ${sessionFolder}/exploration-${angle}.json
170
-
171
- ## MANDATORY FIRST STEPS (Execute by Agent)
172
- **You (cli-explore-agent) MUST execute these steps in order:**
173
- 1. Run: ccw tool exec get_modules_by_depth '{}' (project structure)
174
- 2. Run: rg -l "{keyword_from_task}" --type ts (locate relevant files)
175
- 3. Execute: cat ~/.claude/workflows/cli-templates/schemas/explore-json-schema.json (get output schema reference)
176
-
177
- ## Exploration Strategy (${angle} focus)
178
-
179
- **Step 1: Structural Scan** (Bash)
180
- - get_modules_by_depth.sh → identify modules related to ${angle}
181
- - find/rg locate files relevant to ${angle} aspect
182
- - Analyze imports/dependencies from ${angle} perspective
183
-
184
- **Step 2: Semantic Analysis** (Gemini CLI)
185
- - How does existing code handle ${angle} concerns?
186
- - What patterns are used for ${angle}?
187
- - Where would new code integrate from ${angle} viewpoint?
188
-
189
- **Step 3: Write Output**
190
- - Consolidate ${angle} findings into JSON
191
- - Identify ${angle}-specific clarification needs
192
-
193
- ## Expected Output
194
-
195
- **File**: ${sessionFolder}/exploration-${angle}.json
196
-
197
- **Schema Reference**: Schema obtained in MANDATORY FIRST STEPS step 3, follow schema exactly
198
-
199
- **Required Fields** (all ${angle} focused):
200
- - project_structure: Modules/architecture relevant to ${angle}
201
- - relevant_files: Files affected from ${angle} perspective
202
- **IMPORTANT**: Use object format with relevance scores for synthesis:
203
- \`[{path: "src/file.ts", relevance: 0.85, rationale: "Core ${angle} logic"}]\`
204
- Scores: 0.7+ high priority, 0.5-0.7 medium, <0.5 low
205
- - patterns: ${angle}-related patterns to follow
206
- - dependencies: Dependencies relevant to ${angle}
207
- - integration_points: Where to integrate from ${angle} viewpoint (include file:line locations)
208
- - constraints: ${angle}-specific limitations/conventions
209
- - clarification_needs: ${angle}-related ambiguities (options array + recommended index)
210
- - _metadata.exploration_angle: "${angle}"
211
-
212
- ## Success Criteria
213
- - [ ] Schema obtained via cat explore-json-schema.json
214
- - [ ] get_modules_by_depth.sh executed
215
- - [ ] At least 3 relevant files identified with ${angle} rationale
216
- - [ ] Patterns are actionable (code examples, not generic advice)
217
- - [ ] Integration points include file:line locations
218
- - [ ] Constraints are project-specific to ${angle}
219
- - [ ] JSON output follows schema exactly
220
- - [ ] clarification_needs includes options + recommended
221
-
222
- ## Output
223
- Write: ${sessionFolder}/exploration-${angle}.json
224
- Return: 2-3 sentence summary of ${angle} findings
225
- `
226
- )
227
- )
228
-
229
- // Execute all exploration tasks in parallel
230
- ```
231
-
232
- **Auto-discover Generated Exploration Files**:
233
- ```javascript
234
- // After explorations complete, auto-discover all exploration-*.json files
235
- const explorationFiles = bash(`find ${sessionFolder} -name "exploration-*.json" -type f`)
236
- .split('\n')
237
- .filter(f => f.trim())
238
-
239
- // Read metadata to build manifest
240
- const explorationManifest = {
241
- session_id: sessionId,
242
- task_description: task_description,
243
- timestamp: getUtc8ISOString(),
244
- complexity: complexity,
245
- exploration_count: explorationCount,
246
- explorations: explorationFiles.map(file => {
247
- const data = JSON.parse(Read(file))
248
- const filename = path.basename(file)
249
- return {
250
- angle: data._metadata.exploration_angle,
251
- file: filename,
252
- path: file,
253
- index: data._metadata.exploration_index
254
- }
255
- })
256
- }
257
-
258
- Write(`${sessionFolder}/explorations-manifest.json`, JSON.stringify(explorationManifest, null, 2))
259
-
260
- console.log(`
261
- ## Exploration Complete
262
-
263
- Generated exploration files in ${sessionFolder}:
264
- ${explorationManifest.explorations.map(e => `- exploration-${e.angle}.json (angle: ${e.angle})`).join('\n')}
265
-
266
- Manifest: explorations-manifest.json
267
- Angles explored: ${explorationManifest.explorations.map(e => e.angle).join(', ')}
268
- `)
269
- ```
270
-
271
- **Output**:
272
- - `${sessionFolder}/exploration-{angle1}.json`
273
- - `${sessionFolder}/exploration-{angle2}.json`
274
- - ... (1-4 files based on complexity)
275
- - `${sessionFolder}/explorations-manifest.json`
276
-
277
- ---
278
-
279
- ### Phase 2: Clarification (Optional, Multi-Round)
280
-
281
- **Skip if**: No exploration or `clarification_needs` is empty across all explorations
282
-
283
- **⚠️ CRITICAL**: AskUserQuestion tool limits max 4 questions per call. **MUST execute multiple rounds** to exhaust all clarification needs - do NOT stop at round 1.
284
-
285
- **Aggregate clarification needs from all exploration angles**:
286
- ```javascript
287
- // Load manifest and all exploration files
288
- const manifest = JSON.parse(Read(`${sessionFolder}/explorations-manifest.json`))
289
- const explorations = manifest.explorations.map(exp => ({
290
- angle: exp.angle,
291
- data: JSON.parse(Read(exp.path))
292
- }))
293
-
294
- // Aggregate clarification needs from all explorations
295
- const allClarifications = []
296
- explorations.forEach(exp => {
297
- if (exp.data.clarification_needs?.length > 0) {
298
- exp.data.clarification_needs.forEach(need => {
299
- allClarifications.push({
300
- ...need,
301
- source_angle: exp.angle
302
- })
303
- })
304
- }
305
- })
306
-
307
- // Deduplicate exact same questions only
308
- const seen = new Set()
309
- const dedupedClarifications = allClarifications.filter(c => {
310
- const key = c.question.toLowerCase()
311
- if (seen.has(key)) return false
312
- seen.add(key)
313
- return true
314
- })
315
-
316
- // Multi-round clarification: batch questions (max 4 per round)
317
- if (dedupedClarifications.length > 0) {
318
- const BATCH_SIZE = 4
319
- const totalRounds = Math.ceil(dedupedClarifications.length / BATCH_SIZE)
320
-
321
- for (let i = 0; i < dedupedClarifications.length; i += BATCH_SIZE) {
322
- const batch = dedupedClarifications.slice(i, i + BATCH_SIZE)
323
- const currentRound = Math.floor(i / BATCH_SIZE) + 1
324
-
325
- console.log(`### Clarification Round ${currentRound}/${totalRounds}`)
326
-
327
- AskUserQuestion({
328
- questions: batch.map(need => ({
329
- question: `[${need.source_angle}] ${need.question}\n\nContext: ${need.context}`,
330
- header: need.source_angle.substring(0, 12),
331
- multiSelect: false,
332
- options: need.options.map((opt, index) => ({
333
- label: need.recommended === index ? `${opt} ★` : opt,
334
- description: need.recommended === index ? `Recommended` : `Use ${opt}`
335
- }))
336
- }))
337
- })
338
-
339
- // Store batch responses in clarificationContext before next round
340
- }
341
- }
342
- ```
343
-
344
- **Output**: `clarificationContext` (in-memory)
345
-
346
- ---
347
-
348
- ### Phase 3: Planning
349
-
350
- **Planning Strategy Selection** (based on Phase 1 complexity):
351
-
352
- **IMPORTANT**: Phase 3 is **planning only** - NO code execution. All execution happens in Phase 5 via lite-execute.
353
-
354
- **Low Complexity** - Direct planning by Claude:
355
- ```javascript
356
- // Step 1: Read schema
357
- const schema = Bash(`cat ~/.claude/workflows/cli-templates/schemas/plan-json-schema.json`)
358
-
359
- // Step 2: Generate plan following schema (Claude directly, no agent)
360
- const plan = {
361
- summary: "...",
362
- approach: "...",
363
- tasks: [...], // Each task: { id, title, scope, ..., depends_on, execution_group, complexity }
364
- estimated_time: "...",
365
- recommended_execution: "Agent",
366
- complexity: "Low",
367
- _metadata: { timestamp: getUtc8ISOString(), source: "direct-planning", planning_mode: "direct" }
368
- }
369
-
370
- // Step 3: Write plan to session folder
371
- Write(`${sessionFolder}/plan.json`, JSON.stringify(plan, null, 2))
372
-
373
- // Step 4: MUST continue to Phase 4 (Confirmation) - DO NOT execute code here
374
- ```
375
-
376
- **Medium/High Complexity** - Invoke cli-lite-planning-agent:
377
-
378
- ```javascript
379
- Task(
380
- subagent_type="cli-lite-planning-agent",
381
- description="Generate detailed implementation plan",
382
- prompt=`
383
- Generate implementation plan and write plan.json.
384
-
385
- ## Output Schema Reference
386
- Execute: cat ~/.claude/workflows/cli-templates/schemas/plan-json-schema.json (get schema reference before generating plan)
387
-
388
- ## Task Description
389
- ${task_description}
390
-
391
- ## Multi-Angle Exploration Context
392
-
393
- ${manifest.explorations.map(exp => `### Exploration: ${exp.angle} (${exp.file})
394
- Path: ${exp.path}
395
-
396
- Read this file for detailed ${exp.angle} analysis.`).join('\n\n')}
397
-
398
- Total explorations: ${manifest.exploration_count}
399
- Angles covered: ${manifest.explorations.map(e => e.angle).join(', ')}
400
-
401
- Manifest: ${sessionFolder}/explorations-manifest.json
402
-
403
- ## User Clarifications
404
- ${JSON.stringify(clarificationContext) || "None"}
405
-
406
- ## Complexity Level
407
- ${complexity}
408
-
409
- ## Requirements
410
- Generate plan.json with:
411
- - summary: 2-3 sentence overview
412
- - approach: High-level implementation strategy (incorporating insights from all exploration angles)
413
- - tasks: 2-7 structured tasks (**IMPORTANT: group by feature/module, NOT by file**)
414
- - **Task Granularity Principle**: Each task = one complete feature unit or module
415
- - title: action verb + target module/feature (e.g., "Implement auth token refresh")
416
- - scope: module path (src/auth/) or feature name, prefer module-level over single file
417
- - action, description
418
- - modification_points: ALL files to modify for this feature (group related changes)
419
- - implementation (3-7 steps covering all modification_points)
420
- - reference (pattern, files, examples)
421
- - acceptance (2-4 criteria for the entire feature)
422
- - depends_on: task IDs this task depends on (use sparingly, only for true dependencies)
423
- - estimated_time, recommended_execution, complexity
424
- - _metadata:
425
- - timestamp, source, planning_mode
426
- - exploration_angles: ${JSON.stringify(manifest.explorations.map(e => e.angle))}
427
-
428
- ## Task Grouping Rules
429
- 1. **Group by feature**: All changes for one feature = one task (even if 3-5 files)
430
- 2. **Group by context**: Tasks with similar context or related functional changes can be grouped together
431
- 3. **Minimize agent count**: Simple, unrelated tasks can also be grouped to reduce agent execution overhead
432
- 4. **Avoid file-per-task**: Do NOT create separate tasks for each file
433
- 5. **Substantial tasks**: Each task should represent 15-60 minutes of work
434
- 6. **True dependencies only**: Only use depends_on when Task B cannot start without Task A's output
435
- 7. **Prefer parallel**: Most tasks should be independent (no depends_on)
436
-
437
- ## Execution
438
- 1. Read ALL exploration files for comprehensive context
439
- 2. Execute CLI planning using Gemini (Qwen fallback)
440
- 3. Synthesize findings from multiple exploration angles
441
- 4. Parse output and structure plan
442
- 5. Write JSON: Write('${sessionFolder}/plan.json', jsonContent)
443
- 6. Return brief completion summary
444
- `
445
- )
446
- ```
447
-
448
- **Output**: `${sessionFolder}/plan.json`
449
-
450
- ---
451
-
452
- ### Phase 4: Task Confirmation & Execution Selection
453
-
454
- **Step 4.1: Display Plan**
455
- ```javascript
456
- const plan = JSON.parse(Read(`${sessionFolder}/plan.json`))
457
-
458
- console.log(`
459
- ## Implementation Plan
460
-
461
- **Summary**: ${plan.summary}
462
- **Approach**: ${plan.approach}
463
-
464
- **Tasks** (${plan.tasks.length}):
465
- ${plan.tasks.map((t, i) => `${i+1}. ${t.title} (${t.file})`).join('\n')}
466
-
467
- **Complexity**: ${plan.complexity}
468
- **Estimated Time**: ${plan.estimated_time}
469
- **Recommended**: ${plan.recommended_execution}
470
- `)
471
- ```
472
-
473
- **Step 4.2: Collect Confirmation**
474
- ```javascript
475
- AskUserQuestion({
476
- questions: [
477
- {
478
- question: `Confirm plan? (${plan.tasks.length} tasks, ${plan.complexity})`,
479
- header: "Confirm",
480
- multiSelect: true,
481
- options: [
482
- { label: "Allow", description: "Proceed as-is" },
483
- { label: "Modify", description: "Adjust before execution" },
484
- { label: "Cancel", description: "Abort workflow" }
485
- ]
486
- },
487
- {
488
- question: "Execution method:",
489
- header: "Execution",
490
- multiSelect: false,
491
- options: [
492
- { label: "Agent", description: "@code-developer agent" },
493
- { label: "Codex", description: "codex CLI tool" },
494
- { label: "Auto", description: `Auto: ${plan.complexity === 'Low' ? 'Agent' : 'Codex'}` }
495
- ]
496
- },
497
- {
498
- question: "Code review after execution?",
499
- header: "Review",
500
- multiSelect: false,
501
- options: [
502
- { label: "Gemini Review", description: "Gemini CLI" },
503
- { label: "Agent Review", description: "@code-reviewer" },
504
- { label: "Skip", description: "No review" }
505
- ]
506
- }
507
- ]
508
- })
509
- ```
510
-
511
- ---
512
-
513
- ### Phase 5: Dispatch to Execution
514
-
515
- **CRITICAL**: lite-plan NEVER executes code directly. ALL execution MUST go through lite-execute.
516
-
517
- **Step 5.1: Build executionContext**
518
-
519
- ```javascript
520
- // Load manifest and all exploration files
521
- const manifest = JSON.parse(Read(`${sessionFolder}/explorations-manifest.json`))
522
- const explorations = {}
523
-
524
- manifest.explorations.forEach(exp => {
525
- if (file_exists(exp.path)) {
526
- explorations[exp.angle] = JSON.parse(Read(exp.path))
527
- }
528
- })
529
-
530
- const plan = JSON.parse(Read(`${sessionFolder}/plan.json`))
531
-
532
- executionContext = {
533
- planObject: plan,
534
- explorationsContext: explorations,
535
- explorationAngles: manifest.explorations.map(e => e.angle),
536
- explorationManifest: manifest,
537
- clarificationContext: clarificationContext || null,
538
- executionMethod: userSelection.execution_method,
539
- codeReviewTool: userSelection.code_review_tool,
540
- originalUserInput: task_description,
541
- session: {
542
- id: sessionId,
543
- folder: sessionFolder,
544
- artifacts: {
545
- explorations: manifest.explorations.map(exp => ({
546
- angle: exp.angle,
547
- path: exp.path
548
- })),
549
- explorations_manifest: `${sessionFolder}/explorations-manifest.json`,
550
- plan: `${sessionFolder}/plan.json`
551
- }
552
- }
553
- }
554
- ```
555
-
556
- **Step 5.2: Dispatch**
557
-
558
- ```javascript
559
- SlashCommand(command="/workflow:lite-execute --in-memory")
560
- ```
561
-
562
- ## Session Folder Structure
563
-
564
- ```
565
- .workflow/.lite-plan/{task-slug}-{YYYY-MM-DD}/
566
- ├── exploration-{angle1}.json # Exploration angle 1
567
- ├── exploration-{angle2}.json # Exploration angle 2
568
- ├── exploration-{angle3}.json # Exploration angle 3 (if applicable)
569
- ├── exploration-{angle4}.json # Exploration angle 4 (if applicable)
570
- ├── explorations-manifest.json # Exploration index
571
- └── plan.json # Implementation plan
572
- ```
573
-
574
- **Example**:
575
- ```
576
- .workflow/.lite-plan/implement-jwt-refresh-2025-11-25-14-30-25/
577
- ├── exploration-architecture.json
578
- ├── exploration-auth-patterns.json
579
- ├── exploration-security.json
580
- ├── explorations-manifest.json
581
- └── plan.json
582
- ```
583
-
584
- ## Error Handling
585
-
586
- | Error | Resolution |
587
- |-------|------------|
588
- | Exploration agent failure | Skip exploration, continue with task description only |
589
- | Planning agent failure | Fallback to direct planning by Claude |
590
- | Clarification timeout | Use exploration findings as-is |
591
- | Confirmation timeout | Save context, display resume instructions |
592
- | Modify loop > 3 times | Suggest breaking task or using /workflow:plan |
1
+ ---
2
+ name: lite-plan
3
+ description: Lightweight interactive planning workflow with in-memory planning, code exploration, and execution dispatch to lite-execute after user confirmation
4
+ argument-hint: "[-e|--explore] \"task description\"|file.md"
5
+ allowed-tools: TodoWrite(*), Task(*), SlashCommand(*), AskUserQuestion(*)
6
+ ---
7
+
8
+ # Workflow Lite-Plan Command (/workflow:lite-plan)
9
+
10
+ ## Overview
11
+
12
+ Intelligent lightweight planning command with dynamic workflow adaptation based on task complexity. Focuses on planning phases (exploration, clarification, planning, confirmation) and delegates execution to `/workflow:lite-execute`.
13
+
14
+ **Core capabilities:**
15
+ - Intelligent task analysis with automatic exploration detection
16
+ - Dynamic code exploration (cli-explore-agent) when codebase understanding needed
17
+ - Interactive clarification after exploration to gather missing information
18
+ - Adaptive planning strategy (direct Claude vs cli-lite-planning-agent) based on complexity
19
+ - Two-step confirmation: plan display → multi-dimensional input collection
20
+ - Execution dispatch with complete context handoff to lite-execute
21
+
22
+ ## Usage
23
+
24
+ ```bash
25
+ /workflow:lite-plan [FLAGS] <TASK_DESCRIPTION>
26
+
27
+ # Flags
28
+ -e, --explore Force code exploration phase (overrides auto-detection)
29
+
30
+ # Arguments
31
+ <task-description> Task description or path to .md file (required)
32
+ ```
33
+
34
+ ## Execution Process
35
+
36
+ ```
37
+ Phase 1: Task Analysis & Exploration
38
+ ├─ Parse input (description or .md file)
39
+ ├─ intelligent complexity assessment (Low/Medium/High)
40
+ ├─ Exploration decision (auto-detect or --explore flag)
41
+ ├─ ⚠️ Context protection: If file reading ≥50k chars → force cli-explore-agent
42
+ └─ Decision:
43
+ ├─ needsExploration=true → Launch parallel cli-explore-agents (1-4 based on complexity)
44
+ └─ needsExploration=false → Skip to Phase 2/3
45
+
46
+ Phase 2: Clarification (optional, multi-round)
47
+ ├─ Aggregate clarification_needs from all exploration angles
48
+ ├─ Deduplicate similar questions
49
+ └─ Decision:
50
+ ├─ Has clarifications → AskUserQuestion (max 4 questions per round, multiple rounds allowed)
51
+ └─ No clarifications → Skip to Phase 3
52
+
53
+ Phase 3: Planning (NO CODE EXECUTION - planning only)
54
+ └─ Decision (based on Phase 1 complexity):
55
+ ├─ Low → Load schema: cat ~/.claude/workflows/cli-templates/schemas/plan-json-schema.json → Direct Claude planning (following schema) → plan.json → MUST proceed to Phase 4
56
+ └─ Medium/High → cli-lite-planning-agent → plan.json → MUST proceed to Phase 4
57
+
58
+ Phase 4: Confirmation & Selection
59
+ ├─ Display plan summary (tasks, complexity, estimated time)
60
+ └─ AskUserQuestion:
61
+ ├─ Confirm: Allow / Modify / Cancel
62
+ ├─ Execution: Agent / Codex / Auto
63
+ └─ Review: Gemini / Agent / Skip
64
+
65
+ Phase 5: Dispatch
66
+ ├─ Build executionContext (plan + explorations + clarifications + selections)
67
+ └─ SlashCommand("/workflow:lite-execute --in-memory")
68
+ ```
69
+
70
+ ## Implementation
71
+
72
+ ### Phase 1: Intelligent Multi-Angle Exploration
73
+
74
+ **Session Setup** (MANDATORY - follow exactly):
75
+
76
+ **Option 1: Using CLI Command** (Recommended for simplicity):
77
+ ```bash
78
+ # Generate session ID
79
+ task_slug=$(echo "${task_description}" | tr '[:upper:]' '[:lower:]' | tr -cs '[:alnum:]' '-' | cut -c1-40)
80
+ date_str=$(date -u '+%Y-%m-%d')
81
+ session_id="${task_slug}-${date_str}"
82
+
83
+ # Initialize lite-plan session (location auto-inferred from type)
84
+ ccw session init "${session_id}" \
85
+ --type lite-plan \
86
+ --content "{\"description\":\"${task_description}\",\"complexity\":\"${complexity}\"}"
87
+
88
+ # Get session folder
89
+ session_folder=".workflow/.lite-plan/${session_id}"
90
+ echo "Session initialized: ${session_id} at ${session_folder}"
91
+ ```
92
+
93
+ **Option 2: Using session_manager Tool** (For programmatic access):
94
+ ```javascript
95
+ // Helper: Get UTC+8 (China Standard Time) ISO string
96
+ const getUtc8ISOString = () => new Date(Date.now() + 8 * 60 * 60 * 1000).toISOString()
97
+
98
+ const taskSlug = task_description.toLowerCase().replace(/[^a-z0-9]+/g, '-').substring(0, 40)
99
+ const dateStr = getUtc8ISOString().substring(0, 10) // Format: 2025-12-17
100
+
101
+ const sessionId = `${taskSlug}-${dateStr}` // e.g., "implement-jwt-refresh-2025-12-17"
102
+
103
+
104
+
105
+ const sessionFolder = initResult.result.path
106
+ console.log(`Session initialized: ${sessionId} at ${sessionFolder}`)
107
+ ```
108
+
109
+ **Session File Structure**:
110
+ - `session-metadata.json` - Session metadata (created at init, contains description, complexity, status)
111
+ - `plan.json` - Actual planning content (created later in Phase 3, contains tasks, steps, dependencies)
112
+
113
+ **Metadata Field Usage**:
114
+ - `description`: Displayed in dashboard session list (replaces session ID as title)
115
+ - `complexity`: Used for planning strategy selection (Low Direct Claude, Medium/High Agent)
116
+ - `created_at`: Displayed in dashboard timeline
117
+ - Custom fields: Any additional fields in metadata are saved and accessible programmatically
118
+
119
+ **Accessing Session Data**:
120
+ ```bash
121
+ # Read session metadata
122
+ ccw session ${session_id} read session-metadata.json
123
+
124
+ # Read plan content (after Phase 3 completion)
125
+ ccw session ${session_id} read plan.json
126
+ ```
127
+
128
+ **Exploration Decision Logic**:
129
+ ```javascript
130
+ needsExploration = (
131
+ flags.includes('--explore') || flags.includes('-e') ||
132
+ task.mentions_specific_files ||
133
+ task.requires_codebase_context ||
134
+ task.needs_architecture_understanding ||
135
+ task.modifies_existing_code
136
+ )
137
+
138
+ if (!needsExploration) {
139
+ // Skip to Phase 2 (Clarification) or Phase 3 (Planning)
140
+ proceed_to_next_phase()
141
+ }
142
+ ```
143
+
144
+ **⚠️ Context Protection**: File reading ≥50k chars → force `needsExploration=true` (delegate to cli-explore-agent)
145
+
146
+ **Complexity Assessment** (Intelligent Analysis):
147
+ ```javascript
148
+ // analyzes task complexity based on:
149
+ // - Scope: How many systems/modules are affected?
150
+ // - Depth: Surface change vs architectural impact?
151
+ // - Risk: Potential for breaking existing functionality?
152
+ // - Dependencies: How interconnected is the change?
153
+
154
+ const complexity = analyzeTaskComplexity(task_description)
155
+ // Returns: 'Low' | 'Medium' | 'High'
156
+ // Low: Single file, isolated change, minimal risk
157
+ // Medium: Multiple files, some dependencies, moderate risk
158
+ // High: Cross-module, architectural, high risk
159
+
160
+ // Angle assignment based on task type (orchestrator decides, not agent)
161
+ const ANGLE_PRESETS = {
162
+ architecture: ['architecture', 'dependencies', 'modularity', 'integration-points'],
163
+ security: ['security', 'auth-patterns', 'dataflow', 'validation'],
164
+ performance: ['performance', 'bottlenecks', 'caching', 'data-access'],
165
+ bugfix: ['error-handling', 'dataflow', 'state-management', 'edge-cases'],
166
+ feature: ['patterns', 'integration-points', 'testing', 'dependencies']
167
+ }
168
+
169
+ function selectAngles(taskDescription, count) {
170
+ const text = taskDescription.toLowerCase()
171
+ let preset = 'feature' // default
172
+
173
+ if (/refactor|architect|restructure|modular/.test(text)) preset = 'architecture'
174
+ else if (/security|auth|permission|access/.test(text)) preset = 'security'
175
+ else if (/performance|slow|optimi|cache/.test(text)) preset = 'performance'
176
+ else if (/fix|bug|error|issue|broken/.test(text)) preset = 'bugfix'
177
+
178
+ return ANGLE_PRESETS[preset].slice(0, count)
179
+ }
180
+
181
+ const selectedAngles = selectAngles(task_description, complexity === 'High' ? 4 : (complexity === 'Medium' ? 3 : 1))
182
+
183
+ console.log(`
184
+ ## Exploration Plan
185
+
186
+ Task Complexity: ${complexity}
187
+ Selected Angles: ${selectedAngles.join(', ')}
188
+
189
+ Launching ${selectedAngles.length} parallel explorations...
190
+ `)
191
+ ```
192
+
193
+ **Launch Parallel Explorations** - Orchestrator assigns angle to each agent:
194
+
195
+ **⚠️ CRITICAL - NO BACKGROUND EXECUTION**:
196
+ - **MUST NOT use `run_in_background: true`** - exploration results are REQUIRED before planning
197
+
198
+
199
+ ```javascript
200
+ // Launch agents with pre-assigned angles
201
+ const explorationTasks = selectedAngles.map((angle, index) =>
202
+ Task(
203
+ subagent_type="cli-explore-agent",
204
+ run_in_background=false, // ⚠️ MANDATORY: Must wait for results
205
+ description=`Explore: ${angle}`,
206
+ prompt=`
207
+ ## Task Objective
208
+ Execute **${angle}** exploration for task planning context. Analyze codebase from this specific angle to discover relevant structure, patterns, and constraints.
209
+
210
+ ## Assigned Context
211
+ - **Exploration Angle**: ${angle}
212
+ - **Task Description**: ${task_description}
213
+ - **Exploration Index**: ${index + 1} of ${selectedAngles.length}
214
+ - **Output File**: ${sessionFolder}/exploration-${angle}.json
215
+
216
+ ## MANDATORY FIRST STEPS (Execute by Agent)
217
+ **You (cli-explore-agent) MUST execute these steps in order:**
218
+ 1. Run: ccw tool exec get_modules_by_depth '{}' (project structure)
219
+ 2. Run: rg -l "{keyword_from_task}" --type ts (locate relevant files)
220
+ 3. Execute: cat ~/.claude/workflows/cli-templates/schemas/explore-json-schema.json (get output schema reference)
221
+
222
+ ## Exploration Strategy (${angle} focus)
223
+
224
+ **Step 1: Structural Scan** (Bash)
225
+ - get_modules_by_depth.sh → identify modules related to ${angle}
226
+ - find/rg → locate files relevant to ${angle} aspect
227
+ - Analyze imports/dependencies from ${angle} perspective
228
+
229
+ **Step 2: Semantic Analysis** (Gemini CLI)
230
+ - How does existing code handle ${angle} concerns?
231
+ - What patterns are used for ${angle}?
232
+ - Where would new code integrate from ${angle} viewpoint?
233
+
234
+ **Step 3: Write Output**
235
+ - Consolidate ${angle} findings into JSON
236
+ - Identify ${angle}-specific clarification needs
237
+
238
+ ## Expected Output
239
+
240
+ **File**: ${sessionFolder}/exploration-${angle}.json
241
+
242
+ **Schema Reference**: Schema obtained in MANDATORY FIRST STEPS step 3, follow schema exactly
243
+
244
+ **Required Fields** (all ${angle} focused):
245
+ - project_structure: Modules/architecture relevant to ${angle}
246
+ - relevant_files: Files affected from ${angle} perspective
247
+ **IMPORTANT**: Use object format with relevance scores for synthesis:
248
+ \`[{path: "src/file.ts", relevance: 0.85, rationale: "Core ${angle} logic"}]\`
249
+ Scores: 0.7+ high priority, 0.5-0.7 medium, <0.5 low
250
+ - patterns: ${angle}-related patterns to follow
251
+ - dependencies: Dependencies relevant to ${angle}
252
+ - integration_points: Where to integrate from ${angle} viewpoint (include file:line locations)
253
+ - constraints: ${angle}-specific limitations/conventions
254
+ - clarification_needs: ${angle}-related ambiguities (options array + recommended index)
255
+ - _metadata.exploration_angle: "${angle}"
256
+
257
+ ## Success Criteria
258
+ - [ ] Schema obtained via cat explore-json-schema.json
259
+ - [ ] get_modules_by_depth.sh executed
260
+ - [ ] At least 3 relevant files identified with ${angle} rationale
261
+ - [ ] Patterns are actionable (code examples, not generic advice)
262
+ - [ ] Integration points include file:line locations
263
+ - [ ] Constraints are project-specific to ${angle}
264
+ - [ ] JSON output follows schema exactly
265
+ - [ ] clarification_needs includes options + recommended
266
+
267
+ ## Output
268
+ Write: ${sessionFolder}/exploration-${angle}.json
269
+ Return: 2-3 sentence summary of ${angle} findings
270
+ `
271
+ )
272
+ )
273
+
274
+ // Execute all exploration tasks in parallel
275
+ ```
276
+
277
+ **Auto-discover Generated Exploration Files**:
278
+ ```javascript
279
+ // After explorations complete, auto-discover all exploration-*.json files
280
+ const explorationFiles = bash(`find ${sessionFolder} -name "exploration-*.json" -type f`)
281
+ .split('\n')
282
+ .filter(f => f.trim())
283
+
284
+ // Read metadata to build manifest
285
+ const explorationManifest = {
286
+ session_id: sessionId,
287
+ task_description: task_description,
288
+ timestamp: getUtc8ISOString(),
289
+ complexity: complexity,
290
+ exploration_count: explorationCount,
291
+ explorations: explorationFiles.map(file => {
292
+ const data = JSON.parse(Read(file))
293
+ const filename = path.basename(file)
294
+ return {
295
+ angle: data._metadata.exploration_angle,
296
+ file: filename,
297
+ path: file,
298
+ index: data._metadata.exploration_index
299
+ }
300
+ })
301
+ }
302
+
303
+ Write(`${sessionFolder}/explorations-manifest.json`, JSON.stringify(explorationManifest, null, 2))
304
+
305
+ console.log(`
306
+ ## Exploration Complete
307
+
308
+ Generated exploration files in ${sessionFolder}:
309
+ ${explorationManifest.explorations.map(e => `- exploration-${e.angle}.json (angle: ${e.angle})`).join('\n')}
310
+
311
+ Manifest: explorations-manifest.json
312
+ Angles explored: ${explorationManifest.explorations.map(e => e.angle).join(', ')}
313
+ `)
314
+ ```
315
+
316
+ **Output**:
317
+ - `${sessionFolder}/exploration-{angle1}.json`
318
+ - `${sessionFolder}/exploration-{angle2}.json`
319
+ - ... (1-4 files based on complexity)
320
+ - `${sessionFolder}/explorations-manifest.json`
321
+
322
+ ---
323
+
324
+ ### Phase 2: Clarification (Optional, Multi-Round)
325
+
326
+ **Skip if**: No exploration or `clarification_needs` is empty across all explorations
327
+
328
+ **⚠️ CRITICAL**: AskUserQuestion tool limits max 4 questions per call. **MUST execute multiple rounds** to exhaust all clarification needs - do NOT stop at round 1.
329
+
330
+ **Aggregate clarification needs from all exploration angles**:
331
+ ```javascript
332
+ // Load manifest and all exploration files
333
+ const manifest = JSON.parse(Read(`${sessionFolder}/explorations-manifest.json`))
334
+ const explorations = manifest.explorations.map(exp => ({
335
+ angle: exp.angle,
336
+ data: JSON.parse(Read(exp.path))
337
+ }))
338
+
339
+ // Aggregate clarification needs from all explorations
340
+ const allClarifications = []
341
+ explorations.forEach(exp => {
342
+ if (exp.data.clarification_needs?.length > 0) {
343
+ exp.data.clarification_needs.forEach(need => {
344
+ allClarifications.push({
345
+ ...need,
346
+ source_angle: exp.angle
347
+ })
348
+ })
349
+ }
350
+ })
351
+
352
+ // Deduplicate exact same questions only
353
+ const seen = new Set()
354
+ const dedupedClarifications = allClarifications.filter(c => {
355
+ const key = c.question.toLowerCase()
356
+ if (seen.has(key)) return false
357
+ seen.add(key)
358
+ return true
359
+ })
360
+
361
+ // Multi-round clarification: batch questions (max 4 per round)
362
+ if (dedupedClarifications.length > 0) {
363
+ const BATCH_SIZE = 4
364
+ const totalRounds = Math.ceil(dedupedClarifications.length / BATCH_SIZE)
365
+
366
+ for (let i = 0; i < dedupedClarifications.length; i += BATCH_SIZE) {
367
+ const batch = dedupedClarifications.slice(i, i + BATCH_SIZE)
368
+ const currentRound = Math.floor(i / BATCH_SIZE) + 1
369
+
370
+ console.log(`### Clarification Round ${currentRound}/${totalRounds}`)
371
+
372
+ AskUserQuestion({
373
+ questions: batch.map(need => ({
374
+ question: `[${need.source_angle}] ${need.question}\n\nContext: ${need.context}`,
375
+ header: need.source_angle.substring(0, 12),
376
+ multiSelect: false,
377
+ options: need.options.map((opt, index) => ({
378
+ label: need.recommended === index ? `${opt} ★` : opt,
379
+ description: need.recommended === index ? `Recommended` : `Use ${opt}`
380
+ }))
381
+ }))
382
+ })
383
+
384
+ // Store batch responses in clarificationContext before next round
385
+ }
386
+ }
387
+ ```
388
+
389
+ **Output**: `clarificationContext` (in-memory)
390
+
391
+ ---
392
+
393
+ ### Phase 3: Planning
394
+
395
+ **Planning Strategy Selection** (based on Phase 1 complexity):
396
+
397
+ **IMPORTANT**: Phase 3 is **planning only** - NO code execution. All execution happens in Phase 5 via lite-execute.
398
+
399
+ **Low Complexity** - Direct planning by Claude:
400
+ ```javascript
401
+ // Step 1: Read schema
402
+ const schema = Bash(`cat ~/.claude/workflows/cli-templates/schemas/plan-json-schema.json`)
403
+
404
+ // Step 2: ⚠️ MANDATORY - Read and review ALL exploration files
405
+ const manifest = JSON.parse(Read(`${sessionFolder}/explorations-manifest.json`))
406
+ manifest.explorations.forEach(exp => {
407
+ const explorationData = Read(exp.path)
408
+ console.log(`\n### Exploration: ${exp.angle}\n${explorationData}`)
409
+ })
410
+
411
+ // Step 3: Generate plan following schema (Claude directly, no agent)
412
+ // ⚠️ Plan MUST incorporate insights from exploration files read in Step 2
413
+ const plan = {
414
+ summary: "...",
415
+ approach: "...",
416
+ tasks: [...], // Each task: { id, title, scope, ..., depends_on, execution_group, complexity }
417
+ estimated_time: "...",
418
+ recommended_execution: "Agent",
419
+ complexity: "Low",
420
+ _metadata: { timestamp: getUtc8ISOString(), source: "direct-planning", planning_mode: "direct" }
421
+ }
422
+
423
+ // Step 4: Write plan to session folder
424
+ Write(`${sessionFolder}/plan.json`, JSON.stringify(plan, null, 2))
425
+
426
+ // Step 5: MUST continue to Phase 4 (Confirmation) - DO NOT execute code here
427
+ ```
428
+
429
+ **Medium/High Complexity** - Invoke cli-lite-planning-agent:
430
+
431
+ ```javascript
432
+ Task(
433
+ subagent_type="cli-lite-planning-agent",
434
+ description="Generate detailed implementation plan",
435
+ prompt=`
436
+ Generate implementation plan and write plan.json.
437
+
438
+ ## Output Schema Reference
439
+ Execute: cat ~/.claude/workflows/cli-templates/schemas/plan-json-schema.json (get schema reference before generating plan)
440
+
441
+ ## Task Description
442
+ ${task_description}
443
+
444
+ ## Multi-Angle Exploration Context
445
+
446
+ ${manifest.explorations.map(exp => `### Exploration: ${exp.angle} (${exp.file})
447
+ Path: ${exp.path}
448
+
449
+ Read this file for detailed ${exp.angle} analysis.`).join('\n\n')}
450
+
451
+ Total explorations: ${manifest.exploration_count}
452
+ Angles covered: ${manifest.explorations.map(e => e.angle).join(', ')}
453
+
454
+ Manifest: ${sessionFolder}/explorations-manifest.json
455
+
456
+ ## User Clarifications
457
+ ${JSON.stringify(clarificationContext) || "None"}
458
+
459
+ ## Complexity Level
460
+ ${complexity}
461
+
462
+ ## Requirements
463
+ Generate plan.json with:
464
+ - summary: 2-3 sentence overview
465
+ - approach: High-level implementation strategy (incorporating insights from all exploration angles)
466
+ - tasks: 2-7 structured tasks (**IMPORTANT: group by feature/module, NOT by file**)
467
+ - **Task Granularity Principle**: Each task = one complete feature unit or module
468
+ - title: action verb + target module/feature (e.g., "Implement auth token refresh")
469
+ - scope: module path (src/auth/) or feature name, prefer module-level over single file
470
+ - action, description
471
+ - modification_points: ALL files to modify for this feature (group related changes)
472
+ - implementation (3-7 steps covering all modification_points)
473
+ - reference (pattern, files, examples)
474
+ - acceptance (2-4 criteria for the entire feature)
475
+ - depends_on: task IDs this task depends on (use sparingly, only for true dependencies)
476
+ - estimated_time, recommended_execution, complexity
477
+ - _metadata:
478
+ - timestamp, source, planning_mode
479
+ - exploration_angles: ${JSON.stringify(manifest.explorations.map(e => e.angle))}
480
+
481
+ ## Task Grouping Rules
482
+ 1. **Group by feature**: All changes for one feature = one task (even if 3-5 files)
483
+ 2. **Group by context**: Tasks with similar context or related functional changes can be grouped together
484
+ 3. **Minimize agent count**: Simple, unrelated tasks can also be grouped to reduce agent execution overhead
485
+ 4. **Avoid file-per-task**: Do NOT create separate tasks for each file
486
+ 5. **Substantial tasks**: Each task should represent 15-60 minutes of work
487
+ 6. **True dependencies only**: Only use depends_on when Task B cannot start without Task A's output
488
+ 7. **Prefer parallel**: Most tasks should be independent (no depends_on)
489
+
490
+ ## Execution
491
+ 1. Read ALL exploration files for comprehensive context
492
+ 2. Execute CLI planning using Gemini (Qwen fallback)
493
+ 3. Synthesize findings from multiple exploration angles
494
+ 4. Parse output and structure plan
495
+ 5. Write JSON: Write('${sessionFolder}/plan.json', jsonContent)
496
+ 6. Return brief completion summary
497
+ `
498
+ )
499
+ ```
500
+
501
+ **Output**: `${sessionFolder}/plan.json`
502
+
503
+ ---
504
+
505
+ ### Phase 4: Task Confirmation & Execution Selection
506
+
507
+ **Step 4.1: Display Plan**
508
+ ```javascript
509
+ const plan = JSON.parse(Read(`${sessionFolder}/plan.json`))
510
+
511
+ console.log(`
512
+ ## Implementation Plan
513
+
514
+ **Summary**: ${plan.summary}
515
+ **Approach**: ${plan.approach}
516
+
517
+ **Tasks** (${plan.tasks.length}):
518
+ ${plan.tasks.map((t, i) => `${i+1}. ${t.title} (${t.file})`).join('\n')}
519
+
520
+ **Complexity**: ${plan.complexity}
521
+ **Estimated Time**: ${plan.estimated_time}
522
+ **Recommended**: ${plan.recommended_execution}
523
+ `)
524
+ ```
525
+
526
+ **Step 4.2: Collect Confirmation**
527
+ ```javascript
528
+ AskUserQuestion({
529
+ questions: [
530
+ {
531
+ question: `Confirm plan? (${plan.tasks.length} tasks, ${plan.complexity})`,
532
+ header: "Confirm",
533
+ multiSelect: true,
534
+ options: [
535
+ { label: "Allow", description: "Proceed as-is" },
536
+ { label: "Modify", description: "Adjust before execution" },
537
+ { label: "Cancel", description: "Abort workflow" }
538
+ ]
539
+ },
540
+ {
541
+ question: "Execution method:",
542
+ header: "Execution",
543
+ multiSelect: false,
544
+ options: [
545
+ { label: "Agent", description: "@code-developer agent" },
546
+ { label: "Codex", description: "codex CLI tool" },
547
+ { label: "Auto", description: `Auto: ${plan.complexity === 'Low' ? 'Agent' : 'Codex'}` }
548
+ ]
549
+ },
550
+ {
551
+ question: "Code review after execution?",
552
+ header: "Review",
553
+ multiSelect: false,
554
+ options: [
555
+ { label: "Gemini Review", description: "Gemini CLI" },
556
+ { label: "Agent Review", description: "@code-reviewer" },
557
+ { label: "Skip", description: "No review" }
558
+ ]
559
+ }
560
+ ]
561
+ })
562
+ ```
563
+
564
+ ---
565
+
566
+ ### Phase 5: Dispatch to Execution
567
+
568
+ **CRITICAL**: lite-plan NEVER executes code directly. ALL execution MUST go through lite-execute.
569
+
570
+ **Step 5.1: Build executionContext**
571
+
572
+ ```javascript
573
+ // Load manifest and all exploration files
574
+ const manifest = JSON.parse(Read(`${sessionFolder}/explorations-manifest.json`))
575
+ const explorations = {}
576
+
577
+ manifest.explorations.forEach(exp => {
578
+ if (file_exists(exp.path)) {
579
+ explorations[exp.angle] = JSON.parse(Read(exp.path))
580
+ }
581
+ })
582
+
583
+ const plan = JSON.parse(Read(`${sessionFolder}/plan.json`))
584
+
585
+ executionContext = {
586
+ planObject: plan,
587
+ explorationsContext: explorations,
588
+ explorationAngles: manifest.explorations.map(e => e.angle),
589
+ explorationManifest: manifest,
590
+ clarificationContext: clarificationContext || null,
591
+ executionMethod: userSelection.execution_method,
592
+ codeReviewTool: userSelection.code_review_tool,
593
+ originalUserInput: task_description,
594
+ session: {
595
+ id: sessionId,
596
+ folder: sessionFolder,
597
+ artifacts: {
598
+ explorations: manifest.explorations.map(exp => ({
599
+ angle: exp.angle,
600
+ path: exp.path
601
+ })),
602
+ explorations_manifest: `${sessionFolder}/explorations-manifest.json`,
603
+ plan: `${sessionFolder}/plan.json`
604
+ }
605
+ }
606
+ }
607
+ ```
608
+
609
+ **Step 5.2: Dispatch**
610
+
611
+ ```javascript
612
+ SlashCommand(command="/workflow:lite-execute --in-memory")
613
+ ```
614
+
615
+ ## Session Folder Structure
616
+
617
+ ```
618
+ .workflow/.lite-plan/{task-slug}-{YYYY-MM-DD}/
619
+ ├── exploration-{angle1}.json # Exploration angle 1
620
+ ├── exploration-{angle2}.json # Exploration angle 2
621
+ ├── exploration-{angle3}.json # Exploration angle 3 (if applicable)
622
+ ├── exploration-{angle4}.json # Exploration angle 4 (if applicable)
623
+ ├── explorations-manifest.json # Exploration index
624
+ └── plan.json # Implementation plan
625
+ ```
626
+
627
+ **Example**:
628
+ ```
629
+ .workflow/.lite-plan/implement-jwt-refresh-2025-11-25-14-30-25/
630
+ ├── exploration-architecture.json
631
+ ├── exploration-auth-patterns.json
632
+ ├── exploration-security.json
633
+ ├── explorations-manifest.json
634
+ └── plan.json
635
+ ```
636
+
637
+ ## Error Handling
638
+
639
+ | Error | Resolution |
640
+ |-------|------------|
641
+ | Exploration agent failure | Skip exploration, continue with task description only |
642
+ | Planning agent failure | Fallback to direct planning by Claude |
643
+ | Clarification timeout | Use exploration findings as-is |
644
+ | Confirmation timeout | Save context, display resume instructions |
645
+ | Modify loop > 3 times | Suggest breaking task or using /workflow:plan |