Claude Existing Terminal Auto Start
English | 日本語
English
Runs claude --permission-mode auto once in an existing restored terminal
when a VS Code window starts.
Features
- Does not run in an empty window (no folder opened), which prevents the
workspace-trust prompt from appearing for a temporary folder.
- When no restored terminal exists (e.g. a folder opened for the first
time), a new terminal is created and the command runs there
(can be disabled with
createTerminalIfNone).
- If the workspace is not yet trusted, it waits and runs as soon as trust
is granted.
- Restored terminals are detected via the
onDidOpenTerminal event, so
the command runs as soon as the terminal appears — no polling.
- Shell-agnostic: works with PowerShell, Command Prompt, Git Bash, WSL, etc.
- Prefers the active existing terminal.
- Skips terminals whose name contains
claude to avoid starting twice.
Manual run
Run the following from the Command Palette:
Claude: Run in Existing Terminal Now
This sends the Claude Code startup command to the existing active
terminal without creating a new one.
Settings
claudeExistingTerminal.enabled — enable/disable automatic run.
claudeExistingTerminal.command — command to send
(default: claude --permission-mode auto).
claudeExistingTerminal.startupDelayMs — delay before sending the
command after the terminal process is available (default: 1200).
claudeExistingTerminal.restoreWaitMs — maximum time to wait for a
restored terminal before falling back (default: 10000).
claudeExistingTerminal.createTerminalIfNone — create a new terminal
when none is restored (default: true).
claudeExistingTerminal.skipWhenTerminalNameContains — skip terminals
whose name contains any of these strings (default: ["claude"]).
To start Claude in normal (non-auto) mode:
{
"claudeExistingTerminal.command": "claude"
}
If terminal restoration is slow in your environment:
{
"claudeExistingTerminal.startupDelayMs": 2000,
"claudeExistingTerminal.restoreWaitMs": 15000
}
日本語
VS Codeのウィンドウ起動時に、復元された既存ターミナル上で
claude --permission-mode autoを一度だけ実行します。
特徴
- フォルダを開いていない空のウインドウ(新規起動)では実行しません。
テンポラリフォルダへの信頼確認が出るのを防ぎます。
- 「フォルダーを開く」で新規に開いた場合など、復元ターミナルが
存在しないときは新しいターミナルを作成して実行します
(
createTerminalIfNoneで無効化できます)。
- ワークスペースが未信頼の間は待機し、信頼が付与された時点で実行します。
- 復元ターミナルは
onDidOpenTerminalイベントで検知するため、
ターミナルが現れた瞬間に実行されます(ポーリングなし)。
- PowerShell、コマンドプロンプト、Git Bash、WSLなどのシェルを固定しません。
- アクティブな既存ターミナルを優先します。
- ターミナル名に
claudeが含まれる場合は、二重起動を避けるためスキップします。
手動実行
コマンドパレットで次を実行します。
Claude: Run in Existing Terminal Now
このコマンドも新しいターミナルを作成せず、既存のアクティブな
ターミナルへClaude Code起動コマンドを送信します。
設定
claudeExistingTerminal.enabled — 自動実行の有効/無効。
claudeExistingTerminal.command — 送信するコマンド
(既定: claude --permission-mode auto)。
claudeExistingTerminal.startupDelayMs — ターミナルプロセス確認後、
コマンド送信までの待機時間(既定: 1200)。
claudeExistingTerminal.restoreWaitMs — 復元ターミナルを待つ最大時間。
超過するとフォールバックします(既定: 10000)。
claudeExistingTerminal.createTerminalIfNone — 復元ターミナルが無い
場合に新規作成するか(既定: true)。
claudeExistingTerminal.skipWhenTerminalNameContains — 名前にこれらの
文字列を含むターミナルをスキップ(既定: ["claude"])。
通常モードで起動したい場合は、コマンドを上書きできます。
{
"claudeExistingTerminal.command": "claude"
}
ターミナルの復元が遅い環境では、待機時間を延ばせます。
{
"claudeExistingTerminal.startupDelayMs": 2000,
"claudeExistingTerminal.restoreWaitMs": 15000
}