Skip to content

Latest commit

 

History

History
115 lines (91 loc) · 4.68 KB

File metadata and controls

115 lines (91 loc) · 4.68 KB

AX CLI Command Reference

Last reviewed: 2025-02-21 Applies to: ax-cli/ax-grok v4.4.x

Note: The ax-glm package has been deprecated. GLM/Z.AI users should use OpenCode - the official CLI from Z.AI.

Main syntax

ax-<provider> [message...] [options]
# providers: ax-grok, ax-cli (local/offline)

Core options

  • -p, --prompt <text>: headless, single prompt then exit.
  • -d, --directory <dir>: working directory (default: current).
  • -k, --api-key <key>: API key override (env vars preferred).
  • -u, --base-url <url>: API endpoint override.
  • -m, --model <name>: model override.
  • --max-tool-rounds <n>: cap tool executions (default from settings).
  • -c, --continue: resume the most recent conversation in the current directory.
  • -v, --version: show version; -h, --help: show help.

Thinking / Reasoning

  • --think: enable thinking/reasoning mode (Grok: reasoning_effort when supported).
  • --no-think: disable thinking/reasoning.

Sampling / reproducibility

  • --deterministic: sets do_sample=false.
  • --seed <number>: seed + deterministic.
  • --top-p <number>: nucleus sampling (0–1). Use instead of or alongside temperature.

Context helpers

  • --file <path>: include file content.
  • --selection <text>: include ad-hoc text.
  • --line-range <start-end>: include a specific range (with --file).
  • --git-diff: include current repo diff.

Output / integration

  • --json: JSON output (useful for editors/automation).
  • --vscode: format output for VSCode integration.
  • --no-agent: bypass agent-first mode.
  • --agent <name>: force a specific AutomatosX agent (e.g., backend, frontend, security).

Models by provider (current)

  • Grok (default base: https://api.x.ai/v1): grok-4 (default alias), grok-4.1, grok-4.1-fast-reasoning, grok-4.1-fast-non-reasoning, grok-4.1-mini, grok-4-0709, grok-3, grok-3-mini, grok-2-1212, grok-2-vision-1212, grok-2-image-1212.
  • Local/offline (default base: http://localhost:11434/v1): qwen3:14b (default), qwen3:32b, qwen3:8b, qwen3:72b, qwen2.5-coder:32b, codegeex4.

Env vars

  • API keys: XAI_API_KEY / GROK_API_KEY, AX_API_KEY (local).
  • AI_MODEL: default model override.
  • AI_BASE_URL: base URL override.

Typical commands

# Interactive (Grok)
ax-grok --think

# Headless (Grok) with reasoning and capped tool rounds
ax-grok -p "summarize tests" --think --max-tool-rounds 20

# Local edit via Ollama
ax-cli -p "rename foo to bar in src/index.ts" --model qwen3:14b --base-url http://localhost:11434/v1

# Continue previous conversation
ax-grok --continue

Slash Commands (Interactive Mode)

/init - Project Initialization

Generates AX.md at project root with AI-optimized context.

/init                      # Standard analysis (auto-refreshes if AX.md exists)
/init --depth=basic        # Quick scan (name, language, stack)
/init --depth=standard     # + Code stats, tests, docs
/init --depth=full         # + Architecture, dependencies, hotspots
/init --depth=security     # + Secret scanning, dangerous APIs
/init --force              # Force complete regeneration

Depth levels:

Level Includes
basic Project name, language, tech stack, scripts
standard + Code statistics, test coverage, documentation analysis
full + Architecture mapping, dependency graph, hotspots, how-to guides
security + Secret detection, dangerous API usage, auth pattern analysis

Adaptive output: Verbosity automatically adjusts based on project complexity (file count, LOC, dependencies).

Generated files:

  • AX.md - Primary context file (always)
  • .ax/analysis.json - Deep analysis data (full/security only)

Automatic context injection: When you start a conversation, AX CLI reads AX.md and injects its content into the AI's system prompt. The AI immediately understands your project's build commands, tech stack, and conventions.

Priority order: AX.md (primary) → ax.summary.json (legacy) → ax.index.json (legacy)

Other Commands

  • /help - Show all commands
  • /model <name> - Switch AI model
  • /lang <code> - Change language (en, zh-CN, zh-TW, ja, ko, de, es, pt, fr, vi, th)
  • /doctor - Run diagnostics
  • /mcp list - List MCP servers
  • /mcp add <name> --template - Add MCP server from template
  • /exit - Exit CLI

Exit codes

  • 0 success, 1 error or validation failure.

Tips

  • Use CLI flags for one-offs; use project settings (.ax-<provider>/settings.json) for repo defaults; use env vars for CI/secrets.
  • If a model does not support thinking, --think is ignored.
  • Run /init when starting a new project to generate context for better AI assistance.