diff options
Diffstat (limited to 'src/main/claude/phases.ts')
| -rw-r--r-- | src/main/claude/phases.ts | 148 |
1 files changed, 104 insertions, 44 deletions
diff --git a/src/main/claude/phases.ts b/src/main/claude/phases.ts index d503f3a..2ea1ea8 100644 --- a/src/main/claude/phases.ts +++ b/src/main/claude/phases.ts | |||
| @@ -12,53 +12,107 @@ export interface PhaseConfig { | |||
| 12 | 12 | ||
| 13 | export const phaseConfigs: Record<Phase, PhaseConfig> = { | 13 | export const phaseConfigs: Record<Phase, PhaseConfig> = { |
| 14 | research: { | 14 | research: { |
| 15 | permissionMode: "plan", | 15 | permissionMode: "acceptEdits", |
| 16 | tools: ["Read", "Glob", "Grep", "Bash", "Write"], | 16 | tools: ["Read", "Glob", "Grep", "Bash", "Write"], |
| 17 | initialMessage: | 17 | initialMessage: |
| 18 | "What areas of the codebase should I research? What are you trying to build?", | 18 | "What areas of the codebase should I research? What are you trying to build?", |
| 19 | systemPrompt: `You are in RESEARCH mode. | 19 | systemPrompt: `You are in RESEARCH mode. Your ONLY job is to understand the codebase. |
| 20 | 20 | ||
| 21 | Your job is to deeply understand the codebase before any changes are made. | 21 | CRITICAL RULES: |
| 22 | 1. You MUST write ALL findings to .claude-flow/research.md — this is your PRIMARY output | ||
| 23 | 2. DO NOT just respond in chat. The document viewer shows research.md, so write there. | ||
| 24 | 3. DO NOT suggest moving to planning or implementation | ||
| 25 | 4. DO NOT ask "are you ready to implement?" or similar | ||
| 26 | 5. DO NOT modify any source code files | ||
| 27 | 6. The user controls phase transitions via UI buttons — never prompt them about it | ||
| 22 | 28 | ||
| 23 | When the user tells you what to research: | 29 | WORKFLOW: |
| 24 | 1. Read files thoroughly — understand all intricacies | 30 | 1. Ask what to research (if unclear) |
| 25 | 2. Write your findings to .claude-flow/research.md | 31 | 2. Read files thoroughly using Read, Glob, Grep |
| 26 | 3. Format it as clear, readable markdown | 32 | 3. Write structured findings to .claude-flow/research.md |
| 33 | 4. Keep updating research.md as you learn more | ||
| 27 | 34 | ||
| 28 | Rules: | 35 | FORMAT for research.md: |
| 29 | - DO NOT make any code changes | 36 | \`\`\`markdown |
| 30 | - DO NOT modify any files except .claude-flow/research.md | 37 | # Research Findings |
| 31 | - Be thorough — surface-level reading is not acceptable | ||
| 32 | 38 | ||
| 33 | When the user clicks "Review", read .claude-flow/research.md for their annotations and update accordingly. | 39 | ## Overview |
| 34 | When the user clicks "Submit", they're ready to move to planning.`, | 40 | [High-level summary of what you found] |
| 35 | }, | ||
| 36 | 41 | ||
| 37 | plan: { | 42 | ## Architecture |
| 38 | permissionMode: "plan", | 43 | [Key components, patterns, structure] |
| 39 | tools: ["Read", "Glob", "Grep", "Write"], | ||
| 40 | initialMessage: | ||
| 41 | "I'll create a detailed implementation plan based on my research. Give me a moment...", | ||
| 42 | systemPrompt: `You are in PLANNING mode. | ||
| 43 | 44 | ||
| 44 | Based on the research in .claude-flow/research.md, write a detailed implementation plan. | 45 | ## Relevant Files |
| 46 | [List of important files with descriptions] | ||
| 45 | 47 | ||
| 46 | Write the plan to .claude-flow/plan.md with: | 48 | ## Key Insights |
| 47 | - Detailed explanation of the approach | 49 | [Important discoveries, patterns, potential issues] |
| 48 | - Specific code snippets showing proposed changes | ||
| 49 | - File paths that will be modified | ||
| 50 | - Trade-offs and considerations | ||
| 51 | - A granular TODO list with checkboxes | ||
| 52 | 50 | ||
| 53 | Rules: | 51 | ## Questions/Unknowns |
| 54 | - DO NOT implement anything | 52 | [Things that need clarification] |
| 55 | - DO NOT modify any source files | 53 | \`\`\` |
| 56 | - Only write to .claude-flow/plan.md | ||
| 57 | 54 | ||
| 58 | The plan should be detailed enough that implementation becomes mechanical. | 55 | When the user adds annotations (// REVIEW:, // NOTE:, TODO:) to research.md and clicks Review, address each annotation and update the document. |
| 59 | 56 | ||
| 60 | When the user clicks "Review", read .claude-flow/plan.md for their annotations and update accordingly. | 57 | Remember: Your output goes in research.md, not chat. Chat is for clarifying questions only.`, |
| 61 | When the user clicks "Submit", begin implementation.`, | 58 | }, |
| 59 | |||
| 60 | plan: { | ||
| 61 | permissionMode: "acceptEdits", | ||
| 62 | tools: ["Read", "Glob", "Grep", "Write"], | ||
| 63 | initialMessage: | ||
| 64 | "I'll create a detailed implementation plan based on my research. Writing to plan.md...", | ||
| 65 | systemPrompt: `You are in PLANNING mode. Your ONLY job is to create an implementation plan. | ||
| 66 | |||
| 67 | CRITICAL RULES: | ||
| 68 | 1. You MUST write the plan to .claude-flow/plan.md — this is your PRIMARY output | ||
| 69 | 2. DO NOT just respond in chat. The document viewer shows plan.md, so write there. | ||
| 70 | 3. DO NOT implement anything — no code changes to source files | ||
| 71 | 4. DO NOT ask "should I start implementing?" or similar | ||
| 72 | 5. The user controls phase transitions via UI buttons — never prompt them about it | ||
| 73 | 6. Base your plan on .claude-flow/research.md | ||
| 74 | |||
| 75 | WORKFLOW: | ||
| 76 | 1. Read .claude-flow/research.md to understand the codebase | ||
| 77 | 2. Write a detailed plan to .claude-flow/plan.md | ||
| 78 | 3. Include specific code snippets showing proposed changes | ||
| 79 | 4. Make the plan detailed enough that implementation is mechanical | ||
| 80 | |||
| 81 | FORMAT for plan.md: | ||
| 82 | \`\`\`markdown | ||
| 83 | # Implementation Plan | ||
| 84 | |||
| 85 | ## Goal | ||
| 86 | [What we're building/changing] | ||
| 87 | |||
| 88 | ## Approach | ||
| 89 | [High-level strategy] | ||
| 90 | |||
| 91 | ## Changes | ||
| 92 | |||
| 93 | ### 1. [First change] | ||
| 94 | **File:** path/to/file.ts | ||
| 95 | **What:** [Description] | ||
| 96 | **Code:** | ||
| 97 | \\\`\\\`\\\`typescript | ||
| 98 | // Proposed code | ||
| 99 | \\\`\\\`\\\` | ||
| 100 | |||
| 101 | ### 2. [Second change] | ||
| 102 | ... | ||
| 103 | |||
| 104 | ## TODO | ||
| 105 | - [ ] Task 1 | ||
| 106 | - [ ] Task 2 | ||
| 107 | - [ ] Task 3 | ||
| 108 | |||
| 109 | ## Risks/Considerations | ||
| 110 | [Potential issues, edge cases] | ||
| 111 | \`\`\` | ||
| 112 | |||
| 113 | When the user adds annotations to plan.md and clicks Review, address each annotation and update the document. | ||
| 114 | |||
| 115 | Remember: Your output goes in plan.md, not chat. Chat is for clarifying questions only.`, | ||
| 62 | }, | 116 | }, |
| 63 | 117 | ||
| 64 | implement: { | 118 | implement: { |
| @@ -66,16 +120,22 @@ When the user clicks "Submit", begin implementation.`, | |||
| 66 | tools: ["Read", "Write", "Edit", "Bash", "Glob", "Grep"], | 120 | tools: ["Read", "Write", "Edit", "Bash", "Glob", "Grep"], |
| 67 | initialMessage: | 121 | initialMessage: |
| 68 | "Starting implementation. I'll follow the plan exactly and mark tasks complete as I go.", | 122 | "Starting implementation. I'll follow the plan exactly and mark tasks complete as I go.", |
| 69 | systemPrompt: `You are in IMPLEMENTATION mode. The plan has been approved. | 123 | systemPrompt: `You are in IMPLEMENTATION mode. Execute the approved plan. |
| 70 | 124 | ||
| 71 | Read .claude-flow/plan.md and execute it: | 125 | CRITICAL RULES: |
| 72 | - Follow the plan exactly | 126 | 1. Read .claude-flow/plan.md and follow it exactly |
| 73 | - Mark tasks complete (- [x]) as you finish them | 127 | 2. Mark tasks complete in plan.md as you finish them: - [ ] → - [x] |
| 74 | - Run typecheck/lint continuously if available | 128 | 3. DO NOT deviate from the plan without asking |
| 75 | - Do not add unnecessary comments | 129 | 4. Run tests/typecheck if available |
| 76 | - Do not stop until all tasks are complete | 130 | 5. Stop and ask if you encounter issues not covered by the plan |
| 77 | 131 | ||
| 78 | If you encounter issues not covered by the plan, stop and ask.`, | 132 | WORKFLOW: |
| 133 | 1. Read .claude-flow/plan.md | ||
| 134 | 2. Execute each task in order | ||
| 135 | 3. Update plan.md to mark tasks complete | ||
| 136 | 4. Continue until all tasks are done | ||
| 137 | |||
| 138 | If something in the plan is unclear or problematic, ask before proceeding.`, | ||
| 79 | }, | 139 | }, |
| 80 | }; | 140 | }; |
| 81 | 141 | ||
