claude-code-workflow 6.3.48 → 6.3.49
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.
- package/.claude/CLAUDE.md +6 -8
- package/.claude/agents/action-planning-agent.md +28 -45
- package/.claude/agents/cli-lite-planning-agent.md +93 -1
- package/.claude/agents/code-developer.md +144 -27
- package/.claude/commands/ccw-coordinator.md +175 -21
- package/.claude/commands/ccw-debug.md +832 -0
- package/.claude/commands/ccw.md +90 -9
- package/.claude/commands/cli/cli-init.md +1 -0
- package/.claude/commands/issue/convert-to-plan.md +718 -0
- package/.claude/commands/issue/from-brainstorm.md +382 -0
- package/.claude/commands/memory/tips.md +332 -0
- package/.claude/commands/workflow/analyze-with-file.md +804 -0
- package/.claude/commands/workflow/brainstorm/auto-parallel.md +18 -43
- package/.claude/commands/workflow/brainstorm/role-analysis.md +705 -0
- package/.claude/commands/workflow/brainstorm-with-file.md +1153 -0
- package/.claude/commands/workflow/debug-with-file.md +7 -5
- package/.claude/commands/workflow/execute.md +6 -4
- package/.claude/commands/workflow/lite-plan.md +2 -2
- package/.claude/commands/workflow/plan-verify.md +162 -327
- package/.claude/commands/workflow/plan.md +162 -26
- package/.claude/commands/workflow/replan.md +78 -2
- package/.claude/commands/workflow/{review-fix.md → review-cycle-fix.md} +6 -6
- package/.claude/commands/workflow/review-module-cycle.md +2 -2
- package/.claude/commands/workflow/review-session-cycle.md +2 -2
- package/.claude/commands/workflow/tools/conflict-resolution.md +16 -26
- package/.claude/commands/workflow/tools/context-gather.md +81 -118
- package/.claude/commands/workflow/tools/task-generate-agent.md +94 -10
- package/.claude/skills/ccw-help/command.json +4 -4
- package/.claude/skills/lite-skill-generator/SKILL.md +650 -0
- package/.claude/skills/lite-skill-generator/templates/simple-skill.md +68 -0
- package/.claude/skills/lite-skill-generator/templates/style-guide.md +64 -0
- package/.claude/skills/skill-generator/SKILL.md +277 -85
- package/.claude/skills/skill-generator/phases/01-requirements-discovery.md +4 -15
- package/.claude/skills/skill-generator/phases/02-structure-generation.md +72 -17
- package/.claude/skills/skill-generator/phases/03-phase-generation.md +218 -51
- package/.claude/skills/skill-generator/phases/04-specs-templates.md +111 -41
- package/.claude/skills/skill-generator/phases/05-validation.md +139 -56
- package/.claude/skills/skill-generator/templates/autonomous-action.md +78 -268
- package/.claude/skills/skill-generator/templates/autonomous-orchestrator.md +14 -0
- package/.claude/skills/skill-generator/templates/code-analysis-action.md +12 -0
- package/.claude/skills/skill-generator/templates/llm-action.md +12 -0
- package/.claude/skills/skill-generator/templates/script-template.md +368 -0
- package/.claude/skills/skill-generator/templates/sequential-phase.md +14 -0
- package/.claude/skills/skill-generator/templates/skill-md.md +14 -0
- package/.claude/skills/skill-tuning/SKILL.md +130 -266
- package/.claude/skills/skill-tuning/phases/orchestrator.md +95 -283
- package/.claude/skills/skill-tuning/specs/problem-taxonomy.md +90 -198
- package/.claude/skills/skill-tuning/specs/tuning-strategies.md +193 -1345
- package/.claude/workflows/cli-templates/schemas/plan-verify-agent-schema.json +47 -0
- package/.claude/workflows/cli-templates/schemas/verify-json-schema.json +158 -0
- package/.claude/workflows/cli-tools-usage.md +1 -1
- package/.codex/AGENTS.md +1 -3
- package/.codex/prompts/analyze-with-file.md +607 -0
- package/.codex/prompts/brainstorm-to-cycle.md +455 -0
- package/.codex/prompts/brainstorm-with-file.md +933 -0
- package/.codex/prompts/debug-with-file.md +15 -20
- package/.codex/skills/ccw-cli-tools/SKILL.md +559 -0
- package/ccw/dist/commands/cli.d.ts.map +1 -1
- package/ccw/dist/commands/cli.js +29 -5
- package/ccw/dist/commands/cli.js.map +1 -1
- package/ccw/dist/commands/issue.d.ts +2 -0
- package/ccw/dist/commands/issue.d.ts.map +1 -1
- package/ccw/dist/commands/issue.js +62 -20
- package/ccw/dist/commands/issue.js.map +1 -1
- package/ccw/dist/config/litellm-api-config-manager.d.ts.map +1 -1
- package/ccw/dist/config/litellm-api-config-manager.js +5 -3
- package/ccw/dist/config/litellm-api-config-manager.js.map +1 -1
- package/ccw/dist/config/litellm-provider-models.d.ts +73 -0
- package/ccw/dist/config/litellm-provider-models.d.ts.map +1 -0
- package/ccw/dist/config/litellm-provider-models.js +172 -0
- package/ccw/dist/config/litellm-provider-models.js.map +1 -0
- package/ccw/dist/config/provider-models.d.ts +25 -51
- package/ccw/dist/config/provider-models.d.ts.map +1 -1
- package/ccw/dist/config/provider-models.js +84 -149
- package/ccw/dist/config/provider-models.js.map +1 -1
- package/ccw/dist/config/storage-paths.d.ts.map +1 -1
- package/ccw/dist/config/storage-paths.js +23 -5
- package/ccw/dist/config/storage-paths.js.map +1 -1
- package/ccw/dist/core/auth/csrf-middleware.js +3 -3
- package/ccw/dist/core/auth/csrf-middleware.js.map +1 -1
- package/ccw/dist/core/dashboard-generator.d.ts.map +1 -1
- package/ccw/dist/core/dashboard-generator.js +3 -1
- package/ccw/dist/core/dashboard-generator.js.map +1 -1
- package/ccw/dist/core/routes/claude-routes.d.ts.map +1 -1
- package/ccw/dist/core/routes/claude-routes.js +206 -14
- package/ccw/dist/core/routes/claude-routes.js.map +1 -1
- package/ccw/dist/core/routes/cli-routes.d.ts.map +1 -1
- package/ccw/dist/core/routes/cli-routes.js.map +1 -1
- package/ccw/dist/core/routes/commands-routes.d.ts +7 -0
- package/ccw/dist/core/routes/commands-routes.d.ts.map +1 -0
- package/ccw/dist/core/routes/commands-routes.js +480 -0
- package/ccw/dist/core/routes/commands-routes.js.map +1 -0
- package/ccw/dist/core/routes/model-routes.d.ts +11 -0
- package/ccw/dist/core/routes/model-routes.d.ts.map +1 -0
- package/ccw/dist/core/routes/model-routes.js +112 -0
- package/ccw/dist/core/routes/model-routes.js.map +1 -0
- package/ccw/dist/core/routes/nav-status-routes.d.ts.map +1 -1
- package/ccw/dist/core/routes/nav-status-routes.js +84 -1
- package/ccw/dist/core/routes/nav-status-routes.js.map +1 -1
- package/ccw/dist/core/routes/provider-routes.d.ts +11 -0
- package/ccw/dist/core/routes/provider-routes.d.ts.map +1 -0
- package/ccw/dist/core/routes/provider-routes.js +67 -0
- package/ccw/dist/core/routes/provider-routes.js.map +1 -0
- package/ccw/dist/core/routes/skills-routes.d.ts.map +1 -1
- package/ccw/dist/core/routes/skills-routes.js +219 -7
- package/ccw/dist/core/routes/skills-routes.js.map +1 -1
- package/ccw/dist/core/routes/system-routes.d.ts.map +1 -1
- package/ccw/dist/core/routes/system-routes.js +58 -6
- package/ccw/dist/core/routes/system-routes.js.map +1 -1
- package/ccw/dist/core/server.d.ts.map +1 -1
- package/ccw/dist/core/server.js +13 -0
- package/ccw/dist/core/server.js.map +1 -1
- package/ccw/dist/mcp-server/index.js +2 -2
- package/ccw/dist/mcp-server/index.js.map +1 -1
- package/ccw/dist/tools/claude-cli-tools.d.ts +48 -11
- package/ccw/dist/tools/claude-cli-tools.d.ts.map +1 -1
- package/ccw/dist/tools/claude-cli-tools.js +146 -50
- package/ccw/dist/tools/claude-cli-tools.js.map +1 -1
- package/ccw/dist/tools/cli-config-manager.d.ts +1 -13
- package/ccw/dist/tools/cli-config-manager.d.ts.map +1 -1
- package/ccw/dist/tools/cli-config-manager.js +3 -27
- package/ccw/dist/tools/cli-config-manager.js.map +1 -1
- package/ccw/dist/tools/cli-executor-core.d.ts.map +1 -1
- package/ccw/dist/tools/cli-executor-core.js +7 -2
- package/ccw/dist/tools/cli-executor-core.js.map +1 -1
- package/ccw/dist/tools/cli-executor-state.d.ts.map +1 -1
- package/ccw/dist/tools/cli-history-store.d.ts +11 -0
- package/ccw/dist/tools/cli-history-store.d.ts.map +1 -1
- package/ccw/dist/tools/cli-history-store.js +82 -2
- package/ccw/dist/tools/cli-history-store.js.map +1 -1
- package/ccw/dist/tools/command-registry.d.ts +7 -0
- package/ccw/dist/tools/command-registry.d.ts.map +1 -1
- package/ccw/dist/tools/command-registry.js +14 -1
- package/ccw/dist/tools/command-registry.js.map +1 -1
- package/ccw/dist/tools/generate-module-docs.d.ts.map +1 -1
- package/ccw/dist/tools/generate-module-docs.js +11 -7
- package/ccw/dist/tools/generate-module-docs.js.map +1 -1
- package/ccw/dist/tools/litellm-executor.d.ts +1 -0
- package/ccw/dist/tools/litellm-executor.d.ts.map +1 -1
- package/ccw/dist/tools/litellm-executor.js +11 -9
- package/ccw/dist/tools/litellm-executor.js.map +1 -1
- package/ccw/dist/types/skill-types.d.ts +97 -0
- package/ccw/dist/types/skill-types.d.ts.map +1 -0
- package/ccw/dist/types/skill-types.js +6 -0
- package/ccw/dist/types/skill-types.js.map +1 -0
- package/ccw/src/commands/cli.ts +36 -5
- package/ccw/src/commands/issue.ts +81 -26
- package/ccw/src/config/litellm-api-config-manager.ts +5 -3
- package/ccw/src/config/litellm-provider-models.ts +222 -0
- package/ccw/src/config/provider-models.ts +91 -190
- package/ccw/src/config/storage-paths.ts +20 -5
- package/ccw/src/core/auth/csrf-middleware.ts +3 -3
- package/ccw/src/core/dashboard-generator.ts +3 -1
- package/ccw/src/core/routes/claude-routes.ts +233 -15
- package/ccw/src/core/routes/cli-routes.ts +2 -3
- package/ccw/src/core/routes/commands-routes.ts +620 -0
- package/ccw/src/core/routes/nav-status-routes.ts +95 -1
- package/ccw/src/core/routes/provider-routes.ts +78 -0
- package/ccw/src/core/routes/skills-routes.ts +266 -45
- package/ccw/src/core/routes/system-routes.ts +102 -50
- package/ccw/src/core/server.ts +13 -0
- package/ccw/src/mcp-server/index.ts +2 -2
- package/ccw/src/templates/dashboard-css/18-cli-settings.css +35 -0
- package/ccw/src/templates/dashboard-css/37-commands.css +193 -0
- package/ccw/src/templates/dashboard-js/components/navigation.js +4 -0
- package/ccw/src/templates/dashboard-js/i18n.js +116 -0
- package/ccw/src/templates/dashboard-js/views/cli-manager.js +249 -4
- package/ccw/src/templates/dashboard-js/views/commands-manager.js +503 -0
- package/ccw/src/templates/dashboard-js/views/issue-manager.js +7 -7
- package/ccw/src/templates/dashboard-js/views/mcp-manager.js +2 -7
- package/ccw/src/templates/dashboard-js/views/skills-manager.js +164 -23
- package/ccw/src/templates/dashboard.html +7 -0
- package/ccw/src/tools/claude-cli-tools.ts +170 -56
- package/ccw/src/tools/cli-config-manager.ts +2 -33
- package/ccw/src/tools/cli-executor-core.ts +8 -2
- package/ccw/src/tools/cli-history-store.ts +92 -2
- package/ccw/src/tools/command-registry.ts +16 -1
- package/ccw/src/tools/generate-module-docs.ts +11 -7
- package/ccw/src/tools/litellm-executor.ts +13 -9
- package/ccw/src/types/skill-types.ts +99 -0
- package/package.json +1 -1
- package/.claude/commands/enhance-prompt.md +0 -93
- package/.claude/commands/memory/code-map-memory.md +0 -687
- package/.claude/commands/memory/docs.md +0 -615
- package/.claude/commands/memory/load-skill-memory.md +0 -182
- package/.claude/commands/memory/skill-memory.md +0 -525
- package/.claude/commands/memory/swagger-docs.md +0 -773
- package/.claude/commands/memory/tech-research-rules.md +0 -310
- package/.claude/commands/memory/workflow-skill-memory.md +0 -517
- package/.claude/commands/task/breakdown.md +0 -208
- package/.claude/commands/task/create.md +0 -152
- package/.claude/commands/task/execute.md +0 -270
- package/.claude/commands/task/replan.md +0 -441
- package/.claude/commands/version.md +0 -254
- package/.claude/commands/workflow/action-plan-verify.md +0 -485
- package/.claude/commands/workflow/brainstorm/api-designer.md +0 -587
- package/.claude/commands/workflow/brainstorm/data-architect.md +0 -220
- package/.claude/commands/workflow/brainstorm/product-manager.md +0 -200
- package/.claude/commands/workflow/brainstorm/product-owner.md +0 -200
- package/.claude/commands/workflow/brainstorm/scrum-master.md +0 -200
- package/.claude/commands/workflow/brainstorm/subject-matter-expert.md +0 -200
- package/.claude/commands/workflow/brainstorm/system-architect.md +0 -389
- package/.claude/commands/workflow/brainstorm/ui-designer.md +0 -221
- package/.claude/commands/workflow/brainstorm/ux-expert.md +0 -221
- package/.claude/commands/workflow/debug.md +0 -331
- package/.claude/commands/workflow/develop-with-file.md +0 -1044
- package/.claude/skills/ccw-loop/README.md +0 -303
- package/.claude/skills/skill-generator/templates/script-bash.md +0 -277
- package/.claude/skills/skill-generator/templates/script-python.md +0 -198
- package/.codex/prompts/debug.md +0 -318
- package/ccw/src/core/routes/mcp-routes.ts.backup +0 -549
|
@@ -0,0 +1,607 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Interactive collaborative analysis with documented discussions, CLI-assisted exploration, and evolving understanding
|
|
3
|
+
argument-hint: TOPIC="<topic or question to analyze>"
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Codex Analyze-With-File Prompt
|
|
7
|
+
|
|
8
|
+
## Overview
|
|
9
|
+
|
|
10
|
+
Interactive collaborative analysis workflow with **documented discussion process**. Records understanding evolution, facilitates multi-round Q&A, and uses deep analysis for codebase and concept exploration.
|
|
11
|
+
|
|
12
|
+
**Core workflow**: Topic → Explore → Discuss → Document → Refine → Conclude
|
|
13
|
+
|
|
14
|
+
**Key features**:
|
|
15
|
+
- **discussion.md**: Timeline of discussions and understanding evolution
|
|
16
|
+
- **Multi-round Q&A**: Iterative clarification with user
|
|
17
|
+
- **Analysis-assisted exploration**: Deep codebase and concept analysis
|
|
18
|
+
- **Consolidated insights**: Synthesizes discussions into actionable conclusions
|
|
19
|
+
- **Flexible continuation**: Resume analysis sessions to build on previous work
|
|
20
|
+
|
|
21
|
+
## Target Topic
|
|
22
|
+
|
|
23
|
+
**$TOPIC**
|
|
24
|
+
|
|
25
|
+
## Execution Process
|
|
26
|
+
|
|
27
|
+
```
|
|
28
|
+
Session Detection:
|
|
29
|
+
├─ Check if analysis session exists for topic
|
|
30
|
+
├─ EXISTS + discussion.md exists → Continue mode
|
|
31
|
+
└─ NOT_FOUND → New session mode
|
|
32
|
+
|
|
33
|
+
Phase 1: Topic Understanding
|
|
34
|
+
├─ Parse topic/question
|
|
35
|
+
├─ Identify analysis dimensions (architecture, implementation, concept, etc.)
|
|
36
|
+
├─ Initial scoping with user
|
|
37
|
+
└─ Document initial understanding in discussion.md
|
|
38
|
+
|
|
39
|
+
Phase 2: Exploration (Parallel)
|
|
40
|
+
├─ Search codebase for relevant patterns
|
|
41
|
+
├─ Analyze code structure and dependencies
|
|
42
|
+
└─ Aggregate findings into exploration summary
|
|
43
|
+
|
|
44
|
+
Phase 3: Interactive Discussion (Multi-Round)
|
|
45
|
+
├─ Present exploration findings
|
|
46
|
+
├─ Facilitate Q&A with user
|
|
47
|
+
├─ Capture user insights and requirements
|
|
48
|
+
├─ Update discussion.md with each round
|
|
49
|
+
└─ Repeat until user is satisfied or clarity achieved
|
|
50
|
+
|
|
51
|
+
Phase 4: Synthesis & Conclusion
|
|
52
|
+
├─ Consolidate all insights
|
|
53
|
+
├─ Update discussion.md with conclusions
|
|
54
|
+
├─ Generate actionable recommendations
|
|
55
|
+
└─ Optional: Create follow-up tasks or issues
|
|
56
|
+
|
|
57
|
+
Output:
|
|
58
|
+
├─ .workflow/.analysis/{slug}-{date}/discussion.md (evolving document)
|
|
59
|
+
├─ .workflow/.analysis/{slug}-{date}/explorations.json (findings)
|
|
60
|
+
└─ .workflow/.analysis/{slug}-{date}/conclusions.json (final synthesis)
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## Implementation Details
|
|
64
|
+
|
|
65
|
+
### Session Setup & Mode Detection
|
|
66
|
+
|
|
67
|
+
```javascript
|
|
68
|
+
const getUtc8ISOString = () => new Date(Date.now() + 8 * 60 * 60 * 1000).toISOString()
|
|
69
|
+
|
|
70
|
+
const topicSlug = "$TOPIC".toLowerCase().replace(/[^a-z0-9]+/g, '-').substring(0, 40)
|
|
71
|
+
const dateStr = getUtc8ISOString().substring(0, 10)
|
|
72
|
+
|
|
73
|
+
const sessionId = `ANL-${topicSlug}-${dateStr}`
|
|
74
|
+
const sessionFolder = `.workflow/.analysis/${sessionId}`
|
|
75
|
+
const discussionPath = `${sessionFolder}/discussion.md`
|
|
76
|
+
const explorationsPath = `${sessionFolder}/explorations.json`
|
|
77
|
+
const conclusionsPath = `${sessionFolder}/conclusions.json`
|
|
78
|
+
|
|
79
|
+
// Auto-detect mode
|
|
80
|
+
const sessionExists = fs.existsSync(sessionFolder)
|
|
81
|
+
const hasDiscussion = sessionExists && fs.existsSync(discussionPath)
|
|
82
|
+
|
|
83
|
+
const mode = hasDiscussion ? 'continue' : 'new'
|
|
84
|
+
|
|
85
|
+
if (!sessionExists) {
|
|
86
|
+
bash(`mkdir -p ${sessionFolder}`)
|
|
87
|
+
}
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
---
|
|
91
|
+
|
|
92
|
+
### Phase 1: Topic Understanding
|
|
93
|
+
|
|
94
|
+
#### Step 1.1: Parse Topic & Identify Dimensions
|
|
95
|
+
|
|
96
|
+
```javascript
|
|
97
|
+
// Analyze topic to determine analysis dimensions
|
|
98
|
+
const ANALYSIS_DIMENSIONS = {
|
|
99
|
+
architecture: ['架构', 'architecture', 'design', 'structure', '设计'],
|
|
100
|
+
implementation: ['实现', 'implement', 'code', 'coding', '代码'],
|
|
101
|
+
performance: ['性能', 'performance', 'optimize', 'bottleneck', '优化'],
|
|
102
|
+
security: ['安全', 'security', 'auth', 'permission', '权限'],
|
|
103
|
+
concept: ['概念', 'concept', 'theory', 'principle', '原理'],
|
|
104
|
+
comparison: ['比较', 'compare', 'vs', 'difference', '区别'],
|
|
105
|
+
decision: ['决策', 'decision', 'choice', 'tradeoff', '选择']
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
function identifyDimensions(topic) {
|
|
109
|
+
const text = topic.toLowerCase()
|
|
110
|
+
const matched = []
|
|
111
|
+
|
|
112
|
+
for (const [dimension, keywords] of Object.entries(ANALYSIS_DIMENSIONS)) {
|
|
113
|
+
if (keywords.some(k => text.includes(k))) {
|
|
114
|
+
matched.push(dimension)
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
return matched.length > 0 ? matched : ['general']
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
const dimensions = identifyDimensions("$TOPIC")
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
#### Step 1.2: Initial Scoping (New Session Only)
|
|
125
|
+
|
|
126
|
+
Ask user to scope the analysis:
|
|
127
|
+
|
|
128
|
+
- Focus areas: 代码实现 / 架构设计 / 最佳实践 / 问题诊断
|
|
129
|
+
- Analysis depth: Quick Overview / Standard Analysis / Deep Dive
|
|
130
|
+
|
|
131
|
+
#### Step 1.3: Create/Update discussion.md
|
|
132
|
+
|
|
133
|
+
For new session:
|
|
134
|
+
|
|
135
|
+
```markdown
|
|
136
|
+
# Analysis Discussion
|
|
137
|
+
|
|
138
|
+
**Session ID**: ${sessionId}
|
|
139
|
+
**Topic**: $TOPIC
|
|
140
|
+
**Started**: ${getUtc8ISOString()}
|
|
141
|
+
**Dimensions**: ${dimensions.join(', ')}
|
|
142
|
+
|
|
143
|
+
---
|
|
144
|
+
|
|
145
|
+
## User Context
|
|
146
|
+
|
|
147
|
+
**Focus Areas**: ${userFocusAreas.join(', ')}
|
|
148
|
+
**Analysis Depth**: ${analysisDepth}
|
|
149
|
+
|
|
150
|
+
---
|
|
151
|
+
|
|
152
|
+
## Discussion Timeline
|
|
153
|
+
|
|
154
|
+
### Round 1 - Initial Understanding (${timestamp})
|
|
155
|
+
|
|
156
|
+
#### Topic Analysis
|
|
157
|
+
|
|
158
|
+
Based on topic "$TOPIC":
|
|
159
|
+
|
|
160
|
+
- **Primary dimensions**: ${dimensions.join(', ')}
|
|
161
|
+
- **Initial scope**: ${initialScope}
|
|
162
|
+
- **Key questions to explore**:
|
|
163
|
+
- ${question1}
|
|
164
|
+
- ${question2}
|
|
165
|
+
- ${question3}
|
|
166
|
+
|
|
167
|
+
#### Next Steps
|
|
168
|
+
|
|
169
|
+
- Search codebase for relevant patterns
|
|
170
|
+
- Gather insights via analysis
|
|
171
|
+
- Prepare discussion points for user
|
|
172
|
+
|
|
173
|
+
---
|
|
174
|
+
|
|
175
|
+
## Current Understanding
|
|
176
|
+
|
|
177
|
+
${initialUnderstanding}
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
For continue session, append:
|
|
181
|
+
|
|
182
|
+
```markdown
|
|
183
|
+
### Round ${n} - Continuation (${timestamp})
|
|
184
|
+
|
|
185
|
+
#### Previous Context
|
|
186
|
+
|
|
187
|
+
Resuming analysis based on prior discussion.
|
|
188
|
+
|
|
189
|
+
#### New Focus
|
|
190
|
+
|
|
191
|
+
${newFocusFromUser}
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
---
|
|
195
|
+
|
|
196
|
+
### Phase 2: Exploration
|
|
197
|
+
|
|
198
|
+
#### Step 2.1: Codebase Search
|
|
199
|
+
|
|
200
|
+
```javascript
|
|
201
|
+
// Extract keywords from topic
|
|
202
|
+
const keywords = extractTopicKeywords("$TOPIC")
|
|
203
|
+
|
|
204
|
+
// Search codebase for relevant code
|
|
205
|
+
const searchResults = []
|
|
206
|
+
for (const keyword of keywords) {
|
|
207
|
+
const results = Grep({ pattern: keyword, path: ".", output_mode: "content", "-C": 3 })
|
|
208
|
+
searchResults.push({ keyword, results })
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
// Identify affected files and patterns
|
|
212
|
+
const relevantLocations = analyzeSearchResults(searchResults)
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
#### Step 2.2: Pattern Analysis
|
|
216
|
+
|
|
217
|
+
Analyze the codebase from identified dimensions:
|
|
218
|
+
|
|
219
|
+
1. Architecture patterns and structure
|
|
220
|
+
2. Implementation conventions
|
|
221
|
+
3. Dependency relationships
|
|
222
|
+
4. Potential issues or improvements
|
|
223
|
+
|
|
224
|
+
#### Step 2.3: Aggregate Findings
|
|
225
|
+
|
|
226
|
+
```javascript
|
|
227
|
+
// Aggregate into explorations.json
|
|
228
|
+
const explorations = {
|
|
229
|
+
session_id: sessionId,
|
|
230
|
+
timestamp: getUtc8ISOString(),
|
|
231
|
+
topic: "$TOPIC",
|
|
232
|
+
dimensions: dimensions,
|
|
233
|
+
sources: [
|
|
234
|
+
{ type: "codebase", summary: codebaseSummary },
|
|
235
|
+
{ type: "analysis", summary: analysisSummary }
|
|
236
|
+
],
|
|
237
|
+
key_findings: [...],
|
|
238
|
+
discussion_points: [...],
|
|
239
|
+
open_questions: [...]
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
Write(explorationsPath, JSON.stringify(explorations, null, 2))
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
#### Step 2.4: Update discussion.md
|
|
246
|
+
|
|
247
|
+
```markdown
|
|
248
|
+
#### Exploration Results (${timestamp})
|
|
249
|
+
|
|
250
|
+
**Sources Analyzed**:
|
|
251
|
+
${sources.map(s => `- ${s.type}: ${s.summary}`).join('\n')}
|
|
252
|
+
|
|
253
|
+
**Key Findings**:
|
|
254
|
+
${keyFindings.map((f, i) => `${i+1}. ${f}`).join('\n')}
|
|
255
|
+
|
|
256
|
+
**Points for Discussion**:
|
|
257
|
+
${discussionPoints.map((p, i) => `${i+1}. ${p}`).join('\n')}
|
|
258
|
+
|
|
259
|
+
**Open Questions**:
|
|
260
|
+
${openQuestions.map((q, i) => `- ${q}`).join('\n')}
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
---
|
|
264
|
+
|
|
265
|
+
### Phase 3: Interactive Discussion (Multi-Round)
|
|
266
|
+
|
|
267
|
+
#### Step 3.1: Present Findings & Gather Feedback
|
|
268
|
+
|
|
269
|
+
```javascript
|
|
270
|
+
// Maximum discussion rounds
|
|
271
|
+
const MAX_ROUNDS = 5
|
|
272
|
+
let roundNumber = 1
|
|
273
|
+
let discussionComplete = false
|
|
274
|
+
|
|
275
|
+
while (!discussionComplete && roundNumber <= MAX_ROUNDS) {
|
|
276
|
+
// Display current findings
|
|
277
|
+
console.log(`
|
|
278
|
+
## Discussion Round ${roundNumber}
|
|
279
|
+
|
|
280
|
+
${currentFindings}
|
|
281
|
+
|
|
282
|
+
### Key Points for Your Input
|
|
283
|
+
${discussionPoints.map((p, i) => `${i+1}. ${p}`).join('\n')}
|
|
284
|
+
`)
|
|
285
|
+
|
|
286
|
+
// Gather user input
|
|
287
|
+
// Options:
|
|
288
|
+
// - 同意,继续深入: Deepen analysis in current direction
|
|
289
|
+
// - 需要调整方向: Get user's adjusted focus
|
|
290
|
+
// - 分析完成: Exit loop
|
|
291
|
+
// - 有具体问题: Answer specific questions
|
|
292
|
+
|
|
293
|
+
// Process user response and update understanding
|
|
294
|
+
updateDiscussionDocument(roundNumber, userResponse, findings)
|
|
295
|
+
roundNumber++
|
|
296
|
+
}
|
|
297
|
+
```
|
|
298
|
+
|
|
299
|
+
#### Step 3.2: Document Each Round
|
|
300
|
+
|
|
301
|
+
Append to discussion.md:
|
|
302
|
+
|
|
303
|
+
```markdown
|
|
304
|
+
### Round ${n} - Discussion (${timestamp})
|
|
305
|
+
|
|
306
|
+
#### User Input
|
|
307
|
+
|
|
308
|
+
${userInputSummary}
|
|
309
|
+
|
|
310
|
+
${userResponse === 'adjustment' ? `
|
|
311
|
+
**Direction Adjustment**: ${adjustmentDetails}
|
|
312
|
+
` : ''}
|
|
313
|
+
|
|
314
|
+
${userResponse === 'questions' ? `
|
|
315
|
+
**User Questions**:
|
|
316
|
+
${userQuestions.map((q, i) => `${i+1}. ${q}`).join('\n')}
|
|
317
|
+
|
|
318
|
+
**Answers**:
|
|
319
|
+
${answers.map((a, i) => `${i+1}. ${a}`).join('\n')}
|
|
320
|
+
` : ''}
|
|
321
|
+
|
|
322
|
+
#### Updated Understanding
|
|
323
|
+
|
|
324
|
+
Based on user feedback:
|
|
325
|
+
- ${insight1}
|
|
326
|
+
- ${insight2}
|
|
327
|
+
|
|
328
|
+
#### Corrected Assumptions
|
|
329
|
+
|
|
330
|
+
${corrections.length > 0 ? corrections.map(c => `
|
|
331
|
+
- ~~${c.wrong}~~ → ${c.corrected}
|
|
332
|
+
- Reason: ${c.reason}
|
|
333
|
+
`).join('\n') : 'None'}
|
|
334
|
+
|
|
335
|
+
#### New Insights
|
|
336
|
+
|
|
337
|
+
${newInsights.map(i => `- ${i}`).join('\n')}
|
|
338
|
+
```
|
|
339
|
+
|
|
340
|
+
---
|
|
341
|
+
|
|
342
|
+
### Phase 4: Synthesis & Conclusion
|
|
343
|
+
|
|
344
|
+
#### Step 4.1: Consolidate Insights
|
|
345
|
+
|
|
346
|
+
```javascript
|
|
347
|
+
const conclusions = {
|
|
348
|
+
session_id: sessionId,
|
|
349
|
+
topic: "$TOPIC",
|
|
350
|
+
completed: getUtc8ISOString(),
|
|
351
|
+
total_rounds: roundNumber,
|
|
352
|
+
|
|
353
|
+
summary: "...",
|
|
354
|
+
|
|
355
|
+
key_conclusions: [
|
|
356
|
+
{ point: "...", evidence: "...", confidence: "high|medium|low" }
|
|
357
|
+
],
|
|
358
|
+
|
|
359
|
+
recommendations: [
|
|
360
|
+
{ action: "...", rationale: "...", priority: "high|medium|low" }
|
|
361
|
+
],
|
|
362
|
+
|
|
363
|
+
open_questions: [...],
|
|
364
|
+
|
|
365
|
+
follow_up_suggestions: [
|
|
366
|
+
{ type: "issue", summary: "..." },
|
|
367
|
+
{ type: "task", summary: "..." }
|
|
368
|
+
]
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
Write(conclusionsPath, JSON.stringify(conclusions, null, 2))
|
|
372
|
+
```
|
|
373
|
+
|
|
374
|
+
#### Step 4.2: Final discussion.md Update
|
|
375
|
+
|
|
376
|
+
```markdown
|
|
377
|
+
---
|
|
378
|
+
|
|
379
|
+
## Conclusions (${timestamp})
|
|
380
|
+
|
|
381
|
+
### Summary
|
|
382
|
+
|
|
383
|
+
${summaryParagraph}
|
|
384
|
+
|
|
385
|
+
### Key Conclusions
|
|
386
|
+
|
|
387
|
+
${conclusions.key_conclusions.map((c, i) => `
|
|
388
|
+
${i+1}. **${c.point}** (Confidence: ${c.confidence})
|
|
389
|
+
- Evidence: ${c.evidence}
|
|
390
|
+
`).join('\n')}
|
|
391
|
+
|
|
392
|
+
### Recommendations
|
|
393
|
+
|
|
394
|
+
${conclusions.recommendations.map((r, i) => `
|
|
395
|
+
${i+1}. **${r.action}** (Priority: ${r.priority})
|
|
396
|
+
- Rationale: ${r.rationale}
|
|
397
|
+
`).join('\n')}
|
|
398
|
+
|
|
399
|
+
### Remaining Questions
|
|
400
|
+
|
|
401
|
+
${conclusions.open_questions.map(q => `- ${q}`).join('\n')}
|
|
402
|
+
|
|
403
|
+
---
|
|
404
|
+
|
|
405
|
+
## Current Understanding (Final)
|
|
406
|
+
|
|
407
|
+
### What We Established
|
|
408
|
+
|
|
409
|
+
${establishedPoints.map(p => `- ${p}`).join('\n')}
|
|
410
|
+
|
|
411
|
+
### What Was Clarified/Corrected
|
|
412
|
+
|
|
413
|
+
${corrections.map(c => `- ~~${c.original}~~ → ${c.corrected}`).join('\n')}
|
|
414
|
+
|
|
415
|
+
### Key Insights
|
|
416
|
+
|
|
417
|
+
${keyInsights.map(i => `- ${i}`).join('\n')}
|
|
418
|
+
|
|
419
|
+
---
|
|
420
|
+
|
|
421
|
+
## Session Statistics
|
|
422
|
+
|
|
423
|
+
- **Total Rounds**: ${totalRounds}
|
|
424
|
+
- **Duration**: ${duration}
|
|
425
|
+
- **Sources Used**: ${sources.join(', ')}
|
|
426
|
+
- **Artifacts Generated**: discussion.md, explorations.json, conclusions.json
|
|
427
|
+
```
|
|
428
|
+
|
|
429
|
+
#### Step 4.3: Post-Completion Options
|
|
430
|
+
|
|
431
|
+
Offer follow-up options:
|
|
432
|
+
- Create Issue: Convert conclusions to actionable issues
|
|
433
|
+
- Generate Task: Create implementation tasks
|
|
434
|
+
- Export Report: Generate standalone analysis report
|
|
435
|
+
- Complete: No further action needed
|
|
436
|
+
|
|
437
|
+
---
|
|
438
|
+
|
|
439
|
+
## Session Folder Structure
|
|
440
|
+
|
|
441
|
+
```
|
|
442
|
+
.workflow/.analysis/ANL-{slug}-{date}/
|
|
443
|
+
├── discussion.md # Evolution of understanding & discussions
|
|
444
|
+
├── explorations.json # Exploration findings
|
|
445
|
+
├── conclusions.json # Final synthesis
|
|
446
|
+
└── exploration-*.json # Individual exploration results (optional)
|
|
447
|
+
```
|
|
448
|
+
|
|
449
|
+
## Discussion Document Template
|
|
450
|
+
|
|
451
|
+
```markdown
|
|
452
|
+
# Analysis Discussion
|
|
453
|
+
|
|
454
|
+
**Session ID**: ANL-xxx-2025-01-25
|
|
455
|
+
**Topic**: [topic or question]
|
|
456
|
+
**Started**: 2025-01-25T10:00:00+08:00
|
|
457
|
+
**Dimensions**: [architecture, implementation, ...]
|
|
458
|
+
|
|
459
|
+
---
|
|
460
|
+
|
|
461
|
+
## User Context
|
|
462
|
+
|
|
463
|
+
**Focus Areas**: [user-selected focus]
|
|
464
|
+
**Analysis Depth**: [quick|standard|deep]
|
|
465
|
+
|
|
466
|
+
---
|
|
467
|
+
|
|
468
|
+
## Discussion Timeline
|
|
469
|
+
|
|
470
|
+
### Round 1 - Initial Understanding (2025-01-25 10:00)
|
|
471
|
+
|
|
472
|
+
#### Topic Analysis
|
|
473
|
+
...
|
|
474
|
+
|
|
475
|
+
#### Exploration Results
|
|
476
|
+
...
|
|
477
|
+
|
|
478
|
+
### Round 2 - Discussion (2025-01-25 10:15)
|
|
479
|
+
|
|
480
|
+
#### User Input
|
|
481
|
+
...
|
|
482
|
+
|
|
483
|
+
#### Updated Understanding
|
|
484
|
+
...
|
|
485
|
+
|
|
486
|
+
#### Corrected Assumptions
|
|
487
|
+
- ~~[wrong]~~ → [corrected]
|
|
488
|
+
|
|
489
|
+
### Round 3 - Deep Dive (2025-01-25 10:30)
|
|
490
|
+
...
|
|
491
|
+
|
|
492
|
+
---
|
|
493
|
+
|
|
494
|
+
## Conclusions (2025-01-25 11:00)
|
|
495
|
+
|
|
496
|
+
### Summary
|
|
497
|
+
...
|
|
498
|
+
|
|
499
|
+
### Key Conclusions
|
|
500
|
+
...
|
|
501
|
+
|
|
502
|
+
### Recommendations
|
|
503
|
+
...
|
|
504
|
+
|
|
505
|
+
---
|
|
506
|
+
|
|
507
|
+
## Current Understanding (Final)
|
|
508
|
+
|
|
509
|
+
### What We Established
|
|
510
|
+
- [confirmed points]
|
|
511
|
+
|
|
512
|
+
### What Was Clarified/Corrected
|
|
513
|
+
- ~~[original assumption]~~ → [corrected understanding]
|
|
514
|
+
|
|
515
|
+
### Key Insights
|
|
516
|
+
- [insights gained]
|
|
517
|
+
|
|
518
|
+
---
|
|
519
|
+
|
|
520
|
+
## Session Statistics
|
|
521
|
+
|
|
522
|
+
- **Total Rounds**: 3
|
|
523
|
+
- **Duration**: 1 hour
|
|
524
|
+
- **Sources Used**: codebase exploration, analysis
|
|
525
|
+
- **Artifacts Generated**: discussion.md, explorations.json, conclusions.json
|
|
526
|
+
```
|
|
527
|
+
|
|
528
|
+
## Iteration Flow
|
|
529
|
+
|
|
530
|
+
```
|
|
531
|
+
First Call (TOPIC="topic"):
|
|
532
|
+
├─ No session exists → New mode
|
|
533
|
+
├─ Identify analysis dimensions
|
|
534
|
+
├─ Scope with user
|
|
535
|
+
├─ Create discussion.md with initial understanding
|
|
536
|
+
├─ Launch explorations
|
|
537
|
+
└─ Enter discussion loop
|
|
538
|
+
|
|
539
|
+
Continue Call (TOPIC="topic"):
|
|
540
|
+
├─ Session exists → Continue mode
|
|
541
|
+
├─ Load discussion.md
|
|
542
|
+
├─ Resume from last round
|
|
543
|
+
└─ Continue discussion loop
|
|
544
|
+
|
|
545
|
+
Discussion Loop:
|
|
546
|
+
├─ Present current findings
|
|
547
|
+
├─ Gather user feedback
|
|
548
|
+
├─ Process response:
|
|
549
|
+
│ ├─ Agree → Deepen analysis
|
|
550
|
+
│ ├─ Adjust → Change direction
|
|
551
|
+
│ ├─ Question → Answer then continue
|
|
552
|
+
│ └─ Complete → Exit loop
|
|
553
|
+
├─ Update discussion.md
|
|
554
|
+
└─ Repeat until complete or max rounds
|
|
555
|
+
|
|
556
|
+
Completion:
|
|
557
|
+
├─ Generate conclusions.json
|
|
558
|
+
├─ Update discussion.md with final synthesis
|
|
559
|
+
└─ Offer follow-up options
|
|
560
|
+
```
|
|
561
|
+
|
|
562
|
+
## Consolidation Rules
|
|
563
|
+
|
|
564
|
+
When updating "Current Understanding":
|
|
565
|
+
|
|
566
|
+
1. **Promote confirmed insights**: Move validated findings to "What We Established"
|
|
567
|
+
2. **Track corrections**: Keep important wrong→right transformations
|
|
568
|
+
3. **Focus on current state**: What do we know NOW
|
|
569
|
+
4. **Avoid timeline repetition**: Don't copy discussion details
|
|
570
|
+
5. **Preserve key learnings**: Keep insights valuable for future reference
|
|
571
|
+
|
|
572
|
+
**Bad (cluttered)**:
|
|
573
|
+
```markdown
|
|
574
|
+
## Current Understanding
|
|
575
|
+
|
|
576
|
+
In round 1 we discussed X, then in round 2 user said Y, and we explored Z...
|
|
577
|
+
```
|
|
578
|
+
|
|
579
|
+
**Good (consolidated)**:
|
|
580
|
+
```markdown
|
|
581
|
+
## Current Understanding
|
|
582
|
+
|
|
583
|
+
### What We Established
|
|
584
|
+
- The authentication flow uses JWT with refresh tokens
|
|
585
|
+
- Rate limiting is implemented at API gateway level
|
|
586
|
+
|
|
587
|
+
### What Was Clarified
|
|
588
|
+
- ~~Assumed Redis for sessions~~ → Actually uses database-backed sessions
|
|
589
|
+
|
|
590
|
+
### Key Insights
|
|
591
|
+
- Current architecture supports horizontal scaling
|
|
592
|
+
- Security audit recommended before production
|
|
593
|
+
```
|
|
594
|
+
|
|
595
|
+
## Error Handling
|
|
596
|
+
|
|
597
|
+
| Situation | Action |
|
|
598
|
+
|-----------|--------|
|
|
599
|
+
| Exploration fails | Continue with available context, note limitation |
|
|
600
|
+
| User timeout in discussion | Save state, show resume instructions |
|
|
601
|
+
| Max rounds reached | Force synthesis, offer continuation option |
|
|
602
|
+
| No relevant findings | Broaden search, ask user for clarification |
|
|
603
|
+
| Session folder conflict | Append timestamp suffix |
|
|
604
|
+
|
|
605
|
+
---
|
|
606
|
+
|
|
607
|
+
**Now execute the analyze-with-file workflow for topic**: $TOPIC
|