Skip to content

Kanban board for managing Claude Code agents in tmux

Notifications You must be signed in to change notification settings

mgilank/agent-viewer

 
 

Repository files navigation

Agent Viewer

A visual kanban board for orchestrating multiple Claude Code agents
Spawn, monitor, and interact with AI coding assistants from a single web UI. Manage your autonomous development team through tmux sessions with real-time state tracking and intelligent auto-discovery.

Agent Viewer Dashboard

Table of Contents


✨ Features

Core Capabilities

  • πŸš€ Agent Spawning β€” Create new Claude Code agents with custom prompts and project paths
  • πŸ“Š Kanban Board β€” Visual organization across Running, Idle, and Completed columns
  • πŸ”„ Real-time State Detection β€” Automatic state tracking via intelligent terminal output parsing
  • πŸ” Auto-Discovery β€” Automatically detects existing Claude tmux sessions and adds them to the board
  • πŸ’¬ Interactive Messaging β€” Send follow-up messages and files to running agents
  • πŸ“ Smart Project Management β€” Save frequently-used projects as tabs for quick access

Advanced Features

  • 🎨 ANSI Color Support β€” Full 16/256/24-bit color rendering in terminal output
  • πŸ“€ File Uploads β€” Drag-and-drop or click to send files to agents
  • πŸ”„ Re-spawn β€” Restart completed agents with new prompts in the same project
  • πŸ”— Direct Attachment β€” Copy tmux attach commands for terminal access
  • 🌐 Mobile-Friendly β€” Access and manage agents from your phone via Tailscale
  • 🧠 AI-Generated Labels β€” Automatic label generation using Claude Haiku for better organization
  • πŸ“¦ Persistent Registry β€” Agent state persists across server restarts

Keyboard Shortcuts

  • N β€” Open spawn modal
  • Enter β€” Send message (in prompt field)
  • Shift+Enter β€” New line (in prompt field)

πŸš€ Quick Start

Prerequisites

You'll need the following installed on your system:

macOS Installation

# Install dependencies via Homebrew
brew install node tmux

# Install Claude Code CLI globally
npm install -g @anthropic-ai/claude-code

Verify Installation

node --version    # Should be v18+
tmux -V           # Should show tmux version
claude --version  # Should show Claude CLI version

Installation

# Clone the repository
git clone <repo-url>
cd agent-viewer

# Install dependencies
npm install

# Start the server
npm start

Open http://localhost:4200 in your browser.


πŸ“± Remote Access

Access Agent Viewer from any device on your network using Tailscale.

Setup Tailscale

  1. Install on your Mac

    brew install tailscale
    # Or download from https://tailscale.com/download
  2. Install on your phone

  3. Sign in with the same account on both devices

Access from Your Phone

# Start the server (binds to 0.0.0.0 by default)
npm start

Get your Tailscale IP:

tailscale ip

Then visit on your phone:

http://<tailscale-ip>:4200

With MagicDNS (if enabled):

http://<machine-name>:4200

Mobile View


🎯 Usage Guide

Spawning Agents

  1. Click [+ SPAWN] or press N
  2. Enter the project path (or browse with πŸ“)
  3. Write your initial prompt
  4. Click SPAWN

The agent launches in a new tmux session and appears on the board.

Managing Agents

Action Description
VIEW OUTPUT Open full terminal output with ANSI colors
EXPAND Show output inline on the card
Send Message Type in prompt field and press Enter
FILE Upload a file to the agent
ATTACH Copy tmux attach command
RESPAWN Restart a completed agent with new prompt
CLEANUP Remove agent from board
KILL Terminate running agent session

Project Tabs

  • Click + to save the current project as a tab
  • Click a tab to filter by that project
  • When a tab is selected, spawn modal auto-fills that project path

Folder Browser

Click the πŸ“ button in the spawn modal to visually browse your filesystem and select project directories.

Auto-Discovery

Agent Viewer automatically discovers existing tmux sessions running Claude Code and adds them to the board. No manual registration needed!


πŸ—οΈ Architecture

Agent Viewer is a minimal, framework-free application with a clean two-file architecture:

agent-viewer/
β”œβ”€β”€ server.js              # Express backend (tmux integration, SSE broadcasting)
β”œβ”€β”€ public/
β”‚   β”œβ”€β”€ index.html         # Frontend (HTML/CSS/JS in one file)
β”‚   β”œβ”€β”€ prompt-key-utils.js
β”‚   └── expanded-card-utils.js
β”œβ”€β”€ .agent-registry.json   # Persistent agent state
└── .project-tabs.json     # Saved project tabs

Backend (server.js)

Core Systems:

  • Agent Registry β€” In-memory state + JSON persistence
  • State Detection β€” Polls tmux output every 3s to classify agent states
  • Tmux Integration β€” Spawns sessions, captures output, sends input
  • Auto-Discovery β€” Scans tmux sessions and detects Claude processes
  • LLM Label Generation β€” Async Claude Haiku calls for smart labeling
  • SSE Broadcasting β€” Real-time state updates to all clients

State Detection Logic:

Agents are classified by pattern-matching terminal output:

  • Running β€” "esc to interrupt" prompt visible
  • Idle β€” Empty prompt or permission requests
  • Completed β€” Session exited or specific completion signals

Frontend (public/index.html)

  • Vanilla JavaScript β€” No frameworks, no build step
  • SSE-Driven Updates β€” Real-time state synchronization
  • ANSI Converter β€” Full 16/256/24-bit color support
  • Drag-and-Drop β€” For card reordering and file uploads
  • Terminal Aesthetic β€” Dark, modern UI inspired by CLI tools

βš™οΈ Configuration

Environment Variables

Variable Default Description
PORT 4200 Server port
HOST 0.0.0.0 Bind address (0.0.0.0 for network access, 127.0.0.1 for localhost only)
POLL_INTERVAL 3000 State detection interval in milliseconds

Examples

Custom port:

PORT=3000 npm start

Localhost only:

HOST=127.0.0.1 npm start

Multiple settings:

HOST=0.0.0.0 PORT=8080 POLL_INTERVAL=5000 npm start

πŸ”§ Development

Project Structure

agent-viewer/
β”œβ”€β”€ server.js              # Main backend (Express + tmux integration)
β”œβ”€β”€ public/
β”‚   β”œβ”€β”€ index.html         # Complete frontend app
β”‚   β”œβ”€β”€ prompt-key-utils.js       # Keyboard handling utilities
β”‚   └── expanded-card-utils.js    # Card state management
β”œβ”€β”€ test/
β”‚   └── ansi-test.html     # ANSI color rendering tests
β”œβ”€β”€ docs/
β”‚   └── architecture.html  # Visual architecture diagram
β”œβ”€β”€ .agent-registry.json   # Auto-generated agent state
β”œβ”€β”€ .project-tabs.json     # Auto-generated saved tabs
β”œβ”€β”€ CLAUDE.md             # Claude Code integration guide
└── package.json

No Build Step

This project runs directly with Node.js:

  • No transpilation
  • No bundling
  • No compilation

Just edit and refresh!

Key Patterns

  • Shell escaping β€” Single quotes: message.replace(/'/g, "'\\''")
  • Async commands β€” All external commands use exec() with timeouts (never execSync())
  • Session naming β€” Format: agent-{label} (lowercase, hyphenated)
  • Manual parsing β€” Multipart file uploads parsed without libraries
  • Interactive handling β€” waitForClaudeReady() auto-dismisses Claude startup prompts

πŸ› Troubleshooting

Common Issues

Agent not spawning

Problem: Agent doesn't appear on the board after clicking SPAWN

Solutions:

  • Verify claude is in your PATH: which claude
  • Check tmux is installed: tmux -V
  • Ensure project path exists and is accessible
  • Check server logs for errors

Output not showing

Problem: Terminal output is blank or not updating

Solutions:

  • Wait 3 seconds for next state detection cycle
  • Check if tmux session exists: tmux ls
  • Try clicking VIEW OUTPUT instead of EXPAND
  • Verify agent is actually running: tmux attach -t agent-<label>

Agents not auto-discovered

Problem: Existing Claude tmux sessions not appearing

Solutions:

  • Ensure tmux session contains a Claude process
  • Restart the server to trigger fresh discovery
  • Check .agent-registry.json for corrupted data

Cannot connect from phone

Problem: Tailscale IP not accessible

Solutions:

  • Verify server started with HOST=0.0.0.0
  • Check Tailscale is running on both devices: tailscale status
  • Use IP address instead of MagicDNS name
  • Ensure no firewall blocking port 4200

Debug Mode

Enable verbose logging:

DEBUG=* npm start

View tmux sessions:

tmux ls

Attach to agent directly:

tmux attach -t agent-<label>

πŸ“š API Reference

REST Endpoints

Agents

Method Endpoint Description
GET /api/agents List all agents with current state
POST /api/agents Spawn new agent
POST /api/agents/:name/send Send message or respawn
POST /api/agents/:name/upload Upload file to agent
DELETE /api/agents/:name Kill agent session
DELETE /api/agents/:name/cleanup Remove from registry
GET /api/agents/:name/output Fetch terminal output

Projects

Method Endpoint Description
GET /api/recent-projects List recently used paths
GET /api/browse?dir=PATH Browse directories

Bulk Operations

Method Endpoint Description
DELETE /api/cleanup/completed Bulk cleanup completed agents

Real-time

Method Endpoint Description
GET /api/events SSE stream for real-time updates

Request Examples

Spawn Agent:

curl -X POST http://localhost:4200/api/agents \
  -H "Content-Type: application/json" \
  -d '{
    "projectPath": "/path/to/project",
    "prompt": "Implement user authentication"
  }'

Send Message:

curl -X POST http://localhost:4200/api/agents/my-agent/send \
  -H "Content-Type: application/json" \
  -d '{"message": "Add unit tests"}'

Upload File:

curl -X POST http://localhost:4200/api/agents/my-agent/upload \
  -F "files=@./config.json"

πŸ“„ License

See repository for license information.


🀝 Contributing

Contributions are welcome! This is a minimal project by design:

  • Keep it simple
  • No frameworks or build tools
  • Maintain the single-file frontend approach

πŸ™ Acknowledgments

Built with:


Made with ❀️ for developers managing multiple AI agents

About

Kanban board for managing Claude Code agents in tmux

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • HTML 67.1%
  • JavaScript 32.9%