Content
# workbuddy-account-migrate
> WorkBuddy account migration tool.
[](https://opensource.org/licenses/MIT)
[](https://www.apple.com/macos)
[](https://www.python.org/)
[](https://github.com/xiaoliuzhuan666/workbuddy-account-migrate)
**[English](#english) | [中文](#chinese)**
---
<h2 id="english">English</h2>
### The Problem
After switching accounts in WorkBuddy (Tencent Cloud AI assistant desktop app), **all your previous conversation history, long-term memory, and MCP connector configs disappear from the UI**. The data is still on disk — just hidden by `user_id` isolation.
This tool merges old account data into your current account with a single command.
### Quick Start
```bash
git clone https://github.com/xiaoliuzhuan666/workbuddy-account-migrate.git
cd workbuddy-account-migrate
python3 scripts/migrate.py
```
Interactive wizard — just pick a number, no user_id knowledge required.
### What Gets Migrated
| Data | How | Strategy |
|:---|:---|:---|
| Session history | SQLite `user_id` field | UPDATE to new account |
| Long-term Memory | `~/.workbuddy/memory/{uid}_memory.md` | Append + deduplicate |
| MCP Connectors | `~/.workbuddy/connectors/{uid}/mcp.json` | JSON deep merge |
Skills, Automations, Settings are global (no user_id) — no migration needed.
### Features
- Interactive wizard (no user_id needed)
- Safe: append-only memory, deep-merge connectors, WAL checkpoint before & after
- Multi-source user_id validation (DB + storage.json cross-check)
- Post-migration verification (source user_id must be zero)
- Zero dependencies (Python 3.8+ only)
### Compatibility
- WorkBuddy (macOS)
- WorkBuddy (Windows)
- WorkBuddy (Linux)
- CodeBuddy CLI
### Changelog
#### v1.3.0 (2026-05-26)
**Critical fix: Migration was silently skipped due to stale user_id**
- **Bug fix**: `get_current_user_id()` now uses multi-source cross-validation — reads from both DB latest session and `storage.json`, warns when inconsistent, prioritizes DB value. Previously relied solely on `genie.userId` which could be stale after account switch, causing `source == target` and migration being skipped.
- **Bug fix**: `migrate_sessions()` now performs WAL checkpoint after UPDATE (not just before), and verifies source user_id is zero. Previously, modifications could be lost on client restart due to unflushed WAL logs.
- **SKILL.md**: Added AI manual migration best practices, 3 new troubleshooting entries.
- **README**: Updated feature list, workflow description, and version badge.
#### v1.2.0 (2026-05-25)
- Added task history recovery (`--list-tasks`, `--restore-tasks`)
- Added interactive wizard mode
- Added `--generate-commands` for TaskCreate tool
#### v1.1.0 (2026-05-25)
- Initial public release
- Session, Memory, Connector migration
- Auto-backup + rollback support
### License
[MIT](LICENSE) 2026