A modern web-based terminal and monitoring interface for Claude Flow with real-time system monitoring.
# Install dependencies
npm install
# Start UI with WebSocket server on default ports (11235/11236)
npm run claude-flow-ui
# The server automatically:
# 1. Starts the UI on port 11235
# 2. Starts WebSocket server on port 11236
# 3. Optionally launches claude-flow with your arguments
# Start UI on specific port
npm run claude-flow-ui -- --port 8080
# Start UI with claude-flow (pass arguments after port)
npm run claude-flow-ui -- --port 8080 swarm --objective "your task here"
# Or use directly with npx after install
npx claude-flow-ui --port 3000 hive-mind --name "my-hive"- Full Keyboard Support: Arrow keys, history, Ctrl+C, Ctrl+L, etc.
- Command History: Navigate with up/down arrows
- Multi-Session: Multiple terminal tabs
- Real-time I/O: Live streaming of input/output
- πΎ Memory Panel: Real-time memory usage, efficiency metrics, visual history
- π€ Agents Panel: Live agent status, health indicators, task monitoring
- π Prompt Panel: Current/historical prompts, context information
- β‘ Commands Panel: Active command tracking, execution status, output logs
claude-flow-ui [--port <number>] [claude-flow-args...]--port <number>: Specify port (default: 11235)claude-flow-args: Any arguments to pass to claude-flow
Configure both server and claude-flow options using environment variables:
# Server configuration
export PORT=3000
export TERMINAL_SIZE=140x50
# Claude Flow configuration
export CLAUDE_FLOW_ALPHA=true # Use alpha version
export CLAUDE_FLOW_MODE=sparc
export CLAUDE_FLOW_PROMPT="Build a REST API"
export CLAUDE_FLOW_NEURAL=true
export CLAUDE_FLOW_INIT=github
# Run UI - automatically uses env vars
npm run claude-flow-uiAvailable environment variables:
Server Configuration:
PORT: UI server port (default: 8080)TERMINAL_SIZE: Terminal dimensions as{cols}x{rows}(default: 120x40)
Claude Flow Configuration:
CLAUDE_FLOW_ALPHA: Use alpha version (true/false, default:false)CLAUDE_FLOW_MODE: First argument/mode for claude-flowCLAUDE_FLOW_SUBCOMMAND: Subcommand after mode (e.g.,tdd,run,batch)CLAUDE_FLOW_PROMPT: Task description (automatically quoted)CLAUDE_FLOW_ARGUMENTS: Additional arguments after promptCLAUDE_FLOW_TIMEOUT: Timeout in seconds for operationsCLAUDE_FLOW_NEURAL: Set totrueto enable neural modeCLAUDE_SPAWN: Agent spawning (truefor --claude,autofor --auto-spawn)CLAUDE_FLOW_INIT: Run init commands (true,force,github, orauto- NEW!)
Hive Mind Configuration:
HIVE_CONSENSUS_TYPE: Consensus algorithm (majority,unanimous,byzantine, etc.)HIVE_QUEEN_TYPE: Queen coordinator type (strategic,tactical,adaptive,democratic)AUTO_SCALE_AGENTS: Enable auto-scaling (trueto enable)HIVE_LOG_LEVEL: Log level (error,warn,info,debug- debug also adds --verbose)HIVE_MEMORY_SIZE: Memory allocation for hive system
See docs/ENVIRONMENT_VARIABLES.md for full documentation.
# Run UI only (no claude-flow)
npm run claude-flow-ui
# Run UI with claude-flow in swarm mode
npm run claude-flow-ui -- swarm --objective "Build a React app"
# Run UI on port 8080 with hive-mind mode
npm run claude-flow-ui -- --port 8080 hive-mind --queen strategic
# Run with all claude-flow options
npm run claude-flow-ui -- --port 3000 swarm \
--objective "Create API" \
--model claude-3-opus \
--max-agents 10
# NEW: Auto-initialize claude-flow in new projects
CLAUDE_FLOW_INIT=auto npm run claude-flow-ui
# Auto-init with alpha version
CLAUDE_FLOW_INIT=auto CLAUDE_FLOW_ALPHA=true npm run claude-flow-ui- Default UI port is 11235
- Default WebSocket port is 11236 (UI port + 1)
- If
--portis specified, that port is used for UI - WebSocket automatically uses UI port + 1
- If the requested port is occupied, automatically finds next available port
- Both servers start automatically - no separate setup needed
- Displays both UI and WebSocket ports on startup
When you run npm run claude-flow-ui:
- UI Server: Next.js application on port 11235
- WebSocket Server: Real-time communication on port 11236
- Claude Flow (optional): If you provide arguments
The WebSocket server provides:
- Terminal session management
- Real-time system metrics
- Agent status updates
- Command execution monitoring
- Framework: Next.js 15 with App Router
- UI Library: React 18
- Styling: Tailwind CSS 3.4
- Terminal: xterm.js 5.5
- WebSocket: Socket.IO Client 4.8
- State Management: Zustand 5.0
- Language: TypeScript 5.6
src/
βββ app/ # Next.js app directory
βββ components/ # React components
β βββ terminal/ # Interactive terminal
β βββ monitoring/ # Monitoring panels
β β βββ MemoryPanel.tsx
β β βββ AgentsPanel.tsx
β β βββ PromptPanel.tsx
β β βββ CommandsPanel.tsx
β βββ sidebar/ # Session sidebar
β βββ tabs/ # Tab components
βββ hooks/ # Custom React hooks
β βββ useTerminal.ts # Terminal logic
β βββ useWebSocket.ts # WebSocket connection
βββ lib/ # Utility libraries
β βββ state/ # Zustand store
β βββ websocket/ # WebSocket client
βββ types/ # TypeScript definitions
# Clone the repository
git clone https://github.com/yourusername/claude-flow-ui.git
cd claude-flow-ui
# Install dependencies
npm install# Start development server
npm run dev
# Run with custom port
PORT=8080 npm run dev# Build for production
npm run build
# Start production server
npm start
# Or use the custom server
node server.js --port 8080The UI connects to claude-flow's WebSocket server for real-time communication.
Default connection: ws://localhost:11236 (UI port + 1)
The WebSocket port is automatically set to UI port + 1:
- UI on port 11235 β WebSocket on port 11236
- UI on port 8080 β WebSocket on port 8081
To override, set environment variables:
# .env.local
NEXT_PUBLIC_WS_PORT=11236
NEXT_PUBLIC_WS_URL=ws://localhost:11236# .env.local
NEXT_PUBLIC_WS_PORT=11236 # WebSocket port (default: UI port + 1)
NEXT_PUBLIC_WS_URL=ws://localhost:11236 # Full WebSocket URL
NEXT_PUBLIC_API_URL=http://localhost:11235 # API URLEdit src/hooks/useTerminal.ts to customize:
- Terminal colors and theme
- Font size and family
- Cursor style
- Scrollback buffer size
npm run dev- Development servernpm run build- Production buildnpm start- Production server (Next.js)npm run serve- Custom server with port selectionnpm run claude-flow-ui- Start UI with CLI optionsnpm run lint- Run ESLintnpm run type-check- TypeScript checking
The server automatically finds the next available port if the requested port is occupied.
The WebSocket server starts automatically with the UI. If you see connection errors:
- Check that both servers started successfully (look for the startup messages)
- Verify the WebSocket port in the console output
- Ensure no firewall is blocking the WebSocket port
- Try restarting with
npm run claude-flow-ui
# Test the WebSocket connection
node test-connection.jsThis will verify that the WebSocket server is running and responding.
- Refresh the browser
- Check browser console for errors
- Ensure WebSocket connection is established
MIT
Contributions are welcome! Please feel free to submit a Pull Request.
Built with collective intelligence by the Claude Flow Hive Mind system.