fix(analyze-with-file): add session termination boundary and optimize Phase 4 UX

- Add explicit session termination output before lite-planex handoff to
  prevent phase collision between analyze-with-file and lite-plan
- Restructure Phase 4: display conclusions summary before asking next step
- Simplify post-completion options to 3 (执行任务/产出Issue/完成),
  remove redundant 导出报告 since report is always shown
- Update 01-lite-plan.md context isolation label to match new option name
This commit is contained in:
catlog22
2026-03-02 16:46:33 +08:00
parent 57636040d2
commit d346d48ba2
2 changed files with 30 additions and 12 deletions

View File

@@ -526,7 +526,7 @@ CONSTRAINTS: ${perspective.constraints}
- **📌 Decision summary**: How key decisions shaped the final conclusions (link conclusions back to decisions) - **📌 Decision summary**: How key decisions shaped the final conclusions (link conclusions back to decisions)
- Write to conclusions.json - Write to conclusions.json
2. **Final discussion.md Update** 3. **Final discussion.md Update**
- Append conclusions section: - Append conclusions section:
- **Summary**: High-level overview - **Summary**: High-level overview
- **Key Conclusions**: Ranked with evidence and confidence - **Key Conclusions**: Ranked with evidence and confidence
@@ -542,33 +542,51 @@ CONSTRAINTS: ${perspective.constraints}
- **Trade-offs Made**: Key trade-offs and why certain paths were chosen over others - **Trade-offs Made**: Key trade-offs and why certain paths were chosen over others
- Add session statistics: rounds, duration, sources, artifacts, **decision count** - Add session statistics: rounds, duration, sources, artifacts, **decision count**
3. **Post-Completion Options** (⚠️ TERMINAL — analyze-with-file ends after user selection) 4. **Display Conclusions Summary**
- Present analysis conclusions to the user before asking for next steps:
```javascript
console.log(`
## Analysis Report
**Summary**: ${conclusions.summary}
**Key Conclusions** (${conclusions.key_conclusions.length}):
${conclusions.key_conclusions.map((c, i) => `${i+1}. [${c.confidence}] ${c.point}`).join('\n')}
**Recommendations** (${conclusions.recommendations.length}):
${conclusions.recommendations.map((r, i) => `${i+1}. [${r.priority}] ${r.action} — ${r.rationale}`).join('\n')}
${conclusions.open_questions.length > 0 ? `\n**Open Questions**:\n${conclusions.open_questions.map(q => '- ' + q).join('\n')}` : ''}
📄 Full report: ${sessionFolder}/discussion.md
`)
```
5. **Post-Completion Options** (⚠️ TERMINAL — analyze-with-file ends after user selection)
> **WORKFLOW BOUNDARY**: After user selects any option below, the analyze-with-file workflow is **COMPLETE**. > **WORKFLOW BOUNDARY**: After user selects any option below, the analyze-with-file workflow is **COMPLETE**.
> If "生成任务" is selected, workflow-lite-planex takes over exclusively — do NOT return to any analyze-with-file phase. > If "执行任务" is selected, workflow-lite-planex takes over exclusively — do NOT return to any analyze-with-file phase.
> The "Phase" numbers in workflow-lite-planex (Phase 1-5) are SEPARATE from analyze-with-file phases. > The "Phase" numbers in workflow-lite-planex (LP-Phase 1-5) are SEPARATE from analyze-with-file phases.
```javascript ```javascript
const hasActionableRecs = conclusions.recommendations?.some(r => r.priority === 'high' || r.priority === 'medium') const hasActionableRecs = conclusions.recommendations?.some(r => r.priority === 'high' || r.priority === 'medium')
const nextStep = AskUserQuestion({ const nextStep = AskUserQuestion({
questions: [{ questions: [{
question: "Analysis complete. What's next?", question: "Report generated. What would you like to do next?",
header: "Next Step", header: "Next Step",
multiSelect: false, multiSelect: false,
options: [ options: [
{ label: hasActionableRecs ? "生成任务 (Recommended)" : "生成任务", description: "Launch workflow-lite-planex with analysis context" }, { label: hasActionableRecs ? "执行任务 (Recommended)" : "执行任务", description: "Launch workflow-lite-planex to plan & execute" },
{ label: "创建Issue", description: "Launch issue-discover with conclusions" }, { label: "产出Issue", description: "Launch issue-discover with conclusions" },
{ label: "导出报告", description: "Generate standalone analysis report" },
{ label: "完成", description: "No further action" } { label: "完成", description: "No further action" }
] ]
}] }]
}) })
``` ```
**Handle "生成任务"** (⚠️ TERMINAL — analyze-with-file ends here, lite-plan takes over exclusively): **Handle "执行任务"** (⚠️ TERMINAL — analyze-with-file ends here, lite-plan takes over exclusively):
```javascript ```javascript
if (nextStep.includes("生成任务")) { if (nextStep.includes("执行任务")) {
// 1. Build task description from high/medium priority recommendations // 1. Build task description from high/medium priority recommendations
const taskDescription = conclusions.recommendations const taskDescription = conclusions.recommendations
.filter(r => r.priority === 'high' || r.priority === 'medium') .filter(r => r.priority === 'high' || r.priority === 'medium')
@@ -784,7 +802,7 @@ User agrees with current direction, wants deeper code analysis
- Need simple task breakdown - Need simple task breakdown
- Focus on quick execution planning - Focus on quick execution planning
> **Note**: Phase 4「生成任务」assembles analysis context as inline `## Prior Analysis` block in task description, allowing lite-plan to skip redundant exploration automatically. > **Note**: Phase 4「执行任务」assembles analysis context as inline `## Prior Analysis` block in task description, allowing lite-plan to skip redundant exploration automatically.
--- ---

View File

@@ -18,7 +18,7 @@ Intelligent lightweight planning command with dynamic workflow adaptation based
## Context Isolation ## Context Isolation
> **⚠️ CRITICAL**: If this phase was invoked from analyze-with-file (via "生成任务"), > **⚠️ CRITICAL**: If this phase was invoked from analyze-with-file (via "执行任务"),
> the analyze-with-file session is **COMPLETE** and all its phase instructions > the analyze-with-file session is **COMPLETE** and all its phase instructions
> are FINISHED and MUST NOT be referenced. > are FINISHED and MUST NOT be referenced.
> Only follow the LP-Phase 1-5 defined in THIS document (01-lite-plan.md). > Only follow the LP-Phase 1-5 defined in THIS document (01-lite-plan.md).