Cursor Agent
HAPI supports Cursor Agent CLI for running Cursor's AI coding agent with remote control via web and phone.
Prerequisites
Install Cursor Agent CLI:
- macOS/Linux:
curl https://cursor.com/install -fsS | bash - Windows:
irm 'https://cursor.com/install?win32=true' | iex
Verify installation:
bash
agent --versionUsage
bash
hapi cursor # Start Cursor Agent session
hapi cursor resume <chatId> # Resume a specific chat
hapi cursor --continue # Resume the most recent chat
hapi cursor --mode plan # Start in Plan mode
hapi cursor --mode ask # Start in Ask mode
hapi cursor --yolo # Bypass approval prompts (--force)
hapi cursor --model <model> # Specify modelPermission Modes
| Mode | Description |
|---|---|
default | Standard agent behavior |
plan | Plan mode - design approach before coding |
ask | Ask mode - explore code without edits |
yolo | Bypass approval prompts |
Set mode via --mode flag or change from the web UI during a session.
Modes
- Local mode - Run
hapi cursorfrom terminal. Full interactive experience. - Remote mode - Spawn from web/phone when no terminal. Uses
agent -pwith--output-format stream-jsonand--trust. Each user message spawns one agent process; session continues via--resume.
Limitations
- Tool approval - In remote mode,
--trustis used; tools run without per-request approval. Use--yolofor full bypass. - Session resume - Pass
--resume <chatId>or--continueto resume. Useagent lsto list previous chats and get chat IDs.
Integration
Once running, your Cursor session appears in the HAPI web app and Telegram Mini App. You can:
- Monitor session activity
- Approve permissions from your phone
- Send messages when in local mode (messages queue for when you switch)
Related
- Cursor CLI Documentation
- How it Works - Architecture and data flow