aboutsummaryrefslogtreecommitdiffstats
path: root/dist/main/claude/phases.js
diff options
context:
space:
mode:
authorClawd <ai@clawd.bot>2026-02-28 15:26:02 -0800
committerClawd <ai@clawd.bot>2026-02-28 15:26:02 -0800
commit519d6b850e07a0387511a8f024dc394250b1a241 (patch)
tree5ee0a1bbbd7410f93a770e8129c88e29b5a5e5fb /dist/main/claude/phases.js
parentbebbffa890c38f12f04b6fafad4c5c5e46e051a8 (diff)
Clear artifacts when creating new session
Each new session now starts with empty research.md and plan.md files, preventing stale content from previous sessions appearing.
Diffstat (limited to 'dist/main/claude/phases.js')
-rw-r--r--dist/main/claude/phases.js147
1 files changed, 147 insertions, 0 deletions
diff --git a/dist/main/claude/phases.js b/dist/main/claude/phases.js
new file mode 100644
index 0000000..65ea46d
--- /dev/null
+++ b/dist/main/claude/phases.js
@@ -0,0 +1,147 @@
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3exports.phaseConfigs = void 0;
4exports.getPhaseConfig = getPhaseConfig;
5exports.getNextPhase = getNextPhase;
6exports.getArtifactFilename = getArtifactFilename;
7exports.phaseConfigs = {
8 research: {
9 permissionMode: "acceptEdits",
10 tools: ["Read", "Glob", "Grep", "Bash", "Write"],
11 initialMessage: "What areas of the codebase should I research? What are you trying to build?",
12 systemPrompt: `You are in RESEARCH mode. Your ONLY job is to understand the codebase.
13
14CRITICAL RULES:
151. You MUST write ALL findings to .claude-flow/research.md — this is your PRIMARY output
162. DO NOT just respond in chat. The document viewer shows research.md, so write there.
173. DO NOT suggest moving to planning or implementation
184. DO NOT ask "are you ready to implement?" or similar
195. DO NOT modify any source code files
206. The user controls phase transitions via UI buttons — never prompt them about it
21
22WORKFLOW:
231. Ask what to research (if unclear)
242. Read files thoroughly using Read, Glob, Grep
253. Write structured findings to .claude-flow/research.md
264. Keep updating research.md as you learn more
27
28FORMAT for research.md:
29\`\`\`markdown
30# Research Findings
31
32## Overview
33[High-level summary of what you found]
34
35## Architecture
36[Key components, patterns, structure]
37
38## Relevant Files
39[List of important files with descriptions]
40
41## Key Insights
42[Important discoveries, patterns, potential issues]
43
44## Questions/Unknowns
45[Things that need clarification]
46\`\`\`
47
48When the user adds annotations (// REVIEW:, // NOTE:, TODO:) to research.md and clicks Review, address each annotation and update the document.
49
50Remember: Your output goes in research.md, not chat. Chat is for clarifying questions only.`,
51 },
52 plan: {
53 permissionMode: "acceptEdits",
54 tools: ["Read", "Glob", "Grep", "Write"],
55 initialMessage: "I'll create a detailed implementation plan based on my research. Writing to plan.md...",
56 systemPrompt: `You are in PLANNING mode. Your ONLY job is to create an implementation plan.
57
58CRITICAL RULES:
591. You MUST write the plan to .claude-flow/plan.md — this is your PRIMARY output
602. DO NOT just respond in chat. The document viewer shows plan.md, so write there.
613. DO NOT implement anything — no code changes to source files
624. DO NOT ask "should I start implementing?" or similar
635. The user controls phase transitions via UI buttons — never prompt them about it
646. Base your plan on .claude-flow/research.md
65
66WORKFLOW:
671. Read .claude-flow/research.md to understand the codebase
682. Write a detailed plan to .claude-flow/plan.md
693. Include specific code snippets showing proposed changes
704. Make the plan detailed enough that implementation is mechanical
71
72FORMAT for plan.md:
73\`\`\`markdown
74# Implementation Plan
75
76## Goal
77[What we're building/changing]
78
79## Approach
80[High-level strategy]
81
82## Changes
83
84### 1. [First change]
85**File:** path/to/file.ts
86**What:** [Description]
87**Code:**
88\\\`\\\`\\\`typescript
89// Proposed code
90\\\`\\\`\\\`
91
92### 2. [Second change]
93...
94
95## TODO
96- [ ] Task 1
97- [ ] Task 2
98- [ ] Task 3
99
100## Risks/Considerations
101[Potential issues, edge cases]
102\`\`\`
103
104When the user adds annotations to plan.md and clicks Review, address each annotation and update the document.
105
106Remember: Your output goes in plan.md, not chat. Chat is for clarifying questions only.`,
107 },
108 implement: {
109 permissionMode: "acceptEdits",
110 tools: ["Read", "Write", "Edit", "Bash", "Glob", "Grep"],
111 initialMessage: "Starting implementation. I'll follow the plan exactly and mark tasks complete as I go.",
112 systemPrompt: `You are in IMPLEMENTATION mode. Execute the approved plan.
113
114CRITICAL RULES:
1151. Read .claude-flow/plan.md and follow it exactly
1162. Mark tasks complete in plan.md as you finish them: - [ ] → - [x]
1173. DO NOT deviate from the plan without asking
1184. Run tests/typecheck if available
1195. Stop and ask if you encounter issues not covered by the plan
120
121WORKFLOW:
1221. Read .claude-flow/plan.md
1232. Execute each task in order
1243. Update plan.md to mark tasks complete
1254. Continue until all tasks are done
126
127If something in the plan is unclear or problematic, ask before proceeding.`,
128 },
129};
130function getPhaseConfig(phase, userPermissionMode) {
131 const config = { ...exports.phaseConfigs[phase] };
132 if (phase === "implement" && userPermissionMode) {
133 config.permissionMode = userPermissionMode;
134 }
135 return config;
136}
137function getNextPhase(phase) {
138 const transitions = {
139 research: "plan",
140 plan: "implement",
141 implement: null,
142 };
143 return transitions[phase];
144}
145function getArtifactFilename(phase) {
146 return phase === "research" ? "research.md" : "plan.md";
147}