Sessions
A hive session is an isolated git clone paired with a terminal environment for running AI agents. Instead of working directly in your main repository — where multiple agents would step on each other's changes — hive creates separate clones so each agent gets its own workspace. When you create a session, hive clones the repository (or reuses a recycled clone), then spawns a tmux session with windows for your AI tools.
Each project (git remote) can have multiple sessions running in parallel, each working on a different task. Sessions can run multiple agents in separate tmux windows — for example, a primary Claude agent alongside a test runner.
colonyops/hive <-- project (git remote)
├── fix-auth (26kj0c) <-- hive session (isolated clone)
│ └── tmux: fix-auth <-- tmux session (spawned by hive)
│ ├── window: claude <-- primary AI agent
│ ├── window: aider <-- secondary agent (optional)
│ └── window: shell <-- regular terminal
├── add-tests (x9m2p)
│ └── tmux: add-tests
│ ├── window: claude
│ └── window: shell
└── refactor-config (m4k8w)
└── tmux: refactor-config
├── window: aider <-- any AI tool works
└── window: shell
acme-corp/backend <-- another project
├── api-migration (p7n3q)
│ └── tmux: api-migration
│ ├── window: claude
│ └── window: shell
└── fix-ci (r2d5t)
└── tmux: fix-ci
├── window: claude
└── window: shell
Hive Session
An isolated git clone in a dedicated directory with its own terminal environment. Each session is a self-contained workspace for one or more AI agents working on a specific task or feature.
Key characteristics:
- Unique 6-character ID (e.g.,
26kj0c) - Display name (e.g.,
fix-auth-bug) - Isolated git clone at a specific path
- One or more agent windows (configured via agent profiles)
- Lifecycle:
active→recycled→deleted
Not to be confused with: Tmux session (see relationship below)
Session names
A session has a display name and a slug. You type the name; hive derives the slug from it by lowercasing it, folding accented letters (é to e), and joining the letters and digits with single hyphens. Fix Auth Bug becomes fix-auth-bug. The slug names the tmux session and the clone directory.
- A name is 1 to 60 characters of letters, digits, spaces, and
_ . : / -, and starts with a letter or a digit. - Two active sessions cannot share a slug, so
Fix Bugandfix-bugcount as the same name.hive new,hive batch, the TUI, and a rename all reject a duplicate. - A name that hive generates, from a source template or a Hive Desktop launch node, is turned into a slug and cut to 60 characters at a word boundary. When its slug is already taken, hive adds an id from where the name came from (the item id for a source, the command id for a launch node) instead of failing.
Tags
Tags are short words you attach to a session, such as auto or backend. Scripts and agents can use them to find the sessions they should act on.
- A tag is 1 to 40 characters and cannot contain a comma. Tags compare without case, so
Autoandautoare the same tag, and the first spelling is kept. - Add tags when you create a session with
hive new --tags auto --tags backend, or from a source withtemplates.tags. - Change them later with
hive session update <id> --add-tag <tag>,--remove-tag <tag>, or--clear-tags. The flags repeat.--clear-tagsapplies first, then the additions, then the removals. - List the sessions that carry every given tag with
hive ls --tags auto.--jsonoutput includes atagsarray. - In the TUI, press ctrl+t or R to open Edit Session, which edits the name and the tags (comma separated) together. Tab moves between the fields and Enter saves. The tree shows tags at the end of each row and in the preview header, and / matches them.
Hive Desktop shows the same sessions in its Code area when both use the same Hive data root, which is the default.
Agent
An AI tool instance (Claude, Aider, Codex) running within a session. Each agent runs in its own tmux window and is independently monitored by the TUI.
Sessions support multiple agents — for example, a primary Claude agent alongside a test runner or code reviewer. Configure agent profiles in your config to define which tools are available. See agent profiles for setup.
Tmux Session
A terminal multiplexer session that hosts a hive session. When you create a hive session, hive spawns a tmux session with the same name as the session slug.
Relationship: Each hive session spawns a tmux session with the same name. The tmux session contains agent windows (matched by tmux.preview_window_matcher patterns) and a shell window. See the architecture diagram above.
To open a session in Hive Desktop, run hive desktop open hive://code/<slug>. See Links for the link formats.
Repository
A git remote URL (e.g., github.com/colonyops/hive). Multiple sessions can be created from the same repository.
Clone Strategies
Hive supports two strategies for isolating session workspaces:
Full clone (default)
Each session gets its own independent git clone. This is the simplest and most compatible option — sessions are entirely self-contained and can be on different branches.
rules:
- pattern: "" # matches all repos; omitting clone_strategy also defaults to full
Worktree
Sessions share a single bare clone of the repository. Each session is a git worktree pointing into the shared bare clone. This avoids re-downloading the full history for every session and reduces disk usage on large repositories.
Set clone_strategy: worktree on a rule. Use a catch-all rule (pattern: "") to apply it globally, or a specific pattern to apply it to matching repos only:
rules:
# worktree for all repos
- pattern: ""
clone_strategy: worktree
# override back to full for a specific repo
- pattern: ".*/legacy/.*"
clone_strategy: full
Note
Recycling a worktree session removes its checkout and session record, just like deleting it. The next session gets a fresh path and branch while continuing to reuse the shared bare clone. This keeps the usual recycle workflow without retaining stale worktree state.
Remote spellings and hosts
Hive treats the SSH and HTTPS URLs of one repository as the same repository. [email protected]:acme/site.git and https://github.com/acme/site share recycled clones, the max_recycled pool, and the worktree bare clone.
When a recycled clone is reused for a different spelling, hive points its origin at the URL you asked for and pulls. If that fails, hive restores the old origin, keeps the clone recycled, and creates a fresh clone instead.
Bare clones are stored per host and path, in .bare/<host>/<path> under the repos directory. Repositories with the same owner/repo on different hosts get separate bare clones. A bare clone created by an older version at .bare/<owner>/<repo> is still used while its origin is the same repository. Its origin follows the URL of the latest request.
Note
A host with a non-default web port, such as https://git.example.com:8443/acme/site, is not matched with its SSH spelling [email protected]:acme/site. Hive treats them as different repositories.
Session Lifecycle
Sessions move through a managed lifecycle:
- Create — A new session starts as
active. Hive clones the repository (or reuses a recycled clone) and spawns a tmux session. - Recycle — When you're done, recycle the session instead of deleting it. Full-clone sessions are reset and retained for reuse. Worktree sessions are removed because the shared bare clone already makes the next worktree inexpensive to create.
- Delete — Permanently removes the session directory and all associated data.
- Corrupted — If hive detects an invalid state (e.g., missing directory, broken git repo), the session is marked corrupted and can only be deleted.
Prefer recycling over deleting
You can use the same recycle workflow with either clone strategy. Full-clone sessions are retained to avoid another clone; worktree sessions are deleted while their shared bare clone remains available for fast future sessions.
Status Indicators
The TUI shows real-time agent status:
| Indicator | Color | Meaning |
|---|---|---|
[●] |
Green (animated) | Agent actively working |
[!] |
Yellow | Agent needs approval/permission |
[>] |
Cyan | Agent ready for input |
[?] |
Dim | Terminal session not found |
[○] |
Gray | Session recycled |
Short flags
A short flag has the same meaning in every hive command. A flag that is not in the table has no short form, so use its long name.
| Short | Long | Used by |
|---|---|---|
-a |
--agent |
new, batch, session create |
-f |
--file |
batch, review |
-l |
--listen |
msg inbox, msg sub |
-n |
--tail |
msg inbox, msg sub |
-r |
--remote |
new, session create |
-s |
--source |
new, session create |
-t |
--topic |
msg sub |
-w |
--wait |
msg inbox, msg sub |
Commands generated from operations (hive dt, and hive hc, hive msg and hive todo other than msg sub and msg inbox) follow the same table and have no other short flags.