Skip to main content

Overview

HAPI CLI supports multiple AI coding agents, each with its own command and options. All session commands connect to the HAPI hub for remote control.

Claude Code Sessions

hapi (default command)

Start a Claude Code session with remote control capabilities.
hapi [options]
--yolo
flag
Bypass all permissions (equivalent to --dangerously-skip-permissions)
--dangerously-skip-permissions
flag
Skip all permission prompts (use with caution)
--model
string
Specify the Claude model to use
hapi --model claude-sonnet-4.5
--hapi-starting-mode
local | remote
Set initial session mode:
  • local: Controlled from terminal
  • remote: Controlled from web/mobile app
hapi --hapi-starting-mode remote
--resume
flag
Resume the most recent Claude session
hapi --resume

Pass-through to Claude

All standard Claude CLI flags are supported and passed through:
# Examples from Claude CLI
hapi --resume
hapi --dangerously-skip-permissions
hapi --model claude-sonnet-4.5

Terminal Output Example

$ hapi
 Connected to HAPI hub
 Session registered: session-abc123
 Claude Code started

🌐 Control this session:
   Web: https://your-hub.com/sessions/session-abc123
   Telegram: /session session-abc123

Claude Code is ready. How can I help you today?

Codex Sessions

hapi codex

Start an OpenAI Codex session.
hapi codex [options]
resume <sessionId>
string
Resume an existing Codex session
hapi codex resume session-xyz789
--yolo
flag
Bypass approvals and sandbox restrictions (equivalent to --dangerously-bypass-approvals-and-sandbox)
--dangerously-bypass-approvals-and-sandbox
flag
Skip all permission prompts and sandbox restrictions
--model
string
Specify the OpenAI model to use
hapi codex --model gpt-4

Examples

# Start new Codex session
hapi codex

# Resume specific session
hapi codex resume session-xyz789

# Start with bypass permissions
hapi codex --yolo

# Use specific model
hapi codex --model gpt-4-turbo

Cursor Agent Sessions

hapi cursor

Start a Cursor Agent session.
hapi cursor [options]
resume <chatId>
string
Resume an existing Cursor chat
hapi cursor resume chat-abc123
--resume [chatId]
string
Resume a Cursor chat (chatId optional if used as flag)
hapi cursor --resume chat-abc123
--continue
flag
Continue the previous conversation
--mode
plan | ask
Set the agent mode:
  • plan: Planning mode (agent creates execution plan)
  • ask: Question-answer mode
hapi cursor --mode plan
--plan
flag
Shortcut for --mode plan
--yolo
flag
Bypass permissions (equivalent to --force)
--force
flag
Force execution without prompts
--model
string
Specify the model to use
hapi cursor --model claude-opus
--hapi-starting-mode
local | remote
Set initial session mode (local or remote control)

Examples

# Start new Cursor session
hapi cursor

# Resume specific chat
hapi cursor resume chat-abc123

# Start in planning mode
hapi cursor --mode plan

# Continue previous conversation
hapi cursor --continue

# Use specific model with bypass permissions
hapi cursor --model claude-opus --yolo

Terminal Output Example

$ hapi cursor --mode plan
 Connected to HAPI hub
 Cursor Agent started in plan mode
 Session: session-cursor-456

🌐 Control remotely at: https://your-hub.com/sessions/session-cursor-456

Gemini Sessions

hapi gemini

Start a Google Gemini session via ACP (Anthropic Code Plugins).
Gemini runs in remote mode only - it waits for messages from the hub UI or Telegram.
hapi gemini [options]
--yolo
flag
Bypass permissions
--model
string
Specify the Gemini model to use
hapi gemini --model gemini-pro
--hapi-starting-mode
local | remote
Set session mode (typically remote for Gemini)

Examples

# Start Gemini session (remote mode)
hapi gemini

# Start with specific model
hapi gemini --model gemini-1.5-pro

# Bypass permissions
hapi gemini --yolo

OpenCode Sessions

hapi opencode

Start an OpenCode session via ACP and plugin hooks.
OpenCode supports both local and remote modes. Local mode streams via OpenCode plugins.
hapi opencode [options]
--resume <sessionId>
string
Resume an existing OpenCode session
hapi opencode --resume session-opencode-123
--yolo
flag
Bypass permissions
--hapi-starting-mode
local | remote
Set session mode:
  • local: Terminal streaming via OpenCode plugins
  • remote: Control from web/mobile

Examples

# Start OpenCode session
hapi opencode

# Resume existing session
hapi opencode --resume session-opencode-123

# Start in local mode
hapi opencode --hapi-starting-mode local

# Remote mode with bypass permissions
hapi opencode --hapi-starting-mode remote --yolo

Common Flags

These internal flags are used across multiple session types:
--started-by
runner | terminal
Internal flag indicating how the session was started. Set automatically by the runner.

MCP Stdio Bridge

hapi mcp

Start an MCP (Model Context Protocol) stdio bridge for external tools.
hapi mcp [arguments]
This command provides a bridge between MCP tools and HAPI sessions. Configuration can be set via the HAPI_HTTP_MCP_URL environment variable.

Example

# Start MCP bridge with default URL
hapi mcp

# With custom MCP URL (via env var)
export HAPI_HTTP_MCP_URL=http://localhost:8080
hapi mcp

Session Modes

All session types support two control modes:

Local Mode

  • Session is controlled from the terminal
  • User interacts directly via command line
  • Still registered with hub for monitoring

Remote Mode

  • Session waits for commands from web/mobile app
  • No terminal interaction required
  • Ideal for background sessions

Switching Modes

You can switch between local and remote modes mid-session using the web interface or Telegram bot.

Next Steps

Build docs developers (and LLMs) love