@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,42 @@
1
+ # Code Quality Standards — Open Kit
2
+
3
+ All implementation agents MUST follow these standards before writing any code.
4
+
5
+ ## Import Discipline
6
+ - Import only what a file uses
7
+ - Prefer explicit imports over wildcard imports
8
+ - Remove unused imports in the same change that introduces them
9
+
10
+ ## Formatting
11
+ - Consistent indentation per language convention
12
+ - No unrelated file reformatting
13
+ - Follow the project's existing formatter if one exists
14
+
15
+ ## Type Discipline
16
+ - Prefer explicit types, schemas, or contracts
17
+ - Avoid broad `any`-style escapes; document exceptions
18
+ - Make nullability, optional fields, and error cases explicit
19
+
20
+ ## Naming
21
+ - Descriptive names that reflect domain intent
22
+ - No abbreviations unless ecosystem-standard
23
+ - Match existing naming patterns before introducing new ones
24
+
25
+ ## Function & File Scope
26
+ - One primary responsibility per file
27
+ - Functions small enough that intent is obvious
28
+ - Split large mixed-responsibility units into smaller ones
29
+
30
+ ## Error Handling
31
+ - Fail loudly so the next agent can diagnose the issue
32
+ - Do not swallow errors without recording why it is safe
33
+ - Return or raise structured errors when the stack supports it
34
+
35
+ ## Tests
36
+ - Add or update tests when behavior changes
37
+ - Prefer tests that validate behavior, not implementation details
38
+ - If no test framework exists, describe the missing validation path in your report
39
+
40
+ ## Documentation
41
+ - Update relevant docs when commands, workflows, or architecture change
42
+ - Do not leave future agents to infer decisions from code alone
@@ -0,0 +1,85 @@
1
+ # Issue Routing
2
+
3
+ This file defines how QA findings are classified and routed.
4
+
5
+ For the canonical workflow contract, including lane semantics, stage order, escalation policy, and artifact expectations, use `context/core/workflow.md`.
6
+
7
+ Classification is shared across all workflow modes, but routing behavior depends on the active work item mirrored through `.opencode/workflow-state.json`.
8
+
9
+ ## Required Issue Schema
10
+
11
+ Each issue should record:
12
+
13
+ - `issue_id`
14
+ - `title`
15
+ - `type`: `bug` | `design_flaw` | `requirement_gap`
16
+ - `severity`: `critical` | `high` | `medium` | `low`
17
+ - `rooted_in`: `implementation` | `architecture` | `requirements`
18
+ - `recommended_owner`
19
+ - `evidence`
20
+ - `artifact_refs`
21
+
22
+ ## Ownership Rules
23
+
24
+ | Type | Default Owner |
25
+ | --- | --- |
26
+ | `bug` | `FullstackAgent` |
27
+ | `design_flaw` | `ArchitectAgent` |
28
+ | `requirement_gap` | `BAAgent` |
29
+
30
+ ## Routing By Mode
31
+
32
+ ### Quick Task routing
33
+
34
+ | Type | Route to | Expected action |
35
+ | --- | --- | --- |
36
+ | `bug` | `quick_build` / `FullstackAgent` | Fix in quick mode and re-verify |
37
+ | `design_flaw` | `full_intake` / `MasterOrchestrator` | Escalate to full delivery |
38
+ | `requirement_gap` | `full_intake` / `MasterOrchestrator` | Escalate to full delivery |
39
+
40
+ Quick mode must not absorb design or requirements work. When either appears, quick execution stops and the work is promoted to the full lane.
41
+
42
+ With the stronger quick-lane semantics now live, quick work includes an explicit `quick_plan` stage, but that stronger quick lane does not relax the design/requirements guardrail.
43
+
44
+ Quick-mode guardrail:
45
+
46
+ - do not invent a quick task board, per-task owners, or QA-per-subtask routing
47
+
48
+ ### Full Delivery routing
49
+
50
+ | Type | Route to | Expected action |
51
+ | --- | --- | --- |
52
+ | `bug` | `full_implementation` / `FullstackAgent` | Fix implementation and return to QA |
53
+ | `design_flaw` | `full_architecture` / `ArchitectAgent` | Repair the design or escalate implementation concerns through architecture review |
54
+ | `requirement_gap` | `full_spec` / `BAAgent` | Clarify or repair requirements |
55
+
56
+ Task-aware full-delivery note:
57
+
58
+ - full-delivery execution tasks may carry task-local owners and findings, but routing still resolves to the feature-level stage owner above
59
+ - task-local rework may stay within the task board only for implementation-rooted bugs that do not require a stage change
60
+ - when a QA finding reveals a design flaw or requirement gap, the feature returns to `full_architecture` or `full_spec` even if the finding started from one execution task
61
+ - preserve task ids and task evidence in issue notes so the orchestrator can reconnect feature routing with task-board state
62
+
63
+ ### Migration routing
64
+
65
+ | Type | Route to | Expected action |
66
+ | --- | --- | --- |
67
+ | `bug` | `migration_upgrade` / `FullstackAgent` | Fix upgrade fallout and re-verify |
68
+ | `design_flaw` | `migration_strategy` / `TechLeadAgent` | Rework upgrade sequencing, compatibility assumptions, or rollback plan |
69
+ | `requirement_gap` | `full_intake` / `MasterOrchestrator` | Escalate into full delivery because the issue is no longer primarily technical migration work |
70
+
71
+ Migration mode treats compatibility or upgrade-path mistakes as migration-stage work, but it must not absorb product-definition ambiguity.
72
+
73
+ Migration-mode guardrail:
74
+
75
+ - do not invent a migration task board, per-task owners, or QA-per-subtask routing in the current live contract
76
+
77
+ ## Retry And Escalation
78
+
79
+ - Increment `retry_count` when the same issue cycles back after a failed fix
80
+ - In quick mode, repeated `bug` failures still stay in quick mode unless a design or requirement problem is uncovered and the work is no longer safely bounded
81
+ - In quick mode, `design_flaw` and `requirement_gap` escalate immediately rather than retrying inside quick mode
82
+ - In migration mode, repeated `bug` failures still stay in migration mode unless product ambiguity is uncovered and the work no longer fits migration semantics
83
+ - In migration mode, `requirement_gap` escalates immediately to full delivery instead of retrying inside migration mode
84
+ - In full mode, repeated task-local failures may keep a task in local rework only while the issue remains implementation-rooted and stage ownership does not need to change
85
+ - Escalate to the user after 3 failed loops on the same issue family
@@ -0,0 +1,54 @@
1
+ # Lane Selection
2
+
3
+ This file is the detailed routing reference for choosing between `Quick Task`, `Migration`, and `Full Delivery`.
4
+
5
+ Use `context/core/workflow.md` for the canonical live contract. Use this file when you need the stricter routing rubric, tie-breakers, anti-patterns, and examples.
6
+
7
+ ## Core Rule
8
+
9
+ Choose the lane by the dominant uncertainty of the work, not by estimated size alone.
10
+
11
+ - `Quick Task`: low local uncertainty inside already-understood behavior
12
+ - `Migration`: compatibility uncertainty inside behavior-preserving modernization
13
+ - `Full Delivery`: product, requirements, acceptance, or cross-boundary solution uncertainty
14
+
15
+ ## Routing Profile Dimensions
16
+
17
+ Record and reason with these dimensions:
18
+
19
+ - `work_intent`: `maintenance`, `modernization`, `feature`
20
+ - `behavior_delta`: `preserve`, `extend`, `redefine`
21
+ - `dominant_uncertainty`: `low_local`, `compatibility`, `product`
22
+ - `scope_shape`: `local`, `adjacent`, `cross_boundary`
23
+
24
+ Expected combinations:
25
+
26
+ - `Quick Task` -> `maintenance`, `preserve`, `low_local`, `local|adjacent`
27
+ - `Migration` -> `modernization`, `preserve`, `compatibility`, `local|adjacent|cross_boundary`
28
+ - `Full Delivery` -> usually `feature`, `extend|redefine`, `product`, often `cross_boundary`
29
+
30
+ ## Tie-Breaker Priority
31
+
32
+ Apply these in order:
33
+
34
+ 1. If `behavior_delta` is not `preserve`, choose `Full Delivery`.
35
+ 2. If `dominant_uncertainty` is `product`, choose `Full Delivery`.
36
+ 3. If `dominant_uncertainty` is `compatibility` and preserved behavior is known, choose `Migration`.
37
+ 4. If `dominant_uncertainty` is `low_local` and scope stays bounded, choose `Quick Task`.
38
+ 5. If uncertainty still cannot be classified honestly, choose `Full Delivery`.
39
+
40
+ ## Anti-Patterns
41
+
42
+ - Do not choose `Quick Task` for a dependency or framework upgrade just because the code diff looks small.
43
+ - Do not choose `Migration` when acceptance criteria or business semantics are being redefined.
44
+ - Do not choose `Full Delivery` for straightforward modernization work only because internal architecture must change.
45
+ - Do not let file count or estimated duration override the dominant uncertainty rule.
46
+
47
+ ## Fast Examples
48
+
49
+ - Upgrade React 16 to React 19 with preserved screens -> `Migration`
50
+ - Add a new billing workflow -> `Full Delivery`
51
+ - Fix a typo in one operator doc -> `Quick Task`
52
+ - Replace one deprecated helper with known equivalent behavior -> `Quick Task`
53
+ - Modernize fetching to React Query while preserving UX and rules -> `Migration`
54
+ - Upgrade framework and redesign onboarding flow -> `Full Delivery`
@@ -0,0 +1,143 @@
1
+ # Project Configuration & Tooling Standards
2
+
3
+ This file defines the current execution reality for the repository. Agents must use documented commands when they exist and explicitly report when they do not.
4
+
5
+ For the canonical workflow contract, including lane semantics, stage order, escalation policy, approvals, and artifact expectations, use `context/core/workflow.md`.
6
+
7
+ ## Current State
8
+
9
+ - There is no repo-native build command for generated application code yet.
10
+ - There is no repo-native lint command for generated application code yet.
11
+ - There is no repo-native test command for generated application code yet.
12
+ - There is no single canonical package manager or language toolchain for future applications yet.
13
+ - OpenKit uses the mode-aware workflow documented in `context/core/workflow.md`; keep tooling and command guidance here aligned with that live contract instead of re-stating lane policy in full.
14
+ - The active compatibility mirror uses a mode-aware schema and `.opencode/workflow-state.js` supports that workflow model.
15
+ - The preferred operator install path is now global: `npm install -g openkit`, then `openkit run` and `openkit doctor`.
16
+ - The checked-in repository-local runtime still exists as the authoring and compatibility surface under `.opencode/`.
17
+ - `registry.json` and `.opencode/install-manifest.json` are additive local metadata surfaces; they do not imply destructive install or plugin-only packaging.
18
+ - Repository-internal runtime surfaces still include workflow state, workflow-state CLI, hooks, agents, skills, commands, context, and maintained docs.
19
+ - Global-facing metadata surface is currently limited to documentation and metadata that explain the global install and compatibility contract.
20
+
21
+ ## Commands That Do Exist
22
+
23
+ - Session hook configuration lives in `hooks/hooks.json`.
24
+ - The session-start hook script lives in `hooks/session-start`.
25
+ - The global OpenKit CLI entrypoint lives at `bin/openkit.js`.
26
+ - The OpenCode kit manifest lives in `.opencode/opencode.json`.
27
+ - The global install writes its own profile manifest under the OpenCode home directory.
28
+ - The active compatibility mirror lives in `.opencode/workflow-state.json`.
29
+ - The managed work-item backing store lives in `.opencode/work-items/`.
30
+ - The workflow-state CLI lives at `.opencode/workflow-state.js`.
31
+ - Workflow command contracts live under `commands/`.
32
+ - Registry metadata lives in `registry.json`.
33
+ - Install metadata lives in `.opencode/install-manifest.json`.
34
+ - The repository does not contain a root `opencode.json` entrypoint.
35
+
36
+ ### Workflow-State Utility Commands
37
+
38
+ These are repository workflow commands, not application build/lint/test commands:
39
+
40
+ - `npm install -g openkit`
41
+ - `openkit install-global`
42
+ - `openkit doctor`
43
+ - `openkit run [args]`
44
+ - `openkit upgrade`
45
+ - `openkit uninstall [--remove-workspaces]`
46
+
47
+ - `node .opencode/workflow-state.js status`
48
+ - `node .opencode/workflow-state.js doctor`
49
+ - `node .opencode/workflow-state.js version`
50
+ - `node .opencode/workflow-state.js profiles`
51
+ - `node .opencode/workflow-state.js show-profile <name>`
52
+ - `node .opencode/workflow-state.js sync-install-manifest <name>`
53
+ - `node .opencode/workflow-state.js show`
54
+ - `node .opencode/workflow-state.js validate`
55
+ - `node .opencode/workflow-state.js start-feature <feature_id> <feature_slug>`
56
+ - `node .opencode/workflow-state.js start-task <mode> <feature_id> <feature_slug> <mode_reason>`
57
+ - `node .opencode/workflow-state.js create-work-item <mode> <feature_id> <feature_slug> <mode_reason>`
58
+ - `node .opencode/workflow-state.js list-work-items`
59
+ - `node .opencode/workflow-state.js show-work-item <work_item_id>`
60
+ - `node .opencode/workflow-state.js activate-work-item <work_item_id>`
61
+ - `node .opencode/workflow-state.js advance-stage <stage>`
62
+ - `node .opencode/workflow-state.js set-approval <gate> <status> [approved_by] [approved_at] [notes]`
63
+ - `node .opencode/workflow-state.js set-routing-profile <work_intent> <behavior_delta> <dominant_uncertainty> <scope_shape> <selection_reason>`
64
+ - `node .opencode/workflow-state.js link-artifact <kind> <path>`
65
+ - `node .opencode/workflow-state.js scaffold-artifact <task_card|plan|migration_report> <slug>`
66
+ - `node .opencode/workflow-state.js list-tasks <work_item_id>`
67
+ - `node .opencode/workflow-state.js create-task <work_item_id> <task_id> <title> <kind> [branch] [worktree_path]`
68
+ - `node .opencode/workflow-state.js claim-task <work_item_id> <task_id> <owner> <requested_by>`
69
+ - `node .opencode/workflow-state.js release-task <work_item_id> <task_id> <requested_by>`
70
+ - `node .opencode/workflow-state.js reassign-task <work_item_id> <task_id> <owner> <requested_by>`
71
+ - `node .opencode/workflow-state.js assign-qa-owner <work_item_id> <task_id> <qa_owner> <requested_by>`
72
+ - `node .opencode/workflow-state.js set-task-status <work_item_id> <task_id> <status>`
73
+ - `node .opencode/workflow-state.js validate-work-item-board <work_item_id>`
74
+ - `node .opencode/workflow-state.js record-issue <issue_id> <title> <type> <severity> <rooted_in> <recommended_owner> <evidence> <artifact_refs>`
75
+ - `node .opencode/workflow-state.js clear-issues`
76
+ - `node .opencode/workflow-state.js route-rework <issue_type> [repeat_failed_fix]`
77
+
78
+ Current workflow-state behavior:
79
+
80
+ - The CLI understands the current mode-aware workflow model.
81
+ - `npm install -g openkit` installs the OpenKit CLI globally.
82
+ - `openkit run` materializes the globally managed kit into the OpenCode home directory on first use when needed.
83
+ - `openkit doctor` checks the global install and the current workspace bootstrap.
84
+ - `openkit install-global` remains available as a manual or compatibility setup path.
85
+ - `openkit run` launches OpenCode with the globally installed `openkit` profile and workspace-specific environment.
86
+ - `openkit upgrade` refreshes the global managed kit bundle in place.
87
+ - `openkit uninstall` removes the global managed kit and profile, with optional workspace cleanup.
88
+ - `status`, `doctor`, `version`, `profiles`, `show-profile`, and `sync-install-manifest` are part of the current runtime inspection surface.
89
+ - `start-feature` remains available as a compatibility shortcut and initializes `Full Delivery` mode.
90
+ - `start-task` is the preferred explicit entrypoint for new mode-aware state.
91
+ - `create-work-item`, `list-work-items`, `show-work-item`, and `activate-work-item` are the live work-item coordination commands.
92
+ - `list-tasks`, `create-task`, `claim-task`, `release-task`, `reassign-task`, `assign-qa-owner`, `set-task-status`, and `validate-work-item-board` are the live full-delivery task-board commands.
93
+ - `scaffold-artifact` is a narrow helper for creating and linking `task_card`, `plan`, and `migration_report` artifacts from checked-in templates.
94
+ - `set-routing-profile` updates the explicit routing metadata used to justify and validate lane selection.
95
+ - `task_card` scaffolding requires `quick` mode and is intentionally allowed as optional traceability in the quick lane.
96
+ - `plan` scaffolding requires `full` mode at `full_plan` or `migration` mode at `migration_strategy`, and it always requires a linked architecture artifact.
97
+ - `migration_report` scaffolding requires `migration` mode at `migration_baseline` or `migration_strategy` and is intended for one-file migration tracking.
98
+ - `doctor` now checks active-work-item pointer integrity, compatibility-mirror alignment, and task-board validity when the active full-delivery stage depends on a task board.
99
+ - Task-board support is bounded: only full-delivery work items may use it, and it does not imply unrestricted parallel safety outside the validated command surface.
100
+
101
+ ## Global Kit Contract
102
+
103
+ - The preferred product surface is now the globally installed OpenKit kit inside the OpenCode home directory.
104
+ - Repository-internal runtime surfaces remain `.opencode/opencode.json`, workflow-state files, the workflow-state CLI, hooks, agents, skills, commands, context, and maintained docs.
105
+ - `registry.json` documents available components and metadata for the global-kit compatibility direction.
106
+ - `.opencode/install-manifest.json` records which local profile is active and keeps install semantics explicit and non-destructive.
107
+ - Global install writes its own managed kit bundle, profile manifest, and workspace state under the OpenCode home directory.
108
+ - The checked-in repository runtime remains important for authoring, tests, and compatibility, not as the preferred end-user install shape.
109
+
110
+ ## Validation Reality By Mode
111
+
112
+ ### Quick Task
113
+
114
+ - Use the closest real verification path available.
115
+ - If no test framework exists, manual verification is acceptable when reported clearly.
116
+ - Do not invent commands that the repository has not adopted.
117
+
118
+ ### Full Delivery
119
+
120
+ - Prefer the strongest real validation path available.
121
+ - If no test or build tooling exists, explicitly record that the validation path is unavailable.
122
+ - Do not claim TDD or automated QA evidence unless the supporting commands actually exist.
123
+
124
+ ### Migration
125
+
126
+ - Prefer baseline capture, preserved-invariant tracking, compatibility evidence, build/test/typecheck results, codemod evidence, smoke checks, and targeted regression checks over default TDD-first execution.
127
+ - Refactor only to create seams, adapters, or compatibility boundaries that make the migration safer; do not treat migration as an excuse for a rewrite.
128
+ - If suitable test tooling exists, add focused tests only where they clarify behavior during the migration; do not force greenfield TDD semantics onto broad upgrades by default.
129
+ - If no repo-native validation commands exist, state the missing validation path and record manual before/after evidence honestly.
130
+
131
+ ## Future Update Rule
132
+
133
+ When this repository adopts a real application stack, update both this file and `AGENTS.md` with the exact commands before expecting agents to run them.
134
+
135
+ When the workflow-state CLI gains new mode-aware capabilities, update this file at the same time so the documented command behavior matches reality.
136
+
137
+ ## Execution Rules For Agents
138
+
139
+ 1. Use documented commands only.
140
+ 2. If a command is missing or stale, say so explicitly in the report.
141
+ 3. Do not substitute guessed commands from a preferred stack.
142
+ 4. Prefer `.opencode/workflow-state.js` over manual JSON edits when an operation is supported.
143
+ 5. Do not run destructive commands unless the user explicitly requests them.
@@ -0,0 +1,85 @@
1
+ # Session Resume Protocol
2
+
3
+ Use this file when continuing work that may have started in a previous session.
4
+
5
+ For the canonical workflow contract, including lane semantics, stage order, escalation policy, approvals, and artifact expectations, use `context/core/workflow.md`.
6
+
7
+ ## Required Read Order
8
+
9
+ 1. `AGENTS.md` for repository-wide rules and current-state guardrails
10
+ 2. `context/navigation.md` for context discovery and current-vs-future wayfinding
11
+ 3. `.opencode/workflow-state.json` as the active compatibility mirror for the current work item
12
+ 4. Determine `mode` and `current_stage`
13
+ 5. Read the mode-appropriate artifact or task context
14
+ 6. Read any related QA issues, approval notes, or escalation metadata
15
+
16
+ ## Mode-Aware Resume Rules
17
+
18
+ ### Quick Task
19
+
20
+ If `mode` is `quick`:
21
+
22
+ - read the quick task card if `artifacts.task_card` is present
23
+ - if there is no task card, treat missing recorded quick context as a repair need; resume only from inspectable repository state and recorded workflow evidence, and repair the missing quick context before advancing when the current stage requires it
24
+ - if `current_stage` is `quick_plan`, inspect the bounded checklist, acceptance confirmation, and verification path before resuming implementation
25
+ - if `current_stage` is `quick_build`, inspect the recorded `quick_plan` content first; do not treat the absence of a task card as missing workflow
26
+ - if `current_stage` is `quick_verify`, inspect the latest QA Lite evidence before continuing
27
+ - if `current_stage` is `quick_done`, confirm `quick_verified` is approved and the closing evidence remains inspectable on resume
28
+
29
+ Quick-lane reminder:
30
+
31
+ - `quick_plan` is already part of the live contract, even when no separate doc artifact exists
32
+ - QA Lite evidence is already part of the live contract, even when it is stored only in workflow state and session notes
33
+ - do not invent a quick task board, extra lane, or extra artifact requirement while resuming quick work
34
+
35
+ ### Full Delivery
36
+
37
+ If `mode` is `full`:
38
+
39
+ - read the artifact referenced by the current stage when it exists
40
+ - if `work_item_id` is present, inspect `.opencode/work-items/index.json` and the active work-item state before trusting task-aware full-delivery context
41
+ - if the current full-delivery stage is `full_plan`, `full_implementation`, or `full_qa`, inspect the task board when it exists and confirm it belongs only to this full work item
42
+ - restore both feature-level and task-level context: current stage owner, active work item id, ready/active task summary, and any task-specific evidence tied to the next decision
43
+ - if `current_stage` is `full_qa`, read the current QA report and related plan first
44
+ - preserve the approval-gate context before advancing or rerouting
45
+ - if resuming at a handoff boundary, inspect the latest approved gate notes before starting new work
46
+
47
+ ### Migration
48
+
49
+ If `mode` is `migration`:
50
+
51
+ - read the linked architecture artifact when present because it carries the baseline and compatibility model for the upgrade
52
+ - read the migration plan in `docs/plans/` when it exists
53
+ - if `current_stage` is `migration_baseline`, inspect `docs/templates/migration-baseline-checklist.md` and the recorded current versions, preserved invariants, compatibility hotspots, and likely breakpoints before planning
54
+ - if `current_stage` is `migration_strategy`, inspect the staged upgrade sequence, seam or adapter decisions, rollback notes, and validation path before resuming implementation
55
+ - if `current_stage` is `migration_upgrade`, inspect the migration strategy and latest execution evidence before continuing
56
+ - if `current_stage` is `migration_verify`, inspect `docs/templates/migration-verify-checklist.md` and the latest regression, smoke, compatibility, and parity evidence before deciding closure or reroute
57
+ - if `current_stage` is `migration_done`, confirm `migration_verified` is approved and the closing evidence remains inspectable on resume
58
+ - migration mode still has no task board in the live contract
59
+
60
+ ## General Resume Rules
61
+
62
+ - Trust repository state over memory.
63
+ - If `status` is `blocked`, do not continue implementation until the blocker is understood.
64
+ - If an approval gate for the active mode is still `pending`, do not silently skip to the next stage.
65
+ - If the referenced artifact file is missing, report the mismatch and repair the docs/state before proceeding.
66
+ - If `escalated_from` is `quick` or `migration`, resume from the current full-delivery stage, not from the abandoned earlier stage.
67
+ - Use `.opencode/workflow-state.js show` or `.opencode/workflow-state.js validate` when explicit state inspection helps resume work.
68
+ - Use `node .opencode/workflow-state.js list-work-items`, `show-work-item`, `list-tasks`, or `validate-work-item-board` when full-delivery resume depends on task-aware state.
69
+ - Inspect whether the recorded evidence is sufficient for the current stage before acting; if not, repair the handoff context first.
70
+ - Preserve explicit validation history when resuming; do not replace prior evidence with vague restatements.
71
+
72
+ Task-aware full-delivery reminder:
73
+
74
+ - `.opencode/workflow-state.json` is the active compatibility mirror, not the sole managed backing file
75
+ - do not assume every full-delivery item has parallel work; only rely on task-board state when the runtime actually recorded it
76
+ - quick and migration modes still have no task board
77
+
78
+ The current one-way escalation behavior remains unchanged in the live contract.
79
+
80
+ ## Status Values
81
+
82
+ - `idle`: no active feature is currently being executed
83
+ - `in_progress`: work is active in the current stage
84
+ - `blocked`: work cannot continue without input or repair
85
+ - `done`: the feature has completed the active workflow
@@ -0,0 +1,224 @@
1
+ # Workflow State Schema
2
+
3
+ This file defines the canonical fields and enums exposed through `.opencode/workflow-state.json`, which now acts as the active external compatibility mirror for the active work item.
4
+
5
+ For the canonical workflow contract, including lane semantics, stage order, escalation policy, approvals, and quick-lane artifact expectations, use `context/core/workflow.md`.
6
+
7
+ The schema is mode-aware and uses separate stage names for `Quick Task`, `Migration`, and `Full Delivery`.
8
+
9
+ Internal runtime note:
10
+
11
+ - managed per-item state lives under `.opencode/work-items/<work_item_id>/state.json`
12
+ - the active work item is mirrored into `.opencode/workflow-state.json` for compatibility with existing docs, commands, and resume flow
13
+ - full-delivery task boards live beside the per-item state, not inside the mirrored top-level state object
14
+
15
+ ## Required Top-Level Fields
16
+
17
+ - `feature_id`
18
+ - `feature_slug`
19
+ - `mode`
20
+ - `mode_reason`
21
+ - `routing_profile`
22
+ - `current_stage`
23
+ - `status`
24
+ - `current_owner`
25
+ - `artifacts`
26
+ - `approvals`
27
+ - `issues`
28
+ - `retry_count`
29
+ - `escalated_from`
30
+ - `escalation_reason`
31
+ - `updated_at`
32
+ - `work_item_id`
33
+
34
+ ## `mode` Values
35
+
36
+ - `quick`
37
+ - `migration`
38
+ - `full`
39
+
40
+ Guardrail:
41
+
42
+ - do not add a `quick_plus` or similar third mode without a separate explicit schema and runtime change
43
+ - references to `Quick Task+` describe the live successor semantics of `quick`, not a new enum
44
+
45
+ ## `current_stage` Values
46
+
47
+ ### Quick Task stages
48
+
49
+ - `quick_intake`: request accepted into quick mode and scoped by the Master Orchestrator
50
+ - `quick_plan`: the Master Orchestrator is recording the bounded quick checklist, acceptance confirmation, and verification path
51
+ - `quick_build`: Fullstack is implementing the quick task
52
+ - `quick_verify`: the QA Agent is performing QA Lite validation for the quick task
53
+ - `quick_done`: the quick task is complete
54
+
55
+ ### Migration stages
56
+
57
+ - `migration_intake`: request accepted into migration mode and scoped by the Master Orchestrator
58
+ - `migration_baseline`: Architect is recording the current baseline, preserved invariants, compatibility map, and major breakpoints
59
+ - `migration_strategy`: Tech Lead is defining staged upgrade sequence, seam creation, rollback points, and validation approach
60
+ - `migration_upgrade`: Fullstack is executing the migration or upgrade work
61
+ - `migration_verify`: the QA Agent is performing regression, compatibility, and parity validation for the migration
62
+ - `migration_done`: the migration work is complete
63
+
64
+ ### Full Delivery stages
65
+
66
+ - `full_intake`: request received and routed into full mode
67
+ - `full_brief`: PM is producing or revising the product brief
68
+ - `full_spec`: BA is producing or revising the specification
69
+ - `full_architecture`: Architect is producing or revising the design
70
+ - `full_plan`: Tech Lead is producing or revising the implementation plan
71
+ - `full_implementation`: Fullstack is executing approved work
72
+ - `full_qa`: QA is validating implementation or routing findings
73
+ - `full_done`: the feature completed the full-delivery workflow
74
+
75
+ ## `status` Values
76
+
77
+ - `idle`
78
+ - `in_progress`
79
+ - `blocked`
80
+ - `done`
81
+
82
+ ## `routing_profile` Shape
83
+
84
+ `routing_profile` must always contain these keys:
85
+
86
+ - `work_intent`
87
+ - `behavior_delta`
88
+ - `dominant_uncertainty`
89
+ - `scope_shape`
90
+ - `selection_reason`
91
+
92
+ Allowed values:
93
+
94
+ - `work_intent`: `maintenance`, `modernization`, `feature`
95
+ - `behavior_delta`: `preserve`, `extend`, `redefine`
96
+ - `dominant_uncertainty`: `low_local`, `compatibility`, `product`
97
+ - `scope_shape`: `local`, `adjacent`, `cross_boundary`
98
+
99
+ Mode expectations:
100
+
101
+ - `Quick Task` must use `work_intent = maintenance`, `behavior_delta = preserve`, and `dominant_uncertainty = low_local`
102
+ - `Migration` must use `work_intent = modernization`, `behavior_delta = preserve`, and `dominant_uncertainty = compatibility`
103
+ - `Full Delivery` must reflect product-facing uncertainty, changed behavior, feature intent, or cross-boundary scope
104
+
105
+ ## Stage Ownership Map
106
+
107
+ | Stage | Default Owner |
108
+ | --- | --- |
109
+ | `quick_intake` | `MasterOrchestrator` |
110
+ | `quick_plan` | `MasterOrchestrator` |
111
+ | `quick_build` | `FullstackAgent` |
112
+ | `quick_verify` | `QAAgent` |
113
+ | `quick_done` | `MasterOrchestrator` |
114
+ | `migration_intake` | `MasterOrchestrator` |
115
+ | `migration_baseline` | `ArchitectAgent` |
116
+ | `migration_strategy` | `TechLeadAgent` |
117
+ | `migration_upgrade` | `FullstackAgent` |
118
+ | `migration_verify` | `QAAgent` |
119
+ | `migration_done` | `MasterOrchestrator` |
120
+ | `full_intake` | `MasterOrchestrator` |
121
+ | `full_brief` | `PMAgent` |
122
+ | `full_spec` | `BAAgent` |
123
+ | `full_architecture` | `ArchitectAgent` |
124
+ | `full_plan` | `TechLeadAgent` |
125
+ | `full_implementation` | `FullstackAgent` |
126
+ | `full_qa` | `QAAgent` |
127
+ | `full_done` | `MasterOrchestrator` |
128
+
129
+ Feature-versus-task ownership rule:
130
+
131
+ - these owners are feature-stage owners
132
+ - a full-delivery task board may also track task-level `primary_owner` and `qa_owner` assignments without changing the feature-stage owner above
133
+
134
+ Approval authority map for live gates:
135
+
136
+ | Gate | Approval Authority |
137
+ | --- | --- |
138
+ | `quick_verified` | `QAAgent` |
139
+ | `baseline_to_strategy` | `TechLeadAgent` |
140
+ | `strategy_to_upgrade` | `FullstackAgent` |
141
+ | `upgrade_to_verify` | `QAAgent` |
142
+ | `migration_verified` | `QAAgent` |
143
+ | `pm_to_ba` | `BAAgent` |
144
+ | `ba_to_architect` | `ArchitectAgent` |
145
+ | `architect_to_tech_lead` | `TechLeadAgent` |
146
+ | `tech_lead_to_fullstack` | `FullstackAgent` |
147
+ | `fullstack_to_qa` | `QAAgent` |
148
+ | `qa_to_done` | `MasterOrchestrator` |
149
+
150
+ ## Artifacts Shape
151
+
152
+ `artifacts` must always contain these keys:
153
+
154
+ - `task_card`
155
+ - `brief`
156
+ - `spec`
157
+ - `architecture`
158
+ - `plan`
159
+ - `migration_report`
160
+ - `qa_report`
161
+ - `adr`
162
+
163
+ Usage by mode:
164
+
165
+ - `Quick Task` may use `task_card`, leaves `brief`, `spec`, `architecture`, `plan`, and `qa_report` as `null`, and keeps `adr` as an empty array; the required `quick_plan` stage is workflow state, not a separate artifact slot
166
+ - `Migration` may use `architecture`, `plan`, and optional `migration_report`, leaves `task_card`, `brief`, `spec`, and `qa_report` as `null`, and keeps `adr` as optional decision records when needed
167
+ - `Full Delivery` uses `brief`, `spec`, `architecture`, `plan`, `qa_report`, and optional `adr`, while `task_card` stays `null`
168
+
169
+ Do not assume additional quick-lane artifact keys until they are explicitly added to the runtime schema and supporting code.
170
+
171
+ Task-board location and scope:
172
+
173
+ - quick mode has no task-board schema surface
174
+ - full-delivery task boards are stored in `.opencode/work-items/<work_item_id>/tasks.json`
175
+ - task-board fields are validated by runtime code and work-item-board commands rather than being embedded into `.opencode/workflow-state.json`
176
+
177
+ ## Approvals Shape
178
+
179
+ Approval entries use the canonical shape:
180
+
181
+ - `status`
182
+ - `approved_by`
183
+ - `approved_at`
184
+ - `notes`
185
+
186
+ Mode-specific approval keys:
187
+
188
+ ### Quick Task
189
+
190
+ - `quick_verified`
191
+
192
+ ### Migration
193
+
194
+ - `baseline_to_strategy`
195
+ - `strategy_to_upgrade`
196
+ - `upgrade_to_verify`
197
+ - `migration_verified`
198
+
199
+ ### Full Delivery
200
+
201
+ - `pm_to_ba`
202
+ - `ba_to_architect`
203
+ - `architect_to_tech_lead`
204
+ - `tech_lead_to_fullstack`
205
+ - `fullstack_to_qa`
206
+ - `qa_to_done`
207
+
208
+ Validation must be mode-aware. Do not require full-delivery gates for quick mode or quick gates for full mode.
209
+
210
+ Approval-entry expectations:
211
+
212
+ - `approved_by` should identify the live approval authority for the gate when status is `approved`
213
+ - `notes` should record handoff readiness, notable assumptions, or rejection reasons in inspectable form
214
+ - `quick_verified.notes` should capture QA Lite evidence or reference where that evidence is stored
215
+ - gate notes should be sufficient for session resume without relying on unstated memory
216
+
217
+ ## Escalation Fields
218
+
219
+ - `escalated_from`: `null`, `quick`, or `migration`
220
+ - `escalation_reason`: `null` or a short explanation of why quick or migration work was promoted to full delivery
221
+
222
+ These fields allow the repository to preserve history when a quick or migration item becomes a full-delivery item.
223
+
224
+ That compatibility rule stays in place unless a later approved migration changes it deliberately.