Phase 20: React UI Build
Status: π Planned
Estimated Duration: 8β12 weeks
Depends on: Phase 14 (API), all feature phases for UI surfaces (Phases 1β10)
Branch: dev
Goalβ
Replace the current lightweight htmx-based operator console (cmd/ui) with a production-grade, full-featured React application that surfaces every capability the Cruvero runtime has built across Phases 1β10. Add a visual drag-and-drop flow builder for designing agent workflows that persist to a configurable GitHub repository. The UI becomes the primary operator interfaceβnot just a monitoring tool, but a complete control plane.
Design Philosophyβ
- React app with Go backend β The htmx approach worked for the operator console, but a full-featured UI with flow builder, real-time streaming, state inspection, and interactive visualizations requires a proper React frontend. Single Go binary still serves the built React assets.
- Go API stays the authority β The React frontend consumes the Go API. No business logic in the frontend.
- Every phase's features get a UI surface β If it exists in the CLI, it should exist in the UI.
- Security first β OWASP Top 10 mitigations, role-based access, future-proofed for enterprise identity providers.
Sub-Phasesβ
| Sub-Phase | Name | Prompts | Depends On |
|---|---|---|---|
| 20A | Go Backend: Auth, Flow, and API Layer | 5 | -- |
| 20B | React Foundation: Project, Layout, Auth, API Client | 5 | 20A |
| 20C | Core UI Pages: Runs, Cost, Tools, Memory | 5 | 20B |
| 20D | Advanced Pages: Replay, Traces, Supervisor, Settings | 4 | 20C |
| 20E | Visual Flow Builder + GitHub Persistence UI | 5 | 20B |
| 20F | Security Hardening, Build Pipeline, Testing, Polish | 4 | 20C, 20D, 20E |
Total: 28 prompts across 6 sub-phases.
Dependency graph: 20A β 20B β 20C β 20D β 20F and 20B β 20E β 20F
Architecture Decisionsβ
| Concern | Decision |
|---|---|
| Frontend | React 18 (Vite) with TypeScript |
| Workflow builder | React Flow (reactflow library) |
| Charts | ECharts (echarts-for-react) |
| JSON editing | Monaco Editor |
| State management | Zustand (client state) + TanStack Query (server state) |
| Styling | Tailwind CSS, matched to Figma reference in reference/frontend/ folder |
| Backend | All APIs in Golang (extend cmd/ui/main.go or new cmd/api service) |
| Serving | React is UI-onlyβno SSR, no Node.js in production. Go embeds built assets from cmd/ui/dist/. |
| Auth | OIDC with role-based access (Keycloak primary, Azure AD future-proofed) |
| Workflow persistence | Workflows save to GitHub (source of truth), repo configurable per tenant |
User Roles & Permissionsβ
| Role | Permissions |
|---|---|
| Viewer | Read-only access to runs, logs, metrics, tool registry, memory |
| Editor | Execute runs, approve/reject, answer questions, edit state, manage prompts |
| Admin | Manage tools, registry versions, users, workflows, tenant settings |
| Super Admin | Tenant management, system config, role assignment, provider config |
Auth Architectureβ
- Primary: Keycloak OIDC integration with JWT tokens
- Future: Azure AD / Entra ID support (abstract identity provider interface)
- Token handling: Secure HTTP-only cookies, refresh token rotation
- Role claims: Map OIDC claims/groups to Cruvero roles
- Session management: Configurable timeout, forced logout on role change
Scope by Feature Areaβ
1. Dashboard & Run Management (Phase 1β2 features)β
- Run list with status badges (Running, Completed, Failed, Paused), duration, model, cost, step count
- Run filters: status, date range, model, prompt search, cost range
- Run detail page:
- Step-by-step timeline with expand/collapse per step
- Per-step: LLM decision, tool call + args, tool result, latency, token count, cost
- Decision record hashes (prompt hash, state hash, tool schema hash, input hash)
- State diff viewer between steps (JSON diff with syntax highlighting)
- Raw prompt viewer (what the LLM actually saw)
- Live run streaming via SSE with configurable interval
- Start new run from UI: prompt input, model selector, registry version, max steps, advanced config
2. Approval & Human-in-the-Loop (Phase 2 features)β
- Approval queue page: pending approvals across all running workflows
- Approve/reject with optional reason
- Show tool name, args, agent reasoning for the call
- Approval history with timestamps and actors
- Question queue: pending questions from agents
- Answer inline with text input
- Live control panel per running workflow:
- Pause / Resume / Step (single-step then pause)
- Edit state (Monaco JSON editor with validation)
- Inject synthetic tool result
3. Replay & Time-Travel (Phase 2 + 6A features)β
- Replay console:
- Select run β pick step β replay from that point
- Side-by-side comparison: original vs replay decision log
- Decision override editor (inject different decision at step N)
- Counterfactual replay: "what if the agent had done X instead?"
- Replay diff viewer: highlight divergence points between original and replay
4. Causal Tracing & Explainability (Phase 6A features)β
- Trace explorer per run:
- Visual influence graph: which inputs influenced which outputs
- Click any output β see causal chain (user messages, tool results, memory facts)
- Influence confidence scores
- "Why did the agent do X?" query interface
- Select an output/decision β see all contributing factors
5. Tool Registry & Management (Phase 1β2 features)β
- Tool browser: search/filter all tools across registry versions
- Tool schema viewer (JSON Schema rendered as form)
- Read-only flag, retry policy, cost hints
- MCP tool distinction (shows source server)
- Tool approval policies: enable/disable tools, cap retry attempts
- Tool repair policies: configure repair loop settings per tool
- Registry version browser: compare tools across versions, diff tool schemas
6. Memory Explorer (Phase 4 features)β
- Episodic memory: browse per-run episodes, expandable timeline
- Semantic memory: search facts by query, view embeddings (optional 2D projection), see salience scores
- Procedural memory: browse/edit stored procedures and playbooks
- Memory policy viewer: show active policies (working memory limit, summarization threshold, etc.)
7. Cost Dashboard (Phase 6B features)β
- Cost overview: total spend by time period, grouped by model/provider/run
- Cost breakdown per run: per-step cost with token/tool split
- Cost trends chart: ECharts line chart over time, bar chart by model
- Cost policy display: show active max cost per run/step, cheap model preferences
- Provider comparison: OpenRouter vs Azure cost side-by-side
- Model catalog browser: list all models with context limits, pricing, capabilities
- Model preferences: view/edit preferred models per namespace
8. Supervisor & Multi-Agent (Phase 5 features)β
- Supervisor run viewer:
- Visual layout showing supervisor + child agents
- Per-agent status, progress, cost
- Inter-agent message timeline
- Blackboard state viewer (shared state)
- Pattern selector: when starting a supervisor run, pick pattern (delegate, broadcast, debate, pipeline, map-reduce, voting, saga)
- Saga viewer: step progression with compensation status
- Shows which steps completed, which failed, which compensated
- Debate viewer: side-by-side arguments from pro/con agents with critic output
9. Graph DSL Visualizer (Phase 3 features)β
- Read-only graph renderer: visualize any existing Graph DSL workflow
- Show steps, routes, parallel branches, join points
- Highlight current execution position for running workflows
- Color-code by status (pending, running, completed, failed)
- Subgraph expansion: click to drill into composed subgraphs
10. Visual Flow Builder + GitHub Persistence (NEW)β
- Drag-and-drop workflow editor using React Flow
- Node palette with all DSL primitives:
- Step (with tool binding)
- Route (with condition editor)
- Parallel (with branch configuration)
- Join (JoinAll, JoinAny, JoinN, JoinVote selector)
- Subgraph (reference to another flow)
- Approval Gate (with timeout config)
- Start / End nodes
- Edge connections with typed ports (data flow, control flow)
- Property panel: per-node configuration sidebar (Monaco for complex JSON)
- Real-time validation overlay (missing joins, cycles, unreachable nodes, invalid conditions)
- Minimap, zoom, pan, auto-layout (dagre/elk)
- Undo/redo support
- Keyboard shortcuts
- Node palette with all DSL primitives:
- Bidirectional serialization: visual graph β Graph DSL JSON
- GitHub persistence:
- Repo configurable per tenant in tenant settings
- Each workflow saved as a folder:
<repo>/<workflow-name>/workflow.jsonβ Graph DSL definitionmetadata.jsonβ Name, description, version, author, timestampsREADME.mdβ Auto-generated documentation
- Direct commit or PR mode (create branch + PR for review)
- Load existing workflows from GitHub for editing
- Commit history viewer per workflow
- Conflict detection on save
- Branch selection for load/save
- Preview / dry-run: compile flow β execute with mock tools β show execution trace overlaid on the graph
- Deploy: push flow to registry as a new graph version
11. Live Agent Inspection (Phase 6C features)β
- Inspector panel for running workflows:
- Current state viewer (full JSON tree via Monaco)
- Memory state (working, episodic snapshots)
- Drill into any state path
- Edit state fields inline (gated, sends edit-state signal)
- Step/continue controls with visual step indicator
- Inject synthetic tool result
12. Speculative Execution Viewer (Phase 6C features)β
- Speculation dashboard: when a run uses speculative execution, show all branches
- Per-branch: model used, cost, output, status
- Winning branch highlighted
- Selection criteria shown (lowest cost / highest similarity)
13. Differential Testing (Phase 6C features)β
- Diff test launcher: select two models or agent versions, provide test inputs
- Results table: side-by-side outputs, cost comparison, latency comparison
- Aggregate metrics: accuracy, cost delta, latency delta
14. Agent Versioning (Phase 6C features)β
- Version registry: list agent versions with semver, changelog, compatibility
- Version comparison: diff two versions (schema changes, behavior changes)
- Rollback controls: select a version to deploy
15. Ops & Self-Healing (Phase 6C features)β
- Ops tools panel: read-only query tools (workflow_query, trace_query, registry_get_latest)
- Gated write tools: workflow_edit_state, workflow_approve, workflow_replay_override (require confirmation)
- Repair log: show tool repair attempts per run
16. MCP Server Status (Phase 2 + 8 features)β
- MCP server health: list configured MCP servers, connection status, last ping
- MCP tool inventory: tools exposed per server
- MCP server config viewer: endpoint, env vars (masked)
17. Settings & Configurationβ
- Environment viewer: show current config (non-secret values)
- Provider config: active LLM provider, model, timeout
- Tenant settings: GitHub repo for workflows, default model, cost limits
- Auth status: current auth mode, identity provider config
- System health: Temporal connection, Postgres connection, Dragonfly connection
Technical Architectureβ
Frontend Stackβ
| Layer | Technology |
|---|---|
| Framework | React 18 with TypeScript |
| Build | Vite β static bundle in cmd/ui/dist/ |
| Routing | React Router v6 |
| Flow builder | React Flow |
| Charts | ECharts (echarts-for-react) |
| JSON editor | Monaco Editor |
| Server state | TanStack Query (React Query) |
| Client state | Zustand |
| Styling | Tailwind CSS |
| Streaming | EventSource API for SSE |
| API client | Typed client, calls Phase 14 API endpoints |
Backend (Go)β
Extend the existing cmd/ui Go server. If Phase 14 API endpoints are missing for any UI feature, add them in this phase.
API Endpoints (extend/add as needed):
Flows:
GET /api/flowsβ list flows from GitHubGET /api/flows/:nameβ load flow folder (workflow.json + metadata.json)POST /api/flowsβ save flow draft (server-side)POST /api/flows/:name/commitβ commit to GitHubPOST /api/flows/:name/validateβ server-side validationPOST /api/flows/:name/previewβ dry-run executionPOST /api/flows/:name/deployβ register as graph versionGET /api/flows/:name/historyβ commit history
Memory:
GET /api/memory/episodic?run_id=...&limit=...&types=...GET /api/memory/semantic?query=...&k=...&namespace=...GET /api/memory/procedural?name=...
Traces:
GET /api/traces?run_id=...&step=...GET /api/traces/explain?run_id=...&output_id=...
Inspection:
POST /api/inspect/stateβ get live statePOST /api/inspect/editβ edit state (gated by role)POST /api/inspect/injectβ inject tool result
Supervisor:
GET /api/supervisor/run?workflow_id=...β supervisor state with agentsGET /api/supervisor/blackboard?workflow_id=...POST /api/supervisor/signalβ send signal to supervisor
Models:
GET /api/models?provider=...β model catalogGET /api/models/prefs?namespace=...β preferred modelsPOST /api/models/prefsβ update preferences
Agent Versions:
GET /api/agent-versionsGET /api/agent-versions/:versionPOST /api/agent-versionsβ create version
Diff Testing:
POST /api/diff-testβ launch diff testGET /api/diff-test/:idβ get results
MCP:
GET /api/mcp/serversβ server list + statusGET /api/mcp/tools?server=...β tools per server
Tenant:
GET /api/tenant/settingsβ tenant configurationPUT /api/tenant/settingsβ update tenant settings (Admin+)GET /api/tenant/usersβ list users (Admin+)POST /api/tenant/users/:id/roleβ assign role (Super Admin)
System:
GET /api/healthβ Temporal + Postgres + Dragonfly statusGET /api/configβ non-secret configuration values
GitHub Persistenceβ
- Configurable per tenant via tenant settings UI
- Each workflow is a folder in the configured repo:
<repo>/<workflow-name>/
βββ workflow.json # Graph DSL definition
βββ metadata.json # Name, version, author, timestamps
βββ README.md # Auto-generated docs - Optional PR mode: create branch + PR instead of direct commit
- Uses
go-githublibrary (ormcp-githubif available) - Conflict detection: compare SHA before commit, prompt user on conflict
Serving Modelβ
go run ./cmd/ui --addr :8080serves the built React app from embeddedcmd/ui/dist/- Development:
cd cmd/ui/frontend && vite devwith proxy to Go API on:8081 - Production: single binary, no Node.js required at runtime
- Environment variable
CRUVERO_UI_MODE=react(default) orhtmxfor backward compat
OWASP Security Hardeningβ
All OWASP Top 10 mitigations implemented:
| Category | Mitigation |
|---|---|
| Injection | Parameterized queries (Go backend), input validation on all API endpoints |
| Broken Auth | Secure session management, JWT with short expiry, refresh token rotation |
| Sensitive Data | HTTPS only, secrets never in responses, secure cookie flags |
| XXE | JSON-only APIs, no XML parsing |
| Broken Access Control | Role-based route guards (frontend), role checks on every API endpoint (backend) |
| Security Misconfiguration | Hardened CSP headers, X-Frame-Options, X-Content-Type-Options |
| XSS | React's built-in escaping, CSP with strict script-src, no dangerouslySetInnerHTML |
| Insecure Deserialization | Strict JSON schema validation on all inputs |
| Vulnerable Components | Automated dependency audit (npm audit, govulncheck), Dependabot/Renovate |
| Insufficient Logging | Audit log for all mutations, structured logging with correlation IDs |
Security Headers (served by Go)β
Content-Security-Policy: default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self' data:; connect-src 'self' wss:;
X-Frame-Options: DENY
X-Content-Type-Options: nosniff
X-XSS-Protection: 1; mode=block
Referrer-Policy: strict-origin-when-cross-origin
Permissions-Policy: geolocation=(), microphone=(), camera=()
CSRF Protectionβ
- All state-changing requests require CSRF token
- Token generated server-side, stored in secure cookie
- Validated on every POST/PUT/DELETE
Input Sanitizationβ
- All user input validated against JSON schemas
- Monaco editor content sanitized before execution
- File uploads validated (type, size, content)
Tasks and Subtasksβ
1. Project Scaffold (1 week)β
- Vite + React + TypeScript project setup in
cmd/ui/frontend/ - Tailwind CSS configuration
- ESLint + Prettier configuration
- Vitest + React Testing Library setup
- Go server: embed built React assets, serve SPA with fallback routing
2. Design System (1 week)β
- Component library from Figma reference in
reference/frontend/folder - Design tokens: colors, spacing, typography, shadows
- Core components: Button, Input, Select, Modal, Table, Card, Badge, Tabs
- Layout components: Sidebar, TopBar, ContentArea, PageHeader
3. Auth Integration (1 week)β
- OIDC login flow with Keycloak
- JWT token management (secure cookies, refresh rotation)
- Role extraction from claims/groups
- Route guards (frontend): redirect unauthorized users
- API guards (backend): role check middleware
- Abstract identity provider interface (future Azure AD support)
- Session timeout handling, logout
4. Run Management Pages (2 weeks)β
- Run list with filters, search, pagination
- Run detail with step timeline, state diffs, decision records
- Live streaming run view (SSE)
- Start new run form with model selector
- Approval queue page
- Question queue page
- Live control panel (pause/resume/step)
5. Cost & Models Pages (1 week)β
- Cost dashboard with ECharts time-series
- Per-run cost breakdown
- Model catalog browser
- Model preferences editor
- Provider comparison view
6. Tool & Registry Pages (1 week)β
- Tool browser with schema viewer
- Registry version comparison
- Tool approval policies editor
- Tool repair policies editor
- MCP server status page
7. Memory Explorer (1 week)β
- Episodic memory timeline per run
- Semantic memory search with salience scores
- Procedural memory browser
- Memory policy viewer
8. Replay & Trace Pages (1 week)β
- Replay console with side-by-side diff
- Counterfactual replay launcher
- Causal trace explorer with influence graph
- "Why did the agent do X?" query interface
9. Supervisor & Multi-Agent Pages (1 week)β
- Supervisor run viewer with agent graph
- Inter-agent message timeline
- Blackboard state viewer
- Saga step viewer with compensation
- Debate side-by-side viewer
10. Visual Flow Builder (2β3 weeks)β
- React Flow integration with custom node types
- Node palette with all DSL primitives
- Property panel with Monaco for complex config
- Edge validation and typed ports
- Real-time client-side validation overlay
- Auto-layout with dagre/elk
- Undo/redo, keyboard shortcuts, minimap
- Bidirectional serialization (visual β DSL JSON)
11. GitHub Integration (1 week)β
- Go backend: GitHub API for list/load/commit/PR
- Tenant settings: configure GitHub repo
- Flow list page: browse workflows from repo
- Load/save/commit workflow from builder
- Commit history viewer
- PR mode toggle
- Conflict detection
12. Preview & Deploy (1 week)β
- Dry-run execution with mock tools
- Execution trace overlay on flow builder graph
- Deploy to registry as graph version
13. Inspection & Advanced Pages (1 week)β
- Live inspection panel with Monaco state editor
- Speculative execution viewer
- Differential testing launcher + results
- Agent version registry page
- Ops tools panel
- Settings & system health page
14. OWASP Hardening (1 week)β
- CSP headers implementation
- CSRF token flow
- Input sanitization audit
- Dependency audit setup (npm audit, govulncheck)
- Security header verification
- Penetration testing checklist
15. Polish & Testing (1 week)β
- Responsive design for common breakpoints
- Loading states, error boundaries, empty states
- E2E tests (Playwright)
- API endpoint tests
- Accessibility (WCAG 2.1 AA): keyboard nav, ARIA, focus management
- Documentation
Files to Add/Changeβ
Frontend (new)β
| Path | Description |
|---|---|
cmd/ui/frontend/ | React project root |
cmd/ui/frontend/src/pages/ | Page components (RunList, RunDetail, CostDashboard, FlowBuilder, etc.) |
cmd/ui/frontend/src/components/ | Shared components (design system) |
cmd/ui/frontend/src/components/flow/ | React Flow workflow builder nodes + edges |
cmd/ui/frontend/src/hooks/ | API hooks, auth hooks, SSE hooks |
cmd/ui/frontend/src/api/ | Typed API client |
cmd/ui/frontend/src/auth/ | OIDC integration, role guards, provider abstraction |
cmd/ui/frontend/src/stores/ | Zustand stores |
cmd/ui/frontend/vite.config.ts | Vite configuration |
cmd/ui/frontend/tailwind.config.ts | Tailwind configuration |
cmd/ui/frontend/tsconfig.json | TypeScript configuration |
cmd/ui/frontend/package.json | Dependencies |
cmd/ui/frontend/.eslintrc.js | ESLint configuration |
cmd/ui/frontend/.prettierrc | Prettier configuration |
Backend (extend)β
| Path | Description |
|---|---|
cmd/ui/main.go | Serve embedded React dist, security headers, SPA fallback |
cmd/ui/flow_api.go | Flow CRUD + GitHub handlers |
cmd/ui/memory_api.go | Memory query handlers |
cmd/ui/trace_api.go | Trace/explain handlers |
cmd/ui/inspect_api.go | Live inspection handlers |
cmd/ui/supervisor_api.go | Supervisor query/signal handlers |
cmd/ui/models_api.go | Model catalog + prefs handlers |
cmd/ui/versions_api.go | Agent version handlers |
cmd/ui/difftest_api.go | Diff test handlers |
cmd/ui/mcp_api.go | MCP status handlers |
cmd/ui/tenant_api.go | Tenant settings + user management |
cmd/ui/health_api.go | System health handler |
cmd/ui/auth_middleware.go | Role-based access middleware |
cmd/ui/csrf_middleware.go | CSRF protection middleware |
cmd/ui/security_headers.go | Security headers middleware |
Sharedβ
| Path | Description |
|---|---|
internal/flow/types.go | Flow JSON schema types |
internal/flow/serialize.go | Visual β DSL conversion |
internal/flow/validate.go | Graph validation |
internal/flow/github.go | GitHub persistence |
internal/flow/preview.go | Dry-run execution |
internal/auth/provider.go | Abstract identity provider interface |
internal/auth/keycloak.go | Keycloak implementation |
internal/auth/azuread.go | Azure AD implementation (stub for future) |
docs/manual/flow-builder.md | Flow builder documentation |
docs/manual/ui-react.md | React UI documentation |
Environment Variablesβ
| Variable | Default | Description |
|---|---|---|
CRUVERO_UI_MODE | react | react or htmx (backward compat) |
CRUVERO_UI_STATIC_DIR | cmd/ui/dist | Path to React build output |
CRUVERO_UI_DEV_PROXY | β | Vite dev server URL for development mode |
CRUVERO_FLOW_GITHUB_REPO | β | Default GitHub repo for workflow persistence |
CRUVERO_FLOW_GITHUB_BRANCH | main | Default branch for workflow files |
CRUVERO_FLOW_GITHUB_TOKEN | β | GitHub PAT (falls back to GITHUB_TOKEN) |
CRUVERO_FLOW_GITHUB_PR_MODE | false | Create PRs instead of direct commits |
CRUVERO_AUTH_PROVIDER | keycloak | Identity provider (keycloak, azuread) |
CRUVERO_UI_JWKS_URL | β | OIDC JWKS endpoint |
CRUVERO_UI_ISSUER | β | OIDC issuer URL |
CRUVERO_UI_AUDIENCE | β | OIDC audience/client ID |
CRUVERO_UI_SESSION_TIMEOUT | 8h | Session timeout duration |
Dev Environment Checksβ
- Start UI and see run list with live data
- Start a new run from UI and watch it stream
- Approve a pending action from approval queue
- Answer an agent question from question queue
- Pause, step, and resume a running workflow
- View per-run cost breakdown and ECharts cost trends
- Browse tool registry and compare versions
- Search semantic memory and view salience scores
- Replay a run from step N with decision overrides
- View causal trace and explain a decision
- View supervisor run with child agents and messages
- Open flow builder, drag nodes, connect edges
- Configure GitHub repo in tenant settings
- Save workflow and commit to GitHub repo
- Load existing workflow from GitHub and edit
- Run preview and see execution trace on graph
- View speculative execution branches
- Launch differential test between two models
- Inspect live state of running workflow
- Login with Keycloak, verify role-based access
- Verify CSRF protection on mutations
- Verify security headers in browser dev tools
Exit Criteriaβ
- All features from
cmd/uihtmx version replicated in React - All run management features from CLI available in UI
- React Flow workflow builder creates valid Graph DSL definitions
- Workflows save as folders to GitHub (workflow.json + metadata.json)
- Load and edit existing workflows from GitHub
- ECharts renders cost, latency, and success rate dashboards
- Approvals, questions, and live control working end-to-end
- Memory explorer with search and salience display
- Replay console with counterfactual support
- Causal trace with visual influence graph
- Supervisor run viewer with multi-agent layout
- Speculative execution and diff test results visible
- Live inspection panel working on running workflows
- System health page showing all connection statuses
- OWASP Top 10 mitigations verified
- Role-based access enforced (Viewer/Editor/Admin/Super Admin)
- Auth works with Keycloak, Azure AD interface stubbed
- Responsive design, accessible (WCAG 2.1 AA)
- All API calls go through typed client
- E2E tests passing for critical paths
- Security headers verified
- Dependency audit clean
Code Quality Requirementsβ
Go (internal/flow/, internal/auth/, cmd/ui/)β
- Error handling: never ignore errors with
_ - Cyclomatic complexity per function under 15
- No commented-out code, no TODO without linked issue
- Resource cleanup (defer Close, context cancellation)
- Early returns, no magic values, no hardcoded secrets
- Linting:
go vet ./internal/flow/... ./internal/auth/... && staticcheck ./internal/flow/... ./internal/auth/...
TypeScript (cmd/ui/frontend/)β
- Strict TypeScript (
"strict": truein tsconfig) - ESLint with recommended + React hooks rules
- No
anytypes (useunknown+ type guards) - Components under 50 lines (extract sub-components)
- Linting:
npx tsc --noEmit && npx eslint src/
Test Coverageβ
- Go packages: >= 80% for
internal/flow/andinternal/auth/ - React: Vitest component tests for shared components
- E2E: Playwright critical path tests
Success Metricsβ
| Metric | Target |
|---|---|
| Feature parity | All cmd/ui htmx features replicated in React |
| Flow builder | Creates valid Graph DSL definitions, round-trips losslessly |
| Security | OWASP Top 10 mitigations verified |
| Accessibility | WCAG 2.1 AA compliance |
| Test coverage | >= 80% for internal/flow/ and internal/auth/; Vitest + Playwright for frontend |
Cross-Referencesβ
- Current htmx UI:
cmd/ui/main.go,cmd/ui/ui/* - Figma reference:
reference/frontend/folder in repo - Phase 14 API:
cmd/ui/main.go(existing endpoints) - Graph DSL:
internal/graph/* - Supervisor:
internal/supervisor/* - Memory:
internal/memory/*
Notesβ
- This replaces the current htmx static UI entirely. The old
cmd/ui/ui/*static files become legacy. - React Flow is the established standard for node-based editors. No need to build from scratch.
- The Go binary still serves everythingβ
go:embedthe built React dist. No Node.js in production. - GitHub persistence makes flows CI-friendly: you can lint, test, and deploy flows from a CI pipeline.
- PR mode is critical for teams: flows go through review before they're live.
- The flow builder doesn't replace the Go DSLβit's a visual authoring layer that produces the same JSON the DSL produces.
- Every page should have a direct link to the corresponding CLI command in the docs, so power users can switch between UI and CLI seamlessly.
- If Phase 14 API is missing endpoints needed by the UI, add them as part of this phase and document the additions.