Skip to main content

CLI Command Reference

Global Options​

FlagDescription
--version, -vPrint the CLI version
--help, -hShow help for any command
--debug, -dUse local-debug mode (plaintext output, for debugging)

agentrix start​

Start the daemon if it is not already running, then show its status.

agentrix start

What it does:

  1. Authenticates (browser OAuth on first run, or validates existing credentials).
  2. Checks critical dependencies (git, sandbox tools). Exits if any are missing.
  3. Spawns the daemon as a detached background process.
  4. Waits up to 5 seconds for the daemon to report ready.
  5. Prints daemon status.

agentrix start does not perform CLI upgrade checks. Use agentrix upgrade for manual CLI upgrades, or trigger upgrade-cli from an app machine-control surface where available.

Example:

Starting Agentrix background service...
✓ Daemon started successfully

🤖 Daemon Status
✓ Daemon is running
PID: 12345
Started: 4/22/2026, 10:00:00 AM
CLI Version: 1.2.3
HTTP Port: 51234

agentrix stop​

Stop the running daemon.

agentrix stop

Any active worker sessions are terminated when the daemon stops.


agentrix status​

Show daemon and authentication status.

agentrix status

This is equivalent to running agentrix doctor filtered to daemon + auth sections.

Example output:

🤖 Daemon Status
✓ Daemon is running
PID: 12345
Started: 4/22/2026, 10:00:00 AM
CLI Version: 1.2.3
HTTP Port: 51234

🔐 Authentication
✓ Authenticated (credentials found)

agentrix doctor​

Full system diagnostics — version, configuration, environment variables, authentication, dependencies, and daemon status.

agentrix doctor

Use this as the first step when troubleshooting. It shows:

  • CLI version, platform, Node.js version
  • Daemon spawn paths (wrapper script, entrypoint)
  • Configuration (home dir, server URL, log dir)
  • Environment variables that affect Agentrix behavior
  • Authentication status
  • Dependency status (git, claude, codex, sandbox tools)
  • Daemon status (running / stale / not running)

agentrix llm-config apply​

Generate Claude Code, Codex, and Gemini config from Agentrix environment variables. The CLI Docker image runs this command automatically before agentrix daemon or agentrix start; local and systemd deployments can run it manually.

export AGENTRIX_BASE_URL=https://api.xmz.ai
export AGENTRIX_API_KEY=<llm-gateway-api-key>

agentrix llm-config apply --verbose

For this command, AGENTRIX_API_KEY and AGENTRIX_BASE_URL point to the LLM gateway. agentrix-run also reads variables with those names, but there they mean Agentrix API options; see agentrix-run.

By default, the command writes only missing config files and leaves existing files alone. Codex config stays minimal; worker launch options control runtime sandboxing and approval policy.

Options:

OptionDescription
--source envRead config from environment variables. Only env is supported
--forceOverwrite existing Claude, Codex, PI, and Gemini config files
--dry-runShow planned file writes without changing disk state
--verbosePrint each config file action

Related env vars:

VariableDefaultDescription
AGENTRIX_API_KEY—LLM gateway key
AGENTRIX_API_KEY_FILE—Read the LLM gateway key from a file
AGENTRIX_BASE_URLhttps://api.xmz.aiLLM gateway URL; Codex uses /v1 under this URL
AGENTRIX_CLAUDE_HOME~/.claudeClaude Code config directory
AGENTRIX_CODEX_HOME~/.codexCodex config directory
AGENTRIX_PI_HOME~/.pi/agentPI config directory; PI_CODING_AGENT_DIR is also supported
AGENTRIX_GEMINI_HOME$AGENTRIX_HOME_DIR/config/geminiGemini config directory
AGENTRIX_CODEX_MODELgpt-5.5Default Codex model
AGENTRIX_PI_MODELSame as AGENTRIX_CODEX_MODELDefault PI model
AGENTRIX_CLAUDE_MODELclaude-sonnet-4-6Default Claude model
AGENTRIX_CLAUDE_FAST_MODELclaude-haiku-4-5Claude fast model
AGENTRIX_CLAUDE_SUBAGENT_MODELSame as AGENTRIX_CLAUDE_MODELClaude subagent model
AGENTRIX_GEMINI_IMAGE_MODELgemini-2.5-flash-imageGemini image model

agentrix upgrade​

Upgrade the CLI to the latest version on npm.

agentrix upgrade

This runs npm install -g @agentrix/cli@latest and:

  • Also checks for agent updates (companion, etc.).
  • Restarts the daemon automatically if it was running.

agentrix start does not perform automatic CLI upgrade checks.


agentrix logout​

Unbind this machine from your Agentrix account.

agentrix logout

Removes ~/.agentrix/credentials.json. The next agentrix start will open the browser authentication flow again.


agentrix ls​

List sessions currently tracked by the running daemon.

agentrix ls

Each session corresponds to a running or recently-started worker process.

Example:

Active sessions:
[
{
"taskId": "task-abc123",
"pid": 54321,
"startedBy": "cli"
}
]

Returns No active sessions if no workers are running.


agentrix kill <sessionId>​

Stop a specific worker session by its task ID.

agentrix kill task-abc123

agentrix killall​

Terminate all runaway agentrix processes found on the system.

agentrix killall

Use this when sessions are stuck or the daemon state is inconsistent. Reports how many processes were killed.


agentrix git-server add​

Add a private GitLab server to the local daemon config and store the PAT used to access it. User identity binding and proxy registration are independent choices.

agentrix git-server add \
--base-url https://gitlab.example.com

Options:

OptionDescription
--base-url <url>GitLab site URL, for example https://gitlab.example.com
--api-url <url>GitLab API URL. Defaults to <base-url>/api/v4
--pat-file <file>Read the PAT from a file; use - to read from stdin
--bind-user / --no-bind-userWhether to bind the GitLab account to the current Agentrix user; pressing Enter at the prompt defaults to no binding
--proxy / --no-proxyWhether to register this machine as a Git proxy node; prompts by default

When --pat-file is omitted, the command prompts for the PAT interactively without echoing it.

printf '%s' "$GITLAB_PAT" | agentrix git-server add \
--base-url https://gitlab.example.com \
--pat-file -

The command prints JSON with webhookUrl and webhookSecret. The PAT and webhook secret are encrypted under ~/.agentrix/credentials/; baseUrl and apiUrl are stored as local config.

The prompt defaults to no binding, which is appropriate for a shared bot PAT on a Private Cloud machine. The daemon still validates and stores the PAT locally, but does not send it to the Agentrix API or create user-scoped GitLab credentials, identities, or repositories. Pass --bind-user only when the PAT represents the current Agentrix user. --proxy remains independent and can expose the machine's GitLab network access without treating the bot as the current user's identity.

This command requires a bound machine. If it reports that the Agentrix auth secret is missing, run agentrix start first.


agentrix git-server list​

List private GitLab config stored on this machine.

agentrix git-server list

The output includes the full local view: Git server ID, baseUrl, apiUrl, webhook endpoint, current daemon webhookUrl, whether a PAT is configured, PAT user metadata, webhookSecret, and cached project-level pipeline trigger tokens.

[
{
"id": "corp-gitlab",
"type": "gitlab",
"baseUrl": "https://gitlab.example.com",
"apiUrl": "https://gitlab.example.com/api/v4",
"webhookEndpointPath": "/webhooks/gitlab/corp-gitlab",
"webhookUrl": "http://192.168.1.10:30624/webhooks/gitlab/corp-gitlab",
"patConfigured": true,
"patMeta": {
"username": "alice",
"email": "[email protected]",
"lastValidatedAt": "2026-04-27T05:00:00.000Z",
"expiresAt": null
},
"webhookSecret": "...",
"projectTriggerTokens": {}
}
]

If the daemon is not running, webhookUrl may be empty; run agentrix start and list again.


GitLab Webhook Setup​

The daemon's built-in web server can receive GitLab webhooks directly and convert supported events into GitLab pipeline triggers.

Basic setup:

  1. Run agentrix start to make sure the daemon is running.
  2. Run agentrix git-server add to save the GitLab baseUrl, apiUrl, and PAT.
  3. Run agentrix git-server list, then copy webhookUrl and webhookSecret.
  4. In the GitLab project's Webhooks page, paste webhookUrl into URL and webhookSecret into Secret token, and select the event types that should trigger pipelines.
  5. If GitLab is not on the same machine, enable daemonControl.allowLanAccess in ~/.agentrix/settings.json and restart the daemon.
{
"daemonControl": {
"allowLanAccess": true
}
}

Supported Events and Mapping​

The daemon webhook endpoint validates GitLab's X-Gitlab-Token, normalizes supported events, and triggers GitLab pipelines. It does not forward GitLab webhook payloads to the Agentrix repository inbox side channel.

Pipeline triggers default to all supported normalized events:

GitLab webhookPipeline resultNormalized event
event_type: "issue" or object_kind: "issue"Triggers a project pipelineGITLAB_BRIDGE_EVENT_NAME=issues, GITLAB_BRIDGE_EVENT_ACTION=<github_action>
merge_requestTriggers a project pipelineGITLAB_BRIDGE_EVENT_NAME=pull_request or pull_request_review, GITLAB_BRIDGE_EVENT_ACTION=<github_action>
Non-system issue/MR note commentsTriggers a project pipelineGITLAB_BRIDGE_EVENT_NAME=issue_comment or pull_request_review_comment, GITLAB_BRIDGE_EVENT_ACTION=created/edited/deleted
pipelineTriggers a project pipelineGITLAB_BRIDGE_EVENT_NAME=workflow_run, GITLAB_BRIDGE_EVENT_ACTION=requested/in_progress/completed
System note, GitLab-only changes, and other unsupported eventsDoes not trigger a pipeline; response body is status: "ignored" with a reasonNot applicable

Common normalized actions:

GitLab signalNormalized event
Issue open/reopen/closeissues.opened/reopened/closed
Issue label added/removedissues.labeled/unlabeled, one event per label
MR open/reopen/close/mergepull_request.opened/reopened/closed, with GITLAB_BRIDGE_PULL_REQUEST_MERGED=true for merges
MR source/head updatepull_request.synchronize
MR reviewer added/removedpull_request.review_requested/review_request_removed
Issue/MR ordinary commentissue_comment.created/edited/deleted
Pipeline created/pending/runningworkflow_run.requested/in_progress; created is exposed as GITLAB_BRIDGE_WORKFLOW_RUN_STATUS=pending
Pipeline success/failed/canceled/skippedworkflow_run.completed, with GITLAB_BRIDGE_WORKFLOW_RUN_CONCLUSION carrying the result

The bridge's default pipeline variables use the GITLAB_BRIDGE_* prefix. Agentrix also appends AGENTRIX_GIT_SERVER_ID so agentrix-run can resolve the configured private GitLab server.

Every daemon-triggered pipeline receives these base variables:

VariableMeaning
GITLAB_BRIDGE_EVENT_NAMEnormalized event name, for example issues, pull_request, issue_comment, or workflow_run
GITLAB_BRIDGE_EVENT_ACTIONNormalized event action
GITLAB_BRIDGE_REPOSITORYFull repository path, for example group/subgroup/repo
GITLAB_BRIDGE_REPOSITORY_OWNERproject.path_with_namespace without the final path segment; subgroups are preserved
GITLAB_BRIDGE_REF_NAMETarget ref for the triggered pipeline
AGENTRIX_GIT_SERVER_IDGit server ID configured on this machine

Event-specific variables are added as follows:

EventAdditional variables
issuesGITLAB_BRIDGE_ISSUE_NUMBER, GITLAB_BRIDGE_ISSUE_TITLE, GITLAB_BRIDGE_ISSUE_URL, plus GITLAB_BRIDGE_LABEL_NAME, GITLAB_BRIDGE_LABELS, GITLAB_BRIDGE_LABELS_JSON, and GITLAB_BRIDGE_LABEL_CHANGES_JSON for label events
pull_request / pull_request_reviewGITLAB_BRIDGE_PR_NUMBER, GITLAB_BRIDGE_HEAD_REF, GITLAB_BRIDGE_BASE_REF, GITLAB_BRIDGE_PR_TITLE, GITLAB_BRIDGE_PR_BODY, GITLAB_BRIDGE_PR_URL, GITLAB_BRIDGE_LABELS, GITLAB_BRIDGE_LABELS_JSON, plus GITLAB_BRIDGE_HEAD_SHA and GITLAB_BRIDGE_OLD_HEAD_SHA for synchronize events when GitLab provides commit data
issue_comment / pull_request_review_commentGITLAB_BRIDGE_COMMENT_BODY, GITLAB_BRIDGE_COMMENT_ID, GITLAB_BRIDGE_COMMENT_URL, plus either GITLAB_BRIDGE_ISSUE_NUMBER or GITLAB_BRIDGE_PR_NUMBER depending on the comment target
workflow_runGITLAB_BRIDGE_WORKFLOW_RUN_STATUS, GITLAB_BRIDGE_WORKFLOW_RUN_CONCLUSION, GITLAB_BRIDGE_WORKFLOW_RUN_ID, GITLAB_BRIDGE_WORKFLOW_RUN_NUMBER, GITLAB_BRIDGE_WORKFLOW_RUN_URL, GITLAB_BRIDGE_WORKFLOW_RUN_REF, GITLAB_BRIDGE_WORKFLOW_RUN_SHA, and GITLAB_BRIDGE_PR_NUMBER when an MR can be inferred

Optional variables are present only when GitLab includes the matching payload field:

VariableMeaning
GITLAB_BRIDGE_ISSUE_TITLEIssue title; present when GitLab includes it in the payload
GITLAB_BRIDGE_ISSUE_URLIssue URL; uses the payload URL first, then falls back to project URL plus IID
GITLAB_BRIDGE_OLD_HEAD_SHAPrevious MR head revision for pull_request.synchronize when GitLab provides it
GITLAB_BRIDGE_HEAD_SHACurrent MR head SHA for pull_request.synchronize when GitLab provides it

Notes:

  • The webhook URL is only the daemon endpoint. It does not contain the PAT, API URL, or pipeline trigger token.
  • The webhook secret is matched against GitLab's X-Gitlab-Token request header.
  • Pipeline trigger tokens are GitLab project-level tokens. The daemon creates or reuses a GitLab webhook bridge trigger the first time it handles a webhook for a project, then encrypts the token locally.
  • Delivery identity is read from GitLab's stable delivery headers (webhook-id, Idempotency-Key, X-Gitlab-Webhook-UUID, X-Gitlab-Event-UUID, then legacy X-Gitlab-Delivery). If none is present, the daemon uses a stable payload hash.
  • Successfully delivered normalized fan-out events are de-duplicated for repeated delivery attempts. Duplicate redeliveries return status: "ignored" with delivery reason: "duplicate_delivery_event"; failed fan-out events are not marked as processed, so a later manual redelivery can compensate them.
  • If GitLab rejects the pipeline trigger, for example because .gitlab-ci.yml is missing, the daemon logs the failure and returns HTTP 200 to GitLab with response body status: "failed". This avoids GitLab retrying a business-level failure. Non-200 webhook responses are reserved for requests the bridge cannot safely process, such as an invalid secret or missing local GitLab bridge configuration.

Environment Variables​

These variables modify CLI behavior without changing settings.json.

VariableDefaultDescription
AGENTRIX_HOME_DIR~/.agentrixRoot state directory
AGENTRIX_SERVER_URLhttps://agentrix.xmz.aiBackend API URL
AGENTRIX_WEBAPP_URLhttps://agentrix.xmz.aiWeb app URL (used for auth redirect)
AGENTRIX_WORKSPACE_HOME_DIR~/.agentrix/workspacesTask workspace root
AGENTRIX_AGENTS_HOME_DIR~/.agentrix/agentsCustom agent install root
AGENTRIX_CLAUDE_HOME~/.claudeClaude Code config dir
AGENTRIX_CODEX_HOME~/.codexCodex config dir
AGENTRIX_PI_HOME~/.pi/agentPI config dir; PI_CODING_AGENT_DIR is also supported
AGENTRIX_GEMINI_HOME~/.agentrix/config/geminiGemini config dir
AGENTRIX_API_KEY—LLM gateway key read by agentrix llm-config apply and Docker auto-config
AGENTRIX_API_KEY_FILE—Read the LLM gateway key from a file
AGENTRIX_BASE_URLhttps://api.xmz.aiLLM gateway URL
AGENTRIX_PI_MODELSame as AGENTRIX_CODEX_MODELDefault PI model
AGENTRIX_CLAUDE_PATH—Override the claude binary path
AGENTRIX_CODEX_PATH—Override the codex binary path
AGENTRIX_LLM_AUTO_CONFIGtrueWhether the Docker image auto-generates LLM config before daemon/start
AGENTRIX_LLM_CONFIG_FORCEfalseWhether Docker auto-config overwrites existing LLM config
GITLAB_BASE_URL—GitLab site URL for Docker/cloud runner auto-configuration
GITLAB_API_URL<base-url>/api/v4GitLab API URL used by auto-configuration
GITLAB_TOKEN—GitLab token saved to the local worker token store and, when user binding is enabled, synced as an API credential
GITLAB_TOKEN_FILE—Read the GitLab token from a file, useful with Docker secrets
AGENTRIX_GITLAB_BIND_USERLocal: true; Private Cloud: falseWhether auto-configuration binds the GitLab account to the current Agentrix user; an explicit value overrides the runtime default
AGENTRIX_GITLAB_USE_AS_PROXYtrueWhether auto-configuration registers the current runner as a Git proxy node
AGENTRIX_GITLAB_AUTO_CONFIGtrueSet to false to disable Docker/cloud runner GitLab auto-configuration
AGENTRIX_DISABLE_CAFFEINATE—Set to true to allow the machine to sleep during tasks
CLOUD_AUTH_TOKEN—Cloud runner auth token; set to the runner secret when deploying a Private Cloud runner
CLOUD_AUTH_TOKEN_FILE—Read the cloud runner auth token from a file
DEBUG—Enable verbose debug logging