Overview
Thehcom hooks command manages hook installation across Claude Code, Gemini CLI, Codex, and OpenCode. Hooks enable automatic message delivery and status tracking without manual polling.
Basic Usage
Hook Status
View installation status for all tools.Add Hooks
Auto-detect Current Tool
- Claude Code (via
CLAUDE_CODE_ENTRYPOINT) - Gemini CLI (via
GEMINI_CLI_ENTRYPOINT) - Codex (via
CODEX_CLI_ENTRYPOINT) - OpenCode (via
OPENCODE=1)
Specific Tool
All Tools
Remove Hooks
All Tools (default)
Specific Tool
What Hooks Do
Claude Code
Location:~/.claude/settings.json
Hooks:
setup- Connect to hcom on launchstart- Deliver pending messages at start of turnstop- Notify idle status, wait for messagesend- Disconnect on exit
- Automatic message delivery
- Status tracking (active/listening/blocked)
- Command execution tracking
- File edit notifications
Gemini CLI
Location:~/.gemini/settings.json
Hooks:
setup- Connect to hcom on launchstart- Deliver pending messages at start of turnstop- Notify idle status, wait for messagesend- Disconnect on exit
- Message delivery
- Status tracking
- Tool use tracking
Codex
Location:~/.codex/config.toml + ~/.codex/rules/hcom.rules
Hooks:
on_start- Connect via codex-notifyon_turn_start- Deliver messageson_turn_end- Status updateson_exit- Disconnect
OpenCode
Location:~/.config/opencode/plugins/hcom.ts
Plugin hooks:
onLoad- Connect to hcombeforeTurn- Deliver messagesafterTurn- Status updatesonExit- Disconnect
- Native TypeScript integration
- Event subscriptions
- Message formatting
Hook Verification
Claude
Gemini
Codex
OpenCode
Auto-Approve Integration
Hooks respect theHCOM_AUTO_APPROVE config setting.
- send, start, list, events, listen, relay, config, transcript, archive, status, help
- reset, stop, launches
Troubleshooting
Hooks Not Working
Verify installation:Messages Not Delivered
Check hook execution:Codex ExecPolicy Errors
Verify rules file:OpenCode Plugin Not Loading
Check plugin path:Ad-hoc Mode (No Hooks)
You can use hcom without hooks in any AI tool:- No automatic message delivery
- Manual polling required
- No status tracking
- No tool use notifications
Environment Detection
Hooks auto-detect the current tool via environment variables: Claude Code:Examples
First-time Setup
Tool-specific Setup
Remove and Reinstall
Sandbox Mode
Hook Files
Global Locations (default)
- Claude:
~/.claude/settings.json - Gemini:
~/.gemini/settings.json - Codex:
~/.codex/config.toml,~/.codex/rules/hcom.rules - OpenCode:
~/.config/opencode/plugins/hcom.ts
Local Locations (HCOM_DIR set)
- Claude:
$PWD/.claude/settings.json - Gemini:
$PWD/.gemini/settings.json - Codex:
$PWD/.codex/config.toml,$PWD/.codex/rules/hcom.rules - OpenCode:
~/.config/opencode/plugins/hcom.ts(always global)
Tips
- Always restart the tool after adding/removing hooks
- Use
hcom statusto verify hook installation - Enable
auto_approvefor smoother workflow - Remove hooks cleanly with
hcom hooks remove - Use ad-hoc mode if hooks can’t be installed
- Check logs if hooks aren’t working
See Also
- hcom config - Auto-approve settings
- hcom status - Verify hook installation
- hcom start - Manual connection