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,381 @@
1
+ ---
2
+ description: Interactive setup wizard for HQ Starter Kit
3
+ allowed-tools: Read, Write, Edit, AskUserQuestion, Glob, Bash
4
+ visibility: public
5
+ ---
6
+
7
+ # HQ Setup Wizard
8
+
9
+ Welcome! This wizard will configure your personal HQ.
10
+
11
+ ## Phase 0: Dependencies
12
+
13
+ Check and guide installation of key dependencies before proceeding.
14
+
15
+ ### Required
16
+ Run these checks silently. Only prompt user if something is missing.
17
+
18
+ **qmd** (HQ search - semantic + full-text):
19
+ ```bash
20
+ which qmd
21
+ ```
22
+ If missing, show:
23
+ ```
24
+ qmd not found. HQ uses qmd for semantic search across knowledge bases.
25
+
26
+ Install: cargo install qmd
27
+ OR: brew install tobi/tap/qmd
28
+
29
+ After install, index HQ: qmd index .
30
+ ```
31
+
32
+ **Claude Code CLI**:
33
+ ```bash
34
+ which claude
35
+ ```
36
+ If missing, show:
37
+ ```
38
+ Claude Code CLI not found. Required to run HQ.
39
+
40
+ Install: npm install -g @anthropic-ai/claude-code
41
+ ```
42
+
43
+ ### Optional (check based on starter selection)
44
+
45
+ **gh CLI** (for code workers):
46
+ ```bash
47
+ which gh
48
+ ```
49
+ If missing and Code Worker selected:
50
+ ```
51
+ gh CLI recommended for code workers (PRs, issues).
52
+ Install: brew install gh
53
+ ```
54
+
55
+ ### Post-install: Index HQ
56
+ If qmd was just installed or index doesn't exist:
57
+ ```bash
58
+ qmd index .
59
+ ```
60
+
61
+ ---
62
+
63
+ ## Context to Load
64
+
65
+ 1. Read `starter-projects/` to understand available options
66
+ 2. Read `knowledge/public/workers/templates/` for worker patterns
67
+
68
+ ## Phase 1: Identity
69
+
70
+ Ask these questions one at a time. Wait for answers before proceeding.
71
+
72
+ 1. **What's your name or handle?** (used for folder naming)
73
+ 2. **What do you do?** (1-2 sentences about your roles/work)
74
+ 3. **What domains do you focus on?** (e.g., tech, business, creative, health)
75
+ 4. **Company/context name?** (default: "personal" - used for organizing your settings/knowledge)
76
+
77
+ ## Phase 2: Starter Project Selection
78
+
79
+ Present these options:
80
+
81
+ ```
82
+ Choose your starter project(s):
83
+
84
+ 1. PERSONAL ASSISTANT
85
+ - Daily email digest
86
+ - Task scanning
87
+ - Calendar awareness
88
+ Best for: Productivity-focused users
89
+
90
+ 2. SOCIAL MEDIA WORKER
91
+ - Content drafting (X, LinkedIn)
92
+ - Voice consistency
93
+ - Post scheduling queue
94
+ Best for: Personal brand builders
95
+
96
+ 3. CODE WORKER
97
+ - Ralph loop implementation
98
+ - Back pressure verification
99
+ - PRD-driven development
100
+ Best for: Developers shipping autonomously
101
+
102
+ Enter numbers (e.g., "1,3" or "2" or "all"):
103
+ ```
104
+
105
+ ## Phase 3: Customization
106
+
107
+ Based on selection, ask relevant questions:
108
+
109
+ ### If Personal Assistant selected:
110
+ - How many email accounts do you manage?
111
+ - Preferred digest time? (morning/evening)
112
+
113
+ ### If Social Media selected:
114
+ - Which platforms? (X, LinkedIn, both)
115
+ - Posting voice: professional / casual / direct
116
+ - Content topics (3-5 keywords)
117
+
118
+ ### If Code Worker selected:
119
+ - Primary tech stack? (Node/TypeScript, Python, Go, etc.)
120
+ - Project name for first PRD?
121
+ - Verification commands? (default: `npm run typecheck && npm run build`)
122
+
123
+ ## Phase 4: Generate Files
124
+
125
+ ### Always create company structure:
126
+
127
+ ```
128
+ companies/{company}/
129
+ ├── settings/ # API credentials (gitignored)
130
+ ├── data/ # Exports, reports
131
+ └── knowledge/
132
+ ├── profile.md
133
+ └── voice-style.md
134
+ ```
135
+
136
+ Create directories with `mkdir -p companies/{company}/settings companies/{company}/data companies/{company}/knowledge`
137
+
138
+ **companies/{company}/knowledge/profile.md:**
139
+ ```markdown
140
+ # {Name}'s Profile
141
+
142
+ ## About
143
+ {description from Phase 1, Q2}
144
+
145
+ ## Focus Areas
146
+ {domains from Phase 1, Q3}
147
+
148
+ ## Preferences
149
+ - Communication style: [direct/detailed/casual]
150
+ - Working hours: [your timezone/schedule]
151
+ - Autonomy level: [how much should agents do without asking?]
152
+
153
+ ## Context Notes
154
+ [Add notes agents should know when working for you]
155
+ ```
156
+
157
+ **companies/{company}/knowledge/voice-style.md:**
158
+ ```markdown
159
+ # {Name}'s Voice Style
160
+
161
+ ## Tone
162
+ {based on answers - professional/casual/direct}
163
+
164
+ ## Guidelines
165
+ - [Customize as you use HQ]
166
+ - [Add patterns you like]
167
+ - [Note things to avoid]
168
+
169
+ ## Example Phrases
170
+ - [Add phrases that sound like you]
171
+ ```
172
+
173
+ ### Based on selection:
174
+
175
+ **If Personal Assistant:**
176
+ 1. Copy `starter-projects/personal-assistant/` to `projects/personal-assistant/`
177
+ 2. Create `workers/private/email-digest/worker.yaml`:
178
+ ```yaml
179
+ worker:
180
+ id: email-digest
181
+ name: "Email Digest"
182
+ type: AssistantWorker
183
+ version: "1.0"
184
+
185
+ identity:
186
+ voice_guide: companies/{company}/knowledge/voice-style.md
187
+
188
+ execution:
189
+ mode: scheduled
190
+ schedule: "0 {hour} * * *" # from digest time preference
191
+ max_runtime: 10m
192
+
193
+ context:
194
+ base:
195
+ - companies/{company}/knowledge/profile.md
196
+ - companies/{company}/settings/email-accounts.json
197
+
198
+ verification:
199
+ post_execute:
200
+ - check: digest_generated
201
+ approval_required: false
202
+
203
+ tasks:
204
+ source: workers/private/email-digest/prd.json
205
+ one_at_a_time: true
206
+
207
+ output:
208
+ destination: workspace/digests/
209
+ format: markdown
210
+ naming: "{date}-digest.md"
211
+
212
+ instructions: |
213
+ Generate email digest following the Presidential Daily Brief format.
214
+ Classify emails: urgent | actionable | fyi | archive
215
+ Focus on what needs attention, not comprehensive summary.
216
+ ```
217
+ 3. Create `companies/{company}/settings/email-accounts.json.example`:
218
+ ```json
219
+ {
220
+ "accounts": [
221
+ {
222
+ "name": "Primary",
223
+ "email": "you@example.com",
224
+ "provider": "gmail|outlook|imap"
225
+ }
226
+ ]
227
+ }
228
+ ```
229
+ 4. Add to `workers/registry.yaml`
230
+
231
+ **If Social Media:**
232
+ 1. Copy `starter-projects/social-media/` to `projects/social-presence/`
233
+ 2. Create `workers/private/{platform}-{name}/worker.yaml`:
234
+ ```yaml
235
+ worker:
236
+ id: {platform}-{name}
237
+ name: "{Platform} Content"
238
+ type: SocialWorker
239
+ version: "1.0"
240
+
241
+ identity:
242
+ voice_guide: companies/{company}/knowledge/voice-style.md
243
+
244
+ execution:
245
+ mode: on-demand
246
+ max_runtime: 15m
247
+
248
+ context:
249
+ base:
250
+ - companies/{company}/knowledge/profile.md
251
+ - companies/{company}/knowledge/voice-style.md
252
+ dynamic:
253
+ - workspace/content-ideas/
254
+
255
+ verification:
256
+ post_execute:
257
+ - check: character_count
258
+ max: 280 # for X
259
+ - check: voice_consistency
260
+ approval_required: true
261
+
262
+ tasks:
263
+ source: workers/private/{platform}-{name}/queue.json
264
+ one_at_a_time: true
265
+
266
+ output:
267
+ destination: workspace/social-drafts/
268
+ format: markdown
269
+ naming: "{date}-{topic}.md"
270
+
271
+ instructions: |
272
+ Draft content matching voice style guide.
273
+ Always verify character limits before marking complete.
274
+ Never post without human approval.
275
+ ```
276
+ 3. Create `workers/private/{platform}-{name}/queue.json`:
277
+ ```json
278
+ {
279
+ "worker": "{platform}-{name}",
280
+ "queue": []
281
+ }
282
+ ```
283
+ 4. Add to `workers/registry.yaml`
284
+
285
+ **If Code Worker:**
286
+ 1. Copy `starter-projects/code-worker/` to `projects/{project-name}/`
287
+ 2. Create `workers/private/{project-name}-coder/worker.yaml`:
288
+ ```yaml
289
+ worker:
290
+ id: {project-name}-coder
291
+ name: "{Project} Code Worker"
292
+ type: CodeWorker
293
+ version: "1.0"
294
+
295
+ execution:
296
+ mode: on-demand
297
+ max_runtime: 30m
298
+
299
+ context:
300
+ base:
301
+ - knowledge/public/Ralph/
302
+ - projects/{project-name}/prd.json
303
+ dynamic:
304
+ - "{repo-path}/"
305
+ exclude:
306
+ - node_modules/
307
+ - "*.log"
308
+ - dist/
309
+
310
+ verification:
311
+ post_execute:
312
+ - check: typecheck
313
+ command: "{verify-command}"
314
+ must_pass: true
315
+ - check: build
316
+ command: "{build-command}"
317
+ must_pass: true
318
+ approval_required: false
319
+
320
+ tasks:
321
+ source: projects/{project-name}/prd.json
322
+ format: prd
323
+ one_at_a_time: true
324
+
325
+ output:
326
+ format: git_commit
327
+
328
+ instructions: |
329
+ Implement features following Ralph methodology.
330
+ Run back pressure checks after each change.
331
+ Commit with format: feat({feature-id}): {description}
332
+ Write checkpoint after each completed feature.
333
+ ```
334
+ 3. Add to `workers/registry.yaml`
335
+
336
+ ### Update Registry
337
+
338
+ Add entries to `workers/registry.yaml`:
339
+ ```yaml
340
+ workers:
341
+ - id: {worker-id}
342
+ path: workers/private/{worker-id}/
343
+ type: {WorkerType}
344
+ visibility: private
345
+ status: active
346
+ description: "{1-sentence description}"
347
+ ```
348
+
349
+ ## Phase 5: Summary
350
+
351
+ Output:
352
+ ```
353
+ HQ Setup Complete!
354
+
355
+ Created:
356
+ - Company context: companies/{company}/
357
+ - knowledge/profile.md
358
+ - knowledge/voice-style.md
359
+ - settings/ (for credentials)
360
+ - data/ (for exports)
361
+ - Workers: {list with paths}
362
+ - Projects: {list with paths}
363
+
364
+ Next steps:
365
+ 1. Review and customize companies/{company}/knowledge/profile.md
366
+ 2. {If email} Copy settings/email-accounts.json.example → email-accounts.json and add credentials
367
+ 3. Run `/search <topic>` to find relevant HQ knowledge
368
+ 4. Run `/nexttask` to see available work
369
+ 5. Run `/run {worker-id}` to execute a worker
370
+ 6. Run `/newworker` when you want to add more workers
371
+
372
+ Happy building!
373
+ ```
374
+
375
+ ## Rules
376
+
377
+ - Ask questions one at a time (avoid overwhelming)
378
+ - Use defaults when user says "skip" or "default"
379
+ - Always validate paths before writing
380
+ - Never overwrite existing files without asking
381
+ - Create parent directories as needed
@@ -0,0 +1,312 @@
1
+ <#
2
+ .SYNOPSIS
3
+ Pure Ralph Loop - Canonical external orchestrator
4
+
5
+ .DESCRIPTION
6
+ Runs the SAME prompt in a loop. Claude picks the task.
7
+ Fresh context per iteration. Loop until all tasks pass.
8
+
9
+ .PARAMETER PrdPath
10
+ Full path to the PRD JSON file
11
+
12
+ .PARAMETER TargetRepo
13
+ Full path to the target repository
14
+
15
+ .PARAMETER Manual
16
+ Run in manual mode (interactive TUI, manually close windows)
17
+ Default is auto mode (uses -p flag, auto-exits)
18
+
19
+ .EXAMPLE
20
+ # Auto mode (default) - fully autonomous
21
+ .\pure-ralph-loop.ps1 -PrdPath "C:/my-hq/projects/my-project/prd.json" -TargetRepo "C:/my-hq"
22
+
23
+ # Manual mode - see chain of thought, close windows manually
24
+ .\pure-ralph-loop.ps1 -PrdPath "C:/my-hq/projects/my-project/prd.json" -TargetRepo "C:/my-hq" -Manual
25
+ #>
26
+
27
+ param(
28
+ [Parameter(Mandatory=$true)]
29
+ [string]$PrdPath,
30
+
31
+ [Parameter(Mandatory=$true)]
32
+ [string]$TargetRepo,
33
+
34
+ [string]$HqPath = "C:/my-hq",
35
+
36
+ [switch]$Manual
37
+ )
38
+
39
+ # ============================================================================
40
+ # Configuration
41
+ # ============================================================================
42
+
43
+ $BasePromptPath = Join-Path $HqPath "prompts/pure-ralph-base.md"
44
+ $ProjectName = (Split-Path (Split-Path $PrdPath -Parent) -Leaf)
45
+ $LogDir = Join-Path $HqPath "workspace/orchestrator/$ProjectName"
46
+ $LogFile = Join-Path $LogDir "pure-ralph.log"
47
+ $LockFile = Join-Path $TargetRepo ".pure-ralph.lock"
48
+
49
+ # Create log directory
50
+ New-Item -ItemType Directory -Path $LogDir -Force | Out-Null
51
+
52
+ # ============================================================================
53
+ # Functions
54
+ # ============================================================================
55
+
56
+ function Write-Log {
57
+ param([string]$Message, [string]$Level = "INFO")
58
+ $timestamp = Get-Date -Format "yyyy-MM-dd HH:mm:ss"
59
+ $entry = "[$timestamp] [$Level] $Message"
60
+ Add-Content -Path $LogFile -Value $entry
61
+
62
+ switch ($Level) {
63
+ "ERROR" { Write-Host $entry -ForegroundColor Red }
64
+ "WARN" { Write-Host $entry -ForegroundColor Yellow }
65
+ "SUCCESS" { Write-Host $entry -ForegroundColor Green }
66
+ default { Write-Host $entry }
67
+ }
68
+ }
69
+
70
+ function Create-LockFile {
71
+ $lockContent = @{
72
+ project = $ProjectName
73
+ pid = $PID
74
+ started_at = (Get-Date -Format "o")
75
+ } | ConvertTo-Json
76
+ $lockContent | Out-File -FilePath $LockFile -Encoding utf8
77
+ Write-Log "Lock file created: $LockFile"
78
+ }
79
+
80
+ function Remove-LockFile {
81
+ if (Test-Path $LockFile) {
82
+ Remove-Item -Path $LockFile -Force
83
+ Write-Log "Lock file removed: $LockFile"
84
+ }
85
+ }
86
+
87
+ function Check-ExistingLock {
88
+ if (Test-Path $LockFile) {
89
+ try {
90
+ $lockContent = Get-Content $LockFile -Raw | ConvertFrom-Json
91
+ $lockProject = $lockContent.project
92
+ $lockPid = $lockContent.pid
93
+ $lockStarted = [DateTime]::Parse($lockContent.started_at)
94
+ $duration = (Get-Date) - $lockStarted
95
+ $durationStr = "{0:hh\:mm\:ss}" -f $duration
96
+
97
+ Write-Host ""
98
+ Write-Host "=== WARNING: Lock File Detected ===" -ForegroundColor Yellow
99
+ Write-Host "Another pure-ralph loop may be running on this repo." -ForegroundColor Yellow
100
+ Write-Host ""
101
+ Write-Host " Project: $lockProject" -ForegroundColor Gray
102
+ Write-Host " PID: $lockPid" -ForegroundColor Gray
103
+ Write-Host " Started: $($lockContent.started_at)" -ForegroundColor Gray
104
+ Write-Host " Duration: $durationStr" -ForegroundColor Gray
105
+ Write-Host ""
106
+
107
+ # Check if process is still running
108
+ $processRunning = $false
109
+ try {
110
+ $proc = Get-Process -Id $lockPid -ErrorAction SilentlyContinue
111
+ if ($proc) {
112
+ $processRunning = $true
113
+ Write-Host " Process Status: RUNNING" -ForegroundColor Red
114
+ } else {
115
+ Write-Host " Process Status: NOT RUNNING (stale lock)" -ForegroundColor Yellow
116
+ }
117
+ } catch {
118
+ Write-Host " Process Status: NOT RUNNING (stale lock)" -ForegroundColor Yellow
119
+ }
120
+ Write-Host ""
121
+
122
+ Write-Log "Existing lock file found for project '$lockProject' (PID: $lockPid, Duration: $durationStr)" "WARN"
123
+
124
+ # Prompt user
125
+ $response = Read-Host "Another pure-ralph is running. Continue anyway? (y/N)"
126
+ if ($response -match "^[Yy]$") {
127
+ Write-Log "User chose to continue despite existing lock" "WARN"
128
+ Write-Host "Continuing... (existing lock will be overwritten)" -ForegroundColor Yellow
129
+ return $true
130
+ } else {
131
+ Write-Log "User chose to abort due to existing lock" "INFO"
132
+ Write-Host "Aborting." -ForegroundColor Red
133
+ return $false
134
+ }
135
+ } catch {
136
+ Write-Log "Could not parse lock file: $_" "WARN"
137
+ # If we can't parse the lock file, ask the user
138
+ $response = Read-Host "Lock file exists but couldn't be read. Continue anyway? (y/N)"
139
+ if ($response -match "^[Yy]$") {
140
+ return $true
141
+ } else {
142
+ return $false
143
+ }
144
+ }
145
+ }
146
+ return $true
147
+ }
148
+
149
+ function Get-TaskProgress {
150
+ $prd = Get-Content $PrdPath -Raw | ConvertFrom-Json
151
+ $total = $prd.features.Count
152
+ $complete = ($prd.features | Where-Object { $_.passes -eq $true }).Count
153
+ return @{ Total = $total; Complete = $complete; Remaining = $total - $complete }
154
+ }
155
+
156
+ function Build-Prompt {
157
+ param([bool]$IsManual)
158
+
159
+ # Read base prompt and substitute only PRD_PATH and TARGET_REPO
160
+ $prompt = Get-Content $BasePromptPath -Raw
161
+ $prompt = $prompt -replace '\{\{PRD_PATH\}\}', $PrdPath
162
+ $prompt = $prompt -replace '\{\{TARGET_REPO\}\}', $TargetRepo
163
+
164
+ # In manual mode, add instruction for user to close window
165
+ if ($IsManual) {
166
+ $prompt += @"
167
+
168
+
169
+ ---
170
+
171
+ ## IMPORTANT: Manual Mode
172
+
173
+ When you have completed the task and updated the PRD, output this message:
174
+
175
+ ```
176
+ TASK COMPLETE - Please close this window to continue to the next task.
177
+ ```
178
+
179
+ Do NOT exit automatically. Wait for the user to close the window.
180
+ "@
181
+ }
182
+
183
+ return $prompt
184
+ }
185
+
186
+ # ============================================================================
187
+ # Main Loop
188
+ # ============================================================================
189
+
190
+ $modeLabel = if ($Manual) { "MANUAL (interactive)" } else { "AUTO (autonomous)" }
191
+
192
+ Write-Host ""
193
+ Write-Host "=== Pure Ralph Loop ===" -ForegroundColor Cyan
194
+ Write-Host "PRD: $PrdPath" -ForegroundColor Gray
195
+ Write-Host "Target: $TargetRepo" -ForegroundColor Gray
196
+ Write-Host "Log: $LogFile" -ForegroundColor Gray
197
+ Write-Host "Mode: $modeLabel" -ForegroundColor $(if ($Manual) { "Yellow" } else { "Green" })
198
+ Write-Host ""
199
+ Write-Host "Same prompt every iteration. Claude picks the task." -ForegroundColor Yellow
200
+ Write-Host ""
201
+
202
+ Write-Log "Pure Ralph Loop started"
203
+ Write-Log "PRD: $PrdPath"
204
+ Write-Log "Target: $TargetRepo"
205
+ Write-Log "Mode: $modeLabel"
206
+
207
+ # Check for existing lock file (conflict detection)
208
+ if (-not (Check-ExistingLock)) {
209
+ exit 1
210
+ }
211
+
212
+ # Create lock file to prevent concurrent execution
213
+ Create-LockFile
214
+
215
+ # Ensure lock file is removed on exit (success or failure)
216
+ try {
217
+ # Build the prompt ONCE (only PRD_PATH and TARGET_REPO substituted)
218
+ $prompt = Build-Prompt -IsManual $Manual
219
+ $promptFile = Join-Path $LogDir "current-prompt.md"
220
+ $prompt | Out-File -FilePath $promptFile -Encoding utf8
221
+
222
+ Write-Log "Prompt built and saved to $promptFile"
223
+
224
+ $iteration = 0
225
+ $maxIterations = 50
226
+
227
+ while ($iteration -lt $maxIterations) {
228
+ $iteration++
229
+
230
+ $progress = Get-TaskProgress
231
+
232
+ Write-Host ""
233
+ Write-Host "--- Iteration $iteration ---" -ForegroundColor Cyan
234
+ Write-Log "Iteration $iteration - Progress: $($progress.Complete)/$($progress.Total)"
235
+
236
+ # Check if all done
237
+ if ($progress.Remaining -eq 0) {
238
+ Write-Host ""
239
+ Write-Host "=== ALL TASKS COMPLETE ===" -ForegroundColor Green
240
+ Write-Log "All tasks complete!" "SUCCESS"
241
+ break
242
+ }
243
+
244
+ Write-Host "Tasks remaining: $($progress.Remaining)" -ForegroundColor Yellow
245
+ Write-Host ""
246
+
247
+ if ($Manual) {
248
+ Write-Host "Opening Claude in new window (MANUAL MODE)..." -ForegroundColor Cyan
249
+ Write-Host ">>> Close the window when task completes to continue <<<" -ForegroundColor Yellow
250
+ } else {
251
+ Write-Host "Opening Claude in new window (AUTO MODE)..." -ForegroundColor Cyan
252
+ Write-Host ">>> Window will close automatically when done <<<" -ForegroundColor Green
253
+ }
254
+ Write-Host ""
255
+
256
+ Write-Log "Spawning Claude session"
257
+
258
+ # Build the Claude command based on mode
259
+ if ($Manual) {
260
+ # Manual mode: interactive TUI, user closes window
261
+ $claudeCmd = @"
262
+ cd '$TargetRepo'
263
+ Write-Host '=== Pure Ralph Session (MANUAL MODE) ===' -ForegroundColor Cyan
264
+ Write-Host 'Reading PRD, picking task, implementing...' -ForegroundColor Gray
265
+ Write-Host 'Close this window when done to continue the loop.' -ForegroundColor Yellow
266
+ Write-Host ''
267
+ claude --permission-mode bypassPermissions (Get-Content '$promptFile' -Raw)
268
+ "@
269
+ } else {
270
+ # Auto mode: -p flag, auto-exits
271
+ $claudeCmd = @"
272
+ cd '$TargetRepo'
273
+ Write-Host '=== Pure Ralph Session (AUTO MODE) ===' -ForegroundColor Cyan
274
+ Write-Host 'Reading PRD, picking task, implementing...' -ForegroundColor Gray
275
+ Write-Host ''
276
+ claude -p --permission-mode bypassPermissions (Get-Content '$promptFile' -Raw)
277
+ Write-Host ''
278
+ Write-Host 'Session complete. Window closing in 3 seconds...' -ForegroundColor Green
279
+ Start-Sleep -Seconds 3
280
+ exit
281
+ "@
282
+ }
283
+
284
+ # Start new window and WAIT for it to close
285
+ $proc = Start-Process powershell -ArgumentList "-Command", $claudeCmd -PassThru
286
+
287
+ Write-Host "Waiting for Claude session (PID: $($proc.Id))..." -ForegroundColor Gray
288
+ $proc.WaitForExit()
289
+
290
+ Write-Log "Claude session ended"
291
+
292
+ # Brief pause before next iteration
293
+ Start-Sleep -Seconds 2
294
+ }
295
+
296
+ if ($iteration -ge $maxIterations) {
297
+ Write-Log "Safety limit reached ($maxIterations iterations)" "WARN"
298
+ }
299
+
300
+ # Final summary
301
+ $progress = Get-TaskProgress
302
+ Write-Host ""
303
+ Write-Host "=== Final Summary ===" -ForegroundColor Cyan
304
+ Write-Host "Completed: $($progress.Complete)/$($progress.Total) tasks" -ForegroundColor $(if ($progress.Remaining -eq 0) { "Green" } else { "Yellow" })
305
+ Write-Host "Log: $LogFile" -ForegroundColor Gray
306
+
307
+ Write-Log "Loop ended. Final: $($progress.Complete)/$($progress.Total) complete"
308
+ }
309
+ finally {
310
+ # Always remove lock file on exit (success or failure)
311
+ Remove-LockFile
312
+ }