opencode-agent-orchestration-kit 1.0.27

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 (236) hide show
  1. package/.github/CODEOWNERS +1 -0
  2. package/.github/ISSUE_TEMPLATE/bug_report.yml +65 -0
  3. package/.github/ISSUE_TEMPLATE/config.yml +11 -0
  4. package/.github/ISSUE_TEMPLATE/documentation.yml +22 -0
  5. package/.github/ISSUE_TEMPLATE/feature_request.yml +43 -0
  6. package/.github/PULL_REQUEST_TEMPLATE.md +25 -0
  7. package/.github/workflows/check.yml +47 -0
  8. package/CODE_OF_CONDUCT.md +24 -0
  9. package/CONTRIBUTING.md +52 -0
  10. package/LICENSE +201 -0
  11. package/NOTICE.md +23 -0
  12. package/README.md +806 -0
  13. package/SECURITY.md +17 -0
  14. package/docker/open-design/.env.example +6 -0
  15. package/docker/open-design/Dockerfile +50 -0
  16. package/docker/open-design/docker-compose.yml +18 -0
  17. package/docker/open-design/opencode-od/agents/od-worker.md +22 -0
  18. package/docker/open-design/opencode-od/opencode.json +24 -0
  19. package/docs/agents.md +21 -0
  20. package/docs/commands.md +16 -0
  21. package/docs/configuration.md +30 -0
  22. package/docs/docker-open-design.md +42 -0
  23. package/docs/impeccable.md +18 -0
  24. package/docs/installation.md +176 -0
  25. package/docs/models.md +17 -0
  26. package/docs/open-design.md +25 -0
  27. package/docs/quickstart.md +74 -0
  28. package/docs/releases/v1.0.10.md +46 -0
  29. package/docs/releases/v1.0.14.md +39 -0
  30. package/docs/releases/v1.0.27.md +66 -0
  31. package/docs/security.md +8 -0
  32. package/docs/superpowers/plans/2026-07-20-safe-installation-lifecycle.md +779 -0
  33. package/docs/superpowers/plans/2026-07-20-version-identity-and-releases.md +590 -0
  34. package/docs/superpowers/specs/2026-07-20-safe-installation-lifecycle-design.md +1350 -0
  35. package/docs/superpowers/specs/2026-07-20-version-identity-and-releases-design.md +557 -0
  36. package/docs/superpowers.md +34 -0
  37. package/docs/synology.md +30 -0
  38. package/docs/troubleshooting.md +54 -0
  39. package/docs/workflows.md +44 -0
  40. package/doctor.sh +5 -0
  41. package/env.example +15 -0
  42. package/install.sh +5 -0
  43. package/opencode/AGENTS.md +104 -0
  44. package/opencode/agents/debugger.md +41 -0
  45. package/opencode/agents/designer.md +93 -0
  46. package/opencode/agents/developer.md +180 -0
  47. package/opencode/agents/evaluator.md +35 -0
  48. package/opencode/agents/evolver.md +31 -0
  49. package/opencode/agents/lead.md +251 -0
  50. package/opencode/agents/researcher.md +76 -0
  51. package/opencode/agents/review_api.md +34 -0
  52. package/opencode/agents/review_coordinator.md +111 -0
  53. package/opencode/agents/review_quality.md +35 -0
  54. package/opencode/agents/review_security.md +35 -0
  55. package/opencode/agents/review_tests.md +37 -0
  56. package/opencode/agents/reviewer.md +116 -0
  57. package/opencode/agents/scoper.md +75 -0
  58. package/opencode/agents/specifier.md +116 -0
  59. package/opencode/commands/code-simplify.md +36 -0
  60. package/opencode/commands/design.md +27 -0
  61. package/opencode/commands/evolve.md +165 -0
  62. package/opencode/commands/feature.md +67 -0
  63. package/opencode/commands/implement.md +11 -0
  64. package/opencode/commands/init.md +34 -0
  65. package/opencode/commands/loop.md +145 -0
  66. package/opencode/commands/mvp-spec.md +20 -0
  67. package/opencode/commands/plan.md +74 -0
  68. package/opencode/commands/research.md +12 -0
  69. package/opencode/commands/review-orchestrated.md +47 -0
  70. package/opencode/commands/review-preflight.md +26 -0
  71. package/opencode/commands/review.md +18 -0
  72. package/opencode/commands/scope.md +36 -0
  73. package/opencode/commands/spec.md +12 -0
  74. package/opencode/commands/test.md +40 -0
  75. package/opencode/docs/ai/evolution/README.md +135 -0
  76. package/opencode/docs/ai/evolution/benchmarks/manual-scenarios.md +123 -0
  77. package/opencode/docs/ai/evolution/benchmarks/router-scenarios.jsonl +8 -0
  78. package/opencode/docs/ai/evolution/evolution_history.md +83 -0
  79. package/opencode/docs/ai/evolution/mechanisms.jsonl +7 -0
  80. package/opencode/docs/ai/evolution/rejected_mechanisms.jsonl +2 -0
  81. package/opencode/docs/ai/evolution/runs/README.md +15 -0
  82. package/opencode/docs/ai/evolution/runs/iteration-001-sidecar/analysis/overview.md +12 -0
  83. package/opencode/docs/ai/evolution/runs/iteration-001-sidecar/change_evaluation.json +108 -0
  84. package/opencode/docs/ai/evolution/runs/iteration-001-sidecar/change_manifest.json +52 -0
  85. package/opencode/docs/ai/evolution/runs/iteration-001-sidecar/evaluation.md +19 -0
  86. package/opencode/docs/ai/evolution/runs/iteration-001-sidecar/post_evaluation.md +12 -0
  87. package/opencode/docs/ai/evolution/runs/iteration-002-feature-flow-fix/analysis/overview.md +7 -0
  88. package/opencode/docs/ai/evolution/runs/iteration-002-feature-flow-fix/change_evaluation.json +31 -0
  89. package/opencode/docs/ai/evolution/runs/iteration-002-feature-flow-fix/evaluation.md +19 -0
  90. package/opencode/docs/ai/evolution/runs/iteration-003-agent-readable-harness/analysis/overview.md +13 -0
  91. package/opencode/docs/ai/evolution/runs/iteration-003-agent-readable-harness/change_evaluation.json +66 -0
  92. package/opencode/docs/ai/evolution/runs/iteration-003-agent-readable-harness/change_manifest.json +82 -0
  93. package/opencode/docs/ai/evolution/runs/iteration-003-agent-readable-harness/evaluation.md +20 -0
  94. package/opencode/docs/ai/evolution/runs/iteration-004-orchestration-audit/analysis/detail/ahe-run-lifecycle-validator.md +40 -0
  95. package/opencode/docs/ai/evolution/runs/iteration-004-orchestration-audit/analysis/detail/evolve-evaluation-only-contract.md +15 -0
  96. package/opencode/docs/ai/evolution/runs/iteration-004-orchestration-audit/analysis/detail/open-design-tool-contract.md +14 -0
  97. package/opencode/docs/ai/evolution/runs/iteration-004-orchestration-audit/analysis/detail/slash-command-contract-coverage.md +40 -0
  98. package/opencode/docs/ai/evolution/runs/iteration-004-orchestration-audit/analysis/overview.md +17 -0
  99. package/opencode/docs/ai/evolution/runs/iteration-004-orchestration-audit/analysis/pre_apply_approval.md +15 -0
  100. package/opencode/docs/ai/evolution/runs/iteration-004-orchestration-audit/change_evaluation.json +252 -0
  101. package/opencode/docs/ai/evolution/runs/iteration-004-orchestration-audit/change_manifest.json +210 -0
  102. package/opencode/docs/ai/evolution/runs/iteration-004-orchestration-audit/evaluation.md +25 -0
  103. package/opencode/docs/ai/evolution/runs/iteration-004-orchestration-audit/post_apply_evaluation.md +15 -0
  104. package/opencode/docs/ai/evolution/runs/iteration-004-orchestration-audit/post_manifest_evaluation.md +14 -0
  105. package/opencode/docs/ai/evolution/runs/iteration-004-orchestration-audit/pre_apply_evaluation.md +15 -0
  106. package/opencode/docs/ai/evolution/runs/iteration-005-harness-orchestration-audit/analysis/overview.md +13 -0
  107. package/opencode/docs/ai/evolution/runs/iteration-005-harness-orchestration-audit/change_evaluation.json +14 -0
  108. package/opencode/docs/ai/evolution/runs/iteration-005-harness-orchestration-audit/change_manifest.json +30 -0
  109. package/opencode/docs/ai/evolution/runs/iteration-005-harness-orchestration-audit/evaluation.md +25 -0
  110. package/opencode/docs/ai/evolution/runs/iteration-006-lead-delegation-audit/analysis/overview.md +13 -0
  111. package/opencode/docs/ai/evolution/runs/iteration-006-lead-delegation-audit/change_evaluation.json +14 -0
  112. package/opencode/docs/ai/evolution/runs/iteration-006-lead-delegation-audit/change_manifest.json +29 -0
  113. package/opencode/docs/ai/evolution/runs/iteration-006-lead-delegation-audit/evaluation.md +18 -0
  114. package/opencode/docs/ai/evolution/runs/iteration-007-agent-skills-integration/analysis/overview.md +13 -0
  115. package/opencode/docs/ai/evolution/runs/iteration-007-agent-skills-integration/change_evaluation.json +14 -0
  116. package/opencode/docs/ai/evolution/runs/iteration-007-agent-skills-integration/change_manifest.json +34 -0
  117. package/opencode/docs/ai/evolution/runs/iteration-007-agent-skills-integration/evaluation.md +17 -0
  118. package/opencode/docs/ai/evolution/runs/iteration-008-lead-readonly-shell-permissions/analysis/overview.md +13 -0
  119. package/opencode/docs/ai/evolution/runs/iteration-008-lead-readonly-shell-permissions/change_evaluation.json +12 -0
  120. package/opencode/docs/ai/evolution/runs/iteration-008-lead-readonly-shell-permissions/change_manifest.json +28 -0
  121. package/opencode/docs/ai/evolution/runs/iteration-008-lead-readonly-shell-permissions/evaluation.md +17 -0
  122. package/opencode/docs/ai/evolution/runs/iteration-009-lead-developer-ownership-loop/analysis/overview.md +9 -0
  123. package/opencode/docs/ai/evolution/runs/iteration-009-lead-developer-ownership-loop/change_evaluation.json +14 -0
  124. package/opencode/docs/ai/evolution/runs/iteration-009-lead-developer-ownership-loop/change_manifest.json +31 -0
  125. package/opencode/docs/ai/evolution/runs/iteration-009-lead-developer-ownership-loop/evaluation.md +18 -0
  126. package/opencode/docs/ai/evolution/runs/iteration-010-token-plugin-sidebar-content/analysis/overview.md +12 -0
  127. package/opencode/docs/ai/evolution/runs/iteration-010-token-plugin-sidebar-content/change_evaluation.json +14 -0
  128. package/opencode/docs/ai/evolution/runs/iteration-010-token-plugin-sidebar-content/change_manifest.json +31 -0
  129. package/opencode/docs/ai/evolution/runs/iteration-010-token-plugin-sidebar-content/evaluation.md +17 -0
  130. package/opencode/docs/ai/evolution/runs/iteration-011-lead-cd-which-permissions/analysis/overview.md +10 -0
  131. package/opencode/docs/ai/evolution/runs/iteration-011-lead-cd-which-permissions/change_evaluation.json +14 -0
  132. package/opencode/docs/ai/evolution/runs/iteration-011-lead-cd-which-permissions/change_manifest.json +30 -0
  133. package/opencode/docs/ai/evolution/runs/iteration-011-lead-cd-which-permissions/evaluation.md +17 -0
  134. package/opencode/docs/ai/evolution/runs/iteration-012-lead-shell-allowlist-boundaries/analysis/overview.md +25 -0
  135. package/opencode/docs/ai/evolution/runs/iteration-012-lead-shell-allowlist-boundaries/change_evaluation.json +28 -0
  136. package/opencode/docs/ai/evolution/runs/iteration-012-lead-shell-allowlist-boundaries/change_manifest.json +31 -0
  137. package/opencode/docs/ai/evolution/runs/iteration-012-lead-shell-allowlist-boundaries/evaluation.md +22 -0
  138. package/opencode/docs/ai/evolution/runs/iteration-013-doc-gardening-mechanical-checks/analysis/overview.md +27 -0
  139. package/opencode/docs/ai/evolution/runs/iteration-013-doc-gardening-mechanical-checks/change_evaluation.json +32 -0
  140. package/opencode/docs/ai/evolution/runs/iteration-013-doc-gardening-mechanical-checks/change_manifest.json +49 -0
  141. package/opencode/docs/ai/evolution/runs/iteration-013-doc-gardening-mechanical-checks/evaluation.md +92 -0
  142. package/opencode/docs/ai/evolution/runs/iteration-014-harness-baseline/analysis/detail/token-vs-semantic.md +31 -0
  143. package/opencode/docs/ai/evolution/runs/iteration-014-harness-baseline/analysis/overview.md +14 -0
  144. package/opencode/docs/ai/evolution/runs/iteration-014-harness-baseline/evaluation.md +36 -0
  145. package/opencode/docs/ai/evolution/runs/iteration-015-semantic-checker/analysis/overview.md +13 -0
  146. package/opencode/docs/ai/evolution/runs/iteration-015-semantic-checker/change_evaluation.json +31 -0
  147. package/opencode/docs/ai/evolution/runs/iteration-015-semantic-checker/change_manifest.json +47 -0
  148. package/opencode/docs/ai/evolution/runs/iteration-015-semantic-checker/evaluation.md +27 -0
  149. package/opencode/docs/ai/evolution/runs/iteration-016-contract-prompt-alignment/analysis/overview.md +32 -0
  150. package/opencode/docs/ai/evolution/runs/iteration-016-contract-prompt-alignment/change_evaluation.json +31 -0
  151. package/opencode/docs/ai/evolution/runs/iteration-016-contract-prompt-alignment/change_manifest.json +35 -0
  152. package/opencode/docs/ai/evolution/runs/iteration-016-contract-prompt-alignment/evaluation.md +31 -0
  153. package/opencode/docs/ai/evolution/runs/iteration-017-ahe-cycle/analysis/detail/pattern-1-feature-sidecar-false-positive.md +51 -0
  154. package/opencode/docs/ai/evolution/runs/iteration-017-ahe-cycle/analysis/detail/pattern-2-checker-time-budget.md +52 -0
  155. package/opencode/docs/ai/evolution/runs/iteration-017-ahe-cycle/analysis/overview.md +99 -0
  156. package/opencode/docs/ai/evolution/runs/iteration-017-ahe-cycle/change_evaluation.json +61 -0
  157. package/opencode/docs/ai/evolution/runs/iteration-017-ahe-cycle/change_manifest.json +61 -0
  158. package/opencode/docs/ai/evolution/runs/iteration-017-ahe-cycle/evaluation.md +448 -0
  159. package/opencode/docs/ai/evolution/runs/iteration-018-free-message-routing-audit/analysis/detail/intake-gray-zone.md +65 -0
  160. package/opencode/docs/ai/evolution/runs/iteration-018-free-message-routing-audit/analysis/overview.md +172 -0
  161. package/opencode/docs/ai/evolution/runs/iteration-018-free-message-routing-audit/evaluation.md +226 -0
  162. package/opencode/docs/ai/evolution/runs/iteration-019-handoff-routing-audit/analysis/detail/plan-only-gray-zone.md +62 -0
  163. package/opencode/docs/ai/evolution/runs/iteration-019-handoff-routing-audit/analysis/overview.md +167 -0
  164. package/opencode/docs/ai/evolution/runs/iteration-019-handoff-routing-audit/evaluation.md +163 -0
  165. package/opencode/docs/ai/evolution/runs/iteration-020-loop-engineering-command/analysis/overview.md +42 -0
  166. package/opencode/docs/ai/evolution/runs/iteration-020-loop-engineering-command/change_evaluation.json +46 -0
  167. package/opencode/docs/ai/evolution/runs/iteration-020-loop-engineering-command/change_manifest.json +57 -0
  168. package/opencode/docs/ai/evolution/runs/iteration-020-loop-engineering-command/evaluation.md +48 -0
  169. package/opencode/docs/ai/evolution/runs/iteration-021/analysis/detail/contract-vs-runtime-gap.md +163 -0
  170. package/opencode/docs/ai/evolution/runs/iteration-021/analysis/detail/evidence-collection-blocker.md +134 -0
  171. package/opencode/docs/ai/evolution/runs/iteration-021/analysis/overview.md +111 -0
  172. package/opencode/docs/ai/evolution/runs/iteration-021/change_evaluation.json +52 -0
  173. package/opencode/docs/ai/evolution/runs/iteration-021/change_manifest.json +50 -0
  174. package/opencode/docs/ai/evolution/runs/iteration-021/evaluation.md +46 -0
  175. package/opencode/docs/ai/evolution/runs/iteration-021/manifest-justification.md +48 -0
  176. package/opencode/docs/ai/evolution/session-sources.md +91 -0
  177. package/opencode/docs/ai/harness/README.md +32 -0
  178. package/opencode/docs/ai/harness/agents.md +148 -0
  179. package/opencode/docs/ai/harness/checks.md +119 -0
  180. package/opencode/docs/ai/harness/commands.md +391 -0
  181. package/opencode/docs/ai/harness/evidence.md +85 -0
  182. package/opencode/docs/ai/harness/init-detection-rules.md +160 -0
  183. package/opencode/docs/ai/harness/orchestrated-review.md +131 -0
  184. package/opencode/docs/ai/harness/skill-metadata-schema.md +198 -0
  185. package/opencode/docs/ai/harness/skill-resolution.md +202 -0
  186. package/opencode/docs/ai/harness/skill_registry.json +443 -0
  187. package/opencode/docs/ai/harness/skill_registry.md +43 -0
  188. package/opencode/docs/ai/project-context-template.md +53 -0
  189. package/opencode/opencode.json +38 -0
  190. package/opencode/package-lock.json +1717 -0
  191. package/opencode/package.json +11 -0
  192. package/opencode/plugins/token-tree-usage.tsx +206 -0
  193. package/opencode/references/performance-checklist.md +153 -0
  194. package/opencode/references/security-checklist.md +134 -0
  195. package/opencode/references/testing-patterns.md +236 -0
  196. package/opencode/scripts/check-harness.mjs +1572 -0
  197. package/opencode/scripts/check-harness.test.mjs +820 -0
  198. package/opencode/scripts/collect-session-evidence.mjs +612 -0
  199. package/opencode/scripts/collect-session-evidence.test.mjs +443 -0
  200. package/opencode/scripts/preflight-audit.mjs +497 -0
  201. package/opencode/scripts/preflight-audit.test.mjs +363 -0
  202. package/opencode/scripts/project-capability-snapshot.mjs +407 -0
  203. package/opencode/scripts/project-capability-snapshot.test.mjs +382 -0
  204. package/opencode/scripts/review-orchestrated-prepare.mjs +547 -0
  205. package/opencode/scripts/review-orchestrated-prepare.test.mjs +516 -0
  206. package/opencode/scripts/skill-resolver.mjs +585 -0
  207. package/opencode/scripts/skill-resolver.test.mjs +781 -0
  208. package/opencode/scripts/update-skill-registry.mjs +380 -0
  209. package/opencode/skills/api-and-interface-design/SKILL.md +315 -0
  210. package/opencode/skills/autonomous-loops/SKILL.md +312 -0
  211. package/opencode/skills/code-review-and-quality/SKILL.md +365 -0
  212. package/opencode/skills/code-simplification/SKILL.md +345 -0
  213. package/opencode/skills/context-engineering/SKILL.md +252 -0
  214. package/opencode/skills/debugging-and-error-recovery/SKILL.md +316 -0
  215. package/opencode/skills/documentation-and-adrs/SKILL.md +298 -0
  216. package/opencode/skills/doubt-driven-development/SKILL.md +168 -0
  217. package/opencode/skills/iterative-retrieval/SKILL.md +232 -0
  218. package/opencode/skills/open-design/SKILL.md +123 -0
  219. package/opencode/skills/performance-optimization/SKILL.md +365 -0
  220. package/opencode/skills/security-and-hardening/SKILL.md +369 -0
  221. package/opencode/skills/source-driven-development/SKILL.md +210 -0
  222. package/opencode/skills/test-driven-development/SKILL.md +406 -0
  223. package/opencode/skills/using-agent-skills/SKILL.md +194 -0
  224. package/opencode/skills/verification-loop/SKILL.md +162 -0
  225. package/opencode/tools/open_design.ts +361 -0
  226. package/opencode/tui.json +5 -0
  227. package/package.json +20 -0
  228. package/rollback.sh +5 -0
  229. package/scripts/check.sh +184 -0
  230. package/scripts/install-smoke.sh +111 -0
  231. package/scripts/manage-installation.mjs +1498 -0
  232. package/scripts/manage-installation.test.mjs +1936 -0
  233. package/scripts/version.mjs +197 -0
  234. package/scripts/version.test.mjs +195 -0
  235. package/uninstall.sh +5 -0
  236. package/upgrade.sh +5 -0
@@ -0,0 +1,162 @@
1
+ ---
2
+ name: verification-loop
3
+ description: Comprehensive multi-phase verification system. Use after completing a feature, before creating a PR, when ensuring quality gates pass, or after refactoring.
4
+ phase: verify
5
+ domains:
6
+ - testing
7
+ - evaluation
8
+ - release
9
+ stacks:
10
+ - any
11
+ allowed_agents:
12
+ - lead
13
+ - developer
14
+ - reviewer
15
+ - evaluator
16
+ surfaces:
17
+ - quality-gates
18
+ - pre-pr-checks
19
+ skill_source: external
20
+ origin: affaan-m/ecc
21
+ status: active
22
+ ---
23
+
24
+ # Verification Loop
25
+
26
+ A comprehensive verification system that runs multi-phase quality gates before closing any non-trivial implementation.
27
+
28
+ ## When to Use
29
+
30
+ - After completing a feature or significant code change
31
+ - Before creating a PR
32
+ - When you want to ensure quality gates pass
33
+ - After refactoring
34
+ - When the handoff requires explicit validation evidence
35
+
36
+ ## Verification Phases
37
+
38
+ ### Phase 1: Build Verification
39
+
40
+ ```bash
41
+ # Check if project builds
42
+ npm run build 2>&1 | tail -20
43
+ # OR
44
+ pnpm build 2>&1 | tail -20
45
+ ```
46
+
47
+ If build fails, STOP and fix before continuing.
48
+
49
+ ### Phase 2: Type Check
50
+
51
+ ```bash
52
+ # TypeScript projects
53
+ npx tsc --noEmit 2>&1 | head -30
54
+
55
+ # Python projects
56
+ pyright . 2>&1 | head -30
57
+ ```
58
+
59
+ Report all type errors. Fix critical ones before continuing.
60
+
61
+ ### Phase 3: Lint Check
62
+
63
+ ```bash
64
+ # JavaScript/TypeScript
65
+ npm run lint 2>&1 | head -30
66
+
67
+ # Python
68
+ ruff check . 2>&1 | head -30
69
+ ```
70
+
71
+ ### Phase 4: Test Suite
72
+
73
+ ```bash
74
+ # Run tests with coverage
75
+ npm run test -- --coverage 2>&1 | tail -50
76
+
77
+ # Check coverage threshold
78
+ # Target: 80% minimum
79
+ ```
80
+
81
+ Report:
82
+ - Total tests: X
83
+ - Passed: X
84
+ - Failed: X
85
+ - Coverage: X%
86
+
87
+ ### Phase 5: Security Scan
88
+
89
+ ```bash
90
+ # Check for secrets
91
+ grep -rn "sk-" --include="*.ts" --include="*.js" . 2>/dev/null | head -10
92
+ grep -rn "api_key" --include="*.ts" --include="*.js" . 2>/dev/null | head -10
93
+
94
+ # Check for console.log
95
+ grep -rn "console.log" --include="*.ts" --include="*.tsx" src/ 2>/dev/null | head -10
96
+ ```
97
+
98
+ ### Phase 6: Diff Review
99
+
100
+ ```bash
101
+ # Show what changed
102
+ git diff --stat
103
+ git diff HEAD~1 --name-only
104
+ ```
105
+
106
+ Review each changed file for:
107
+ - Unintended changes
108
+ - Missing error handling
109
+ - Potential edge cases
110
+
111
+ ## Output Format
112
+
113
+ After running all phases, produce a verification report:
114
+
115
+ ```
116
+ VERIFICATION REPORT
117
+ ==================
118
+
119
+ Build: [PASS/FAIL]
120
+ Types: [PASS/FAIL] (X errors)
121
+ Lint: [PASS/FAIL] (X warnings)
122
+ Tests: [PASS/FAIL] (X/Y passed, Z% coverage)
123
+ Security: [PASS/FAIL] (X issues)
124
+ Diff: [X files changed]
125
+
126
+ Overall: [READY/NOT READY] for PR
127
+
128
+ Issues to Fix:
129
+ 1. ...
130
+ 2. ...
131
+ ```
132
+
133
+ ## Continuous Mode
134
+
135
+ For long sessions, run verification every 15 minutes or after major changes:
136
+
137
+ ```markdown
138
+ Set a mental checkpoint:
139
+ - After completing each function
140
+ - After finishing a component
141
+ - Before moving to next task
142
+ ```
143
+
144
+ ## Integration with OpenCode Harness
145
+
146
+ This skill complements the `Verification Envelope` in the developer contract:
147
+
148
+ - **Verification Loop** runs the actual quality gates (build, type, lint, test, security, diff)
149
+ - **Verification Envelope** documents the results for the next agent or reviewer
150
+ - Use both: run the loop, then report in the envelope
151
+
152
+ ## Verification
153
+
154
+ After applying verification-loop:
155
+
156
+ - [ ] All 6 phases were executed in order
157
+ - [ ] Build passes before proceeding to type check
158
+ - [ ] Type errors are fixed before proceeding to lint
159
+ - [ ] Test suite passes with coverage >= 80%
160
+ - [ ] No secrets or sensitive data in changed files
161
+ - [ ] Diff review covers all changed files
162
+ - [ ] Verification report is produced with clear PASS/FAIL per phase
@@ -0,0 +1,361 @@
1
+ import { tool } from "@opencode-ai/plugin"
2
+
3
+ type RuntimeGlobals = {
4
+ process?: { env?: Record<string, string | undefined> }
5
+ Bun?: { env?: Record<string, string | undefined> }
6
+ crypto?: { getRandomValues?: (array: Uint8Array) => Uint8Array }
7
+ }
8
+
9
+ function runtime() {
10
+ return globalThis as unknown as RuntimeGlobals
11
+ }
12
+
13
+ function getEnv(name: string): string | undefined {
14
+ const g = runtime()
15
+ return g.process?.env?.[name] ?? g.Bun?.env?.[name]
16
+ }
17
+
18
+ function randomId(length = 8): string {
19
+ const g = runtime()
20
+ const bytes = new Uint8Array(Math.ceil(length / 2))
21
+ g.crypto?.getRandomValues?.(bytes)
22
+
23
+ if (bytes.some((byte) => byte !== 0)) {
24
+ return Array.from(bytes)
25
+ .map((byte) => byte.toString(16).padStart(2, "0"))
26
+ .join("")
27
+ .slice(0, length)
28
+ }
29
+
30
+ return `${Date.now().toString(36)}${Math.random().toString(36).slice(2)}`
31
+ .replace(/[^a-z0-9]/gi, "")
32
+ .slice(0, length)
33
+ }
34
+
35
+ function baseUrl(input?: string) {
36
+ const raw = input || getEnv("OPEN_DESIGN_URL")
37
+ if (!raw) {
38
+ throw new Error("OPEN_DESIGN_URL is not set. Example: export OPEN_DESIGN_URL='https://open-design.example.com'")
39
+ }
40
+
41
+ const url = raw.replace(/\/+$/, "")
42
+ if (/\/projects\//.test(url)) {
43
+ throw new Error("OPEN_DESIGN_URL must be the Open Design base URL, not a project or file URL.")
44
+ }
45
+
46
+ return url
47
+ }
48
+
49
+ async function requestJson(base: string, path: string, init: RequestInit = {}) {
50
+ const res = await fetch(`${base}${path}`, {
51
+ ...init,
52
+ headers: {
53
+ "Content-Type": "application/json",
54
+ ...(init.headers || {}),
55
+ },
56
+ })
57
+
58
+ const text = await res.text()
59
+ let body: unknown = text
60
+
61
+ try {
62
+ body = text ? JSON.parse(text) : null
63
+ } catch {
64
+ body = text
65
+ }
66
+
67
+ if (!res.ok) {
68
+ throw new Error(`Open Design ${path} failed (${res.status}): ${JSON.stringify(body, null, 2)}`)
69
+ }
70
+
71
+ return body
72
+ }
73
+
74
+ function safeSlug(input: string) {
75
+ return input
76
+ .toLowerCase()
77
+ .normalize("NFKD")
78
+ .replace(/[^\w\s-]/g, "")
79
+ .replace(/\s+/g, "-")
80
+ .replace(/-+/g, "-")
81
+ .replace(/^-|-$/g, "")
82
+ .slice(0, 80) || "open-design-project"
83
+ }
84
+
85
+ function projectUrl(base: string, projectId: string) {
86
+ return `${base}/projects/${encodeURIComponent(projectId)}`
87
+ }
88
+
89
+ function projectFileUrl(base: string, projectId: string, fileName: string) {
90
+ const safeFile = fileName.split("/").map(encodeURIComponent).join("/")
91
+ return `${base}/projects/${encodeURIComponent(projectId)}/files/${safeFile}`
92
+ }
93
+
94
+ function rawFileUrl(base: string, projectId: string, fileName: string) {
95
+ const safeFile = fileName.split("/").map(encodeURIComponent).join("/")
96
+ return `${base}/api/projects/${encodeURIComponent(projectId)}/files/${safeFile}`
97
+ }
98
+
99
+ function composeSystemPrompt(input: {
100
+ skillId: string
101
+ skillBody: string
102
+ designSystemId?: string | null
103
+ designSystemBody?: string | null
104
+ }) {
105
+ return [
106
+ "# Open Design Runtime",
107
+ "",
108
+ "You are a senior visual designer and frontend prototyper working inside Open Design.",
109
+ "Produce a high-quality, implementable artifact. Prefer writing real files, especially index.html, so the workbench can preview them.",
110
+ "",
111
+ "Rules:",
112
+ "- Follow the active Open Design skill.",
113
+ "- Follow the active design system when provided.",
114
+ "- Avoid generic AI-looking layouts.",
115
+ "- Do not invent fake metrics, testimonials, or brand assets.",
116
+ "- Use accessible contrast and responsive layout.",
117
+ "- Create complete files, not only prose.",
118
+ "",
119
+ `## Active skill: ${input.skillId}`,
120
+ "",
121
+ input.skillBody,
122
+ "",
123
+ input.designSystemBody
124
+ ? `## Active design system: ${input.designSystemId}\n\n${input.designSystemBody}`
125
+ : "## Active design system\n\nNo explicit design system selected. Use a restrained, professional default.",
126
+ ].join("\n")
127
+ }
128
+
129
+ function parseSseFrames(buffer: string) {
130
+ const frames: Array<{ event: string; data: any }> = []
131
+ let rest = buffer
132
+
133
+ while (true) {
134
+ const idx = rest.indexOf("\n\n")
135
+ if (idx === -1) break
136
+ const raw = rest.slice(0, idx)
137
+ rest = rest.slice(idx + 2)
138
+
139
+ let event = "message"
140
+ let data = ""
141
+ for (const line of raw.split("\n")) {
142
+ if (line.startsWith("event: ")) event = line.slice(7).trim()
143
+ if (line.startsWith("data: ")) data += line.slice(6)
144
+ }
145
+
146
+ try {
147
+ frames.push({ event, data: JSON.parse(data) })
148
+ } catch {
149
+ frames.push({ event, data })
150
+ }
151
+ }
152
+
153
+ return { frames, rest }
154
+ }
155
+
156
+ async function streamOpenDesignChat(base: string, body: unknown) {
157
+ const res = await fetch(`${base}/api/chat`, {
158
+ method: "POST",
159
+ headers: { "Content-Type": "application/json" },
160
+ body: JSON.stringify(body),
161
+ })
162
+
163
+ if (!res.ok || !res.body) {
164
+ const text = await res.text().catch(() => "")
165
+ throw new Error(`Open Design chat failed (${res.status}): ${text}`)
166
+ }
167
+
168
+ const reader = res.body.getReader()
169
+ const decoder = new TextDecoder()
170
+ let buffer = ""
171
+ let stdout = ""
172
+ let stderr = ""
173
+ let end: any = null
174
+ let eventsCount = 0
175
+
176
+ while (true) {
177
+ const { value, done } = await reader.read()
178
+ if (done) break
179
+
180
+ buffer += decoder.decode(value, { stream: true })
181
+ const parsed = parseSseFrames(buffer)
182
+ buffer = parsed.rest
183
+
184
+ for (const frame of parsed.frames) {
185
+ eventsCount += 1
186
+ if (frame.event === "stdout") stdout += String(frame.data?.chunk ?? "")
187
+ if (frame.event === "stderr") stderr += String(frame.data?.chunk ?? "")
188
+ if (frame.event === "agent") {
189
+ if (typeof frame.data?.delta === "string") stdout += frame.data.delta
190
+ if (typeof frame.data?.text === "string") stdout += frame.data.text
191
+ }
192
+ if (frame.event === "end") end = frame.data
193
+ if (frame.event === "error") {
194
+ throw new Error(`Open Design agent error: ${String(frame.data?.message ?? JSON.stringify(frame.data))}`)
195
+ }
196
+ }
197
+ }
198
+
199
+ if (end && typeof end.code === "number" && end.code !== 0) {
200
+ throw new Error(`Open Design agent exited with code ${end.code}\n${stderr.slice(-1000)}`)
201
+ }
202
+
203
+ return { stdout, stderr, end, eventsCount }
204
+ }
205
+
206
+ export const health = tool({
207
+ description: "Check whether the Open Design workbench is reachable.",
208
+ args: {
209
+ baseUrl: tool.schema.string().optional(),
210
+ },
211
+ async execute(args) {
212
+ const base = baseUrl(args.baseUrl)
213
+ const data = await requestJson(base, "/api/health")
214
+ return JSON.stringify({ baseUrl: base, health: data }, null, 2)
215
+ },
216
+ })
217
+
218
+ export const list_agents = tool({
219
+ description: "List local agent CLIs detected by Open Design.",
220
+ args: {
221
+ baseUrl: tool.schema.string().optional(),
222
+ },
223
+ async execute(args) {
224
+ const base = baseUrl(args.baseUrl)
225
+ const data = await requestJson(base, "/api/agents")
226
+ return JSON.stringify(data, null, 2)
227
+ },
228
+ })
229
+
230
+ export const list_skills = tool({
231
+ description: "List Open Design skills available in the workbench.",
232
+ args: {
233
+ baseUrl: tool.schema.string().optional(),
234
+ },
235
+ async execute(args) {
236
+ const base = baseUrl(args.baseUrl)
237
+ const data = await requestJson(base, "/api/skills")
238
+ return JSON.stringify(data, null, 2)
239
+ },
240
+ })
241
+
242
+ export const list_design_systems = tool({
243
+ description: "List Open Design design systems available in the workbench.",
244
+ args: {
245
+ baseUrl: tool.schema.string().optional(),
246
+ },
247
+ async execute(args) {
248
+ const base = baseUrl(args.baseUrl)
249
+ const data = await requestJson(base, "/api/design-systems")
250
+ return JSON.stringify(data, null, 2)
251
+ },
252
+ })
253
+
254
+ export const create_project = tool({
255
+ description: "Create an Open Design project and return its workbench URL without running generation.",
256
+ args: {
257
+ baseUrl: tool.schema.string().optional(),
258
+ name: tool.schema.string(),
259
+ prompt: tool.schema.string(),
260
+ skillId: tool.schema.string().optional(),
261
+ designSystemId: tool.schema.string().optional(),
262
+ kind: tool.schema.string().optional(),
263
+ fidelity: tool.schema.string().optional(),
264
+ },
265
+ async execute(args) {
266
+ const base = baseUrl(args.baseUrl)
267
+ const projectId = `${safeSlug(args.name)}-${randomId(8)}`
268
+ const body = {
269
+ id: projectId,
270
+ name: args.name,
271
+ skillId: args.skillId ?? "web-prototype",
272
+ designSystemId: args.designSystemId ?? null,
273
+ pendingPrompt: args.prompt,
274
+ metadata: {
275
+ kind: args.kind ?? "prototype",
276
+ fidelity: args.fidelity ?? "high-fidelity",
277
+ },
278
+ }
279
+
280
+ const created = await requestJson(base, "/api/projects", { method: "POST", body: JSON.stringify(body) })
281
+ return JSON.stringify({ projectId, url: projectUrl(base, projectId), created }, null, 2)
282
+ },
283
+ })
284
+
285
+ export const run_design = tool({
286
+ description: "Create an Open Design project and run a design generation.",
287
+ args: {
288
+ baseUrl: tool.schema.string().optional(),
289
+ name: tool.schema.string(),
290
+ prompt: tool.schema.string(),
291
+ skillId: tool.schema.string(),
292
+ designSystemId: tool.schema.string().optional(),
293
+ agentId: tool.schema.string().optional(),
294
+ model: tool.schema.string().optional(),
295
+ kind: tool.schema.string().optional(),
296
+ fidelity: tool.schema.string().optional(),
297
+ },
298
+ async execute(args) {
299
+ const base = baseUrl(args.baseUrl)
300
+ const projectId = `${safeSlug(args.name)}-${randomId(8)}`
301
+
302
+ await requestJson(base, "/api/projects", {
303
+ method: "POST",
304
+ body: JSON.stringify({
305
+ id: projectId,
306
+ name: args.name,
307
+ skillId: args.skillId,
308
+ designSystemId: args.designSystemId ?? null,
309
+ pendingPrompt: args.prompt,
310
+ metadata: {
311
+ kind: args.kind ?? "prototype",
312
+ fidelity: args.fidelity ?? "high-fidelity",
313
+ },
314
+ }),
315
+ })
316
+
317
+ const skill = (await requestJson(base, `/api/skills/${encodeURIComponent(args.skillId)}`)) as any
318
+ const designSystem = args.designSystemId
319
+ ? ((await requestJson(base, `/api/design-systems/${encodeURIComponent(args.designSystemId)}`)) as any)
320
+ : null
321
+
322
+ const systemPrompt = composeSystemPrompt({
323
+ skillId: args.skillId,
324
+ skillBody: String(skill?.body ?? ""),
325
+ designSystemId: args.designSystemId ?? null,
326
+ designSystemBody: designSystem?.body ? String(designSystem.body) : null,
327
+ })
328
+
329
+ const result = await streamOpenDesignChat(base, {
330
+ agentId: args.agentId ?? "opencode",
331
+ message: args.prompt,
332
+ systemPrompt,
333
+ projectId,
334
+ attachments: [],
335
+ model: args.model ?? null,
336
+ reasoning: null,
337
+ })
338
+
339
+ const filesData = (await requestJson(base, `/api/projects/${encodeURIComponent(projectId)}/files`)) as any
340
+ const files = Array.isArray(filesData?.files) ? filesData.files : []
341
+
342
+ return JSON.stringify(
343
+ {
344
+ projectId,
345
+ projectUrl: projectUrl(base, projectId),
346
+ files: files.map((file: any) => ({
347
+ name: file.name,
348
+ kind: file.kind,
349
+ size: file.size,
350
+ uiUrl: projectFileUrl(base, projectId, file.name),
351
+ rawUrl: rawFileUrl(base, projectId, file.name),
352
+ })),
353
+ outputPreview: result.stdout.slice(-4000),
354
+ stderrPreview: result.stderr.slice(-1000),
355
+ eventsCount: result.eventsCount,
356
+ },
357
+ null,
358
+ 2,
359
+ )
360
+ },
361
+ })
@@ -0,0 +1,5 @@
1
+ {
2
+ "plugin": [
3
+ "./plugins/token-tree-usage.tsx"
4
+ ]
5
+ }
package/package.json ADDED
@@ -0,0 +1,20 @@
1
+ {
2
+ "name": "opencode-agent-orchestration-kit",
3
+ "version": "1.0.27",
4
+ "private": false,
5
+ "license": "Apache-2.0",
6
+ "type": "module",
7
+ "scripts": {
8
+ "check:version": "node scripts/version.mjs --check",
9
+ "contract-check": "bash scripts/check.sh",
10
+ "unit-and-script-tests": "node --test scripts/*.test.mjs opencode/scripts/*.test.mjs",
11
+ "typecheck": "npm --prefix opencode exec -- tsc --noEmit --jsx preserve --jsxImportSource @opentui/solid --module NodeNext --moduleResolution NodeNext --target ES2022 --strict --skipLibCheck opencode/plugins/token-tree-usage.tsx",
12
+ "dependency-audit": "npm --prefix opencode audit --omit=dev --audit-level=moderate",
13
+ "installation-smoke": "bash scripts/install-smoke.sh",
14
+ "check:quick": "npm run contract-check",
15
+ "check": "npm run contract-check && npm run unit-and-script-tests",
16
+ "check:release": "npm --prefix opencode ci && npm run check && npm run typecheck && npm run dependency-audit && npm run installation-smoke",
17
+ "lint": "npm run contract-check",
18
+ "format": "echo 'No formatter configured. Markdown and shell are intentionally plain.'"
19
+ }
20
+ }
package/rollback.sh ADDED
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+
4
+ root="$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)"
5
+ exec node "$root/scripts/manage-installation.mjs" rollback "$@"