CLI Mode

xbot chat runs one-shot agent conversations. Defaults to the current directory as workspace.

bash
# Initialize project context (creates .xbot/ and XBOT.md)
xbot chat /init

# One-shot task in current directory
xbot chat "refactor the database layer"

# Use explicit workspace
xbot chat --workspace /path/to/project "find bugs"

# Use global workspace for non-project tasks
xbot chat --global "research quantum computing"

# Override model for this task
xbot chat --model anthropic/claude-sonnet-4-20250514 "review my code"

REPL Interactive Mode

Rich terminal UI built with Ratatui — streamed responses, persistent sessions, subagent notifications, and runtime model switching.

bash
xbot repl
xbot repl --workspace /path/to/project
xbot repl --global

Backend Service

xbot run starts the always-on AI assistant backend. It simultaneously launches the Gateway HTTP server, heartbeat service, cron scheduler, and all configured channel backends.

bash
xbot run
xbot run --workspace /path/to/project

Built-in Tools

xbot provides 12 built-in tools that agents can invoke autonomously to complete tasks.

ToolPurposeNotes
read_fileRead file contentsSupports offset and line limit
write_fileCreate or overwrite fileRequires approval (configurable)
edit_filePrecise string-replace editApproval flow with diff preview
list_dirList directory contentsRecursive file tree display
grep_filesSearch for patterns in filesRegex pattern support
execExecute shell commandsConfigurable timeout, default 120s
web_searchWeb searchDuckDuckGo default, configurable
web_fetchFetch webpage contentHTML to Markdown conversion
messageSend message to channelCross-channel delivery
cronCreate scheduled jobsOne-shot, interval, or cron expr
spawnSpawn background subagentParallel subtasks, max 3 concurrent
wait_subagentsWait for subagentsCollect subagent results
File Edit Approval

write_file and edit_file support an approval flow (Allow Once / Always Allow / Deny) with diff preview. Use restrictToWorkspace to sandbox file operations.

MCP Tool Servers

xbot supports MCP (Model Context Protocol) over stdio. Enabled tools register as native tools with mcp_<server>_<tool> naming.

json
{
  "tools": {
    "mcpServers": {
      "github": {
        "enabled": true,
        "type": "stdio",
        "command": "npx",
        "args": ["-y", "@modelcontextprotocol/server-github"],
        "env": { "GITHUB_TOKEN": "ghp_..." },
        "enabledTools": ["*"],
        "toolTimeout": 30
      },
      "filesystem": {
        "enabled": true,
        "type": "stdio",
        "command": "npx",
        "args": ["-y", "@modelcontextprotocol/server-filesystem", "/tmp"]
      }
    }
  }
}

Memory System

xbot implements a dual-file persistent memory architecture ensuring important information persists across sessions.

FilePurposeLifecycle
MEMORY.mdDurable facts, user preferences, project knowledgePermanent
HISTORY.mdResettable event logResettable

Memory Consolidation

LLM-driven consolidation auto-triggers when context usage reaches ~75%, compressing older memories. Falls back to raw archive mode after 3 LLM consolidation failures.

Explicit Memory

bash
# In REPL or via channel
/memorize Always use tabs for indentation in this project

Skills System

Skills are modular SKILL.md files in skills/<name>/SKILL.md with YAML frontmatter defining triggers and priority.

bash
xbot skills list             # List all skills
xbot skills init my-skill    # Create a custom skill

Built-in Skills

SkillPurpose
software-engineerCode writing, debugging, refactoring
summarizeContent summarization and report generation
githubGitHub repository operations and CI/CD
github-cligh CLI integration
data-analystData analysis and visualization
cronScheduled task management
scheduled-opsScheduled operations
memoryMemory management
memory-hygieneMemory cleanup and organization
memory-entry-writerAuto-write task summaries to memory
weatherWeather lookup
project-initProject initialization
project-contextProject context understanding
workspace-operatorWorkspace operations
delivery-rulesMessage delivery rules
tmuxtmux session management
clawhubClawHub integration
skill-creatorCreate new skills

Subagent System

The main agent can spawn background subagents for parallel subtask execution. Subagents default to 3 max concurrent with 100 max iterations each.

Limitations

Subagents cannot use spawn, cron, or message tools. If subagents.model is empty, subagents inherit the main task model.

Hybrid Model Routing

Main task on a remote frontier API (e.g., OpenAI GPT-4.1), subagents switch to a local model (e.g., Qwen on vLLM) for parallel work — balancing quality and cost.

json
{
  "agents": {
    "defaults": {
      "model": "openai/gpt-4.1",
      "provider": "openai"
    },
    "subagents": {
      "model": "qwen2.5-coder:7b",
      "provider": "local-vllm",
      "apiBase": "http://127.0.0.1:8001/v1"
    }
  },
  "providers": {
    "openai": { "apiKey": "sk-..." },
    "local-vllm": {
      "apiKey": "",
      "apiBase": "http://127.0.0.1:8001/v1"
    }
  }
}

Provider Configuration

xbot supports 26 LLM providers with automatic model routing — auto-detecting provider from model name prefixes, API key prefixes, or API base URLs.

CategoryProviders
Cloud APIsOpenAI, Anthropic, DeepSeek, Groq, Gemini, Moonshot, MiniMax, Mistral, StepFun, Zhipu, DashScope, Azure OpenAI
GatewaysOpenRouter, AIHubMix, SiliconFlow, Volcengine, BytePlus
LocalOllama, vLLM, OVMS, Custom
OAuthGitHub Copilot, OpenAI Codex
OtherCursor

Cron Scheduling

Three scheduling modes: one-shot (At), interval (Every), and cron expression (Cron) with timezone support. Jobs persist to .xbot/state/cron/jobs.json.

bash
xbot jobs              # List all scheduled jobs

Gateway Endpoints

The Gateway HTTP server started by xbot run listens on 0.0.0.0:18790 by default.

EndpointPurpose
GET /healthzHealth check
GET /readyzReadiness check
GET /statusRuntime status JSON
GET /metricsPrometheus-format metrics
GET /adminWeb admin UI

Full Configuration Reference

Config file at ~/.xbot/config.json. All available settings:

PathDefaultDescription
agents.defaults.modelopenai/gpt-4.1-miniDefault LLM model
agents.defaults.providerautoProvider selection
agents.defaults.maxTokens16384Max completion tokens
agents.defaults.contextWindowTokens65536Context window size
agents.defaults.maxConcurrentTools5Parallel tool execution count
agents.defaults.maxConcurrentRequests3Global request concurrency
agents.defaults.memoryMaxBytes32768Memory file size cap
gateway.host0.0.0.0Gateway listen host
gateway.port18790Gateway listen port
gateway.heartbeat.enabledtrueHeartbeat service
gateway.heartbeat.intervalS1800Heartbeat interval (seconds)
tools.exec.enabletrueEnable shell execution
tools.exec.timeout120Shell timeout (seconds)
tools.restrictToWorkspacefalseRestrict file ops to workspace

API Reference page.