Claude Layout Session
Never lose your Claude Code sessions again. Save your terminal layout — restore it instantly.
All commands are available via Ctrl+Shift+P → type Claude Layout
If you use Claude Code daily, you know the pain: you close VS Code, your terminals vanish, and you're stuck re-opening Claude and losing the thread of every conversation. Claude Layout Session fixes that in one keystroke.
What It Does
Claude Layout Session tracks your active Claude Code terminals — capturing session IDs, models, and working directories — and lets you restore them exactly as they were, even after VS Code restarts.
- Your conversations don't die when your editor does
- No more copying session IDs manually
- No more
claude --resume <id> hunting through history
- Works with PowerShell, WSL, and Linux terminals side by side
- Terminals restore silently in the background — no visible paste, no flicker
- Open a new workspace? The extension offers to create a Claude terminal for you
Features
| Feature |
Description |
| Save layout |
Captures every running claude terminal: session ID, model, working directory |
| Silent restore |
Terminals open hidden, launch Claude, then appear ready — no visible typing |
| Parallel restore |
All terminals start simultaneously, not one by one |
| New Terminal |
Create a new Claude terminal with guided setup (model + permissions) |
| Auto session capture |
Automatically detects and saves new session IDs in background |
| Toggle Danger Mode |
Enable/disable --dangerously-skip-permissions per terminal or globally |
| Change Model |
Switch model (opus/opus[1m]/sonnet/sonnet[1m]/haiku) for all or specific terminals with optional redeploy |
| Smart startup |
Detects if layout exists → offers restore. No layout → offers to create one |
| Status bar indicator |
Shows how many sessions are saved, always visible |
| Startup notification |
Toast on VS Code start with one-click restore |
| PowerShell integration |
wtsave, wtrestore, wtlist — control from the terminal itself |
| WSL support |
Detect all WSL distros (Ubuntu, Debian, Kali, Fedora, openSUSE, etc.) |
| Linux native |
Full support for VS Code Remote SSH and native Linux environments |
| No duplicates |
Terminals already open are skipped — safe to restore any time |
Quick Start
1. Install the extension
2. Open a workspace — two scenarios:
- New workspace (no sessions saved): a notification asks "Create a new Claude terminal?" — pick a model and start working
- Existing sessions: a notification offers one-click restore
3. Save your sessions
- Open Command Palette (
Ctrl+Shift+P) → Claude Layout: Save Sessions
- Or run
wtsave in your PowerShell terminal
4. Restore after restart
- Press
Ctrl+Alt+T
- Or click the notification that appears on startup
- Or run
wtrestore in your terminal
Commands
| Command |
Keybinding |
Description |
Claude Layout: New Terminal |
— |
Create a new Claude terminal with guided setup |
Claude Layout: Save Sessions |
— |
Save current Claude terminal sessions |
Claude Layout: Restore Sessions |
Ctrl+Alt+T |
Restore saved sessions silently in background |
Claude Layout: Toggle Danger Mode |
— |
Enable or disable --dangerously-skip-permissions |
Claude Layout: Change Model |
— |
Switch model for all or specific terminals |
Claude Layout: List Terminals |
— |
Show diagnostic info about open terminals |
New Terminal
Run Claude Layout: New Terminal from the Command Palette to create a fresh Claude terminal:
- Select model:
opus, opus[1m], sonnet, sonnet[1m], or haiku
- Danger mode: enable or disable
--dangerously-skip-permissions
- Terminal is created and Claude starts
The session ID doesn't exist yet — it's created when you start your first conversation. The extension runs an auto-save in background:
- Checks every 2 minutes for new session IDs
- Stops after capturing all IDs or after 10 attempts
- No action needed from you — it just works
Toggle Danger Mode
Run Claude Layout: Toggle Danger Mode from the Command Palette:
- Choose Enable or Disable
- Apply to all terminals or a specific one
- Choose whether to redeploy now or just save the config
The setting is persisted in .vscode/terminal-state.json and applied on every restore.
Change Model
Run Claude Layout: Change Model to switch the Claude model:
- Pick a model:
opus, opus[1m], sonnet, sonnet[1m], or haiku (1M variants offer extended context)
- Apply to all terminals or a specific one
- Choose whether to redeploy now (closes and reopens affected terminals) or just save
Useful when you're running low on tokens and need to switch everything to sonnet fast.
How It Works
- Save scans running
claude.exe processes, matches them to VS Code terminals via shell PID, and extracts the real conversation ID from --resume flags. Data is written to .vscode/terminal-state.json.
- Restore creates all terminals hidden simultaneously, waits for shells to be ready, sends the
claude --resume command to all at once, then reveals them after Claude has initialized.
- New Terminal creates a Claude instance with your chosen config and saves it with a pending session ID. Auto-save captures the real ID once you start a conversation.
- Terminals already open are skipped automatically.
PowerShell Profile Integration
Add to your $PROFILE for full terminal-level control:
function wtsave {
$root = (Get-Location).Path
$trigger = Join-Path $root ".vscode\.wt-save-trigger"
"save" | Set-Content $trigger -NoNewline
Start-Sleep -Seconds 5
$state = Join-Path $root ".vscode\terminal-state.json"
if (Test-Path $state) { Get-Content $state -Raw | ConvertFrom-Json | ConvertTo-Json -Depth 5 }
}
function wtrestore {
$root = (Get-Location).Path
$trigger = Join-Path $root ".vscode\.wt-restore-trigger"
"restore" | Set-Content $trigger -NoNewline
}
function wtlist {
$root = (Get-Location).Path
$trigger = Join-Path $root ".vscode\.wt-list-trigger"
$result = Join-Path $root ".vscode\.wt-list-result"
Remove-Item $result -Force -ErrorAction SilentlyContinue
"list" | Set-Content $trigger -NoNewline
Start-Sleep -Seconds 3
if (Test-Path $result) { Get-Content $result -Raw | ConvertFrom-Json | ConvertTo-Json -Depth 5 }
}
WSL Integration
Add to your ~/.bashrc or ~/.zshrc:
function wtsave() {
root=$(pwd)
echo -n "save" > "$root/.vscode/.wt-save-trigger"
sleep 5
state="$root/.vscode/terminal-state.json"
[ -f "$state" ] && cat "$state" | python3 -m json.tool
}
function wtrestore() {
echo -n "restore" > "$(pwd)/.vscode/.wt-restore-trigger"
}
function wtlist() {
root=$(pwd)
result="$root/.vscode/.wt-list-result"
rm -f "$result"
echo -n "list" > "$root/.vscode/.wt-list-trigger"
sleep 3
[ -f "$result" ] && cat "$result" | python3 -m json.tool
}
Requirements
- Claude Code CLI installed and in PATH
- Windows (PowerShell, WSL) or Linux (native, Remote SSH)
- VS Code 1.85+
Data Storage
Layout data is saved per-workspace in .vscode/terminal-state.json. Add it to .gitignore if you prefer not to commit session data.
Changelog
1.1.2
- Fix machine freeze from dormant WSL distros — WSL enumeration now only queries running distros (
wsl -l -v --running). Previously, the extension iterated every installed distro and called wsl -d <distro>, which booted dormant Hyper-V VMs and allocated GBs of RAM per distro, freezing low-memory machines
- Fix duplicate sessionId regression in WSL branch — removed the "most recent session file" fallback in
readWslSessionFile. This aligns WSL detection with the strict matcher rule (v1.1.0 DEC-008) and prevents multiple WSL terminals from sharing the same session ID
- Auto-save reduced drastically — interval raised from 2 min to 10 min, max attempts cut from 10 to 3. Reduces background pressure from ~6× while still capturing session IDs from newly created terminals
- Auto-save no longer bumps
savedAt — the savedAt timestamp is now preserved when auto-save captures pending session IDs, matching the original intent (only manual mutations update it)
- Shell-quote WSL distro names and file paths in all
wsl -d "<distro>" calls — defends against distros or project paths with spaces or special characters
1.1.1
- Fix restore on Linux —
Restore Sessions command and startup notification now call restore directly on Linux (Remote SSH, Dev Containers, native Linux). Previously, restore went through the wtrestore PowerShell IPC flow, which is not available in bash/zsh environments, causing silent failure
1.1.0
- Fix duplicate sessionId bug — each terminal now resolves to its own unique session. The old "most recent session file" fallback caused multiple terminals to share the same ID after VS Code restarts or when PIDs were reused
- New three-strategy matching: exact PID →
--resume UUID in cmdline → cwd + most recent unused startedAt
- Used-ID tracking — once a sessionId is claimed by a terminal during a save, no other terminal in the same pass can claim it
- Strict
findConversationId — requires a startedAt timestamp match (±30s); no more "return the newest file" fallback
1.0.9
savedAt is now updated when Toggle Danger Mode or Change Model persists changes — keeps layout timestamp accurate
1.0.8
- 1M context models —
opus[1m] and sonnet[1m] available in New Terminal and Change Model
- Model names are quoted in commands to safely support bracket-suffixed values
1.0.7
- Cross-platform support — works on Windows, WSL, and native Linux (VS Code Remote SSH)
- Broader WSL detection — detects all distros: Ubuntu, Debian, Kali, Fedora, openSUSE, Arch, Alpine
- WSL detection via bash.exe, distro executables, terminal names, and VS Code profiles
- Linux native — direct PID matching on Linux, no WSL bridge needed
- Grandchild PID walking — finds Claude even when launched through intermediate shells (bash → node → claude)
1.0.6
- New Terminal command — create a Claude terminal with guided model + permissions setup
- Smart startup — workspace without layout offers to create a new Claude terminal
- Auto session capture — background auto-save detects new session IDs every 2 min (max 10 attempts)
1.0.5
- Toggle Danger Mode — enable/disable
--dangerously-skip-permissions per terminal or globally
- Change Model — switch opus/sonnet/haiku with optional instant redeploy
- Silent restore — terminals open hidden and appear only when Claude is ready
- Parallel restore — all terminals start simultaneously
1.0.3
- Initial Marketplace release
Contributing
Found a bug? Have an idea? Open an issue or a PR on GitHub — all contributions are welcome.
A Note on Sharing
Good tools should be free. We built this because we needed it, and we believe the best software grows when it reaches the people who need it most — not behind a paywall.
If Claude Layout Session saved you time, frustration, or a lost conversation you really needed: share it with your team, your community, or anyone who lives in the terminal. That's how small tools become something bigger.
Thank you for using it, sharing it, and being part of the community. 🤝