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,781 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Skill Resolver Tests
4
+ *
5
+ * Validates the two-stage skill resolution: prefilter + ranking + shortlist output.
6
+ * Uses node:assert — no external dependencies.
7
+ *
8
+ * Usage:
9
+ * node scripts/skill-resolver.test.mjs
10
+ */
11
+
12
+ import assert from "node:assert/strict";
13
+ import { fileURLToPath } from "node:url";
14
+ import {
15
+ loadRegistry,
16
+ loadSnapshot,
17
+ filterByAgent,
18
+ filterByPhase,
19
+ filterByDomains,
20
+ filterByStacks,
21
+ rankCandidates,
22
+ generateShortlist,
23
+ formatShortlist,
24
+ } from "./skill-resolver.mjs";
25
+
26
+ // ── Test fixtures ────────────────────────────────────────────────────────
27
+
28
+ const FIXTURE_REGISTRY = {
29
+ generated_at: "2026-06-03T00:00:00Z",
30
+ schema_version: 2,
31
+ skills: [
32
+ {
33
+ name: "test-driven-development",
34
+ source: "built-in",
35
+ phase: "verify",
36
+ domains: ["testing", "debugging"],
37
+ stacks: ["any"],
38
+ allowed_agents: ["developer", "reviewer", "specifier", "lead"],
39
+ surfaces: ["code-implementation", "bug-fix"],
40
+ skill_source: "built-in",
41
+ status: "active",
42
+ description: "Drives development with tests.",
43
+ load_path: "skills/test-driven-development/SKILL.md",
44
+ origin: null,
45
+ },
46
+ {
47
+ name: "security-and-hardening",
48
+ source: "built-in",
49
+ phase: "build",
50
+ domains: ["security"],
51
+ stacks: ["any"],
52
+ allowed_agents: ["developer", "researcher", "designer", "specifier", "reviewer", "scoper", "lead"],
53
+ surfaces: ["input-validation", "auth"],
54
+ skill_source: "built-in",
55
+ status: "active",
56
+ description: "Hardens code against vulnerabilities.",
57
+ load_path: "skills/security-and-hardening/SKILL.md",
58
+ origin: null,
59
+ },
60
+ {
61
+ name: "code-review-and-quality",
62
+ source: "built-in",
63
+ phase: "review",
64
+ domains: ["review", "security", "testing", "performance"],
65
+ stacks: ["any"],
66
+ allowed_agents: ["reviewer", "lead", "developer"],
67
+ surfaces: ["diff-review"],
68
+ skill_source: "built-in",
69
+ status: "active",
70
+ description: "Conducts multi-axis code review.",
71
+ load_path: "skills/code-review-and-quality/SKILL.md",
72
+ origin: null,
73
+ },
74
+ {
75
+ name: "debugging-and-error-recovery",
76
+ source: "built-in",
77
+ phase: "verify",
78
+ domains: ["debugging", "testing"],
79
+ stacks: ["any"],
80
+ allowed_agents: ["developer", "lead", "reviewer"],
81
+ surfaces: ["bug-fix"],
82
+ skill_source: "built-in",
83
+ status: "active",
84
+ description: "Guides systematic root-cause debugging.",
85
+ load_path: "skills/debugging-and-error-recovery/SKILL.md",
86
+ origin: null,
87
+ },
88
+ {
89
+ name: "open-design",
90
+ source: "built-in",
91
+ phase: "build",
92
+ domains: ["ui-ux"],
93
+ stacks: ["open-design"],
94
+ allowed_agents: ["designer", "lead", "developer"],
95
+ surfaces: ["visual-design"],
96
+ skill_source: "built-in",
97
+ status: "active",
98
+ description: "Use the Open Design workbench for visual designs.",
99
+ load_path: "skills/open-design/SKILL.md",
100
+ origin: null,
101
+ },
102
+ {
103
+ name: "flutter-accessibility-audit",
104
+ source: "user-installed",
105
+ phase: "unknown",
106
+ domains: [],
107
+ stacks: ["any"],
108
+ allowed_agents: ["developer", "researcher", "designer", "specifier", "reviewer", "scoper", "lead"],
109
+ surfaces: [],
110
+ skill_source: "user-installed",
111
+ status: "active",
112
+ description: "Triggers an accessibility scan for Flutter widgets.",
113
+ load_path: "~/.agents/skills/flutter-accessibility-audit/SKILL.md",
114
+ origin: null,
115
+ },
116
+ {
117
+ name: "deprecated-skill",
118
+ source: "built-in",
119
+ phase: "build",
120
+ domains: ["testing"],
121
+ stacks: ["any"],
122
+ allowed_agents: ["developer"],
123
+ surfaces: [],
124
+ skill_source: "built-in",
125
+ status: "deprecated",
126
+ description: "An old deprecated skill.",
127
+ load_path: "skills/deprecated-skill/SKILL.md",
128
+ origin: null,
129
+ },
130
+ {
131
+ name: "no-phase-skill",
132
+ source: "user-installed",
133
+ phase: "unknown",
134
+ domains: [],
135
+ stacks: ["any"],
136
+ allowed_agents: ["developer", "lead"],
137
+ surfaces: [],
138
+ skill_source: "user-installed",
139
+ status: "active",
140
+ description: "A skill without specific phase.",
141
+ load_path: "~/.agents/skills/no-phase-skill/SKILL.md",
142
+ origin: null,
143
+ },
144
+ {
145
+ name: "no-agents-skill",
146
+ source: "user-installed",
147
+ phase: "build",
148
+ domains: ["testing"],
149
+ stacks: ["any"],
150
+ allowed_agents: [],
151
+ surfaces: [],
152
+ skill_source: "user-installed",
153
+ status: "active",
154
+ description: "A skill without allowed_agents defined.",
155
+ load_path: "~/.agents/skills/no-agents-skill/SKILL.md",
156
+ origin: null,
157
+ },
158
+ {
159
+ name: "meta-skill",
160
+ source: "built-in",
161
+ phase: "meta",
162
+ domains: ["orchestration"],
163
+ stacks: ["any"],
164
+ allowed_agents: ["lead", "developer"],
165
+ surfaces: [],
166
+ skill_source: "built-in",
167
+ status: "active",
168
+ description: "Helps discover and select other skills.",
169
+ load_path: "skills/meta-skill/SKILL.md",
170
+ origin: null,
171
+ },
172
+ {
173
+ name: "operate-skill",
174
+ source: "built-in",
175
+ phase: "operate",
176
+ domains: ["orchestration"],
177
+ stacks: ["harness"],
178
+ allowed_agents: ["lead", "developer"],
179
+ surfaces: [],
180
+ skill_source: "built-in",
181
+ status: "active",
182
+ description: "Operates harness runtime loops.",
183
+ load_path: "skills/operate-skill/SKILL.md",
184
+ origin: null,
185
+ },
186
+ {
187
+ name: "experimental-skill",
188
+ source: "built-in",
189
+ phase: "build",
190
+ domains: ["testing"],
191
+ stacks: ["any"],
192
+ allowed_agents: ["developer"],
193
+ surfaces: [],
194
+ skill_source: "built-in",
195
+ status: "experimental",
196
+ description: "An experimental skill.",
197
+ load_path: "skills/experimental-skill/SKILL.md",
198
+ origin: null,
199
+ },
200
+ {
201
+ name: "flutter-only-skill",
202
+ source: "user-installed",
203
+ phase: "build",
204
+ domains: ["ui-ux", "mobile"],
205
+ stacks: ["flutter"],
206
+ allowed_agents: ["developer", "designer"],
207
+ surfaces: [],
208
+ skill_source: "user-installed",
209
+ status: "active",
210
+ description: "Flutter specific UI skill.",
211
+ load_path: "~/.agents/skills/flutter-only-skill/SKILL.md",
212
+ origin: null,
213
+ },
214
+ ],
215
+ };
216
+
217
+ const FIXTURE_SNAPSHOT = {
218
+ schema_version: 1,
219
+ repo_root: "/tmp/opencode",
220
+ stacks_detected: [
221
+ { id: "node", confidence: "high", evidence: ["package.json"] },
222
+ { id: "typescript", confidence: "high", evidence: ["tsconfig.json"] },
223
+ ],
224
+ domains_detected: [
225
+ { id: "orchestration", confidence: "high", evidence: ["docs/ai/harness/**"] },
226
+ { id: "testing", confidence: "high", evidence: ["**/*.test.*"] },
227
+ { id: "documentation", confidence: "high", evidence: ["docs/**/*.md"] },
228
+ { id: "specification", confidence: "high", evidence: ["docs/ai/specs/**"] },
229
+ ],
230
+ surfaces_detected: [
231
+ { id: "harness", confidence: "high", evidence: ["AGENTS.md"] },
232
+ ],
233
+ unknowns: [],
234
+ generated_by: "lead prefilter",
235
+ generated_at: "2026-06-03T00:00:00Z",
236
+ };
237
+
238
+ // ── Helpers ──────────────────────────────────────────────────────────────
239
+
240
+ let passed = 0;
241
+ let failed = 0;
242
+ const failures = [];
243
+
244
+ function test(name, fn) {
245
+ try {
246
+ fn();
247
+ passed++;
248
+ console.log(` ✓ ${name}`);
249
+ } catch (err) {
250
+ failed++;
251
+ failures.push({ name, error: err });
252
+ console.log(` ✗ ${name}`);
253
+ console.log(` ${err.message}`);
254
+ }
255
+ }
256
+
257
+ function assertIncludes(arr, name, msg) {
258
+ assert.ok(
259
+ arr.some((s) => s.name === name),
260
+ msg || `Expected shortlist to include "${name}"`,
261
+ );
262
+ }
263
+
264
+ function assertExcludes(arr, name, msg) {
265
+ assert.ok(
266
+ !arr.some((s) => s.name === name),
267
+ msg || `Expected shortlist to NOT include "${name}"`,
268
+ );
269
+ }
270
+
271
+ // ── Tests ────────────────────────────────────────────────────────────────
272
+
273
+ console.log("\n=== Skill Resolver Tests ===\n");
274
+
275
+ // ── T1: developer + build → shortlist includes build-phase skills, excludes Flutter ──
276
+
277
+ console.log("T1: developer + build");
278
+
279
+ test("includes security-and-hardening (build phase, security domain match via taskDomains)", () => {
280
+ const shortlist = generateShortlist({
281
+ targetAgent: "developer",
282
+ taskPhase: "build",
283
+ taskDomains: ["security", "testing"],
284
+ registry: FIXTURE_REGISTRY,
285
+ snapshot: FIXTURE_SNAPSHOT,
286
+ });
287
+ assertIncludes(shortlist.candidates, "security-and-hardening");
288
+ });
289
+
290
+ test("excludes no-agents-skill (empty allowed_agents = no agents allowed)", () => {
291
+ const shortlist = generateShortlist({
292
+ targetAgent: "developer",
293
+ taskPhase: "build",
294
+ taskDomains: ["security", "testing"],
295
+ registry: FIXTURE_REGISTRY,
296
+ snapshot: FIXTURE_SNAPSHOT,
297
+ });
298
+ assertExcludes(shortlist.candidates, "no-agents-skill", "Empty allowed_agents means no agents allowed");
299
+ });
300
+
301
+ test("excludes test-driven-development (phase verify != build, not meta/operate)", () => {
302
+ const shortlist = generateShortlist({
303
+ targetAgent: "developer",
304
+ taskPhase: "build",
305
+ taskDomains: ["security", "testing"],
306
+ registry: FIXTURE_REGISTRY,
307
+ snapshot: FIXTURE_SNAPSHOT,
308
+ });
309
+ assertExcludes(shortlist.candidates, "test-driven-development", "verify phase excluded from build");
310
+ });
311
+
312
+ test("excludes flutter-only-skill (stack mismatch: flutter vs node/typescript)", () => {
313
+ const shortlist = generateShortlist({
314
+ targetAgent: "developer",
315
+ taskPhase: "build",
316
+ taskDomains: ["security", "testing"],
317
+ registry: FIXTURE_REGISTRY,
318
+ snapshot: FIXTURE_SNAPSHOT,
319
+ });
320
+ assertExcludes(shortlist.candidates, "flutter-only-skill");
321
+ });
322
+
323
+ test("excludes code-review-and-quality (phase review != build)", () => {
324
+ const shortlist = generateShortlist({
325
+ targetAgent: "developer",
326
+ taskPhase: "build",
327
+ taskDomains: ["security", "testing"],
328
+ registry: FIXTURE_REGISTRY,
329
+ snapshot: FIXTURE_SNAPSHOT,
330
+ });
331
+ assertExcludes(shortlist.candidates, "code-review-and-quality");
332
+ });
333
+
334
+ // ── T2: reviewer + review → prioritizes review skills ──
335
+
336
+ console.log("\nT2: reviewer + review");
337
+
338
+ test("includes code-review-and-quality (review phase, reviewer agent)", () => {
339
+ const shortlist = generateShortlist({
340
+ targetAgent: "reviewer",
341
+ taskPhase: "review",
342
+ taskDomains: ["review"],
343
+ registry: FIXTURE_REGISTRY,
344
+ snapshot: FIXTURE_SNAPSHOT,
345
+ });
346
+ assertIncludes(shortlist.candidates, "code-review-and-quality");
347
+ });
348
+
349
+ test("excludes test-driven-development (phase verify != review)", () => {
350
+ const shortlist = generateShortlist({
351
+ targetAgent: "reviewer",
352
+ taskPhase: "review",
353
+ taskDomains: ["review"],
354
+ registry: FIXTURE_REGISTRY,
355
+ snapshot: FIXTURE_SNAPSHOT,
356
+ });
357
+ assertExcludes(shortlist.candidates, "test-driven-development", "verify phase excluded from review");
358
+ });
359
+
360
+ test("code-review-and-quality has high confidence for reviewer+review", () => {
361
+ const shortlist = generateShortlist({
362
+ targetAgent: "reviewer",
363
+ taskPhase: "review",
364
+ taskDomains: ["review"],
365
+ registry: FIXTURE_REGISTRY,
366
+ snapshot: FIXTURE_SNAPSHOT,
367
+ });
368
+ const crq = shortlist.candidates.find((s) => s.name === "code-review-and-quality");
369
+ assert.ok(crq, "code-review-and-quality should be in candidates");
370
+ assert.equal(crq.confidence, "high", "Should have high confidence");
371
+ });
372
+
373
+ // ── T3: agent not allowed → empty shortlist ──
374
+
375
+ console.log("\nT3: agent not allowed");
376
+
377
+ test("returns empty candidates for non-existent agent", () => {
378
+ const shortlist = generateShortlist({
379
+ targetAgent: "nonexistent-agent",
380
+ taskPhase: "build",
381
+ taskDomains: ["testing"],
382
+ registry: FIXTURE_REGISTRY,
383
+ snapshot: FIXTURE_SNAPSHOT,
384
+ });
385
+ assert.equal(shortlist.candidates.length, 0, "Should have 0 candidates");
386
+ });
387
+
388
+ // ── T4: 0 matches → empty shortlist + full omitted_summary ──
389
+
390
+ console.log("\nT4: 0 matches");
391
+
392
+ test("omitted_summary has filtered_by_agent count when no agent matches", () => {
393
+ const shortlist = generateShortlist({
394
+ targetAgent: "nonexistent-agent",
395
+ taskPhase: "build",
396
+ taskDomains: ["testing"],
397
+ registry: FIXTURE_REGISTRY,
398
+ snapshot: FIXTURE_SNAPSHOT,
399
+ });
400
+ assert.ok(
401
+ shortlist.omitted_summary.filtered_by_agent >= 0,
402
+ "Should have filtered_by_agent count",
403
+ );
404
+ assert.equal(shortlist.candidates.length, 0);
405
+ });
406
+
407
+ // ── T5: phase unknown → no phase filtering ──
408
+
409
+ console.log("\nT5: phase unknown");
410
+
411
+ test("does not filter by phase when taskPhase is unknown", () => {
412
+ const shortlist = generateShortlist({
413
+ targetAgent: "developer",
414
+ taskPhase: "unknown",
415
+ taskDomains: [],
416
+ registry: FIXTURE_REGISTRY,
417
+ snapshot: FIXTURE_SNAPSHOT,
418
+ });
419
+ // With unknown phase, more skills should pass through
420
+ assert.ok(shortlist.candidates.length > 3, "Should have more candidates with unknown phase");
421
+ });
422
+
423
+ // ── T6: output format → contains expected sections ──
424
+
425
+ console.log("\nT6: output format");
426
+
427
+ test("formatShortlist contains all required sections", () => {
428
+ const shortlist = generateShortlist({
429
+ targetAgent: "developer",
430
+ taskPhase: "build",
431
+ taskDomains: ["testing"],
432
+ registry: FIXTURE_REGISTRY,
433
+ snapshot: FIXTURE_SNAPSHOT,
434
+ });
435
+ const output = formatShortlist(shortlist);
436
+ assert.ok(output.includes("=== Skill Shortlist ==="), "Missing header");
437
+ assert.ok(output.includes("Target Agent:"), "Missing target agent");
438
+ assert.ok(output.includes("Task Phase:"), "Missing task phase");
439
+ assert.ok(output.includes("--- Candidates"), "Missing candidates section");
440
+ assert.ok(output.includes("--- Omitted Summary ---"), "Missing omitted summary");
441
+ assert.ok(output.includes("--- Recommendation ---"), "Missing recommendation");
442
+ assert.ok(output.includes("filtered_by_agent:"), "Missing filtered_by_agent");
443
+ assert.ok(output.includes("filtered_by_phase:"), "Missing filtered_by_phase");
444
+ assert.ok(output.includes("filtered_by_domain:"), "Missing filtered_by_domain");
445
+ assert.ok(output.includes("filtered_by_stack:"), "Missing filtered_by_stack");
446
+ assert.ok(output.includes("suggested_final_selection:"), "Missing suggested_final_selection");
447
+ });
448
+
449
+ test("formatShortlist includes Reasons for each candidate", () => {
450
+ const shortlist = generateShortlist({
451
+ targetAgent: "developer",
452
+ taskPhase: "build",
453
+ taskDomains: ["testing"],
454
+ registry: FIXTURE_REGISTRY,
455
+ snapshot: FIXTURE_SNAPSHOT,
456
+ });
457
+ const output = formatShortlist(shortlist);
458
+ assert.ok(output.includes("Reasons:"), "Missing Reasons section");
459
+ assert.ok(output.includes("Load:"), "Missing Load path");
460
+ });
461
+
462
+ // ── T7: max 8 candidates ──
463
+
464
+ console.log("\nT7: max 8 candidates");
465
+
466
+ test("never returns more than 8 candidates", () => {
467
+ const shortlist = generateShortlist({
468
+ targetAgent: "developer",
469
+ taskPhase: "unknown",
470
+ taskDomains: [],
471
+ registry: FIXTURE_REGISTRY,
472
+ snapshot: FIXTURE_SNAPSHOT,
473
+ });
474
+ assert.ok(
475
+ shortlist.candidates.length <= 8,
476
+ `Expected at most 8 candidates, got ${shortlist.candidates.length}`,
477
+ );
478
+ });
479
+
480
+ // ── T8: deprecated not appearing ──
481
+
482
+ console.log("\nT8: deprecated excluded");
483
+
484
+ test("deprecated skills are excluded from candidates", () => {
485
+ const shortlist = generateShortlist({
486
+ targetAgent: "developer",
487
+ taskPhase: "build",
488
+ taskDomains: ["testing"],
489
+ registry: FIXTURE_REGISTRY,
490
+ snapshot: FIXTURE_SNAPSHOT,
491
+ });
492
+ assertExcludes(shortlist.candidates, "deprecated-skill", "Deprecated skill should be excluded");
493
+ });
494
+
495
+ // ── T9: confidence levels ──
496
+
497
+ console.log("\nT9: confidence levels");
498
+
499
+ test("high confidence for exact phase + domain + agent match", () => {
500
+ const shortlist = generateShortlist({
501
+ targetAgent: "developer",
502
+ taskPhase: "build",
503
+ taskDomains: ["security"],
504
+ registry: FIXTURE_REGISTRY,
505
+ snapshot: FIXTURE_SNAPSHOT,
506
+ });
507
+ const sec = shortlist.candidates.find((s) => s.name === "security-and-hardening");
508
+ assert.ok(sec, "security-and-hardening should be in candidates");
509
+ assert.equal(sec.confidence, "high", "Should have high confidence");
510
+ });
511
+
512
+ // ── T10: reasons are populated ──
513
+
514
+ console.log("\nT10: reasons populated");
515
+
516
+ test("each candidate has at least one reason", () => {
517
+ const shortlist = generateShortlist({
518
+ targetAgent: "developer",
519
+ taskPhase: "build",
520
+ taskDomains: ["security", "testing"],
521
+ registry: FIXTURE_REGISTRY,
522
+ snapshot: FIXTURE_SNAPSHOT,
523
+ });
524
+ for (const candidate of shortlist.candidates) {
525
+ assert.ok(
526
+ candidate.reasons.length > 0,
527
+ `${candidate.name} should have at least one reason`,
528
+ );
529
+ }
530
+ });
531
+
532
+ // ── T11: meta/operate phase filtering ──
533
+
534
+ console.log("\nT11: meta/operate phase filtering");
535
+
536
+ test("meta skills included when task_phase is build (meta/operate pass through)", () => {
537
+ const shortlist = generateShortlist({
538
+ targetAgent: "developer",
539
+ taskPhase: "build",
540
+ taskDomains: ["testing"],
541
+ registry: FIXTURE_REGISTRY,
542
+ snapshot: FIXTURE_SNAPSHOT,
543
+ });
544
+ // meta-skill has phase=meta, should pass through the phase filter
545
+ assertIncludes(shortlist.candidates, "meta-skill");
546
+ });
547
+
548
+ test("operate skills included when task_phase is build (meta/operate pass through)", () => {
549
+ const shortlist = generateShortlist({
550
+ targetAgent: "developer",
551
+ taskPhase: "build",
552
+ taskDomains: ["testing"],
553
+ registry: FIXTURE_REGISTRY,
554
+ snapshot: FIXTURE_SNAPSHOT,
555
+ });
556
+ // operate-skill has phase=operate, allowed_agents=[lead, developer], stacks=[harness]
557
+ // It passes agent filter (developer) and phase filter (operate passes through)
558
+ // But stacks=[harness] and snapshot has node/typescript, not harness → filtered by stack
559
+ assertExcludes(shortlist.candidates, "operate-skill", "operate skill filtered by stack mismatch");
560
+ });
561
+
562
+ // ── T12: empty registry ──
563
+
564
+ console.log("\nT12: edge cases");
565
+
566
+ test("empty registry produces empty shortlist", () => {
567
+ const shortlist = generateShortlist({
568
+ targetAgent: "developer",
569
+ taskPhase: "build",
570
+ taskDomains: ["testing"],
571
+ registry: { skills: [] },
572
+ snapshot: FIXTURE_SNAPSHOT,
573
+ });
574
+ assert.equal(shortlist.candidates.length, 0);
575
+ });
576
+
577
+ test("missing snapshot still works (empty domains/stacks)", () => {
578
+ const shortlist = generateShortlist({
579
+ targetAgent: "developer",
580
+ taskPhase: "build",
581
+ taskDomains: ["testing"],
582
+ registry: FIXTURE_REGISTRY,
583
+ snapshot: null,
584
+ });
585
+ // Should still find skills by agent + phase + domain match
586
+ assert.ok(shortlist.candidates.length > 0, "Should have candidates even without snapshot");
587
+ });
588
+
589
+ // ── T13: external skills integration ─────────────────────────────────────
590
+
591
+ console.log("\nT13: external skills integration");
592
+
593
+ // Add external skills to the fixture for these tests
594
+ const EXTERNAL_SKILLS = [
595
+ {
596
+ name: "context-engineering",
597
+ source: "external",
598
+ phase: "build",
599
+ domains: ["context-management", "orchestration"],
600
+ stacks: ["any"],
601
+ allowed_agents: ["lead", "researcher", "specifier", "developer"],
602
+ surfaces: ["session-setup", "context-loading"],
603
+ skill_source: "external",
604
+ status: "active",
605
+ description: "Optimizes agent context setup.",
606
+ load_path: "skills/context-engineering/SKILL.md",
607
+ origin: "addyosmani/agent-skills",
608
+ },
609
+ {
610
+ name: "iterative-retrieval",
611
+ source: "external",
612
+ phase: "operate",
613
+ domains: ["orchestration", "context-management", "research"],
614
+ stacks: ["any", "harness"],
615
+ allowed_agents: ["lead", "researcher", "developer"],
616
+ surfaces: ["context-loading", "multi-agent-orchestration"],
617
+ skill_source: "external",
618
+ status: "active",
619
+ description: "Pattern for progressively refining context retrieval.",
620
+ load_path: "skills/iterative-retrieval/SKILL.md",
621
+ origin: "affaan-m/ecc",
622
+ },
623
+ {
624
+ name: "doubt-driven-development",
625
+ source: "external",
626
+ phase: "review",
627
+ domains: ["review", "debugging", "security"],
628
+ stacks: ["any"],
629
+ allowed_agents: ["lead", "developer", "reviewer"],
630
+ surfaces: ["code-implementation", "adversarial-review"],
631
+ skill_source: "external",
632
+ status: "active",
633
+ description: "Subjects every non-trivial decision to adversarial review.",
634
+ load_path: "skills/doubt-driven-development/SKILL.md",
635
+ origin: "addyosmani/agent-skills",
636
+ },
637
+ {
638
+ name: "verification-loop",
639
+ source: "external",
640
+ phase: "verify",
641
+ domains: ["testing", "evaluation", "release"],
642
+ stacks: ["any"],
643
+ allowed_agents: ["lead", "developer", "reviewer", "evaluator"],
644
+ surfaces: ["quality-gates", "pre-pr-checks"],
645
+ skill_source: "external",
646
+ status: "active",
647
+ description: "Comprehensive multi-phase verification system.",
648
+ load_path: "skills/verification-loop/SKILL.md",
649
+ origin: "affaan-m/ecc",
650
+ },
651
+ {
652
+ name: "using-agent-skills",
653
+ source: "external",
654
+ phase: "meta",
655
+ domains: ["orchestration", "specification"],
656
+ stacks: ["any", "harness"],
657
+ allowed_agents: ["lead", "researcher", "specifier"],
658
+ surfaces: ["skill-discovery", "orchestration"],
659
+ skill_source: "external",
660
+ status: "active",
661
+ description: "Discovers and invokes agent skills.",
662
+ load_path: "skills/using-agent-skills/SKILL.md",
663
+ origin: "addyosmani/agent-skills",
664
+ },
665
+ {
666
+ name: "autonomous-loops",
667
+ source: "external",
668
+ phase: "operate",
669
+ domains: ["orchestration", "evolution", "release"],
670
+ stacks: ["any", "harness"],
671
+ allowed_agents: ["lead", "evolver"],
672
+ surfaces: ["autonomous-orchestration", "ci-cd-pipelines"],
673
+ skill_source: "external",
674
+ status: "active",
675
+ description: "Patterns and architectures for autonomous loops.",
676
+ load_path: "skills/autonomous-loops/SKILL.md",
677
+ origin: "affaan-m/ecc",
678
+ },
679
+ ];
680
+
681
+ const REGISTRY_WITH_EXTERNAL = {
682
+ ...FIXTURE_REGISTRY,
683
+ skills: [...FIXTURE_REGISTRY.skills, ...EXTERNAL_SKILLS],
684
+ };
685
+
686
+ test("context-engineering appears in shortlist for developer + build", () => {
687
+ const shortlist = generateShortlist({
688
+ targetAgent: "developer",
689
+ taskPhase: "build",
690
+ taskDomains: ["context-management"],
691
+ registry: REGISTRY_WITH_EXTERNAL,
692
+ snapshot: FIXTURE_SNAPSHOT,
693
+ });
694
+ assertIncludes(shortlist.candidates, "context-engineering");
695
+ });
696
+
697
+ test("using-agent-skills appears in shortlist for lead + meta", () => {
698
+ const shortlist = generateShortlist({
699
+ targetAgent: "lead",
700
+ taskPhase: "meta",
701
+ taskDomains: ["orchestration"],
702
+ registry: REGISTRY_WITH_EXTERNAL,
703
+ snapshot: FIXTURE_SNAPSHOT,
704
+ });
705
+ assertIncludes(shortlist.candidates, "using-agent-skills");
706
+ });
707
+
708
+ test("doubt-driven-development appears for reviewer + review", () => {
709
+ const shortlist = generateShortlist({
710
+ targetAgent: "reviewer",
711
+ taskPhase: "review",
712
+ taskDomains: ["review"],
713
+ registry: REGISTRY_WITH_EXTERNAL,
714
+ snapshot: FIXTURE_SNAPSHOT,
715
+ });
716
+ assertIncludes(shortlist.candidates, "doubt-driven-development");
717
+ });
718
+
719
+ test("verification-loop appears for developer + verify", () => {
720
+ const shortlist = generateShortlist({
721
+ targetAgent: "developer",
722
+ taskPhase: "verify",
723
+ taskDomains: ["testing"],
724
+ registry: REGISTRY_WITH_EXTERNAL,
725
+ snapshot: FIXTURE_SNAPSHOT,
726
+ });
727
+ assertIncludes(shortlist.candidates, "verification-loop");
728
+ });
729
+
730
+ test("all external skills have skill_source=external and origin set", () => {
731
+ for (const skill of EXTERNAL_SKILLS) {
732
+ assert.equal(skill.skill_source, "external", `${skill.name} should have skill_source=external`);
733
+ assert.ok(skill.origin, `${skill.name} should have origin set`);
734
+ assert.ok(skill.origin.length > 0, `${skill.name} origin should not be empty`);
735
+ }
736
+ });
737
+
738
+ test("external skills have required metadata fields", () => {
739
+ const requiredFields = ["name", "phase", "domains", "stacks", "allowed_agents", "skill_source", "origin", "status"];
740
+ for (const skill of EXTERNAL_SKILLS) {
741
+ for (const field of requiredFields) {
742
+ assert.ok(field in skill, `${skill.name} should have field '${field}'`);
743
+ }
744
+ }
745
+ });
746
+
747
+ test("autonomous-loops appears for lead + operate", () => {
748
+ const shortlist = generateShortlist({
749
+ targetAgent: "lead",
750
+ taskPhase: "operate",
751
+ taskDomains: ["orchestration"],
752
+ registry: REGISTRY_WITH_EXTERNAL,
753
+ snapshot: FIXTURE_SNAPSHOT,
754
+ });
755
+ assertIncludes(shortlist.candidates, "autonomous-loops");
756
+ });
757
+
758
+ test("iterative-retrieval appears for lead + operate", () => {
759
+ const shortlist = generateShortlist({
760
+ targetAgent: "lead",
761
+ taskPhase: "operate",
762
+ taskDomains: ["orchestration", "context-management"],
763
+ registry: REGISTRY_WITH_EXTERNAL,
764
+ snapshot: FIXTURE_SNAPSHOT,
765
+ });
766
+ assertIncludes(shortlist.candidates, "iterative-retrieval");
767
+ });
768
+
769
+ // ── Summary ──────────────────────────────────────────────────────────────
770
+
771
+ console.log(`\n=== Results: ${passed} passed, ${failed} failed ===\n`);
772
+
773
+ if (failed > 0) {
774
+ console.log("Failures:");
775
+ for (const f of failures) {
776
+ console.log(` - ${f.name}: ${f.error.message}`);
777
+ }
778
+ process.exit(1);
779
+ }
780
+
781
+ process.exit(0);