# Visual Brainstorming Companion Implementation Plan > **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:executing-plans to implement this plan task-by-task. **Goal:** Give Claude a browser-based visual companion for brainstorming sessions - show mockups, prototypes, and interactive choices alongside terminal conversation. **Architecture:** Claude writes HTML to a temp file. A local Node.js server watches that file and serves it with an auto-injected helper library. User interactions flow via WebSocket to server stdout, which Claude sees in background task output. **Tech Stack:** Node.js, Express, ws (WebSocket), chokidar (file watching) --- ## Task 1: Create the Server Foundation **Files:** - Create: `lib/brainstorm-server/index.js` - Create: `lib/brainstorm-server/package.json` **Step 1: Create package.json** ```json { "name": "brainstorm-server", "version": "1.0.0", "description": "Visual brainstorming companion server for Claude Code", "main": "index.js", "dependencies": { "chokidar": "^3.5.3", "express": "^4.18.2", "ws": "^8.14.2" } } ``` **Step 2: Create minimal server that starts** ```javascript const express = require('express'); const http = require('http'); const WebSocket = require('ws'); const chokidar = require('chokidar'); const fs = require('fs'); const path = require('path'); const PORT = process.env.BRAINSTORM_PORT || 3333; const SCREEN_FILE = process.env.BRAINSTORM_SCREEN || '/tmp/brainstorm/screen.html'; const SCREEN_DIR = path.dirname(SCREEN_FILE); // Ensure screen directory exists if (!fs.existsSync(SCREEN_DIR)) { fs.mkdirSync(SCREEN_DIR, { recursive: true }); } // Create default screen if none exists if (!fs.existsSync(SCREEN_FILE)) { fs.writeFileSync(SCREEN_FILE, `
Waiting for Claude to push a screen...
`); } const app = express(); const server = http.createServer(app); const wss = new WebSocket.Server({ server }); // Track connected browsers for reload notifications const clients = new Set(); wss.on('connection', (ws) => { clients.add(ws); ws.on('close', () => clients.delete(ws)); ws.on('message', (data) => { // User interaction event - write to stdout for Claude const event = JSON.parse(data.toString()); console.log(JSON.stringify({ type: 'user-event', ...event })); }); }); // Serve current screen with helper.js injected app.get('/', (req, res) => { let html = fs.readFileSync(SCREEN_FILE, 'utf-8'); // Inject helper script before Updated