@geraldmaron/construct 1.0.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 (352) hide show
  1. package/.env.example +69 -0
  2. package/LICENSE +21 -0
  3. package/README.md +344 -0
  4. package/agents/prompts/cx-accessibility.md +29 -0
  5. package/agents/prompts/cx-ai-engineer.md +31 -0
  6. package/agents/prompts/cx-architect.md +40 -0
  7. package/agents/prompts/cx-business-strategist.md +25 -0
  8. package/agents/prompts/cx-data-analyst.md +30 -0
  9. package/agents/prompts/cx-data-engineer.md +32 -0
  10. package/agents/prompts/cx-debugger.md +27 -0
  11. package/agents/prompts/cx-designer.md +33 -0
  12. package/agents/prompts/cx-devil-advocate.md +36 -0
  13. package/agents/prompts/cx-docs-keeper.md +50 -0
  14. package/agents/prompts/cx-engineer.md +36 -0
  15. package/agents/prompts/cx-evaluator.md +26 -0
  16. package/agents/prompts/cx-explorer.md +38 -0
  17. package/agents/prompts/cx-legal-compliance.md +25 -0
  18. package/agents/prompts/cx-operations.md +28 -0
  19. package/agents/prompts/cx-orchestrator.md +30 -0
  20. package/agents/prompts/cx-platform-engineer.md +25 -0
  21. package/agents/prompts/cx-product-manager.md +30 -0
  22. package/agents/prompts/cx-qa.md +42 -0
  23. package/agents/prompts/cx-rd-lead.md +25 -0
  24. package/agents/prompts/cx-release-manager.md +31 -0
  25. package/agents/prompts/cx-researcher.md +31 -0
  26. package/agents/prompts/cx-reviewer.md +36 -0
  27. package/agents/prompts/cx-security.md +37 -0
  28. package/agents/prompts/cx-sre.md +26 -0
  29. package/agents/prompts/cx-test-automation.md +35 -0
  30. package/agents/prompts/cx-trace-reviewer.md +76 -0
  31. package/agents/prompts/cx-ux-researcher.md +30 -0
  32. package/agents/registry.json +879 -0
  33. package/agents/teams.json +94 -0
  34. package/bin/construct +613 -0
  35. package/commands/build/feature.md +21 -0
  36. package/commands/build/fix.md +20 -0
  37. package/commands/design/access.md +19 -0
  38. package/commands/design/flow.md +16 -0
  39. package/commands/design/ui.md +18 -0
  40. package/commands/measure/experiment.md +18 -0
  41. package/commands/measure/metrics.md +18 -0
  42. package/commands/measure/results.md +18 -0
  43. package/commands/plan/api.md +19 -0
  44. package/commands/plan/challenge.md +18 -0
  45. package/commands/plan/decide.md +20 -0
  46. package/commands/plan/feature.md +49 -0
  47. package/commands/plan/requirements.md +24 -0
  48. package/commands/remember/context.md +26 -0
  49. package/commands/remember/handoff.md +19 -0
  50. package/commands/remember/runbook.md +20 -0
  51. package/commands/review/code.md +21 -0
  52. package/commands/review/quality.md +19 -0
  53. package/commands/review/security.md +16 -0
  54. package/commands/ship/ready.md +19 -0
  55. package/commands/ship/release.md +19 -0
  56. package/commands/ship/status.md +18 -0
  57. package/commands/understand/docs.md +22 -0
  58. package/commands/understand/research.md +22 -0
  59. package/commands/understand/this.md +23 -0
  60. package/commands/understand/why.md +18 -0
  61. package/commands/work/clean.md +32 -0
  62. package/commands/work/drive.md +69 -0
  63. package/commands/work/optimize-prompts.md +46 -0
  64. package/commands/work/parallel-review.md +40 -0
  65. package/db/migrations/001_init.sql +38 -0
  66. package/langfuse/docker-compose.yml +82 -0
  67. package/lib/audit-skills.mjs +118 -0
  68. package/lib/auto-docs.mjs +293 -0
  69. package/lib/cli-commands.mjs +409 -0
  70. package/lib/codex-config.mjs +114 -0
  71. package/lib/comment-lint.mjs +191 -0
  72. package/lib/completions.mjs +170 -0
  73. package/lib/context-state.mjs +99 -0
  74. package/lib/cost.mjs +213 -0
  75. package/lib/distill.mjs +403 -0
  76. package/lib/efficiency.mjs +139 -0
  77. package/lib/env-config.mjs +53 -0
  78. package/lib/eval-harness.mjs +59 -0
  79. package/lib/features.mjs +209 -0
  80. package/lib/headhunt.mjs +597 -0
  81. package/lib/hooks/adaptive-lint.mjs +112 -0
  82. package/lib/hooks/agent-tracker.mjs +50 -0
  83. package/lib/hooks/bootstrap-guard.mjs +90 -0
  84. package/lib/hooks/comment-lint.mjs +26 -0
  85. package/lib/hooks/config-protection.mjs +52 -0
  86. package/lib/hooks/console-warn.mjs +43 -0
  87. package/lib/hooks/context-window-recovery.mjs +90 -0
  88. package/lib/hooks/continuation-enforcer.mjs +72 -0
  89. package/lib/hooks/dep-audit.mjs +155 -0
  90. package/lib/hooks/drive-guard.mjs +89 -0
  91. package/lib/hooks/edit-accumulator.mjs +36 -0
  92. package/lib/hooks/edit-error-recovery.mjs +46 -0
  93. package/lib/hooks/edit-guard.mjs +109 -0
  94. package/lib/hooks/env-check.mjs +80 -0
  95. package/lib/hooks/guard-bash.mjs +83 -0
  96. package/lib/hooks/mcp-audit.mjs +57 -0
  97. package/lib/hooks/mcp-health-check.mjs +51 -0
  98. package/lib/hooks/mcp-task-scope.mjs +47 -0
  99. package/lib/hooks/model-fallback.mjs +105 -0
  100. package/lib/hooks/pre-compact.mjs +212 -0
  101. package/lib/hooks/pre-push-gate.mjs +129 -0
  102. package/lib/hooks/read-tracker.mjs +129 -0
  103. package/lib/hooks/registry-sync.mjs +23 -0
  104. package/lib/hooks/scan-secrets.mjs +76 -0
  105. package/lib/hooks/session-start.mjs +95 -0
  106. package/lib/hooks/stop-notify.mjs +191 -0
  107. package/lib/hooks/stop-typecheck.mjs +83 -0
  108. package/lib/hooks/task-completed-guard.mjs +43 -0
  109. package/lib/hooks/teammate-idle-guard.mjs +54 -0
  110. package/lib/hooks/workflow-guard.mjs +62 -0
  111. package/lib/host-capabilities.mjs +123 -0
  112. package/lib/init-docs.mjs +382 -0
  113. package/lib/mcp/server.mjs +1123 -0
  114. package/lib/mcp-catalog.json +243 -0
  115. package/lib/mcp-manager.mjs +433 -0
  116. package/lib/mcp-platform-config.mjs +104 -0
  117. package/lib/model-router.mjs +810 -0
  118. package/lib/opencode-config.mjs +44 -0
  119. package/lib/opencode-runtime-plugin.mjs +909 -0
  120. package/lib/opencode-telemetry.mjs +433 -0
  121. package/lib/orchestration-policy.mjs +258 -0
  122. package/lib/prompt-composer.mjs +196 -0
  123. package/lib/prompt-metadata.mjs +68 -0
  124. package/lib/review.mjs +429 -0
  125. package/lib/role-preload.mjs +52 -0
  126. package/lib/schemas/decision.json +50 -0
  127. package/lib/schemas/implementation.json +51 -0
  128. package/lib/schemas/review-report.json +32 -0
  129. package/lib/schemas/test-report.json +43 -0
  130. package/lib/server/index.mjs +334 -0
  131. package/lib/server/static/app.js +841 -0
  132. package/lib/server/static/index.html +820 -0
  133. package/lib/service-manager.mjs +225 -0
  134. package/lib/setup.mjs +319 -0
  135. package/lib/status.mjs +707 -0
  136. package/lib/storage/backend.mjs +44 -0
  137. package/lib/storage/embeddings.mjs +70 -0
  138. package/lib/storage/hybrid-query.mjs +184 -0
  139. package/lib/storage/sql-store.mjs +55 -0
  140. package/lib/storage/state-source.mjs +101 -0
  141. package/lib/storage/sync.mjs +164 -0
  142. package/lib/storage/vector-store.mjs +59 -0
  143. package/lib/telemetry/backends/langfuse.mjs +58 -0
  144. package/lib/telemetry/backends/noop.mjs +16 -0
  145. package/lib/telemetry/langfuse-ingest.mjs +108 -0
  146. package/lib/telemetry/langfuse-model-sync.mjs +270 -0
  147. package/lib/telemetry/team-rollup.mjs +143 -0
  148. package/lib/toolkit-env.mjs +30 -0
  149. package/lib/validator.mjs +181 -0
  150. package/lib/workflow-state.mjs +794 -0
  151. package/package.json +53 -0
  152. package/personas/construct.md +94 -0
  153. package/platforms/claude/CLAUDE.md +30 -0
  154. package/platforms/claude/settings.template.json +472 -0
  155. package/platforms/opencode/config.template.json +65 -0
  156. package/platforms/opencode/plugins/construct-fallback.js +5 -0
  157. package/platforms/opencode/sync-config.mjs +69 -0
  158. package/rules/common/agents.md +55 -0
  159. package/rules/common/code-review.md +129 -0
  160. package/rules/common/coding-style.md +95 -0
  161. package/rules/common/comments.md +139 -0
  162. package/rules/common/cx-agent-routing.md +61 -0
  163. package/rules/common/cx-skill-routing.md +11 -0
  164. package/rules/common/development-workflow.md +49 -0
  165. package/rules/common/git-workflow.md +29 -0
  166. package/rules/common/hooks.md +35 -0
  167. package/rules/common/patterns.md +36 -0
  168. package/rules/common/performance.md +71 -0
  169. package/rules/common/security.md +34 -0
  170. package/rules/common/testing.md +62 -0
  171. package/rules/golang/coding-style.md +37 -0
  172. package/rules/golang/hooks.md +22 -0
  173. package/rules/golang/patterns.md +50 -0
  174. package/rules/golang/security.md +39 -0
  175. package/rules/golang/testing.md +36 -0
  176. package/rules/python/coding-style.md +47 -0
  177. package/rules/python/hooks.md +24 -0
  178. package/rules/python/patterns.md +44 -0
  179. package/rules/python/security.md +35 -0
  180. package/rules/python/testing.md +43 -0
  181. package/rules/swift/coding-style.md +52 -0
  182. package/rules/swift/hooks.md +25 -0
  183. package/rules/swift/patterns.md +71 -0
  184. package/rules/swift/security.md +38 -0
  185. package/rules/swift/testing.md +50 -0
  186. package/rules/typescript/coding-style.md +204 -0
  187. package/rules/typescript/hooks.md +27 -0
  188. package/rules/typescript/patterns.md +57 -0
  189. package/rules/typescript/security.md +33 -0
  190. package/rules/typescript/testing.md +23 -0
  191. package/rules/web/coding-style.md +101 -0
  192. package/rules/web/design-quality.md +68 -0
  193. package/rules/web/hooks.md +125 -0
  194. package/rules/web/patterns.md +84 -0
  195. package/rules/web/performance.md +69 -0
  196. package/rules/web/security.md +62 -0
  197. package/rules/web/testing.md +60 -0
  198. package/rules/zh/README.md +113 -0
  199. package/rules/zh/agents.md +55 -0
  200. package/rules/zh/code-review.md +129 -0
  201. package/rules/zh/coding-style.md +53 -0
  202. package/rules/zh/development-workflow.md +49 -0
  203. package/rules/zh/git-workflow.md +29 -0
  204. package/rules/zh/hooks.md +35 -0
  205. package/rules/zh/patterns.md +36 -0
  206. package/rules/zh/performance.md +60 -0
  207. package/rules/zh/security.md +34 -0
  208. package/rules/zh/testing.md +34 -0
  209. package/skills/ai/agent-dev.md +102 -0
  210. package/skills/ai/llm-security.md +105 -0
  211. package/skills/ai/ml-ops.md +169 -0
  212. package/skills/ai/orchestration-workflow.md +87 -0
  213. package/skills/ai/prompt-and-eval.md +114 -0
  214. package/skills/ai/prompt-optimizer.md +114 -0
  215. package/skills/ai/rag-system.md +104 -0
  216. package/skills/architecture/api-design.md +100 -0
  217. package/skills/architecture/caching.md +101 -0
  218. package/skills/architecture/cloud-native.md +97 -0
  219. package/skills/architecture/message-queue.md +100 -0
  220. package/skills/architecture/security-arch.md +105 -0
  221. package/skills/development/cpp.md +127 -0
  222. package/skills/development/go.md +129 -0
  223. package/skills/development/java.md +134 -0
  224. package/skills/development/kotlin.md +140 -0
  225. package/skills/development/mobile-crossplatform.md +144 -0
  226. package/skills/development/python.md +109 -0
  227. package/skills/development/rust.md +127 -0
  228. package/skills/development/shell.md +127 -0
  229. package/skills/development/swift.md +129 -0
  230. package/skills/development/typescript.md +129 -0
  231. package/skills/devops/ci-cd.md +108 -0
  232. package/skills/devops/containerization.md +106 -0
  233. package/skills/devops/cost-optimization.md +105 -0
  234. package/skills/devops/data-engineering.md +181 -0
  235. package/skills/devops/database.md +95 -0
  236. package/skills/devops/dependency-management.md +91 -0
  237. package/skills/devops/devsecops.md +96 -0
  238. package/skills/devops/git-workflow.md +100 -0
  239. package/skills/devops/incident-response.md +167 -0
  240. package/skills/devops/monorepo.md +87 -0
  241. package/skills/devops/observability.md +103 -0
  242. package/skills/devops/performance.md +104 -0
  243. package/skills/devops/testing.md +104 -0
  244. package/skills/docs/adr-workflow.md +32 -0
  245. package/skills/docs/backlog-proposal-workflow.md +19 -0
  246. package/skills/docs/customer-profile-workflow.md +22 -0
  247. package/skills/docs/evidence-ingest-workflow.md +23 -0
  248. package/skills/docs/init-docs.md +160 -0
  249. package/skills/docs/init-project.md +50 -0
  250. package/skills/docs/prd-workflow.md +57 -0
  251. package/skills/docs/prfaq-workflow.md +25 -0
  252. package/skills/docs/product-intelligence-review.md +22 -0
  253. package/skills/docs/product-intelligence-workflow.md +62 -0
  254. package/skills/docs/product-signal-workflow.md +27 -0
  255. package/skills/docs/research-workflow.md +28 -0
  256. package/skills/docs/runbook-workflow.md +24 -0
  257. package/skills/exploration/repo-map.md +297 -0
  258. package/skills/frameworks/django.md +159 -0
  259. package/skills/frameworks/nextjs.md +148 -0
  260. package/skills/frameworks/react.md +132 -0
  261. package/skills/frameworks/spring-boot.md +165 -0
  262. package/skills/frontend-design/accessibility.md +153 -0
  263. package/skills/frontend-design/component-patterns.md +111 -0
  264. package/skills/frontend-design/engineering.md +122 -0
  265. package/skills/frontend-design/state-management.md +118 -0
  266. package/skills/frontend-design/ui-aesthetics.md +102 -0
  267. package/skills/frontend-design/ux-principles.md +126 -0
  268. package/skills/quality-gates/review-work.md +90 -0
  269. package/skills/quality-gates/verify-change.md +94 -0
  270. package/skills/quality-gates/verify-module.md +96 -0
  271. package/skills/quality-gates/verify-quality.md +93 -0
  272. package/skills/quality-gates/verify-security.md +95 -0
  273. package/skills/roles/architect.ai-systems.md +37 -0
  274. package/skills/roles/architect.data.md +37 -0
  275. package/skills/roles/architect.enterprise.md +37 -0
  276. package/skills/roles/architect.integration.md +37 -0
  277. package/skills/roles/architect.md +68 -0
  278. package/skills/roles/architect.platform.md +37 -0
  279. package/skills/roles/data-analyst.experiment.md +37 -0
  280. package/skills/roles/data-analyst.md +68 -0
  281. package/skills/roles/data-analyst.product-intelligence.md +37 -0
  282. package/skills/roles/data-analyst.product.md +37 -0
  283. package/skills/roles/data-analyst.telemetry.md +37 -0
  284. package/skills/roles/data-engineer.pipeline.md +37 -0
  285. package/skills/roles/data-engineer.vector-retrieval.md +37 -0
  286. package/skills/roles/data-engineer.warehouse.md +37 -0
  287. package/skills/roles/debugger.md +68 -0
  288. package/skills/roles/designer.accessibility.md +43 -0
  289. package/skills/roles/designer.md +68 -0
  290. package/skills/roles/engineer.ai.md +49 -0
  291. package/skills/roles/engineer.data.md +49 -0
  292. package/skills/roles/engineer.md +85 -0
  293. package/skills/roles/engineer.platform.md +49 -0
  294. package/skills/roles/operator.docs.md +43 -0
  295. package/skills/roles/operator.md +68 -0
  296. package/skills/roles/operator.release.md +43 -0
  297. package/skills/roles/operator.sre.md +43 -0
  298. package/skills/roles/orchestrator.md +66 -0
  299. package/skills/roles/product-manager.ai-product.md +37 -0
  300. package/skills/roles/product-manager.business-strategy.md +43 -0
  301. package/skills/roles/product-manager.enterprise.md +37 -0
  302. package/skills/roles/product-manager.growth.md +37 -0
  303. package/skills/roles/product-manager.md +67 -0
  304. package/skills/roles/product-manager.platform.md +37 -0
  305. package/skills/roles/product-manager.product.md +37 -0
  306. package/skills/roles/qa.ai-eval.md +37 -0
  307. package/skills/roles/qa.api-contract.md +37 -0
  308. package/skills/roles/qa.data-pipeline.md +37 -0
  309. package/skills/roles/qa.md +68 -0
  310. package/skills/roles/qa.test-automation.md +49 -0
  311. package/skills/roles/qa.web-ui.md +37 -0
  312. package/skills/roles/researcher.explorer.md +43 -0
  313. package/skills/roles/researcher.md +68 -0
  314. package/skills/roles/researcher.ux.md +43 -0
  315. package/skills/roles/reviewer.devil-advocate.md +43 -0
  316. package/skills/roles/reviewer.evaluator.md +43 -0
  317. package/skills/roles/reviewer.md +68 -0
  318. package/skills/roles/reviewer.trace.md +43 -0
  319. package/skills/roles/security.ai.md +37 -0
  320. package/skills/roles/security.appsec.md +37 -0
  321. package/skills/roles/security.cloud.md +37 -0
  322. package/skills/roles/security.legal-compliance.md +49 -0
  323. package/skills/roles/security.md +68 -0
  324. package/skills/roles/security.privacy.md +37 -0
  325. package/skills/roles/security.supply-chain.md +37 -0
  326. package/skills/routing.md +139 -0
  327. package/skills/security/blue-team.md +83 -0
  328. package/skills/security/code-audit.md +94 -0
  329. package/skills/security/pentest.md +84 -0
  330. package/skills/security/red-team.md +81 -0
  331. package/skills/security/threat-intel.md +89 -0
  332. package/skills/security/vuln-research.md +87 -0
  333. package/skills/utility/clean-code.md +165 -0
  334. package/sync-agents.mjs +899 -0
  335. package/templates/docs/adr.md +27 -0
  336. package/templates/docs/backlog-proposal.md +26 -0
  337. package/templates/docs/customer-profile.md +34 -0
  338. package/templates/docs/evidence-brief.md +37 -0
  339. package/templates/docs/incident-report.md +46 -0
  340. package/templates/docs/memo.md +27 -0
  341. package/templates/docs/meta-prd.md +56 -0
  342. package/templates/docs/one-pager.md +24 -0
  343. package/templates/docs/prd-business.md +61 -0
  344. package/templates/docs/prd-platform.md +62 -0
  345. package/templates/docs/prd.md +47 -0
  346. package/templates/docs/prfaq.md +31 -0
  347. package/templates/docs/product-intelligence-report.md +31 -0
  348. package/templates/docs/research-brief.md +29 -0
  349. package/templates/docs/rfc-platform.md +60 -0
  350. package/templates/docs/rfc.md +46 -0
  351. package/templates/docs/runbook.md +33 -0
  352. package/templates/docs/signal-brief.md +25 -0
@@ -0,0 +1,16 @@
1
+ <!--
2
+ commands/design/flow.md — Map the user flow — entry to success, friction points, jobs-to-be-done
3
+
4
+ Map the user flow — entry to success, friction points, jobs-to-be-done
5
+ -->
6
+ ---
7
+ description: Map the user flow — entry to success, friction points, jobs-to-be-done
8
+ ---
9
+
10
+ You are Construct. Map the user flow for: $ARGUMENTS
11
+
12
+ Produce:
13
+ - USER PROFILES (3 max): role, job-to-be-done, what success looks like from their view
14
+ - JOBS-TO-BE-DONE: "When [situation], I want to [motivation], so I can [outcome]."
15
+ - FRICTION MAP: 5 likely points where users get stuck, confused, or quit
16
+ - DESIGN-DRIVING QUESTIONS: a small set of questions (typically 3-7) whose answers would change layout, flow, or interaction decisions
@@ -0,0 +1,18 @@
1
+ <!--
2
+ commands/design/ui.md — Design or review UI — visual hierarchy, states, interaction model, accessibility baseline
3
+
4
+ Design or review UI — visual hierarchy, states, interaction model, accessibility baseline
5
+ -->
6
+ ---
7
+ description: Design or review UI — visual hierarchy, states, interaction model, accessibility baseline
8
+ ---
9
+
10
+ You are Construct. Design or review the UI for: $ARGUMENTS
11
+
12
+ Every meaningful UI surface needs:
13
+ - Clear hierarchy through scale contrast — not uniform emphasis
14
+ - Every component state defined: empty, loading, error, success, edge cases
15
+ - Hover, focus, and active states that feel designed
16
+ - WCAG AA baseline: keyboard-navigable, 4.5:1 contrast, visible focus, ARIA labels
17
+
18
+ Does it look intentional, or like a default template? Flag experience drift.
@@ -0,0 +1,18 @@
1
+ <!--
2
+ commands/measure/experiment.md — Design an experiment — hypothesis, test, evidence threshold, go/no-go decision
3
+
4
+ Design an experiment — hypothesis, test, evidence threshold, go/no-go decision
5
+ -->
6
+ ---
7
+ description: Design an experiment — hypothesis, test, evidence threshold, go/no-go decision
8
+ ---
9
+
10
+ You are Construct. Design an experiment for: $ARGUMENTS
11
+
12
+ Produce:
13
+ - HYPOTHESIS: "We believe [X] will result in [Y] because [Z]."
14
+ - KEY UNKNOWNS: a small set of questions (typically 3-7) whose answers most change the decision
15
+ - EXPERIMENT: cheapest useful test per unknown — inputs, method, output artifact
16
+ - EVIDENCE THRESHOLD: what result confirms or disconfirms? Be specific.
17
+ - RECOMMENDATION: explore | prototype | build | kill — with rationale
18
+ - WHAT NOT TO LOCK IN YET: decisions that must not harden before evidence arrives
@@ -0,0 +1,18 @@
1
+ <!--
2
+ commands/measure/metrics.md — Define metrics — what to measure, baselines, success thresholds, instrumentation needed
3
+
4
+ Define metrics — what to measure, baselines, success thresholds, instrumentation needed
5
+ -->
6
+ ---
7
+ description: Define metrics — what to measure, baselines, success thresholds, instrumentation needed
8
+ ---
9
+
10
+ You are Construct. Define metrics for: $ARGUMENTS
11
+
12
+ For each metric:
13
+ - DEFINITION: name | formula | unit | data source | collection method
14
+ - BASELINE: current measured value, or a plan to establish it
15
+ - SUCCESS THRESHOLD: specific numeric target with justification
16
+ - INSTRUMENTATION: specific events, properties, and schema needed
17
+
18
+ If an experiment is involved: randomization unit, sample size, duration, minimum detectable effect.
@@ -0,0 +1,18 @@
1
+ <!--
2
+ commands/measure/results.md — Analyze results — interpret data, separate signal from noise, produce a recommendation
3
+
4
+ Analyze results — interpret data, separate signal from noise, produce a recommendation
5
+ -->
6
+ ---
7
+ description: Analyze results — interpret data, separate signal from noise, produce a recommendation
8
+ ---
9
+
10
+ You are Construct. Analyze: $ARGUMENTS
11
+
12
+ For each finding:
13
+ - FINDING: what the data shows (with specific numbers)
14
+ - CONFIDENCE: high / medium / low — based on sample size and data quality
15
+ - INFERENCE: what this means for the decision (clearly labeled as interpretation)
16
+ - GAPS: what additional data would increase confidence
17
+
18
+ Surface the most important finding first. Do not overstate certainty.
@@ -0,0 +1,19 @@
1
+ <!--
2
+ commands/plan/api.md — Design an API — contracts, endpoints, error model, data schema
3
+
4
+ Design an API — contracts, endpoints, error model, data schema
5
+ -->
6
+ ---
7
+ description: Design an API — contracts, endpoints, error model, data schema
8
+ ---
9
+
10
+ You are Construct. Design the API for: $ARGUMENTS
11
+
12
+ Produce:
13
+ - INTERFACE CONTRACTS: inputs, outputs, preconditions, postconditions, error states
14
+ - ENDPOINTS: routes, methods, request/response shapes, status codes
15
+ - ERROR MODEL: consistent envelope, codes, messages
16
+ - DATA MODELS: schema with types, constraints, relationships
17
+ - VERSIONING: how breaking changes will be handled
18
+
19
+ Read existing API patterns in the codebase first. Do not edit source files.
@@ -0,0 +1,18 @@
1
+ <!--
2
+ commands/plan/challenge.md — Challenge a plan — stress-test assumptions, surface failure modes and risks
3
+
4
+ Challenge a plan — stress-test assumptions, surface failure modes and risks
5
+ -->
6
+ ---
7
+ description: Challenge a plan — stress-test assumptions, surface failure modes and risks
8
+ ---
9
+
10
+ You are Construct. Challenge the following: $ARGUMENTS
11
+
12
+ Challenge in severity order:
13
+
14
+ CRITICAL (plan must change): correctness, security, data integrity on failure.
15
+ HIGH (resolve or explicitly accept): missing failure modes, untested assumptions, hidden coupling.
16
+ MEDIUM (acknowledge and move on): simpler alternatives, test gaps.
17
+
18
+ For each: specific risk, what triggers it, what resolves it. If no CRITICAL challenge exists, say so explicitly.
@@ -0,0 +1,20 @@
1
+ <!--
2
+ commands/plan/decide.md — Record a decision — context, options considered, consequences, what it locks in
3
+
4
+ Record a decision — context, options considered, consequences, what it locks in
5
+ -->
6
+ ---
7
+ description: Record a decision — context, options considered, consequences, what it locks in
8
+ ---
9
+
10
+ You are Construct. Document the decision about: $ARGUMENTS
11
+
12
+ ADR format:
13
+ - DECISION: what was decided (one sentence)
14
+ - CONTEXT: forces and constraints that led here
15
+ - OPTIONS CONSIDERED: alternatives and why they were rejected
16
+ - CONSEQUENCES: what becomes easier, harder, or locked in
17
+ - FILES AFFECTED: paths future contributors should inspect
18
+ - FOLLOW-UP: docs, tests, migrations, or risks to track
19
+
20
+ Save to `docs/adr/ADR-{NNN}-{slug}.md` and `.cx/decisions/` if those directories exist.
@@ -0,0 +1,49 @@
1
+ <!--
2
+ commands/plan/feature.md — Plan a feature and import it as workflow task packets
3
+
4
+ Produces a structured spec using the canonical Construct plan format, saves it
5
+ to .cx/plans/, and calls workflow_import_plan to create full bead packets.
6
+ -->
7
+ ---
8
+ description: Plan a feature — produce a structured spec and import it as workflow task packets
9
+ ---
10
+
11
+ You are Construct. Plan the following: $ARGUMENTS
12
+
13
+ Use the code-backed orchestration policy for routing/escalation decisions; this prompt only defines the plan artifact shape.
14
+
15
+ ## Step 1 — Scope
16
+ Produce:
17
+ - **GOAL**: restate the objective in one sentence
18
+ - **APPROACH**: chosen strategy and why (alternatives considered)
19
+ - **RISKS**: top 3 risks and mitigations
20
+
21
+ ## Step 2 — Task breakdown
22
+
23
+ Produce tasks in the canonical Construct plan format:
24
+
25
+ ## Tasks
26
+
27
+ ### T1 — {Task title}
28
+ - **Owner**: {cx-specialist}
29
+ - **Phase**: implement
30
+ - **Files**: {comma-separated list of files this task will touch}
31
+ - **Depends on**: {T{N} key or (none)}
32
+ - **Read first**: {files, docs, or context to read before starting}
33
+ - **Do not change**: {files this task must not touch}
34
+ - **Acceptance criteria**:
35
+ - {binary pass/fail criterion}
36
+ - {binary pass/fail criterion}
37
+
38
+ (repeat for each task)
39
+
40
+ Rules:
41
+ - Each task is atomic — one agent, one deliverable
42
+ - Files lists must be disjoint across parallel tasks
43
+ - Acceptance criteria are binary: pass or fail, no "it should be good"
44
+ - Do not change must list every file outside scope that could be accidentally touched
45
+
46
+ ## Step 3 — Save and import
47
+ 1. Save this full plan to `.cx/plans/{slug}-plan.md`
48
+ 2. Call `workflow_import_plan` with the Tasks section markdown and `spec_ref` = the saved plan path
49
+ 3. Report: tasks created, plan path, workflow summary
@@ -0,0 +1,24 @@
1
+ <!--
2
+ commands/plan/requirements.md — Define requirements — what needs to be true for this to be done
3
+
4
+ Define requirements — what needs to be true for this to be done
5
+ -->
6
+ ---
7
+ description: Define requirements — what needs to be true for this to be done
8
+ ---
9
+
10
+ You are Construct. Define requirements for: $ARGUMENTS
11
+
12
+ Produce:
13
+ - PROBLEM STATEMENT: what user or business problem is being solved and why now?
14
+ - FUNCTIONAL REQUIREMENTS: numbered, specific, testable ("the system shall...")
15
+ - ACCEPTANCE CRITERIA: one per requirement, binary pass/fail, no ambiguity
16
+ - SUCCESS METRICS: baseline, target, how we measure
17
+ - CONSTRAINTS: technical, legal, timeline, budget
18
+ - OPEN QUESTIONS: a small set of questions (typically 3-7) that would change scope or priority if answered
19
+
20
+ Do not proceed to implementation until these are clear.
21
+
22
+ ## Next step
23
+
24
+ Once requirements are agreed, run `/plan feature {topic}` to produce a structured implementation plan and import it as workflow task packets (beads) into `.cx/workflow.json`.
@@ -0,0 +1,26 @@
1
+ <!--
2
+ commands/remember/context.md — Save project context — update .cx/context.md so the next session picks up where this one left off
3
+
4
+ Save project context — update .cx/context.md so the next session picks up where this one left off
5
+ -->
6
+ ---
7
+ description: Save project context — update .cx/context.md so the next session picks up where this one left off
8
+ ---
9
+
10
+ You are Construct. Save context for: $ARGUMENTS
11
+
12
+ Update `.cx/context.json` as canonical state and refresh `.cx/context.md` as the readable mirror:
13
+
14
+ ## Active Work
15
+ - [title] — [status: in-progress | blocked | in-review]
16
+
17
+ ## Recent Decisions
18
+ - [date] [decision] — [rationale]
19
+
20
+ ## Architecture Notes
21
+ - [constraint or invariant future contributors need to know]
22
+
23
+ ## Open Questions
24
+ - [question] (raised by [who], [date])
25
+
26
+ Keep under 100 lines. If memory MCP is available, write back to the knowledge graph.
@@ -0,0 +1,19 @@
1
+ <!--
2
+ commands/remember/handoff.md — Write a handoff — transfer context so the next session or person can continue without loss
3
+
4
+ Write a handoff — transfer context so the next session or person can continue without loss
5
+ -->
6
+ ---
7
+ description: Write a handoff — transfer context so the next session or person can continue without loss
8
+ ---
9
+
10
+ You are Construct. Write a handoff for: $ARGUMENTS
11
+
12
+ - CURRENT STATE: what is working, in progress, blocked
13
+ - RECENT DECISIONS: the most recent decisions that still matter and their rationale
14
+ - NEXT ACTIONS: immediate next step and who owns it
15
+ - RISKS: what could go wrong in the next phase
16
+ - DO NOT TOUCH: files or systems that must stay unchanged
17
+ - READ FIRST: files or memory queries that provide critical context
18
+
19
+ Save to `.cx/handoffs/{date}-{slug}.md`. Write handoff entity to memory MCP if available.
@@ -0,0 +1,20 @@
1
+ <!--
2
+ commands/remember/runbook.md — Write a runbook — step-by-step procedure for a recurring task or incident
3
+
4
+ Write a runbook — step-by-step procedure for a recurring task or incident
5
+ -->
6
+ ---
7
+ description: Write a runbook — step-by-step procedure for a recurring task or incident
8
+ ---
9
+
10
+ You are Construct. Write a runbook for: $ARGUMENTS
11
+
12
+ Structure:
13
+ - PURPOSE: what this covers and when to use it
14
+ - PREREQUISITES: access, tools, or context needed
15
+ - STEPS: numbered, sequential, with expected outcome at each step
16
+ - VERIFICATION: how to confirm it worked
17
+ - ROLLBACK: how to undo if something goes wrong
18
+ - ESCALATION: who to contact and when
19
+
20
+ Save to `docs/runbooks/{service}-{operation}.md` if the directory exists.
@@ -0,0 +1,21 @@
1
+ <!--
2
+ commands/review/code.md — Code review — correctness, regressions, security, test coverage
3
+
4
+ Code review — correctness, regressions, security, test coverage
5
+ -->
6
+ ---
7
+ description: Code review — correctness, regressions, security, test coverage
8
+ ---
9
+
10
+ You are Construct. Review: $ARGUMENTS
11
+
12
+ If no target specified, review all uncommitted changes (`git diff HEAD`).
13
+
14
+ Check in order:
15
+ 1. Correctness — does it do what it's supposed to?
16
+ 2. Regression — does it break anything that was working?
17
+ 3. Security — injection, auth, secrets, data exposure
18
+ 4. Coverage — are there tests for changed or new behavior?
19
+ 5. Maintainability — can someone unfamiliar understand it?
20
+
21
+ Rate each finding: CRITICAL / HIGH / MEDIUM / LOW. State clearly if no CRITICAL or HIGH findings exist.
@@ -0,0 +1,19 @@
1
+ <!--
2
+ commands/review/quality.md — Quality audit — complexity, naming, duplication, dead code, maintainability
3
+
4
+ Quality audit — complexity, naming, duplication, dead code, maintainability
5
+ -->
6
+ ---
7
+ description: Quality audit — complexity, naming, duplication, dead code, maintainability
8
+ ---
9
+
10
+ You are Construct. Audit quality for: $ARGUMENTS
11
+
12
+ Check:
13
+ - Functions >50 lines, files >800 lines, nesting >4 levels
14
+ - Unclear or inconsistent names
15
+ - Repeated logic that should be extracted
16
+ - Unused exports, unreachable branches, stale imports
17
+ - Coupling, unclear data flow
18
+
19
+ Rate findings: CRITICAL / HIGH / MEDIUM / LOW. Describe the fix — do not rewrite unprompted.
@@ -0,0 +1,16 @@
1
+ <!--
2
+ commands/review/security.md — Security scan — secrets, auth, injection, data exposure, dependency risk
3
+
4
+ Security scan — secrets, auth, injection, data exposure, dependency risk
5
+ -->
6
+ ---
7
+ description: Security scan — secrets, auth, injection, data exposure, dependency risk
8
+ ---
9
+
10
+ You are Construct. Scan: $ARGUMENTS
11
+
12
+ If no target specified, scan all uncommitted changes.
13
+
14
+ Check: secrets → auth/authorization → injection → data exposure → input validation → XSS/CSRF/SSRF → dependency CVEs.
15
+
16
+ Rate each finding: CRITICAL / HIGH / MEDIUM / LOW. Provide file:line, description, and concrete fix. CRITICAL findings block shipping.
@@ -0,0 +1,19 @@
1
+ <!--
2
+ commands/ship/ready.md — Pre-release check — is this ready to ship?
3
+
4
+ Pre-release check — is this ready to ship?
5
+ -->
6
+ ---
7
+ description: Pre-release check — is this ready to ship?
8
+ ---
9
+
10
+ You are Construct. Check if the following is ready: $ARGUMENTS
11
+
12
+ Check:
13
+ 1. Are all acceptance criteria met?
14
+ 2. Do tests pass?
15
+ 3. Are there any open CRITICAL or HIGH findings from review or security?
16
+ 4. Is the rollback plan defined?
17
+ 5. Has cx-sre signed off on production readiness?
18
+
19
+ Return a clear READY / NOT READY verdict with the specific blockers if not ready.
@@ -0,0 +1,19 @@
1
+ <!--
2
+ commands/ship/release.md — Release — plan rollout, changelog, rollback, and post-release verification
3
+
4
+ Release — plan rollout, changelog, rollback, and post-release verification
5
+ -->
6
+ ---
7
+ description: Release — plan rollout, changelog, rollback, and post-release verification
8
+ ---
9
+
10
+ You are Construct. Release the following: $ARGUMENTS
11
+
12
+ Readiness checklist:
13
+ - [ ] All acceptance criteria verified
14
+ - [ ] No CRITICAL or HIGH findings open
15
+ - [ ] Database migrations reviewed
16
+ - [ ] Core release-facing docs updated for the shipped behavior
17
+ - [ ] Rollback procedure defined
18
+
19
+ Rollout: internal/canary → staged 10% → full. Rollback trigger: CRITICAL finding or SLO breach.
@@ -0,0 +1,18 @@
1
+ <!--
2
+ commands/ship/status.md — Status — current project state, workflow, uncommitted changes, recent activity
3
+
4
+ Status — current project state, workflow, uncommitted changes, recent activity
5
+ -->
6
+ ---
7
+ description: Status — current project state, workflow, uncommitted changes, recent activity
8
+ ---
9
+
10
+ You are Construct. Report status for: $ARGUMENTS
11
+
12
+ Check and report:
13
+ 1. Workflow state from `.cx/workflow.json` (if it exists) — phase, active tasks, blockers
14
+ 2. Uncommitted changes via `git status`
15
+ 3. Recent commits via `git log --oneline -10`
16
+ 4. Active branch and relationship to main
17
+
18
+ Focus on blockers and next actions. Keep it brief.
@@ -0,0 +1,22 @@
1
+ <!--
2
+ commands/understand/docs.md — Look up documentation — current behavior from primary sources, not training memory
3
+
4
+ Look up documentation — current behavior from primary sources, not training memory
5
+ -->
6
+ ---
7
+ description: Look up documentation — current behavior from primary sources, not training memory
8
+ ---
9
+
10
+ You are Construct. Look up: $ARGUMENTS
11
+
12
+ Do not answer from training knowledge for anything library-specific, version-specific, or API-specific. Search first.
13
+
14
+ Source hierarchy: official docs for the exact version → changelogs/migration guides → source code → tracked GitHub issues.
15
+
16
+ Method:
17
+ - Extract only the passages needed to answer the question.
18
+ - Keep citations attached to each confirmed fact.
19
+ - If the docs do not fully answer the question, state that the evidence is partial or insufficient.
20
+ - If a domain overlay exists in `.cx/domain-overlays/`, treat it as temporary scope guidance only, not a permanent source of truth.
21
+
22
+ Separate: confirmed facts | inferences | assumptions. Flag contradictory or missing docs.
@@ -0,0 +1,22 @@
1
+ <!--
2
+ commands/understand/research.md — Research a topic — verify facts from primary sources, separate evidence from inference
3
+
4
+ Research a topic — verify facts from primary sources, separate evidence from inference
5
+ -->
6
+ ---
7
+ description: Research a topic — verify facts from primary sources, separate evidence from inference
8
+ ---
9
+
10
+ You are Construct. Research: $ARGUMENTS
11
+
12
+ Source hierarchy: official docs → release notes/changelogs → source code → tracked issues → community resources.
13
+
14
+ Method:
15
+ - Use query-focused extraction instead of generic summarization when the question is concrete.
16
+ - Prefer citation-first notes tied to exact source spans or chunks.
17
+ - If evidence is incomplete, label sufficiency as partial or insufficient rather than guessing.
18
+ - If a domain overlay exists in `.cx/domain-overlays/`, use it as bounded internal context but do not treat it as a permanent capability.
19
+
20
+ For each finding: source, date, confidence (confirmed / inferred / weak signal).
21
+
22
+ Output: FINDINGS (with citations) | INFERENCES (labeled) | GAPS | RECOMMENDATION
@@ -0,0 +1,23 @@
1
+ <!--
2
+ commands/understand/this.md — Explore and understand something — trace execution paths, map structure, gather evidence
3
+
4
+ Explore and understand something — trace execution paths, map structure, gather evidence
5
+ -->
6
+ ---
7
+ description: Explore and understand something — trace execution paths, map structure, gather evidence
8
+ ---
9
+
10
+ You are Construct. Explore and explain: $ARGUMENTS
11
+
12
+ Gather evidence — do not propose solutions unless asked.
13
+
14
+ 1. Search for the specific symbol, pattern, or behavior
15
+ 2. Trace the execution path from entry point to outcome
16
+ 3. Map relevant files, functions, and data structures
17
+ 4. Note what is absent: missing error handling, missing tests, surprising dependencies
18
+
19
+ Output:
20
+ - ENTRY POINTS: where the relevant behavior begins
21
+ - EXECUTION PATH: call chain from entry to the behavior
22
+ - KEY FILES: files that would need to change
23
+ - GAPS: missing tests, error handling, or surprising dependencies
@@ -0,0 +1,18 @@
1
+ <!--
2
+ commands/understand/why.md — Investigate a failure — why is this broken, what is the root cause
3
+
4
+ Investigate a failure — why is this broken, what is the root cause
5
+ -->
6
+ ---
7
+ description: Investigate a failure — why is this broken, what is the root cause
8
+ ---
9
+
10
+ You are Construct. Investigate: $ARGUMENTS
11
+
12
+ 1. Capture — exact error, stack trace, reproduction steps
13
+ 2. Reproduce — confirm you can trigger the failure consistently
14
+ 3. Isolate — narrow to the smallest failing case
15
+ 4. Trace — follow data and control flow to where the invariant breaks
16
+ 5. Root cause — the one upstream cause that, if fixed, prevents the failure
17
+
18
+ Do not plan a fix until root cause is confirmed. If you cannot reproduce, say so immediately and ask for more context.
@@ -0,0 +1,32 @@
1
+ <!--
2
+ commands/work/clean.md — Remove AI-generated code smells — verbosity, hedging, dead comments, generic names
3
+
4
+ Remove AI-generated code smells — verbosity, hedging, dead comments, generic names
5
+ -->
6
+ ---
7
+ description: Remove AI-generated code smells — verbosity, hedging, dead comments, generic names
8
+ ---
9
+
10
+ You are cx-reviewer identifying AI slop in: $ARGUMENTS
11
+
12
+ Then dispatch cx-engineer to apply the fixes.
13
+
14
+ ## What to remove
15
+
16
+ 1. **Obvious comments** — `// This function calculates X` when the function is named `calculateX`
17
+ 2. **Hedging names** — `result`, `data`, `temp`, `item`, `obj`, `value`, `response` — rename to reflect what they actually contain
18
+ 3. **Debug artifacts** — `console.log`, `print`, `debugger`, leftover logging statements
19
+ 4. **Unnecessary wrapping** — functions that do nothing except call one other function with no transformation
20
+ 5. **Dead TODO blocks** — `// TODO: remove later`, `// FIXME: clean this up`, stale commented-out code
21
+ 6. **Restated types** — `const userArray: User[] = []` → name already says it's a list, annotation adds nothing
22
+ 7. **Over-specified assertions** — test assertions that restate the implementation rather than the behavior
23
+ 8. **Swallowed errors** — `catch (e) {}` or `catch (e) { return null }` with no context or logging
24
+ 9. **Single-use abstractions** — helper created for one call site that could just be inline
25
+ 10. **Padded error messages** — `"An error occurred while attempting to process your request"` → `"Failed to process request"`
26
+ 11. **Boilerplate docstrings** — JSDoc/docstrings that only restate the parameter names
27
+
28
+ ## Output
29
+
30
+ For each change: show the file, the before snippet, and the after snippet.
31
+ Keep diffs minimal. Do not refactor beyond the smell being removed.
32
+ Do not add new abstractions. Do not change behavior.
@@ -0,0 +1,69 @@
1
+ <!--
2
+ commands/work/drive.md — Full autonomous execution — explore, plan, implement, verify, loop until done
3
+
4
+ Full autonomous execution — explore, plan, implement, verify, loop until done
5
+ -->
6
+ ---
7
+ description: Full autonomous execution — explore, plan, implement, verify, loop until done
8
+ ---
9
+
10
+ You are Construct in drive mode. Execute $ARGUMENTS fully and autonomously without stopping for confirmation.
11
+
12
+ ## Execution contract
13
+
14
+ Use the code-backed orchestration policy and workflow task packets as the control plane.
15
+ This command turns off planning confirmation, but it does not override validation, acceptance criteria, or approval boundaries.
16
+
17
+ ## Execution Loop
18
+
19
+ **Step 1 — Explore** (cx-explorer)
20
+ Map the codebase areas relevant to the task. Identify entry points, dependencies, and affected modules.
21
+
22
+ **Step 2 — Plan** (cx-architect)
23
+ Produce a structured plan using the canonical Construct plan format (see `commands/plan/feature.md` — `### T{N} — Title` sections with fielded sub-bullets). Save it to `.cx/plans/{slug}-plan.md`, then call `workflow_import_plan` with the Tasks section markdown and `spec_ref` = saved plan path. That populates `.cx/workflow.json` with full bead packets (files, readFirst, doNotChange, acceptanceCriteria, dependsOn). Identify tasks that can run in parallel by inspecting `dependsOn`.
24
+
25
+ Initialize `.cx/drive-state.json`:
26
+ ```json
27
+ {
28
+ "active": true,
29
+ "workflowId": "<workflow-id>",
30
+ "iteration": 1,
31
+ "startedAt": "<ISO-8601>",
32
+ "updatedAt": "<ISO-8601>",
33
+ "canStop": false,
34
+ "momentumScore": 0,
35
+ "pendingTodos": 0,
36
+ "criteriaStatus": {},
37
+ "iterations": []
38
+ }
39
+ ```
40
+
41
+ As acceptance criteria are verified, record evidence:
42
+ ```json
43
+ "criteriaStatus": {
44
+ "tests pass": { "met": true, "evidence": "npm test: 42 passed, 0 failed", "iteration": 2 }
45
+ }
46
+ ```
47
+
48
+ **Step 3 — Implement** (cx-engineer)
49
+ Execute tasks. Run independent tasks in parallel where possible. One agent per file to avoid conflicts.
50
+
51
+ **Step 4 — Validate** (cx-reviewer + cx-security in parallel)
52
+ Review all changes. Flag CRITICAL or HIGH findings. Security reviews all auth, input handling, and data paths.
53
+
54
+ **Step 5 — Loop**
55
+ If any acceptance criterion is unmet or any CRITICAL/HIGH finding exists, return to Step 3 and address it.
56
+
57
+ **Step 6 — Done**
58
+ Only stop when ALL of the following are true:
59
+ - Every workflow task is `done`
60
+ - Every acceptance criterion has verification evidence
61
+ - No CRITICAL or HIGH findings are open
62
+ - Tests pass
63
+
64
+ ## Rules
65
+
66
+ - Do not stop to ask for confirmation. If blocked by genuine ambiguity, surface the specific blocker and propose a resolution before stopping.
67
+ - Prefer parallel execution for independent tasks.
68
+ - Write verification evidence into each workflow task before marking it `done`.
69
+ - If context is running low, save state to `.cx/workflow.json` and summarize the handoff point.
@@ -0,0 +1,46 @@
1
+ <!--
2
+ commands/work/optimize-prompts.md — Prompt optimization command.
3
+
4
+ Runs the closed-loop prompt optimization workflow using Langfuse trace data.
5
+ -->
6
+ ---
7
+ description: Closed-loop prompt optimization — read Langfuse traces, diagnose failures, push improved version to staging
8
+ ---
9
+
10
+ You are cx-trace-reviewer running a prompt optimization cycle for: $ARGUMENTS
11
+
12
+ If $ARGUMENTS is empty, optimize all agents with median quality score below 0.65 in the past 7 days.
13
+ If $ARGUMENTS names a specific agent (e.g. "cx-engineer"), optimize only that agent.
14
+
15
+ Follow `skills/ai/prompt-optimizer.md` exactly.
16
+
17
+ Optimize prompt fragments and overlays, not the runtime orchestration policy. If a failure is caused by routing or approval logic, move it into code instead of adding more prompt text.
18
+
19
+ ## Required steps
20
+
21
+ 1. **Read current prompt** — read the agent's prompt from `agents/registry.json` (or its `promptFile`)
22
+ 2. **Fetch recent scores** — GET `{LANGFUSE_BASEURL}/api/public/scores?name=quality&limit=200`
23
+ 3. **Skip agents with fewer than 20 scored traces** — insufficient signal; note them but do not optimize
24
+ 4. **Diagnose failure patterns** — analyze low-scoring traces, identify top 3 recurring patterns
25
+ 5. **Generate improved prompt** — targeted edits that address failures without breaking high-scoring behaviors
26
+ 6. **Push to staging** — update the prompt in a staging marker comment; log the candidate via `cx_trace` with `promptVersion: staging-{timestamp}`
27
+ 7. **Report** — for each agent: before/after median score estimate, patterns addressed, staging version note
28
+
29
+ ## Output
30
+
31
+ ```
32
+ AGENT: cx-engineer
33
+ Status: OPTIMIZED
34
+ Previous median: 0.61 (n=47 traces)
35
+ Patterns addressed: missing file references, output verbosity, hallucination in tool-less responses
36
+ Staging: logged as cx_trace with promptVersion: staging-2026-04-18
37
+ Next: monitor 20+ traces then compare. Run /work:optimize-prompts cx-engineer --promote when ready.
38
+
39
+ AGENT: cx-reviewer
40
+ Status: SKIPPED (insufficient traces: 12 < 20)
41
+
42
+ AGENT: cx-debugger
43
+ Status: NO ACTION (median 0.82 — above threshold)
44
+ ```
45
+
46
+ Do not promote to production automatically. Promotion requires the monitoring step in the skill.