# Windows Claude Desktop & Cowork Profile Anatomy

This reference documents the on-disk architecture of **Claude Desktop & Cowork** on Windows so migrations preserve the entire working state ("The Alot") across machines, Windows user profiles, installer variants (MSIX vs. Standard EXE), and organization/account UUID changes.

---

## 1. Three Linked Storage Roots on Windows

A user's live Cowork environment spans three separate directories on Windows:

### Root A — Claude Desktop & Cowork AppData (`<DesktopRoot>`)
Depending on how Claude Desktop was installed on Windows, `<DesktopRoot>` lives in one of two places:
- **MSIX (Windows Store / App Installer)**:
  `%LOCALAPPDATA%\Packages\Claude_<publisherId>\LocalCache\Roaming\Claude`
  *(e.g. `C:\Users\<user>\AppData\Local\Packages\Claude_pzs8sxrjxfjjc\LocalCache\Roaming\Claude`)*
  Note: Inside the MSIX container, Windows virtualizes `%APPDATA%\Claude` to this `LocalCache\Roaming\Claude` path.
- **Standard Installer (EXE / Squirrel)**:
  `%APPDATA%\Claude`
  *(e.g. `C:\Users\<user>\AppData\Roaming\Claude`)*

### Root B — Claude Engine, Plugins, Skills & Session Transcript Store (`%USERPROFILE%\.claude` and `%USERPROFILE%\.claude.json`)
Even when Claude Desktop runs inside the MSIX package, the underlying local agent engine writes directly to the real Windows user profile at:
- `%USERPROFILE%\.claude\`
- `%USERPROFILE%\.claude.json`

### Root C — Cowork User Files & Space Working Folders (`coworkUserFilesPath`)
Configured in `claude_desktop_config.json` under `coworkUserFilesPath` (defaulting to `%USERPROFILE%\Claude`, e.g. `C:\Users\<user>\Claude\Projects`), plus any external workspace directories linked in `spaces.json`.

---

## 2. Account & Organization UUID Nesting Rules

Claude Cowork namespaces user data by **Account UUID** (`<accountUuid>`) and **Organization UUID** (`<orgUuid>`). Note that different subdirectories reverse the nesting order or use 8-character prefixes:

| Relative Path | UUID Order / Format | Contents |
| --- | --- | --- |
| `<DesktopRoot>\local-agent-mode-sessions\<accountUuid>\<orgUuid>\` | `<accountUuid>\<orgUuid>` | `spaces.json`, `remote-session-spaces.json`, `scheduled-tasks.json`, and `spaces\<spaceId>\memory\*.md` |
| `<DesktopRoot>\local-agent-mode-sessions\skills-plugin\<orgUuid>\<accountUuid>\` | **`<orgUuid>\<accountUuid>` (Reversed!)** | `manifest.json`, `.claude-plugin\plugin.json`, `.aside\`, and `skills\<skillName>\SKILL.md` |
| `<DesktopRoot>\claude-code-sessions\<accountUuid>\<orgUuid>\` | `<accountUuid>\<orgUuid>` | `archived-sessions.idx`, `scheduled-tasks.json`, and `local_<sessionUuid>.json` sidebar session cards |
| `<DesktopRoot>\space-memory-copy\<accountUuid>\<orgUuid>\` | `<accountUuid>\<orgUuid>` | `<spaceId>.json` space memory sync state |
| `<DesktopRoot>\spaces-present\<accountUuid8>\<orgUuid8>\` | **8-char prefixes** (`<acct[:8]>\<org[:8]>`) | `present` marker and DPAPI-encrypted `link-key` |
| `<DesktopRoot>\scratch-workspaces\<accountUuid>\<orgUuid>\` | `<accountUuid>\<orgUuid>` | Ephemeral Cowork scratch workspaces |
| `%USERPROFILE%\.claude\plugins\synced\<orgUuid>_<accountUuid>\` | **`<orgUuid>_<accountUuid>` (Underscore)** | Synced Cowork role/domain plugins (`productivity`, `product-management`, `engineering`, `design`, `data~g2`, `pdf-viewer`) |
| `%USERPROFILE%\.claude\skills\synced\<orgUuid>_<accountUuid>\` | **`<orgUuid>_<accountUuid>` (Underscore)** | Synced skills mirror and `.bucket-<orgUuid>_<accountUuid>` |

When migrating between different accounts or organizations, **all eight** path patterns plus JSON keys inside `claude_desktop_config.json`, `config.json`, `mcp-user-tool-toggles.json`, and `cowork-enabled-cli-ops.json` must be remapped together.

---

## 3. How Sidebar Sessions Link to Conversation Transcripts

Each local session card shown in the Claude Desktop / Cowork sidebar is stored at:
`<DesktopRoot>\claude-code-sessions\<accountUuid>\<orgUuid>\local_<uuid>.json`

Key fields inside `local_<uuid>.json`:
- `sessionId`: `"local_<uuid>"` (referenced in `archived-sessions.idx` and `claude_desktop_config.json` -> `preferences.epitaxyPrefs` for starred sessions, pinned order, and manual session groups)
- `cliSessionId`: `"<transcriptUuid>"`
- `cwd` and `originCwd`: e.g. `"C:\\Users\\macst\\cowork"`
- `title`, `model`, `effort`, `permissionMode`, `enabledMcpTools`

When the user clicks that session in the sidebar, Claude Desktop resolves the full conversation transcript at:
`%USERPROFILE%\.claude\projects\<encoded-cwd>\<cliSessionId>.jsonl`

### Project Path Encoding Rule (`<encoded-cwd>`)
Windows paths are encoded into directory names under `%USERPROFILE%\.claude\projects\` by replacing every character outside `[a-zA-Z0-9-]` with `-`:
```python
re.sub(r"[^a-zA-Z0-9-]", "-", path_str)
```
Examples:
- `C:\` -> `C--`
- `C:\Users\macst\cowork` -> `C--Users-macst-cowork`
- `G:\source\repos\MacstaClaw` -> `G--source-repos-MacstaClaw`

If the Windows username changes on the target PC (`C:\Users\alice` -> `C:\Users\bob`), both:
1. The `<encoded-cwd>` folder name (`C--Users-alice-cowork` -> `C--Users-bob-cowork`), and
2. The `"cwd"` / `"originCwd"` strings inside `local_*.json` and `<cliSessionId>.jsonl`
must be remapped so every historical session resumes without broken links.

---

## 4. Machine-Bound & DPAPI-Encrypted Artifacts (Sanitization Rules)

To avoid breaking authentication on the destination machine or leaking machine-bound blobs:
1. **`<DesktopRoot>\config.json`**:
   - Strip `oauth:tokenCache` and `oauth:tokenCacheV2` on export, and preserve the destination machine's `oauth:tokenCache*` keys on import merge.
2. **`<DesktopRoot>\spaces-present\<acct8>\<org8>\link-key`**:
   - Encrypted with Windows DPAPI (`v10...` header tied to the source Windows user/machine master key). Exclude by default so Claude Desktop regenerates it cleanly.
3. **`%USERPROFILE%\.claude\.credentials.json` & `mcp-needs-auth-cache.json`**:
   - Exclude by default on export so OAuth connectors re-authenticate cleanly on the target machine.
4. **`%USERPROFILE%\.claude.json`**:
   - Strip `oauthAccount` on export; preserve destination `oauthAccount`, `machineID`, and `userID` on import merge while migrating `projects` (folder trust, allowed tools, project MCP servers), `skillUsage`, `pluginUsage`, and onboarding flags.
