diff options
| author | bndw <ben@bdw.to> | 2026-03-04 21:36:32 -0800 |
|---|---|---|
| committer | bndw <ben@bdw.to> | 2026-03-04 21:36:32 -0800 |
| commit | 73d2680b83ccbdbd8dfec2d319533e98b379b830 (patch) | |
| tree | 193eaf5157edcf12d06dde85fb44efaf3aae2004 /src/main/claude | |
| parent | b6405dd6a4ba65fc5dc6746db7be7be7d0bb29f3 (diff) | |
feat: Thread optional `phase` param into `db/sessions.ts::cre… (+7 more)
- ✅ Thread optional `phase` param into `db/sessions.ts::createSession()`
- ✅ Thread optional `phase` param into `ipc/handlers.ts` sessions:create handler
- ✅ Thread optional `phase` param into `preload.ts` createSession API
- ✅ Update Plan phase system prompt to gracefully handle missing research.md
- ✅ Update Implement phase system prompt to gracefully handle missing plan.md
- ✅ Create `renderer/src/components/NewSessionModal.tsx`
- ✅ Update `App.tsx`: add modal state, split handler, add modal JSX
- ✅ Add modal CSS to `globals.css`
Diffstat (limited to 'src/main/claude')
| -rw-r--r-- | src/main/claude/index.ts | 5 | ||||
| -rw-r--r-- | src/main/claude/phases.ts | 10 |
2 files changed, 9 insertions, 6 deletions
diff --git a/src/main/claude/index.ts b/src/main/claude/index.ts index 8cf512c..9139f17 100644 --- a/src/main/claude/index.ts +++ b/src/main/claude/index.ts | |||
| @@ -48,8 +48,9 @@ export async function sendMessage({ | |||
| 48 | // Load any custom system prompt for this phase (null → use default) | 48 | // Load any custom system prompt for this phase (null → use default) |
| 49 | const customSystemPrompt = getSetting(`systemPrompt.${session.phase}`) ?? undefined; | 49 | const customSystemPrompt = getSetting(`systemPrompt.${session.phase}`) ?? undefined; |
| 50 | 50 | ||
| 51 | // Load global model override (empty string or null → let SDK use its default) | 51 | // Phase-specific model override takes precedence; falls back to global default. |
| 52 | const configuredModel = getSetting("model") || undefined; | 52 | const configuredModel = |
| 53 | getSetting(`model.${session.phase}`) || getSetting("model") || undefined; | ||
| 53 | 54 | ||
| 54 | // Load MCP servers config (JSON string → object, or undefined if not set) | 55 | // Load MCP servers config (JSON string → object, or undefined if not set) |
| 55 | const mcpServersJson = getSetting("mcpServers"); | 56 | const mcpServersJson = getSetting("mcpServers"); |
diff --git a/src/main/claude/phases.ts b/src/main/claude/phases.ts index a1cbba1..e8c16df 100644 --- a/src/main/claude/phases.ts +++ b/src/main/claude/phases.ts | |||
| @@ -87,11 +87,12 @@ CRITICAL RULES: | |||
| 87 | 87 | ||
| 88 | CONTEXT: | 88 | CONTEXT: |
| 89 | - Read CLAUDE.md at project root for codebase overview | 89 | - Read CLAUDE.md at project root for codebase overview |
| 90 | - Read ${artifactDir}/research.md to understand the specific task | 90 | - Read ${artifactDir}/research.md to understand the specific task. |
| 91 | If research.md does not exist, this session began at the planning phase — base your plan on the task description provided in the chat instead. | ||
| 91 | 92 | ||
| 92 | WORKFLOW: | 93 | WORKFLOW: |
| 93 | 1. Read CLAUDE.md for codebase overview | 94 | 1. Read CLAUDE.md for codebase overview |
| 94 | 2. Read ${artifactDir}/research.md to understand the specific task | 95 | 2. Read ${artifactDir}/research.md if it exists; otherwise use the task description from chat |
| 95 | 3. Write a detailed plan to ${artifactDir}/plan.md | 96 | 3. Write a detailed plan to ${artifactDir}/plan.md |
| 96 | 4. Include specific code snippets showing proposed changes | 97 | 4. Include specific code snippets showing proposed changes |
| 97 | 5. Make the plan detailed enough that implementation is mechanical | 98 | 5. Make the plan detailed enough that implementation is mechanical |
| @@ -141,14 +142,15 @@ Remember: Your output goes in ${artifactDir}/plan.md, not chat. Chat is for clar | |||
| 141 | systemPrompt: (artifactDir) => `You are in IMPLEMENTATION mode. Execute the approved plan. | 142 | systemPrompt: (artifactDir) => `You are in IMPLEMENTATION mode. Execute the approved plan. |
| 142 | 143 | ||
| 143 | CRITICAL RULES: | 144 | CRITICAL RULES: |
| 144 | 1. Read ${artifactDir}/plan.md and follow it exactly | 145 | 1. Read ${artifactDir}/plan.md if it exists and follow it exactly. |
| 146 | If plan.md does not exist, this session began at the implementation phase — implement based on the task description provided in the chat messages. | ||
| 145 | 2. Mark tasks complete in ${artifactDir}/plan.md as you finish them: - [ ] → - [x] | 147 | 2. Mark tasks complete in ${artifactDir}/plan.md as you finish them: - [ ] → - [x] |
| 146 | 3. DO NOT deviate from the plan without asking | 148 | 3. DO NOT deviate from the plan without asking |
| 147 | 4. Run tests/typecheck if available | 149 | 4. Run tests/typecheck if available |
| 148 | 5. Stop and ask if you encounter issues not covered by the plan | 150 | 5. Stop and ask if you encounter issues not covered by the plan |
| 149 | 151 | ||
| 150 | WORKFLOW: | 152 | WORKFLOW: |
| 151 | 1. Read ${artifactDir}/plan.md | 153 | 1. Read ${artifactDir}/plan.md (if it exists) |
| 152 | 2. Execute each task in order | 154 | 2. Execute each task in order |
| 153 | 3. Update ${artifactDir}/plan.md to mark tasks complete | 155 | 3. Update ${artifactDir}/plan.md to mark tasks complete |
| 154 | 4. Continue until all tasks are done | 156 | 4. Continue until all tasks are done |
