mothx [flags] [message...]
| Parameter | Short | Default | Description |
|---|---|---|---|
--provider |
-p |
Default from config file | LLM provider (deepseek-openai, deepseek-anthropic or custom name) |
--model |
-m |
Default from config file | Model ID |
--mode |
-M |
agent |
Run mode (plan, agent, yolo) |
--thinking |
-t |
off |
Thinking level (off, minimal, low, medium, high, xhigh) |
--multi-agent |
- | false |
Enable multi-agent tools and commands |
--delegate |
- | false |
Enable delegation mode (blocking single sub-agent tool) |
--workflows |
- | false |
Enable Elisp workflow tools and /workflows commands |
| Parameter | Short | Description |
|---|---|---|
--continue |
-c |
Continue most recent session |
--resume |
-r |
Resume session by ID or path |
--session |
- | Use specific session ID or .db handle file |
| Parameter | Short | Description |
|---|---|---|
--print |
-P |
Non-interactive mode, print response and exit. If a tool would require approval, the command exits with an error instead of auto-approving. |
--verbose |
- | Verbose output |
--debug |
- | Enable debug logging, provider request/response debug output, and local pprof at 127.0.0.1:6060 |
| Parameter | Description |
|---|---|
--sandbox |
Enable sandbox (bubblewrap) |
--no-sandbox |
Disable sandbox (deprecated, disabled by default) |
| Parameter | Short | Description |
|---|---|---|
--init-serve |
- | Create serve.json config template |
--init-a2a-master-config |
- | Create a2a-list.json config template |
--enable-a2a-master |
- | Enable A2A master mode (remote agent dispatch) |
--force |
- | Force overwrite existing files (used with --init-*) |
--version |
-v |
Show version |
--help |
-h |
Show help |
Run MothX as an ACP-compliant stdio agent for IDE integration.
mothx acp [flags]
Supports VS Code, JetBrains IDEs, and any ACP-compatible editor.
| Flag | Short | Default | Description |
|---|---|---|---|
--provider |
-p |
From config | LLM provider |
--model |
-m |
From config | Model ID |
--mode |
-M |
agent |
Run mode (plan, agent, yolo) |
--thinking |
-t |
From config | Thinking level |
--sandbox |
- | false | Enable sandbox |
--verbose |
- | false | Verbose output |
--debug |
- | false | Debug logging and local pprof |
--multi-agent |
- | false | Enable multi-agent tools for ACP sessions |
--delegate |
- | false | Enable delegation mode for ACP sessions |
--workflows |
- | false | Enable Elisp workflow tools for ACP sessions |
See the ACP Protocol documentation for IDE integration details.
Run the standalone A2A (Agent-to-Agent) protocol server.
mothx a2a [command]
| Subcommand | Description |
|---|---|
start |
Start A2A server |
stop |
Stop A2A server |
status |
Show server status |
card |
Show/generate Agent Card |
send <message> |
Send task to remote A2A server |
discover <url> |
Discover remote Agent Card |
--init-a2a-config |
Create a2a.json config template |
--force |
Force overwrite existing config file |
See A2A Protocol documentation for details.
Start MothX as a unified server exposing an OpenAI-compatible Chat Completions API, Web UI, and optional WeChat/Feishu/WebSocket messaging channels.
mothx serve [flags]
| Flag | Short | Default | Description |
|---|---|---|---|
--port |
- | 8080 |
Listen port or address, e.g. 8080 or 0.0.0.0:8080 (overrides serve.json) |
--config |
- | - | Path to serve.json |
--unsafe |
- | false | Disable auth and bind Serve to all interfaces |
--work-dir |
- | Current directory | Default working directory |
--provider |
-p |
From config | LLM provider |
--model |
-m |
From config | Model ID |
--sandbox |
- | false | Enable sandbox (bwrap) |
--multi-agent |
- | false | Enable multi-agent tools |
--delegate |
- | false | Enable delegation mode |
--workflows |
- | false | Enable Elisp workflow tools |
--lobster |
- | false | Enable yolo mode, disable sandbox, and enable sub-agents |
--verbose |
- | false | Verbose output |
--debug |
- | false | Debug logging and local pprof |
| Subcommand | Description |
|---|---|
| `init-config [global | project]` |
--force |
Force overwrite existing config file |
See Serve Mode documentation for details.
Start the usage dashboard, or print token and request statistics directly in the terminal.
mothx stats [flags]
| Flag | Short | Default | Description |
|---|---|---|---|
--addr |
- | 127.0.0.1:7878 |
Listen address for the web dashboard |
--db |
- | Default sessions database | Path to sessions.db |
--cli |
- | false | Print stats in the terminal instead of starting the web server |
Examples:
mothx stats
mothx stats --cli
mothx stats --cli --db ~/.mothx/sessions/sessions.dbDiagnose your MothX environment: OS info, config files, providers, models, sandbox, MCP, and more.
mothx doctor
See the doctor section above for details.
Generate or refresh a project AGENTS.md file that documents project conventions for AI agents.
mothx systeminit [guidance...]
This CLI subcommand runs non-interactively. In TUI and ACP, /systeminit runs interactively and uses the question tool to ask clarifying questions before generating the file.
| Argument | Description |
|---|---|
guidance... |
Optional trailing guidance (e.g., ask me in Chinese, write AGENTS.md in English) |
Examples:
# Generate AGENTS.md with default behavior
mothx systeminit
# Generate with custom guidance
mothx systeminit ask me in Chinese, write in EnglishChecks performed:
- Environment: OS/arch, Go version, shell, home/working directory
- Configuration Files: Validates settings, serve, and MCP config files with parse checks
- Providers & Models: Lists configured providers with masked API keys, models with context window/max tokens/reasoning flags; verifies default provider initialization
- Sandbox: Checks bubblewrap availability and version
- MCP Servers: Lists configured MCP servers
- Sessions: Shows session directory and entry count
- Skills: Shows global and project skills directories
- Context Files: Discovers AGENTS.md, CLAUDE.md, CURSOR.md, .cursorrules, CONVENTIONS.md
mothx doctorSample output:
MothX Doctor
─────────────────
Environment
✅ OS / Arch — linux/amd64
✅ Go version — go1.24.4
✅ Shell — /bin/bash
✅ Home directory — /home/user
✅ Working directory — /home/user/project
Configuration Files
✅ Global settings — /home/user/.mothx/settings.json (1.2 KB)
⏭️ Project settings — .mothx/settings.json (not found)
...
Providers & Models
✅ Default provider — deepseek-openai
✅ Default model — deepseek-v4-flash
✅ Provider: deepseek-openai — api=openai-chat, base=https://api.deepseek.com, key=sk-a****xyz
✅ └─ deepseek-v4-flash — ctx=1M, max=384K ★ default
✅ Provider init — deepseek-openai/deepseek-v4-flash created successfully
Result: All 15 checks passed
# Interactive mode
mothx
# With initial prompt
mothx -P "Explain this codebase"
# Non-interactive mode
mothx -p "Write a Hello World"# Use DeepSeek (OpenAI API)
mothx --provider deepseek-openai --model deepseek-v4-flash
# Use DeepSeek (Anthropic API)
mothx -p deepseek-anthropic -m deepseek-v4-flash
# Use custom provider
mothx --provider my-custom-provider# Plan mode - read-only analysis
mothx --mode plan
# Agent mode - standard read/write (default)
mothx -M agent
# YOLO mode - full access
mothx -M yolo# Enable sub-agent tools and multi-agent commands
mothx --multi-agent
# ACP sessions can also opt in
mothx acp --multi-agentWhen enabled, MothX registers the subagent_* tools and exposes multi-agent workflows such as delegated background investigation. Cron command entry points also depend on multi-agent mode.
# Enable blocking single sub-agent delegation
mothx --delegate
# ACP sessions can also opt in
mothx acp --delegate
# Serve can opt in
mothx serve --delegateDelegate mode registers the delegate_subagent tool for synchronous, blocking sub-agent delegation. Unlike multi-agent (which runs async sub-agents in parallel), delegate mode runs one sub-agent at a time and waits for completion. Use it for bounded investigation tasks where the parent only needs a summarized result.
You can toggle delegation at runtime via /delegate [on|off|status] in TUI or serve slash commands.
# Disable thinking
mothx --thinking off
# Medium level
mothx -t medium
# Highest level
mothx --thinking xhigh# Continue most recent session
mothx --continue
mothx -c
# Resume specific session
mothx --resume session-abc123
mothx -r ~/.mothx/sessions/--encoded-working-directory--/20260625-120000_abcd1234.db
# Use specific session handle file
mothx --session ./20260625-120000_abcd1234.dbIn the TUI, startup without --continue, --resume, or --session does not create an empty session immediately. A new session is created when the first user message is sent. When an existing session is continued, resumed, or selected, its history is shown in the normal terminal scrollback.
# Enable sandbox
mothx --sandbox
# Disable sandbox (default)
mothx# Read from stdin
echo "Explain this code" | mothx -P
# Read from file contents directly
mothx -p "Explain this file: main.go"# Start ACP server (for IDE integration)
mothx acp
# ACP with specific model
mothx acp --provider deepseek-openai --model deepseek-v4-flash
# ACP with sandbox
mothx acp --sandbox --mode agentCommands available during interactive sessions:
| Command | Description |
|---|---|
/mode [plan|agent|yolo] |
Switch or show current mode |
/model [model_id] |
Switch or show current model |
/think |
Cycle thinking level |
/compact |
Trigger context compaction |
/delegate [on|off|status] |
Toggle or show delegate mode |
/systeminit [guidance] |
Generate or refresh project AGENTS.md |
/reload |
Restart with a fresh session (TUI) |
/btw <question> |
Ask a side question without interrupting main task |
/settings |
Configure settings.json groups, including providers, defaults, behavior, and approval |
/alloweditpath [add <glob>|remove <glob>|clear] |
Manage auto-edit path whitelist |
/allowautoedit [on|off] [global] |
Toggle full auto-edit in agent mode |
/agent list |
List sub-agents in multi-agent mode |
/agent switch <id> |
Switch the active sub-agent |
/agent destroy <id> |
Destroy a sub-agent |
| Command | Description |
|---|---|
/sessions |
Open the interactive session picker |
/sessions ls |
List sessions for the current project |
/sessions set <id> |
Switch to a session by ID prefix |
/sessions clear |
Start fresh; the new session is created on the next message |
/sessions del <id> |
Delete a session by ID prefix |
/clear |
Clear conversation |
The /sessions picker supports Up/Down to select, Enter to switch, n to start fresh, d to delete the selected session, and Esc to close.
| Command | Description |
|---|---|
/skills |
List available skills |
/skill <name> |
Activate a skill by name |
/skill:<name> |
Activate a skill (alternative syntax) |
| Command | Description |
|---|---|
/help |
Show help |
/quit |
Exit |
| Shortcut | Function |
|---|---|
Enter |
Submit the current prompt |
Alt+Enter / Ctrl+J |
Insert a newline in the prompt editor |
Tab |
Cycle mode (plan → agent → yolo) |
Esc |
Abort current operation, approval, or question prompt |
Ctrl+O |
Open latest tool/details modal; press again, Esc, or q to close |
Ctrl+E |
Open the ESM progress panel; press again, Esc, or q to close |
Ctrl+G |
Toggle compact tool display mode |
Up / Down |
Move within multiline input; browse prompt history at the first/last input line; scroll an open details/progress panel |
PgUp / PgDn |
Page through an open details/progress panel |
Home / End |
Move to the start/end of the current input line; jump to top/bottom in an open details/progress panel |
Default settings can be overridden via environment variables:
| Variable | Description |
|---|---|
DEEPSEEK_API_KEY |
DeepSeek API key |
VIBECODING_DIR |
Override config directory |
VIBECODING_PROVIDER |
Override default provider |
VIBECODING_MODEL |
Override default model |
VIBECODING_MODE |
Override default mode |
VIBECODING_THINKING |
Override default thinking level |
VIBECODING_USER_AGENT |
Custom User-Agent string |
| Code | Description |
|---|---|
| 0 | Success |
| 1 | General error |
| 2 | Usage error |
| 130 | User interrupt (Ctrl+C) |