aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorClawd <ai@clawd.bot>2026-02-27 21:51:02 -0800
committerClawd <ai@clawd.bot>2026-02-27 21:51:02 -0800
commit399b03824c9970a7072f9632945282ff85ada1a0 (patch)
tree7c51580ecc75e765ed71e9052c779d5c70c5e148
parent34ba41851752da108fbede66997cda0f814eb714 (diff)
Address review comments: clarify decisions, add context indicator
-rw-r--r--PLAN.md10
-rw-r--r--plan.md73
-rw-r--r--research.md4
3 files changed, 80 insertions, 7 deletions
diff --git a/PLAN.md b/PLAN.md
index 4495134..de6e333 100644
--- a/PLAN.md
+++ b/PLAN.md
@@ -239,15 +239,15 @@ If you encounter issues not covered by the plan, stop and ask.
239 239
240--- 240---
241 241
242## Open Questions 242## Decisions Made
243 243
2441. **Claude Code SDK vs CLI**: Need to verify SDK capabilities. Fallback to spawning CLI if needed. 2441. **Claude Agent SDK**: Using the SDK (`@anthropic-ai/claude-agent-sdk`) — provides hooks, session management, and streaming.
245 245
2462. **Artifact storage**: Store in SQLite (current plan) or as actual files in project directory? 2462. **Artifact storage**: Files in `.claude-flow/` directory (research.md, plan.md). Editable in any editor, visible in git.
247 247
2483. **Session context**: How much conversation history to include? Compaction strategy? 2483. **Session context**: SDK auto-compacts when context fills. UI will show token usage so users can see context size.
249 249
2504. **Multi-file editing**: How to handle plans that span many files? Tree view of changes? 2504. **Code review**: Out of scope — this tool enforces the *generation* workflow. Review stays in git.
251 251
252--- 252---
253 253
diff --git a/plan.md b/plan.md
index ff71487..cf6ea0b 100644
--- a/plan.md
+++ b/plan.md
@@ -40,6 +40,7 @@ claude-flow/
40│ │ ├── Message.tsx # Single message bubble 40│ │ ├── Message.tsx # Single message bubble
41│ │ ├── ArtifactPane.tsx # Markdown editor for plan/research 41│ │ ├── ArtifactPane.tsx # Markdown editor for plan/research
42│ │ ├── PhaseBar.tsx # Phase indicator + controls 42│ │ ├── PhaseBar.tsx # Phase indicator + controls
43│ │ ├── ContextIndicator.tsx # Token usage / context size display
43│ │ └── Settings.tsx # API key, preferences 44│ │ └── Settings.tsx # API key, preferences
44│ ├── hooks/ 45│ ├── hooks/
45│ │ ├── useProjects.ts 46│ │ ├── useProjects.ts
@@ -1036,7 +1037,76 @@ export function PhaseBar({ session, onPhaseChange, onPermissionModeChange }: Pha
1036} 1037}
1037``` 1038```
1038 1039
1039### 4.6 Chat (`renderer/src/components/Chat.tsx`) 1040### 4.6 ContextIndicator (`renderer/src/components/ContextIndicator.tsx`)
1041
1042```typescript
1043import React from "react";
1044
1045interface ContextIndicatorProps {
1046 inputTokens: number;
1047 outputTokens: number;
1048 cacheHits?: number;
1049}
1050
1051export function ContextIndicator({ inputTokens, outputTokens, cacheHits }: ContextIndicatorProps) {
1052 const totalTokens = inputTokens + outputTokens;
1053 const maxTokens = 200000; // Claude's context window
1054 const usagePercent = Math.min((totalTokens / maxTokens) * 100, 100);
1055
1056 const getColor = () => {
1057 if (usagePercent > 80) return "#ef4444"; // red
1058 if (usagePercent > 50) return "#f59e0b"; // amber
1059 return "#10b981"; // green
1060 };
1061
1062 return (
1063 <div className="context-indicator">
1064 <div className="context-bar">
1065 <div
1066 className="context-fill"
1067 style={{ width: `${usagePercent}%`, backgroundColor: getColor() }}
1068 />
1069 </div>
1070 <span className="context-label">
1071 {(totalTokens / 1000).toFixed(1)}k / 200k tokens
1072 {cacheHits ? ` (${(cacheHits / 1000).toFixed(1)}k cached)` : ""}
1073 </span>
1074 </div>
1075 );
1076}
1077```
1078
1079Add styles to `globals.css`:
1080
1081```css
1082/* Context Indicator */
1083.context-indicator {
1084 display: flex;
1085 align-items: center;
1086 gap: 8px;
1087 padding: 0 16px;
1088}
1089
1090.context-bar {
1091 width: 100px;
1092 height: 6px;
1093 background: #333;
1094 border-radius: 3px;
1095 overflow: hidden;
1096}
1097
1098.context-fill {
1099 height: 100%;
1100 transition: width 0.3s ease;
1101}
1102
1103.context-label {
1104 font-size: 12px;
1105 color: #888;
1106}
1107```
1108
1109### 4.7 Chat (`renderer/src/components/Chat.tsx`)
1040 1110
1041```typescript 1111```typescript
1042import React, { useState, useEffect, useRef } from "react"; 1112import React, { useState, useEffect, useRef } from "react";
@@ -1475,6 +1545,7 @@ function ensureArtifactDir(projectPath: string) {
1475- [ ] Implement `renderer/src/App.tsx` 1545- [ ] Implement `renderer/src/App.tsx`
1476- [ ] Implement `renderer/src/components/Sidebar.tsx` 1546- [ ] Implement `renderer/src/components/Sidebar.tsx`
1477- [ ] Implement `renderer/src/components/PhaseBar.tsx` 1547- [ ] Implement `renderer/src/components/PhaseBar.tsx`
1548- [ ] Implement `renderer/src/components/ContextIndicator.tsx`
1478- [ ] Implement `renderer/src/components/Chat.tsx` 1549- [ ] Implement `renderer/src/components/Chat.tsx`
1479- [ ] Update `renderer/src/main.tsx` 1550- [ ] Update `renderer/src/main.tsx`
1480 1551
diff --git a/research.md b/research.md
index 0496f29..b7d0897 100644
--- a/research.md
+++ b/research.md
@@ -111,7 +111,7 @@ for await (const message of query({
111 111
112**Critical for our workflow:** 112**Critical for our workflow:**
113- **Research/Plan/Annotate phases**: Use `plan` mode or restrict `allowedTools` to read-only 113- **Research/Plan/Annotate phases**: Use `plan` mode or restrict `allowedTools` to read-only
114- **Implement phase**: Use `acceptEdits` or `bypassPermissions` 114- **Implement phase**: Use `acceptEdits` or `bypassPermissions` // REVIEW: make a user toggle
115 115
116### System Prompts 116### System Prompts
117 117
@@ -307,6 +307,7 @@ const enforcePhaseHook: HookCallback = async (input, toolUseID, { signal }) => {
307- Con: More complex, may lose SDK internal state 307- Con: More complex, may lose SDK internal state
308 308
309**Recommendation:** Use **Option A** (SDK persistence) with session ID in SQLite. We can still store messages for display/search, but rely on SDK for actual context. 309**Recommendation:** Use **Option A** (SDK persistence) with session ID in SQLite. We can still store messages for display/search, but rely on SDK for actual context.
310// REVIEW: option a
310 311
311### Artifact Management 312### Artifact Management
312 313
@@ -318,6 +319,7 @@ The blog workflow uses `research.md` and `plan.md` as persistent artifacts.
3183. **Both** — Files as source of truth, sync to SQLite for search 3193. **Both** — Files as source of truth, sync to SQLite for search
319 320
320**Recommendation:** Store as **files in the project directory** (e.g., `.claude-flow/research.md`, `.claude-flow/plan.md`). This matches the blog workflow where the human edits the plan.md directly. 321**Recommendation:** Store as **files in the project directory** (e.g., `.claude-flow/research.md`, `.claude-flow/plan.md`). This matches the blog workflow where the human edits the plan.md directly.
322// REVIEW: recommendation is great
321 323
322### IPC Architecture 324### IPC Architecture
323 325