claude-code-workflow 6.2.9 → 6.3.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 (205) hide show
  1. package/.claude/CLAUDE.md +17 -2
  2. package/.claude/commands/workflow/lite-plan.md +7 -4
  3. package/.claude/workflows/cli-templates/protocols/analysis-protocol.md +11 -4
  4. package/.claude/workflows/cli-templates/protocols/write-protocol.md +10 -75
  5. package/.claude/workflows/cli-tools-usage.md +14 -24
  6. package/.claude/workflows/context-tools-ace.md +105 -0
  7. package/.codex/AGENTS.md +51 -1
  8. package/.codex/prompts/compact.md +378 -0
  9. package/.gemini/GEMINI.md +57 -20
  10. package/ccw/dist/cli.d.ts.map +1 -1
  11. package/ccw/dist/cli.js +3 -1
  12. package/ccw/dist/cli.js.map +1 -1
  13. package/ccw/dist/commands/cli.d.ts +2 -0
  14. package/ccw/dist/commands/cli.d.ts.map +1 -1
  15. package/ccw/dist/commands/cli.js +129 -8
  16. package/ccw/dist/commands/cli.js.map +1 -1
  17. package/ccw/dist/commands/hook.d.ts.map +1 -1
  18. package/ccw/dist/commands/hook.js +3 -2
  19. package/ccw/dist/commands/hook.js.map +1 -1
  20. package/ccw/dist/config/litellm-api-config-manager.d.ts +180 -0
  21. package/ccw/dist/config/litellm-api-config-manager.d.ts.map +1 -0
  22. package/ccw/dist/config/litellm-api-config-manager.js +770 -0
  23. package/ccw/dist/config/litellm-api-config-manager.js.map +1 -0
  24. package/ccw/dist/config/provider-models.d.ts +73 -0
  25. package/ccw/dist/config/provider-models.d.ts.map +1 -0
  26. package/ccw/dist/config/provider-models.js +172 -0
  27. package/ccw/dist/config/provider-models.js.map +1 -0
  28. package/ccw/dist/core/cache-manager.d.ts.map +1 -1
  29. package/ccw/dist/core/cache-manager.js +3 -5
  30. package/ccw/dist/core/cache-manager.js.map +1 -1
  31. package/ccw/dist/core/dashboard-generator.d.ts.map +1 -1
  32. package/ccw/dist/core/dashboard-generator.js +3 -1
  33. package/ccw/dist/core/dashboard-generator.js.map +1 -1
  34. package/ccw/dist/core/routes/cli-routes.d.ts.map +1 -1
  35. package/ccw/dist/core/routes/cli-routes.js +208 -0
  36. package/ccw/dist/core/routes/cli-routes.js.map +1 -1
  37. package/ccw/dist/core/routes/codexlens-routes.d.ts.map +1 -1
  38. package/ccw/dist/core/routes/codexlens-routes.js +234 -18
  39. package/ccw/dist/core/routes/codexlens-routes.js.map +1 -1
  40. package/ccw/dist/core/routes/hooks-routes.d.ts.map +1 -1
  41. package/ccw/dist/core/routes/hooks-routes.js +30 -32
  42. package/ccw/dist/core/routes/hooks-routes.js.map +1 -1
  43. package/ccw/dist/core/routes/litellm-api-routes.d.ts +21 -0
  44. package/ccw/dist/core/routes/litellm-api-routes.d.ts.map +1 -0
  45. package/ccw/dist/core/routes/litellm-api-routes.js +780 -0
  46. package/ccw/dist/core/routes/litellm-api-routes.js.map +1 -0
  47. package/ccw/dist/core/routes/litellm-routes.d.ts +20 -0
  48. package/ccw/dist/core/routes/litellm-routes.d.ts.map +1 -0
  49. package/ccw/dist/core/routes/litellm-routes.js +85 -0
  50. package/ccw/dist/core/routes/litellm-routes.js.map +1 -0
  51. package/ccw/dist/core/routes/mcp-routes.js +2 -2
  52. package/ccw/dist/core/routes/mcp-routes.js.map +1 -1
  53. package/ccw/dist/core/routes/status-routes.d.ts.map +1 -1
  54. package/ccw/dist/core/routes/status-routes.js +39 -0
  55. package/ccw/dist/core/routes/status-routes.js.map +1 -1
  56. package/ccw/dist/core/server.d.ts.map +1 -1
  57. package/ccw/dist/core/server.js +15 -1
  58. package/ccw/dist/core/server.js.map +1 -1
  59. package/ccw/dist/mcp-server/index.js +1 -1
  60. package/ccw/dist/mcp-server/index.js.map +1 -1
  61. package/ccw/dist/tools/claude-cli-tools.d.ts +97 -0
  62. package/ccw/dist/tools/claude-cli-tools.d.ts.map +1 -0
  63. package/ccw/dist/tools/claude-cli-tools.js +276 -0
  64. package/ccw/dist/tools/claude-cli-tools.js.map +1 -0
  65. package/ccw/dist/tools/cli-executor.d.ts.map +1 -1
  66. package/ccw/dist/tools/cli-executor.js +80 -20
  67. package/ccw/dist/tools/cli-executor.js.map +1 -1
  68. package/ccw/dist/tools/codex-lens.d.ts +9 -2
  69. package/ccw/dist/tools/codex-lens.d.ts.map +1 -1
  70. package/ccw/dist/tools/codex-lens.js +114 -9
  71. package/ccw/dist/tools/codex-lens.js.map +1 -1
  72. package/ccw/dist/tools/context-cache-store.d.ts +136 -0
  73. package/ccw/dist/tools/context-cache-store.d.ts.map +1 -0
  74. package/ccw/dist/tools/context-cache-store.js +256 -0
  75. package/ccw/dist/tools/context-cache-store.js.map +1 -0
  76. package/ccw/dist/tools/context-cache.d.ts +56 -0
  77. package/ccw/dist/tools/context-cache.d.ts.map +1 -0
  78. package/ccw/dist/tools/context-cache.js +294 -0
  79. package/ccw/dist/tools/context-cache.js.map +1 -0
  80. package/ccw/dist/tools/core-memory.d.ts.map +1 -1
  81. package/ccw/dist/tools/core-memory.js +33 -19
  82. package/ccw/dist/tools/core-memory.js.map +1 -1
  83. package/ccw/dist/tools/index.d.ts.map +1 -1
  84. package/ccw/dist/tools/index.js +2 -0
  85. package/ccw/dist/tools/index.js.map +1 -1
  86. package/ccw/dist/tools/litellm-client.d.ts +85 -0
  87. package/ccw/dist/tools/litellm-client.d.ts.map +1 -0
  88. package/ccw/dist/tools/litellm-client.js +188 -0
  89. package/ccw/dist/tools/litellm-client.js.map +1 -0
  90. package/ccw/dist/tools/litellm-executor.d.ts +34 -0
  91. package/ccw/dist/tools/litellm-executor.d.ts.map +1 -0
  92. package/ccw/dist/tools/litellm-executor.js +192 -0
  93. package/ccw/dist/tools/litellm-executor.js.map +1 -0
  94. package/ccw/dist/tools/pattern-parser.d.ts +55 -0
  95. package/ccw/dist/tools/pattern-parser.d.ts.map +1 -0
  96. package/ccw/dist/tools/pattern-parser.js +237 -0
  97. package/ccw/dist/tools/pattern-parser.js.map +1 -0
  98. package/ccw/dist/tools/smart-search.d.ts +1 -0
  99. package/ccw/dist/tools/smart-search.d.ts.map +1 -1
  100. package/ccw/dist/tools/smart-search.js +117 -41
  101. package/ccw/dist/tools/smart-search.js.map +1 -1
  102. package/ccw/dist/types/litellm-api-config.d.ts +294 -0
  103. package/ccw/dist/types/litellm-api-config.d.ts.map +1 -0
  104. package/ccw/dist/types/litellm-api-config.js +8 -0
  105. package/ccw/dist/types/litellm-api-config.js.map +1 -0
  106. package/ccw/src/cli.ts +3 -1
  107. package/ccw/src/commands/cli.ts +153 -9
  108. package/ccw/src/commands/hook.ts +3 -2
  109. package/ccw/src/config/.litellm-api-config-manager.ts.2025-12-23T11-57-43-727Z.bak +441 -0
  110. package/ccw/src/config/litellm-api-config-manager.ts +1012 -0
  111. package/ccw/src/config/provider-models.ts +222 -0
  112. package/ccw/src/core/cache-manager.ts +292 -294
  113. package/ccw/src/core/dashboard-generator.ts +3 -1
  114. package/ccw/src/core/routes/cli-routes.ts +234 -0
  115. package/ccw/src/core/routes/codexlens-routes.ts +241 -19
  116. package/ccw/src/core/routes/hooks-routes.ts +399 -405
  117. package/ccw/src/core/routes/litellm-api-routes.ts +930 -0
  118. package/ccw/src/core/routes/litellm-routes.ts +107 -0
  119. package/ccw/src/core/routes/mcp-routes.ts +1271 -1271
  120. package/ccw/src/core/routes/status-routes.ts +51 -0
  121. package/ccw/src/core/server.ts +15 -1
  122. package/ccw/src/mcp-server/index.ts +1 -1
  123. package/ccw/src/templates/dashboard-css/12-cli-legacy.css +44 -0
  124. package/ccw/src/templates/dashboard-css/18-cli-settings.css +34 -0
  125. package/ccw/src/templates/dashboard-css/31-api-settings.css +2265 -0
  126. package/ccw/src/templates/dashboard-js/components/cli-history.js +15 -8
  127. package/ccw/src/templates/dashboard-js/components/cli-status.js +376 -9
  128. package/ccw/src/templates/dashboard-js/components/navigation.js +329 -313
  129. package/ccw/src/templates/dashboard-js/i18n.js +589 -3
  130. package/ccw/src/templates/dashboard-js/views/api-settings.js +3362 -0
  131. package/ccw/src/templates/dashboard-js/views/cli-manager.js +212 -24
  132. package/ccw/src/templates/dashboard-js/views/codexlens-manager.js +1265 -27
  133. package/ccw/src/templates/dashboard.html +840 -831
  134. package/ccw/src/tools/claude-cli-tools.ts +371 -0
  135. package/ccw/src/tools/cli-executor.ts +87 -20
  136. package/ccw/src/tools/codex-lens.ts +146 -9
  137. package/ccw/src/tools/context-cache-store.ts +368 -0
  138. package/ccw/src/tools/context-cache.ts +393 -0
  139. package/ccw/src/tools/core-memory.ts +33 -19
  140. package/ccw/src/tools/index.ts +2 -0
  141. package/ccw/src/tools/litellm-client.ts +246 -0
  142. package/ccw/src/tools/litellm-executor.ts +241 -0
  143. package/ccw/src/tools/pattern-parser.ts +329 -0
  144. package/ccw/src/tools/smart-search.ts +142 -41
  145. package/ccw/src/types/litellm-api-config.ts +402 -0
  146. package/ccw-litellm/README.md +180 -0
  147. package/ccw-litellm/pyproject.toml +35 -0
  148. package/ccw-litellm/src/ccw_litellm/__init__.py +47 -0
  149. package/ccw-litellm/src/ccw_litellm/__pycache__/__init__.cpython-313.pyc +0 -0
  150. package/ccw-litellm/src/ccw_litellm/__pycache__/cli.cpython-313.pyc +0 -0
  151. package/ccw-litellm/src/ccw_litellm/cli.py +108 -0
  152. package/ccw-litellm/src/ccw_litellm/clients/__init__.py +12 -0
  153. package/ccw-litellm/src/ccw_litellm/clients/__pycache__/__init__.cpython-313.pyc +0 -0
  154. package/ccw-litellm/src/ccw_litellm/clients/__pycache__/litellm_embedder.cpython-313.pyc +0 -0
  155. package/ccw-litellm/src/ccw_litellm/clients/__pycache__/litellm_llm.cpython-313.pyc +0 -0
  156. package/ccw-litellm/src/ccw_litellm/clients/litellm_embedder.py +251 -0
  157. package/ccw-litellm/src/ccw_litellm/clients/litellm_llm.py +165 -0
  158. package/ccw-litellm/src/ccw_litellm/config/__init__.py +22 -0
  159. package/ccw-litellm/src/ccw_litellm/config/__pycache__/__init__.cpython-313.pyc +0 -0
  160. package/ccw-litellm/src/ccw_litellm/config/__pycache__/loader.cpython-313.pyc +0 -0
  161. package/ccw-litellm/src/ccw_litellm/config/__pycache__/models.cpython-313.pyc +0 -0
  162. package/ccw-litellm/src/ccw_litellm/config/loader.py +316 -0
  163. package/ccw-litellm/src/ccw_litellm/config/models.py +130 -0
  164. package/ccw-litellm/src/ccw_litellm/interfaces/__init__.py +14 -0
  165. package/ccw-litellm/src/ccw_litellm/interfaces/__pycache__/__init__.cpython-313.pyc +0 -0
  166. package/ccw-litellm/src/ccw_litellm/interfaces/__pycache__/embedder.cpython-313.pyc +0 -0
  167. package/ccw-litellm/src/ccw_litellm/interfaces/__pycache__/llm.cpython-313.pyc +0 -0
  168. package/ccw-litellm/src/ccw_litellm/interfaces/embedder.py +52 -0
  169. package/ccw-litellm/src/ccw_litellm/interfaces/llm.py +45 -0
  170. package/codex-lens/src/codexlens/__pycache__/config.cpython-313.pyc +0 -0
  171. package/codex-lens/src/codexlens/cli/__pycache__/commands.cpython-313.pyc +0 -0
  172. package/codex-lens/src/codexlens/cli/__pycache__/embedding_manager.cpython-313.pyc +0 -0
  173. package/codex-lens/src/codexlens/cli/__pycache__/model_manager.cpython-313.pyc +0 -0
  174. package/codex-lens/src/codexlens/cli/__pycache__/output.cpython-313.pyc +0 -0
  175. package/codex-lens/src/codexlens/cli/commands.py +360 -22
  176. package/codex-lens/src/codexlens/cli/embedding_manager.py +660 -56
  177. package/codex-lens/src/codexlens/cli/model_manager.py +31 -18
  178. package/codex-lens/src/codexlens/cli/output.py +12 -1
  179. package/codex-lens/src/codexlens/config.py +93 -0
  180. package/codex-lens/src/codexlens/search/__pycache__/chain_search.cpython-313.pyc +0 -0
  181. package/codex-lens/src/codexlens/search/__pycache__/hybrid_search.cpython-313.pyc +0 -0
  182. package/codex-lens/src/codexlens/search/__pycache__/ranking.cpython-313.pyc +0 -0
  183. package/codex-lens/src/codexlens/search/chain_search.py +6 -2
  184. package/codex-lens/src/codexlens/search/hybrid_search.py +44 -21
  185. package/codex-lens/src/codexlens/search/ranking.py +1 -1
  186. package/codex-lens/src/codexlens/semantic/__init__.py +42 -0
  187. package/codex-lens/src/codexlens/semantic/__pycache__/__init__.cpython-313.pyc +0 -0
  188. package/codex-lens/src/codexlens/semantic/__pycache__/base.cpython-313.pyc +0 -0
  189. package/codex-lens/src/codexlens/semantic/__pycache__/chunker.cpython-313.pyc +0 -0
  190. package/codex-lens/src/codexlens/semantic/__pycache__/embedder.cpython-313.pyc +0 -0
  191. package/codex-lens/src/codexlens/semantic/__pycache__/factory.cpython-313.pyc +0 -0
  192. package/codex-lens/src/codexlens/semantic/__pycache__/gpu_support.cpython-313.pyc +0 -0
  193. package/codex-lens/src/codexlens/semantic/__pycache__/litellm_embedder.cpython-313.pyc +0 -0
  194. package/codex-lens/src/codexlens/semantic/__pycache__/vector_store.cpython-313.pyc +0 -0
  195. package/codex-lens/src/codexlens/semantic/base.py +61 -0
  196. package/codex-lens/src/codexlens/semantic/chunker.py +43 -20
  197. package/codex-lens/src/codexlens/semantic/embedder.py +60 -13
  198. package/codex-lens/src/codexlens/semantic/factory.py +98 -0
  199. package/codex-lens/src/codexlens/semantic/gpu_support.py +225 -3
  200. package/codex-lens/src/codexlens/semantic/litellm_embedder.py +144 -0
  201. package/codex-lens/src/codexlens/semantic/rotational_embedder.py +434 -0
  202. package/codex-lens/src/codexlens/semantic/vector_store.py +33 -8
  203. package/codex-lens/src/codexlens/storage/migrations/__pycache__/migration_004_dual_fts.cpython-313.pyc +0 -0
  204. package/package.json +3 -1
  205. package/.codex/prompts.zip +0 -0
package/.claude/CLAUDE.md CHANGED
@@ -2,9 +2,24 @@
2
2
 
3
3
  - **CLI Tools Usage**: @~/.claude/workflows/cli-tools-usage.md
4
4
  - **Coding Philosophy**: @~/.claude/workflows/coding-philosophy.md
5
- - **Context Requirements**: @~/.claude/workflows/context-tools.md
5
+ - **Context Requirements**: @~/.claude/workflows/context-tools-ace.md
6
6
  - **File Modification**: @~/.claude/workflows/file-modification.md
7
+ - **CLI Endpoints Config**: @.claude/cli-tools.json
8
+
9
+ ## CLI Endpoints
10
+
11
+ **Strictly follow the @.claude/cli-tools.json configuration**
12
+
13
+ Available CLI endpoints are dynamically defined by the config file:
14
+ - Built-in tools and their enable/disable status
15
+ - Custom API endpoints registered via the Dashboard
16
+ - Managed through the CCW Dashboard Status page
7
17
 
8
18
  ## Agent Execution
9
19
 
10
- - **Always use `run_in_background = false`** for Task tool agent calls to ensure synchronous execution and immediate result visibility
20
+ - **Always use `run_in_background: false`** for Task tool agent calls: `Task({ subagent_type: "xxx", prompt: "...", run_in_background: false })` to ensure synchronous execution and immediate result visibility
21
+ - **TaskOutput usage**: Only use `TaskOutput({ task_id: "xxx", block: false })` + sleep loop to poll completion status. NEVER read intermediate output during agent/CLI execution - wait for final result only
22
+
23
+ ## Code Diagnostics
24
+
25
+ - **Prefer `mcp__ide__getDiagnostics`** for code error checking over shell-based TypeScript compilation
@@ -140,11 +140,17 @@ function selectAngles(taskDescription, count) {
140
140
 
141
141
  const selectedAngles = selectAngles(task_description, complexity === 'High' ? 4 : (complexity === 'Medium' ? 3 : 1))
142
142
 
143
+ // Planning strategy determination
144
+ const planningStrategy = complexity === 'Low'
145
+ ? 'Direct Claude Planning'
146
+ : 'cli-lite-planning-agent'
147
+
143
148
  console.log(`
144
149
  ## Exploration Plan
145
150
 
146
151
  Task Complexity: ${complexity}
147
152
  Selected Angles: ${selectedAngles.join(', ')}
153
+ Planning Strategy: ${planningStrategy}
148
154
 
149
155
  Launching ${selectedAngles.length} parallel explorations...
150
156
  `)
@@ -358,10 +364,7 @@ if (dedupedClarifications.length > 0) {
358
364
  ```javascript
359
365
  // 分配规则(优先级从高到低):
360
366
  // 1. 用户明确指定:"用 gemini 分析..." → gemini, "codex 实现..." → codex
361
- // 2. 任务类型推断:
362
- // - 分析|审查|评估|探索 → gemini
363
- // - 实现|创建|修改|修复 → codex (复杂) 或 agent (简单)
364
- // 3. 默认 → agent
367
+ // 2. 默认 → agent
365
368
 
366
369
  const executorAssignments = {} // { taskId: { executor: 'gemini'|'codex'|'agent', reason: string } }
367
370
  plan.tasks.forEach(task => {
@@ -1,10 +1,17 @@
1
1
  # Analysis Mode Protocol
2
2
 
3
3
  ## Mode Definition
4
-
5
4
  **Mode**: `analysis` (READ-ONLY)
6
- **Tools**: Gemini, Qwen (default mode)
5
+ ## Prompt Structure
7
6
 
7
+ ```
8
+ PURPOSE: [development goal]
9
+ TASK: [specific implementation task]
10
+ MODE: [auto|write]
11
+ CONTEXT: [file patterns]
12
+ EXPECTED: [deliverables]
13
+ RULES: [templates | additional constraints]
14
+ ```
8
15
  ## Operation Boundaries
9
16
 
10
17
  ### ALLOWED Operations
@@ -27,8 +34,8 @@
27
34
  2. **Read** and analyze CONTEXT files thoroughly
28
35
  3. **Identify** patterns, issues, and dependencies
29
36
  4. **Generate** insights and recommendations
30
- 5. **Output** structured analysis (text response only)
31
- 6. **Validate** EXPECTED deliverables met
37
+ 5. **Validate** EXPECTED deliverables met
38
+ 6. **Output** structured analysis (text response only)
32
39
 
33
40
  ## Core Requirements
34
41
 
@@ -1,10 +1,14 @@
1
1
  # Write Mode Protocol
2
+ ## Prompt Structure
2
3
 
3
- ## Mode Definition
4
-
5
- **Mode**: `write` (FILE OPERATIONS) / `auto` (FULL OPERATIONS)
6
- **Tools**: Codex (auto), Gemini/Qwen (write)
7
-
4
+ ```
5
+ PURPOSE: [development goal]
6
+ TASK: [specific implementation task]
7
+ MODE: [auto|write]
8
+ CONTEXT: [file patterns]
9
+ EXPECTED: [deliverables]
10
+ RULES: [templates | additional constraints]
11
+ ```
8
12
  ## Operation Boundaries
9
13
 
10
14
  ### MODE: write
@@ -15,12 +19,6 @@
15
19
 
16
20
  **Restrictions**: Follow project conventions, cannot break existing functionality
17
21
 
18
- ### MODE: auto (Codex only)
19
- - All `write` mode operations
20
- - Run tests and builds
21
- - Commit code incrementally
22
- - Full autonomous development
23
-
24
22
  **Constraint**: Must test every change
25
23
 
26
24
  ## Execution Flow
@@ -33,16 +31,6 @@
33
31
  5. **Validate** changes
34
32
  6. **Report** file changes
35
33
 
36
- ### MODE: auto
37
- 1. **Parse** all 6 fields
38
- 2. **Analyze** CONTEXT files - find 3+ similar patterns
39
- 3. **Plan** implementation following RULES
40
- 4. **Generate** code with tests
41
- 5. **Run** tests continuously
42
- 6. **Commit** working code incrementally
43
- 7. **Validate** EXPECTED deliverables
44
- 8. **Report** results
45
-
46
34
  ## Core Requirements
47
35
 
48
36
  **ALWAYS**:
@@ -61,17 +49,6 @@
61
49
  - Break backward compatibility
62
50
  - Exceed 3 failed attempts without stopping
63
51
 
64
- ## Multi-Task Execution (Resume)
65
-
66
- **First subtask**: Standard execution flow
67
- **Subsequent subtasks** (via `resume`):
68
- - Recall context from previous subtasks
69
- - Build on previous work
70
- - Maintain consistency
71
- - Test integration
72
- - Report context for next subtask
73
-
74
- ## Error Handling
75
52
 
76
53
  **Three-Attempt Rule**: On 3rd failure, stop and report what attempted, what failed, root cause
77
54
 
@@ -92,7 +69,7 @@
92
69
 
93
70
  **If template has no format** → Use default format below
94
71
 
95
- ### Single Task Implementation
72
+ ### Task Implementation
96
73
 
97
74
  ```markdown
98
75
  # Implementation: [TASK Title]
@@ -124,48 +101,6 @@
124
101
  [Recommendations if any]
125
102
  ```
126
103
 
127
- ### Multi-Task (First Subtask)
128
-
129
- ```markdown
130
- # Subtask 1/N: [TASK Title]
131
-
132
- ## Changes
133
- [List of file changes]
134
-
135
- ## Implementation
136
- [Details with code references]
137
-
138
- ## Testing
139
- ✅ Tests: X passing
140
-
141
- ## Context for Next Subtask
142
- - Key decisions: [established patterns]
143
- - Files created: [paths and purposes]
144
- - Integration points: [where next subtask should connect]
145
- ```
146
-
147
- ### Multi-Task (Subsequent Subtasks)
148
-
149
- ```markdown
150
- # Subtask N/M: [TASK Title]
151
-
152
- ## Changes
153
- [List of file changes]
154
-
155
- ## Integration Notes
156
- ✅ Compatible with previous subtask
157
- ✅ Maintains established patterns
158
-
159
- ## Implementation
160
- [Details with code references]
161
-
162
- ## Testing
163
- ✅ Tests: X passing
164
-
165
- ## Context for Next Subtask
166
- [If not final, provide context]
167
- ```
168
-
169
104
  ### Partial Completion
170
105
 
171
106
  ```markdown
@@ -362,10 +362,6 @@ ccw cli -p "RULES: \$(cat ~/.claude/workflows/cli-templates/protocols/analysis-p
362
362
  - Description: Additional directories (comma-separated)
363
363
  - Default: none
364
364
 
365
- - **`--timeout <ms>`**
366
- - Description: Timeout in milliseconds
367
- - Default: 300000
368
-
369
365
  - **`--resume [id]`**
370
366
  - Description: Resume previous session
371
367
  - Default: -
@@ -430,7 +426,7 @@ MODE: analysis
430
426
  CONTEXT: @src/auth/**/* @src/middleware/auth.ts | Memory: Using bcrypt for passwords, JWT for sessions
431
427
  EXPECTED: Security report with: severity matrix, file:line references, CVE mappings where applicable, remediation code snippets prioritized by risk
432
428
  RULES: $(cat ~/.claude/workflows/cli-templates/protocols/analysis-protocol.md) $(cat ~/.claude/workflows/cli-templates/prompts/analysis/03-assess-security-risks.txt) | Focus on authentication | Ignore test files
433
- " --tool gemini --cd src/auth --timeout 600000
429
+ " --tool gemini --mode analysis --cd src/auth
434
430
  ```
435
431
 
436
432
  **Implementation Task** (New Feature):
@@ -442,7 +438,7 @@ MODE: write
442
438
  CONTEXT: @src/middleware/**/* @src/config/**/* | Memory: Using Express.js, Redis already configured, existing middleware pattern in auth.ts
443
439
  EXPECTED: Production-ready code with: TypeScript types, unit tests, integration test, configuration example, migration guide
444
440
  RULES: $(cat ~/.claude/workflows/cli-templates/protocols/write-protocol.md) $(cat ~/.claude/workflows/cli-templates/prompts/development/02-implement-feature.txt) | Follow existing middleware patterns | No breaking changes
445
- " --tool codex --mode write --timeout 1800000
441
+ " --tool codex --mode write
446
442
  ```
447
443
 
448
444
  **Bug Fix Task**:
@@ -454,7 +450,7 @@ MODE: analysis
454
450
  CONTEXT: @src/websocket/**/* @src/services/connection-manager.ts | Memory: Using ws library, ~5000 concurrent connections in production
455
451
  EXPECTED: Root cause analysis with: memory profile, leak source (file:line), fix recommendation with code, verification steps
456
452
  RULES: $(cat ~/.claude/workflows/cli-templates/protocols/analysis-protocol.md) $(cat ~/.claude/workflows/cli-templates/prompts/analysis/01-diagnose-bug-root-cause.txt) | Focus on resource cleanup
457
- " --tool gemini --cd src --timeout 900000
453
+ " --tool gemini --mode analysis --cd src
458
454
  ```
459
455
 
460
456
  **Refactoring Task**:
@@ -466,30 +462,25 @@ MODE: write
466
462
  CONTEXT: @src/payments/**/* @src/types/payment.ts | Memory: Currently only Stripe, adding PayPal next sprint, must support future gateways
467
463
  EXPECTED: Refactored code with: strategy interface, concrete implementations, factory class, updated tests, migration checklist
468
464
  RULES: $(cat ~/.claude/workflows/cli-templates/protocols/write-protocol.md) $(cat ~/.claude/workflows/cli-templates/prompts/development/02-refactor-codebase.txt) | Preserve all existing behavior | Tests must pass
469
- " --tool gemini --mode write --timeout 1200000
465
+ " --tool gemini --mode write
470
466
  ```
471
467
  ---
472
468
 
473
- ## Configuration
474
-
475
- ### Timeout Allocation
476
-
477
- **Minimum**: 5 minutes (300000ms)
478
-
479
- - **Simple**: 5-10min (300000-600000ms)
480
- - Examples: Analysis, search
469
+ ## ⚙️ Execution Configuration
481
470
 
482
- - **Medium**: 10-20min (600000-1200000ms)
483
- - Examples: Refactoring, documentation
471
+ ### Dynamic Timeout Allocation
484
472
 
485
- - **Complex**: 20-60min (1200000-3600000ms)
486
- - Examples: Implementation, migration
473
+ **Minimum timeout: 5 minutes (300000ms)** - Never set below this threshold.
487
474
 
488
- - **Heavy**: 60-120min (3600000-7200000ms)
489
- - Examples: Large codebase, multi-file
475
+ **Timeout Ranges**:
476
+ - **Simple** (analysis, search): 5-10min (300000-600000ms)
477
+ - **Medium** (refactoring, documentation): 10-20min (600000-1200000ms)
478
+ - **Complex** (implementation, migration): 20-60min (1200000-3600000ms)
479
+ - **Heavy** (large codebase, multi-file): 60-120min (3600000-7200000ms)
490
480
 
491
- **Codex Multiplier**: 3x allocated time (minimum 15min / 900000ms)
481
+ **Codex Multiplier**: 3x of allocated time (minimum 15min / 900000ms)
492
482
 
483
+ **Auto-detection**: Analyze PURPOSE and TASK fields to determine timeout
493
484
 
494
485
  ### Permission Framework
495
486
 
@@ -523,4 +514,3 @@ RULES: $(cat ~/.claude/workflows/cli-templates/protocols/write-protocol.md) $(ca
523
514
  - [ ] **Tool selected** - `--tool gemini|qwen|codex`
524
515
  - [ ] **Template applied (REQUIRED)** - Use specific or universal fallback template
525
516
  - [ ] **Constraints specified** - Scope, requirements
526
- - [ ] **Timeout configured** - Based on complexity
@@ -0,0 +1,105 @@
1
+ ## MCP Tools Usage
2
+
3
+ ### search_context (ACE) - Code Search (REQUIRED - HIGHEST PRIORITY)
4
+
5
+ **OVERRIDES**: All other search/discovery rules in other workflow files
6
+
7
+ **When**: ANY code discovery task, including:
8
+ - Find code, understand codebase structure, locate implementations
9
+ - Explore unknown locations
10
+ - Verify file existence before reading
11
+ - Pattern-based file discovery
12
+ - Semantic code understanding
13
+
14
+ **Priority Rule**:
15
+ 1. **Always use mcp__ace-tool__search_context FIRST** for any code/file discovery
16
+ 2. Only use Built-in Grep for single-file exact line search (after location confirmed)
17
+ 3. Only use Built-in Read for known, confirmed file paths
18
+
19
+ **How**:
20
+ ```javascript
21
+ // Natural language code search - best for understanding and exploration
22
+ mcp__ace-tool__search_context({
23
+ project_root_path: "/path/to/project",
24
+ query: "authentication logic"
25
+ })
26
+
27
+ // With keywords for better semantic matching
28
+ mcp__ace-tool__search_context({
29
+ project_root_path: "/path/to/project",
30
+ query: "I want to find where the server handles user login. Keywords: auth, login, session"
31
+ })
32
+ ```
33
+
34
+ **Good Query Examples**:
35
+ - "Where is the function that handles user authentication?"
36
+ - "What tests are there for the login functionality?"
37
+ - "How is the database connected to the application?"
38
+ - "I want to find where the server handles chunk merging. Keywords: upload chunk merge"
39
+ - "Locate where the system refreshes cached data. Keywords: cache refresh, invalidation"
40
+
41
+ **Bad Query Examples** (use grep or file view instead):
42
+ - "Find definition of constructor of class Foo" (use grep tool instead)
43
+ - "Find all references to function bar" (use grep tool instead)
44
+ - "Show me how Checkout class is used in services/payment.py" (use file view tool instead)
45
+
46
+ **Key Features**:
47
+ - Real-time index of the codebase (always up-to-date)
48
+ - Cross-language retrieval support
49
+ - Semantic search with embeddings
50
+ - No manual index initialization required
51
+
52
+ ---
53
+
54
+ ### read_file - Read File Contents
55
+
56
+ **When**: Read files found by search_context
57
+
58
+ **How**:
59
+ ```javascript
60
+ read_file(path="/path/to/file.ts") // Single file
61
+ read_file(path="/src/**/*.config.ts") // Pattern matching
62
+ ```
63
+
64
+ ---
65
+
66
+ ### edit_file - Modify Files
67
+
68
+ **When**: Built-in Edit tool fails or need advanced features
69
+
70
+ **How**:
71
+ ```javascript
72
+ edit_file(path="/file.ts", old_string="...", new_string="...", mode="update")
73
+ edit_file(path="/file.ts", line=10, content="...", mode="insert_after")
74
+ ```
75
+
76
+ **Modes**: `update` (replace text), `insert_after`, `insert_before`, `delete_line`
77
+
78
+ ---
79
+
80
+ ### write_file - Create/Overwrite Files
81
+
82
+ **When**: Create new files or completely replace content
83
+
84
+ **How**:
85
+ ```javascript
86
+ write_file(path="/new-file.ts", content="...")
87
+ ```
88
+
89
+ ---
90
+
91
+ ### Exa - External Search
92
+
93
+ **When**: Find documentation/examples outside codebase
94
+
95
+ **How**:
96
+ ```javascript
97
+ mcp__exa__search(query="React hooks 2025 documentation")
98
+ mcp__exa__search(query="FastAPI auth example", numResults=10)
99
+ mcp__exa__search(query="latest API docs", livecrawl="always")
100
+ ```
101
+
102
+ **Parameters**:
103
+ - `query` (required): Search query string
104
+ - `numResults` (optional): Number of results to return (default: 5)
105
+ - `livecrawl` (optional): `"always"` or `"fallback"` for live crawling
package/.codex/AGENTS.md CHANGED
@@ -21,8 +21,11 @@
21
21
  - Graceful degradation
22
22
  - Don't expose sensitive info
23
23
 
24
+
25
+
24
26
  ## Core Principles
25
27
 
28
+
26
29
  **Incremental Progress**:
27
30
  - Small, testable changes
28
31
  - Commit working code frequently
@@ -43,11 +46,58 @@
43
46
  - Maintain established patterns
44
47
  - Test integration between subtasks
45
48
 
49
+
50
+ ## System Optimization
51
+
52
+ **Direct Binary Calls**: Always call binaries directly in `functions.shell`, set `workdir`, avoid shell wrappers (`bash -lc`, `cmd /c`, etc.)
53
+
54
+ **Text Editing Priority**:
55
+ 1. Use `apply_patch` tool for all routine text edits
56
+ 2. Fall back to `sed` for single-line substitutions if unavailable
57
+ 3. Avoid Python editing scripts unless both fail
58
+
59
+ **apply_patch invocation**:
60
+ ```json
61
+ {
62
+ "command": ["apply_patch", "*** Begin Patch\n*** Update File: path/to/file\n@@\n- old\n+ new\n*** End Patch\n"],
63
+ "workdir": "<workdir>",
64
+ "justification": "Brief reason"
65
+ }
66
+ ```
67
+
68
+ **Windows UTF-8 Encoding** (before commands):
69
+ ```powershell
70
+ [Console]::InputEncoding = [Text.UTF8Encoding]::new($false)
71
+ [Console]::OutputEncoding = [Text.UTF8Encoding]::new($false)
72
+ chcp 65001 > $null
73
+ ```
74
+
75
+ ## Context Acquisition (MCP Tools Priority)
76
+
77
+ **For task context gathering and analysis, ALWAYS prefer MCP tools**:
78
+
79
+ 1. **smart_search** - First choice for code discovery
80
+ - Use `smart_search(query="...")` for semantic/keyword search
81
+ - Use `smart_search(action="find_files", pattern="*.ts")` for file discovery
82
+ - Supports modes: `auto`, `hybrid`, `exact`, `ripgrep`
83
+
84
+ 2. **read_file** - Batch file reading
85
+ - Read multiple files in parallel: `read_file(path="file1.ts")`, `read_file(path="file2.ts")`
86
+ - Supports glob patterns: `read_file(path="src/**/*.config.ts")`
87
+
88
+ **Priority Order**:
89
+ ```
90
+ smart_search (discovery) → read_file (batch read) → shell commands (fallback)
91
+ ```
92
+
93
+ **NEVER** use shell commands (`cat`, `find`, `grep`) when MCP tools are available.
94
+
46
95
  ## Execution Checklist
47
96
 
48
97
  **Before**:
49
98
  - [ ] Understand PURPOSE and TASK clearly
50
- - [ ] Review CONTEXT files, find 3+ patterns
99
+ - [ ] Use smart_search to discover relevant files
100
+ - [ ] Use read_file to batch read context files, find 3+ patterns
51
101
  - [ ] Check RULES templates and constraints
52
102
 
53
103
  **During**: