HLVM CLI Reference

Complete reference for the hlvm command-line interface.

Quick Reference

CommandDescription
hlvmInteractive shell
hlvm askAI agent task execution
hlvm modelModel management
hlvm serveHTTP runtime host
hlvm doctorCheck runtime, route, and memory health
hlvm browserBrowser bridge management
hlvm editorHQL editor integration
hlvm lspHost-integrated HQL language server
hlvm mcpMCP server management
hlvm agentNamed agent management
hlvm petPet avatar management

Workspace Scope

HLVM uses the directory where it was started as the working root, matching Codex and Claude Code. Relative file references, HQL evaluation, attachments, and agent tools resolve from that root.

Workspace options are top-level options and must come before a command:

FlagMeaning
(none)Use the current directory
-C <dir>Use a specific directory
--cd <dir>Long form of -C
--globalUse explicit global-assistant scope
hlvm                                # Current directory
hlvm -C ~/dev/my-project            # Interactive shell in one project
hlvm -C ~/dev/my-project ask "test" # One-shot agent in one project
hlvm --global                       # Explicit global assistant

Inside the interactive shell, /path shows the current scope, /path <dir> changes it for future turns, and /path --global returns to global scope. The footer always shows the active scope.

--global is intentionally a semantic mode rather than an alias users must spell as --cd /. This keeps the public API clear and gives other clients one stable way to request the global assistant.


hlvm

Start the interactive shell.

hlvm [options]

Options:

FlagDescription
-C, --cd <d>Use a specific working directory
--globalUse explicit global-assistant scope
--no-bannerSkip the startup banner
--port <N>Use a dedicated runtime port for dev/test isolation
--debugShow internal trace rows in the shell
--help, -hShow help
--versionShow version

Input routing:

InputAction
(expression)HQL code evaluation
(js "code")JavaScript evaluation
/commandSlash commands
Everything elseAI conversation

Use /path in the shell to inspect or change the working directory.


hlvm ask

Interactive AI agent for task execution. Runs the full agent orchestration loop with tool calling and planning.

hlvm ask "<query>"

Options:

FlagDescription
--printNon-interactive output (uses configured mode, otherwise acceptEdits)
--verboseShow agent header, tool labels, stats, and trace output
--output-format <fmt>Output format: text (default), json, stream-json
--usageShow token usage summary after execution
--attach <path>Attach a file input (repeatable)
--model <provider/model>Use a specific AI model
--agent <name>Use a named agent
--port <N>Use a dedicated runtime port for dev/test isolation
--statelessUse an isolated hidden conversation for this run only
--permission-mode <mode>Set permission mode (see below)
--allowed-tools <name>Allow specific tool (repeatable)
--disallowed-tools <name>Deny specific tool (repeatable)
--max-turns <N>Maximum agent loop iterations (headless safety cap)
--help, -hShow help

Examples:

# Interactive (default)
hlvm ask "list files in src/"

# Run against another directory without changing the parent shell
hlvm -C ~/dev/my-project ask "list files in src/"

# Non-interactive print mode
hlvm ask --print "analyze code quality"

# Permission modes
hlvm ask --permission-mode acceptEdits "fix the bug"
hlvm ask --permission-mode readOnly "analyze code"

# Use a named agent
hlvm ask --agent reviewer "review this PR"

# Unlock shell execution explicitly (required in non-interactive mode)
hlvm ask --allowed-tools shell_exec --allowed-tools write_file \
  --permission-mode readOnly \
  "write a python script to generate a chart and run it"

# Block a specific tool
hlvm ask --disallowed-tools shell_exec "analyze code"

# Generate a file from multiple sources
hlvm ask --allowed-tools shell_exec --allowed-tools write_file \
  --allowed-tools read_file --permission-mode readOnly \
  "read all PDFs in ./reports/, summarize them, and write summary.md"

# Generate a PPTX presentation
hlvm ask --allowed-tools shell_exec --allowed-tools write_file \
  --permission-mode readOnly \
  "create a 5-slide dark-themed presentation about MCP, save to ~/Desktop/mcp.pptx, then open it"

# Mutate an existing PPTX in place and reload PowerPoint
hlvm ask --allowed-tools shell_exec --allowed-tools read_file \
  --permission-mode readOnly \
  "open ~/Desktop/mcp.pptx with python-pptx, change slide 1 title to 'New Title', save it, then run: osascript -e 'tell application \"Microsoft PowerPoint\" to quit saving no' && sleep 2 && open ~/Desktop/mcp.pptx"

# Structured output for scripting
hlvm ask --output-format stream-json "count test files"   # NDJSON events
hlvm ask --output-format json "count test files"           # Single JSON result

# Model selection
hlvm ask --model openai/gpt-4o "summarize this codebase"
hlvm ask --model claude-code/claude-sonnet-4-6 "review this PR"

# Attach files (images, PDFs, docs)
hlvm ask --attach ./screenshot.png "describe this UI issue"
hlvm ask --attach ./report.pdf --attach ./data.csv \
  "summarize the report and cross-reference with the data"

# Isolated hidden conversation (persistent memory still follows normal settings)
hlvm ask --stateless "hello"

# One run with no persistent memory reads or writes
hlvm ask --memory-free "answer without using saved memory"

# Cap agent loop iterations (useful for automation)
hlvm ask --max-turns 5 "refactor this file"

Output Formats

FormatDescription
textHuman-readable streaming text (default)
jsonSingle JSON object with the final result
stream-jsonNewline-delimited JSON events (NDJSON)

stream-json events:

{"type":"token","text":"Hello"}
{"type":"agent_event","event":{"type":"tool_start","name":"read_file"}}
{"type":"final","text":"Done","stats":{"turns":1},"meta":{"model":"ollama/test-fixture"}}

json output:

{
  "type": "result",
  "result": "Done",
  "stats": { "turns": 1 },
  "meta": { "model": "ollama/test-fixture" }
}

Permission Controls

The persistent user setting has exactly three presets. The REPL shows the friendly labels; config and automation use the stable values:

REPL labelConfig valueL0 (Read)L1 (Write)L2 (Destructive)
AskdefaultAuto-approvePromptPrompt
AutoacceptEditsAuto-approveAuto-approvePrompt
Full accessbypassPermissionsAuto-approveAuto-approveAuto-approve

Fresh installs use Auto. In the REPL, Shift+Tab cycles these three presets and /permissions opens the same picker. /plan is a separate workflow control.

hlvm ask --permission-mode also accepts two task-local constraints for headless and backend workflows. They are never persisted or shown in the three-state picker:

Task constraintL0 (Read)L1 (Write)L2 (Destructive)
readOnlyAuto-approveAuto-denyAuto-deny
planAuto-approvePrompt after planPrompt after plan

Tool safety levels:

  • L0: Safe read-only (read_file, list_files, search_code)
  • L1: Mutations (write_file, edit_file)
  • L2: High-risk (delete operations, destructive shell commands)
  • shell_exec has no fixed level โ€” it is classified per command by its content: a read-only command is L0, a mutation L1, and a destructive one (e.g. rm -rf) L2.
  • Full access still cannot bypass core-owned hard gates for publication, workspace trust, protected paths, or operating-system permissions.

Priority order: deny > allow > mode > default

hlvm model

Manage AI models โ€” list, pull, remove, and run them.

hlvm model [command]

Subcommands:

CommandDescription
(none)Show model help
listList all available models (grouped by provider)
login <backend>Sign in through a supported agent runtime
usage <backend>Show backend-reported subscription usage
key listList configured cloud provider keys
key set <id>Save a provider API key in the credential store
key unset <id>Remove a provider API key from the credential store
set <name>Set default model (persisted to ~/.hlvm/settings.json)
show <name>Show model details (params, capabilities, size)
pull <provider/model>Download a model (Ollama only)
remove <provider/model>Remove a model (Ollama only)

Examples:

hlvm model                                         # Show model help
hlvm model list                                    # List all models
hlvm model login codex                             # Sign in to a backend
hlvm model key list                                # List provider keys
hlvm model set claude-code/claude-haiku-4-5-20251001  # Set default
hlvm model show llama3.1:8b                        # Model details
hlvm model pull ollama/llama3.2:latest             # Download
hlvm model remove ollama/llama3.2:latest           # Remove

The set command persists to the same config SSOT used by the REPL model picker, hlvm ask, and the ai() API.


hlvm serve

Start the HTTP runtime host. Used by GUI clients and host-backed CLI surfaces.

hlvm serve

Starts on port 11435.

Endpoints:

MethodPathDescription
POST/api/chatSubmit chat, eval, or agent turns
GET/api/chat/messagesRead active conversation messages
GET/api/chat/streamSubscribe to active conversation updates
GET/api/launch/readinessRead route/onboarding disposition
GET/healthHealth check

Examples:

hlvm serve

# Health check
curl http://localhost:11435/health

# Evaluate HQL
curl -X POST http://localhost:11435/api/chat \
  -H "Content-Type: application/json" \
  -d '{"mode":"eval","messages":[{"role":"user","content":"(+ 1 2)"}]}'

# Chat
curl -X POST http://localhost:11435/api/chat \
  -H "Content-Type: application/json" \
  -d '{"mode":"chat","messages":[{"role":"user","content":"hello"}]}'

GUI-visible top-level submission uses POST /api/chat. Internal compatibility endpoints may still exist, but they are not part of the public runtime-host contract.


hlvm mcp

Model Context Protocol server management.

hlvm mcp <command>

Subcommands:

CommandDescription
add <name> <url>Add a remote MCP server
add <name> -- <command> [args...]Add a stdio MCP server
show <name>Show details for one MCP server
listList configured servers
remove <name>Remove a server
login <name>OAuth authentication for a remote MCP server
logout <name>Remove stored OAuth token

Options:

FlagDescription
--transport <type>http or sse for remote URLs; stdio uses --
--env KEY=VALUEEnvironment variable (repeatable, for add)
--header "Name: v"HTTP/SSE header (repeatable, for add)
--client-id <id>OAuth client ID (for add)
--client-secretOAuth client secret input toggle (for add)
--callback-port <port>OAuth callback port (for add)

Examples:

hlvm mcp add github -- npx -y @modelcontextprotocol/server-github
hlvm mcp add db http://localhost:8080
hlvm mcp add sentry --env SENTRY_TOKEN=abc123 -- npx @sentry/mcp-server
hlvm mcp show github
hlvm mcp list
hlvm mcp remove github
hlvm mcp login notion
hlvm mcp logout notion

Notes:

  • Servers persist to ~/.hlvm/mcp.json. Inherited sources (Cursor, Windsurf, Zed, Codex CLI, Gemini CLI, Claude Code plugins) are read-only from HLVM.
  • URL inputs default to HTTP. Use --transport sse for SSE servers, or use the -- separator for stdio commands.
  • list and show report live MCP connection status.
  • hlvm mcp <subcommand> --help shows subcommand-specific help.

See the MCP guide for the full MCP surface, configuration model, and runtime behavior.


hlvm doctor

Check runtime-host health, concrete route readiness, and memory health.

hlvm doctor
hlvm doctor --json
hlvm doctor memory
hlvm doctor memory --json

hlvm browser

Manage the native browser bridge.

hlvm browser setup
hlvm browser status
hlvm browser verify
hlvm browser uninstall

hlvm editor

Install and inspect HQL editor integration for supported VS Code-compatible editors.

hlvm editor setup
hlvm editor status

Subcommands:

CommandDescription
setupInstall HQL support in detected VS Code and Cursor editors
statusShow detected editors and installed HQL extension versions

For VS Code and VS Code Insiders, setup installs hlvm.hql-language by Marketplace ID. For Cursor, it downloads the matching platform VSIX from the official VS Code Marketplace CDN, verifies its pinned SHA-256 checksum, installs it, and removes the temporary package. Opening a .hql file then starts the bundled language server. The extension can instead use an explicit hql.serverPath or hql-lsp from PATH.


hlvm lsp

Start the HQL language server over stdio with the HLVM runtime evaluator.

hlvm lsp

The independent HQL package owns and tests the language-server implementation. This HLVM command supplies host runtime state and evaluation bindings; it does not duplicate HQL language behavior. Editor integrations normally use the standalone hql-lsp binary.


hlvm agent

Manage named agents โ€” reusable AI personas, each with its own identity and memory. Run one with hlvm ask --agent <name>.

hlvm agent <command>

Subcommands:

CommandDescription
listList all addressable agents
show <name>Show one agent's full file
add <name>Scaffold a new agent file
identity <name> [options]Update identity (emoji, color, image, avatar)
remove <name>Archive the agent and its memory
restore <removal-id>Undo a previous agent removal
generate "<description>"AI-generate an agent from a text description

identity options:

FlagDescription
--emoji <emoji>Terminal-only glyph (frontmatter: terminal_icon)
--color <#HEX>Set the accent color
--image-url <url|path>Set an avatar image from a URL or local path
--avatar <pet-id>Reusable pet avatar from ~/.hlvm/pets or ~/.codex/pets
--description <text>Set the agent description
--defaultMark this agent as the default
--no-defaultUnmark this agent as the default

Examples:

hlvm agent list
hlvm agent add coder
hlvm agent identity coder --emoji ๐Ÿง‘โ€๐Ÿ’ป --color "#4FC3F7"
hlvm agent generate "an agent that triages my email"
hlvm ask --agent coder "review this PR"
# `remove` prints the ID accepted by `restore`
hlvm agent remove coder
hlvm agent restore <removal-id>

hlvm pet

Manage Codex-compatible pet avatars, resolved from ~/.hlvm/pets and ~/.codex/pets. Assign a pet to an agent to give it a visual avatar.

hlvm pet <command>

Subcommands:

CommandDescription
listList pets from ~/.hlvm/pets and ~/.codex/pets
show <pet-id>Show one resolved pet
validate <pet-id|folder>Validate a Codex-compatible pet package
import <pet-id|folder>Copy a pet package into ~/.hlvm/pets
update <pet-id>Update HLVM-owned pet metadata
remove <pet-id>Remove an HLVM-owned pet package
assign <agent> <pet-id>Assign a pet avatar to an agent

Examples:

hlvm pet list
hlvm pet show sakiko
hlvm pet import ~/Downloads/my-pet --id my-pet
hlvm pet assign hlvm sakiko

Model Identification

Models use <provider>/<model-name> format:

auto                           # Automatic eligible-route selection (default)
ollama/qwen3:8b                # Optional existing Ollama route
openai/gpt-4o                  # OpenAI
codex/<exact-model>            # Native Codex App Server harness
claude-code/<exact-model>      # Direct Claude subscription provider
claude-code-agent/<exact-model> # Native Claude Code Agent SDK harness
grok-build/<exact-model>       # Native Grok Build ACP harness
opencode/<profile>/<model>     # Native OpenCode ACP harness
google/gemini-2.0-flash        # Google

The normal interface uses auto or one exact route copied from hlvm model list. There is no Restricted/Enhanced/Native-Full mode selector. HLVM discovers the maximum compatible capability set for the resolved route; advanced users pin an exact harness route only when reproducibility, billing, privacy, or engine-specific behavior matters.


Environment Variables

Supported user-facing environment variables:

VariableDescription
HLVM_NO_UPDATE_CHECKDisable the startup update check

HLVM's state lives at ~/.hlvm/ โ€” this is fixed and not configurable. HLVM runs as a single user-level daemon, shared by the CLI, the macOS GUI, and any messaging-channel receivers; there is no per-directory isolation at the user contract.

Runtime port isolation:

hlvm --port 18442 ask "test against an isolated runtime"
hlvm ask --port 18442 "same isolation, command-local form"
hlvm --port 18442

The default 11435 port is the shared product runtime. Use --port only for source-mode work, E2E tests, or diagnostics where touching the GUI runtime would be wrong. HLVM does not silently auto-increment ports because that would split runtime state without making the isolation explicit.

Internal equivalent used by tests and spawned runtime hosts:

VariableDescription
HLVM_REPL_PORTEnvironment form of --port for explicit dev/test isolation only

Configuration Files

FileDescription
~/.hlvm/settings.jsonUnified config: model, theme, permission mode, etc.
~/.hlvm/Global config and cache directory
hql.jsonHQL package metadata (name, version, exports)

Exit Codes

CodeMeaning
0Success
1General failure