mirror of
https://github.com/catlog22/Claude-Code-Workflow.git
synced 2026-02-11 02:33:51 +08:00
fix: Clarify multi-round clarification and enforce session timestamp format
- Phase 2 Clarification: max 4 questions per round, multiple rounds allowed - Session Setup: MANDATORY timestamp in sessionId format (slug-YYYY-MM-DD-HH-mm-ss) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -43,11 +43,11 @@ Phase 1: Bug Analysis & Diagnosis
|
|||||||
|- needsDiagnosis=true -> Launch parallel cli-explore-agents (1-4 based on severity)
|
|- needsDiagnosis=true -> Launch parallel cli-explore-agents (1-4 based on severity)
|
||||||
+- needsDiagnosis=false (hotfix) -> Skip directly to Phase 3 (Fix Planning)
|
+- needsDiagnosis=false (hotfix) -> Skip directly to Phase 3 (Fix Planning)
|
||||||
|
|
||||||
Phase 2: Clarification (optional)
|
Phase 2: Clarification (optional, multi-round)
|
||||||
|- Aggregate clarification_needs from all diagnosis angles
|
|- Aggregate clarification_needs from all diagnosis angles
|
||||||
|- Deduplicate similar questions
|
|- Deduplicate similar questions
|
||||||
+- Decision:
|
+- Decision:
|
||||||
|- Has clarifications -> AskUserQuestion (max 4 questions)
|
|- Has clarifications -> AskUserQuestion (max 4 questions per round, multiple rounds allowed)
|
||||||
+- No clarifications -> Skip to Phase 3
|
+- No clarifications -> Skip to Phase 3
|
||||||
|
|
||||||
Phase 3: Fix Planning (NO CODE EXECUTION - planning only)
|
Phase 3: Fix Planning (NO CODE EXECUTION - planning only)
|
||||||
@@ -71,15 +71,17 @@ Phase 5: Dispatch
|
|||||||
|
|
||||||
### Phase 1: Intelligent Multi-Angle Diagnosis
|
### Phase 1: Intelligent Multi-Angle Diagnosis
|
||||||
|
|
||||||
**Session Setup**:
|
**Session Setup** (MANDATORY - follow exactly):
|
||||||
```javascript
|
```javascript
|
||||||
// Helper: Get UTC+8 (China Standard Time) ISO string
|
// Helper: Get UTC+8 (China Standard Time) ISO string
|
||||||
const getUtc8ISOString = () => new Date(Date.now() + 8 * 60 * 60 * 1000).toISOString()
|
const getUtc8ISOString = () => new Date(Date.now() + 8 * 60 * 60 * 1000).toISOString()
|
||||||
|
|
||||||
const bugSlug = bug_description.toLowerCase().replace(/[^a-z0-9]+/g, '-').substring(0, 40)
|
const bugSlug = bug_description.toLowerCase().replace(/[^a-z0-9]+/g, '-').substring(0, 40)
|
||||||
const timestamp = getUtc8ISOString().replace(/[:.]/g, '-')
|
const timestamp = getUtc8ISOString().replace(/[:.]/g, '-')
|
||||||
const shortTimestamp = timestamp.substring(0, 19).replace('T', '-')
|
const shortTimestamp = timestamp.substring(0, 19).replace('T', '-') // Format: 2025-11-29-14-30-25
|
||||||
const sessionId = `${bugSlug}-${shortTimestamp}`
|
|
||||||
|
// ⚠️ CRITICAL: sessionId MUST include both slug AND timestamp
|
||||||
|
const sessionId = `${bugSlug}-${shortTimestamp}` // e.g., "user-avatar-upload-fails-2025-11-29-14-30-25"
|
||||||
const sessionFolder = `.workflow/.lite-fix/${sessionId}`
|
const sessionFolder = `.workflow/.lite-fix/${sessionId}`
|
||||||
|
|
||||||
bash(`mkdir -p ${sessionFolder}`)
|
bash(`mkdir -p ${sessionFolder}`)
|
||||||
@@ -287,7 +289,7 @@ Angles diagnosed: ${diagnosisManifest.diagnoses.map(d => d.angle).join(', ')}
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
### Phase 2: Clarification (Optional)
|
### Phase 2: Clarification (Optional, Multi-Round)
|
||||||
|
|
||||||
**Skip if**: No diagnosis or `clarification_needs` is empty across all diagnoses
|
**Skip if**: No diagnosis or `clarification_needs` is empty across all diagnoses
|
||||||
|
|
||||||
@@ -327,21 +329,29 @@ function deduplicateClarifications(clarifications) {
|
|||||||
|
|
||||||
const uniqueClarifications = deduplicateClarifications(allClarifications)
|
const uniqueClarifications = deduplicateClarifications(allClarifications)
|
||||||
|
|
||||||
|
// Multi-round clarification: batch questions (max 4 per round)
|
||||||
if (uniqueClarifications.length > 0) {
|
if (uniqueClarifications.length > 0) {
|
||||||
AskUserQuestion({
|
const BATCH_SIZE = 4
|
||||||
questions: uniqueClarifications.map(need => ({
|
for (let i = 0; i < uniqueClarifications.length; i += BATCH_SIZE) {
|
||||||
question: `[${need.source_angle}] ${need.question}\n\nContext: ${need.context}`,
|
const batch = uniqueClarifications.slice(i, i + BATCH_SIZE)
|
||||||
header: need.source_angle,
|
|
||||||
multiSelect: false,
|
AskUserQuestion({
|
||||||
options: need.options.map((opt, index) => {
|
questions: batch.map(need => ({
|
||||||
const isRecommended = need.recommended === index
|
question: `[${need.source_angle}] ${need.question}\n\nContext: ${need.context}`,
|
||||||
return {
|
header: need.source_angle,
|
||||||
label: isRecommended ? `${opt} ★` : opt,
|
multiSelect: false,
|
||||||
description: isRecommended ? `Use ${opt} approach (Recommended)` : `Use ${opt} approach`
|
options: need.options.map((opt, index) => {
|
||||||
}
|
const isRecommended = need.recommended === index
|
||||||
})
|
return {
|
||||||
}))
|
label: isRecommended ? `${opt} ★` : opt,
|
||||||
})
|
description: isRecommended ? `Use ${opt} approach (Recommended)` : `Use ${opt} approach`
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}))
|
||||||
|
})
|
||||||
|
|
||||||
|
// Store batch responses in clarificationContext before next round
|
||||||
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
@@ -43,11 +43,11 @@ Phase 1: Task Analysis & Exploration
|
|||||||
├─ needsExploration=true → Launch parallel cli-explore-agents (1-4 based on complexity)
|
├─ needsExploration=true → Launch parallel cli-explore-agents (1-4 based on complexity)
|
||||||
└─ needsExploration=false → Skip to Phase 2/3
|
└─ needsExploration=false → Skip to Phase 2/3
|
||||||
|
|
||||||
Phase 2: Clarification (optional)
|
Phase 2: Clarification (optional, multi-round)
|
||||||
├─ Aggregate clarification_needs from all exploration angles
|
├─ Aggregate clarification_needs from all exploration angles
|
||||||
├─ Deduplicate similar questions
|
├─ Deduplicate similar questions
|
||||||
└─ Decision:
|
└─ Decision:
|
||||||
├─ Has clarifications → AskUserQuestion (max 4 questions)
|
├─ Has clarifications → AskUserQuestion (max 4 questions per round, multiple rounds allowed)
|
||||||
└─ No clarifications → Skip to Phase 3
|
└─ No clarifications → Skip to Phase 3
|
||||||
|
|
||||||
Phase 3: Planning (NO CODE EXECUTION - planning only)
|
Phase 3: Planning (NO CODE EXECUTION - planning only)
|
||||||
@@ -71,15 +71,17 @@ Phase 5: Dispatch
|
|||||||
|
|
||||||
### Phase 1: Intelligent Multi-Angle Exploration
|
### Phase 1: Intelligent Multi-Angle Exploration
|
||||||
|
|
||||||
**Session Setup**:
|
**Session Setup** (MANDATORY - follow exactly):
|
||||||
```javascript
|
```javascript
|
||||||
// Helper: Get UTC+8 (China Standard Time) ISO string
|
// Helper: Get UTC+8 (China Standard Time) ISO string
|
||||||
const getUtc8ISOString = () => new Date(Date.now() + 8 * 60 * 60 * 1000).toISOString()
|
const getUtc8ISOString = () => new Date(Date.now() + 8 * 60 * 60 * 1000).toISOString()
|
||||||
|
|
||||||
const taskSlug = task_description.toLowerCase().replace(/[^a-z0-9]+/g, '-').substring(0, 40)
|
const taskSlug = task_description.toLowerCase().replace(/[^a-z0-9]+/g, '-').substring(0, 40)
|
||||||
const timestamp = getUtc8ISOString().replace(/[:.]/g, '-')
|
const timestamp = getUtc8ISOString().replace(/[:.]/g, '-')
|
||||||
const shortTimestamp = timestamp.substring(0, 19).replace('T', '-')
|
const shortTimestamp = timestamp.substring(0, 19).replace('T', '-') // Format: 2025-11-29-14-30-25
|
||||||
const sessionId = `${taskSlug}-${shortTimestamp}`
|
|
||||||
|
// ⚠️ CRITICAL: sessionId MUST include both slug AND timestamp
|
||||||
|
const sessionId = `${taskSlug}-${shortTimestamp}` // e.g., "implement-jwt-refresh-2025-11-29-14-30-25"
|
||||||
const sessionFolder = `.workflow/.lite-plan/${sessionId}`
|
const sessionFolder = `.workflow/.lite-plan/${sessionId}`
|
||||||
|
|
||||||
bash(`mkdir -p ${sessionFolder}`)
|
bash(`mkdir -p ${sessionFolder}`)
|
||||||
@@ -276,7 +278,7 @@ Angles explored: ${explorationManifest.explorations.map(e => e.angle).join(', ')
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
### Phase 2: Clarification (Optional)
|
### Phase 2: Clarification (Optional, Multi-Round)
|
||||||
|
|
||||||
**Skip if**: No exploration or `clarification_needs` is empty across all explorations
|
**Skip if**: No exploration or `clarification_needs` is empty across all explorations
|
||||||
|
|
||||||
@@ -316,21 +318,29 @@ function deduplicateClarifications(clarifications) {
|
|||||||
|
|
||||||
const uniqueClarifications = deduplicateClarifications(allClarifications)
|
const uniqueClarifications = deduplicateClarifications(allClarifications)
|
||||||
|
|
||||||
|
// Multi-round clarification: batch questions (max 4 per round)
|
||||||
if (uniqueClarifications.length > 0) {
|
if (uniqueClarifications.length > 0) {
|
||||||
AskUserQuestion({
|
const BATCH_SIZE = 4
|
||||||
questions: uniqueClarifications.map(need => ({
|
for (let i = 0; i < uniqueClarifications.length; i += BATCH_SIZE) {
|
||||||
question: `[${need.source_angle}] ${need.question}\n\nContext: ${need.context}`,
|
const batch = uniqueClarifications.slice(i, i + BATCH_SIZE)
|
||||||
header: need.source_angle,
|
|
||||||
multiSelect: false,
|
AskUserQuestion({
|
||||||
options: need.options.map((opt, index) => {
|
questions: batch.map(need => ({
|
||||||
const isRecommended = need.recommended === index
|
question: `[${need.source_angle}] ${need.question}\n\nContext: ${need.context}`,
|
||||||
return {
|
header: need.source_angle,
|
||||||
label: isRecommended ? `${opt} ★` : opt,
|
multiSelect: false,
|
||||||
description: isRecommended ? `Use ${opt} approach (Recommended)` : `Use ${opt} approach`
|
options: need.options.map((opt, index) => {
|
||||||
}
|
const isRecommended = need.recommended === index
|
||||||
})
|
return {
|
||||||
}))
|
label: isRecommended ? `${opt} ★` : opt,
|
||||||
})
|
description: isRecommended ? `Use ${opt} approach (Recommended)` : `Use ${opt} approach`
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}))
|
||||||
|
})
|
||||||
|
|
||||||
|
// Store batch responses in clarificationContext before next round
|
||||||
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user