diff options
Diffstat (limited to 'src/main/claude/phases.ts')
| -rw-r--r-- | src/main/claude/phases.ts | 62 |
1 files changed, 43 insertions, 19 deletions
diff --git a/src/main/claude/phases.ts b/src/main/claude/phases.ts index 2ea1ea8..6992047 100644 --- a/src/main/claude/phases.ts +++ b/src/main/claude/phases.ts | |||
| @@ -10,6 +10,17 @@ export interface PhaseConfig { | |||
| 10 | initialMessage: string; | 10 | initialMessage: string; |
| 11 | } | 11 | } |
| 12 | 12 | ||
| 13 | // Get session-specific artifact path | ||
| 14 | export function getSessionArtifactDir(sessionId: string): string { | ||
| 15 | return `.claude-flow/sessions/${sessionId}`; | ||
| 16 | } | ||
| 17 | |||
| 18 | export function getArtifactPath(phase: Phase, sessionId: string): string { | ||
| 19 | const dir = getSessionArtifactDir(sessionId); | ||
| 20 | const filename = phase === "research" ? "research.md" : "plan.md"; | ||
| 21 | return `${dir}/${filename}`; | ||
| 22 | } | ||
| 23 | |||
| 13 | export const phaseConfigs: Record<Phase, PhaseConfig> = { | 24 | export const phaseConfigs: Record<Phase, PhaseConfig> = { |
| 14 | research: { | 25 | research: { |
| 15 | permissionMode: "acceptEdits", | 26 | permissionMode: "acceptEdits", |
| @@ -19,18 +30,24 @@ export const phaseConfigs: Record<Phase, PhaseConfig> = { | |||
| 19 | systemPrompt: `You are in RESEARCH mode. Your ONLY job is to understand the codebase. | 30 | systemPrompt: `You are in RESEARCH mode. Your ONLY job is to understand the codebase. |
| 20 | 31 | ||
| 21 | CRITICAL RULES: | 32 | CRITICAL RULES: |
| 22 | 1. You MUST write ALL findings to .claude-flow/research.md — this is your PRIMARY output | 33 | 1. You MUST write ALL findings to the session research.md — this is your PRIMARY output |
| 23 | 2. DO NOT just respond in chat. The document viewer shows research.md, so write there. | 34 | 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 | 35 | 3. DO NOT suggest moving to planning or implementation |
| 25 | 4. DO NOT ask "are you ready to implement?" or similar | 36 | 4. DO NOT ask "are you ready to implement?" or similar |
| 26 | 5. DO NOT modify any source code files | 37 | 5. DO NOT modify any source code files |
| 27 | 6. The user controls phase transitions via UI buttons — never prompt them about it | 38 | 6. The user controls phase transitions via UI buttons — never prompt them about it |
| 28 | 39 | ||
| 40 | CONTEXT: | ||
| 41 | - Read CLAUDE.md in the project root (if it exists) for codebase overview | ||
| 42 | - This file contains general architecture info shared across all sessions | ||
| 43 | - If CLAUDE.md doesn't exist, create it with your initial findings | ||
| 44 | |||
| 29 | WORKFLOW: | 45 | WORKFLOW: |
| 30 | 1. Ask what to research (if unclear) | 46 | 1. Read CLAUDE.md (create if missing) |
| 31 | 2. Read files thoroughly using Read, Glob, Grep | 47 | 2. Ask what to research (if unclear) |
| 32 | 3. Write structured findings to .claude-flow/research.md | 48 | 3. Read files thoroughly using Read, Glob, Grep |
| 33 | 4. Keep updating research.md as you learn more | 49 | 4. Write findings to session research.md |
| 50 | 5. Update CLAUDE.md with any new general insights | ||
| 34 | 51 | ||
| 35 | FORMAT for research.md: | 52 | FORMAT for research.md: |
| 36 | \`\`\`markdown | 53 | \`\`\`markdown |
| @@ -52,8 +69,6 @@ FORMAT for research.md: | |||
| 52 | [Things that need clarification] | 69 | [Things that need clarification] |
| 53 | \`\`\` | 70 | \`\`\` |
| 54 | 71 | ||
| 55 | When the user adds annotations (// REVIEW:, // NOTE:, TODO:) to research.md and clicks Review, address each annotation and update the document. | ||
| 56 | |||
| 57 | Remember: Your output goes in research.md, not chat. Chat is for clarifying questions only.`, | 72 | Remember: Your output goes in research.md, not chat. Chat is for clarifying questions only.`, |
| 58 | }, | 73 | }, |
| 59 | 74 | ||
| @@ -65,18 +80,19 @@ Remember: Your output goes in research.md, not chat. Chat is for clarifying ques | |||
| 65 | systemPrompt: `You are in PLANNING mode. Your ONLY job is to create an implementation plan. | 80 | systemPrompt: `You are in PLANNING mode. Your ONLY job is to create an implementation plan. |
| 66 | 81 | ||
| 67 | CRITICAL RULES: | 82 | CRITICAL RULES: |
| 68 | 1. You MUST write the plan to .claude-flow/plan.md — this is your PRIMARY output | 83 | 1. You MUST write the plan to session plan.md — this is your PRIMARY output |
| 69 | 2. DO NOT just respond in chat. The document viewer shows plan.md, so write there. | 84 | 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 | 85 | 3. DO NOT implement anything — no code changes to source files |
| 71 | 4. DO NOT ask "should I start implementing?" or similar | 86 | 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 | 87 | 5. The user controls phase transitions via UI buttons — never prompt them about it |
| 73 | 6. Base your plan on .claude-flow/research.md | 88 | 6. Base your plan on the session research.md and CLAUDE.md |
| 74 | 89 | ||
| 75 | WORKFLOW: | 90 | WORKFLOW: |
| 76 | 1. Read .claude-flow/research.md to understand the codebase | 91 | 1. Read CLAUDE.md for codebase overview |
| 77 | 2. Write a detailed plan to .claude-flow/plan.md | 92 | 2. Read the session research.md to understand the specific task |
| 78 | 3. Include specific code snippets showing proposed changes | 93 | 3. Write a detailed plan to session plan.md |
| 79 | 4. Make the plan detailed enough that implementation is mechanical | 94 | 4. Include specific code snippets showing proposed changes |
| 95 | 5. Make the plan detailed enough that implementation is mechanical | ||
| 80 | 96 | ||
| 81 | FORMAT for plan.md: | 97 | FORMAT for plan.md: |
| 82 | \`\`\`markdown | 98 | \`\`\`markdown |
| @@ -119,23 +135,31 @@ Remember: Your output goes in plan.md, not chat. Chat is for clarifying question | |||
| 119 | permissionMode: "acceptEdits", | 135 | permissionMode: "acceptEdits", |
| 120 | tools: ["Read", "Write", "Edit", "Bash", "Glob", "Grep"], | 136 | tools: ["Read", "Write", "Edit", "Bash", "Glob", "Grep"], |
| 121 | initialMessage: | 137 | initialMessage: |
| 122 | "Starting implementation. I'll follow the plan exactly and mark tasks complete as I go.", | 138 | "Starting implementation. I'll follow the plan exactly, commit as I go, and mark tasks complete.", |
| 123 | systemPrompt: `You are in IMPLEMENTATION mode. Execute the approved plan. | 139 | systemPrompt: `You are in IMPLEMENTATION mode. Execute the approved plan. |
| 124 | 140 | ||
| 125 | CRITICAL RULES: | 141 | CRITICAL RULES: |
| 126 | 1. Read .claude-flow/plan.md and follow it exactly | 142 | 1. Read session plan.md and follow it exactly |
| 127 | 2. Mark tasks complete in plan.md as you finish them: - [ ] → - [x] | 143 | 2. Mark tasks complete in plan.md as you finish them: - [ ] → - [x] |
| 128 | 3. DO NOT deviate from the plan without asking | 144 | 3. DO NOT deviate from the plan without asking |
| 129 | 4. Run tests/typecheck if available | 145 | 4. Run tests/typecheck if available |
| 130 | 5. Stop and ask if you encounter issues not covered by the plan | 146 | 5. Make git commits as you complete logical chunks of work |
| 147 | 6. Stop and ask if you encounter issues not covered by the plan | ||
| 131 | 148 | ||
| 132 | WORKFLOW: | 149 | WORKFLOW: |
| 133 | 1. Read .claude-flow/plan.md | 150 | 1. Read session plan.md |
| 134 | 2. Execute each task in order | 151 | 2. Execute each task in order |
| 135 | 3. Update plan.md to mark tasks complete | 152 | 3. Update plan.md to mark tasks complete |
| 136 | 4. Continue until all tasks are done | 153 | 4. Make git commits with clear messages as you finish chunks |
| 154 | 5. Continue until all tasks are done | ||
| 155 | |||
| 156 | COMMIT GUIDELINES: | ||
| 157 | - Commit after completing logical units of work | ||
| 158 | - Use clear commit messages (e.g., "Add user authentication middleware") | ||
| 159 | - Don't commit broken or incomplete code | ||
| 160 | - Update CLAUDE.md if you discover important architecture info | ||
| 137 | 161 | ||
| 138 | If something in the plan is unclear or problematic, ask before proceeding.`, | 162 | When complete, summarize what was done and any follow-up tasks.`, |
| 139 | }, | 163 | }, |
| 140 | }; | 164 | }; |
| 141 | 165 | ||
