# Ralph Progress Log - RA-H Light Strip-Down
Started: Thu 29 Jan 2026 15:00:36 AEDT
Branch: feature/rah-light
Goal: Strip ra-h_os to lightweight 2-panel UI + MCP server

## Context
- Auth/subscription already removed
- Target: remove chat agents, voice, delegations, simplify to 2-panel
- Keep: nodes/edges/dimensions, MCP server, workflows, extraction

## Story 1: Remove agent delegation system
- Completed: Thu 29 Jan 2026
- Files deleted:
  - src/services/agents/delegation.ts
  - app/api/rah/delegations/route.ts
  - app/api/rah/delegations/stream/route.ts
  - app/api/rah/delegations/[sessionId]/route.ts
  - app/api/rah/delegations/[sessionId]/summary/route.ts
  - src/components/agents/DelegationIndicator.tsx
- Files modified:
  - src/services/agents/workflowExecutor.ts (removed delegation streaming)
  - src/services/agents/quickAdd.ts (direct execution instead of delegation)
  - src/tools/orchestration/executeWorkflow.ts (direct execution)
  - src/tools/orchestration/delegateToWiseRAH.ts (direct execution)
  - app/api/workflows/execute/route.ts (direct execution)
  - src/components/layout/ThreePanelLayout.tsx (stub type, removed API calls)
  - src/components/agents/RAHChat.tsx (stub type, stub voice hooks)
  - src/components/agents/AgentsPanel.tsx (stub type)
  - src/components/agents/MiniRAHPanel.tsx (stub type)
  - src/components/agents/WiseRAHPanel.tsx (stub type)
  - src/components/agents/QuickAddStatus.tsx (stub type)
  - src/components/panes/types.ts (stub type)
  - src/components/panes/WorkflowsPane.tsx (import from types.ts)
- Learnings:
  - Delegation system was deeply integrated with workflows; had to refactor to direct execution
  - UI components that will be deleted later needed stub types to compile
  - Voice hooks also needed stubs in RAHChat.tsx (will be cleaned up in Story 2)

## Story 2: Remove voice features
- Completed: Thu 29 Jan 2026
- Files deleted:
  - src/components/agents/hooks/useVoiceSession.ts
  - src/components/agents/hooks/useRealtimeVoiceClient.ts
  - src/components/agents/hooks/useAssistantTTS.ts
  - src/components/agents/hooks/useVoiceInterruption.ts
  - app/api/voice/tts/route.ts
  - app/api/realtime/ephemeral-token/route.ts
  - src/services/voice/usageLogger.ts
- Files modified:
  - src/components/agents/RAHChat.tsx (removed all voice-related code and stub hooks)
  - src/components/agents/TerminalInput.tsx (removed voice props and voice UI)
- Learnings:
  - Voice hooks were stubbed in Story 1, so removal was straightforward
  - TerminalInput had voice UI (amplitude bars, mic icons) that needed cleanup
  - No imports to these files from other parts of the codebase

## Story 3: Remove orchestration tools (delegateToWiseRAH)
- Completed: Thu 29 Jan 2026
- Files deleted:
  - src/tools/orchestration/delegateToWiseRAH.ts
  - tests/evals/scenarios/delegate-wise.ts
  - tests/evals/scenarios/delegate-mini.ts
- Files modified:
  - src/tools/infrastructure/registry.ts (removed import and references)
  - src/tools/infrastructure/groups.ts (removed from TOOL_GROUP_ASSIGNMENTS)
  - tests/evals/scenarios/index.ts (removed deleted test imports)
- Learnings:
  - delegateToMiniRAH test also removed since the tool never existed in the registry
  - The tool was a thin wrapper around WorkflowExecutor, which remains for workflow functionality
  - Clean removal - no other files depended on this tool

## Story 4: Remove chat agent components
- Completed: Thu 29 Jan 2026
- Files deleted:
  - src/components/agents/AgentsPanel.tsx
  - src/components/agents/MiniRAHPanel.tsx
  - src/components/agents/WiseRAHPanel.tsx
- Files modified: None
- Learnings:
  - These components were not imported anywhere in the codebase
  - Clean deletion with no cascading changes needed
  - AgentsPanel contained ~1100 lines of complex UI for delegation management (now obsolete)

## Story 5: Remove chat API route
- Completed: Thu 29 Jan 2026
- Files deleted:
  - app/api/rah/chat/route.ts
  - app/api/rah/usage/route.ts
  - app/api/rah/ (empty directory)
- Files modified: None
- Learnings:
  - RAHChat.tsx still references /api/rah/chat endpoint (will be deleted in Story 7)
  - Type-check passes because the endpoint URL is just a string constant
  - tests/evals/runner.ts also references this endpoint (evals won't work until cleaned up)

## Story 6: Simplify to two-panel layout
- Completed: Thu 29 Jan 2026
- Files deleted:
  - src/components/panes/ChatPane.tsx
- Files modified:
  - src/components/panes/types.ts (removed 'chat' from PaneType, ChatPaneProps)
  - src/components/panes/index.ts (removed ChatPane export)
  - src/components/layout/ThreePanelLayout.tsx (removed chat case, defaults)
  - src/components/layout/LeftToolbar.tsx (removed chat icon/type)
- Learnings:
  - Changed persisted state keys from v3 to v4 to avoid stale 'chat' type in user storage
  - Default slotB is now null instead of { type: 'chat' }
  - Cmd+\ now opens node pane instead of chat
  - Layout still flexible (2-panel with split handle) but chat option removed

## Story 7: Remove RAHChat component
- Completed: Thu 29 Jan 2026
- Files deleted:
  - src/components/agents/RAHChat.tsx
  - src/components/agents/TerminalInput.tsx
  - src/components/agents/TerminalMessage.tsx
  - src/components/agents/hooks/useSSEChat.ts
  - src/components/helpers/ReasoningTrace.tsx
  - src/components/helpers/ToolDisplay.tsx
- Files modified:
  - src/components/panes/WorkflowsPane.tsx (simplified - removed RAHChat, shows MCP integration message)
- Learnings:
  - WorkflowsPane was heavily dependent on RAHChat for delegation detail views
  - Simplified WorkflowsPane to show a message about MCP integration
  - ReasoningTrace and ToolDisplay were only used by RAHChat - safe to delete
  - ~2000 lines of chat UI code removed

## Story 8: Clean up agent services
- Completed: Thu 29 Jan 2026
- Files deleted:
  - src/services/agents/registry.ts (only used by contextBuilder.ts which was deleted)
  - src/services/ai.ts (not imported anywhere)
  - src/services/helpers/contextBuilder.ts (not imported anywhere - was for chat agent context)
  - src/services/helpers/logger.ts (not imported anywhere)
- Files kept (still used by MCP tools/API):
  - src/services/agents/workflowExecutor.ts (executeWorkflow tool, /api/workflows/execute)
  - src/services/agents/quickAdd.ts (/api/quick-add endpoint)
  - src/services/agents/toolResultUtils.ts (used by workflowExecutor and quickAdd)
  - src/services/agents/transcriptSummarizer.ts (used by quickAdd for chat transcript import)
  - src/services/agents/autoEdge.ts (used by /api/nodes endpoint for auto-edge creation)
  - src/services/agents/types.ts (AgentDefinition types - still referenced)
- Learnings:
  - contextBuilder.ts was the bridge between agents and the chat system - with chat gone, it's unused
  - registry.ts defined agent configurations (ra-h, ra-h-easy, workflow) used only by contextBuilder
  - ai.ts was a standalone AIService class that was never imported anywhere
  - 776 lines of code removed
  - The remaining agent services are all used by MCP-accessible functionality

## Story 9: Clean up context services
- Completed: Thu 29 Jan 2026
- Files deleted:
  - src/services/context/supabaseTokenRegistry.ts (stub for private version, not imported)
- Files kept:
  - src/services/context/requestContext.ts (used by workflowExecutor, chat middleware, executeWorkflow tool, evalsLogger)
  - src/services/context/autoContext.ts (used by /api/workflows/execute route and executeWorkflow tool)
- Learnings:
  - supabaseTokenRegistry was a stub placeholder for the private version's auth system
  - requestContext provides API key passing and trace IDs through the request lifecycle
  - autoContext provides "top 10 most connected nodes" context for workflows

## Story 10: Simplify settings panel
- Completed: Thu 29 Jan 2026
- Files modified:
  - src/components/settings/ContextViewer.tsx (updated description to remove chat reference)
- Analysis:
  - SettingsModal.tsx tabs: Logs, Tools, Workflows, API Keys, Database, Context, External Agents
  - No voice-specific or agent-configuration tabs existed - panel was already clean
  - All tabs are useful for MCP/workflow functionality
- Learnings:
  - The settings panel was designed well from the start - no chat/voice-specific tabs to remove
  - Only text update needed: "chats and workflows" → "workflow execution" in ContextViewer

