@KirafishyWSL 与 Windows 双环境 OpenCode 配置同步 中发帖

WSL 与 Windows 双环境 OpenCode 配置同步实践
背景
在 WSL 和 Windows 双环境下使用 OpenCode 时,希望两边配置和会话数据能够同步,避免手动切换环境时丢失上下文。
主要分为两块:配置目录同步和会话数据库同步。把步骤直接丢给agent应该就能搞定了。
一、配置文件同步
OpenCode 的配置目录位于 ~/.config/opencode/,包含:

opencode.json - 主配置(provider、model、MCP)
AGENTS.md - 全局规则
hooks/ - 钩子脚本
agents/ - Agent 定义
command/ - 斜杠命令

方案:符号链接,WSL 直接指向 Windows 配置目录
ln -s /mnt/c/Users/用户名/.config/opencode ~/.config/opencode
ln ...