From d346d48ba25601ba802f18de8b0a09600812e152 Mon Sep 17 00:00:00 2001 From: catlog22 Date: Mon, 2 Mar 2026 16:46:33 +0800 Subject: [PATCH] fix(analyze-with-file): add session termination boundary and optimize Phase 4 UX MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 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 --- .../commands/workflow/analyze-with-file.md | 40 ++++++++++++++----- .../phases/01-lite-plan.md | 2 +- 2 files changed, 30 insertions(+), 12 deletions(-) diff --git a/.claude/commands/workflow/analyze-with-file.md b/.claude/commands/workflow/analyze-with-file.md index 070e7ae9..b5c6bfce 100644 --- a/.claude/commands/workflow/analyze-with-file.md +++ b/.claude/commands/workflow/analyze-with-file.md @@ -526,7 +526,7 @@ CONSTRAINTS: ${perspective.constraints} - **📌 Decision summary**: How key decisions shaped the final conclusions (link conclusions back to decisions) - Write to conclusions.json -2. **Final discussion.md Update** +3. **Final discussion.md Update** - Append conclusions section: - **Summary**: High-level overview - **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 - 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**. - > 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. + > 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 (LP-Phase 1-5) are SEPARATE from analyze-with-file phases. ```javascript const hasActionableRecs = conclusions.recommendations?.some(r => r.priority === 'high' || r.priority === 'medium') const nextStep = AskUserQuestion({ questions: [{ - question: "Analysis complete. What's next?", + question: "Report generated. What would you like to do next?", header: "Next Step", multiSelect: false, options: [ - { label: hasActionableRecs ? "生成任务 (Recommended)" : "生成任务", description: "Launch workflow-lite-planex with analysis context" }, - { label: "创建Issue", description: "Launch issue-discover with conclusions" }, - { label: "导出报告", description: "Generate standalone analysis report" }, + { label: hasActionableRecs ? "执行任务 (Recommended)" : "执行任务", description: "Launch workflow-lite-planex to plan & execute" }, + { label: "产出Issue", description: "Launch issue-discover with conclusions" }, { 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 - if (nextStep.includes("生成任务")) { + if (nextStep.includes("执行任务")) { // 1. Build task description from high/medium priority recommendations const taskDescription = conclusions.recommendations .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 - 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. --- diff --git a/.claude/skills/workflow-lite-planex/phases/01-lite-plan.md b/.claude/skills/workflow-lite-planex/phases/01-lite-plan.md index 85c3edfb..bba1c381 100644 --- a/.claude/skills/workflow-lite-planex/phases/01-lite-plan.md +++ b/.claude/skills/workflow-lite-planex/phases/01-lite-plan.md @@ -18,7 +18,7 @@ Intelligent lightweight planning command with dynamic workflow adaptation based ## 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 > are FINISHED and MUST NOT be referenced. > Only follow the LP-Phase 1-5 defined in THIS document (01-lite-plan.md).