|
| 1 | +# More Pixel Agents — Design |
| 2 | + |
| 3 | +## Overview |
| 4 | + |
| 5 | +A standalone browser-based pixel art office that visualizes all active Claude Code agents across your machine. Fork of [pixel-agents](https://github.com/pablodelucca/pixel-agents) with three core features and one stretch goal. |
| 6 | + |
| 7 | +## Goals |
| 8 | + |
| 9 | +1. **Browser-based standalone app** — Run outside VS Code as a local web server (`localhost:3100`) |
| 10 | +2. **Auto-discover all active sessions** — Scan `~/.claude/projects/` for any session active in the last 30 minutes |
| 11 | +3. **Click-to-focus terminal** — Click an agent to switch to its Ghostty/iTerm/VS Code/Terminal.app tab |
| 12 | +4. **Character-to-folder config** — Assign specific character sprites to project folders |
| 13 | +5. **Mini sub-agents (stretch)** — Show smaller pixel characters when agents spawn sub-agents |
| 14 | + |
| 15 | +## Approach |
| 16 | + |
| 17 | +Cherry-pick/merge existing PRs into the fork, then build new features on top: |
| 18 | + |
| 19 | +- **PR #156** — Standalone Node.js HTTP + WebSocket server serving the webview |
| 20 | +- **PR #157** — `scanAllProjectDirs()` to watch all `~/.claude/projects/` directories |
| 21 | +- **PR #141** — External terminal detection (adapt for Ghostty focus logic) |
| 22 | +- **PR #143** — Already merged in main; browser preview foundation with `shared/` modules |
| 23 | + |
| 24 | +## Architecture |
| 25 | + |
| 26 | +### Standalone Server (from PR #156) |
| 27 | + |
| 28 | +- Node.js HTTP server serves the built webview at `localhost:3100` |
| 29 | +- WebSocket bridge replaces VS Code's `postMessage` API |
| 30 | +- `vscodeApi.ts` auto-detects environment (VS Code vs browser) and switches transport |
| 31 | + |
| 32 | +### Multi-Folder File Watcher (from PR #157) |
| 33 | + |
| 34 | +- `scanAllProjectDirs()` scans all directories under `~/.claude/projects/` |
| 35 | +- Creates virtual agents for each active session (transcript modified < 30 min ago) |
| 36 | +- Watches for new JSONL transcript entries to update agent state (typing, reading, idle, etc.) |
| 37 | + |
| 38 | +### Terminal Focus (new) |
| 39 | + |
| 40 | +Detection flow: |
| 41 | +1. Parse session's working directory from `~/.claude/projects/` path |
| 42 | +2. Use `pgrep`/`ps` to find Claude Code processes and their parent PIDs |
| 43 | +3. Cache the session → terminal mapping |
| 44 | + |
| 45 | +Focus logic (macOS, via `osascript`): |
| 46 | +- **Ghostty:** Activate app, match tab by PID or window title |
| 47 | +- **iTerm2:** Rich AppleScript support, focus tab by PID |
| 48 | +- **Terminal.app:** AppleScript to focus window |
| 49 | +- **VS Code:** `code` CLI or AppleScript |
| 50 | +- **Fallback:** Tooltip with working directory |
| 51 | + |
| 52 | +### Character Config (new) |
| 53 | + |
| 54 | +Config file at `~/.config/more-pixel-agents/config.json` mapping folder paths to character IDs. |
| 55 | + |
| 56 | +### Mini Sub-Agents (stretch goal) |
| 57 | + |
| 58 | +Detect `Agent` tool invocations, render at ~60% scale, cap at 4 per parent. |
| 59 | + |
| 60 | +## Implementation Order |
| 61 | + |
| 62 | +1. Fork repo, integrate PRs #156 + #157 |
| 63 | +2. Add character-to-folder config system |
| 64 | +3. Build terminal detection + focus-switching |
| 65 | +4. (Stretch) Mini sub-agent rendering |
0 commit comments