diff options
| author | Clawd <ai@clawd.bot> | 2026-02-27 21:51:02 -0800 |
|---|---|---|
| committer | Clawd <ai@clawd.bot> | 2026-02-27 21:51:02 -0800 |
| commit | 399b03824c9970a7072f9632945282ff85ada1a0 (patch) | |
| tree | 7c51580ecc75e765ed71e9052c779d5c70c5e148 /plan.md | |
| parent | 34ba41851752da108fbede66997cda0f814eb714 (diff) | |
Address review comments: clarify decisions, add context indicator
Diffstat (limited to 'plan.md')
| -rw-r--r-- | plan.md | 73 |
1 files changed, 72 insertions, 1 deletions
| @@ -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 | ||
| 1043 | import React from "react"; | ||
| 1044 | |||
| 1045 | interface ContextIndicatorProps { | ||
| 1046 | inputTokens: number; | ||
| 1047 | outputTokens: number; | ||
| 1048 | cacheHits?: number; | ||
| 1049 | } | ||
| 1050 | |||
| 1051 | export 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 | |||
| 1079 | Add 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 |
| 1042 | import React, { useState, useEffect, useRef } from "react"; | 1112 | import 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 | ||
