Skip to content

Commit fb335f6

Browse files
chanjunrenclaude
andcommitted
📝 add training notes dump and MVM frontend plan
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent d4d9e23 commit fb335f6

2 files changed

Lines changed: 154 additions & 0 deletions

File tree

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
🗓️ 24052026 1200
2+
3+
# training
4+
5+
## context
6+
- **inline slalom skating** + **bouldering**
7+
- goal: increase training volume without burning out
8+
- sedentary programmer — long sitting hours, posture issues
9+
10+
## sleep + desk soreness
11+
12+
### posture fixes
13+
- **thoracic spine foam roll** — 2 min/day, biggest ROI for shoulder/back relief
14+
- desk breaks every 30–45 min — 60s standing + shoulder circles
15+
- monitor at eye level, elbows at 90 degrees
16+
17+
### pre-sleep routine (5 min)
18+
- child's pose, doorway pec stretch, supine twist
19+
- decompresses spine before bed
20+
21+
### sleep position
22+
- side sleeper: pillow between knees, thick neck pillow
23+
- back sleeper: thin pillow, one under knees
24+
- waking up sore → likely mattress/pillow issue, not just posture
25+
26+
## recovery + training volume
27+
28+
### nutrition
29+
- **protein**: 1.6–2g per kg bodyweight daily — most people undershoot by half
30+
- **hydration**: light yellow pee = baseline
31+
- eat enough overall — training hard on a deficit = soreness that won't quit
32+
33+
### training structure
34+
- alternate hard/easy days — technique (low intensity) one day, full send the next
35+
- **active recovery** > full rest — light skating, walking, mobility on off days
36+
- weekly split: 2 hard, 2 moderate, 1–2 light/active recovery
37+
- more total hours than going hard 3x and being wrecked for 4 days
38+
39+
### recovery tools
40+
- **contrast showers** post-training (30s cold / 60s hot, 3–4 cycles)
41+
- 10 min stretching/foam rolling immediately after sessions
42+
- sleep 7–8 hrs — non-negotiable for volume increase
43+
44+
### mindset
45+
- soreness ≠ progress
46+
- consistent moderate training > sporadic intense training
47+
- track sessions — seeing 5/week on paper builds momentum
48+
49+
---
50+
## References

www/plans/mvm.md

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
# MVM — Frontend Plan
2+
3+
UI for comparing Claude model outputs side-by-side with real-time streaming. Talks to MVM backend at `localhost:8080`.
4+
5+
Backend design doc: `backies/docs/mvm/`
6+
7+
---
8+
9+
## Code structure
10+
11+
```
12+
src/pages/mvm/index.tsx # Page wrapper
13+
src/components/mvm/
14+
mvm-view.tsx # Main container
15+
connection-banner.tsx # Warning when local API unreachable
16+
prompt-form.tsx # Model toggles + prompt textarea + submit
17+
results-grid.tsx # Responsive grid of result cards
18+
result-card.tsx # Single model result display (streaming text)
19+
src/hooks/useMvm.ts # SSE stream consumer, loading, connection health
20+
src/types/mvm.ts # TypeScript types mirroring API/SSE events
21+
```
22+
23+
## Modified files
24+
25+
`src/constants/api.ts` — add `MVM_API_BASE = "http://localhost:8080"`.
26+
27+
---
28+
29+
## UI flow
30+
31+
1. On mount: hook pings `GET /api/mvm/health` (3s timeout). Fetches model list from `GET /api/mvm/models`.
32+
2. If unreachable: amber banner — "Local API not running. Start with `make run` in backies/". Submit disabled.
33+
3. Select models (toggle buttons rendered dynamically from `/models` response)
34+
4. Enter prompt in textarea. Optional "Advanced" disclosure for system prompt.
35+
5. Click "Compare" — cards appear immediately per model (from `model_start` events)
36+
6. Text streams into each card in real-time as `token` events arrive
37+
7. When `model_done` arrives, card footer fills in with tokens + cost + duration
38+
8. If `model_error` arrives, card shows error state
39+
9. Stream ends on `done` event — loading state clears
40+
41+
---
42+
43+
## SSE consumption
44+
45+
`EventSource` doesn't support POST. Use `fetch` + `ReadableStream`:
46+
47+
```typescript
48+
const res = await fetch(`${MVM_API_BASE}/api/mvm/compare`, {
49+
method: 'POST',
50+
headers: { 'Content-Type': 'application/json' },
51+
body: JSON.stringify({ prompt, models, system_prompt }),
52+
});
53+
54+
const reader = res.body.getReader();
55+
const decoder = new TextDecoder();
56+
57+
while (true) {
58+
const { done, value } = await reader.read();
59+
if (done) break;
60+
const chunk = decoder.decode(value, { stream: true });
61+
// parse SSE events (split by \n\n, extract event: and data: lines)
62+
// dispatch by event type: model_start, token, model_done, model_error, done
63+
}
64+
```
65+
66+
State shape per model:
67+
68+
```typescript
69+
{
70+
[model: string]: {
71+
text: string; // accumulated from token events
72+
status: 'streaming' | 'done' | 'error';
73+
usage?: ArenaUsage; // filled on model_done
74+
duration_ms?: number;
75+
total_cost_usd?: number;
76+
error?: string; // filled on model_error
77+
}
78+
}
79+
```
80+
81+
---
82+
83+
## Reusable components
84+
85+
- `<Page>` wrapper from `src/components/ui/page.tsx`
86+
- `Button` from `src/components/ui/button.tsx` (outline variant for model toggles)
87+
- `Card`/`CardHeader`/`CardContent`/`CardFooter` from `src/components/ui/card.tsx`
88+
- `useMateria` hook as fetch pattern reference (for `/models` and `/health` calls)
89+
90+
---
91+
92+
## Constraints
93+
94+
- **Always visible** on prod site. Shows connection banner if local API unreachable.
95+
- **Mixed content**: prod (`https://chanjunren.github.io`) calling `http://localhost:8080`. Chrome/Firefox allow localhost as secure context exception. Safari may block — recommend running Docusaurus dev server locally.
96+
- No new dependencies beyond what's already in the project.
97+
98+
---
99+
100+
## Future extensions
101+
102+
- Diff view between outputs
103+
- Markdown rendering in result cards
104+
- History of past comparisons

0 commit comments

Comments
 (0)