Repository navigation
Description
What happens
wmux successfully restores workspace layouts and Claude Code conversations after restarting, but terminals reopen in the user's home directory instead of their original project directories.
This occurs with both CMD and Git Bash.
Expected: Each terminal should reopen in its previous working directory, including when resuming a Claude Code conversation.
Actual: Terminals start in C:\Users\<USERNAME>.
Interestingly, wmux correctly displays the current working directory in its sidebar before closing. This suggests directory detection works, but the directory information may not be persisted or restored correctly.
Impact: Restored Claude Code agents may operate in the wrong project directory, potentially reading or modifying unintended files.
Update: Workaround found
Opening a project using Ctrl+O (Open folder as workspace) resolves the problem: wmux correctly restores the project's working directory after restarting.
The issue appears to affect terminals where the working directory was changed using cd.
Observed behavior:
cdinto a project directory → wmux displays the correct directory in the sidebar, but does not restore it after restarting.Ctrl+Oto open a project directory → wmux restores the directory correctly.
Possible cause (AI-assisted hypothesis): wmux persists the initial project directory but does not update the saved working directory when it changes through shell integration.
Suggested fix: Persist the latest reported working directory for each terminal, not just the initial directory.
This update was written by ChatGPT (OpenAI GPT-6), based on the user's testing.
Steps to reproduce
- Open wmux on Windows 11.
- Open a terminal using CMD or Git Bash.
- Navigate to a project directory using
cd(for CMD, usecd /dwhen changing drives). - Verify that wmux displays the correct directory in its sidebar.
- Save the session.
- Close wmux normally.
- Reopen wmux and restore the session.
- Check the terminal's working directory.
Result: The terminal opens in the user's home directory instead of the original project directory.
Reproduced with both CMD and Git Bash.
wmux version
2.54.0
Windows version
Windows 11 25H2 26200.9711
Anything else
Environment
- OS: Windows 11
- Shells tested: CMD and Git Bash
- Other shells in use: WSL
- Agent: Claude Code
- Configuration: Multiple workspaces and terminal panes
- wmux: Latest available version
Diagnostic findings
I inspected:
%APPDATA%\wmux\sessions\session.json%APPDATA%\wmux\pty-ledger.json
1. No terminal surfaces contain working-directory information.
Example from the actual session.json (identifiers anonymized):
{
"id": "<SURFACE_ID>",
"type": "terminal",
"resolvedShell": "C:\\Program Files\\Git\\bin\\bash.exe",
"claudeSessionId": "<CLAUDE_SESSION_ID>"
}CMD example:
{
"id": "<SURFACE_ID>",
"type": "terminal",
"shell": "cmd.exe",
"resolvedShell": "C:\\Windows\\System32\\cmd.exe",
"claudeSessionId": "<CLAUDE_SESSION_ID>"
}Neither contains cwd or currentCwd.
2. Workspace-level directories are inconsistent.
The saved session contains three workspaces.
Workspace 1 contains:
{
"title": "Workspace 1",
"shell": "",
"cwd": "C:\\Users\\<USERNAME>"
}Workspaces 2 and 3 contain no workspace-level cwd property.
None of the terminal surfaces has a working-directory property.
3. The PTY ledger contains no working directories.
pty-ledger.json tracks process IDs, executable names, and start times, but no working directories.
This may be intentional.
Possible root cause (AI-assisted hypothesis)
The current working directory may be tracked correctly for the sidebar but not propagated into the state serialized by session persistence.
Possible sequence:
- Shell integration reports the current working directory.
- wmux updates the sidebar.
- Session serialization omits the terminal's latest working directory.
- Session restoration starts the terminal in the default directory.
This is a hypothesis, not a verified source-code diagnosis.
Suggested fix
Investigate the path from shell working-directory reporting to session serialization and terminal restoration.
Persist the latest working directory per terminal surface, rather than relying exclusively on workspace-level state.
Conceptually:
const savedSurface = {
...surface,
cwd: liveTerminalCwd ?? surface.currentCwd ?? surface.cwd,
};Then restore that directory when spawning the terminal:
spawnTerminal({
shell: savedSurface.shell,
cwd: savedSurface.cwd ?? workspace.cwd ?? defaultCwd,
});The directory should be restored before resuming Claude Code.
Please also consider:
- Multiple terminals in the same workspace with different directories.
- CMD, Git Bash, PowerShell, and WSL.
- Windows/Linux path differences.
- Backward compatibility with older saved sessions.
- Missing or deleted directories.
Questions
- Is per-terminal working-directory restoration currently supported?
- Should
cwdorcurrentCwdbe serialized for each terminal? - Is there an existing workaround?
AI disclosure
This bug report was written by ChatGPT (OpenAI GPT-6) based on the user's observations and diagnostic files.
ChatGPT analyzed the supplied session.json and pty-ledger.json and suggested the possible root cause and implementation approach.
The bug was experienced and reproduced by a human user. The technical diagnosis and proposed fix are AI-generated hypotheses and have not been independently verified against the complete wmux source implementation.
Activity
strayge commentedon Nov 2, 2026
Yes, tested with PowerShell and WSL panes.
WSL required shell hook from docs\wsl-explorer.md
For
cmd.exeit looks like bug. Fix in #429Git Bashalso requires manually added hook, that reports changed cwd:~/.bashrc
fix(shell-integration): report cwd from Git Bash and WSL over the pipe (
amirlehmam commentedon Nov 3, 2026
Fixed in 2.55.0, for both shells:
--init-file, and your~/.bashrcor login files still run). It reports the directory as a Windows path after everycd, so the pane reopens there andclaude --resumefinds its project. Previously the reports went to a temp file nothing read, and the/c/...spelling was taken for a WSL path. You can drop the manualPROMPT_COMMANDhook once you update.Please reopen if a restored pane still lands in your home directory.