Terminal Reference

Megas CLI Reference

Detailed guide to configuring, pairing, and running the Megas CLI on your machine.

megas for your terminal

The Megas CLI is the execution layer that runs locally on your development machine. Because Megas is closed-source and secure, all operations are governed by a strict local security policy. The Megas CLI connects outbound to the Megas server via secure WebSockets to fetch instructions and stream terminal events.

Megas CLI Commands

1. Help & Version (megas --help)

Displays all available commands, options, and general configuration parameters.

$ megas --help

Usage: megas [OPTIONS] COMMAND [ARGS]...

  Megas CLI: Outbound runner and directory context synchronizer.

Options:
  --version  Show the version and exit.
  --help     Show this message and exit.

Commands:
  connect  Pair the Megas CLI with a remote orchestrator agent.
  allow    Authorize a local workspace folder path for execution.
  start    Begin the active session loop to listen for commands.
  status   Inspect connection state, active session, and whitelisted paths.

2. Connect & Pair (megas connect)

Establishes a secure connection lease between your local terminal and a specific remote orchestrator agent.

Command Syntax:megas connect --backend <SERVER_URL> --agent-id <AGENT_ID>
$ megas connect --backend https://megasmoves.io --agent-id agent_xyz_123

Connecting to Megas backend...
Connection handshake successful!
Lease established for Agent ID: agent_xyz_123
Active Session: listening on wss://megasmoves.io/api/v1/ws/agent_xyz_123

3. Directory Whitelisting (megas allow)

For security, the Megas CLI will refuse to inspect or execute code in any directory that has not been explicitly whitelisted.

Command Syntax:megas allow <LOCAL_DIRECTORY_PATH>
$ megas allow C:\Users\developer\my-project

Adding path to local security whitelist...
Success: Authorized execution in "C:\Users\developer\my-project"
(Only subdirectories under this path can receive commands from remote agents)

4. Start Listening (megas start)

Launches the daemon execution loop. Once started, the worker listens for incoming session waves, applies local security checks, compiles modifications, and logs results.

$ megas start

Starting Megas CLI daemon...
Connected to WebSocket host.
Status: Listening for incoming sessions...

[2026-07-07 19:10:00] Wave received: session_abc
[2026-07-07 19:10:01] Verifying path permissions for C:\Users\developer\my-project
[2026-07-07 19:10:02] Command lease approved: git status
[2026-07-07 19:10:04] Streamed 142 bytes of logs

5. Status Check (megas status)

Inspects the current network and state details of the local runner daemon.

$ megas status

--- Megas CLI Status ---
Daemon State:   Running (PID 8492)
Backend Host:   https://megasmoves.io
Active Agent:   agent_xyz_123 (Autonomous Mode)
Websocket Link: Connected
Allowed Directories:
  [0] C:\Users\developer\my-project
  [1] C:\Users\developer\other-app

🔒 Security Guidelines

The Megas CLI operates strictly outbound. It does not open any local listening ports, meaning it is safe to run behind corporate firewalls, NAT layers, and VPN setups. Code execution is jailed within the directory paths whitelisted via the megas allow command.