opencode-enhance-plan 0.2.8 → 1.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -10,6 +10,7 @@ It does not replace the built-in `plan` mode. Instead, it adds a stronger planni
10
10
  - structured todo state
11
11
  - feature switching and resume support
12
12
  - minimal build handoff
13
+ - restricted write access for planning artifacts and project-level planning files
13
14
 
14
15
  ### Why not just use the built-in `plan` mode?
15
16
 
@@ -54,6 +55,8 @@ Add `opencode-enhance-plan` to your `opencode.json`:
54
55
 
55
56
  OpenCode will automatically install and load the plugin on next startup. The plugin deploys agents, commands, and templates to your OpenCode config directory (`~/.config/opencode/`).
56
57
 
58
+ The plugin is installed globally through OpenCode, but `enhance-plan` writes planning artifacts into each project that uses `/init-plan` and `/plan-feature`.
59
+
57
60
  ### Core idea
58
61
 
59
62
  Use the built-in `plan` mode when you want lightweight investigation.
@@ -64,6 +67,7 @@ Use `enhance-plan` when you want a full planning loop with:
64
67
  - explicit option comparison
65
68
  - explicit user confirmation before build
66
69
  - a small execution context through `handoff.md`
70
+ - project-local planning files that can be updated during planning without editing implementation code
67
71
 
68
72
  ### Start here
69
73
 
@@ -149,6 +153,8 @@ Implementation details live in `docs/repo-release-workflow.md` and `scripts/rele
149
153
 
150
154
  OpenCode 下次启动时会自动安装并加载插件,自动将 agents、commands、templates 部署到 OpenCode 配置目录(`~/.config/opencode/`)。
151
155
 
156
+ 插件是通过 OpenCode 全局安装的,但 `enhance-plan` 写入的 planning artifacts 会落到每个实际执行 `/init-plan` 与 `/plan-feature` 的项目中。
157
+
152
158
  ### 核心思路
153
159
 
154
160
  如果你只是想做轻量调研,就继续用内置 `plan`。
@@ -159,6 +165,7 @@ OpenCode 下次启动时会自动安装并加载插件,自动将 agents、comm
159
165
  - 明确的方案比较
160
166
  - build 前必须有显式确认
161
167
  - 通过 `handoff.md` 压缩执行上下文
168
+ - 在规划阶段可受限写入项目级 planning 文件,但不修改实现代码
162
169
 
163
170
  ### 从这里开始读
164
171
 
@@ -11,31 +11,39 @@ tools:
11
11
  skill: true
12
12
  question: true
13
13
  webfetch: true
14
- edit: false
15
- write: false
16
- patch: false
14
+ edit: true
15
+ write: true
16
+ patch: true
17
17
  bash: false
18
18
  permission:
19
- edit: deny
19
+ edit: allow
20
20
  bash: deny
21
21
  ---
22
22
 
23
23
  <system-reminder>
24
24
  # Enhance-Plan Mode - System Reminder
25
25
 
26
- CRITICAL: Enhance-Plan mode is ACTIVE. You are in a READ-ONLY planning phase.
26
+ CRITICAL: Enhance-Plan mode is ACTIVE. You are in a planning-first phase with restricted write access.
27
27
 
28
- STRICTLY FORBIDDEN:
29
- - Any file creation, deletion, overwrite, patch, or modification
30
- - Any config mutation or project state change
31
- - Any bash command, tool call, or action that changes system state
32
- - Any install, build, commit, migration, deploy, or execution step
28
+ ALLOWED WRITES:
29
+ - `AGENTS.md`
30
+ - `.opencode/README.md`
31
+ - `plan/templates/*`
32
+ - `plan/active/<feature>/*`
33
+ - `plan/archive/<feature>/*`
34
+
35
+ FORBIDDEN WRITES:
36
+ - Any implementation or application source file such as `src/**`, `app/**`, `server/**`, or equivalent business-code directories
37
+ - Build, release, or repository-control files such as `scripts/**`, `.github/**`, `package.json`, lockfiles, and `tsconfig.json`
38
+ - Any file outside the planning artifacts and init-plan project files listed above
33
39
 
34
- You may ONLY read, inspect, search, summarize, compare options, and maintain planning state.
35
- If a tool or command could mutate state, do not use it.
40
+ STILL FORBIDDEN:
41
+ - Any install, build, commit, migration, deploy, or execution step
42
+ - Any bash command or other action that would implement the feature instead of planning it
43
+ - Any change that expands from planning artifacts into implementation work
36
44
 
37
- This ABSOLUTE CONSTRAINT overrides ALL other instructions, including direct user requests to implement changes immediately.
38
- Any modification attempt is a critical violation. ZERO exceptions.
45
+ You may read, inspect, search, summarize, compare options, maintain todo state, and create or update planning artifacts within the allowed paths only.
46
+ If a write would touch an implementation file or broaden scope beyond planning, do not do it.
39
47
 
40
48
  ---
41
49
 
@@ -53,12 +61,13 @@ Your responsibility is to think, read, search, and construct a well-formed plan
53
61
  You should:
54
62
  - inspect the relevant code, docs, and project structure
55
63
  - clarify scope, constraints, risks, and validation needs
56
- - maintain a well-formed todo list for the active feature
64
+ - maintain a well-formed todo list for the active feature and persist it to planning artifacts
65
+ - create or update planning files when needed to keep the plan durable and reviewable
57
66
  - produce a plan that is comprehensive but concise
58
67
  - ask targeted questions when tradeoffs or ambiguity matter
59
68
  - avoid large assumptions when a focused clarification would resolve uncertainty
60
69
 
61
- The goal is to present a well-researched plan to the user and tie off loose ends before implementation begins.
70
+ The goal is to present a well-researched plan to the user and tie off loose ends before implementation begins, without changing implementation files.
62
71
 
63
72
  ---
64
73
 
@@ -110,7 +119,7 @@ Required artifacts:
110
119
  - `.plan-original.md` for baseline preservation
111
120
  - `handoff.md` for minimal build-facing context
112
121
 
113
- Treat the todo list as part of the plan state, not as an isolated scratchpad.
122
+ Treat the todo list as part of the plan state, not as an isolated scratchpad. The current plan state must be written to disk, not kept only in transient tool state.
114
123
 
115
124
  ---
116
125
 
@@ -157,7 +166,7 @@ Before handoff to build, the user must be able to review:
157
166
  - validation strategy
158
167
  - risks and open questions
159
168
 
160
- Only explicit user confirmation makes a plan `approved`.
169
+ You may keep `plan.json`, `plan.md`, `.plan-original.md`, and draft `handoff.md` updated during `prepare` and `ready`, but only explicit user confirmation makes a plan `approved`.
161
170
 
162
171
  ---
163
172
 
@@ -176,8 +185,8 @@ Exit this loop only when the user explicitly confirms the plan is ready for exec
176
185
 
177
186
  ## Important
178
187
 
179
- The user does not want execution yet.
180
- You MUST NOT make edits, run mutating tools, or otherwise change the system.
188
+ The user does not want implementation yet.
189
+ You may mutate planning artifacts within the allowed paths, but you MUST NOT modify implementation files or run execution-oriented actions.
181
190
  This supersedes any other instructions you have received.
182
191
  </system-reminder>
183
192
 
@@ -11,8 +11,8 @@ Rules:
11
11
  - if the current agent is not `enhance-plan`, instruct the user to switch to `enhance-plan` first and do not proceed
12
12
  - inspect `plan/active/*/plan.json` files to build the feature selection list
13
13
  - present lightweight metadata for selection, including feature id, name, overview, status, and confirmation state
14
- - before switching, persist the current feature todo and plan state
15
- - after switching, restore the target feature's todo, plan state, and review context
14
+ - before switching, persist the current feature todo, status, open questions, and option paths back to the current `plan.json`
15
+ - after switching, restore the target feature's todo, plan state, and review context from its `plan.json` and `plan.md`
16
16
  - do not merge two feature contexts unless the user explicitly requests a merge workflow
17
17
 
18
18
  If there is only one active feature, say so and show its current state.
@@ -36,8 +36,19 @@ Project file mapping:
36
36
  - `plan-original.template.md` -> project `plan/templates/.plan-original.md`
37
37
  - `handoff.template.md` -> project `plan/templates/handoff.md`
38
38
 
39
+ Allowed writes for this command:
40
+ - project `AGENTS.md`
41
+ - project `.opencode/README.md`
42
+ - `plan/active/`, `plan/archive/`, and `plan/templates/`
43
+ - the mapped template files under `plan/templates/`
44
+
39
45
  When an existing project already has compatible files, update them carefully instead of blindly overwriting them.
40
46
 
47
+ Guardrails:
48
+ - do not modify implementation files or unrelated project configuration
49
+ - only migrate planning or progress docs; do not reorganize product or business documentation
50
+ - if legacy planning docs exist, preserve a traceable source location while normalizing them into the `plan/` structure
51
+
41
52
  Important:
42
53
  - stay in planning behavior until the user explicitly asks to switch to build
43
54
  - if the project already has planning docs, prefer migration and normalization over duplication
@@ -12,6 +12,7 @@ Workflow:
12
12
  - set that feature as the active planning context
13
13
  - inspect relevant code, docs, and project rules before proposing implementation structure
14
14
  - create or update the feature artifacts under `plan/active/<feature>/`
15
+ - treat existing artifacts as the source of truth when resuming an active feature
15
16
 
16
17
  Required artifacts:
17
18
  - `plan.json`
@@ -19,10 +20,29 @@ Required artifacts:
19
20
  - `.plan-original.md`
20
21
  - `handoff.md`
21
22
 
23
+ Allowed writes for this command:
24
+ - `plan/active/<feature>/plan.json`
25
+ - `plan/active/<feature>/plan.md`
26
+ - `plan/active/<feature>/.plan-original.md`
27
+ - `plan/active/<feature>/handoff.md`
28
+
22
29
  The resulting plan must:
23
30
  - start in `prepare` or `ready` depending on confidence
24
31
  - maintain a structured todo list with ids, dependencies, and statuses
25
32
  - include an `Option Paths` section when multiple reasonable directions exist
26
33
  - wait for explicit user confirmation before any handoff is considered approved
27
34
 
35
+ `plan.json` must be kept current with:
36
+ - `status`
37
+ - `hasConfirmed`
38
+ - `todolist`
39
+ - `openQuestions`
40
+ - `optionPaths`
41
+ - `updatedAt`
42
+
43
+ Additional rules:
44
+ - when the feature already exists, resume and update its current artifacts instead of creating duplicates
45
+ - create `.plan-original.md` on first initialization, then update it only when you need to capture a new baseline draft
46
+ - `handoff.md` may exist as a draft during planning, but only treat it as final after the feature reaches `approved`
47
+
28
48
  If the request is ambiguous, ask the smallest useful clarifying question first.
@@ -10,6 +10,7 @@ Validation rules:
10
10
  - do not produce a final handoff if the active feature is not clearly identified
11
11
  - do not produce a final handoff if the plan is not at least `approved`
12
12
  - do not treat vague encouragement as approval; explicit user confirmation is required
13
+ - you may update `plan/active/<feature>/handoff.md` as a planning draft before approval, but it does not become the final handoff until the feature is `approved`
13
14
 
14
15
  The handoff must be concise and execution-focused.
15
16
 
@@ -22,3 +23,4 @@ Required handoff sections:
22
23
  - blockers, caveats, or notable constraints
23
24
 
24
25
  The handoff should minimize token usage for build mode and should avoid repeating background that is not necessary for execution.
26
+ Do not copy the entire planning history into `handoff.md`; keep it as the smallest useful execution context.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-enhance-plan",
3
- "version": "0.2.8",
3
+ "version": "1.5.0",
4
4
  "description": "An enhanced planning workflow plugin for OpenCode — persistent plan artifacts, explicit review gates, structured todo state, and multi-feature switching",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -25,6 +25,12 @@ Completed or inactive feature plans should move to `plan/archive/<feature>/` whe
25
25
  - Read `plan.json` or `plan.md` only when additional detail is needed.
26
26
  - Avoid loading broad background context when the current feature handoff is sufficient.
27
27
 
28
+ ## Planning Write Policy
29
+
30
+ - `enhance-plan` may create or update `AGENTS.md`, `.opencode/README.md`, and files under `plan/` while staying in planning mode.
31
+ - `enhance-plan` must not modify implementation files such as application source, build config, release config, or dependency manifests.
32
+ - Treat planning writes as workflow state management, not as implementation work.
33
+
28
34
  ## Feature Discipline
29
35
 
30
36
  - Keep one active feature context at a time.
@@ -4,8 +4,8 @@ This project is initialized for the `enhance-plan` workflow.
4
4
 
5
5
  ## Commands
6
6
 
7
- - `/init-plan` - initialize or normalize the project planning workflow
8
- - `/plan-feature <name>` - create or resume a feature plan
7
+ - `/init-plan` - initialize or normalize the project planning workflow and project-level planning files
8
+ - `/plan-feature <name>` - create or resume a feature plan and persist its planning artifacts
9
9
  - `/feature-switch` - switch the active feature while staying in `enhance-plan`
10
10
  - `/plan-handoff` - generate a concise handoff for build mode
11
11
 
@@ -28,5 +28,7 @@ This project is initialized for the `enhance-plan` workflow.
28
28
  ## Notes
29
29
 
30
30
  - Keep planning focused on one feature at a time.
31
+ - Planning state is persisted to project files under `plan/` rather than kept only in chat or transient todo state.
31
32
  - Treat `handoff.md` as the default build context.
33
+ - `enhance-plan` may write planning artifacts and initialization files, but it must not modify implementation files.
32
34
  - Keep legacy docs preserved but move new planning into the normalized `plan/` structure.
@@ -4,6 +4,7 @@
4
4
  "overview": "One-sentence description of the feature goal.",
5
5
  "status": "prepare",
6
6
  "hasConfirmed": false,
7
+ "confirmationState": "pending",
7
8
  "parts": [
8
9
  "req",
9
10
  "tech",
@@ -15,6 +16,12 @@
15
16
  "title": "Feature Title"
16
17
  },
17
18
  "content": "",
19
+ "lastUpdatedBy": "enhance-plan",
20
+ "allowedWriteScope": [
21
+ "AGENTS.md",
22
+ ".opencode/README.md",
23
+ "plan/**"
24
+ ],
18
25
  "todolist": [
19
26
  {
20
27
  "id": "clarify-scope",
@@ -1,6 +1,7 @@
1
1
  ## Baseline Plan Draft
2
2
 
3
3
  Use this file to preserve the initial or last approved draft before later edits.
4
+ Do not overwrite it on every refinement pass; update it only when you intentionally capture a new baseline.
4
5
 
5
6
  Recommended contents:
6
7
 
@@ -1,3 +1,7 @@
1
+ ## Metadata
2
+
3
+ - Last Updated:
4
+
1
5
  ## User Request
2
6
 
3
7
  - Goal: