Repository navigation
fix(core): keep plan files in the data directory - #66860
rekram1-node wants to merge 3 commits into
Conversation
There was a problem hiding this comment.
Looks good. The plan directory now comes from Global.data, like the other per-user OpenCode paths (memory, snapshot, worktree). I ran debug agents from source with the PR checked out: the Plan agent's instructions and its edit allow rule both point at $XDG_DATA_HOME/opencode/plan (~/.local/share/opencode/plan by default). test/plugin/plan.test.ts passes.
Public API: no SDK, HTTP, config-key or CLI changes. The one user-visible change is where plan files live: ~/.opencode/plan → ~/.local/share/opencode/plan. Existing plans aren't moved. Any permission rules users wrote for ~/.opencode/plan/* will no longer match the directory the Plan agent writes to. That fits what the description says about not migrating.
Note: this doesn't fix #46358. If a session runs from $HOME, the new directory is still inside the project, so the absolute allow rule still won't match the relative path the tools report.
There was a problem hiding this comment.
The new commits look good. Existing plans now move: with a fake $HOME containing ~/.opencode/plan/old.md, running debug agents from source moved the file into ~/.local/share/opencode/plan/, and the Plan agent's edit allow rule points there. test/plugin/plan.test.ts passes, 8 of 8, including the two new tests.
Public API: no SDK, HTTP, config-key or CLI changes. Plan files now live in $XDG_DATA_HOME/opencode/plan instead of ~/.opencode/plan, and existing files are moved there once. Any permission rules users wrote for ~/.opencode/plan/* no longer match the directory the Plan agent writes to.
Plan mode now keeps plan files in OpenCode's data directory instead of a dotfolder in the home directory, like every other OpenCode path.
Existing plans move with it, once, when the plan plugin starts:
Checks:
bun run script/test.ts test/plugin/plan.test.ts(new tests cover the move and the existing-folder case) andbun typecheckin packages/coreAdded by the opencode bot (AI-generated).
Related: #46358, #55683
Public API: moves Plan-mode plan files from ~/.opencode/plan to $XDG_DATA_HOME/opencode/plan, migrating existing files once (user rules for the old path no longer apply)