create-hq 5.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 (310) hide show
  1. package/dist/deps.d.ts +4 -0
  2. package/dist/deps.d.ts.map +1 -0
  3. package/dist/deps.js +65 -0
  4. package/dist/deps.js.map +1 -0
  5. package/dist/git.d.ts +3 -0
  6. package/dist/git.d.ts.map +1 -0
  7. package/dist/git.js +19 -0
  8. package/dist/git.js.map +1 -0
  9. package/dist/index.d.ts +3 -0
  10. package/dist/index.d.ts.map +1 -0
  11. package/dist/index.js +23 -0
  12. package/dist/index.js.map +1 -0
  13. package/dist/scaffold.d.ts +8 -0
  14. package/dist/scaffold.d.ts.map +1 -0
  15. package/dist/scaffold.js +130 -0
  16. package/dist/scaffold.js.map +1 -0
  17. package/dist/ui.d.ts +7 -0
  18. package/dist/ui.d.ts.map +1 -0
  19. package/dist/ui.js +36 -0
  20. package/dist/ui.js.map +1 -0
  21. package/package.json +41 -0
  22. package/template/.claude/CLAUDE.md +202 -0
  23. package/template/.claude/commands/checkpoint.md +127 -0
  24. package/template/.claude/commands/cleanup.md +307 -0
  25. package/template/.claude/commands/execute-task.md +440 -0
  26. package/template/.claude/commands/exit-plan.md +41 -0
  27. package/template/.claude/commands/handoff.md +97 -0
  28. package/template/.claude/commands/learn.md +218 -0
  29. package/template/.claude/commands/metrics.md +118 -0
  30. package/template/.claude/commands/newworker.md +162 -0
  31. package/template/.claude/commands/nexttask.md +67 -0
  32. package/template/.claude/commands/prd.md +238 -0
  33. package/template/.claude/commands/reanchor.md +51 -0
  34. package/template/.claude/commands/remember.md +126 -0
  35. package/template/.claude/commands/run-project.md +348 -0
  36. package/template/.claude/commands/run.md +110 -0
  37. package/template/.claude/commands/search-reindex.md +62 -0
  38. package/template/.claude/commands/search.md +100 -0
  39. package/template/.claude/commands/setup.md +381 -0
  40. package/template/.claude/scripts/pure-ralph-loop.ps1 +312 -0
  41. package/template/.claude/scripts/pure-ralph-loop.sh +859 -0
  42. package/template/CHANGELOG.md +220 -0
  43. package/template/LICENSE +21 -0
  44. package/template/MIGRATION.md +259 -0
  45. package/template/README.md +368 -0
  46. package/template/data/journal/.gitkeep +0 -0
  47. package/template/docs/images/ascii-banner-options.md +122 -0
  48. package/template/docs/images/hq-banner.svg +105 -0
  49. package/template/knowledge/Ralph/01-overview.md +71 -0
  50. package/template/knowledge/Ralph/02-core-concepts.md +114 -0
  51. package/template/knowledge/Ralph/03-how-ralph-works.md +184 -0
  52. package/template/knowledge/Ralph/04-back-pressure.md +222 -0
  53. package/template/knowledge/Ralph/05-specifications.md +210 -0
  54. package/template/knowledge/Ralph/06-agents-md.md +222 -0
  55. package/template/knowledge/Ralph/07-implementation.md +316 -0
  56. package/template/knowledge/Ralph/08-economics.md +182 -0
  57. package/template/knowledge/Ralph/09-resources.md +145 -0
  58. package/template/knowledge/Ralph/10-claude-code-workflow.md +212 -0
  59. package/template/knowledge/Ralph/11-team-training-guide.md +383 -0
  60. package/template/knowledge/Ralph/README.md +40 -0
  61. package/template/knowledge/ai-security-framework/CONTRIBUTING.md +139 -0
  62. package/template/knowledge/ai-security-framework/GLOSSARY.md +176 -0
  63. package/template/knowledge/ai-security-framework/LICENSE +21 -0
  64. package/template/knowledge/ai-security-framework/QUICK-START.md +172 -0
  65. package/template/knowledge/ai-security-framework/README.md +232 -0
  66. package/template/knowledge/ai-security-framework/checklists/browser-security.md +301 -0
  67. package/template/knowledge/ai-security-framework/checklists/credential-isolation.md +322 -0
  68. package/template/knowledge/ai-security-framework/checklists/incident-response.md +288 -0
  69. package/template/knowledge/ai-security-framework/checklists/pre-flight.md +249 -0
  70. package/template/knowledge/ai-security-framework/checklists/weekly-audit.md +159 -0
  71. package/template/knowledge/ai-security-framework/configs/audit-logging.md +372 -0
  72. package/template/knowledge/ai-security-framework/configs/kill-switches.md +354 -0
  73. package/template/knowledge/ai-security-framework/docs/01-core-principles.md +256 -0
  74. package/template/knowledge/ai-security-framework/docs/02-threat-landscape.md +326 -0
  75. package/template/knowledge/ai-security-framework/docs/03-security-posture.md +250 -0
  76. package/template/knowledge/ai-security-framework/templates/agents-security.md +233 -0
  77. package/template/knowledge/design-styles/README.md +42 -0
  78. package/template/knowledge/design-styles/american-industrial.md +136 -0
  79. package/template/knowledge/design-styles/ethereal-abstract.md +133 -0
  80. package/template/knowledge/design-styles/liminal-portal.md +111 -0
  81. package/template/knowledge/design-styles/swipes/american-industrial/G-3m4YPW0AADdu2.jpeg +0 -0
  82. package/template/knowledge/design-styles/swipes/american-industrial/G-JJlt5WwAABK3K.png +0 -0
  83. package/template/knowledge/design-styles/swipes/american-industrial/G-JJmj5W0AEbJ-7.png +0 -0
  84. package/template/knowledge/design-styles/swipes/american-industrial/G59fgNuXkAAKLJQ (1).jpeg +0 -0
  85. package/template/knowledge/design-styles/swipes/american-industrial/G59fgNuXkAAKLJQ.jpeg +0 -0
  86. package/template/knowledge/design-styles/swipes/american-industrial/G7fVkn3WEAAM-ST.jpeg +0 -0
  87. package/template/knowledge/design-styles/swipes/american-industrial/G8ECO5JWEAIksyn.png +0 -0
  88. package/template/knowledge/design-styles/swipes/american-industrial/G9-3GQSWoAA8eqZ.png +0 -0
  89. package/template/knowledge/design-styles/swipes/american-industrial/G9xEOqrXkAEZRcs.png +0 -0
  90. package/template/knowledge/design-styles/swipes/american-industrial/G_MVeJrXQAA8sx4.jpeg +0 -0
  91. package/template/knowledge/design-styles/swipes/american-industrial/G_RSkmGXkAAgAVZ.png +0 -0
  92. package/template/knowledge/design-styles/swipes/american-industrial/README.md +31 -0
  93. package/template/knowledge/design-styles/swipes/american-industrial/qyqtg7Dq.png +0 -0
  94. package/template/knowledge/dev-team/README.md +35 -0
  95. package/template/knowledge/dev-team/patterns/README.md +34 -0
  96. package/template/knowledge/dev-team/patterns/frontend/react-best-practices.md +178 -0
  97. package/template/knowledge/dev-team/troubleshooting/README.md +31 -0
  98. package/template/knowledge/dev-team/workflows/README.md +49 -0
  99. package/template/knowledge/hq/checkpoint-schema.json +51 -0
  100. package/template/knowledge/hq/index-md-spec.md +74 -0
  101. package/template/knowledge/hq/thread-schema.md +153 -0
  102. package/template/knowledge/hq-core/checkpoint-schema.json +51 -0
  103. package/template/knowledge/hq-core/index-md-spec.md +74 -0
  104. package/template/knowledge/hq-core/thread-schema.md +153 -0
  105. package/template/knowledge/loom/README.md +51 -0
  106. package/template/knowledge/loom/architecture.md +125 -0
  107. package/template/knowledge/loom/code-style.md +169 -0
  108. package/template/knowledge/loom/llm-proxy.md +132 -0
  109. package/template/knowledge/loom/state-machine.md +131 -0
  110. package/template/knowledge/loom/thread-system.md +117 -0
  111. package/template/knowledge/loom/tools.md +94 -0
  112. package/template/knowledge/loom/weaver.md +96 -0
  113. package/template/knowledge/loom/web-frontend.md +131 -0
  114. package/template/knowledge/projects/README.md +72 -0
  115. package/template/knowledge/projects/templates/README.template.md +28 -0
  116. package/template/knowledge/workers/README.md +195 -0
  117. package/template/knowledge/workers/ralph-loop-pattern.md +157 -0
  118. package/template/knowledge/workers/skill-schema.md +182 -0
  119. package/template/knowledge/workers/state-machine.md +102 -0
  120. package/template/knowledge/workers/templates/base-worker.yaml +73 -0
  121. package/template/knowledge/workers/templates/code-worker.yaml +85 -0
  122. package/template/knowledge/workers/templates/skill.yaml +49 -0
  123. package/template/knowledge/workers/templates/social-worker.yaml +70 -0
  124. package/template/modules/examples/full-manifest.yaml +92 -0
  125. package/template/modules/examples/minimal.yaml +14 -0
  126. package/template/modules/modules.yaml +59 -0
  127. package/template/projects/.gitkeep +0 -0
  128. package/template/projects/incorporate-workers-into-pure-ralph/prd.json +88 -0
  129. package/template/projects/pure-ralph-branch-isolation/README.md +114 -0
  130. package/template/projects/pure-ralph-branch-isolation/prd.json +123 -0
  131. package/template/projects/purist-ralph-loop/README.md +148 -0
  132. package/template/projects/purist-ralph-loop/prd.json +135 -0
  133. package/template/projects/ralph-test/prd.json +50 -0
  134. package/template/prompts/pure-ralph-base.md +551 -0
  135. package/template/settings/.gitkeep +0 -0
  136. package/template/settings/pure-ralph.json +42 -0
  137. package/template/social-content/drafts/INDEX.md +21 -0
  138. package/template/social-content/drafts/linkedin/.gitkeep +1 -0
  139. package/template/social-content/drafts/x/.gitkeep +1 -0
  140. package/template/social-content/images/.gitkeep +1 -0
  141. package/template/starter-projects/code-worker/README.md +97 -0
  142. package/template/starter-projects/code-worker/prd.json +45 -0
  143. package/template/starter-projects/personal-assistant/README.md +42 -0
  144. package/template/starter-projects/personal-assistant/prd.json +43 -0
  145. package/template/starter-projects/social-media/README.md +60 -0
  146. package/template/starter-projects/social-media/prd.json +43 -0
  147. package/template/workers/content-brand/README.md +59 -0
  148. package/template/workers/content-brand/skills/messaging-alignment.md +91 -0
  149. package/template/workers/content-brand/skills/tone-check.md +76 -0
  150. package/template/workers/content-brand/skills/voice-analysis.md +68 -0
  151. package/template/workers/content-brand/worker.yaml +81 -0
  152. package/template/workers/content-legal/README.md +80 -0
  153. package/template/workers/content-legal/skills/claim-substantiation.md +150 -0
  154. package/template/workers/content-legal/skills/compliance-scan.md +123 -0
  155. package/template/workers/content-legal/skills/disclaimer-check.md +146 -0
  156. package/template/workers/content-legal/worker.yaml +118 -0
  157. package/template/workers/content-product/README.md +77 -0
  158. package/template/workers/content-product/skills/claim-verification.md +96 -0
  159. package/template/workers/content-product/skills/feature-accuracy.md +117 -0
  160. package/template/workers/content-product/skills/stats-check.md +128 -0
  161. package/template/workers/content-product/worker.yaml +97 -0
  162. package/template/workers/content-sales/README.md +70 -0
  163. package/template/workers/content-sales/skills/conversion-analysis.md +96 -0
  164. package/template/workers/content-sales/skills/cta-audit.md +107 -0
  165. package/template/workers/content-sales/skills/value-prop-check.md +114 -0
  166. package/template/workers/content-sales/worker.yaml +93 -0
  167. package/template/workers/content-shared/cli.ts +242 -0
  168. package/template/workers/content-shared/index.ts +234 -0
  169. package/template/workers/content-shared/lib/accuracy-analyzer.ts +661 -0
  170. package/template/workers/content-shared/lib/analyze.ts +370 -0
  171. package/template/workers/content-shared/lib/brand-analyzer.ts +526 -0
  172. package/template/workers/content-shared/lib/cms-integration.ts +446 -0
  173. package/template/workers/content-shared/lib/compliance-analyzer.ts +655 -0
  174. package/template/workers/content-shared/lib/conversion-analyzer.ts +555 -0
  175. package/template/workers/content-shared/lib/github-integration.ts +582 -0
  176. package/template/workers/content-shared/lib/output.ts +373 -0
  177. package/template/workers/content-shared/lib/parser.ts +771 -0
  178. package/template/workers/content-shared/lib/priority.ts +439 -0
  179. package/template/workers/content-shared/lib/recommendations.ts +512 -0
  180. package/template/workers/content-shared/lib/reporter.ts +749 -0
  181. package/template/workers/content-shared/lib/restructure.ts +664 -0
  182. package/template/workers/content-shared/lib/scorer.ts +140 -0
  183. package/template/workers/content-shared/lib/types.ts +227 -0
  184. package/template/workers/content-shared/lib/variants.ts +595 -0
  185. package/template/workers/content-shared/package.json +51 -0
  186. package/template/workers/content-shared/pnpm-lock.yaml +39 -0
  187. package/template/workers/content-shared/test/sample-page.json +115 -0
  188. package/template/workers/content-shared/tsconfig.json +20 -0
  189. package/template/workers/dev-team/README.md +166 -0
  190. package/template/workers/dev-team/_template.yaml +70 -0
  191. package/template/workers/dev-team/architect/package.json +27 -0
  192. package/template/workers/dev-team/architect/skills/api-design.md +89 -0
  193. package/template/workers/dev-team/architect/skills/refactor-plan.md +96 -0
  194. package/template/workers/dev-team/architect/skills/system-design.md +100 -0
  195. package/template/workers/dev-team/architect/src/index.ts +49 -0
  196. package/template/workers/dev-team/architect/src/mcp-server.ts +122 -0
  197. package/template/workers/dev-team/architect/src/skills/api-design.ts +316 -0
  198. package/template/workers/dev-team/architect/src/skills/refactor-plan.ts +264 -0
  199. package/template/workers/dev-team/architect/src/skills/system-design.ts +212 -0
  200. package/template/workers/dev-team/architect/tsconfig.json +19 -0
  201. package/template/workers/dev-team/architect/worker.yaml +128 -0
  202. package/template/workers/dev-team/backend-dev/package-lock.json +1252 -0
  203. package/template/workers/dev-team/backend-dev/package.json +27 -0
  204. package/template/workers/dev-team/backend-dev/skills/implement-endpoint.md +70 -0
  205. package/template/workers/dev-team/backend-dev/skills/implement-service.md +62 -0
  206. package/template/workers/dev-team/backend-dev/src/index.ts +51 -0
  207. package/template/workers/dev-team/backend-dev/src/mcp-server.ts +109 -0
  208. package/template/workers/dev-team/backend-dev/src/skills/implement-endpoint.ts +122 -0
  209. package/template/workers/dev-team/backend-dev/src/skills/implement-service.ts +126 -0
  210. package/template/workers/dev-team/backend-dev/tsconfig.json +19 -0
  211. package/template/workers/dev-team/backend-dev/worker.yaml +128 -0
  212. package/template/workers/dev-team/code-reviewer/package-lock.json +1080 -0
  213. package/template/workers/dev-team/code-reviewer/package.json +24 -0
  214. package/template/workers/dev-team/code-reviewer/skills/merge-to-production.md +61 -0
  215. package/template/workers/dev-team/code-reviewer/skills/merge-to-staging.md +54 -0
  216. package/template/workers/dev-team/code-reviewer/skills/request-changes.md +63 -0
  217. package/template/workers/dev-team/code-reviewer/skills/review-pr.md +77 -0
  218. package/template/workers/dev-team/code-reviewer/src/index.ts +56 -0
  219. package/template/workers/dev-team/code-reviewer/src/mcp-server.ts +101 -0
  220. package/template/workers/dev-team/code-reviewer/tsconfig.json +19 -0
  221. package/template/workers/dev-team/code-reviewer/worker.yaml +90 -0
  222. package/template/workers/dev-team/database-dev/package.json +22 -0
  223. package/template/workers/dev-team/database-dev/skills/create-schema.md +48 -0
  224. package/template/workers/dev-team/database-dev/src/index.ts +50 -0
  225. package/template/workers/dev-team/database-dev/src/mcp-server.ts +76 -0
  226. package/template/workers/dev-team/database-dev/tsconfig.json +18 -0
  227. package/template/workers/dev-team/database-dev/worker.yaml +90 -0
  228. package/template/workers/dev-team/frontend-dev/package.json +22 -0
  229. package/template/workers/dev-team/frontend-dev/skills/create-component.md +26 -0
  230. package/template/workers/dev-team/frontend-dev/src/index.ts +50 -0
  231. package/template/workers/dev-team/frontend-dev/src/mcp-server.ts +77 -0
  232. package/template/workers/dev-team/frontend-dev/tsconfig.json +18 -0
  233. package/template/workers/dev-team/frontend-dev/worker.yaml +132 -0
  234. package/template/workers/dev-team/infra-dev/package.json +24 -0
  235. package/template/workers/dev-team/infra-dev/skills/add-monitoring.md +73 -0
  236. package/template/workers/dev-team/infra-dev/skills/configure-deployment.md +80 -0
  237. package/template/workers/dev-team/infra-dev/skills/create-dockerfile.md +62 -0
  238. package/template/workers/dev-team/infra-dev/skills/setup-cicd.md +63 -0
  239. package/template/workers/dev-team/infra-dev/src/index.ts +55 -0
  240. package/template/workers/dev-team/infra-dev/src/mcp-server.ts +82 -0
  241. package/template/workers/dev-team/infra-dev/tsconfig.json +19 -0
  242. package/template/workers/dev-team/infra-dev/worker.yaml +92 -0
  243. package/template/workers/dev-team/knowledge-curator/package.json +24 -0
  244. package/template/workers/dev-team/knowledge-curator/skills/curate-troubleshooting.md +63 -0
  245. package/template/workers/dev-team/knowledge-curator/skills/process-learnings.md +61 -0
  246. package/template/workers/dev-team/knowledge-curator/skills/sync-documentation.md +76 -0
  247. package/template/workers/dev-team/knowledge-curator/skills/update-patterns.md +63 -0
  248. package/template/workers/dev-team/knowledge-curator/src/index.ts +53 -0
  249. package/template/workers/dev-team/knowledge-curator/src/mcp-server.ts +92 -0
  250. package/template/workers/dev-team/knowledge-curator/tsconfig.json +19 -0
  251. package/template/workers/dev-team/knowledge-curator/worker.yaml +80 -0
  252. package/template/workers/dev-team/motion-designer/package.json +22 -0
  253. package/template/workers/dev-team/motion-designer/skills/add-animation.md +25 -0
  254. package/template/workers/dev-team/motion-designer/skills/generate-image.md +36 -0
  255. package/template/workers/dev-team/motion-designer/src/index.ts +63 -0
  256. package/template/workers/dev-team/motion-designer/src/mcp-server.ts +79 -0
  257. package/template/workers/dev-team/motion-designer/tsconfig.json +18 -0
  258. package/template/workers/dev-team/motion-designer/worker.yaml +84 -0
  259. package/template/workers/dev-team/product-planner/queue.json +4 -0
  260. package/template/workers/dev-team/product-planner/worker.yaml +220 -0
  261. package/template/workers/dev-team/project-manager/package-lock.json +1252 -0
  262. package/template/workers/dev-team/project-manager/package.json +27 -0
  263. package/template/workers/dev-team/project-manager/skills/create-prd.md +66 -0
  264. package/template/workers/dev-team/project-manager/skills/next-issue.md +51 -0
  265. package/template/workers/dev-team/project-manager/skills/project-status.md +59 -0
  266. package/template/workers/dev-team/project-manager/skills/update-learnings.md +65 -0
  267. package/template/workers/dev-team/project-manager/src/index.ts +54 -0
  268. package/template/workers/dev-team/project-manager/src/mcp-server.ts +207 -0
  269. package/template/workers/dev-team/project-manager/src/skills/create-prd.ts +86 -0
  270. package/template/workers/dev-team/project-manager/src/skills/next-issue.ts +137 -0
  271. package/template/workers/dev-team/project-manager/src/skills/project-status.ts +131 -0
  272. package/template/workers/dev-team/project-manager/src/skills/update-learnings.ts +94 -0
  273. package/template/workers/dev-team/project-manager/tsconfig.json +19 -0
  274. package/template/workers/dev-team/project-manager/worker.yaml +96 -0
  275. package/template/workers/dev-team/qa-tester/package.json +24 -0
  276. package/template/workers/dev-team/qa-tester/skills/create-demo-account.md +36 -0
  277. package/template/workers/dev-team/qa-tester/skills/run-tests.md +36 -0
  278. package/template/workers/dev-team/qa-tester/skills/write-test.md +27 -0
  279. package/template/workers/dev-team/qa-tester/src/index.ts +61 -0
  280. package/template/workers/dev-team/qa-tester/src/mcp-server.ts +88 -0
  281. package/template/workers/dev-team/qa-tester/tsconfig.json +18 -0
  282. package/template/workers/dev-team/qa-tester/worker.yaml +116 -0
  283. package/template/workers/dev-team/task-executor/package-lock.json +1252 -0
  284. package/template/workers/dev-team/task-executor/package.json +27 -0
  285. package/template/workers/dev-team/task-executor/skills/analyze-issue.md +101 -0
  286. package/template/workers/dev-team/task-executor/skills/execute.md +133 -0
  287. package/template/workers/dev-team/task-executor/skills/report-learnings.md +106 -0
  288. package/template/workers/dev-team/task-executor/skills/validate-completion.md +121 -0
  289. package/template/workers/dev-team/task-executor/src/index.ts +54 -0
  290. package/template/workers/dev-team/task-executor/src/mcp-server.ts +139 -0
  291. package/template/workers/dev-team/task-executor/src/skills/analyze-issue.ts +219 -0
  292. package/template/workers/dev-team/task-executor/src/skills/execute.ts +132 -0
  293. package/template/workers/dev-team/task-executor/src/skills/report-learnings.ts +119 -0
  294. package/template/workers/dev-team/task-executor/src/skills/validate-completion.ts +142 -0
  295. package/template/workers/dev-team/task-executor/tsconfig.json +19 -0
  296. package/template/workers/dev-team/task-executor/worker.yaml +110 -0
  297. package/template/workers/registry.yaml +171 -0
  298. package/template/workers/security-scanner/README.md +73 -0
  299. package/template/workers/security-scanner/skills/pre-deploy-check.md +205 -0
  300. package/template/workers/security-scanner/worker.yaml +26 -0
  301. package/template/workspace/checkpoints/.gitkeep +0 -0
  302. package/template/workspace/content-ideas/inbox.jsonl +0 -0
  303. package/template/workspace/drafts/.gitkeep +0 -0
  304. package/template/workspace/learnings/.gitkeep +3 -0
  305. package/template/workspace/orchestrator/.gitkeep +0 -0
  306. package/template/workspace/ralph-test/COMPLETE.md +18 -0
  307. package/template/workspace/ralph-test/hello.txt +2 -0
  308. package/template/workspace/reports/.gitkeep +0 -0
  309. package/template/workspace/scratch/.gitkeep +0 -0
  310. package/template/workspace/threads/.gitkeep +3 -0
@@ -0,0 +1,348 @@
1
+ ---
2
+ description: Run a project through the Ralph loop - orchestrator for multi-task execution
3
+ allowed-tools: Task, Read, Write, Glob, Grep, Bash, AskUserQuestion
4
+ argument-hint: [project-name] or [--resume project] or [--status]
5
+ visibility: public
6
+ ---
7
+
8
+ # /run-project - Project Orchestrator Loop
9
+
10
+ Ralph loop with fresh context per task. The orchestrator is an ultra-lean state machine — it delegates each task entirely to a sub-agent via `/execute-task`, receiving only a structured summary back. Each task gets clean context; nothing accumulates.
11
+
12
+ **Arguments:** $ARGUMENTS
13
+
14
+ ## Core Pattern (Ralph Fresh-Context)
15
+
16
+ The orchestrator is an **ultra-lean state machine**. It picks tasks and delegates each one entirely to a sub-agent via `/execute-task`. The orchestrator:
17
+ - Selects the next incomplete task from the PRD
18
+ - Spawns ONE sub-agent per task (fresh context per task)
19
+ - Receives only a structured JSON summary back
20
+ - Updates state.json and progress.txt
21
+ - Never accumulates worker outputs, handoff blobs, or implementation details
22
+
23
+ Classification, worker selection, worker pipelines, PRD updates, and learning capture all happen inside the sub-agent. This mirrors Pure Ralph's fresh-terminal-per-task model.
24
+
25
+ ## Usage
26
+
27
+ ```bash
28
+ /run-project campaign-migration # Start new
29
+ /run-project --resume campaign-migration # Resume paused
30
+ /run-project --status # Check all projects
31
+ ```
32
+
33
+ ## Process
34
+
35
+ ### 1. Parse Arguments
36
+
37
+ **If `--status`:**
38
+ - Scan `workspace/orchestrator/*/state.json`
39
+ - Display all project statuses
40
+ - Exit
41
+
42
+ **If `--resume {project}` (first-class operation — not a fallback):**
43
+ - Load state from `workspace/orchestrator/{project}/state.json`
44
+ - Read PRD to find next incomplete task
45
+ - Continue from next incomplete + unblocked task
46
+ - The orchestrator starts with ZERO accumulated context — only state.json + PRD
47
+ - If a task was mid-pipeline (has execution state with incomplete phases), `/execute-task` will resume from the incomplete phase inside its sub-agent
48
+
49
+ **If `{project}`:**
50
+ - Check `projects/{project}/prd.json` exists
51
+ - If prd.json **MISSING**: STOP immediately. Do not fall back to README.md.
52
+ ```
53
+ ERROR: projects/{project}/prd.json not found.
54
+
55
+ /run-project requires prd.json (not README.md).
56
+ Fix: Run /prd {project} to generate prd.json.
57
+ ```
58
+ - If prd.json **EXISTS**: validate structure (see Step 2)
59
+ - Check if state.json exists (offer resume or restart)
60
+ - Initialize fresh state if new
61
+
62
+ ### 2. Load Project
63
+
64
+ Read and validate `projects/{project}/prd.json`:
65
+ ```javascript
66
+ const prd = JSON.parse(read(`projects/${project}/prd.json`))
67
+
68
+ // Strict: userStories required. No fallback.
69
+ const stories = prd.userStories
70
+ if (!stories || !Array.isArray(stories) || stories.length === 0) {
71
+ STOP: "prd.json has no userStories array (or it's empty). Migrate legacy 'features' key to 'userStories'."
72
+ }
73
+
74
+ // Validate each story has required fields
75
+ for (const story of stories) {
76
+ const required = ['id', 'title', 'description', 'passes']
77
+ const missing = required.filter(f => !(f in story))
78
+ if (missing.length > 0) {
79
+ STOP: `Story ${story.id || '?'} missing fields: ${missing.join(', ')}`
80
+ }
81
+ }
82
+
83
+ const total = stories.length
84
+ const completed = stories.filter(s => s.passes).length
85
+ const remaining = stories.filter(s => !s.passes)
86
+ ```
87
+
88
+ ### 3. Display Status
89
+
90
+ ```
91
+ Project: {project}
92
+ Progress: {completed}/{total} ({percentage}%)
93
+
94
+ Remaining:
95
+ 1. {id}: {title} (next)
96
+ 2. {id}: {title}
97
+
98
+ Continue? [Y/n]
99
+ ```
100
+
101
+ ### 4. Initialize/Load State
102
+
103
+ ```bash
104
+ mkdir -p workspace/orchestrator/{project}/executions
105
+ ```
106
+
107
+ Write `workspace/orchestrator/{project}/state.json`:
108
+ ```json
109
+ {
110
+ "project": "{project}",
111
+ "prd_path": "projects/{project}/prd.json",
112
+ "status": "in_progress",
113
+ "started_at": "{ISO8601}",
114
+ "updated_at": "{ISO8601}",
115
+ "progress": { "total": 0, "completed": 0, "failed": 0, "in_progress": 0 },
116
+ "current_task": null,
117
+ "completed_tasks": [],
118
+ "retries": 0
119
+ }
120
+ ```
121
+
122
+ ### 5. The Loop
123
+
124
+ The orchestrator is an **ultra-lean state machine**. It picks tasks and delegates everything to sub-agents. Classification, worker selection, worker pipelines, PRD updates, and learning capture all happen inside the sub-agent via `/execute-task`. The orchestrator NEVER accumulates implementation context.
125
+
126
+ ```
127
+ while (remaining tasks with passes: false):
128
+
129
+ 5a. SELECT next task
130
+ - Priority order from PRD
131
+ - Respect dependsOn (skip if deps incomplete)
132
+ - First incomplete + unblocked task
133
+
134
+ Report:
135
+ ```
136
+ Next: {task.id} - {task.title}
137
+ Progress: {completed}/{total}
138
+ ```
139
+
140
+ 5b. EXECUTE task via sub-agent
141
+
142
+ Spawn a SINGLE sub-agent for the entire task.
143
+ The sub-agent handles classification, worker selection,
144
+ the full worker pipeline, PRD update, execution state,
145
+ and learning capture — all via /execute-task.
146
+
147
+ Task({
148
+ subagent_type: "general-purpose",
149
+ description: "Execute {task.id}: {task.title}",
150
+ prompt: "Run /execute-task {project}/{task.id}
151
+
152
+ After completion, output ONLY this structured JSON:
153
+ {
154
+ \"task_id\": \"{task.id}\",
155
+ \"status\": \"completed|failed|blocked\",
156
+ \"summary\": \"1-sentence summary\",
157
+ \"workers_used\": [\"list\"],
158
+ \"back_pressure\": {
159
+ \"tests\": \"pass|fail|skipped\",
160
+ \"lint\": \"pass|fail|skipped\",
161
+ \"typecheck\": \"pass|fail|skipped\",
162
+ \"build\": \"pass|fail|skipped\"
163
+ }
164
+ }"
165
+ })
166
+
167
+ The sub-agent's full context (worker outputs, handoff blobs,
168
+ file diffs, error traces) is freed when it returns.
169
+ Only the structured JSON crosses the boundary.
170
+
171
+ 5c. POST-TASK (orchestrator side — minimal)
172
+
173
+ Parse the sub-agent's JSON output.
174
+
175
+ i. If status == "completed":
176
+ - Update state.json:
177
+ completed_tasks.push({id, completed_at, workers_used})
178
+ progress.completed++
179
+ current_task = null
180
+ - Log 1-line to progress.txt:
181
+ [{timestamp}] {task.id}: {summary} ({completed}/{total})
182
+
183
+ ii. If status == "failed" or "blocked":
184
+ - Log error
185
+ - AskUserQuestion:
186
+ 1. Retry this task
187
+ 2. Skip and continue
188
+ 3. Pause project (run /run-project --resume {project})
189
+
190
+ iv. Update `workspace/orchestrator/INDEX.md` with new progress.
191
+
192
+ v. DISCARD everything else.
193
+ The orchestrator MUST NOT store worker outputs,
194
+ handoff blobs, file lists, or error traces.
195
+ Only retain: task_id, status, 1-sentence summary.
196
+
197
+ 5c.5 AUTO-REANCHOR (between tasks, silent)
198
+
199
+ After processing each task result, refresh context:
200
+ 1. Re-read PRD from disk (sub-agent may have updated passes/notes)
201
+ 2. Refresh git state: `git log --oneline -3`
202
+ 3. If task failed: search for known fixes via `qmd vsearch "{error}" --json -n 5`
203
+ (searches across all knowledge, worker yamls, and command files)
204
+ 4. Re-read CLAUDE.md `## Learned Rules`
205
+ (another session may have added rules via /learn)
206
+
207
+ This is silent — no user interaction. Prevents stale context
208
+ between tasks, especially for multi-session projects.
209
+
210
+ 5d. CONTEXT SAFETY NET
211
+
212
+ If > 10 tasks completed this session OR context heavy:
213
+ - Save state.json
214
+ - Print: "Context boundary reached. Run: /run-project --resume {project}"
215
+ - STOP
216
+
217
+ This rarely triggers because each task sub-agent releases
218
+ its context. But it provides a hard ceiling.
219
+ ```
220
+
221
+ ### 6. Handle Task Failure
222
+
223
+ If any worker phase fails after retry:
224
+
225
+ ```
226
+ Phase {N} ({worker}) failed for {task.id}
227
+
228
+ Error: {details}
229
+ Attempts: {count}
230
+
231
+ Options:
232
+ 1. Retry this worker phase
233
+ 2. Skip worker, continue pipeline
234
+ 3. Pause project (/run-project --resume {project})
235
+ 4. Abort
236
+ ```
237
+
238
+ Use AskUserQuestion.
239
+
240
+ ### 7. Complete Project
241
+
242
+ When all stories have `passes: true`:
243
+
244
+ **Generate report:**
245
+ ```
246
+ Project Complete: {project}
247
+
248
+ Tasks: {completed}/{total}
249
+ Workers Used: {worker}: {N} tasks, ...
250
+ Learnings: {count}
251
+ ```
252
+
253
+ **Aggregate learnings:**
254
+ 1. Scan Tier 3 logs: `workspace/learnings/learn-*.json` matching this project
255
+ 2. Identify repeated patterns (same rule triggered 3+ times across tasks)
256
+ 3. Promote repeated patterns to Tier 1 via `/learn` (severity: high, source: pattern-repetition)
257
+ 4. Write project retrospective to `workspace/reports/{project}-retro.md`
258
+
259
+ **Update state:** `status: "completed"`, `completed_at: "{ISO8601}"`
260
+
261
+ **Update INDEX.md files:** Regenerate `projects/INDEX.md` and `workspace/orchestrator/INDEX.md` per `knowledge/public/hq-core/index-md-spec.md`.
262
+
263
+ ### 8. Status Display (--status)
264
+
265
+ ```
266
+ Project Status
267
+
268
+ ACTIVE:
269
+ campaign-migration — 5/11 (45%) — backend-dev phase on CAM-006
270
+
271
+ PAUSED:
272
+ (none)
273
+
274
+ COMPLETED:
275
+ user-auth (3d ago) — 8/8
276
+ ```
277
+
278
+ ## Worker Pipeline Reference
279
+
280
+ | Task Type | Worker Sequence |
281
+ |-----------|----------------|
282
+ | schema_change | database-dev → backend-dev → code-reviewer → dev-qa-tester |
283
+ | api_development | backend-dev → code-reviewer → dev-qa-tester |
284
+ | ui_component | frontend-dev → motion-designer → code-reviewer → dev-qa-tester |
285
+ | full_stack | architect → database-dev → backend-dev → frontend-dev → code-reviewer → dev-qa-tester |
286
+ | content | content-brand → content-product → content-sales → content-legal |
287
+ | enhancement | (relevant dev) → code-reviewer |
288
+
289
+ Prepend **product-planner** if task spec is unclear or acceptance criteria are vague.
290
+
291
+ ## Handoff Context Format
292
+
293
+ ```json
294
+ {
295
+ "from_worker": "backend-dev",
296
+ "to_worker": "code-reviewer",
297
+ "timestamp": "ISO8601",
298
+ "summary": "What was accomplished",
299
+ "files_created": ["src/services/foo.ts"],
300
+ "files_modified": ["src/index.ts"],
301
+ "key_decisions": ["Used strategy pattern"],
302
+ "context_for_next": "Focus review on cache invalidation",
303
+ "back_pressure": { "tests": "pass", "lint": "pass", "typecheck": "pass" }
304
+ }
305
+ ```
306
+
307
+ ## State File Format
308
+
309
+ `workspace/orchestrator/{project}/state.json`:
310
+ ```json
311
+ {
312
+ "project": "campaign-migration",
313
+ "prd_path": "projects/campaign-migration/prd.json",
314
+ "status": "in_progress|paused|completed",
315
+ "started_at": "ISO8601",
316
+ "updated_at": "ISO8601",
317
+ "progress": { "total": 11, "completed": 5, "failed": 0, "in_progress": 1 },
318
+ "current_task": {
319
+ "id": "CAM-006",
320
+ "started_at": "ISO8601",
321
+ "phase": 2,
322
+ "worker": "backend-dev"
323
+ },
324
+ "completed_tasks": [
325
+ { "id": "CAM-001", "completed_at": "ISO8601", "workers_used": ["backend-dev", "code-reviewer"] }
326
+ ],
327
+ "retries": 0
328
+ }
329
+ ```
330
+
331
+ ## Rules
332
+
333
+ - **ONE project at a time**
334
+ - **Sub-agent per task** — each task runs in its own Task() sub-agent via `/execute-task`. The orchestrator NEVER executes worker phases directly.
335
+ - **Context discipline** — the orchestrator stores ONLY task_id, status, and 1-sentence summary per task. No worker outputs, no handoff blobs, no file lists.
336
+ - **Fresh context per task** — sub-agent context is freed when it returns.
337
+ - **Resume is first-class** — `--resume` is how multi-session projects continue. Not a fallback — the expected path for large projects.
338
+ - **Back pressure is mandatory** — enforced inside `/execute-task`, not by the orchestrator
339
+ - **Fail fast** — pause on errors, surface to user
340
+ - **prd.json is required** — never read or fall back to README.md
341
+ - **Validate prd.json on load** — fail loudly on missing/malformed fields
342
+
343
+ ## Integration
344
+
345
+ - `/prd` → creates PRD → `/run-project {name}` executes it
346
+ - `/execute-task {project}/{id}` → runs single task with same pipeline (standalone or as sub-agent)
347
+ - `/run-project --resume` → continues from next incomplete task with fresh context
348
+ - `/nexttask` → shows active projects from /run-project
@@ -0,0 +1,110 @@
1
+ ---
2
+ description: Run a worker or list available workers
3
+ allowed-tools: Task, Read, Glob, Grep, Bash, Edit, Write, WebSearch, WebFetch, AskUserQuestion
4
+ argument-hint: [worker-id] [skill] [args]
5
+ visibility: public
6
+ ---
7
+
8
+ # /run - Worker Execution
9
+
10
+ Unified interface to run workers and their skills.
11
+
12
+ **Usage:**
13
+ ```
14
+ /run # List available workers
15
+ /run {worker-id} # Show worker skills
16
+ /run {worker-id} {skill} # Run specific skill
17
+ /run {worker-id} {skill} arg # Run with argument
18
+ ```
19
+
20
+ **User's input:** $ARGUMENTS
21
+
22
+ ## Process
23
+
24
+ ### No Arguments → List Workers
25
+
26
+ If no arguments provided, read `workers/registry.yaml` and display:
27
+
28
+ ```
29
+ Available Workers:
30
+
31
+ x-{your-name} X/Twitter posting
32
+ cfo-{company} Financial reporting
33
+ {company}-analyst Data analysis
34
+ ...
35
+
36
+ Usage: /run {worker-id} to see skills
37
+ ```
38
+
39
+ ### Worker ID Only → Show Skills
40
+
41
+ If only worker-id provided:
42
+ 1. Find worker in registry
43
+ 2. Read `workers/{worker-path}/worker.yaml`
44
+ 3. List available skills
45
+
46
+ ```
47
+ Worker: x-{your-name}
48
+ Description: X/Twitter posting
49
+
50
+ Skills:
51
+ contentidea Build out a content idea into posts
52
+ suggestposts Research and suggest posts
53
+ scheduleposts Choose what to post now
54
+
55
+ Usage: /run x-{your-name} {skill}
56
+ ```
57
+
58
+ ### Worker + Skill → Execute
59
+
60
+ 1. Load worker context from `workers/{path}/`
61
+ 2. Load skill definition from `workers/{path}/skills/{skill}.md`
62
+ 3. Execute the skill instructions
63
+ 4. Write checkpoint after completion
64
+
65
+ ### Worker + Skill + Args → Execute with Args
66
+
67
+ Pass arguments to the skill. The skill file will reference `$ARGUMENTS`.
68
+
69
+ ## Execution Pattern
70
+
71
+ When executing a skill:
72
+ 1. **Load context** - Read worker.yaml (includes accumulated learnings in `instructions:`), any knowledge files referenced
73
+ 2. **Execute** - Follow the skill's instructions
74
+ 3. **Verify** - Run any verification steps defined
75
+ 4. **PostToolsHook** - Auto-save thread to `workspace/threads/`
76
+
77
+ ### PostToolsHook (Auto-Checkpoint)
78
+
79
+ After skill completion, automatically create a thread:
80
+
81
+ ```json
82
+ {
83
+ "thread_id": "T-{YYYYMMDD}-{HHMMSS}-{worker}-{skill}",
84
+ "worker": { "id": "{worker-id}", "skill": "{skill}", "state": "completed" },
85
+ "git": { /* capture current git state */ },
86
+ "conversation_summary": "What was accomplished",
87
+ "files_touched": ["files created/modified"],
88
+ "metadata": { "tags": ["{worker-id}", "{skill}"] }
89
+ }
90
+ ```
91
+
92
+ Write to: `workspace/threads/{thread_id}.json`
93
+
94
+ Also append to metrics: `workspace/metrics/metrics.jsonl`
95
+
96
+ ## Examples
97
+
98
+ ```
99
+ /run # See all workers
100
+ /run x-{your-name} # See skills
101
+ /run x-{your-name} contentidea # Run contentidea
102
+ /run x-{your-name} contentidea "AI workforce" # Run with topic
103
+ /run cfo-{company} mrr # Run MRR report
104
+ ```
105
+
106
+ ## Notes
107
+
108
+ - Mode (work vs build) is determined by what the skill does, not declared upfront
109
+ - Workers have scoped permissions - only tools listed in their worker.yaml
110
+ - Skills can reference knowledge bases and other workers
@@ -0,0 +1,62 @@
1
+ ---
2
+ description: Reindex and re-embed HQ for qmd search
3
+ allowed-tools: Bash
4
+ argument-hint: [--force]
5
+ visibility: public
6
+ ---
7
+
8
+ # /search-reindex - Rebuild Search Index
9
+
10
+ Re-index and re-embed HQ content for qmd search.
11
+
12
+ **Args:** $ARGUMENTS
13
+
14
+ ## Process
15
+
16
+ ### 1. Update index (re-scan files)
17
+ ```bash
18
+ qmd update
19
+ ```
20
+
21
+ ### 2. Re-embed
22
+
23
+ If `--force` in $ARGUMENTS:
24
+ ```bash
25
+ qmd embed -f
26
+ ```
27
+
28
+ Otherwise (incremental — only new/changed files):
29
+ ```bash
30
+ qmd embed
31
+ ```
32
+
33
+ ### 3. Show status
34
+ ```bash
35
+ qmd status
36
+ ```
37
+
38
+ Display collection stats, document count, embedding coverage.
39
+
40
+ ## When to Reindex
41
+
42
+ Run after:
43
+ - Adding new knowledge bases or company docs
44
+ - Creating new workers or skills
45
+ - Generating reports or content
46
+ - Major workspace changes
47
+
48
+ ## Full Reset
49
+
50
+ To completely rebuild:
51
+ ```bash
52
+ qmd cleanup
53
+ qmd collection add ~/Documents/HQ --name hq --mask "**/*.md"
54
+ qmd context add qmd://hq "HQ knowledge base: company knowledge, AI worker definitions, project PRDs, slash commands, reports, social drafts, and session threads."
55
+ qmd context add qmd://hq/knowledge "HQ-level knowledge bases: Ralph coding methodology, worker framework patterns, dev-team practices, design styles, security framework, project templates."
56
+ qmd context add qmd://hq/.claude/commands "Claude Code slash commands: agent skills for session management, worker execution, project management, content creation, design, deployment."
57
+ qmd context add qmd://hq/companies "Company-scoped directories (your companies -- configure in companies/ dir) each with knowledge bases, settings, and data."
58
+ qmd context add qmd://hq/workers "AI worker definitions with YAML configs and skill markdown files. Top-level ops workers, 12-person dev-team, 5-person content team."
59
+ qmd context add qmd://hq/projects "Project PRDs and READMEs for active and planned projects across all companies."
60
+ qmd context add qmd://hq/workspace "Runtime workspace: session threads, checkpoints, orchestrator state, reports, social drafts, content ideas, metrics."
61
+ qmd embed
62
+ ```
@@ -0,0 +1,100 @@
1
+ ---
2
+ description: Search across HQ (qmd-powered semantic + full-text)
3
+ allowed-tools: Bash, Read
4
+ argument-hint: <query> [--mode search|vsearch|query] [-n count] [--full]
5
+ visibility: public
6
+ ---
7
+
8
+ # /search - HQ Search (qmd)
9
+
10
+ Semantic + full-text search across all HQ content using qmd.
11
+
12
+ **Query:** $ARGUMENTS
13
+
14
+ ## Parse Arguments
15
+
16
+ Extract from $ARGUMENTS:
17
+ - `query` — search text (everything except flags)
18
+ - `--mode` — `search` (BM25), `vsearch` (semantic), `query` (hybrid). Default: `search`
19
+ - `-n` — result count (default: 10)
20
+ - `--full` — show full content of top result
21
+
22
+ ## Execute Search
23
+
24
+ Run the matching qmd command:
25
+
26
+ **Default (BM25 full-text):**
27
+ ```bash
28
+ qmd search "$QUERY" -n 10 --json
29
+ ```
30
+
31
+ **Semantic (conceptual match):**
32
+ ```bash
33
+ qmd vsearch "$QUERY" -n 10 --json
34
+ ```
35
+
36
+ **Hybrid (BM25 + vector + re-rank):**
37
+ ```bash
38
+ qmd query "$QUERY" -n 10 --json
39
+ ```
40
+
41
+ ## Display Results
42
+
43
+ Parse JSON output. Display:
44
+
45
+ ```
46
+ Search: "{query}" (mode: {mode})
47
+
48
+ Results:
49
+ 1. [0.92] knowledge/public/Ralph/02-core-concepts.md
50
+ "Ralph methodology emphasizes small loops with human checkpoints..."
51
+
52
+ 2. [0.84] .claude/commands/run-project.md
53
+ "Run a project through the Ralph loop..."
54
+
55
+ 3. [0.71] workers/public/dev-team/architect/skills/design-review.md
56
+ "Architecture review following Ralph back-pressure patterns..."
57
+
58
+ {n} results. Use --full to show top result content.
59
+ ```
60
+
61
+ - Score in brackets
62
+ - Relative path (strip `qmd://hq/` prefix)
63
+ - Snippet truncated to ~100 chars
64
+
65
+ ## Full Content
66
+
67
+ If `--full` flag, after listing results, read top result file with Read tool.
68
+
69
+ ## Fallback
70
+
71
+ If qmd errors or isn't installed:
72
+
73
+ ```bash
74
+ grep -rl "$QUERY" ~/Documents/HQ/knowledge/ \
75
+ ~/Documents/HQ/companies/ \
76
+ ~/Documents/HQ/workers/ \
77
+ ~/Documents/HQ/.claude/commands/ \
78
+ ~/Documents/HQ/workspace/ 2>/dev/null | head -20
79
+ ```
80
+
81
+ Display: "qmd unavailable, falling back to grep"
82
+
83
+ ## Examples
84
+
85
+ ```bash
86
+ /search ralph # BM25 keyword search (default)
87
+ /search "how do workers execute" --mode vsearch # Semantic
88
+ /search acme brand --mode query # Hybrid with re-ranking
89
+ /search stripe -n 20 # More results
90
+ /search authentication --full # Show top match content
91
+ ```
92
+
93
+ ## Notes
94
+
95
+ - Default `search` mode is fastest — use for exact keywords
96
+ - Use `--mode vsearch` for conceptual/semantic queries
97
+ - Use `--mode query` for highest quality (slower, uses LLM re-ranking)
98
+ - Scores 0.0-1.0; above 0.5 is a good match
99
+ - Run `/search-reindex` after adding new content
100
+ - For code search in repos, use Grep tool directly