chore: update next session prompt + install mysql2 for beadboard-550

- NEXT_SESSION_PROMPT.md: full context for Dolt mysql2 integration
  including schema, current read path, normalization approach, watcher
  concern, skills to use, and files to read
- mysql2 installed (beadboard-550.1 in_progress)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
ZenchantLive 2026-02-28 17:08:38 -08:00
parent a2e523b751
commit bb1231860e
3 changed files with 264 additions and 115 deletions

View file

@ -1,133 +1,155 @@
# Next Session: bb-ui2.6, bb-ui2.7, bb-ui2.8 - Shell Layout Components
# Next Session: Dolt Direct SQL Integration (beadboard-550)
## Context: Recovery from Corruption Incident
## What This Session Accomplished
Last session we recovered from a catastrophic file corruption event where null bytes overwrote dozens of files. We:
- Recovered tracked files from git stash commits
- Reinstalled node_modules and regenerated shadcn components
- Recreated earthy-dark tokens from bead specifications
- Committed all work with story-driven commit messages
- Created PR #10: https://github.com/zenchantlive/beadboard/pull/10
This session completed **Phase 0** and **Phase 1** of the UX redesign PRD, then pivoted to a more important infrastructure fix: replacing the stale `issues.jsonl` read path with direct Dolt SQL queries.
**Current branch:** `feat/bb-ui2` (branched from recovery branch)
### Phase 0 + 1 (done, committed as `7d37d02` and `a2e523b`)
- `unified-shell.tsx`: wired `blockedOnly` to SocialPage, TopBar with live counts
- `thread-drawer.tsx`: dynamic status instead of hardcoded "In Progress"
- `social-page.tsx`: fixed `onJumpToActivity` dead URL
- `contextual-right-panel.tsx`: added `taskId` branch (ThreadDrawer embedded) and `swarmId` branch (MissionInspector via SwarmIdBranch inner component)
- `AGENTS.md`: documented WSL2 mirrored networking workaround for mixed environments
## Beads to Complete This Session
### Why we pivoted to beadboard-550
The frontend reads `issues.jsonl` as its data source, but `bd` in dolt-native mode writes to a Dolt SQL server (`127.0.0.1:3307`). In mixed WSL2+Windows environments (and whenever Windows `bd` fails with a CGO error), the JSONL gets stale and the frontend shows outdated data.
### bb-ui2.6: TopBar (1.3)
**Location:** `src/components/shared/top-bar.tsx`
**Dependency:** ✅ bb-ui2.5 (UnifiedShell) is CLOSED
The right fix: **BeadBoard connects to Dolt directly via `mysql2`** — same MySQL wire protocol, no CGO needed, no sync step, and it unlocks Dolt's time-travel version history for future history/audit views.
Create top navigation bar with:
- Three view tabs: Social, Graph, Swarm
- Active state indicator (bold text, accent underline)
- Placeholder filter/search inputs
- Wire tab clicks to `useUrlState.setView`
---
## Active Epic: beadboard-550
```
┌─────────────────────────────────────────────────────────┐
│ [Social] [Graph] [Swarm] │ [🔍 filter] [⚙ settings] │
└─────────────────────────────────────────────────────────┘
bd show beadboard-550
```
### bb-ui2.7: LeftPanel (1.4)
**Location:** `src/components/shared/left-panel.tsx`
**Dependency:** ✅ bb-ui2.5 (UnifiedShell) is CLOSED
**4 sequential child tasks:**
Create left sidebar with:
- Channel tree for epic filtering
- Fetch epics from bd API
- Expandable tree structure
- Project scope controls
- Responsive collapse (desktop: 13rem, tablet: collapsed, mobile: hidden)
| Bead | Status | What |
|---|---|---|
| `beadboard-550.1` | in_progress (mysql2 installed, bead claimed) | Install mysql2, create `src/lib/dolt-client.ts` |
| `beadboard-550.2` | blocked on 550.1 | `readIssuesViaDolt()` — JOIN issues+deps+labels |
| `beadboard-550.3` | blocked on 550.2 | Wire Dolt as primary path in `readIssuesFromDisk()` |
| `beadboard-550.4` | blocked on 550.3 | Verify SSE/watcher still fires, remove manual export from AGENTS.md |
```
┌──────────────┐
│ CHANNELS │
├──────────────┤
│ ▼ bb-ui2 │
│ ▶ bb-ui2.0 │
│ ▼ bb-buff │
├──────────────┤
│ SCOPE │
└──────────────┘
```
---
### bb-ui2.8: RightPanel (1.5)
**Location:** `src/components/shared/right-panel.tsx`
**Dependency:** ✅ bb-ui2.5 (UnifiedShell) is CLOSED
Create right panel with responsive behavior:
- Desktop (>=1024px): Fixed sidebar 17rem, always visible
- Tablet (768-1024px): Slide-over from right, backdrop
- Mobile (<768px): Full-screen drawer
Also create: `src/hooks/use-responsive.ts`
## Existing Components (Do Not Recreate)
- `src/components/shared/unified-shell.tsx` - Main 3-panel grid layout ✅
- `src/components/shared/base-card.tsx` - Card primitive ✅
- `src/components/shared/agent-avatar.tsx` - Avatar with liveness ✅
- `src/components/shared/status-badge.tsx` - Status display ✅
- `src/hooks/use-url-state.ts` - URL state management ✅
- `src/lib/social-cards.ts` - Social data builder ✅
- `src/lib/swarm-cards.ts` - Swarm data builder ✅
- `src/components/shared/workflow-graph.tsx` - Graph component ✅
## Key Hooks to Use
- `useUrlState` from `src/hooks/use-url-state.ts` for view/tab state
- Create `useResponsive` for breakpoint detection (bb-ui2.8)
## Design Tokens
Earthy-dark tokens are in `src/app/globals.css`:
- `--color-accent-green: #7CB97A`
- `--color-accent-amber: #D4A574`
- `--color-accent-teal: #5BA8A0`
- `--liveness-active/stale/stuck/dead` for agent states
## Verification Commands
After each bead:
```bash
npm run typecheck
npm run lint
npm run test
```
## Workflow
1. Claim bead: `bd update <id> --status in_progress --notes "<plan>"`
2. Write failing tests first (TDD)
3. Implement minimal code to pass
4. Run verification gates
5. Close bead: `bd close <id> --reason "<what was completed>"`
6. Commit with story-driven message
## Session Start Commands
## Session Start Protocol
```bash
# Check current branch
git branch
# Verify we're on feat/bb-ui2
# If not: git checkout feat/bb-ui2
# Check bead status
bd show bb-ui2.6
bd show bb-ui2.7
bd show bb-ui2.8
# Claim first bead
bd update bb-ui2.6 --status in_progress --notes "Starting TopBar implementation"
cd /mnt/c/Users/Zenchant/codex/beadboard
bd show beadboard-550.1 # read the full spec
bd ready # confirm 550.1 is the only unblocked task
npm run typecheck # baseline should pass (pre-existing status-badge error is expected)
```
## Important Reminders
---
1. **Commit frequently** - The corruption incident taught us that uncommitted work is at risk
2. **Run gates before closing beads** - typecheck, lint, test must all pass
3. **Use closed beads for commit messages** - Reference the bead ID and describe the story
4. **Test responsive behavior** - Check at 390px, 768px, 1440px widths
5. **Wire to useUrlState** - URL is the single source of truth for view state
## Key Technical Context
### Dolt schema (confirmed this session)
The Dolt server runs at `127.0.0.1:3307`, database `beadboard`. Key tables:
- **`issues`** — main table, all fields including `metadata` (JSON column), `status`, `issue_type`, `priority`, `close_reason`, etc.
- **`dependencies`** — `(issue_id, depends_on_id, type, created_at, created_by)` — maps to `BeadDependency[]`
- **`labels`** — `(issue_id, label)` — maps to `string[]`
Connection config lives in `.beads/metadata.json`:
```json
{
"database": "dolt",
"dolt_server_port": 3307,
"dolt_database": "beadboard",
"backend": "dolt"
}
```
Host defaults to `127.0.0.1` (not in metadata.json).
### Current read path (what to replace)
`src/app/page.tsx` calls `readIssuesForScope({ preferBd: true })`:
1. `preferBd: true``readIssuesViaBd()` → runs `bd list --all --json` via CLI → works in WSL2, fails in Windows (CGO error)
2. Falls back to `readIssuesFromDisk()` → reads `issues.jsonl` → stale
Target: replace step 1 with `readIssuesViaDolt()``mysql2` → always works regardless of platform.
### BeadIssue shape (what mysql2 rows must normalize to)
See `src/lib/types.ts` for the full `BeadIssue` interface. Key fields:
- `id`, `title`, `description`, `status`, `priority`, `issue_type`
- `labels: string[]` — from `labels` table
- `dependencies: BeadDependency[]` — from `dependencies` table
- `created_at`, `updated_at`, `closed_at` — ISO strings (Dolt returns Date objects from mysql2)
- `metadata: Record<string, unknown>` — Dolt stores as JSON column, mysql2 auto-parses to object
### normalizeBdIssue() already exists
`src/lib/read-issues.ts` has `normalizeBdIssue()` which handles the JSON→BeadIssue mapping from `bd list --json` output. The Dolt SQL rows will have the same field names, so reuse this function (or factor it out) for 550.2.
### SSE / watcher (concern for 550.4)
`src/lib/watcher.ts` watches `.beads/issues.jsonl` + `.beads/last_touched` for changes and fires SSE events. Need to check whether `bd` still updates `last_touched` when writing to Dolt — if yes, watcher fires correctly and no change needed. If no, need a lightweight poll.
---
## Skills to Use
This is an implementation task — use the standard hyperpowers workflow:
```
hyperpowers:executing-plans — execute one task at a time, STOP after each
hyperpowers:test-driven-development — write test before implementation
hyperpowers:verification-before-completion — run typecheck+lint+test before closing any bead
```
Per `hyperpowers:executing-plans`: execute ONE bead, verify, close it, STOP for user review, then run `/hyperpowers:execute-plan` again to continue.
---
## Files to Read Before Starting
```
src/lib/read-issues.ts — current read path, normalizeBdIssue(), readIssuesViaBd()
src/lib/types.ts — BeadIssue, BeadDependency interfaces
src/lib/bridge.ts — runBdCommand (the CLI path being replaced)
src/app/page.tsx — how preferBd: true is called
.beads/metadata.json — Dolt connection config
```
---
## Verification Gates (every bead before closing)
```bash
npm run typecheck && npm run lint && npm run test
```
Pre-existing known failure: `status-badge.tsx TS2307: Cannot find module '@/lib/types'` — ignore, it predates this work.
---
## What Comes After beadboard-550
The UX phases (Phase 25) are still waiting:
- **Phase 2** (`beadboard-0fi`) — operator identity (now unblocked since Phase 1 closed)
- **Phase 3** (`beadboard-8ij`) — coordination layer
- **Phase 4** (`beadboard-x3l`) — agent presence
- **Phase 5** (`beadboard-d2x`) — blocked triage modal
But those have lower urgency than 550 (data infrastructure correctness > UI features).
---
## Platform Note (WSL2 + Windows)
The Dolt server runs in WSL2 at `127.0.0.1:3307`. If the frontend runs in Windows PowerShell, enable WSL2 mirrored networking first (one-time):
```
C:\Users\<you>\.wslconfig:
[wsl2]
networkingMode=mirrored
```
Then `wsl --shutdown`. Not required for single-platform setups. See `AGENTS.md` Data Backend section for full details.