The official MothX extension for Visual Studio Code — an AI coding agent powered by the Agent Client Protocol (ACP). Chat with MothX directly from your editor, let it read and edit files, run commands, and manage your sessions all from a dedicated sidebar.
- First-class MothX integration: ships with MothX pre-configured — just connect and start chatting
- Multi-session support: each agent in the Agents view is expandable into its previous sessions. Click a session to restore its history in the chat. Backed by
session/listwhen the agent supports it, or by a local per-workspace cache otherwise - Session Config Options: dynamic per-session selectors (mode, model, reasoning level, …) advertised by the agent are rendered automatically in the composer toolbar
- Interactive Chat: built-in chat panel with Markdown rendering, inline tool call display, and collapsible tool sections
- Thinking Display: see agent reasoning in a collapsible block with streaming animation and elapsed time
- Slash Commands: autocomplete popup for agent-provided commands with keyboard navigation
- Mode & Model Picker: switch agent modes and models directly from the chat toolbar
- File System Integration: MothX can read and write files in your workspace
- Terminal Execution: MothX can run commands with terminal output display
- Permission Management: configurable auto-approve policies for agent actions
- Protocol Traffic Logging: inspect all ACP JSON-RPC messages with request/response/notification labels
- Chat Persistence: conversations are preserved when switching panels
- Install the MothX extension
- Make sure the
mothxCLI is installed and available on yourPATH(see MothX) - Open the MothX panel from the Activity Bar
- Click MothX to connect
- Start chatting!
- Node.js 18+
- The
mothxCLI installed and on yourPATH - VS Code 1.85+
The extension comes pre-configured with MothX:
| Agent | Command |
|---|---|
| MothX | mothx acp --mode agent |
You can add more ACP-compatible agents in settings if you wish.
| Setting | Default | Description |
|---|---|---|
mothx.agents |
{ MothX } |
Agent configurations. Each key is the agent name, value has command, args, and env. |
mothx.autoApprovePermissions |
ask |
How agent permission requests are handled: ask or allowAll. |
mothx.defaultWorkingDirectory |
"" |
Default working directory for agent sessions. Empty uses the current workspace. |
mothx.logTraffic |
true |
Log all ACP protocol traffic to the MothX Traffic output channel. |
All commands are accessible via the Command Palette (Ctrl+Shift+P):
| Command | Description |
|---|---|
MothX: Connect to Agent |
Connect to an agent |
MothX: New Conversation |
Start a new conversation with the connected agent |
MothX: Send Prompt |
Send a message to the agent |
MothX: Cancel Current Turn |
Cancel the current agent turn |
MothX: Disconnect Agent |
Disconnect from the current agent |
MothX: Restart Agent |
Restart the current agent process |
MothX: Open Chat Panel |
Focus the chat webview |
MothX: Add Agent Configuration |
Add a new agent to settings |
MothX: Remove Agent |
Remove an agent configuration |
MothX: Set Agent Mode |
Change the agent's operating mode |
MothX: Set Agent Model |
Change the agent's model |
MothX: Refresh Sessions |
Re-fetch the session list for an agent |
MothX: Show Log |
Open the MothX log output channel |
MothX: Show Protocol Traffic |
Open the MothX Traffic output channel |
MothX: Browse Agent Registry |
Browse the ACP agent registry |
| Shortcut | Action |
|---|---|
Ctrl+Shift+A (Cmd+Shift+A on Mac) |
Open Chat Panel |
Escape (when a turn is in progress) |
Cancel Current Turn |
- Node.js 18+
- VS Code 1.85+
npm installnpm run compile # One-time build
npm run watch # Watch mode for development
npm run dev # Launch a VS Code Extension Development Host with the MothX extension loaded (auto-recompiles on save)You can also open a specific workspace in the dev host:
npm run dev -- /path/to/your/projectAlternatively, open the project in VS Code and press F5 to launch the Extension Development Host (this uses the bundled .vscode/launch.json and also starts the webpack watch task).
npm run pretest # Compile tests + lint
npm test # Run testsnpm run package # Production build
npx @vscode/vsce package # Create .vsixThe extension follows a modular architecture:
- Core:
AgentManager,ConnectionManager,SessionManager,AcpClientImpl - Handlers:
FileSystemHandler,TerminalHandler,PermissionHandler,SessionUpdateHandler - UI:
SessionTreeProvider,ChatWebviewProvider,StatusBarManager - Config:
AgentConfig,RegistryClient - Utils:
Logger,StreamAdapter
Communication with agents uses the ACP protocol (JSON-RPC 2.0 over stdio).
MIT — see LICENSE for details.