Skip to content

fix(core): keep plan files in the data directory - #66860

Closed
rekram1-node wants to merge 3 commits into
devfrom
plan-data-dir
Closed

rekram1-node wants to merge 3 commits into
devfrom
plan-data-dir

Conversation

@rekram1-node

@rekram1-node rekram1-node commented Nov 27, 2026 •

Copy link
Copy Markdown
Member

Plan mode now keeps plan files in OpenCode's data directory instead of a dotfolder in the home directory, like every other OpenCode path.

- ~/.opencode/plan
+ ~/.local/share/opencode/plan   ($XDG_DATA_HOME/opencode/plan when set)

Existing plans move with it, once, when the plan plugin starts:

~/.opencode/plan exists and the new folder doesn't → rename it to the new folder
the new folder already exists                      → leave both alone
the move fails (e.g. another disk)                 → log a warning, leave the files where they are

Checks:

  • bun run script/test.ts test/plugin/plan.test.ts (new tests cover the move and the existing-folder case) and bun typecheck in packages/core

Added 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)

@opencodejr opencodejr Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Related: #46358, #55683

@opencodejr opencodejr Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant