aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/claude/phases.ts
diff options
context:
space:
mode:
authorClawd <ai@clawd.bot>2026-02-28 18:46:11 -0800
committerClawd <ai@clawd.bot>2026-02-28 18:46:11 -0800
commit3ac34530578b9a6f59bcea6b5aeefd97eb03d588 (patch)
tree099fe4a4788c5dd5997d1f16f5d2db917eda86d0 /src/main/claude/phases.ts
parentde242df9cbe7dfe483f59f9b25e980727baa4c11 (diff)
Move artifacts to ~/.claude-flow/ (outside repo)
- Store session artifacts in ~/.claude-flow/projects/{projectId}/sessions/{sessionId}/ - Artifacts no longer live in project directory - can't be accidentally committed - Remove .claude-flow/ from .gitignore (not needed anymore) - Update all IPC handlers and renderer to use projectId instead of projectPath - Update prompts to remove worktree references - Update README with new storage location
Diffstat (limited to 'src/main/claude/phases.ts')
-rw-r--r--src/main/claude/phases.ts55
1 files changed, 18 insertions, 37 deletions
diff --git a/src/main/claude/phases.ts b/src/main/claude/phases.ts
index 6678c08..f1df719 100644
--- a/src/main/claude/phases.ts
+++ b/src/main/claude/phases.ts
@@ -10,9 +10,9 @@ export interface PhaseConfig {
10 initialMessage: string; 10 initialMessage: string;
11} 11}
12 12
13// Get session-specific artifact path 13// Get session-specific artifact path (relative to ~/.claude-flow/)
14export function getSessionArtifactDir(sessionId: string): string { 14export function getSessionArtifactDir(sessionId: string): string {
15 return `.claude-flow/sessions/${sessionId}`; 15 return `sessions/${sessionId}`;
16} 16}
17 17
18export function getArtifactPath(phase: Phase, sessionId: string): string { 18export function getArtifactPath(phase: Phase, sessionId: string): string {
@@ -30,7 +30,7 @@ export const phaseConfigs: Record<Phase, PhaseConfig> = {
30 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.
31 31
32CRITICAL RULES: 32CRITICAL RULES:
331. You MUST write ALL findings to \`.claude-flow/sessions/{sessionId}/research.md\` — this is your PRIMARY output 331. You MUST write ALL findings to the session research.md — this is your PRIMARY output
342. DO NOT just respond in chat. The document viewer shows research.md, so write there. 342. DO NOT just respond in chat. The document viewer shows research.md, so write there.
353. DO NOT suggest moving to planning or implementation 353. DO NOT suggest moving to planning or implementation
364. DO NOT ask "are you ready to implement?" or similar 364. DO NOT ask "are you ready to implement?" or similar
@@ -38,16 +38,15 @@ CRITICAL RULES:
386. The user controls phase transitions via UI buttons — never prompt them about it 386. The user controls phase transitions via UI buttons — never prompt them about it
39 39
40CONTEXT: 40CONTEXT:
41- You are in a git worktree at \`.claude-flow/worktrees/{sessionId}/\` 41- Read CLAUDE.md in the project root (if it exists) for codebase overview
42- Read CLAUDE.md in the project root for shared codebase overview
43- If CLAUDE.md doesn't exist, create it with your initial findings
44- This file contains general architecture info shared across all sessions 42- This file contains general architecture info shared across all sessions
43- If CLAUDE.md doesn't exist, create it with your initial findings
45 44
46WORKFLOW: 45WORKFLOW:
471. Read CLAUDE.md (create at project root if missing) 461. Read CLAUDE.md (create at project root if missing)
482. Ask what to research (if unclear) 472. Ask what to research (if unclear)
493. Read files thoroughly using Read, Glob, Grep 483. Read files thoroughly using Read, Glob, Grep
504. Write findings to \`.claude-flow/sessions/{sessionId}/research.md\` 494. Write findings to session research.md
515. Update CLAUDE.md with any new general insights worth sharing 505. Update CLAUDE.md with any new general insights worth sharing
52 51
53FORMAT for research.md: 52FORMAT for research.md:
@@ -70,7 +69,7 @@ FORMAT for research.md:
70[Things that need clarification] 69[Things that need clarification]
71\`\`\` 70\`\`\`
72 71
73Remember: Your output goes in \`.claude-flow/sessions/{sessionId}/research.md\`, not chat. Chat is for clarifying questions only.`, 72Remember: Your output goes in research.md, not chat. Chat is for clarifying questions only.`,
74 }, 73 },
75 74
76 plan: { 75 plan: {
@@ -81,7 +80,7 @@ Remember: Your output goes in \`.claude-flow/sessions/{sessionId}/research.md\`,
81 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.
82 81
83CRITICAL RULES: 82CRITICAL RULES:
841. You MUST write the plan to \`.claude-flow/sessions/{sessionId}/plan.md\` — this is your PRIMARY output 831. You MUST write the plan to session plan.md — this is your PRIMARY output
852. DO NOT just respond in chat. The document viewer shows plan.md, so write there. 842. DO NOT just respond in chat. The document viewer shows plan.md, so write there.
863. DO NOT implement anything — no code changes to source files 853. DO NOT implement anything — no code changes to source files
874. DO NOT ask "should I start implementing?" or similar 864. DO NOT ask "should I start implementing?" or similar
@@ -89,14 +88,13 @@ CRITICAL RULES:
896. Base your plan on the session research.md and CLAUDE.md 886. Base your plan on the session research.md and CLAUDE.md
90 89
91CONTEXT: 90CONTEXT:
92- You are in a git worktree at \`.claude-flow/worktrees/{sessionId}/\`
93- Read CLAUDE.md at project root for codebase overview 91- Read CLAUDE.md at project root for codebase overview
94- Read \`.claude-flow/sessions/{sessionId}/research.md\` for this specific task 92- Read the session research.md to understand the specific task
95 93
96WORKFLOW: 94WORKFLOW:
971. Read CLAUDE.md for codebase overview 951. Read CLAUDE.md for codebase overview
982. Read the session research.md to understand the specific task 962. Read the session research.md to understand the specific task
993. Write a detailed plan to \`.claude-flow/sessions/{sessionId}/plan.md\` 973. Write a detailed plan to session plan.md
1004. Include specific code snippets showing proposed changes 984. Include specific code snippets showing proposed changes
1015. Make the plan detailed enough that implementation is mechanical 995. Make the plan detailed enough that implementation is mechanical
102 100
@@ -134,47 +132,30 @@ FORMAT for plan.md:
134 132
135When the user adds annotations to plan.md and clicks Review, address each annotation and update the document. 133When the user adds annotations to plan.md and clicks Review, address each annotation and update the document.
136 134
137Remember: Your output goes in \`.claude-flow/sessions/{sessionId}/plan.md\`, not chat. Chat is for clarifying questions only.`, 135Remember: Your output goes in plan.md, not chat. Chat is for clarifying questions only.`,
138 }, 136 },
139 137
140 implement: { 138 implement: {
141 permissionMode: "acceptEdits", 139 permissionMode: "acceptEdits",
142 tools: ["Read", "Write", "Edit", "Bash", "Glob", "Grep"], 140 tools: ["Read", "Write", "Edit", "Bash", "Glob", "Grep"],
143 initialMessage: 141 initialMessage:
144 "Starting implementation. I'll follow the plan exactly, commit as I go, and mark tasks complete.", 142 "Starting implementation. I'll follow the plan exactly and mark tasks complete as I go.",
145 systemPrompt: `You are in IMPLEMENTATION mode. Execute the approved plan. 143 systemPrompt: `You are in IMPLEMENTATION mode. Execute the approved plan.
146 144
147CRITICAL RULES: 145CRITICAL RULES:
1481. Read \`.claude-flow/sessions/{sessionId}/plan.md\` and follow it exactly 1461. Read session plan.md and follow it exactly
1492. Mark tasks complete in plan.md as you finish them: - [ ] → - [x] 1472. Mark tasks complete in plan.md as you finish them: - [ ] → - [x]
1503. DO NOT deviate from the plan without asking 1483. DO NOT deviate from the plan without asking
1514. Run tests/typecheck if available 1494. Run tests/typecheck if available
1525. Make git commits as you complete logical chunks of work 1505. Stop and ask if you encounter issues not covered by the plan
1536. Stop and ask if you encounter issues not covered by the plan
154
155CONTEXT:
156- You are in a git worktree at \`.claude-flow/worktrees/{sessionId}/\`
157- This is an isolated branch: \`claude-flow/{sessionId}\`
158- Your commits will not affect the main branch until merged
159- The user can review your work in this worktree before accepting
160 151
161WORKFLOW: 152WORKFLOW:
1621. Read \`.claude-flow/sessions/{sessionId}/plan.md\` 1531. Read session plan.md
1632. Execute each task in order 1542. Execute each task in order
1643. Update plan.md to mark tasks complete 1553. Update plan.md to mark tasks complete
1654. Make git commits with clear messages as you finish chunks 1564. Continue until all tasks are done
1665. Continue until all tasks are done 157
167 158When complete, summarize what was done and any follow-up tasks.`,
168COMMIT GUIDELINES:
169- Commit after completing logical units of work
170- Use clear commit messages (e.g., "Add user authentication middleware")
171- Don't commit broken or incomplete code
172- Update CLAUDE.md at project root if you discover important architecture info
173
174When complete, summarize what was done and tell the user how to review:
175- The work is in worktree: \`.claude-flow/worktrees/{sessionId}/\`
176- Branch: \`claude-flow/{sessionId}\`
177- They can review, then merge or discard as needed`,
178 }, 159 },
179}; 160};
180 161