aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CLAUDE.md55
1 files changed, 0 insertions, 55 deletions
diff --git a/CLAUDE.md b/CLAUDE.md
index 134a510..23eab33 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -52,8 +52,6 @@ Schema migrations: `db/index.ts::getDb()` calls `initSchema()` which uses `CREAT
52### SDK Permission Modes 52### SDK Permission Modes
53`PermissionMode` values: `'default' | 'acceptEdits' | 'bypassPermissions' | 'plan' | 'dontAsk'` 53`PermissionMode` values: `'default' | 'acceptEdits' | 'bypassPermissions' | 'plan' | 'dontAsk'`
54 54
55**Known bug**: `permissionMode: 'bypassPermissions'` requires a companion flag `allowDangerouslySkipPermissions: true` in the `query()` options. This flag is currently missing from `claude/index.ts`.
56
57`allowedTools: string[]` in the SDK maps to Claude Code's `--allowedTools` CLI flag and supports patterns like `'Bash(git *)'` to auto-allow only specific Bash command forms. 55`allowedTools: string[]` in the SDK maps to Claude Code's `--allowedTools` CLI flag and supports patterns like `'Bash(git *)'` to auto-allow only specific Bash command forms.
58 56
59## UI Architecture 57## UI Architecture
@@ -127,59 +125,6 @@ Sidebar demonstrates tree structure for hierarchical data:
127- Inline edit mode for renaming (Rename modal not needed) 125- Inline edit mode for renaming (Rename modal not needed)
128- Context awareness (expanded/collapsed states) 126- Context awareness (expanded/collapsed states)
129 127
130## Known Bugs
131
132### Phase Handling Issues (Critical)
133
134#### Bug #1: New Session Phase Modal Doesn't Apply Selection
135**Status**: Needs debugging
136**Description**: When creating a new session and selecting "Implementation" in the phase modal, the session is created with "Research" phase instead of the selected phase.
137
138**Key Discovery**: The system prompt is determined directly by `session.phase` (src/main/claude/index.ts lines 49, 91, 120).
139- If you create an "Implement" session but Claude receives the **Research system prompt**, it PROVES the session.phase is stored as "research" in the database
140- This is the smoking gun that reveals Bug #1 is in the **data layer**, not the display
141
142**Observable symptom**: Create an "Implement" session and send a message. If Claude says "I am in RESEARCH mode" (contains "DO NOT modify any source code files"), the phase is wrong. If Claude says "I am in IMPLEMENTATION mode" (contains "Mark tasks complete"), the phase is correct.
143
144**Code path**: NewSessionModal → App.handleConfirmNewSession → api.createSession → IPC handler → createSession function → DB INSERT
145
146**Suspected issue**: Phase parameter may be lost or reset during IPC transmission, despite code appearing correct. The IPC handler receives `phase?: Phase` as optional parameter which defaults to "research" in createSession().
147
148**To debug**:
1491. Add console.log in NewSessionModal to confirm selected state
1502. Add console.log in App.handleConfirmNewSession to confirm phase parameter
1513. Add console.log in IPC handler to confirm phase is received
1524. Check database directly: `SELECT phase FROM sessions WHERE ... LIMIT 1`
1535. Check what system prompt Claude actually receives (see observable symptom above)
154
155**Related files**:
156- `renderer/src/components/NewSessionModal.tsx` (phase selection)
157- `src/main/preload.ts` (API bridge - lines 89-90)
158- `src/main/ipc/handlers.ts` (IPC handler - lines 26-37)
159- `src/main/db/sessions.ts` (createSession function - line 39)
160- `src/main/claude/index.ts` (system prompt application - lines 49, 91, 120)
161
162#### Bug #2: Phase Transition State Not Synced + plan.md Not Rendering
163**Status**: Root cause identified ✓
164**Description**: After completing research phase and submitting, the plan phase doesn't show as active in the Sidebar, and plan.md doesn't display (only shows after Claude writes to it).
165
166**Root cause**: The `sessions` array state in App.tsx is never updated after `advancePhase()` completes. Only `selectedSession` is updated. This causes:
1671. **Sidebar inconsistency**: Shows old phase (session object from stale sessions array)
1682. **Header is correct**: Shows new phase (uses selectedSession.phase)
1693. **plan.md might initially be blank**: Loads before Claude writes it (expected, but confusing)
170
171**The fix**: In `App.tsx` handleSubmit(), after successful advancePhase, also update the sessions array:
172```typescript
173setSessions((prev) =>
174 prev.map((s) => (s.id === id ? { ...s, phase: advanced.phase, git_branch: advanced.git_branch } : s))
175);
176```
177
178**Related files**:
179- `renderer/src/App.tsx` (lines 419-446, handleSubmit function)
180- `renderer/src/components/Sidebar.tsx` (line 194, displays phase from sessions array)
181- `renderer/src/components/Header.tsx` (displays phase from selectedSession - works correctly)
182
183## Important Notes 128## Important Notes
184 129
185- `ANTHROPIC_API_KEY` env var must be set before launching 130- `ANTHROPIC_API_KEY` env var must be set before launching