Overview
Fork an agent by cloning its session history into a new independent agent. Works with both active and stopped instances. Alias forhcom fork.
Syntax
Name of instance to fork (active or stopped)The source agent continues running (if active)
Tool-specific arguments to override or merge with original launch args
Flags
Tag for forked agent
Terminal preset for forked agent
Skip confirmation (when applicable)
Launcher identity (who initiated fork)
What Gets Cloned
From Source Agent
- Session History - Full conversation up to fork point
- Tool - Same tool (claude/gemini/codex/opencode)
- Launch Args - Original arguments (merged with new args)
- Tag - Original tag (unless overridden)
- Background Mode - Headless vs interactive setting
What’s New
- Instance Name - Fresh unique name (e.g.,
novaif source wasluna) - Process ID - Independent OS process
- Terminal Window - New pane/tab/window
- Event Cursor - Starts from current max (no pending messages)
- Bootstrap - Includes “YOU ARE A FORK” message
Tool-Specific Behavior
Claude
Uses--resume <session-id> --fork-session:
Gemini
Uses--resume <session-id>:
Codex
Usesfork subcommand:
OpenCode
Uses--session <session-id> --fork:
Fork vs Resume
| Feature | Resume (hcom r) | Fork (hcom f) |
|---|---|---|
| Source | Stopped only | Active or stopped |
| Identity | Same name | New name |
| Cursor | Restored (pending msgs) | Fresh (no pending) |
| Original | Replaced | Continues |
| Bootstrap | ”RESUMED" | "YOU ARE A FORK” |
Examples
Basic Fork
Fork with Model Override
Fork with Tag
Fork Stopped Agent
Fork Headless
Self-Fork Pattern
Multi-Fork Workflow
Error Cases
No Session ID
Gemini Limitation
Not Found
Exit Codes
Fork launched successfully
- No session ID found
- Tool doesn’t support forking (Gemini)
- Instance not found
- Launch failed
Notes
Source Unaffected: Forking does NOT stop or modify the source agent. Both run independently after fork.
Fresh Cursor: Unlike resume, fork starts with a fresh event cursor. No pending messages are delivered to the fork.
Bootstrap Message: Fork sees “YOU ARE A FORK of agent ‘X’” in system prompt, making the relationship clear.
Gemini Limitation: Gemini CLI does not support
--fork or equivalent. Fork fails for Gemini agents.Name Generation: Fork gets a unique name from the pool (luna → nova, kira, etc.). Cannot specify custom name.
Argument Merging: Original launch args merge with fork args. New args override conflicting flags.
Tag Override:
--tag creates a tagged fork. Without --tag, fork inherits source’s tag (if any).Use Cases
Parallel Investigation
Fork an agent to explore different hypotheses simultaneously:Code Review Split
Fork reviewer for parallel file reviews:Safe Experimentation
Fork before risky operations:Workflow Handoff
Fork to hand off context:Related Commands
hcom r- Resume stopped agents (same identity)hcom list- View active agentshcom list --stopped- View stopped instanceshcom send- Message forked agents