AICmd — AI SSH / RDP Terminal, Remote Desktop & Agent for VS CodeOne extension for AI-powered SSH terminals, Windows remote desktops, and local shells — right inside VS Code. Connect to servers via SSH, open a graphical Windows desktop via RDP, let an AI agent run commands and analyze logs in natural language, transfer files (SFTP / ZMODEM / RDP clipboard), audit every command, and run batch jobs — without leaving your editor. 中文文档 · GitHub repository · Report an issue
Screenshot
Features
Quick Start
No separate AICmd installation is needed — the distributed extension ships its own front-end and backend, starts the backend on demand on Why AICmd instead of a plain terminal / RDP client?
How It Works
Requirements
Installing the ExtensionFrom a packaged
|
| Method | Steps |
|---|---|
| Copy files locally + paste (recommended) | Copy files in your OS file manager (Finder / Explorer), click the remote desktop once to focus it, then press Ctrl/Cmd + V inside the remote desktop. The files are picked up from the native paste event and sent to the remote immediately — one keystroke, no extra dialog. This works in the VSCode extension too (a hidden editable paste target is used inside the WebView so the cross-origin iframe still receives the file clipboard). |
| Toolbar upload | Click the upload (📤) button in the RDP toolbar, choose one or more files, then press Ctrl/Cmd + V inside the remote desktop (or right-click → Paste in the target folder) to complete the transfer. A toast reminds you of this step. |
| Drag & drop | Drag files from your OS onto the remote desktop canvas, then press Ctrl/Cmd + V inside the remote desktop to paste them. |
After a transfer starts, the file transfer panel at the bottom of the desktop shows each file's name and status (waiting for remote paste → transferred). Large files are streamed in chunks.
macOS:
Cmd + Vis mapped to the remote WindowsCtrl + V, so the standard Mac copy/paste shortcuts work as expected.VSCode extension: direct local-copy → paste works here as well. The WebView uses a hidden editable target to capture the native
pasteevent (withclipboardData.files) inside the cross-origin iframe, so you do not need to use the toolbar as a workaround. If a particular host still blocks file clipboard access, the toolbar upload button remains as a fallback.
Copying files OUT of the remote desktop
Copy files inside the remote Windows (e.g. in Explorer), then click the download (📥) button in the RDP toolbar. The button becomes active as soon as the remote clipboard contains files; clicking it saves them to your local Downloads folder.
Manage connections
All connection management reuses the same backend and storage as the desktop / CLI app:
- Add connection: click the + button in the view title bar (or run
aicmd.addConnection). A dedicated connection-editor WebView opens; pick SSH or RDP, fill in host/port/auth and save. RDP defaults to port 3389 and an empty username; SSH defaults to port 22 androot. - Edit connection: right-click a connection → Edit, or run
aicmd.editConnection. The same editor WebView opens pre-filled. After saving, the tree refreshes automatically and the editor closes. - Delete connection: right-click a connection → Delete, or run
aicmd.deleteConnection. A confirmation dialog appears; confirming removes the connection via the backend API and refreshes the tree. - Refresh: click the ⟳ button in the view title bar (or run
aicmd.refresh) to re-read the connection list from the backend. - Search: click the magnifier in the view title (or run
aicmd.searchConnection) to filter by name / group / tag and open a connection directly. - Grouping mode: click the grouping icon in the view title (or run
aicmd.setGroupMode) to collapse the tree by connection group or by tag. The choice is persisted in extension state. - Export JSON: click the download icon in the view title (or run
aicmd.exportConnections) → choose whether to include secrets → save the.jsonfile. Secrets are omitted by default (safe to share with a team); backups containing credentials are for personal use only — store them carefully. - Import JSON: click the upload icon in the view title (or run
aicmd.importConnections) → pick a JSON file and confirm. Same-name connections are overwritten, others are kept; a summary reports added / updated / skipped counts. Imported connections get new IDs and secrets are re-encrypted with the local key.
The connection editor is the same
ConnectionEditorcomponent used by the desktop app. By default it only shows name, type, host / port, username and auth; Group & Tags, Advanced Options (platform / RDP domain and size), Startup Script, Port Forwards, Keepalive, Terminal Appearance and Proxy Settings are all collapsible optional sections (already-configured sections auto-expand with a badge when editing). SSH startup scripts / agent forwarding for jump hosts and Proxy Settings (direct, system or custom HTTP / HTTPS / SOCKS4 / SOCKS5 for SSH and RDP; see Proxy Guide) remain fully supported. The extension shares the desktop backend, so the proxy connection is established by the local server and is independent of browser proxy settings.
Configure AI
- In the terminal WebView, click the robot icon (bottom-left sidebar) or the gear icon in the AI chat header.
- Enter your API Key and Base URL (OpenAI, DeepSeek, Qwen, or any compatible endpoint).
- Choose a model (default:
gpt-4o-mini) and save. - You can now chat with the AI Agent in natural language — it observes terminal output, runs commands, and iterates until the task is done.
Add a terminal to your editor's AI chat
In a connected AICmd terminal, right-click and choose Add to AI Chat:
- Selected terminal text (or the most recent 200 lines when nothing is selected) is inserted into the chat input as an
@Terminalcontext chip; nothing is sent automatically. - That terminal is exclusively bound to this conversation. A terminal indicator appears in the VSCode status bar; click it to detach.
- The bound terminal's channel info travels with the reference as
[channel](session / connection / machine),[bridge](one-shot command),[tools], and[valid]. No user-level MCP config is written; disabling the extension or detaching leaves nothing behind. - The AI gets AICmd tools. You can now ask something like "show me the nginx site config" — the AI checks the machine, reads the screen, runs commands, and summarizes the result.
Tool choice: prefer tools registered by the host — native VSCode uses aicmd_sessionInfo, aicmd_sessionRead, aicmd_sessionExec, aicmd_sessionOutput, aicmd_sessionInterrupt, aicmd_sessionDetach (reference with #aicmdExec); other editors use session_info, session_read, session_exec, session_output, session_interrupt, session_detach. Read truncated output in chunks instead of rerunning the command.
One-shot bridge: if the current agent cannot see those tools (for example, the CodeBuddy IDE agent filters extension tools), use the [bridge] command from the reference:
node "<extension-dir>/dist/mcp.js" --call session_exec '{"command":"uptime"}'
It only targets the currently bound terminal and returns NO_BINDING after detach. No MCP config edit and no hand-written HTTP requests are needed.
- Trae: attaches a terminal payload to Cascade through
workbench.action.chat.icube.open. - Stock VSCode 1.105+: adds the bound terminal as a single file reference named after the connection, with no extra prompt text; older versions fall back to a tool reference or the text snapshot.
- Cursor and Windsurf: prefill the chat input with
workbench.action.chat.open; nothing is sent automatically. - Cline, Continue and Roo Code: focus the plugin's chat input and paste the snapshot; nothing is sent automatically.
- In stock VSCode the menu appears only after one of those AI chat extensions is active. If the plugin is started later, the menu appears without reloading the terminal.
- The snapshot is captured when you click the menu item; choose the action again to refresh it.
- Tongyi Lingma: use the tool names or the
[bridge]command in the reference while in agent mode. Its MCP limit is 10 servers; this plugin occupies only a temporary entry and writes no config file.
Safety boundaries: only one terminal is bound at a time; commands are typed into your visible interactive shell and audited; dangerous commands are blocked; tools themselves receive no session/connection id — channel info is only carried by this reference and becomes invalid on detach. Press Ctrl+C in the terminal or click the status bar terminal indicator to detach at any time.
File download (sz / ZMODEM)
When a terminal session triggers a file download (e.g. sz file), the WebView posts a save request to the extension host. VSCode shows a native Save As dialog; choose a destination and the file is written to disk.
Stopping the backend
The backend child process starts on demand and stops automatically when all AICmd WebView panels are closed (and no editor panel is open). It also stops when the extension is deactivated. If the backend crashes unexpectedly, all panels close and an error notification is shown; re-open a connection to restart it.
Settings
Open Settings → Extensions → AICmd (or add to settings.json):
| Setting | Type | Default | Description |
|---|---|---|---|
aicmd.dataDir |
string | ~/.aicmd |
Data directory for connections / sessions / AI config / audit logs. Leave empty to share the desktop / CLI ~/.aicmd. |
aicmd.startPort |
number | 9802 |
Starting port used when launching the AICmd service inside VSCode. If occupied, the extension scans forward for a free port. |
Changing
aicmd.dataDiroraicmd.startPortrequires reloading the VSCode window to take effect (a notification prompts you to reload).
Environment Variables
AICMD_NODE: Path to thenodeexecutable used to launch the backend. By default the extension prefers the VSCode host runtime (Electron), then falls back to nvm / Homebrew / system node. Set this only if auto-detection fails.AICMD_DATA_DIR: Overrides the data directory for connections / sessions / AI config / audit logs (default~/.aicmd). Takes precedence overaicmd.dataDirsetting.AICMD_AUTH_DISABLED: Set to1to disable local token authentication (rarely needed).
The local-shell entry uses the special connection id
__local__, which makes the backend spawn a local terminal session directly.
Local Development
# 1. Install dependencies (ensure node-pty is compiled for your local Node)
pnpm install
# 2. Build the front-end + backend (produces dist/)
pnpm build-only
# 3. Install the extension's own build deps and compile the extension host
cd packages/vscode
npm install # installs esbuild / @types/vscode / vsce
npm run compile # or `npm run watch` for continuous rebuild
cd ../..
# 4. Press F5 in VSCode to launch the "Extension Development Host"
The F5 launch uses a preLaunchTask that automatically runs pnpm build:vscode (front-end + backend + extension host together).
Packaging & Publishing
pnpm build:vscode # build front-end + backend + extension host
node scripts/prepare-vscode-runtime.mjs
cd packages/vscode
vsce package # produce a .vsix
vsce publish
The distributed package must include the runtime (
server.js,dist/includingrdp_client_bg.wasm,data/skills, andnode_moduleswith the nativenode-pty). Marketplace / Open VSX releases are built by CI, which runsnode scripts/prepare-vscode-runtime.mjsto copy the runtime intopackages/vscode/runtime/before packaging. For a local manual build, run that script beforevsce package— the extension automatically prefers that directory when present.
Notes
- The extension's backend listens only on
127.0.0.1, and the WebView loads the front-end from the same origin, so no network exposure or token is required. - RDP targets are always taken from the saved connection config, never from the browser client — a malicious page cannot redirect the tunnel to an arbitrary host.
- Backend logs are written to the Output panel → channel AICmd for troubleshooting startup issues.
- The WebView follows your VSCode color theme (light / dark / high-contrast) and interface language automatically.
Support & Feedback
- Questions: the Q&A tab on the Marketplace page.
- Bugs & feature requests: GitHub Issues.
- 中文文档:README.zh.md。
