Interactive subagent management for Claude Code
rpcc is an MCP server that extends Claude Code with the ability to spawn, monitor, and interact with isolated Claude Code subagents running in separate tmux sessions. This enables true parallel execution, context isolation, and human-in-the-loop intervention for complex tasks.
Claude Code's builtin subagents are useful to managing context and performing multiple straightforward tasks in parallel. But they are black boxes that take in input and return output with no way of course correcting. This is a simple tool to overcome it by letting you manage subagents interactively within your terminal.
- 🔄 Spawn Isolated Subagents: Launch Claude subagents in separate tmux sessions with custom system prompts
- 👁️ Real-Time Monitoring: Interactive TUI dashboard to view all running subagents and their progress
- 🎯 Direct Interaction: Attach to any subagent's tmux session for hands-on debugging and course correction
- ⚡ Parallel Execution: Run multiple subagents simultaneously for independent tasks
- 📝 Session Persistence: Full conversation history and state saved in structured session directories
- 🔌 Seamless Integration: Drop-in replacement for Claude Code's built-in Task tool via MCP protocol
- Bun runtime installed
- Claude Code CLI installed and authenticated
tmuxinstalled (for subagent session management)
# Clone the repository
git clone https://github.com/adagradschool/rpcc.git
cd rpcc
# Install dependencies
bun install
# Link binaries globally
bun linkAdd rpcc as an MCP server in your Claude Code configuration:
For Claude Code - Add to ~/.claude/mcp.json:
{
"mcpServers": {
"rpcc": {
"command": "bunx",
"args": ["rpcc-mcp-server"],
"env": {}
}
}
}Restart Claude Code to load the MCP server.
Claude Code will automatically use rpcc tools when spawning subagents:
User: "Launch a subagent to refactor the auth module"
Claude: I'll spawn a subagent to handle this task...
[Uses mcp__rpcc__rpcc_task tool]
The main agent can:
- Launch:
rpcc_task(type, prompt, description)- Spawn a new subagent - Poll:
rpcc_status(session_id)- Check status without blocking - Wait:
rpcc_wait(session_id)- Block until subagent completes and get results
Monitor and interact with running subagents using the TUI:
rpcc topKeyboard Controls:
↑/↓orj/k- Navigate between sessionsEnter- Attach to selected session's tmux session (full interactive control)k- Kill selected sessionc- Clean up completed/failed sessionsq- Quit
# Clean up completed/failed sessions
rpcc cleanSession data is stored in /tmp/rpcc/sessions/<session-id>/ with:
metadata.json- Agent type, prompt, timestampsstatus.json- Current status and progressconversation.jsonl- Full message historyresult.json- Final output (written on completion)socket- Unix domain socket for real-time attachment
- MCP Server (
rpcc-mcp-server) - Provides tools that Claude Code can call - Subagent Spawner - Creates session directories and manages subagent lifecycle
- Subagent Server - Spawns Claude CLI in tmux, monitors output, handles completion
- CLI Tool (
rpcc) - Interactive TUI for viewing and managing sessions
Main Agent (Claude Code)
↓ calls mcp__rpcc__rpcc_task
Spawner creates session directory
↓ starts SubagentServer
Claude CLI spawned in tmux session
↓ monitoring loop every 1s
Parses tmux output for responses
← Human attaches via 'rpcc top' → Enter
→ Full tmux interaction
← Human detaches (Ctrl-B, D)
Subagent completes task
↓ writes result.json
Main Agent receives result
Subagents are configured with system prompts from the agents/ directory:
general-purpose- Default subagent for background tasksstatusline-setup- Specialized for Claude Code statusline configurationoutput-style-setup- Specialized for output style configuration
Adding custom agents:
- Create
agents/<type>.txtwith your system prompt - Add type to
AgentTypeinsrc/types.ts - Update MCP tool enum in
src/mcp-server.ts
Main Agent (Terminal 1)
↓ launch
Subagent Process (background)
← socket connection
Human (Terminal 2: rpcc top)
→ send messages
← receive updates
→ detach
Subagent Process (continues)
↓ completion
Main Agent (receives result)
- Runtime: Bun (fast TypeScript runtime with Node.js compatibility)
- IPC: Unix domain sockets (
netmodule) - Session Storage: JSON files + JSONL append-only logs
- Process Management: Child process spawning (
child_processmodule) - Claude Integration: Spawn
claudeCLI as subprocess (supports Pro plan auth, not API-only) - Main Agent Integration: MCP (Model Context Protocol) server providing task spawning tools
Main Agent ↔ Subagent
- Poll-based: Main agent reads
status.jsonperiodically - No direct communication channel needed
- Main agent blocks on file watch or polling interval
Human ↔ Subagent
- Socket-based: Real-time bidirectional communication
- Human attachment is transparent to main agent
- Multiple humans can attach (socket supports multiple connections)
Subagent Lifecycle
- Spawned by main agent via Task tool
- Runs autonomously, updating status.json
- Human may attach/detach any number of times
- Completes and writes result.json
- Main agent reads result.json
- Session directory can be archived or cleaned up
- Breakpoints: Subagent pauses at specific points for human approval
- Distributed: Run subagents on remote machines
- Custom Subagents: Setup subagents with custom system prompts and context generation prompts (eg. reviewer, designer)
