Complete reference for every hive command, its flags, arguments, and behavior.
| Flag | Type | Default | Description |
|---|---|---|---|
--config |
string | ~/.config/hive/config.toml |
Config file path |
--verbose |
bool | false |
Enable debug logging (sets log level to DEBUG) |
Query the source for ready work items, claim them locally, and dispatch systemd units.
hive poll [flags]
Polls a configured source (GitHub Projects board) for items in the Ready column. For each ready item, poll:
- Checks the
poll.max-concurrentlimit against activehive-run@*units - Creates a local claim file to prevent duplicate dispatch
- Writes a session JSON file with status
dispatching - Starts a
hive-run@{uuid}.servicesystemd user unit - Marks the item as taken on the source (moves to In Progress)
With --interval, runs as a long-lived daemon. Without it, runs once and exits.
| Flag | Type | Default | Config key | Description |
|---|---|---|---|---|
--interval |
duration | 0 (single-shot) |
poll.interval |
Poll interval (e.g. 5m); if unset, run once and exit |
poll.interval— poll frequencypoll.max-concurrent— maximum activehive-run@*units (0 = unlimited)poll.instance— instance name for session tracking (default:"default")github.project-id— GitHub Projects board number (required)github.project-node-id— GitHub Projects GraphQL node ID (required)github.ready-status— exact status name to filter (e.g."Ready 🤖")github.status-field-id— project status field IDgithub.in-progress-option-id— option ID for In Progress columngithub.in-review-option-id— option ID for In Review columngithub.ready-option-id— option ID for Ready columnsecurity.allowed-users— authorized issue authors (required, fail-closed)
- GitHub token (via
ghCLI authentication) — read board, fetch issues, update status
| Code | Meaning |
|---|---|
| 0 | Success (single-shot) or clean shutdown (daemon) |
| 1 | Configuration error or source build failure |
# Single-shot: poll once and exit
hive poll
# Daemon mode: poll every 5 minutes
hive poll --interval 5m
# With explicit config
hive poll --config ~/.config/hive/production.tomlOrchestrate the full pipeline: prepare → exec → publish.
hive run <uuid | owner/repo#issue> [flags]
Runs the complete agent pipeline. Accepts either:
- UUID — systemd dispatch path. Loads an existing session JSON, creates workspace from session data (prompt and title already fetched by poll).
- Issue reference (
owner/repo#123) — manual workflow. Creates a new session, fetches issue from GitHub, validates author againstsecurity.allowed-users, then proceeds.
Both paths produce identical workspace layouts. The pipeline stages are:
- Prepare — create git worktree, write
.hive/metadata and prompt - Exec — launch Claude Code agent inside jail
- Publish — push branch, draft PR, open PR, update board
Session status transitions: dispatching → prepared → running → stopped → published (or failed on error).
| Argument | Required | Description |
|---|---|---|
<uuid | owner/repo#issue> |
Yes | Session UUID or issue reference |
| Flag | Type | Default | Description |
|---|---|---|---|
--no-publish |
bool | false |
Skip the publish step |
--model |
string | "sonnet" |
Claude model to use |
--board-item-id |
string | "" |
GitHub Projects board item ID (manual workflow) |
- GitHub token (via
ghCLI) — fetch issues, push branches, create PRs, update board ANTHROPIC_API_KEY(optional) — passed to agent; if empty, subscription auth via~/.claude/
| Code | Meaning |
|---|---|
| 0 | Pipeline completed successfully |
| 1 | Any stage failed (session marked as failed) |
# Systemd dispatch (called by hive-run@{uuid}.service)
hive run a1b2c3d4-e5f6-7890-abcd-ef1234567890
# Manual run from issue reference
hive run ivy/hive#42
# Manual run, skip publish for local review
hive run ivy/hive#42 --no-publish
# Use a specific model
hive run ivy/hive#42 --model opusCreate a workspace from a GitHub issue.
hive prepare <owner/repo#issue>
Fetches issue data from GitHub, validates the issue author against security.allowed-users, then creates a git worktree with .hive/ metadata. Writes:
.hive/repo— repository identifier.hive/issue-number— issue number.hive/session-id— UUID.hive/status— set toprepared.hive/issue.json— full issue JSON payload.hive/prompt.md— issue body as agent prompt
The workspace is created at {dataDir}/workspaces/{uuid} as a git worktree branching from main with branch name hive/{uuid}.
The local repo is resolved by convention: ~/src/github.com/{owner}/{repo}/.
| Argument | Required | Description |
|---|---|---|
<owner/repo#issue> |
Yes | Issue reference (e.g. ivy/hive#42) |
- GitHub token (via
ghCLI) — fetch issue data
| Code | Meaning |
|---|---|
| 0 | Workspace created successfully |
| 1 | Issue fetch failed, author not allowed, or repo not found on disk |
hive prepare ivy/hive#42
# Output:
# Workspace ready: /home/user/.local/share/hive/workspaces/abc123...
# Branch: hive/abc123...
# Issue: Add dark mode supportLaunch an agent in a sandboxed workspace.
hive exec <workspace-path> [flags]
Loads a prepared workspace, sets status to running, and launches Claude Code inside the configured jail backend. The agent runs with:
--dangerously-skip-permissions— headless mode--append-system-prompt— instructs agent to commit work before finishing--output-format json— structured output--session-id— workspace session UUID (for resume support)
After the agent exits, if uncommitted changes remain, exec retries up to 3 times by resuming the Claude session with a commit nudge message. Finally sets status to stopped.
| Argument | Required | Description |
|---|---|---|
<workspace-path> |
Yes | Absolute path to workspace directory |
| Flag | Type | Default | Description |
|---|---|---|---|
--resume |
string | "" |
Resume session with a feedback message |
--model |
string | "sonnet" |
Claude model to use |
jail.backend— sandbox backend (default:"systemd-run")
ANTHROPIC_API_KEY(optional) — passed to agent inside jail
| Code | Meaning |
|---|---|
| 0 | Agent finished successfully |
| 1 | Workspace load failed or agent execution failed |
# Run agent in a prepared workspace
hive exec /home/user/.local/share/hive/workspaces/abc123
# Resume with feedback
hive exec /home/user/.local/share/hive/workspaces/abc123 --resume "Fix the failing test"Push branch, open PR, and update the project board.
hive publish <workspace-path>
Loads a workspace and performs the publish pipeline:
- Auto-commit — if uncommitted changes remain after exec retries, stages all non-
.hive/files and commits with a generic message - Push branch — pushes the worktree branch to origin
- Draft PR — uses Claude Code (via jail, model
sonnet) to generate a PR title and body from the branch diff. Falls back to a mechanical title/body if drafting fails - Create PR — opens a pull request via
gh pr create - Update board — moves the board item to In Review (requires
board-item-idfrom session metadata or.hive/board-item-idfile) - Set status — marks workspace as
published
| Argument | Required | Description |
|---|---|---|
<workspace-path> |
Yes | Absolute path to workspace directory |
jail.backend— sandbox backend for PR drafting (default:"systemd-run")github.project-node-id— for board item updategithub.status-field-id— project status field IDgithub.in-progress-option-id— In Progress option IDgithub.in-review-option-id— In Review option ID
- GitHub token (via
ghCLI) — push branch, create PR, update board ANTHROPIC_API_KEY(optional) — for PR drafting
| Code | Meaning |
|---|---|
| 0 | PR created and board updated |
| 1 | Push, PR creation, or workspace load failed |
hive publish /home/user/.local/share/hive/workspaces/abc123
# Output:
# Published: https://github.com/ivy/hive/pull/99Clean up finished sessions and recover stuck items.
hive reap [flags]
Scans all sessions and performs two kinds of cleanup:
Expired terminal sessions — published or failed sessions past their retention period:
- Removes the git worktree and workspace directory
- Deletes the session JSON file
- Releases the claim file
Stale non-terminal sessions — sessions whose hive-run@{uuid}.service unit is no longer active:
- Marks the session as
failed - Releases the item on the source board (moves back to Ready)
- Releases the claim file
| Flag | Type | Default | Config key | Description |
|---|---|---|---|---|
--published-retention |
duration | 24h |
reap.published-retention |
Retention for published sessions |
--failed-retention |
duration | 72h |
reap.failed-retention |
Retention for failed sessions |
reap.published-retention— how long to keep published sessionsreap.failed-retention— how long to keep failed sessions- All
github.*andsecurity.*keys (for building source to release items)
- GitHub token (via
ghCLI) — release items back to Ready on the board
| Code | Meaning |
|---|---|
| 0 | Reap completed (errors on individual sessions are logged, not fatal) |
| 1 | Failed to list sessions |
# Default retention periods
hive reap
# Custom retention
hive reap --published-retention 48h --failed-retention 168h
# With config file
hive reap --config ~/.config/hive/production.tomlList all sessions.
hive ls
Lists all sessions from {dataDir}/sessions/ in a table sorted by creation time (most recent first). Columns:
| Column | Description |
|---|---|
| UUID | Session identifier |
| REF | Source reference (e.g. github:ivy/hive#42) |
| STATUS | Lifecycle status |
| CREATED | Relative time (e.g. 5m ago, 2h ago, 3d ago) |
None.
None.
| Code | Meaning |
|---|---|
| 0 | Sessions listed (or "No sessions found.") |
| 1 | Failed to read sessions directory |
hive ls
# UUID REF STATUS CREATED
# a1b2c3d4-e5f6-7890-abcd-ef1234567890 github:ivy/hive#42 published 2h ago
# f0e1d2c3-b4a5-6789-0123-456789abcdef github:ivy/hive#43 running 5m agoOpen a shell in a session's workspace.
hive cd <ref|uuid>
Resolves the session by ref or UUID and spawns $SHELL (falling back to /bin/sh) in the workspace directory. Useful for inspecting agent work in progress.
Session resolution order:
- If the argument is a UUID, loads
sessions/{uuid}.jsondirectly - Otherwise, normalizes as
github:{ref}and checks claims for an active session - Falls back to scanning all sessions for matching ref (most recent wins)
| Argument | Required | Description |
|---|---|---|
<ref|uuid> |
Yes | Session UUID or issue ref (e.g. ivy/hive#42) |
None.
| Code | Meaning |
|---|---|
| 0 | Shell exited normally |
| 1 | Session not found or workspace missing |
# By UUID
hive cd a1b2c3d4-e5f6-7890-abcd-ef1234567890
# By issue ref
hive cd ivy/hive#42Attach to a running agent's tmux session.
hive attach <ref|uuid>
Resolves the session, reads the tmux session name from .hive/tmux-session, and runs tmux attach-session -t {name}. Use this to observe a running agent in real time.
| Argument | Required | Description |
|---|---|---|
<ref|uuid> |
Yes | Session UUID or issue ref |
None.
| Code | Meaning |
|---|---|
| 0 | Detached from tmux normally |
| 1 | Session not found, workspace missing, or no tmux session file (agent may not be running) |
hive attach ivy/hive#42Deprecated: use
hive reapinstead.
Remove workspace(s) by ID or all at once.
hive cleanup [workspace-id] [flags]
Removes a workspace by ID (matches partial UUID against workspace directory names), or all workspaces with --all. Each removal tears down the git worktree, deletes the branch, and prunes worktree metadata.
| Argument | Required | Description |
|---|---|---|
[workspace-id] |
No (if --all) |
Full or partial workspace ID |
| Flag | Type | Default | Description |
|---|---|---|---|
--all |
bool | false |
Remove all workspaces |
None.
| Code | Meaning |
|---|---|
| 0 | Workspace(s) removed |
| 1 | Workspace not found or removal failed |
Deprecated: use
hive lsinstead.
Alias for hive ls. Same behavior and output.