You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[FEATURE]: V2 Plan mode: restore V1 experimental plan mode's persistent session plan file workflow #49879
I have verified this feature I'm about to request hasn't been suggested before.
Describe the enhancement you want to request
The experimental plan mode in OpenCode v1 had a clear workflow for planning:
enter Plan
↓
derive .opencode/plans/<session-timestamp>-<slug>.md
↓
inject exact path into Plan reminder
↓
allow Plan to create/update only that file
↓
plan_exit references the same canonical path
↓
approved Build session is told to execute that plan
The current plan agent in v2 is lacking some of these steps. It allows creation of plan files, but the plan agent has no system prompt, which means the model is never instructed to create and maintain a plan file for the session, nor does OpenCode generate a timestamp-prefixed plan filename for the agent to use. Furthermore, the plan mode reminder added in #41665 says strictly "You are not allowed to edit or create files" which again discourages the plan agent from creating and maintaining a plan file in the allowed location.
I recommend:
Create a Plan agent prompt that instructs the agent to create and maintain a specific plan file, with a filename generated for each session matching the format <session-timestamp>-<slug>.md
Update the plan mode reminder to "You are not allowed to edit or create files other than the plan file for this session."
I traced this against the V1 workflow and the current V2 plugin. V2 already made two intentional choices: #43710 allows writes under ~/.opencode/plan, while #46905 keeps planning conversational by default and writes a document only when the user explicitly asks. I think the session-file workflow should preserve both decisions rather than restore V1 wholesale.
Proposed V2 scope:
derive one stable path from the durable session creation timestamp + slug, under the existing global Plan directory;
include that exact path in the Plan reminder, while retaining the explicit-user-request condition;
enforce that session-specific file in the write/edit/patch hook instead of exposing the whole Plan directory to every Plan session;
when switching from Plan to Build, mention the canonical path only if the file exists; keep the normal agent switch instead of reintroducing the V1 plan_exit tool.
I would cover stable derivation across reminder reconciliation/restart, exact-file permission boundaries, no eager file creation, and the conditional Build handoff. Would this V2-shaped scope be acceptable for implementation?
The opencode.plan plugin hardcodes the plan directory to path.join(home, ".opencode", "plan"), and the Plan reminder tells the model to write plan files only there. That breaks projects that keep plans in the repository (in our case docs/plans/, reviewed and versioned alongside ADRs):
the directory is shared by every project on the machine, so plans from different repos end up in one flat folder with no link to the project or session;
there is no config key to point it elsewhere, and edit is denied everywhere else in Plan mode, so the plan can't be written where the project expects it even when the user explicitly asks;
nothing hands the plan over to Build afterwards, so the file is effectively orphaned.
Adding one data point from the v1 -> v2 diff for whoever picks this up: the plan directory itself is now hardcoded to ~/.opencode/plan in packages/core/src/plugin/plan.ts (path.join(global.home, ".opencode", "plan")), and the plan agent's edit permission is scoped to that single directory.
If the per-session plan file workflow described here gets restored, a small config knob for the directory (with ~ expansion) would fit naturally alongside the filename generation. The v1 proposals went through #49502 / #46199 / #46191. One trade-off to weigh: the single global directory avoids the per-project duplication complained about in #46189, so a per-worktree configurable path is not necessarily the right default.
Current v2 already covers this. The session plan file persists in ~/.opencode/plan and Plan-mode reminders are re-injected across agent switches (packages/core/src/plugin/plan.ts). The plan_exit tool is gone, agent switching replaces it, so the V1 workflow this request asked to restore is effectively in place. This can be closed.
Thanks for the detailed write-up, @shssoichiro! You're asking for v2 Plan mode to bring back the v1 experimental workflow: a plan file for each session at a generated <session-timestamp>-<slug>.md path, given to the Plan agent and kept up to date by it, with the handoff to Build pointing at that same file.
For context, on dev the Plan reminder no longer says "not allowed to edit or create files". It now says not to create plan files unless the user explicitly asks, and to write them only under ~/.opencode/plan/. So writing a plan file is still something the user has to request, and there's no per-session file or handoff to Build yet. That's a design change rather than a bug, so I've marked this as a feature request for the maintainers to consider.
Activity
Dante-dan commentedon Sep 19, 2026
I traced this against the V1 workflow and the current V2 plugin. V2 already made two intentional choices: #43710 allows writes under
~/.opencode/plan, while #46905 keeps planning conversational by default and writes a document only when the user explicitly asks. I think the session-file workflow should preserve both decisions rather than restore V1 wholesale.Proposed V2 scope:
plan_exittool.I would cover stable derivation across reminder reconciliation/restart, exact-file permission boundaries, no eager file creation, and the conditional Build handoff. Would this V2-shaped scope be acceptable for implementation?
shssoichiro commentedon Sep 19, 2026
Yes, that would satisfy what I'm looking for.
fgbm commentedon Sep 25, 2026
+1, with a concrete case from v2.0.16 (Linux).
The
opencode.planplugin hardcodes the plan directory topath.join(home, ".opencode", "plan"), and the Plan reminder tells the model to write plan files only there. That breaks projects that keep plans in the repository (in our casedocs/plans/, reviewed and versioned alongside ADRs):editis denied everywhere else in Plan mode, so the plan can't be written where the project expects it even when the user explicitly asks;What would solve it for us:
plans_directoryconfig option (per-project config supported) that also extends the Plan agent'sedit/external_directoryallows — like feat: configurable plans directory and opt-out for plugin dependency installs #49502 does for v1, but applied to the v2opencode.planplugin;<timestamp>-<slug>.md) injected into the reminder, as in the v1 workflow described above.Related: #50241 / #46358 (writes into
~/.opencode/planare rejected even there), #46189 (v1 cluttering projects).log0u7 commentedon Oct 10, 2026
Adding one data point from the v1 -> v2 diff for whoever picks this up: the plan directory itself is now hardcoded to
~/.opencode/planinpackages/core/src/plugin/plan.ts(path.join(global.home, ".opencode", "plan")), and the plan agent's edit permission is scoped to that single directory.If the per-session plan file workflow described here gets restored, a small config knob for the directory (with
~expansion) would fit naturally alongside the filename generation. The v1 proposals went through #49502 / #46199 / #46191. One trade-off to weigh: the single global directory avoids the per-project duplication complained about in #46189, so a per-worktree configurable path is not necessarily the right default.log0u7 commentedon Oct 28, 2026
Current v2 already covers this. The session plan file persists in
~/.opencode/planand Plan-mode reminders are re-injected across agent switches (packages/core/src/plugin/plan.ts). Theplan_exittool is gone, agent switching replaces it, so the V1 workflow this request asked to restore is effectively in place. This can be closed.opencodejr commentedon Oct 28, 2026
Thanks for the detailed write-up, @shssoichiro! You're asking for v2 Plan mode to bring back the v1 experimental workflow: a plan file for each session at a generated
<session-timestamp>-<slug>.mdpath, given to the Plan agent and kept up to date by it, with the handoff to Build pointing at that same file.For context, on
devthe Plan reminder no longer says "not allowed to edit or create files". It now says not to create plan files unless the user explicitly asks, and to write them only under~/.opencode/plan/. So writing a plan file is still something the user has to request, and there's no per-session file or handoff to Build yet. That's a design change rather than a bug, so I've marked this as a feature request for the maintainers to consider.Related issues and PRs:
plan_exithandoff for custom primary agents (closed)plan_exittool to switch from Plan to Build~/.opencode/plandocs(opencode): record the real-model v2 check