Skip to content

Latest commit

Β 

History

History
876 lines (751 loc) Β· 30.1 KB

File metadata and controls

876 lines (751 loc) Β· 30.1 KB

Hive Manager - Product Requirements Document

Overview

Product Name: Hive Manager Version: 1.0.0 Platform: Windows (primary), macOS/Linux (future) Tech Stack: Tauri v2 + Rust backend + Svelte frontend

Vision

A native desktop application for orchestrating and monitoring Claude Code multi-agent workflows (Hives, Swarms, and Fusions). Replaces Windows Terminal tab sprawl with a unified interface featuring embedded terminals, real-time hierarchy visualization, and cross-agent coordination.

Problem Statement

Currently, multi-agent workflows spawn 10-20+ Windows Terminal tabs:

  • Queen, Planners (A-D), Workers (1a-4a, 1b-4b...), Reviewers, Testers, Integration Team
  • No unified view of session hierarchy or state
  • Easy to miss agent prompts buried in background tabs
  • Manual tracking of which agent owns which domain/files
  • Coordination logs scattered across files
  • Different CLIs (claude, agent, gemini, opencode, codex) with different behaviors

Solution

A single-window application that:

  • Embeds all agent terminals in a managed grid/tree layout
  • Visualizes the Queen β†’ Planner β†’ Worker hierarchy in real-time
  • Alerts when any agent requests input (across all CLI types)
  • Parses coordination.log and displays structured state
  • Tracks file ownership matrix visually
  • Supports steering individual agents mid-task

Agent Architecture Support

Tier 1: Queen (1 per session)

Property Value
CLI claude --model opus
Role Top-level orchestrator
Spawns Planners only
Owns Branch, commits, PR, integration
Can Modify Code No

Tier 2: Planners (1-10 per session)

Property Value
CLI claude --model opus
Role Domain orchestrator
Spawns Workers, Reviewer, Tester
Owns Task files, worker coordination, review cycle
Can Modify Code No

Tier 3: Workers (2-4 per Planner)

Worker CLI Model Role
Worker 1X (Backend) agent via WSL Cursor/Opus Backend implementation
Worker 2X (Frontend) gemini Gemini 3 Pro Frontend implementation
Worker 3X (Coherence) opencode Grok Code Cross-cutting coherence
Worker 4X (Simplify) codex GPT-5.3 Simplification pass

Support Agents

Agent CLI Model Role
Reviewer opencode BigPickle Code review
Tester codex GPT-5.3 Test execution
Integration Reviewer opencode BigPickle Cross-domain review
Integration Tester codex GPT-5.3 Integration tests

CLI Reference

CLI Auto-Approve Flag Model Flag Platform
claude --dangerously-skip-permissions --model opus Windows
agent --force (global) WSL Ubuntu
gemini -y -m gemini-3-pro-preview Windows
opencode env OPENCODE_YOLO=true -m opencode/MODEL Windows
codex --dangerously-bypass-approvals-and-sandbox -m gpt-5.3-codex Windows

Session Types

Hive (B-Thread)

Queen (Opus)
β”œβ”€β”€ Worker 1 (mixed)
β”œβ”€β”€ Worker 2 (mixed)
β”œβ”€β”€ Worker 3 (mixed)
└── Worker 4 (mixed)
    └── Reviewer + Tester
  • 1 Queen + 1-4 Workers
  • Single domain focus
  • Sequential or parallel workers

Swarm (S-Thread)

Queen (Opus)
β”œβ”€β”€ Planner A (Domain A)
β”‚   β”œβ”€β”€ Worker 1a (Backend)
β”‚   β”œβ”€β”€ Worker 2a (Frontend)
β”‚   β”œβ”€β”€ Worker 3a (Coherence)
β”‚   └── Worker 4a (Simplify)
β”‚       └── Reviewer A + Tester A
β”œβ”€β”€ Planner B (Domain B)
β”‚   β”œβ”€β”€ Worker 1b...
β”‚   └── ...
└── Integration Team
    β”œβ”€β”€ Integration Reviewer
    └── Integration Tester
  • 1 Queen + 2-4 Planners + 2-4 Workers each
  • Multi-domain parallel execution
  • File ownership matrix prevents conflicts

Swarm Long-Horizon

  • Same as Swarm but Planners deployed in waves (1-2 at a time)
  • Later Planners benefit from earlier discoveries
  • Up to 10 Planners (A-J)

Fusion (F-Thread)

Judge (You)
β”œβ”€β”€ Variant A (worktree)
β”œβ”€β”€ Variant B (worktree)
└── Variant C (worktree)
  • Competing implementations in separate git worktrees
  • Human or automated judge picks winner

Functional Requirements

F1: Session Management

ID Requirement Priority
F1.1 Launch Hive session (Queen + 1-4 Workers) P0
F1.2 Launch Swarm session (Queen + 2-4 Planners) P0
F1.3 Launch Swarm Long-Horizon (sequential waves) P1
F1.4 Launch Fusion session (competing worktrees) P1
F1.5 Stop individual agent P0
F1.6 Stop entire session (cascade) P0
F1.7 View session history P1
F1.8 Resume interrupted session P2
F1.9 Clone session config for new task P2

F2: Embedded Terminals (Multi-CLI Support)

ID Requirement Priority
F2.1 Spawn and render claude CLI via PTY P0
F2.2 Spawn and render agent via WSL PTY P0
F2.3 Spawn and render gemini CLI via PTY P0
F2.4 Spawn and render opencode CLI via PTY P0
F2.5 Spawn and render codex CLI via PTY P0
F2.6 Full ANSI color/formatting support P0
F2.7 Send keyboard input to focused terminal P0
F2.8 Terminal resize (responsive panels) P0
F2.9 Search within terminal output P1
F2.10 Copy/paste support P0
F2.11 Auto-scroll with lock/unlock P0

F3: Hierarchy Visualization

ID Requirement Priority
F3.1 Display live hierarchy tree (Queen β†’ Planners β†’ Workers) P0
F3.2 Show agent status badges (starting, running, waiting, complete, error) P0
F3.3 Indicate which agent is focused P0
F3.4 Click hierarchy node to focus terminal P0
F3.5 Show Planner domain assignment P1
F3.6 Show Worker role (Backend/Frontend/Coherence/Simplify) P1
F3.7 Collapse/expand hierarchy branches P1

F4: Session State Monitoring

ID Requirement Priority
F4.1 Parse and display coordination.log messages P0
F4.2 Parse state/responsibility-matrix.md P1
F4.3 Parse state/file-ownership.md and display matrix P1
F4.4 Track task files in tasks/planner-{X}/ P1
F4.5 Show wave progress (long-horizon) P1
F4.6 Display phase progress (Planning β†’ Execution β†’ Review β†’ Integration) P1

F5: Agent Interaction

ID Requirement Priority
F5.1 Visual + audio alert when any agent requests input P0
F5.2 Auto-focus terminal requesting input P0
F5.3 Send text input to agent P0
F5.4 Quick response buttons (y/n, approve, reject) P1
F5.5 Broadcast message to all agents (via coordination.log) P2

F6: Layout Options

ID Requirement Priority
F6.1 Grid layout (2x2, 3x3, 4x4) P0
F6.2 Tree layout (hierarchy-based, indented) P1
F6.3 Tabbed layout (one terminal at a time) P0
F6.4 Focus mode (single terminal fullscreen) P0
F6.5 Custom split layouts P2
F6.6 Save/restore layout preferences P1

F7: Configuration

ID Requirement Priority
F7.1 Configure default Planner count P1
F7.2 Configure Worker models per role P1
F7.3 Configure CLI paths and flags P1
F7.4 Configure session directory paths P1
F7.5 Keyboard shortcut customization P1
F7.6 Theme selection (dark/light) P2

F8: Updates & Maintenance

ID Requirement Priority
F8.1 Check for updates on startup P0
F8.2 Show changelog before update P1
F8.3 Download in background, install on exit P1
F8.4 Manual update check via menu P0
F8.5 Rollback to previous version P2

Technical Architecture

System Diagram

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                          HIVE MANAGER                               β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚
β”‚  β”‚                      SVELTE FRONTEND                          β”‚  β”‚
β”‚  β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚  β”‚
β”‚  β”‚  β”‚ Sidebar  β”‚  β”‚   Terminal Grid    β”‚  β”‚   Status Panel   β”‚  β”‚  β”‚
β”‚  β”‚  β”‚          β”‚  β”‚   β”Œβ”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”    β”‚  β”‚                  β”‚  β”‚  β”‚
β”‚  β”‚  β”‚ Sessions β”‚  β”‚   β”‚ Q  β”‚ β”‚ Pa β”‚    β”‚  β”‚ Hierarchy Tree   β”‚  β”‚  β”‚
β”‚  β”‚  β”‚ History  β”‚  β”‚   β””β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”˜    β”‚  β”‚ β”œβ”€ Queen         β”‚  β”‚  β”‚
β”‚  β”‚  β”‚ Settings β”‚  β”‚   β”Œβ”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”    β”‚  β”‚ β”œβ”€ Planner A     β”‚  β”‚  β”‚
β”‚  β”‚  β”‚          β”‚  β”‚   β”‚W1a β”‚ β”‚W2a β”‚    β”‚  β”‚ β”‚  β”œβ”€ W1a β–ˆ      β”‚  β”‚  β”‚
β”‚  β”‚  β”‚          β”‚  β”‚   β””β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”˜    β”‚  β”‚ β”‚  └─ W2a ⏳     β”‚  β”‚  β”‚
β”‚  β”‚  β”‚ [+] New  β”‚  β”‚      (xterm.js)    β”‚  β”‚ └─ Planner B     β”‚  β”‚  β”‚
β”‚  β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚  β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚
β”‚                                β”‚                                     β”‚
β”‚                      Tauri IPC + Events                             β”‚
β”‚                                β”‚                                     β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚
β”‚  β”‚                       RUST BACKEND                            β”‚  β”‚
β”‚  β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚  β”‚
β”‚  β”‚  β”‚   PTY Manager    β”‚  β”‚ Session Manager  β”‚  β”‚ File Watch  β”‚ β”‚  β”‚
β”‚  β”‚  β”‚  - Windows PTY   β”‚  β”‚  - Hive          β”‚  β”‚  - notify   β”‚ β”‚  β”‚
β”‚  β”‚  β”‚  - WSL PTY       β”‚  β”‚  - Swarm         β”‚  β”‚  - parser   β”‚ β”‚  β”‚
β”‚  β”‚  β”‚  - Multi-CLI     β”‚  β”‚  - Fusion        β”‚  β”‚             β”‚ β”‚  β”‚
β”‚  β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚  β”‚
β”‚  β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚  β”‚
β”‚  β”‚  β”‚  Agent Registry  β”‚  β”‚  Config Store    β”‚  β”‚  Updater    β”‚ β”‚  β”‚
β”‚  β”‚  β”‚  - Hierarchy     β”‚  β”‚  - CLI paths     β”‚  β”‚  - GitHub   β”‚ β”‚  β”‚
β”‚  β”‚  β”‚  - Status        β”‚  β”‚  - Defaults      β”‚  β”‚  - Rollback β”‚ β”‚  β”‚
β”‚  β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚  β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                β”‚
        β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
        β–Ό                       β–Ό                       β–Ό
   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”            β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”            β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”
   β”‚ claude  β”‚            β”‚  agent  β”‚            β”‚ gemini  β”‚
   β”‚  (PTY)  β”‚            β”‚ (WSL)   β”‚            β”‚  (PTY)  β”‚
   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜            β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜            β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
        β–Ό                       β–Ό                       β–Ό
   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”            β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”
   β”‚opencode β”‚            β”‚  codex  β”‚
   β”‚  (PTY)  β”‚            β”‚  (PTY)  β”‚
   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜            β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Rust Backend Components

PTY Manager (src-tauri/src/pty/)

pub struct PtyManager {
    sessions: HashMap<String, PtySession>,
    wsl_available: bool,
}

pub struct PtySession {
    id: String,
    agent_type: AgentType,
    pty: Box<dyn portable_pty::MasterPty>,
    child: Box<dyn portable_pty::Child>,
    status: AgentStatus,
}

pub enum AgentType {
    Claude { model: String },           // claude --model opus
    CursorAgent,                        // WSL: agent --force
    Gemini { model: String },           // gemini -m MODEL -y
    OpenCode { model: String },         // OPENCODE_YOLO=true opencode -m MODEL
    Codex { model: String },            // codex --dangerously-bypass...
}

pub enum AgentStatus {
    Starting,
    Running,
    WaitingForInput,  // Detected via output patterns
    Completed,
    Error(String),
}

Session Manager (src-tauri/src/session/)

pub struct SessionManager {
    active_sessions: HashMap<String, Session>,
    history: Vec<SessionSummary>,
}

pub struct Session {
    id: String,
    session_type: SessionType,
    project_path: PathBuf,
    agents: AgentHierarchy,
    state: SessionState,
    created_at: DateTime<Utc>,
}

pub enum SessionType {
    Hive { worker_count: u8 },
    Swarm { planner_count: u8 },
    SwarmLongHorizon { max_planners: u8, current_wave: u8 },
    Fusion { variants: Vec<String> },
}

pub struct AgentHierarchy {
    queen: AgentNode,
    planners: Vec<PlannerNode>,
}

pub struct PlannerNode {
    agent: AgentNode,
    domain: String,
    workers: Vec<AgentNode>,
    reviewer: Option<AgentNode>,
    tester: Option<AgentNode>,
}

File Watcher (src-tauri/src/watcher/)

pub struct SessionWatcher {
    watchers: HashMap<String, RecommendedWatcher>,
}

// Watch paths:
// - .hive/sessions/{id}/coordination.log
// - .swarm/sessions/{id}/logs/*.log
// - .swarm/sessions/{id}/state/*.md
// - .swarm/sessions/{id}/tasks/**/*.md

pub enum WatchEvent {
    CoordinationMessage { from: String, message_type: String, content: String },
    AgentLogUpdate { agent_id: String, lines: Vec<String> },
    StateFileChanged { file: String, content: String },
    TaskFileCreated { planner: String, task_file: String },
}

Agent Spawner (src-tauri/src/spawner/)

pub struct AgentSpawner;

impl AgentSpawner {
    pub fn spawn_claude(
        &self,
        model: &str,
        prompt_file: &Path,
        cwd: &Path,
    ) -> Result<PtySession>;

    pub fn spawn_wsl_agent(
        &self,
        prompt_file: &Path,
        cwd: &Path,
    ) -> Result<PtySession>;

    pub fn spawn_gemini(
        &self,
        model: &str,
        prompt_file: &Path,
        cwd: &Path,
    ) -> Result<PtySession>;

    pub fn spawn_opencode(
        &self,
        model: &str,
        prompt_file: &Path,
        cwd: &Path,
    ) -> Result<PtySession>;

    pub fn spawn_codex(
        &self,
        model: &str,
        prompt_file: &Path,
        cwd: &Path,
    ) -> Result<PtySession>;
}

Frontend Components

Terminal Component (src/lib/components/Terminal.svelte)

  • Wraps xterm.js
  • Receives output events from Rust backend
  • Sends input to Rust backend
  • Displays status badge overlay

Hierarchy Tree (src/lib/components/HierarchyTree.svelte)

  • Renders Queen β†’ Planner β†’ Worker tree
  • Status indicators per node
  • Click to focus terminal
  • Expandable/collapsible

Coordination Log (src/lib/components/CoordinationLog.svelte)

  • Parses coordination.log
  • Colored by agent (Queen=purple, Planner=blue, etc.)
  • Auto-scroll with pause

File Ownership Matrix (src/lib/components/OwnershipMatrix.svelte)

  • Parses file-ownership.md
  • Visual grid of files Γ— planners
  • Highlights conflicts

Data Flow

Spawning an Agent

1. User clicks "Launch Swarm"
2. Frontend β†’ Tauri command: launch_swarm(project, planner_count)
3. Rust creates session directory structure
4. Rust copies templates, generates prompts
5. Rust spawns Queen PTY
6. Rust returns session_id to frontend
7. Frontend subscribes to session events
8. Queen output streams via Tauri events
9. xterm.js renders output

Agent Output Detection

1. PTY reader receives bytes
2. Rust buffers and scans for patterns:
   - "?" at line end β†’ WaitingForInput
   - "PLANNER_COMPLETE" β†’ status update
   - Log format "[HH:MM:SS] AGENT:" β†’ parse for coordination
3. Rust emits typed events to frontend
4. Frontend updates hierarchy status
5. If WaitingForInput β†’ trigger alert

User Input

1. User types in xterm.js
2. xterm.js onData fires
3. Frontend β†’ Tauri command: write_to_agent(agent_id, bytes)
4. Rust writes bytes to PTY stdin
5. Agent receives input

UI/UX Specifications

Main Layout

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  [≑] Hive Manager                                        [_] [β–‘] [Γ—]     β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚        β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚             β”‚
β”‚ ACTIVE β”‚  β”‚ Queen           [β–ˆ] β”‚ β”‚ Planner A       [β–ˆ] β”‚  β”‚  HIERARCHY  β”‚
β”‚        β”‚  β”‚                     β”‚ β”‚                     β”‚  β”‚             β”‚
β”‚ > Swarmβ”‚  β”‚ Phase 2: Spawning   β”‚ β”‚ Domain: Backend     β”‚  β”‚  Queen β–ˆ    β”‚
β”‚   auth β”‚  β”‚ planners...         β”‚ β”‚ Spawning Worker 1a  β”‚  β”‚  β”œβ”€ Pa β–ˆ    β”‚
β”‚        β”‚  β”‚                     β”‚ β”‚                     β”‚  β”‚  β”‚  β”œβ”€W1a ⏳│
β”‚        β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚  β”‚  β”œβ”€W2a   β”‚
β”‚ RECENT β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚  β”‚  └─W3a   β”‚
β”‚        β”‚  β”‚ Worker 1a       [⏳] β”‚ β”‚ Worker 2a       [β–‘] β”‚  β”‚  └─ Pb β–‘    β”‚
β”‚ - hive β”‚  β”‚                     β”‚ β”‚                     β”‚  β”‚             β”‚
β”‚ - swarmβ”‚  β”‚ Reading task...     β”‚ β”‚ (not started)       β”‚  β”‚ ───────────│
β”‚        β”‚  β”‚                     β”‚ β”‚                     β”‚  β”‚ COORDINATIONβ”‚
β”‚        β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚ Pa: [STATUS]β”‚
β”‚ [+] Newβ”‚                                                   β”‚ Starting w1aβ”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ Type: [Swarm β–Ό]  Planners: [2][3][4]  Project: D:/Code/myapp  [Launch]   β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Status Badges

Badge Meaning Color
β–ˆ Running Blue #7aa2f7
⏳ Waiting for input Yellow #e0af68
βœ“ Completed Green #9ece6a
βœ— Error Red #f7768e
β–‘ Not started Gray #414868
◐ Starting Cyan #7dcfff

Keyboard Shortcuts

Shortcut Action
Ctrl+1-9 Focus terminal by position
Ctrl+Q Focus Queen
Ctrl+A/B/C/D Focus Planner A/B/C/D
Ctrl+Tab Cycle terminals
Ctrl+Shift+Tab Cycle reverse
Ctrl+N New session dialog
Ctrl+W Stop focused agent
Ctrl+Shift+W Stop entire session
F11 Toggle fullscreen terminal
Ctrl+G Toggle grid/tree layout
Ctrl+L Toggle coordination log panel
Ctrl+F Search in focused terminal
Ctrl+, Settings
Escape Exit fullscreen / close dialog

Color Scheme (Tokyo Night)

Element Color
Background #1a1b26
Surface #24283b
Surface Hover #292e42
Border #414868
Text #c0caf5
Text Muted #565f89
Accent (Blue) #7aa2f7
Success (Green) #9ece6a
Warning (Yellow) #e0af68
Error (Red) #f7768e
Info (Cyan) #7dcfff
Purple #bb9af7

Agent Colors (for hierarchy/logs)

Agent Color
Queen Purple #bb9af7
Planner Blue #7aa2f7
Worker (Backend) Cyan #7dcfff
Worker (Frontend) Green #9ece6a
Worker (Coherence) Yellow #e0af68
Worker (Simplify) Orange #ff9e64
Reviewer Magenta #ff007c
Tester Teal #1abc9c

Update Strategy

Distribution

Component Location
Releases GitHub Releases (private repo)
Manifest https://github.com/{user}/hive-manager/releases/latest/download/latest.json
Installer .msi (Windows)

Tauri Updater Config

{
  "plugins": {
    "updater": {
      "active": true,
      "dialog": true,
      "endpoints": [
        "https://github.com/{user}/hive-manager/releases/latest/download/latest.json"
      ],
      "pubkey": "YOUR_PUBLIC_KEY"
    }
  }
}

Update Flow

App Start β†’ Check Updates β†’ Available?
                              β”‚
              β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
              β”‚ Yes                           β”‚ No
              β–Ό                               β–Ό
    Show Changelog Dialog              Continue Normal
              β”‚
    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
    β”‚ Now         Later β”‚
    β–Ό                   β–Ό
Download in BG    Remind Next Launch
Install on Exit

Rollback

  1. Previous installer saved to %APPDATA%/hive-manager/backups/
  2. Settings stored separately (never overwritten)
  3. "Rollback" in Settings β†’ restores previous version

Project Structure

D:/Code Projects/hive-manager/
β”œβ”€β”€ src/                              # Svelte frontend
β”‚   β”œβ”€β”€ lib/
β”‚   β”‚   β”œβ”€β”€ components/
β”‚   β”‚   β”‚   β”œβ”€β”€ Terminal.svelte       # xterm.js wrapper
β”‚   β”‚   β”‚   β”œβ”€β”€ TerminalGrid.svelte   # Grid layout manager
β”‚   β”‚   β”‚   β”œβ”€β”€ HierarchyTree.svelte  # Agent hierarchy view
β”‚   β”‚   β”‚   β”œβ”€β”€ CoordinationLog.svelte
β”‚   β”‚   β”‚   β”œβ”€β”€ OwnershipMatrix.svelte
β”‚   β”‚   β”‚   β”œβ”€β”€ SessionSidebar.svelte
β”‚   β”‚   β”‚   β”œβ”€β”€ LaunchDialog.svelte
β”‚   β”‚   β”‚   β”œβ”€β”€ SettingsDialog.svelte
β”‚   β”‚   β”‚   └── StatusBadge.svelte
β”‚   β”‚   β”œβ”€β”€ stores/
β”‚   β”‚   β”‚   β”œβ”€β”€ sessions.ts           # Session state
β”‚   β”‚   β”‚   β”œβ”€β”€ agents.ts             # Agent hierarchy state
β”‚   β”‚   β”‚   β”œβ”€β”€ terminals.ts          # Terminal instances
β”‚   β”‚   β”‚   └── settings.ts           # User preferences
β”‚   β”‚   └── utils/
β”‚   β”‚       β”œβ”€β”€ tauri.ts              # Tauri IPC wrappers
β”‚   β”‚       └── terminal.ts           # xterm.js helpers
β”‚   β”œβ”€β”€ routes/
β”‚   β”‚   └── +page.svelte
β”‚   β”œβ”€β”€ app.html
β”‚   └── app.css
β”œβ”€β”€ src-tauri/                        # Rust backend
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ main.rs
β”‚   β”‚   β”œβ”€β”€ lib.rs
β”‚   β”‚   β”œβ”€β”€ pty/
β”‚   β”‚   β”‚   β”œβ”€β”€ mod.rs
β”‚   β”‚   β”‚   β”œβ”€β”€ manager.rs
β”‚   β”‚   β”‚   └── session.rs
β”‚   β”‚   β”œβ”€β”€ session/
β”‚   β”‚   β”‚   β”œβ”€β”€ mod.rs
β”‚   β”‚   β”‚   β”œβ”€β”€ manager.rs
β”‚   β”‚   β”‚   β”œβ”€β”€ hive.rs
β”‚   β”‚   β”‚   β”œβ”€β”€ swarm.rs
β”‚   β”‚   β”‚   └── fusion.rs
β”‚   β”‚   β”œβ”€β”€ spawner/
β”‚   β”‚   β”‚   β”œβ”€β”€ mod.rs
β”‚   β”‚   β”‚   β”œβ”€β”€ claude.rs
β”‚   β”‚   β”‚   β”œβ”€β”€ cursor.rs
β”‚   β”‚   β”‚   β”œβ”€β”€ gemini.rs
β”‚   β”‚   β”‚   β”œβ”€β”€ opencode.rs
β”‚   β”‚   β”‚   └── codex.rs
β”‚   β”‚   β”œβ”€β”€ watcher/
β”‚   β”‚   β”‚   β”œβ”€β”€ mod.rs
β”‚   β”‚   β”‚   └── parser.rs
β”‚   β”‚   β”œβ”€β”€ updater/
β”‚   β”‚   β”‚   └── mod.rs
β”‚   β”‚   β”œβ”€β”€ commands/
β”‚   β”‚   β”‚   β”œβ”€β”€ mod.rs
β”‚   β”‚   β”‚   β”œβ”€β”€ session.rs
β”‚   β”‚   β”‚   β”œβ”€β”€ agent.rs
β”‚   β”‚   β”‚   └── settings.rs
β”‚   β”‚   └── config/
β”‚   β”‚       └── mod.rs
β”‚   β”œβ”€β”€ Cargo.toml
β”‚   β”œβ”€β”€ tauri.conf.json
β”‚   └── icons/
β”œβ”€β”€ static/
β”œβ”€β”€ package.json
β”œβ”€β”€ svelte.config.js
β”œβ”€β”€ vite.config.ts
β”œβ”€β”€ tsconfig.json
β”œβ”€β”€ PRD.md
└── CLAUDE.md

Dependencies

Rust (Cargo.toml)

[dependencies]
tauri = { version = "2", features = ["shell-open"] }
tauri-plugin-updater = "2"
tauri-plugin-dialog = "2"
tauri-plugin-fs = "2"
tauri-plugin-shell = "2"
serde = { version = "1", features = ["derive"] }
serde_json = "1"
tokio = { version = "1", features = ["full"] }
portable-pty = "0.8"
notify = "6"
notify-debouncer-mini = "0.4"
chrono = { version = "0.4", features = ["serde"] }
uuid = { version = "1", features = ["v4"] }
thiserror = "1"
tracing = "0.1"
tracing-subscriber = "0.3"
directories = "5"
regex = "1"

Node (package.json)

{
  "devDependencies": {
    "@sveltejs/adapter-static": "^3",
    "@sveltejs/kit": "^2",
    "@sveltejs/vite-plugin-svelte": "^4",
    "@tauri-apps/cli": "^2",
    "svelte": "^5",
    "typescript": "^5",
    "vite": "^6"
  },
  "dependencies": {
    "@tauri-apps/api": "^2",
    "@tauri-apps/plugin-updater": "^2",
    "@tauri-apps/plugin-dialog": "^2",
    "@xterm/xterm": "^5",
    "@xterm/addon-fit": "^0.10",
    "@xterm/addon-webgl": "^0.18",
    "@xterm/addon-search": "^0.15"
  }
}

Milestones

M1: Foundation

  • Tauri + Svelte project scaffold
  • Single PTY terminal (claude CLI)
  • Basic terminal input/output
  • Minimal UI shell

M2: Multi-CLI Support

  • WSL PTY for agent CLI
  • gemini CLI spawning
  • opencode CLI spawning
  • codex CLI spawning
  • Agent type detection

M3: Hive Sessions

  • Hive session launch
  • Queen + Workers hierarchy
  • Basic hierarchy tree view
  • Session sidebar

M4: Swarm Sessions

  • Swarm session launch
  • Planner prompt generation
  • File ownership parsing
  • Coordination log viewer

M5: Polish

  • Input detection + alerts
  • Keyboard shortcuts
  • Layout options (grid/tree/tabs)
  • Settings persistence
  • Theme support

M6: Distribution

  • GitHub releases setup
  • Tauri updater integration
  • Auto-update flow
  • MSI installer generation

Future Considerations (v2+)

A2A Protocol

  • Replace file-based coordination with real-time messaging
  • MCP server embedded in app
  • Structured agent communication

Analytics

  • Token usage per agent
  • Session duration metrics
  • Success/failure tracking
  • Cost estimation

Remote Agents

  • SSH tunnel for remote PTY
  • Multi-machine coordination

Appendix: Session Directory Structures

Hive

.hive/sessions/{SESSION_ID}/
β”œβ”€β”€ session.json
β”œβ”€β”€ coordination.log
β”œβ”€β”€ queen-prompt.md
β”œβ”€β”€ tasks/
β”‚   β”œβ”€β”€ worker-1-task.md
β”‚   └── worker-2-task.md
β”œβ”€β”€ state/
β”‚   └── current.json
└── spawn/
    β”œβ”€β”€ queen.bat
    └── worker-*.bat

Swarm

.swarm/sessions/{SESSION_ID}/
β”œβ”€β”€ docs/
β”‚   β”œβ”€β”€ model-selection.md
β”‚   β”œβ”€β”€ spawn-templates.md
β”‚   └── log-protocol.md
β”œβ”€β”€ phases/
β”‚   β”œβ”€β”€ phase-1-planning.md
β”‚   β”œβ”€β”€ phase-2-execution.md
β”‚   β”œβ”€β”€ phase-3-review.md
β”‚   β”œβ”€β”€ phase-4-integration.md
β”‚   └── phase-5-commit.md
β”œβ”€β”€ state/
β”‚   β”œβ”€β”€ context.md
β”‚   β”œβ”€β”€ responsibility-matrix.md
β”‚   β”œβ”€β”€ file-ownership.md
β”‚   β”œβ”€β”€ session-guidelines.md
β”‚   └── tasks.json
β”œβ”€β”€ tasks/
β”‚   β”œβ”€β”€ planner-a/
β”‚   β”‚   β”œβ”€β”€ worker-1a-task.md
β”‚   β”‚   └── worker-2a-task.md
β”‚   └── planner-b/
β”‚       └── ...
β”œβ”€β”€ logs/
β”‚   β”œβ”€β”€ queen.log
β”‚   β”œβ”€β”€ coordination.log
β”‚   β”œβ”€β”€ planner-a.log
β”‚   └── planner-b.log
β”œβ”€β”€ spawn/
β”‚   β”œβ”€β”€ queen.bat
β”‚   β”œβ”€β”€ planner-a.bat
β”‚   β”œβ”€β”€ worker-1a.bat
β”‚   └── ...
β”œβ”€β”€ queen-prompt.md
β”œβ”€β”€ planner-a-prompt.md
β”œβ”€β”€ planner-b-prompt.md
└── launch.ps1

Last updated: 2026-02-03