aboutsummaryrefslogtreecommitdiffstats
path: root/CLAUDE.md
diff options
context:
space:
mode:
authorbndw <ben@bdw.to>2026-03-04 21:21:22 -0800
committerbndw <ben@bdw.to>2026-03-04 21:21:22 -0800
commitb6405dd6a4ba65fc5dc6746db7be7be7d0bb29f3 (patch)
tree7d04268e9adfe9a6a83029556ef0dd5f72a63d42 /CLAUDE.md
parentead65fd7d50ead785f437cc895c74146bd232702 (diff)
feat: replace header dropdowns with collapsible sidebar tree
- Add Sidebar.tsx: project/session tree with inline rename, collapse/resize - App.tsx: load all sessions at startup, sync selectedProject on session click - Header.tsx: strip project/session UI, keep only right-side controls - globals.css: add .main-layout, sidebar, item, and activity-dot styles - Chat pane: move toggle button to left, use triangle icons matching sidebar
Diffstat (limited to 'CLAUDE.md')
-rw-r--r--CLAUDE.md85
1 files changed, 85 insertions, 0 deletions
diff --git a/CLAUDE.md b/CLAUDE.md
index d2e968a..5d25656 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -33,6 +33,8 @@ renderer/src/ # React UI
33### Phase System 33### Phase System
34Phases: `research | plan | implement`. Each defined in `src/main/claude/phases.ts` with its own `systemPrompt`, `tools[]`, `permissionMode`, and `initialMessage`. Phase progression is one-way; triggered by user clicking "Submit". 34Phases: `research | plan | implement`. Each defined in `src/main/claude/phases.ts` with its own `systemPrompt`, `tools[]`, `permissionMode`, and `initialMessage`. Phase progression is one-way; triggered by user clicking "Submit".
35 35
36**Important**: All new sessions currently start at `research` phase by default (hardcoded in `sessions.createSession()`). If building phase selection UI, modify `createSession()` in both `/db/sessions.ts` and the IPC handler at `/ipc/handlers.ts` to accept an optional `phase` parameter.
37
36### Artifact Storage 38### Artifact Storage
37Session artifacts (`research.md`, `plan.md`) stored inside the target project at `.claude-flow/sessions/{sessionId}/`. This keeps them within the SDK's allowed write boundary (project `cwd`). Add `.claude-flow/` to `.gitignore` to exclude from version control. 39Session artifacts (`research.md`, `plan.md`) stored inside the target project at `.claude-flow/sessions/{sessionId}/`. This keeps them within the SDK's allowed write boundary (project `cwd`). Add `.claude-flow/` to `.gitignore` to exclude from version control.
38 40
@@ -54,6 +56,77 @@ Schema migrations: `db/index.ts::getDb()` calls `initSchema()` which uses `CREAT
54 56
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. 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.
56 58
59## UI Architecture
60
61### Current Layout
62```
63┌─────────────────────────────────────────────────────┐
64│ Header: Project selector, Session selector, Controls │
65├─────────────────────────────────────────────────────┤
66│ Main Content (flex row) │
67│ ├─ Document Pane (flex 1) │
68│ │ └─ Markdown editor/viewer │
69│ └─ Chat Pane (resizable, 380px default) │
70│ └─ Chat messages + input │
71├─────────────────────────────────────────────────────┤
72│ Action Bar: Review/Submit buttons, tokens, settings │
73└─────────────────────────────────────────────────────┘
74```
75
76### Key Components
77- **App.tsx**: Root container, manages projects/sessions/messages state, subscription to Claude messages
78- **Header.tsx**: Project & session selection (dropdowns + buttons), phase indicator, theme toggle
79- **DocumentPane.tsx**: CodeMirror markdown editor in edit mode, react-markdown renderer in view mode
80- **ChatPane.tsx**: Message history, input field, collapsible (stored width in localStorage)
81- **ActionBar.tsx**: Review button (research/plan phases), Submit button, token usage bar, permission mode toggle
82
83### State Management
84App.tsx owns all state. Key state variables:
85- `selectedProject` / `selectedSession` — current context
86- `loadingBySession[sessionId]` — per-session loading flag (tracks thinking state)
87- `activityBySession[sessionId]` — per-session activity status text (e.g., "Using Bash (5s)")
88- `viewPhase` — which artifact to display (research/plan, defaults to current phase)
89- `chatWidth` / `chatCollapsed` — layout preferences (persisted to localStorage)
90- `theme` — "dark" or "light" (persisted to localStorage)
91
92### Per-Session Activity Tracking
93App subscribes to `api.onClaudeMessage()` which broadcasts all Claude SDK messages to all sessions. App updates `loadingBySession` and `activityBySession` dictionaries to track which sessions are currently processing. This allows switching between projects/sessions without losing the thinking indicator state.
94
95### UI Patterns & Conventions
96
97#### Modal/Overlay Pattern
98Full-page overlays (e.g., SettingsPage) use this pattern:
99```tsx
100<div className="settings-overlay">
101 <div className="settings-header">
102 {/* Header with close button */}
103 </div>
104 <div className="settings-body">
105 {/* Content */}
106 </div>
107</div>
108```
109
110When building new modal UI:
111- Use `.settings-overlay` (or similar) class for backdrop + positioning
112- Include a close button with `className="settings-close"`
113- Keep header style consistent with app header height/styling
114- For simple modals (not full-page), consider a centered dialog box instead
115
116#### Form Pattern
117Settings sections use input/select fields. Standard patterns:
118- Label + input field pairs
119- Button groups for related actions
120- Consistent spacing via CSS grid/flex
121- Validation feedback via inline text or error states
122
123#### List/Tree Pattern
124Sidebar demonstrates tree structure for hierarchical data:
125- Parent items with click handlers and action buttons
126- Nested items with indent/visual hierarchy
127- Inline edit mode for renaming (Rename modal not needed)
128- Context awareness (expanded/collapsed states)
129
57## Important Notes 130## Important Notes
58 131
59- `ANTHROPIC_API_KEY` env var must be set before launching 132- `ANTHROPIC_API_KEY` env var must be set before launching
@@ -61,3 +134,15 @@ Schema migrations: `db/index.ts::getDb()` calls `initSchema()` which uses `CREAT
61- `bypassPermissions` mode is a user-controlled toggle in implement phase only 134- `bypassPermissions` mode is a user-controlled toggle in implement phase only
62- Token usage (from `SDKResultMessage.usage`) is displayed in the ActionBar 135- Token usage (from `SDKResultMessage.usage`) is displayed in the ActionBar
63- No git library in dependencies — use Node.js `child_process` (built-in) for git operations 136- No git library in dependencies — use Node.js `child_process` (built-in) for git operations
137- Session rename auto-triggers when research phase completes if session name is default "Session N" format (extracts first sentence from research.md)
138
139## Extensibility Notes for UI Features
140
141When adding new UI features that require user input:
142
1431. **Modal dialogs**: Follow the SettingsPage pattern (full-page overlay with header/body)
1442. **Inline editing**: Use sidebar pattern (inline input that commits on blur/Enter)
1453. **Phase selection**: Phase column in DB already exists and accepts any value—no schema changes needed to support starting at different phases
1464. **Settings additions**: Add to `SettingsPage.tsx` with a new section and corresponding settings UI file in `/components/settings/`
1475. **IPC endpoints**: Register in `/src/main/ipc/handlers.ts` and expose in `/src/main/preload.ts`
1486. **State management**: Keep state in `App.tsx` for global UI state; component local state for transient UI state (e.g., modal visibility, form input)