workbuddy-account-migration
Installation
Review the source and dependencies with a prompt. A package is available to download.
Install with an AI assistant
Copy the prompt so your assistant can review the pinned revision and dependencies first.
View promptHide prompt
Check whether SkillPI Skill Finder is installed for your current agent. If it is missing, install and enable it using the official instructions at https://github.com/Findskills/skillpi. Then use Skill Finder to locate and install "workbuddy-account-migration" from this exact SkillPI detail page: https://skillpi.com/skills/deepskill-0c030a0ecc2367f806d217ada0f3d379f2825253030021e24e51c2d8b1374638. Verify the upstream source and version against https://skillhub.cn/skills/user_463e8e26/workbuddy-account-migration before installing. If they do not match, stop and report the mismatch. Report the installed path and source version.
Source and setup
skillhub.cn
Setup guidance pending
See the original source for supported tools, dependencies, and permissions.
Installation test pending
A Skill to migrate historical sessions and automation tasks after switching WorkBuddy accounts. Used to transfer sessions and automations from the old account to the current account so historical records become visible again in the new account UI. Trigger scenarios include “cannot see history after switching accounts,” “account migration,” “restore historical sessions,” “personal to enterprise account,” and “sessions user_id migration.” The core operation is updating the sessions.user_id and automations.owner_user_id fields in workbuddy.db.
Introduction source: third_party · user_463e8e26 · 1.0.0 Reference
SkillPi interpretation
- Software, accounts and paid services
- Translation pending; see source documentation.
- Limits and differences
- Translation pending; see source documentation.
- Testing
- Not tested
Browse files
Frontmatter
name: workbuddy-account-migration
description: >-
WorkBuddy 切换账号(个人账号→企业账号,或任何账号切换)后,把旧账号下的历史会话(sessions)和自动化任务(automations)迁移到当前账号,让历史记录在新账号 UI 中重新可见。当用户提到"切换账号后看不到历史会话/历史任务"、"账号迁移"、"恢复历史会话"、"个人账号转企业账号"、"sessions user_id 迁移"、WorkBuddy 账号切换后数据丢失等场景时触发。核心操作是 UPDATE workbuddy.db 的 sessions.user_id 和 automations.owner_user_id 字段。WorkBuddy 账号迁移
WorkBuddy 的会话归属由 ~/.workbuddy/workbuddy.db 的 sessions.user_id 字段决定。切换账号后,旧账号的会话在新账号 UI 中不可见。本 skill 通过修改数据库归属字段实现迁移。
迁移流程
第 1 步:识别当前账号 UID
从最新启动日志读取 accountUid 字段:
grep -oE 'accountUid=[a-f0-9-]{36}' ~/.workbuddy/logs/AppStartup.log | tail -1 | cut -d= -f2
此值即当前登录账号的 UID,作为迁移目标。
第 2 步:查询旧账号 UID 及会话分布
sqlite3 ~/.workbuddy/workbuddy.db \
"SELECT user_id, COUNT(*) as cnt,
datetime(MIN(created_at)/1000,'unixepoch','localtime') as earliest,
datetime(MAX(created_at)/1000,'unixepoch','localtime') as latest
FROM sessions WHERE deleted_at IS NULL GROUP BY user_id ORDER BY cnt DESC;"
输出会列出所有账号及其会话数。排除当前账号 UID 后,其余即为待迁移的旧账号。若有多个旧账号,向用户确认迁移哪一个(或全部)。
第 3 步:备份数据库(必做)
cp ~/.workbuddy/workbuddy.db ~/.workbuddy/workbuddy.db.bak-$(date +%Y%m%d-%H%M)
第 4 步:询问是否同时迁移自动化任务
主动询问用户是否要同时迁移 automations 表(定时任务)。automations 有独立的 owner_user_id 字段,与 sessions 分开迁移。
查询 automations 归属分布供用户决策:
sqlite3 ~/.workbuddy/workbuddy.db \
"SELECT owner_user_id, COUNT(*) as cnt,
SUM(CASE WHEN deleted_at IS NULL THEN 1 ELSE 0 END) as active,
SUM(CASE WHEN deleted_at IS NOT NULL THEN 1 ELSE 0 END) as deleted
FROM automations GROUP BY owner_user_id;"
注意:owner_user_id 为空、owner_status='legacy_unassigned' 的任务属于无主历史任务,迁移时一并纳入。
第 5 步:执行迁移
迁移会话(sessions)
sqlite3 ~/.workbuddy/workbuddy.db \
"UPDATE sessions SET user_id = '<新账号UID>' WHERE user_id = '<旧账号UID>';"
迁移自动化任务(automations,用户同意时)
sqlite3 ~/.workbuddy/workbuddy.db \
"UPDATE automations
SET owner_user_id = '<新账号UID>',
owner_status = 'inferred',
owner_source = 'history_unique'
WHERE owner_user_id = '<旧账号UID>'
OR (owner_user_id = '' AND owner_status = 'legacy_unassigned');"
将无主任务(legacy_unassigned)一并归到新账号下,确保 UI 可见。
如需同时恢复被软删除的 automations,追加:
sqlite3 ~/.workbuddy/workbuddy.db \
"UPDATE automations SET deleted_at = NULL WHERE owner_user_id = '<新账号UID>' AND deleted_at IS NOT NULL;"
仅在用户明确要求恢复已删除任务时执行。
第 6 步:验证
sqlite3 ~/.workbuddy/workbuddy.db \
"SELECT user_id, COUNT(*),
SUM(CASE WHEN deleted_at IS NULL THEN 1 ELSE 0 END) as active
FROM sessions GROUP BY user_id;"
确认旧账号 UID 不再出现,新账号会话数 = 迁移前 + 迁移量。
第 7 步:提醒用户重启
迁移完成后必须告知用户重启 WorkBuddy(完全退出 Cmd+Q 再重新打开),否则 UI 内存缓存不会刷新。
回滚命令(如需):cp ~/.workbuddy/workbuddy.db.bak-YYYYMMDD-HHMM ~/.workbuddy/workbuddy.db
注意事项
- WorkBuddy 运行中可直接执行 sqlite3 写入(WAL 模式),但 UI 需重启才生效。
sessions/目录下的.json文件是进程心跳文件(pid/sessionId/url),不是会话内容,无需迁移。sessions.json是快捷访问缓存(仅几条),非完整索引,无需迁移。- 数据库 schema 详见 references/db-schema.md。
- 若需自动执行完整流程,可使用 scripts/migrate.sh(交互式脚本,自动处理上述步骤)。
Current listing version
1.0.0
Quality assessment
Out of 100 · Assessment report from SkillPi LAB.
Areas to improve
-
缺少 When to Use 章节 Reported severity: Minor
文档未明确说明何时使用此 Skill,建议补充使用场景说明。
Recommendation: 在文档开头添加 When to Use 章节,明确说明适用场景。
-
文档较长 Reported severity: Minor
文档约450行,建议适当精简或拆分。
Recommendation: 考虑将部分详细说明移至附录或参考文档。
-
frontmatter 重复 Reported severity: Minor
frontmatter 中的 name/description 与顶层重复。
Recommendation: 移除 frontmatter 中的重复字段,保持简洁。
-
触发词可补充 Reported severity: Minor
触发词覆盖较全面,但可补充更多用户可能使用的表达方式。
Recommendation: 增加如"历史数据迁移"、"账号切换后数据恢复"等触发词。
Highlights
- 解决用户切换账号后历史数据不可见的实际问题
- 提供完整的7步迁移流程,操作清晰
- 包含备份、验证和回滚机制,安全可靠
Highlights
- 触发词覆盖多种变体,边界清晰
- description 明确描述了适用场景
Highlights
- Phase/步骤清晰,有出口条件
- 含端到端示例,frontmatter完整
- 单文件未超500行
Highlights
- 工具来源明确(sqlite3),参数正确
- 覆盖主要异常(备份、验证、回滚)
- 不可逆操作有确认机制(询问用户)
The arithmetic mean of the first four original scores, rounded to a whole number.
Static text checks
100 / 100 · skillpi-20261123-no-r3-v1
No current rules matched the text.
This score reflects rule matches in the text and is provided for reference before use. It excludes attachments and runtime behavior.
Permissions and checks before use
Automatically summarized from this main document. Matches may be examples or defensive advice; they are not actual permission declarations. Attachments, external dependencies and runtime behavior are not covered.
These common operations were not identified in the main document. This does not mean no permissions or risks exist.
Security rating and access scope
safe · Static evidence review; not a runtime safety guarantee.
Translation pending; see source documentation.
Before use, confirm and authorize actual file access, external services and network destinations in your host. This review grants no runtime permissions.
User discussion
No verified reviews yet.