@duypham93/openkit 0.2.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.
Files changed (178) hide show
  1. package/.opencode/README.md +47 -0
  2. package/.opencode/install-manifest.json +41 -0
  3. package/.opencode/lib/artifact-scaffolder.js +111 -0
  4. package/.opencode/lib/contract-consistency.js +218 -0
  5. package/.opencode/lib/parallel-execution-rules.js +261 -0
  6. package/.opencode/lib/runtime-paths.js +95 -0
  7. package/.opencode/lib/runtime-summary.js +82 -0
  8. package/.opencode/lib/state-guard.js +99 -0
  9. package/.opencode/lib/task-board-rules.js +375 -0
  10. package/.opencode/lib/work-item-store.js +280 -0
  11. package/.opencode/lib/workflow-state-controller.js +1739 -0
  12. package/.opencode/lib/workflow-state-rules.js +331 -0
  13. package/.opencode/opencode.json +93 -0
  14. package/.opencode/package.json +3 -0
  15. package/.opencode/tests/artifact-scaffolder.test.js +733 -0
  16. package/.opencode/tests/multi-work-item-runtime.test.js +369 -0
  17. package/.opencode/tests/parallel-execution-runtime.test.js +259 -0
  18. package/.opencode/tests/session-start-hook.test.js +357 -0
  19. package/.opencode/tests/state-guard.test.js +124 -0
  20. package/.opencode/tests/task-board-rules.test.js +204 -0
  21. package/.opencode/tests/work-item-store.test.js +380 -0
  22. package/.opencode/tests/workflow-behavior.test.js +149 -0
  23. package/.opencode/tests/workflow-contract-consistency.test.js +387 -0
  24. package/.opencode/tests/workflow-state-cli.test.js +1275 -0
  25. package/.opencode/tests/workflow-state-controller.test.js +1038 -0
  26. package/.opencode/work-items/feature-001/state.json +70 -0
  27. package/.opencode/work-items/index.json +13 -0
  28. package/.opencode/workflow-state.js +489 -0
  29. package/.opencode/workflow-state.json +70 -0
  30. package/AGENTS.md +265 -0
  31. package/README.md +401 -0
  32. package/agents/architect-agent.md +63 -0
  33. package/agents/ba-agent.md +56 -0
  34. package/agents/code-reviewer.md +77 -0
  35. package/agents/fullstack-agent.md +115 -0
  36. package/agents/master-orchestrator.md +60 -0
  37. package/agents/pm-agent.md +56 -0
  38. package/agents/qa-agent.md +124 -0
  39. package/agents/tech-lead-agent.md +60 -0
  40. package/assets/install-bundle/README.md +7 -0
  41. package/assets/install-bundle/opencode/README.md +11 -0
  42. package/assets/install-bundle/opencode/agents/ArchitectAgent.md +63 -0
  43. package/assets/install-bundle/opencode/agents/BAAgent.md +56 -0
  44. package/assets/install-bundle/opencode/agents/CodeReviewer.md +77 -0
  45. package/assets/install-bundle/opencode/agents/FullstackAgent.md +115 -0
  46. package/assets/install-bundle/opencode/agents/MasterOrchestrator.md +60 -0
  47. package/assets/install-bundle/opencode/agents/PMAgent.md +56 -0
  48. package/assets/install-bundle/opencode/agents/QAAgent.md +124 -0
  49. package/assets/install-bundle/opencode/agents/TechLeadAgent.md +60 -0
  50. package/assets/install-bundle/opencode/commands/brainstorm.md +44 -0
  51. package/assets/install-bundle/opencode/commands/delivery.md +45 -0
  52. package/assets/install-bundle/opencode/commands/execute-plan.md +44 -0
  53. package/assets/install-bundle/opencode/commands/migrate.md +61 -0
  54. package/assets/install-bundle/opencode/commands/quick-task.md +45 -0
  55. package/assets/install-bundle/opencode/commands/task.md +46 -0
  56. package/assets/install-bundle/opencode/commands/write-plan.md +50 -0
  57. package/assets/install-bundle/opencode/context/core/lane-selection.md +54 -0
  58. package/assets/install-bundle/opencode/skills/brainstorming/SKILL.md +51 -0
  59. package/assets/install-bundle/opencode/skills/code-review/SKILL.md +48 -0
  60. package/assets/install-bundle/opencode/skills/subagent-driven-development/SKILL.md +79 -0
  61. package/assets/install-bundle/opencode/skills/systematic-debugging/SKILL.md +61 -0
  62. package/assets/install-bundle/opencode/skills/test-driven-development/SKILL.md +48 -0
  63. package/assets/install-bundle/opencode/skills/using-skills/SKILL.md +39 -0
  64. package/assets/install-bundle/opencode/skills/verification-before-completion/SKILL.md +137 -0
  65. package/assets/install-bundle/opencode/skills/writing-plans/SKILL.md +68 -0
  66. package/assets/install-bundle/opencode/skills/writing-specs/SKILL.md +47 -0
  67. package/assets/opencode.json.template +11 -0
  68. package/assets/openkit-install.json.template +19 -0
  69. package/bin/openkit.js +9 -0
  70. package/commands/brainstorm.md +44 -0
  71. package/commands/delivery.md +45 -0
  72. package/commands/execute-plan.md +44 -0
  73. package/commands/migrate.md +61 -0
  74. package/commands/quick-task.md +45 -0
  75. package/commands/task.md +46 -0
  76. package/commands/write-plan.md +50 -0
  77. package/context/core/approval-gates.md +146 -0
  78. package/context/core/code-quality.md +42 -0
  79. package/context/core/issue-routing.md +85 -0
  80. package/context/core/lane-selection.md +54 -0
  81. package/context/core/project-config.md +143 -0
  82. package/context/core/session-resume.md +85 -0
  83. package/context/core/workflow-state-schema.md +224 -0
  84. package/context/core/workflow.md +442 -0
  85. package/context/navigation.md +94 -0
  86. package/docs/adr/README.md +6 -0
  87. package/docs/architecture/2026-03-20-task-intake-dashboard.md +54 -0
  88. package/docs/architecture/README.md +7 -0
  89. package/docs/briefs/2026-03-20-task-intake-dashboard.md +48 -0
  90. package/docs/briefs/README.md +7 -0
  91. package/docs/governance/README.md +25 -0
  92. package/docs/governance/adr-policy.md +27 -0
  93. package/docs/governance/definition-of-done.md +17 -0
  94. package/docs/governance/naming-conventions.md +21 -0
  95. package/docs/governance/severity-levels.md +12 -0
  96. package/docs/maintainer/README.md +51 -0
  97. package/docs/operations/README.md +79 -0
  98. package/docs/operations/internal-records/2026-03-24-release-checklist.md +79 -0
  99. package/docs/operations/internal-records/2026-03-24-simplified-install-ux.md +36 -0
  100. package/docs/operations/internal-records/README.md +18 -0
  101. package/docs/operations/runbooks/README.md +23 -0
  102. package/docs/operations/runbooks/openkit-daily-usage.md +288 -0
  103. package/docs/operations/runbooks/workflow-state-smoke-tests.md +302 -0
  104. package/docs/operator/README.md +50 -0
  105. package/docs/plans/2026-03-20-task-intake-dashboard.md +49 -0
  106. package/docs/plans/2026-03-21-openkit-full-delivery-multi-task-runtime.md +521 -0
  107. package/docs/plans/2026-03-23-openkit-global-install-runtime.md +157 -0
  108. package/docs/plans/README.md +7 -0
  109. package/docs/qa/2026-03-20-task-intake-dashboard.md +41 -0
  110. package/docs/qa/README.md +7 -0
  111. package/docs/specs/2026-03-20-task-intake-dashboard.md +50 -0
  112. package/docs/specs/2026-03-21-openkit-full-delivery-multi-task-runtime.md +462 -0
  113. package/docs/specs/README.md +7 -0
  114. package/docs/templates/README.md +36 -0
  115. package/docs/templates/adr-template.md +18 -0
  116. package/docs/templates/architecture-template.md +31 -0
  117. package/docs/templates/implementation-plan-template.md +32 -0
  118. package/docs/templates/migration-baseline-checklist.md +48 -0
  119. package/docs/templates/migration-plan-template.md +52 -0
  120. package/docs/templates/migration-report-template.md +74 -0
  121. package/docs/templates/migration-verify-checklist.md +39 -0
  122. package/docs/templates/product-brief-template.md +32 -0
  123. package/docs/templates/qa-report-template.md +37 -0
  124. package/docs/templates/quick-task-template.md +36 -0
  125. package/docs/templates/spec-template.md +31 -0
  126. package/hooks/hooks.json +16 -0
  127. package/hooks/session-start +162 -0
  128. package/package.json +24 -0
  129. package/registry.json +328 -0
  130. package/skills/brainstorming/SKILL.md +51 -0
  131. package/skills/code-review/SKILL.md +48 -0
  132. package/skills/subagent-driven-development/SKILL.md +79 -0
  133. package/skills/systematic-debugging/SKILL.md +61 -0
  134. package/skills/test-driven-development/SKILL.md +48 -0
  135. package/skills/using-skills/SKILL.md +39 -0
  136. package/skills/verification-before-completion/SKILL.md +137 -0
  137. package/skills/writing-plans/SKILL.md +68 -0
  138. package/skills/writing-specs/SKILL.md +47 -0
  139. package/src/audit/vietnamese-detection.js +259 -0
  140. package/src/cli/commands/detect-vietnamese.js +24 -0
  141. package/src/cli/commands/doctor.js +33 -0
  142. package/src/cli/commands/help.js +33 -0
  143. package/src/cli/commands/init.js +25 -0
  144. package/src/cli/commands/install-global.js +26 -0
  145. package/src/cli/commands/install.js +25 -0
  146. package/src/cli/commands/run.js +63 -0
  147. package/src/cli/commands/uninstall.js +32 -0
  148. package/src/cli/commands/upgrade.js +25 -0
  149. package/src/cli/conflict-output.js +19 -0
  150. package/src/cli/index.js +56 -0
  151. package/src/global/doctor.js +101 -0
  152. package/src/global/ensure-install.js +32 -0
  153. package/src/global/install-state.js +73 -0
  154. package/src/global/launcher.js +51 -0
  155. package/src/global/materialize.js +123 -0
  156. package/src/global/paths.js +85 -0
  157. package/src/global/uninstall.js +25 -0
  158. package/src/global/workspace-state.js +63 -0
  159. package/src/install/asset-manifest.js +284 -0
  160. package/src/install/conflicts.js +43 -0
  161. package/src/install/discovery.js +138 -0
  162. package/src/install/install-state.js +136 -0
  163. package/src/install/materialize.js +158 -0
  164. package/src/install/merge-policy.js +145 -0
  165. package/src/runtime/doctor.js +281 -0
  166. package/src/runtime/launcher.js +49 -0
  167. package/src/runtime/opencode-layering.js +135 -0
  168. package/src/runtime/openkit-managed-summary.js +27 -0
  169. package/tests/cli/openkit-cli.test.js +417 -0
  170. package/tests/global/doctor.test.js +130 -0
  171. package/tests/global/ensure-install.test.js +105 -0
  172. package/tests/install/discovery.test.js +124 -0
  173. package/tests/install/install-state.test.js +346 -0
  174. package/tests/install/materialize.test.js +244 -0
  175. package/tests/install/merge-policy.test.js +177 -0
  176. package/tests/runtime/doctor.test.js +430 -0
  177. package/tests/runtime/launcher.test.js +230 -0
  178. package/tests/runtime/module-boundary.test.js +16 -0
@@ -0,0 +1,521 @@
1
+ ---
2
+ artifact_type: implementation_plan
3
+ version: 1
4
+ status: draft
5
+ feature_id: FEATURE-004
6
+ feature_slug: openkit-full-delivery-multi-task-runtime
7
+ source_spec: docs/specs/2026-03-21-openkit-full-delivery-multi-task-runtime.md
8
+ owner: TechLeadAgent
9
+ approval_gate: tech_lead_to_fullstack
10
+ ---
11
+
12
+ # OpenKit Full-Delivery Multi-Task Runtime Implementation Plan
13
+
14
+ > **For agentic workers:** REQUIRED: Use `skills/subagent-driven-development/SKILL.md` when subagents are available. Steps use checkbox (`- [ ]`) syntax for tracking.
15
+
16
+ **Goal:** Add a multi-work-item runtime foundation plus a full-delivery-only execution task board so Tech Lead can split one feature into non-overlapping developer and QA assignments while quick mode stays unchanged.
17
+
18
+ **Architecture:** Implement this in five layers: work-item storage and compatibility mirroring, full-delivery task-board schema and controller support, CLI commands for work-item and task-board operations, aggregate validation and diagnostics, and doc/test updates that keep the new model aligned with the current hard-split workflow contract. Phase 1 keeps `.opencode/workflow-state.json` as the external canonical interface while new per-item state files become the backing store for the active work item.
19
+
20
+ **Tech Stack:** Node.js runtime utilities, JSON state files, Node test runner, Markdown docs
21
+
22
+ ---
23
+
24
+ ## Dependencies
25
+
26
+ - Source spec: `docs/specs/2026-03-21-openkit-full-delivery-multi-task-runtime.md`
27
+ - Canonical workflow docs: `AGENTS.md`, `context/core/workflow.md`, `context/core/session-resume.md`, `context/core/workflow-state-schema.md`, `context/core/project-config.md`
28
+ - Runtime utilities: `.opencode/workflow-state.js`, `.opencode/lib/workflow-state-controller.js`, `.opencode/lib/workflow-state-rules.js`, `.opencode/lib/contract-consistency.js`
29
+ - Existing runtime tests: `.opencode/tests/workflow-state-controller.test.js`, `.opencode/tests/workflow-state-cli.test.js`, `.opencode/tests/workflow-behavior.test.js`, `.opencode/tests/workflow-contract-consistency.test.js`, `.opencode/tests/session-start-hook.test.js`
30
+ - Existing validation command: `node --test ".opencode/tests/*.test.js"`
31
+
32
+ ## Planned File Map
33
+
34
+ - **Work-item storage layer**
35
+ - Create: `.opencode/lib/work-item-store.js`
36
+ - Modify: `.opencode/lib/workflow-state-controller.js`
37
+ - Modify: `.opencode/workflow-state.js`
38
+ - **Task-board rules layer**
39
+ - Create: `.opencode/lib/task-board-rules.js`
40
+ - Modify: `.opencode/lib/workflow-state-rules.js`
41
+ - Modify: `.opencode/lib/workflow-state-controller.js`
42
+ - **Schema and workflow docs layer**
43
+ - Modify: `context/core/workflow.md`
44
+ - Modify: `context/core/workflow-state-schema.md`
45
+ - Modify: `context/core/session-resume.md`
46
+ - Modify: `context/core/project-config.md`
47
+ - Modify: `AGENTS.md`
48
+ - Modify: `README.md`
49
+ - **Diagnostics and operator layer**
50
+ - Modify: `.opencode/lib/contract-consistency.js`
51
+ - Modify: `hooks/session-start`
52
+ - Modify: `docs/operations/README.md`
53
+ - Modify: `docs/operations/runbooks/workflow-state-smoke-tests.md`
54
+ - Modify: `README.md`
55
+ - **Test layer**
56
+ - Create: `.opencode/tests/work-item-store.test.js`
57
+ - Create: `.opencode/tests/task-board-rules.test.js`
58
+ - Create: `.opencode/tests/multi-work-item-runtime.test.js`
59
+ - Modify: `.opencode/tests/workflow-state-controller.test.js`
60
+ - Modify: `.opencode/tests/workflow-state-cli.test.js`
61
+ - Modify: `.opencode/tests/workflow-contract-consistency.test.js`
62
+ - Modify: `.opencode/tests/session-start-hook.test.js`
63
+
64
+ ## Execution Rules
65
+
66
+ - Do not change the quick-lane contract or add task-board runtime to quick mode.
67
+ - Keep `.opencode/workflow-state.json` as the external canonical interface for phase 1 compatibility.
68
+ - Keep the command surface additive under `node .opencode/workflow-state.js ...`.
69
+ - Do not introduce remote orchestration, dashboards, or distributed locking in this phase.
70
+ - Prefer explicit validation over hidden background sync.
71
+ - Update docs, runtime behavior, and tests together when changing the state model.
72
+ - Do not create git commits during execution unless the user explicitly asks for them.
73
+
74
+ ## Phase-1 Compatibility Notes
75
+
76
+ - The repository already contains `.opencode/workflow-state.json` as the checked-in active work-item example.
77
+ - Phase 1 must bootstrap from that existing file into `.opencode/work-items/index.json` plus `.opencode/work-items/<work-item-id>/state.json` without breaking existing entry commands.
78
+ - `start-feature` and `start-task` must remain backward-compatible entrypoints: they should create or select a work item, write per-item state first, then refresh `.opencode/workflow-state.json` as the active compatibility mirror.
79
+ - The checked-in example repo state must continue to load cleanly after the new storage model is introduced.
80
+
81
+ Phase-1 storage contract:
82
+
83
+ - `work_item_id` must be a stable persisted identifier, not a transient runtime pointer
84
+ - bootstrap from the checked-in `.opencode/workflow-state.json` should derive `work_item_id` from `feature_id` unless a stored work-item id already exists
85
+ - `.opencode/work-items/index.json` must contain at least:
86
+ - `active_work_item_id`
87
+ - `work_items` summary entries with `work_item_id`, `feature_id`, `feature_slug`, `mode`, `status`, and state-file path
88
+ - repeated bootstrap runs against the same checked-in state must produce the same `work_item_id` and not duplicate entries
89
+
90
+ ## Tasks
91
+
92
+ ### Task 1: Introduce the work-item storage layer behind the compatibility state file
93
+
94
+ **Files:**
95
+ - Create: `.opencode/lib/work-item-store.js`
96
+ - Modify: `.opencode/lib/workflow-state-controller.js`
97
+ - Modify: `.opencode/workflow-state.js`
98
+ - Create: `.opencode/tests/work-item-store.test.js`
99
+ - Modify: `.opencode/tests/workflow-state-controller.test.js`
100
+
101
+ - [ ] **Step 1: Write failing tests for multi-work-item storage and compatibility mirroring**
102
+
103
+ Create `.opencode/tests/work-item-store.test.js` with cases for:
104
+ - bootstrapping an existing `.opencode/workflow-state.json` into `.opencode/work-items/index.json` and `.opencode/work-items/<id>/state.json`
105
+ - deriving a stable `work_item_id` and avoiding duplicate bootstrap entries across repeated runs
106
+ - creating `.opencode/work-items/index.json`
107
+ - creating `.opencode/work-items/<id>/state.json`
108
+ - activating one work item and mirroring it into `.opencode/workflow-state.json`
109
+ - reporting divergence when the active-item mirror is stale or missing
110
+
111
+ Add focused failing coverage in `.opencode/tests/workflow-state-controller.test.js` for reading and writing the active work item through the compatibility layer.
112
+
113
+ Run:
114
+ ```bash
115
+ node --test ".opencode/tests/*.test.js"
116
+ ```
117
+ Expected: FAIL because the work-item store does not exist yet.
118
+
119
+ - [ ] **Step 2: Implement a focused work-item store helper**
120
+
121
+ Create `.opencode/lib/work-item-store.js` with narrow responsibilities:
122
+ - bootstrap a legacy `.opencode/workflow-state.json` into the phase-1 work-item layout
123
+ - derive and persist stable `work_item_id` values plus the minimal `index.json` shape
124
+ - resolve `.opencode/work-items/index.json`
125
+ - read and write the work-item index
126
+ - read and write one work item state file
127
+ - update the active-item pointer in the index
128
+ - refresh `.opencode/workflow-state.json` as the active compatibility mirror
129
+
130
+ Keep this helper file-focused. Do not add task-board logic here.
131
+
132
+ - [ ] **Step 3: Route controller reads and writes through the active work-item store**
133
+
134
+ Update `.opencode/lib/workflow-state-controller.js` so feature-level operations use the active work-item backing store while preserving current command behavior for callers that still target `.opencode/workflow-state.json`.
135
+
136
+ Explicitly implement legacy-command behavior:
137
+ - `start-feature` bootstraps or creates the target work item, marks it active, writes per-item state, then refreshes the compatibility mirror
138
+ - `start-task` does the same for explicit quick/full task start flows
139
+
140
+ - [ ] **Step 4: Add additive work-item CLI commands**
141
+
142
+ Extend `.opencode/workflow-state.js` with concrete commands:
143
+ - `create-work-item <mode> <feature_id> <feature_slug> <mode_reason>`
144
+ - `list-work-items`
145
+ - `show-work-item <work_item_id>`
146
+ - `activate-work-item <work_item_id>`
147
+
148
+ Keep `start-task`, `start-feature`, `status`, `show`, and `doctor` working during the transition.
149
+
150
+ - [ ] **Step 5: Re-run the full test suite and confirm mirror behavior**
151
+
152
+ Run:
153
+ ```bash
154
+ node --test ".opencode/tests/*.test.js"
155
+ ```
156
+ Expected: PASS for the new storage and compatibility tests.
157
+
158
+ - [ ] **Step 6: Verify the checked-in example repository state still loads cleanly**
159
+
160
+ Run:
161
+ ```bash
162
+ node .opencode/workflow-state.js show
163
+ node .opencode/workflow-state.js status
164
+ ```
165
+ Expected:
166
+ - the checked-in example state still renders correctly through the compatibility interface
167
+ - no bootstrap error appears for the repository root
168
+
169
+ ### Task 2: Add full-delivery execution-task board rules and persistence
170
+
171
+ **Files:**
172
+ - Create: `.opencode/lib/task-board-rules.js`
173
+ - Modify: `.opencode/lib/workflow-state-rules.js`
174
+ - Modify: `.opencode/lib/workflow-state-controller.js`
175
+ - Create: `.opencode/tests/task-board-rules.test.js`
176
+ - Create: `.opencode/tests/multi-work-item-runtime.test.js`
177
+
178
+ - [ ] **Step 1: Write failing tests for full-only task-board behavior**
179
+
180
+ Create `.opencode/tests/task-board-rules.test.js` and `.opencode/tests/multi-work-item-runtime.test.js` with cases for:
181
+ - rejecting task boards on quick work items
182
+ - allowing task-board creation only for full work items
183
+ - persisting the minimum task record shape required by the spec: `task_id`, `title`, `summary`, `kind`, `status`, `primary_owner`, `qa_owner`, `depends_on`, `blocked_by`, `artifact_refs`, `plan_refs`, `branch_or_worktree`, `created_by`, `created_at`, and `updated_at`
184
+ - one `primary_owner` per task
185
+ - one `qa_owner` per task handoff phase
186
+ - explicit primary-owner reassignment allowed only to `TechLeadAgent` or `MasterOrchestrator`
187
+ - dependency cycle rejection
188
+ - rejecting invalid task transitions
189
+ - rejecting QA-fail rework transitions unless a task-scoped finding is attached
190
+ - rejecting `full_implementation` without a valid task board
191
+
192
+ Run:
193
+ ```bash
194
+ node --test ".opencode/tests/*.test.js"
195
+ ```
196
+ Expected: FAIL because task-board rules and persistence do not exist yet.
197
+
198
+ - [ ] **Step 2: Implement the task-board rules helper**
199
+
200
+ Create `.opencode/lib/task-board-rules.js` to own:
201
+ - the minimum persisted task record contract
202
+ - task shape validation
203
+ - allowed task statuses
204
+ - allowed transition edges
205
+ - task-scoped finding shape for QA-fail rework
206
+ - dependency validation
207
+ - aggregate completion logic for full-delivery boards
208
+
209
+ Do not mix feature-stage logic deeply into this helper; expose clear validation functions instead.
210
+
211
+ - [ ] **Step 3: Add task-board persistence to the controller**
212
+
213
+ Update `.opencode/lib/workflow-state-controller.js` so `full` work items can carry `tasks.json` under `.opencode/work-items/<id>/tasks.json`, while `quick` work items reject task-board operations.
214
+
215
+ Persist task-scoped findings with the board so QA-fail rework decisions can point to a specific `task_id` without overloading feature-level issue storage.
216
+
217
+ - [ ] **Step 4: Enforce feature-stage and task-board alignment**
218
+
219
+ Add controller validation for:
220
+ - `full_plan` may create and revise the initial board
221
+ - `full_implementation` requires an initialized board
222
+ - `full_qa` requires implementation tasks to be complete enough for QA handoff
223
+ - `full_done` requires aggregate board completion and no blocking issue
224
+ - `tech_lead_to_fullstack` requires a valid initial board
225
+ - `fullstack_to_qa` requires implementation-complete tasks in valid handoff states
226
+ - `qa_to_done` requires QA-complete tasks and no blocking feature-level issue
227
+ - `qa_in_progress -> claimed|in_progress` rework transitions require an attached task-scoped finding
228
+
229
+ - [ ] **Step 5: Re-run targeted tests, then the full suite**
230
+
231
+ Run targeted task-board tests first, then:
232
+ ```bash
233
+ node --test ".opencode/tests/*.test.js"
234
+ ```
235
+ Expected: PASS.
236
+
237
+ - [ ] **Step 6: Re-run legacy entrypoint regression checks**
238
+
239
+ Run focused checks for:
240
+ - `start-feature`
241
+ - `start-task quick ...`
242
+ - `start-task full ...`
243
+ - repeated bootstrap against the checked-in example state
244
+
245
+ Expected:
246
+ - all entrypoints create or activate work items through the new storage layer without breaking the compatibility mirror
247
+ - repeated bootstrap keeps a stable `work_item_id` and does not duplicate index entries
248
+
249
+ ### Task 3: Add additive CLI commands for task-board operation and assignment
250
+
251
+ **Files:**
252
+ - Modify: `.opencode/workflow-state.js`
253
+ - Modify: `.opencode/lib/workflow-state-controller.js`
254
+ - Modify: `.opencode/tests/workflow-state-cli.test.js`
255
+ - Modify: `.opencode/tests/multi-work-item-runtime.test.js`
256
+
257
+ - [ ] **Step 1: Write failing CLI tests for task-board commands**
258
+
259
+ Add CLI tests for:
260
+ - `list-tasks <work_item_id>`
261
+ - `create-task <work_item_id> <task_id> <title> <kind> [branch] [worktree_path]`
262
+ - `claim-task <work_item_id> <task_id> <owner> <requested_by>`
263
+ - `release-task <work_item_id> <task_id> <requested_by>`
264
+ - `reassign-task <work_item_id> <task_id> <owner> <requested_by>`
265
+ - `assign-qa-owner <work_item_id> <task_id> <owner> <requested_by>`
266
+ - `set-task-status <work_item_id> <task_id> <status>`
267
+
268
+ Do not add CLI tests for unimplemented commands such as `show-task`, `add-task-dependency`, `add-task-finding`, or `summarize-work-item` in this slice unless the runtime adds them first.
269
+
270
+ - [ ] **Step 2: Implement the smallest useful controller helpers for each CLI action**
271
+
272
+ Keep helpers narrow:
273
+ - no bulk mutation API
274
+ - no hidden auto-assignment
275
+ - no broad “update anything” command that bypasses guardrails
276
+
277
+ - [ ] **Step 3: Enforce ownership-safe transitions in CLI flows**
278
+
279
+ Ensure runtime rejects:
280
+ - claiming an already owned task
281
+ - reassigning a task from the wrong authority
282
+ - QA ownership on a task that is not in a QA-handoff-capable state
283
+ - status changes by the wrong owner or wrong role
284
+ - QA-fail rework transitions without a task-scoped finding
285
+ - task creation for a quick item
286
+
287
+ - [ ] **Step 4: Add aggregate inspection commands**
288
+
289
+ Extend the CLI with:
290
+ - `validate-work-item-board <work_item_id>`
291
+
292
+ Keep output concise and operator-readable.
293
+
294
+ - [ ] **Step 5: Re-run CLI and runtime tests**
295
+
296
+ Run:
297
+ ```bash
298
+ node --test ".opencode/tests/*.test.js"
299
+ ```
300
+ Expected: PASS.
301
+
302
+ ### Task 4: Update workflow docs and schema docs for the multi-item full-delivery model
303
+
304
+ **Files:**
305
+ - Modify: `AGENTS.md`
306
+ - Modify: `README.md`
307
+ - Modify: `context/core/workflow.md`
308
+ - Modify: `context/core/workflow-state-schema.md`
309
+ - Modify: `context/core/session-resume.md`
310
+ - Modify: `context/core/project-config.md`
311
+
312
+ - [ ] **Step 1: Build a doc alignment checklist from the approved spec**
313
+
314
+ List the canonical points that must become true in docs:
315
+ - quick lane unchanged
316
+ - `.opencode/workflow-state.json` still canonical externally in phase 1
317
+ - per-item backing store exists behind it
318
+ - full-delivery-only task board from `full_plan` onward
319
+ - role-level feature owner vs task-level owners
320
+
321
+ - [ ] **Step 2: Update the workflow and schema docs together**
322
+
323
+ Make `context/core/workflow.md` and `context/core/workflow-state-schema.md` agree on:
324
+ - the new multi-work-item runtime model
325
+ - the compatibility role of `.opencode/workflow-state.json`
326
+ - the full-delivery task-board concept
327
+ - quick-mode non-participation in task-board behavior
328
+ - the minimum new multi-item and task-board fields introduced in phase 1
329
+
330
+ - [ ] **Step 3: Update resume and project-config docs**
331
+
332
+ Make `context/core/session-resume.md` describe how full-delivery resume should surface feature context plus assigned task context.
333
+
334
+ Make `context/core/project-config.md` list the new runtime commands and limits honestly.
335
+
336
+ - [ ] **Step 4: Update top-level docs without restating too much workflow law**
337
+
338
+ Update `AGENTS.md` and `README.md` so they:
339
+ - acknowledge multi-work-item runtime support
340
+ - keep quick/full limits clear
341
+ - point back to the canonical workflow and schema docs for detail
342
+
343
+ - [ ] **Step 5: Manually verify the doc set is internally consistent**
344
+
345
+ Validation:
346
+ - read the touched docs together
347
+ - confirm no doc implies task-board support for quick mode
348
+ - confirm no doc says `.opencode/workflow-state.json` disappeared in phase 1
349
+ - confirm schema docs and runtime validators describe the same new fields and invariants
350
+
351
+ ### Task 5: Extend diagnostics, resume output, and drift detection for the new state model
352
+
353
+ **Files:**
354
+ - Modify: `.opencode/lib/contract-consistency.js`
355
+ - Modify: `hooks/session-start`
356
+ - Modify: `.opencode/lib/workflow-state-controller.js`
357
+ - Modify: `.opencode/tests/workflow-contract-consistency.test.js`
358
+ - Modify: `.opencode/tests/session-start-hook.test.js`
359
+ - Modify: `.opencode/tests/workflow-state-cli.test.js`
360
+
361
+ - [ ] **Step 1: Write failing tests for multi-item diagnostics and resume output**
362
+
363
+ Add cases for:
364
+ - active-item pointer referencing a missing work item
365
+ - compatibility mirror divergence
366
+ - quick work item incorrectly carrying a `tasks.json`
367
+ - session-start showing active work item plus task-level resume summary for full delivery
368
+ - `doctor` surfacing task-board integrity failures
369
+
370
+ - [ ] **Step 2: Extend contract-consistency checks narrowly**
371
+
372
+ Update `.opencode/lib/contract-consistency.js` to validate only stable multi-item invariants:
373
+ - expected work-item index and active pointer surfaces exist
374
+ - active-item pointer targets a real work item
375
+ - quick items do not carry task-board data
376
+ - schema/docs mention the right phase-1 compatibility behavior
377
+
378
+ - [ ] **Step 3: Update `status`, `doctor`, and `session-start`**
379
+
380
+ Make runtime output show:
381
+ - active work item id
382
+ - work-item count summary where useful
383
+ - task-board summary for active full-delivery work items
384
+ - resume hints that surface assigned or active tasks without guessing one implicit subtask when several are active
385
+
386
+ - [ ] **Step 4: Re-run diagnostics and full tests**
387
+
388
+ Run:
389
+ ```bash
390
+ node .opencode/workflow-state.js doctor
391
+ node --test ".opencode/tests/*.test.js"
392
+ ```
393
+ Expected: PASS.
394
+
395
+ - [ ] **Step 5: Keep diagnostics additive and readable**
396
+
397
+ Refactor output strings only if the new runtime data makes command output too noisy or unclear.
398
+
399
+ ### Task 6: Update operations guidance and add one realistic full-delivery task-board verification flow
400
+
401
+ **Files:**
402
+ - Modify: `docs/operations/README.md`
403
+ - Modify: `docs/operations/runbooks/workflow-state-smoke-tests.md`
404
+ - Modify: `README.md` if the walkthrough needs a top-level pointer
405
+
406
+ - [ ] **Step 1: Add operator guidance for work-item and task-board inspection**
407
+
408
+ Document the smallest honest flow for:
409
+ - listing work items
410
+ - activating a work item
411
+ - listing tasks on a full-delivery board
412
+ - validating board integrity
413
+
414
+ - [ ] **Step 2: Add runnable smoke-test steps with exact commands**
415
+
416
+ Include exact commands for:
417
+ ```bash
418
+ node .opencode/workflow-state.js list-work-items
419
+ node .opencode/workflow-state.js show-work-item <id>
420
+ node .opencode/workflow-state.js list-tasks <id>
421
+ node .opencode/workflow-state.js validate-work-item-board <id>
422
+ node --test ".opencode/tests/*.test.js"
423
+ ```
424
+
425
+ - [ ] **Step 3: Add one realistic walkthrough section to the smoke-test runbook**
426
+
427
+ Expand `docs/operations/runbooks/workflow-state-smoke-tests.md` to show:
428
+ - one full-delivery feature entering `full_plan`
429
+ - Tech Lead creating task-board entries
430
+ - two implementation tasks with different primary owners
431
+ - one QA handoff
432
+ - final validation commands
433
+
434
+ - [ ] **Step 4: Review docs for honesty and scope control**
435
+
436
+ Confirm docs do not imply:
437
+ - quick-mode task boards
438
+ - collaborative multi-owner task editing
439
+ - dashboards or remote orchestrators
440
+
441
+ - [ ] **Step 5: Re-run the runtime test suite after any example-linked doc changes**
442
+
443
+ Run:
444
+ ```bash
445
+ node --test ".opencode/tests/*.test.js"
446
+ ```
447
+ Expected: PASS.
448
+
449
+ ### Task 7: Final integration pass for the phase-1 multi-task runtime slice
450
+
451
+ **Files:**
452
+ - Modify: any touched file that fails final verification
453
+
454
+ - [ ] **Step 1: Run the full runtime suite**
455
+
456
+ Run:
457
+ ```bash
458
+ node --test ".opencode/tests/*.test.js"
459
+ ```
460
+ Expected: PASS.
461
+
462
+ - [ ] **Step 2: Run the runtime inspection commands on the repository root**
463
+
464
+ Run:
465
+ ```bash
466
+ node .opencode/workflow-state.js status
467
+ node .opencode/workflow-state.js doctor
468
+ node .opencode/workflow-state.js show
469
+ ```
470
+
471
+ Expected:
472
+ - commands exit successfully for the checked-in repo state
473
+ - active-item compatibility output is readable
474
+ - no task-board diagnostics incorrectly appear for the current quick-less golden-path example unless a full example board is intentionally added
475
+
476
+ - [ ] **Step 2b: Re-run legacy entrypoint verification on the repository root or isolated fixture path**
477
+
478
+ Run legacy-compatible start flows against a temp state path or isolated fixture path and confirm they still create or activate work items correctly through the new runtime model.
479
+
480
+ - [ ] **Step 3: Perform a final cross-surface consistency pass**
481
+
482
+ Read together:
483
+ - `AGENTS.md`
484
+ - `context/core/workflow.md`
485
+ - `context/core/workflow-state-schema.md`
486
+ - `context/core/session-resume.md`
487
+ - `README.md`
488
+ - `.opencode/workflow-state.js --help` output
489
+
490
+ Confirm they tell the same story about:
491
+ - quick mode staying simple
492
+ - full-delivery-only task boards
493
+ - compatibility mirroring through `.opencode/workflow-state.json`
494
+
495
+ - [ ] **Step 4: Record remaining non-blocking follow-ups in the delivery summary**
496
+
497
+ Call out deferred work such as:
498
+ - richer event logs
499
+ - stale-lock handling
500
+ - optional dashboard UI
501
+ - optional worktree orchestration metadata beyond phase-1 support
502
+
503
+ - [ ] **Step 5: Prepare execution handoff notes**
504
+
505
+ Document:
506
+ - what changed in runtime shape
507
+ - what operators must now watch for
508
+ - what remains intentionally out of scope in phase 1
509
+
510
+ ## Risks
511
+
512
+ - The active-item compatibility mirror could drift from per-item backing files if sync order is not enforced tightly.
513
+ - Full-delivery task-board rules could accidentally leak into quick mode if validation and docs are not updated together.
514
+ - Overly generic task mutation commands could bypass ownership and dependency safeguards.
515
+ - The current golden-path example state may need careful migration or fixture strategy so tests remain readable.
516
+
517
+ ## Rollback Notes
518
+
519
+ - Revert work-item storage changes together with the CLI and diagnostics changes if the compatibility mirror becomes unreliable.
520
+ - Revert task-board persistence and commands together if full-delivery ownership rules prove inconsistent.
521
+ - Restore the last passing `node --test ".opencode/tests/*.test.js"` baseline before retrying any failed slice.
@@ -0,0 +1,157 @@
1
+ ---
2
+ artifact_type: implementation_plan
3
+ version: 1
4
+ status: draft
5
+ feature_id: FEATURE-005
6
+ feature_slug: openkit-global-install-runtime
7
+ source_architecture: docs/architecture/2026-03-23-openkit-global-install-runtime.md
8
+ owner: TechLeadAgent
9
+ approval_gate: tech_lead_to_fullstack
10
+ ---
11
+
12
+ # Implementation Plan: OpenKit Global Install Runtime
13
+
14
+ ## Goal
15
+
16
+ - Convert OpenKit from a repository-local checked-in runtime into a globally installed OpenCode kit that can be enabled with one install command and used across many repositories without copying the kit into each project.
17
+
18
+ ## Dependencies
19
+
20
+ - Current repository runtime contract in `AGENTS.md`, `context/core/workflow.md`, `context/core/lane-selection.md`, and `context/core/project-config.md`.
21
+ - Current repository-local runtime surfaces under `.opencode/`, `agents/`, `skills/`, `commands/`, `context/`, `hooks/`, and `docs/`.
22
+ - Install-bundle authoring source under `assets/install-bundle/opencode/`.
23
+ - Existing workflow-state runtime tests under `.opencode/tests/`.
24
+ - OpenCode global config and profile integration behavior must be confirmed during implementation because the repository does not yet contain a shipped global wrapper path.
25
+
26
+ ## Non-Goals
27
+
28
+ - Do not redesign quick, migration, or full lane semantics.
29
+ - Do not move project output artifacts such as plans, architecture docs, QA docs, or ADRs into global storage.
30
+ - Do not assume a remote plugin marketplace or managed package registry unless implementation adds it explicitly.
31
+
32
+ ## Target UX
33
+
34
+ - Fresh machine install:
35
+ - `npx openkit@latest install-global`
36
+ - `npx openkit@latest doctor`
37
+ - Day-to-day usage in any repo:
38
+ - `opencode --profile openkit`
39
+ - Existing repo should not need checked-in `agents/`, `skills/`, `commands/`, or `.opencode/` surfaces just to use the kit.
40
+
41
+ ## Proposed Runtime Shape
42
+
43
+ ### Global kit location
44
+ - `~/.config/opencode/kits/openkit/` on macOS/Linux
45
+ - platform-equivalent OpenCode config root on other systems
46
+
47
+ ### Global workspace state
48
+ - `~/.config/opencode/workspaces/<workspace-id>/openkit/`
49
+ - contains workflow state, work-item backing store, logs, cache, and per-project install/runtime metadata
50
+
51
+ ### Project-local output only
52
+ - workflow-created deliverables still land in the project, such as `docs/plans/`, `docs/architecture/`, `docs/qa/`, and `docs/adr/`
53
+
54
+ ## Tasks
55
+
56
+ ### [ ] Task 1: Define global install architecture and compatibility contract
57
+ - Files: `AGENTS.md`, `README.md`, `context/core/project-config.md`, `docs/operations/README.md`, `docs/operations/runbooks/openkit-daily-usage.md`, `context/core/session-resume.md`
58
+ - Goal: document the new truth that OpenKit kit code and workspace state move to global OpenCode storage while project artifacts remain local.
59
+ - Validation: docs are internally consistent; no file still claims the repository-local checked-in runtime is the only live path once the new architecture lands.
60
+ - Notes:
61
+ - explicitly document global install directories and the split between global kit, global workspace state, and project-local artifacts
62
+ - keep a compatibility note for existing repository-local runtime during migration
63
+
64
+ ### [ ] Task 2: Introduce a global OpenKit CLI surface
65
+ - Files: new installer/runtime package area, package metadata, launcher scripts, possible `bin/` entrypoints, global manifest templates
66
+ - Goal: add product-level commands `install-global`, `doctor`, and `run` that operate without requiring the user to clone this repository into every project.
67
+ - Validation: local CLI smoke tests cover install, doctor, help output, and run-command argument handling.
68
+ - Notes:
69
+ - `install-global` should install or refresh the global bundle and register the `openkit` profile
70
+ - `doctor` should validate both global install health and current-workspace health
71
+ - `run` should launch OpenCode with the installed `openkit` profile or equivalent resolved config
72
+
73
+ ### [ ] Task 3: Build a managed global bundle from authoring sources
74
+ - Files: `assets/install-bundle/opencode/`, new bundle-build script or packaging logic, global manifest/version files
75
+ - Goal: create a versioned bundle output that can be installed globally without copying the whole authoring repository into a project.
76
+ - Validation: generated bundle contains the expected managed sources and matches the command/agent/skill/context surfaces required by `doctor`.
77
+ - Notes:
78
+ - treat `assets/install-bundle/opencode/` as the install source of truth
79
+ - emit a manifest of managed files for later upgrade and uninstall safety
80
+
81
+ ### [ ] Task 4: Replace repository-local bootstrap assumptions with global workspace bootstrap
82
+ - Files: workflow-state bootstrap utilities, session-start integration, workspace discovery logic, global state path helpers
83
+ - Goal: make first use in a project create or locate workspace state in the global store instead of assuming `.opencode/workflow-state.json` already exists in the project.
84
+ - Validation: opening a fresh repo produces a valid empty workspace state with no active work item; `doctor` reports this as healthy.
85
+ - Notes:
86
+ - install state must be separate from active workflow state
87
+ - no fake active work item should be created during install
88
+ - workspace id should resolve deterministically from git root or absolute project path
89
+
90
+ ### [ ] Task 5: Migrate workflow-state runtime to support global workspace storage
91
+ - Files: workflow-state controller/store modules, path resolution helpers, runtime manifest lookup, tests under `.opencode/tests/`
92
+ - Goal: move active state, work items, and backing-store logic from repo-local `.opencode/` assumptions into a workspace-aware global storage layer.
93
+ - Validation: all existing runtime semantics still pass under the new store; tests cover workspace bootstrap, state reads/writes, mirror behavior, task boards, and routing profile validation.
94
+ - Notes:
95
+ - preserve lane semantics, routing profile checks, artifact signatures, and task-board restrictions
96
+ - keep project artifact path emission relative to the active project root
97
+
98
+ ### [ ] Task 6: Add compatibility adoption path for existing repository-local installs
99
+ - Files: installer/adoption logic, migration docs, doctor rules, possible state migration utilities
100
+ - Goal: allow existing OpenKit repositories to adopt the new global model without losing work-item state or artifact references.
101
+ - Validation: migration tests cover adopting a checked-in `.opencode/` runtime into the global store and preserving active work-item continuity.
102
+ - Notes:
103
+ - provide an explicit adoption mode rather than silently overwriting checked-in runtime surfaces
104
+ - keep rollback straightforward by preserving a backup or export path for old state
105
+
106
+ ### [ ] Task 7: Register and validate the OpenCode profile integration
107
+ - Files: global profile config templates, launcher wiring, doctor/profile checks
108
+ - Goal: make `opencode --profile openkit` a supported path after global installation.
109
+ - Validation: profile registration can be inspected; doctor confirms registration; run-path smoke tests succeed.
110
+ - Notes:
111
+ - do not assume OpenCode plugin APIs that are not proven; verify the real profile/config surface during implementation
112
+ - if OpenCode profile registration is partial, provide a deterministic fallback run path with clear docs
113
+
114
+ ### [ ] Task 8: Harden doctor, upgrade, and uninstall safety
115
+ - Files: global doctor checks, install metadata, managed-file manifest, version markers, upgrade planning docs
116
+ - Goal: ensure the global kit can be inspected, upgraded, and eventually removed safely.
117
+ - Validation: tests cover reinstall, idempotent install, version refresh, stale global workspace detection, and managed-file integrity.
118
+ - Notes:
119
+ - doctor should distinguish global install health from active workspace health
120
+ - upgrade must preserve workspace state and project artifacts
121
+ - uninstall can remain a later command, but managed file tracking must be introduced now
122
+
123
+ ## Validation Strategy
124
+
125
+ - Unit and integration tests for installer, bundle generation, workspace bootstrap, state store migration, and profile registration.
126
+ - Runtime parity tests proving quick, migration, and full semantics remain unchanged after state-store relocation.
127
+ - Fresh-machine smoke path:
128
+ - install globally
129
+ - run doctor successfully
130
+ - open a fresh repo
131
+ - start a quick task
132
+ - confirm state lands in global workspace storage and artifacts still emit into the project when requested
133
+ - Existing-repo adoption smoke path:
134
+ - adopt a repository that already contains repository-local OpenKit surfaces
135
+ - preserve state and artifact references
136
+
137
+ ## Risks
138
+
139
+ - OpenCode global profile integration details may differ from the current assumptions and require adapter logic.
140
+ - Moving state out of the repository can break existing tests, docs, and resume flows if path resolution is incomplete.
141
+ - Backward compatibility with repository-local `.opencode/` installs can become messy without a clear adoption contract.
142
+ - Users may expect project-local visibility into state; doctor and docs must explain where global state now lives.
143
+
144
+ ## Rollback Notes
145
+
146
+ - Keep the current repository-local runtime path operational until the global path is proven and documented.
147
+ - Implement global install behind an additive compatibility layer first, then switch docs and defaults only after validation passes.
148
+ - Preserve export or backup capability for any repository-local state migrated into global workspace storage.
149
+
150
+ ## Acceptance Criteria
151
+
152
+ - A user on a fresh machine can install OpenKit globally with one command and validate it with one doctor command.
153
+ - A user can enter any project and start using OpenKit without copying the kit into that project.
154
+ - Global workspace state is created automatically and remains isolated per project.
155
+ - Project-local workflow artifacts still emit into the active repository.
156
+ - Lane selection, routing profile validation, artifact signatures, migration behavior, and full-delivery task-board rules remain intact.
157
+ - Existing repository-local OpenKit projects have a documented and tested adoption path.