|
| 1 | +# Liku-AI Development Roadmap |
| 2 | + |
| 3 | +## Overview |
| 4 | + |
| 5 | +Liku-AI is a fork of LikuBuddy focused on **real-time AI agent communication** via WebSocket. This document tracks all planned features, integration points, and improvements. |
| 6 | + |
| 7 | +**Version Target**: 2.0.0 (stable WebSocket release) |
| 8 | +**Current**: 2.0.0-alpha.1 |
| 9 | + |
| 10 | +--- |
| 11 | + |
| 12 | +## 🎯 Phase 1: Core WebSocket Integration (v2.0.0-alpha) |
| 13 | + |
| 14 | +### 1.1 WebSocket Server Foundation ✅ |
| 15 | +- [x] Create `LikuWebSocketServer` class |
| 16 | +- [x] Implement event-driven architecture with EventEmitter |
| 17 | +- [x] Define `GameState`, `AICommand`, `AIResponse` interfaces |
| 18 | +- [x] Add client connection/disconnection handling |
| 19 | +- [x] Implement `broadcastState()` for real-time updates |
| 20 | +- [x] Add command acknowledgment system |
| 21 | + |
| 22 | +### 1.2 WebSocket Client Library ✅ |
| 23 | +- [x] Create `LikuAIClient` class for AI agents |
| 24 | +- [x] Implement `sendKey()`, `sendAction()`, `query()` methods |
| 25 | +- [x] Add auto-reconnection with configurable interval |
| 26 | +- [x] Add pending request tracking with timeouts |
| 27 | +- [x] Export types for TypeScript consumers |
| 28 | + |
| 29 | +### 1.3 Game State Integration 🔲 |
| 30 | +- [ ] Modify `GameStateLogger.ts` to also broadcast via WebSocket |
| 31 | +- [ ] Create unified state object that works for both file and WebSocket |
| 32 | +- [ ] Add WebSocket server startup to `src/index.tsx` |
| 33 | +- [ ] Handle graceful shutdown of WebSocket server on exit |
| 34 | +- [ ] Add `--no-websocket` CLI flag for legacy mode |
| 35 | + |
| 36 | +### 1.4 Command Handler Integration 🔲 |
| 37 | +- [ ] Create `CommandRouter` to map WebSocket commands to game actions |
| 38 | +- [ ] Integrate with `useInput` hook in game components |
| 39 | +- [ ] Add synthetic key event generation for WebSocket commands |
| 40 | +- [ ] Support both key-level and action-level commands |
| 41 | +- [ ] Add rate limiting for command spam protection |
| 42 | + |
| 43 | +--- |
| 44 | + |
| 45 | +## 🎯 Phase 2: Enhanced AI Tools (v2.0.0-beta) |
| 46 | + |
| 47 | +### 2.1 Structured Game State 🔲 |
| 48 | +- [ ] Define per-game state schemas (Dino, Snake, TicTacToe) |
| 49 | +- [ ] Add obstacle prediction data to Dino state |
| 50 | +- [ ] Add pathfinding hints to Snake state |
| 51 | +- [ ] Add minimax evaluation to TicTacToe state |
| 52 | +- [ ] Include game-specific decision recommendations |
| 53 | + |
| 54 | +### 2.2 AI Action API 🔲 |
| 55 | +- [ ] Create high-level action vocabulary: |
| 56 | + - `jump`, `duck` (Dino) |
| 57 | + - `turn_left`, `turn_right`, `go_straight` (Snake) |
| 58 | + - `place_mark`, `undo` (TicTacToe) |
| 59 | +- [ ] Map actions to key sequences |
| 60 | +- [ ] Add action validation (is action valid in current state?) |
| 61 | +- [ ] Return action results in response |
| 62 | + |
| 63 | +### 2.3 Query System 🔲 |
| 64 | +- [ ] Implement query handlers for: |
| 65 | + - `gameState` - Full current state |
| 66 | + - `possibleActions` - Valid actions now |
| 67 | + - `history` - Recent game events |
| 68 | + - `stats` - Player statistics |
| 69 | + - `leaderboard` - High scores |
| 70 | +- [ ] Add query result caching for performance |
| 71 | +- [ ] Support query subscriptions (continuous updates) |
| 72 | + |
| 73 | +### 2.4 Event Streaming 🔲 |
| 74 | +- [ ] Add event types: |
| 75 | + - `game:start`, `game:end`, `game:pause` |
| 76 | + - `score:update`, `level:up` |
| 77 | + - `collision`, `powerup`, `obstacle:spawn` |
| 78 | +- [ ] Allow clients to subscribe to specific event types |
| 79 | +- [ ] Include event timestamps for replay synchronization |
| 80 | + |
| 81 | +--- |
| 82 | + |
| 83 | +## 🎯 Phase 3: Multi-Agent Support (v2.0.0-rc) |
| 84 | + |
| 85 | +### 3.1 Agent Identity 🔲 |
| 86 | +- [ ] Add agent authentication/identification on connect |
| 87 | +- [ ] Assign unique agent IDs |
| 88 | +- [ ] Track agent metrics (commands sent, latency) |
| 89 | +- [ ] Support agent metadata (name, type, version) |
| 90 | + |
| 91 | +### 3.2 Concurrent Agent Management 🔲 |
| 92 | +- [ ] Define turn-taking protocol for multiple agents |
| 93 | +- [ ] Add agent priority system |
| 94 | +- [ ] Implement command queuing with fairness |
| 95 | +- [ ] Add spectator mode (receive state, no commands) |
| 96 | + |
| 97 | +### 3.3 Agent Coordination Protocol 🔲 |
| 98 | +- [ ] Define inter-agent messaging format |
| 99 | +- [ ] Add broadcast vs direct message support |
| 100 | +- [ ] Create coordination primitives (lock, sync, barrier) |
| 101 | +- [ ] Support collaborative game modes |
| 102 | + |
| 103 | +--- |
| 104 | + |
| 105 | +## 🎯 Phase 4: Training & Analytics (v2.1.0) |
| 106 | + |
| 107 | +### 4.1 Training Data Export 🔲 |
| 108 | +- [ ] Record game sessions with full state history |
| 109 | +- [ ] Export in common ML formats (JSON, CSV, TFRecord) |
| 110 | +- [ ] Include action-reward pairs for RL training |
| 111 | +- [ ] Add session metadata (agent, difficulty, outcome) |
| 112 | + |
| 113 | +### 4.2 Replay System 🔲 |
| 114 | +- [ ] Store game replays in SQLite |
| 115 | +- [ ] Implement replay playback via WebSocket |
| 116 | +- [ ] Add seek/pause/speed controls |
| 117 | +- [ ] Support replay annotation |
| 118 | + |
| 119 | +### 4.3 Performance Analytics 🔲 |
| 120 | +- [ ] Track per-agent performance metrics |
| 121 | +- [ ] Generate skill progression graphs |
| 122 | +- [ ] Compare human vs AI performance |
| 123 | +- [ ] Export analytics to dashboard |
| 124 | + |
| 125 | +### 4.4 A/B Testing Framework 🔲 |
| 126 | +- [ ] Support multiple AI strategies simultaneously |
| 127 | +- [ ] Random assignment to strategy groups |
| 128 | +- [ ] Statistical significance calculation |
| 129 | +- [ ] Strategy performance comparison |
| 130 | + |
| 131 | +--- |
| 132 | + |
| 133 | +## 🎯 Phase 5: Remote Play (v2.2.0) |
| 134 | + |
| 135 | +### 5.1 Network Play 🔲 |
| 136 | +- [ ] Add secure WebSocket (wss://) support |
| 137 | +- [ ] Implement authentication tokens |
| 138 | +- [ ] Add connection encryption |
| 139 | +- [ ] Support NAT traversal / TURN servers |
| 140 | + |
| 141 | +### 5.2 Cloud Deployment 🔲 |
| 142 | +- [ ] Create Docker container |
| 143 | +- [ ] Add Kubernetes deployment manifests |
| 144 | +- [ ] Support horizontal scaling |
| 145 | +- [ ] Add load balancing |
| 146 | + |
| 147 | +### 5.3 Spectator Mode 🔲 |
| 148 | +- [ ] Read-only WebSocket connections |
| 149 | +- [ ] Efficient state diffing for bandwidth |
| 150 | +- [ ] Support many concurrent spectators |
| 151 | +- [ ] Add latency-based quality adjustment |
| 152 | + |
| 153 | +--- |
| 154 | + |
| 155 | +## 🐛 Known Issues & Technical Debt |
| 156 | + |
| 157 | +### High Priority |
| 158 | +- [ ] PowerShell script escaping needs hardening |
| 159 | +- [ ] File polling and WebSocket should share state format |
| 160 | +- [ ] Need comprehensive error handling in WebSocket server |
| 161 | + |
| 162 | +### Medium Priority |
| 163 | +- [ ] Add unit tests for WebSocket module |
| 164 | +- [ ] Document WebSocket protocol formally |
| 165 | +- [ ] Add connection health monitoring |
| 166 | +- [ ] Implement backpressure for slow clients |
| 167 | + |
| 168 | +### Low Priority |
| 169 | +- [ ] Consider Socket.io as alternative to raw ws |
| 170 | +- [ ] Add WebSocket compression (permessage-deflate) |
| 171 | +- [ ] Profile memory usage with many connections |
| 172 | +- [ ] Add metrics/tracing integration |
| 173 | + |
| 174 | +--- |
| 175 | + |
| 176 | +## 📁 File Structure (Planned) |
| 177 | + |
| 178 | +``` |
| 179 | +src/ |
| 180 | +├── websocket/ |
| 181 | +│ ├── server.ts ✅ WebSocket server |
| 182 | +│ ├── client.ts ✅ AI agent client library |
| 183 | +│ ├── index.ts ✅ Module exports |
| 184 | +│ ├── router.ts 🔲 Command routing |
| 185 | +│ ├── state.ts 🔲 Unified state management |
| 186 | +│ ├── events.ts 🔲 Event definitions |
| 187 | +│ └── protocol.ts 🔲 Protocol constants |
| 188 | +├── ai/ |
| 189 | +│ ├── actions.ts 🔲 High-level action definitions |
| 190 | +│ ├── queries.ts 🔲 Query handlers |
| 191 | +│ └── training.ts 🔲 Training data export |
| 192 | +└── ...existing files... |
| 193 | +``` |
| 194 | + |
| 195 | +--- |
| 196 | + |
| 197 | +## 🔧 Configuration Options (Planned) |
| 198 | + |
| 199 | +```typescript |
| 200 | +interface LikuAIConfig { |
| 201 | + websocket: { |
| 202 | + enabled: boolean; // Enable WebSocket server |
| 203 | + port: number; // Default: 3847 |
| 204 | + maxClients: number; // Max concurrent connections |
| 205 | + rateLimit: number; // Commands per second per client |
| 206 | + }; |
| 207 | + state: { |
| 208 | + broadcastInterval: number; // ms between state broadcasts |
| 209 | + includeRawFrame: boolean; // Include ASCII game frame |
| 210 | + compressState: boolean; // Use msgpack/compression |
| 211 | + }; |
| 212 | + training: { |
| 213 | + recordSessions: boolean; // Save training data |
| 214 | + exportFormat: 'json' | 'csv' | 'tfrecord'; |
| 215 | + replayRetention: number; // Days to keep replays |
| 216 | + }; |
| 217 | +} |
| 218 | +``` |
| 219 | + |
| 220 | +--- |
| 221 | + |
| 222 | +## 📋 Migration Guide (from LikuBuddy) |
| 223 | + |
| 224 | +### For Users |
| 225 | +1. Install Liku-AI: `npm install liku-ai` |
| 226 | +2. All existing features work unchanged |
| 227 | +3. WebSocket server starts automatically on port 3847 |
| 228 | +4. Use `--no-websocket` flag to disable |
| 229 | + |
| 230 | +### For AI Developers |
| 231 | +1. Replace file polling with WebSocket client |
| 232 | +2. Connect to `ws://localhost:3847` |
| 233 | +3. Receive state via `state` events |
| 234 | +4. Send commands via `key`/`action` messages |
| 235 | + |
| 236 | +### Breaking Changes |
| 237 | +- Package name: `gemini-cli-liku-extension` → `liku-ai` |
| 238 | +- Minimum Node.js: 18.x → 20.x (for WebSocket improvements) |
| 239 | + |
| 240 | +--- |
| 241 | + |
| 242 | +## 📊 Success Metrics |
| 243 | + |
| 244 | +| Metric | Target | Current | |
| 245 | +|--------|--------|---------| |
| 246 | +| State Latency | <5ms | TBD | |
| 247 | +| Command Latency | <10ms | TBD | |
| 248 | +| Concurrent Clients | 100+ | TBD | |
| 249 | +| Memory per Client | <1MB | TBD | |
| 250 | +| Test Coverage | >80% | 0% | |
| 251 | + |
| 252 | +--- |
| 253 | + |
| 254 | +## 🗓️ Timeline |
| 255 | + |
| 256 | +| Phase | Target Date | Status | |
| 257 | +|-------|-------------|--------| |
| 258 | +| Alpha (WebSocket Core) | Dec 2024 | 🟡 In Progress | |
| 259 | +| Beta (AI Tools) | Jan 2025 | 🔲 Not Started | |
| 260 | +| RC (Multi-Agent) | Feb 2025 | 🔲 Not Started | |
| 261 | +| 2.0.0 Stable | Mar 2025 | 🔲 Not Started | |
| 262 | +| 2.1.0 Training | Q2 2025 | 🔲 Not Started | |
| 263 | +| 2.2.0 Remote | Q3 2025 | 🔲 Not Started | |
| 264 | + |
| 265 | +--- |
| 266 | + |
| 267 | +*Last Updated: November 30, 2024* |
0 commit comments