beehive
CLAUDE.md63 starsChanged 8 months agoMITView on GitHub
Beehive is a Tauri v2 desktop app for orchestrating coding agents across isolated git workspaces. It lets you manage multiple repos ("hives"), create isolated workspace clones ("combs") on different branches, and run multiple terminal/agent panes side-by-side in each workspace. Hierarchy: Beehive (root dir) → Hives (repos) → Combs (workspace clones) → Terminals (agent panes) Important: Always run source "$HOME/.cargo/env" before any cargo commands to ensure the Rust toolchain is on PATH.
- Installs packages
The file
We split this CLAUDE.md into the rules it gives an agent
5 rules. About 0 are common, 2 are distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 76
Important: Always run source "$HOME/.cargo/env" before any cargo commands to ensure the Rust toolchain is on PATH.
- Distinctive: line 86
Git via std::process::Command: All git and gh operations shell out to the CLI tools directly.
- Very specific: line 88
camelCase serde: All Rust structs use #[serde(rename_all = "camelCase")] so TypeScript types must use camelCase field names (e.g., dirName, …
- Very specific: line 100
Terminal auto-close on exit: When a shell process exits (e.g., exit command, Ctrl+D), the onExit callback removes the pane from the grid …
- Distinctive: line 127
Delete confirmations use a simple two-click pattern (X → "Sure?" → delete), no countdown timers
≈ “Common” is an estimate: at least 1 in 5 of the 12,729 CLAUDE.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Beehive — AI Coding Assistant Context
What is Beehive?
Beehive is a Tauri v2 desktop app for orchestrating coding agents across isolated git workspaces. It lets you manage multiple repos ("hives"), create isolated workspace clones ("combs") on different branches, and run multiple terminal/agent panes side-by-side in each workspace.
Hierarchy: Beehive (root dir) → Hives (repos) → Combs (workspace clones) → Terminals (agent panes)
Tech Stack
- Frontend: React 19 + TypeScript 5.8, Vite 7, xterm.js 5.5 (with unicode11 + web-links addons)
- Backend: Rust (Tauri v2), portable-pty 0.9, tokio, serde, uuid
- IPC: Tauri invoke (commands) + Tauri events (PTY output streaming)
- Styling: Plain CSS with CSS custom properties (Catppuccin Mocha theme)
- Git ops:
std::process::CommandcallinggitandghCLI directly (no libgit2)
Directory Structure
beehive/
├── src/ # React frontend
│ ├── App.tsx # Screen router (loading → preflight → setup → main)
│ ├── App.css # All styles (Catppuccin Mocha theme)
│ ├── types.ts # Shared TS types (BeehiveConfig, HiveInfo, Comb, PaneConfig, AppView)
│ ├── main.tsx # React entry point (StrictMode enabled)
│ └── components/
│ ├── PreflightScreen.tsx # Checks git/gh/gh-auth availability
│ ├── SetupScreen.tsx # Directory picker with autocomplete dropdown
│ ├── HiveListScreen.tsx # Repo CRUD (add via URL, list, delete) — also serves as home/manage view
│ ├── Sidebar.tsx # Hive selector dropdown + comb list + footer nav
│ ├── MainLayout.tsx # Orchestrator: sidebar + workspace + overlays, per-hive runtime state
│ ├── WorkspaceGrid.tsx # Terminal grid for a comb — add/remove panes
│ ├── NewCombModal.tsx # Modal: comb creation form (name + branch dropdown, live validation)
│ ├── CopyCombModal.tsx # Modal: duplicate an existing comb (full cp -r)
│ ├── CustomButtonsModal.tsx # Modal: configure per-hive custom buttons (up to 2)
│ ├── SettingsScreen.tsx # Paths, dependency status, reset
│ └── TerminalPane.tsx # xterm.js wrapper with PTY IPC, visibility toggling, Unicode 11
├── src-tauri/
│ ├── src/
│ │ ├── lib.rs # Tauri app builder, registers all commands
│ │ ├── pty.rs # PTY management (create/write/resize/close), stores child handle
│ │ └── hive.rs # All hive/comb CRUD, git ops, config, preflight, pane persistence, custom buttons
│ ├── Cargo.toml # Rust dependencies
│ └── tauri.conf.json # Tauri config (window 1400x900, dev port 1420)
├── plan.md # TODO list and design notes
├── package.json # Node dependencies
└── vite.config.ts # Vite configHow to Run
# Install frontend dependencies
cd /Users/nikita/beehive && npm install
# Run in development mode (starts both Vite dev server and Tauri)
npm run tauri devCommon Commands
# Rust type-check (from src-tauri/)
source "$HOME/.cargo/env" && cargo check
# TypeScript type-check
cd /Users/nikita/beehive && npx tsc --noEmit
# Full dev build
cd /Users/nikita/beehive && npm run tauri dev
# Production build
cd /Users/nikita/beehive && npm run tauri buildImportant: Always run source "$HOME/.cargo/env" before any cargo commands to ensure the Rust toolchain is on PATH.
Key Architecture Decisions
- Own PTY management: The app spawns real PTY sessions via
portable-pty, not pseudo-terminals. Each pane gets its own PTY with a background reader thread that emits output via Tauri events (pty-output-{sessionId}). The frontend writes user input back viawrite_to_ptyinvoke. The child process handle is stored inPtySessionto prevent premature termination. - Event-based PTY output: PTY output is streamed as
Vec<u8>via Tauri's event system (not command return values) so it can push data asynchronously. The frontend listens withlisten()from@tauri-apps/api/event. - Unique PTY session IDs: Each
TerminalPanemount generates a unique session ID ({paneId}-{uuid}) for its PTY. This prevents React StrictMode's double-mount/unmount cycle from leaking exit events between PTY instances. The pane ID is stable (persisted), but the session ID is ephemeral per mount. - Git via std::process::Command: All git and gh operations shell out to the CLI tools directly. No libgit2 binding. This means git and gh must be installed on the user's system (checked at preflight).
- camelCase serde: All Rust structs use
#[serde(rename_all = "camelCase")]so TypeScript types must use camelCase field names (e.g.,dirName,repoUrl,defaultBranch). Keep this consistent when adding new types. - App config at ~/.beehive/config.json: Stores the beehive directory path. Each beehive directory has a
beehive.jsonwith version info. Each hive has.hive/state.jsonwith repo info, comb list, and pane configs. - Sidebar layout with overlays: Post-setup,
MainLayoutrenders a sidebar + workspace area. Manage Hives and Settings render asposition: fixedfullscreen overlays on top, keeping the main layout (and all terminals) mounted underneath. This prevents terminal destruction when navigating to settings/hive management. - Per-hive runtime state:
MainLayoutkeeps aMap<string, HiveRuntime>where each entry holdscombs,openedCombs,panesByComb, andactiveCombIdfor a specific hive. Switching hives changesactiveHiveDirNamewithout destroying any state. ALL opened combs from ALL hives are rendered simultaneously (hidden viadisplay: none), keeping PTYs alive across hive switches. - Manage Hives as home screen: On startup, the Manage Hives overlay is shown first. Users select a hive to enter the sidebar+workspace view. The back button on overlays tracks navigation origin (
from: "sidebar" | "manageHives") to return to the correct screen. - PtyState is Arc<Mutex
<PtyManager>>: The PTY manager is shared Tauri state, accessed viaState<'_, PtyState>in command handlers. Uses tokio::sync::Mutex for async access. - Terminal auto-close on exit: When a shell process exits (e.g.,
exitcommand, Ctrl+D), theonExitcallback removes the pane from the grid automatically. - Pane persistence: Pane layouts (count, type, position) are saved to disk via
save_comb_panes/get_comb_panescommands. Changes are debounce-saved (500ms). On app restart, pane layout is restored but PTY history is lost (expected). - Custom buttons per hive: Each hive can have up to 2 custom buttons (stored as
CustomButton { label, cmd }inHiveInfo.customButtons). These replace the old hardcoded "+ Agent" button in the workspace header. A gear icon opensCustomButtonsModalto configure buttons, with "previously used" suggestions from other hives. Thesave_custom_buttonscommand persists to state.json. Uses#[serde(default)]for backward compatibility with old state files. - Comb name validation: Both
create_combandcopy_combvalidate names viavalidate_comb_name: non-empty, max 40 chars,[a-zA-Z0-9_-]only, no./-prefix, no.hive, no duplicates. Frontend mirrors this with live inline validation inNewCombModalandCopyCombModal. - Copy comb:
copy_combcommand does a recursivecp -rof the source comb directory (including.git, uncommitted work, etc.) to a new directory, creates a freshCombentry with new UUID/timestamp/empty panes, and persists to state. Sidebar shows a copy icon on hover next to the delete button. - Live branch refresh:
list_combsreads the actual git branch (git rev-parse --abbrev-ref HEAD) from each comb's directory, updating state.json if it differs from stored value.MainLayoutpolls every 5 seconds to keep the sidebar branch labels current when users switch branches in the terminal.
State & Config Files
~/.beehive/config.json— App-level config (beehive directory path){beehiveDir}/beehive.json— Beehive directory marker with version{beehiveDir}/repo_{name}/.hive/state.json— Hive state (HiveInfo + combs list + pane configs per comb + custom buttons)- Combs are full git clones at
{beehiveDir}/repo_{name}/{combName}/
Conventions
- Rust error handling: all commands return
Result<T, String>(error strings for IPC) - Helper
run_cmd()in hive.rs wrapsCommand::new().output()with error mapping - UUID v4 for comb IDs,
crypto.randomUUID()for pane IDs - Timestamps are Unix epoch seconds as strings (no chrono crate)
- CSS uses Catppuccin Mocha color tokens via custom properties
- Font stack prioritizes Nerd Fonts for full Unicode/powerline symbol support
- Delete confirmations use a simple two-click pattern (X → "Sure?" → delete), no countdown timers
Navigation Flow
App startup → Preflight → Setup (if first run) → MainLayout
├── Manage Hives (home/overlay)
│ ├── Select hive → sidebar+workspace
│ └── Settings (overlay, back → Manage Hives)
├── Sidebar
│ ├── Hive dropdown (switch between hives)
│ ├── Comb list (click to open, copy icon to duplicate, x to delete)
│ ├── + New Comb (modal)
│ ├── Manage Hives (overlay)
│ └── Settings (overlay, back → workspace)
└── Workspace (terminal grid per comb)Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

