Overview
Codex mode provides OpenAI-based AI coding sessions with remote control through HAPI. Start sessions from your terminal and control them from web or Telegram.Requirements
- HAPI CLI installed (
hapicommand available) - Authenticated with HAPI hub (
hapi auth login) - OpenAI API credentials configured
Starting a Session
Basic Usage
With Options
Available Flags
| Flag | Description |
|---|---|
resume <sessionId> | Resume a specific Codex session |
--yolo | Bypass approval prompts and sandbox restrictions |
--dangerously-bypass-approvals-and-sandbox | Explicit bypass flag |
--model <model> | Specify OpenAI model (e.g., gpt-4, gpt-3.5-turbo) |
--started-by | Internal flag for runner management |
Permission Modes
Codex supports these permission modes:Default
Standard behavior with approval prompts
Read Only
Only read operations allowed, no file modifications
Safe Yolo
Some restrictions bypassed, critical checks remain
Yolo
Bypass all approvals and sandbox (use with extreme caution)
shared/src/modes.ts:4-5 for mode definitions.
Resume Functionality
Codex sessions can be resumed by session ID:- Check the web UI session list
- Use
hapi runner listto see active sessions - Session IDs are displayed when starting a session
Session Modes
Local Mode
Start from terminal with interactive experience:Remote Mode
Codex supports remote control through the HAPI hub. Sessions can be started from the web UI or Telegram and will run on your machine.Examples
Start New Session
Resume Existing Session
Start with Yolo Mode
Specify Model
Integration
Once running, your Codex session appears in:- HAPI web app
- Telegram Mini App
- Monitor session activity in real-time
- Approve operations from your phone
- Send messages to the agent
- Change permission modes on the fly
- View file changes and diffs
MCP Bridge
Codex integrates with MCP (Model Context Protocol) tools:Related Commands
Source Reference
- Command implementation:
cli/src/commands/codex.ts - Session runner:
cli/src/codex/runCodex.ts - Permission modes:
shared/src/modes.ts:4-5 - MCP bridge:
cli/src/codex/happyMcpStdioBridge.ts