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
Copy file name to clipboardExpand all lines: AGENTS.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -49,5 +49,5 @@ Use `npm test` for normal code changes. Use the runtime debug and sandbox comman
49
49
## Notes For Agents
50
50
51
51
- This repo currently has no dedicated lint or format script; preserve the existing style manually.
52
-
- The package is published from version tags, and the README documents the prerelease `@beta` install path.
52
+
- The package is published from version tags, and the README documents the stable install path.
53
53
- Changes around `plan_exit` should preserve the current runtime contract: only mention or allow it when experimental plan mode is enabled and the client is `cli`.
Copy file name to clipboardExpand all lines: README.md
+29-10Lines changed: 29 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,16 +1,27 @@
1
1
# opencode-planner
2
2
3
-
`opencode-planner` is an OpenCode plugin that adds a dedicated `plan` agent for read-only planning before implementation. Its functionality is an emulation of the experimental plan agent (it has no hard dependency on EXPERIMENTAL_PLAN_MODE=1, altough that setting enables a tool called plan_exit which this plugin will use if available). That is, it likes to use sub-agents and a structured approach to planning, asks clarifying questions, and finally it produces a markdown file.
3
+
`opencode-planner` is an OpenCode plugin that adds a dedicated `plan` agent for read-only planning before implementation. Its functionality is an emulation of the experimental plan agent (it has no hard dependency on `EXPERIMENTAL_PLAN_MODE=1`, although that setting enables a tool called plan_exit which this plugin will use if available). That is, it likes to use sub-agents and a structured approach to planning, asks clarifying questions, and finally it produces a markdown file.
4
+
5
+
6
+
When Plannotator is installed, it can submit the finished plan for richer review.
7
+
8
+
Without Plannotator, it can open the plan in your configured external editor for review. A new command `/edit-plan` will open the plan in the editor if needed.
9
+
10
+
In either case, changes made while editing will trigger a revision of the plan.
4
11
5
-
When Plannotator is installed, it can submit the finished plan for richer review. Without Plannotator, it can open the plan in your configured external editor for review.
6
12
7
13
After review, the agent can hand back to implementation mode by calling `plan_exit` only when the host runtime exposes that tool. In current OpenCode builds, that means experimental plan mode must be enabled and the client must be `cli`. If it's not enabled, you need to prompt the build agent to start work.
Experimental plan mode is not a focus for the core devs, who point out that a plugin can do it, which I set out to prove, at least as a concept. This plugin means, at least for me, a development path for a stronger Plan agent independent of core OpenCode priorities.
20
+
21
+
11
22
## Install for OpenCode
12
23
13
-
Add this to `opencode.json`:
24
+
Add this to `opencode.jsonc` (or `opencode.json`):
14
25
15
26
```json
16
27
{
@@ -40,9 +51,10 @@ If you want reproducible installs instead of automatic plugin refreshes, pin an
40
51
- denies `submit_plan`, `edit_plan`, and `plan_exit` to the built-in `general` and `explore` subagents so review and implementation handoff stay on the primary `plan` agent
41
52
- exposes a `plan_prompt` tool so the `plan` agent can reveal the plugin's prompt basis for customization
42
53
- exposes an `edit_plan` tool so the `plan` agent can open the current plan in the configured external editor
54
+
- registers an `/edit-plan` command that routes to the `plan` agent and asks it to call `edit_plan`
43
55
- uses `submit_plan` for review when available, otherwise falls back to external-editor review
44
56
- keeps the agent in planner mode if the plan file changed after `submit_plan`; the revised plan must be resubmitted before `plan_exit`
45
-
- can leave planner mode with `plan_exit` after approval when experimental plan mode is enabled in the CLI runtime
57
+
- can leave planner mode with `plan_exit` after approval when experimental plan mode is enabled in the CLI runtime (because the plan_exit tool is only available with `EXPERIMENTAL_PLAN_MODE` enabled; se OpenCode docs for Experiments)
46
58
47
59
## Customize the plan agent
48
60
@@ -80,6 +92,16 @@ The tool returns:
80
92
81
93
## Review Without Plannotator
82
94
95
+
In the TUI, you can use `/edit-plan` as a shortcut to ask the `plan` agent to reopen the current plan in your configured external editor. This routes through the existing `edit_plan` tool behavior.
96
+
97
+
Example:
98
+
99
+
```text
100
+
/edit-plan
101
+
```
102
+
103
+
This expects the current session to already have a plan file, and it still requires `PLAN_VISUAL`, `VISUAL`, or `EDITOR` to launch a blocking editor command.
104
+
83
105
If `submit_plan` is not registered by the runtime, the plugin's `edit_plan` tool gives the `plan` agent a fallback way to open the current plan in your configured external editor.
84
106
85
107
Example:
@@ -126,10 +148,7 @@ If you edit the plan after calling `submit_plan`, the plugin treats that as a ne
126
148
127
149
OpenCode installs and updates npm plugins automatically. `opencode-planner` tracks `@latest` by default, which is the recommended channel for most users.
128
150
129
-
The `beta` dist-tag currently points at the same release as `latest`. That keeps existing beta installs on the current stable build until a future prerelease line resumes.
130
-
131
151
-`@latest`: pick up stable plugin versions on restart
132
-
-`@beta`: currently follows the same version as `@latest`
133
152
- exact version pin: stay fixed until the config is changed deliberately
134
153
135
154
If OpenCode appears to keep an older cached plugin, clear the cache under `~/.cache/opencode/` and restart.
@@ -162,8 +181,8 @@ It starts OpenCode with an isolated temporary home/config, keeps the local repo
162
181
1. Update `CHANGELOG.md`.
163
182
2. Bump the version in `package.json`.
164
183
3. Commit the release.
165
-
4. Create and push a git tag like `v0.1.1-beta.1` for prereleases or `v0.1.1` for stable releases.
166
-
5. Let GitHub Actions publish to npm using the correct dist-tag.
184
+
4. Create and push a git tag like `v0.2.0` for the release.
185
+
5. Let GitHub Actions publish to npm `latest`.
167
186
6. Publish matching GitHub release notes.
168
187
169
188
The repository includes GitHub Actions templates for CI and npm publishing from version tags.
@@ -179,7 +198,7 @@ Configure npm Trusted Publishing for this package:
179
198
- Repository: `opencode-planner`
180
199
- Workflow filename: `release.yml`
181
200
182
-
The release workflow publishes prerelease tags like `v0.1.1-beta.1` to the npm `beta` dist-tag, stable tags like `v0.1.1` to `latest`, and creates matching GitHub release notes automatically.
201
+
The release workflow publishes stable tags like `v0.2.0` to npm `latest` and creates matching GitHub release notes automatically.
183
202
184
203
Trusted Publishing uses GitHub OIDC and does not require an `NPM_TOKEN` secret for publishing.
Copy file name to clipboardExpand all lines: index.js
+11-1Lines changed: 11 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -7,6 +7,12 @@ import process from "node:process"
7
7
constagent="plan"
8
8
constroot=".opencode/plans"
9
9
constdefaultPlanTarget=file("<session-id>")
10
+
consteditPlanCommand={
11
+
description: "Reopen the current plan in your editor",
12
+
agent,
13
+
template:
14
+
"Reopen the current markdown plan in the configured external editor by calling the edit_plan tool. If the tool reports that the user changed the plan externally, treat those edits as review feedback, summarize what changed, and continue planning from the updated plan.",
15
+
}
10
16
11
17
functiontruthy(key){
12
18
constvalue=process.env[key]?.toLowerCase()
@@ -60,7 +66,7 @@ function promptDisclosure(target = defaultPlanTarget) {
60
66
"This reminder is injected by the plugin at runtime to keep the `plan` agent in planner mode and enforce the review handoff workflow. It is plugin-controlled and is not customized through `agent.plan.prompt`.",
0 commit comments