AI Terminal Helper
Turn selected code into a ready-to-paste request and open a per-project terminal for the Claude Code or Codex CLI.
- Build a Markdown request from your selection: file path, line range, code, and an instruction.
- Open Claude or Codex terminals that are reused per project, command, and launch setting.
- Register several Claude commands (for example
claude-1, claude --model opus) and pick one when opening.
- Run per-project pre-launch commands, such as activating a Python virtual environment, before the AI CLI starts.
- Save favorite instructions for quick reuse.
The extension never submits a request automatically and never calls an AI API itself. It only opens a terminal, starts your CLI, and copies the request to the clipboard.
Requirements
- VS Code 1.85.0 or later.
- At least one of these CLIs installed, on your
PATH, and already signed in:
- A project folder open in a trusted workspace. The extension does not run in Restricted Mode.
- If you set a specific shell, that shell must be installed:
pwsh needs PowerShell 7, and bash needs a bash executable such as Git Bash on Windows. The default shell needs nothing extra.
- In Remote or WSL sessions, install the CLI in the remote environment, because the extension runs there.
Getting Started
- Open a project folder and select some code.
- Press Ctrl+Alt+A (Cmd+Alt+A on macOS), or right-click and choose AI Terminal: Create Request from Selection.
- Pick a request type (or Write your own) and add any conditions.
- Review and edit the generated Markdown request: file path, line numbers, and code.
- Click Copy Request and Open Terminal at the top of the editor.
- Pick a Claude command or Codex. When the AI prompt is ready, press Ctrl+V and then Enter.
The AI Terminal item in the status bar opens a menu with every command. You can also open terminals directly from there or add favorite instructions. Saving a favorite with an existing name replaces it.
Built-in request types
| Type |
What it asks for |
| Fix Error |
Find and fix the cause of the error, then run available tests. |
| Refactor |
Improve readability without changing external behavior. |
| Write Tests |
Write and run tests for main behavior and edge cases. |
| Explain Code |
Explain how the code works, without modifying files. |
| Review Code |
Report real bugs and missing validation, without modifying files. |
Commands
| Command |
Description |
| AI Terminal: Menu |
Show all commands. Also available from the status bar. |
| AI Terminal: Create Request from Selection |
Build a request from the selected code. |
| AI Terminal: Copy Request and Open Terminal |
Copy the current request and open a Claude or Codex terminal. |
| AI Terminal: Open Claude |
Open (or reuse) a Claude terminal. |
| AI Terminal: Open Codex |
Open (or reuse) a Codex terminal. |
| AI Terminal: Open with Launch Options |
Open with saved settings, a plain launch, or one-off options. |
| AI Terminal: Open in New Terminal |
Always create a new terminal with saved settings. |
| AI Terminal: Configure Project Launch |
Set the start folder, shell, and pre-launch commands for a project. |
| AI Terminal: Configure Claude Commands |
Manage the list of Claude launch commands. |
| AI Terminal: Add Favorite Instruction |
Save an instruction for later requests. |
Terminal Reuse
Terminals opened by the extension are reused per project, tool, launch command, and launch setting. When a terminal is reused, pre-launch commands and the AI command are not typed again. If you exited the CLI or want to rerun setup, use Open in New Terminal. Terminals you opened yourself, or terminals from an earlier VS Code session, are not attached automatically.
Claude Commands
Use AI Terminal → Configure Claude Commands to add commands other than claude, such as claude-1, claude-2, or claude --model opus. Select a command in the list to edit it, or confirm an empty value to remove it. Choose Done to save the list to the user setting aiTerminal.claudeCommands. If you clear everything, only claude is used.
{ "aiTerminal.claudeCommands": ["claude", "claude-1", "claude-2"] }
- With one command, Open Claude starts it right away. With two or more, you choose which one to run. The most recently used command is listed first, so pressing Enter opens it.
- Copy Request and Open Terminal, Open with Launch Options, and Open in New Terminal list every Claude command (for example
Claude: claude-1) together with Codex.
- The terminal name shows the command, for example
Claude (claude-1) · my-project, and each command gets its own reusable terminal.
- Commands are typed into the terminal shell as-is. PowerShell profile functions (for example a
claude-1 function that changes CLAUDE_CONFIG_DIR) only work in a PowerShell shell that loads your profile. CMD and Bash cannot find them. Windows PowerShell and PowerShell 7 use different profile files.
Project Launch Settings
Use AI Terminal → Configure Project Launch to choose the start folder, the shell, and the pre-launch commands. Commands run in list order. Select a command in the list to edit it, or confirm an empty value to remove it. Choose Done to save to the project's .vscode/settings.json. If you cancel partway through, nothing is saved.
- Open Claude, Open Codex, and Copy Request and Open Terminal use the settings saved for the project.
- Open with Launch Options lets you choose saved settings, a plain launch, or options for this launch only. A plain launch uses the project root, the VS Code default shell, and no pre-launch commands.
- Open in New Terminal creates a new terminal with the saved settings. Existing terminals stay open.
- Projects without settings start the AI CLI directly. When settings change, the next launch creates a different terminal. A terminal with identical settings is reused if it already exists.
Example: activate the project's .venv in PowerShell.
{
"aiTerminal.launch": {
"cwd": "",
"shell": "powershell",
"beforeCommands": ["& '.\\.venv\\Scripts\\Activate.ps1'"]
}
}
Setting cwd to backend starts in the project's backend folder, and relative paths in pre-launch commands resolve from there. Absolute paths and ${workspaceFolder}/backend also work. Other ${...} variables are not supported. In a multi-root workspace, the extension uses the settings of the project that contains the active file, and asks you to pick a project when that is unclear.
Virtual environment activation by shell:
| Shell setting |
Pre-launch command |
powershell / pwsh |
& '.\.venv\Scripts\Activate.ps1' |
cmd |
call ".\.venv\Scripts\activate.bat" |
bash |
source .venv/bin/activate |
Pre-launch commands require an explicit shell. default is only allowed when there are no pre-launch commands. The shell and the virtual environment must already exist. In Remote or WSL sessions, use paths and shells from the remote environment. The bash option runs the bash executable of the current environment. It does not switch to WSL.
Pre-launch commands and the AI CLI run in the same terminal shell, so the AI CLI inherits the activated environment. Put one command that finishes on its own in each item. If a command fails, the remaining commands and the AI CLI do not run. PowerShell checks for errors and for the exit codes of external programs. CMD and Bash check whether each command succeeded. Failures hidden inside compound commands or scripts cannot be detected, so scripts must report their own failures. Long-running commands such as servers block the following steps, so run them in a separate terminal. The extension does not change your PowerShell execution policy.
Settings
| Setting |
Scope |
Default |
Description |
aiTerminal.launch |
Project |
{ "cwd": "", "shell": "default", "beforeCommands": [] } |
Start folder, shell, and pre-launch commands. |
aiTerminal.claudeCommands |
User |
["claude"] |
Commands that start a Claude terminal. |
aiTerminal.codexCommand |
User |
"codex" |
Command that starts a Codex terminal. |
The CLIs use your existing sign-in and configuration.
Notes
- Requests are kept in memory and disappear when VS Code closes or reloads. Use Save As to keep one.
- If the selected code has unsaved changes, the request says so.
- The extension does not submit requests automatically or send code anywhere by itself.
Development
Run node test.cjs and node launch.test.cjs to test, and python build.py to build the VSIX. On Windows, the launch tests activate a real temporary virtual environment in PowerShell and CMD, then check the Python path and that a failure stops the launch.