@proflandrigan/shards 1.1.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 (397) hide show
  1. package/README.md +475 -0
  2. package/package.json +37 -0
  3. package/src/agents/academic.md +276 -0
  4. package/src/agents/ai-engineer.md +377 -0
  5. package/src/agents/analytics-engineer.md +364 -0
  6. package/src/agents/applied-ml-scientist.md +410 -0
  7. package/src/agents/backend-engineer.md +255 -0
  8. package/src/agents/bi-engineer.md +333 -0
  9. package/src/agents/data-analyst.md +343 -0
  10. package/src/agents/data-engineer.md +260 -0
  11. package/src/agents/data-modeller.md +386 -0
  12. package/src/agents/data-scientist.md +366 -0
  13. package/src/agents/deep-learning-engineer.md +389 -0
  14. package/src/agents/ml-engineer.md +424 -0
  15. package/src/agents/mlops-engineer.md +339 -0
  16. package/src/agents/researcher.md +187 -0
  17. package/src/agents/specific_instructions/academic/critical_review.md +263 -0
  18. package/src/agents/specific_instructions/academic/report.md +113 -0
  19. package/src/agents/specific_instructions/ai_engineer/advise.md +162 -0
  20. package/src/agents/specific_instructions/ai_engineer/bi_engineer_handoff.md +86 -0
  21. package/src/agents/specific_instructions/ai_engineer/experiment.md +471 -0
  22. package/src/agents/specific_instructions/ai_engineer/experiment_ui_mode.md +44 -0
  23. package/src/agents/specific_instructions/ai_engineer/phases/index.md +45 -0
  24. package/src/agents/specific_instructions/ai_engineer/phases/phase-1.md +55 -0
  25. package/src/agents/specific_instructions/ai_engineer/phases/phase-2.md +86 -0
  26. package/src/agents/specific_instructions/ai_engineer/phases/phase-3.md +96 -0
  27. package/src/agents/specific_instructions/ai_engineer/phases/phase-4.md +138 -0
  28. package/src/agents/specific_instructions/ai_engineer/phases/phase-5.md +157 -0
  29. package/src/agents/specific_instructions/ai_engineer/phases/phase-6.md +196 -0
  30. package/src/agents/specific_instructions/ai_engineer/phases/phase-7.md +313 -0
  31. package/src/agents/specific_instructions/ai_engineer/phases.md +1011 -0
  32. package/src/agents/specific_instructions/ai_engineer/prompt_lab.md +161 -0
  33. package/src/agents/specific_instructions/ai_engineer/prompt_lab_ui_mode.md +28 -0
  34. package/src/agents/specific_instructions/ai_engineer/research.md +393 -0
  35. package/src/agents/specific_instructions/ai_engineer/research_ui_mode.md +66 -0
  36. package/src/agents/specific_instructions/ai_engineer/review.md +159 -0
  37. package/src/agents/specific_instructions/ai_engineer/validation_checklist.md +182 -0
  38. package/src/agents/specific_instructions/analytics_engineer/advise.md +155 -0
  39. package/src/agents/specific_instructions/analytics_engineer/bi_engineer_handoff.md +91 -0
  40. package/src/agents/specific_instructions/analytics_engineer/data_analyst_handoff.md +84 -0
  41. package/src/agents/specific_instructions/analytics_engineer/deep_phases.md +818 -0
  42. package/src/agents/specific_instructions/analytics_engineer/phases_deep/index.md +24 -0
  43. package/src/agents/specific_instructions/analytics_engineer/phases_deep/phase-1.md +77 -0
  44. package/src/agents/specific_instructions/analytics_engineer/phases_deep/phase-2.md +106 -0
  45. package/src/agents/specific_instructions/analytics_engineer/phases_deep/phase-3.md +93 -0
  46. package/src/agents/specific_instructions/analytics_engineer/phases_deep/phase-4.md +79 -0
  47. package/src/agents/specific_instructions/analytics_engineer/phases_deep/phase-5.md +61 -0
  48. package/src/agents/specific_instructions/analytics_engineer/phases_deep/phase-6.md +45 -0
  49. package/src/agents/specific_instructions/analytics_engineer/phases_deep/phase-7.md +235 -0
  50. package/src/agents/specific_instructions/analytics_engineer/phases_deep/phase-8.md +221 -0
  51. package/src/agents/specific_instructions/analytics_engineer/phases_quick/index.md +19 -0
  52. package/src/agents/specific_instructions/analytics_engineer/phases_quick/phase-1.md +47 -0
  53. package/src/agents/specific_instructions/analytics_engineer/phases_quick/phase-2.md +78 -0
  54. package/src/agents/specific_instructions/analytics_engineer/quick_phases.md +112 -0
  55. package/src/agents/specific_instructions/analytics_engineer/review.md +167 -0
  56. package/src/agents/specific_instructions/analytics_engineer/service_mode.md +369 -0
  57. package/src/agents/specific_instructions/analytics_engineer/ui_mode.md +45 -0
  58. package/src/agents/specific_instructions/analytics_engineer/update.md +162 -0
  59. package/src/agents/specific_instructions/analytics_engineer/validation_checklist.md +121 -0
  60. package/src/agents/specific_instructions/applied_ml_scientist/advise.md +143 -0
  61. package/src/agents/specific_instructions/applied_ml_scientist/phases/index.md +21 -0
  62. package/src/agents/specific_instructions/applied_ml_scientist/phases/phase-1.md +51 -0
  63. package/src/agents/specific_instructions/applied_ml_scientist/phases/phase-2.md +66 -0
  64. package/src/agents/specific_instructions/applied_ml_scientist/phases/phase-3.md +113 -0
  65. package/src/agents/specific_instructions/applied_ml_scientist/phases/phase-4.md +104 -0
  66. package/src/agents/specific_instructions/applied_ml_scientist/phases/phase-5.md +156 -0
  67. package/src/agents/specific_instructions/applied_ml_scientist/phases.md +428 -0
  68. package/src/agents/specific_instructions/applied_ml_scientist/research.md +379 -0
  69. package/src/agents/specific_instructions/applied_ml_scientist/review.md +142 -0
  70. package/src/agents/specific_instructions/applied_ml_scientist/validation_checklist.md +136 -0
  71. package/src/agents/specific_instructions/backend_engineer/clean.md +149 -0
  72. package/src/agents/specific_instructions/backend_engineer/review.md +91 -0
  73. package/src/agents/specific_instructions/backend_engineer/review_checklist.md +54 -0
  74. package/src/agents/specific_instructions/backend_engineer/service_mode.md +67 -0
  75. package/src/agents/specific_instructions/bi_engineer/advise.md +137 -0
  76. package/src/agents/specific_instructions/bi_engineer/data_analyst_handoff.md +77 -0
  77. package/src/agents/specific_instructions/bi_engineer/incoming_handoff.md +45 -0
  78. package/src/agents/specific_instructions/bi_engineer/phases/index.md +20 -0
  79. package/src/agents/specific_instructions/bi_engineer/phases/phase-1.md +164 -0
  80. package/src/agents/specific_instructions/bi_engineer/phases/phase-2.md +92 -0
  81. package/src/agents/specific_instructions/bi_engineer/phases/phase-3.md +121 -0
  82. package/src/agents/specific_instructions/bi_engineer/phases/phase-4.md +106 -0
  83. package/src/agents/specific_instructions/bi_engineer/phases.md +451 -0
  84. package/src/agents/specific_instructions/bi_engineer/review.md +166 -0
  85. package/src/agents/specific_instructions/bi_engineer/update.md +147 -0
  86. package/src/agents/specific_instructions/bi_engineer/validation_checklist.md +124 -0
  87. package/src/agents/specific_instructions/data_analyst/advise.md +138 -0
  88. package/src/agents/specific_instructions/data_analyst/explain.md +221 -0
  89. package/src/agents/specific_instructions/data_analyst/incoming_handoff.md +40 -0
  90. package/src/agents/specific_instructions/data_analyst/phases/index.md +20 -0
  91. package/src/agents/specific_instructions/data_analyst/phases/phase-1.md +159 -0
  92. package/src/agents/specific_instructions/data_analyst/phases/phase-2.md +112 -0
  93. package/src/agents/specific_instructions/data_analyst/phases/phase-3.md +265 -0
  94. package/src/agents/specific_instructions/data_analyst/phases/phase-4.md +100 -0
  95. package/src/agents/specific_instructions/data_analyst/phases.md +501 -0
  96. package/src/agents/specific_instructions/data_analyst/review.md +138 -0
  97. package/src/agents/specific_instructions/data_analyst/ui_mode.md +26 -0
  98. package/src/agents/specific_instructions/data_analyst/update.md +144 -0
  99. package/src/agents/specific_instructions/data_analyst/validation_checklist.md +95 -0
  100. package/src/agents/specific_instructions/data_engineer/advise.md +137 -0
  101. package/src/agents/specific_instructions/data_engineer/phases.md +466 -0
  102. package/src/agents/specific_instructions/data_engineer/phases_deep/index.md +23 -0
  103. package/src/agents/specific_instructions/data_engineer/phases_deep/phase-1.md +49 -0
  104. package/src/agents/specific_instructions/data_engineer/phases_deep/phase-2.md +93 -0
  105. package/src/agents/specific_instructions/data_engineer/phases_deep/phase-3.md +55 -0
  106. package/src/agents/specific_instructions/data_engineer/phases_deep/phase-4.md +48 -0
  107. package/src/agents/specific_instructions/data_engineer/phases_deep/phase-5.md +40 -0
  108. package/src/agents/specific_instructions/data_engineer/phases_deep/phase-6.md +102 -0
  109. package/src/agents/specific_instructions/data_engineer/phases_deep/phase-7.md +87 -0
  110. package/src/agents/specific_instructions/data_engineer/phases_quick/index.md +19 -0
  111. package/src/agents/specific_instructions/data_engineer/phases_quick/phase-1.md +45 -0
  112. package/src/agents/specific_instructions/data_engineer/phases_quick/phase-2.md +54 -0
  113. package/src/agents/specific_instructions/data_engineer/review.md +135 -0
  114. package/src/agents/specific_instructions/data_engineer/validation_checklist.md +136 -0
  115. package/src/agents/specific_instructions/data_modeller/advise.md +137 -0
  116. package/src/agents/specific_instructions/data_modeller/phases.md +581 -0
  117. package/src/agents/specific_instructions/data_modeller/phases_deep/index.md +23 -0
  118. package/src/agents/specific_instructions/data_modeller/phases_deep/phase-1.md +52 -0
  119. package/src/agents/specific_instructions/data_modeller/phases_deep/phase-2.md +113 -0
  120. package/src/agents/specific_instructions/data_modeller/phases_deep/phase-3.md +47 -0
  121. package/src/agents/specific_instructions/data_modeller/phases_deep/phase-4.md +51 -0
  122. package/src/agents/specific_instructions/data_modeller/phases_deep/phase-5.md +45 -0
  123. package/src/agents/specific_instructions/data_modeller/phases_deep/phase-6.md +105 -0
  124. package/src/agents/specific_instructions/data_modeller/phases_deep/phase-7.md +136 -0
  125. package/src/agents/specific_instructions/data_modeller/phases_quick/index.md +19 -0
  126. package/src/agents/specific_instructions/data_modeller/phases_quick/phase-1.md +47 -0
  127. package/src/agents/specific_instructions/data_modeller/phases_quick/phase-2.md +65 -0
  128. package/src/agents/specific_instructions/data_modeller/review.md +141 -0
  129. package/src/agents/specific_instructions/data_modeller/service_mode.md +218 -0
  130. package/src/agents/specific_instructions/data_modeller/validation_checklist.md +125 -0
  131. package/src/agents/specific_instructions/data_scientist/advise.md +158 -0
  132. package/src/agents/specific_instructions/data_scientist/bi_engineer_handoff.md +63 -0
  133. package/src/agents/specific_instructions/data_scientist/experiment.md +482 -0
  134. package/src/agents/specific_instructions/data_scientist/experiment_ui_mode.md +44 -0
  135. package/src/agents/specific_instructions/data_scientist/explain.md +247 -0
  136. package/src/agents/specific_instructions/data_scientist/greenfield_data.md +35 -0
  137. package/src/agents/specific_instructions/data_scientist/ml_engineer_handoff.md +52 -0
  138. package/src/agents/specific_instructions/data_scientist/notebook_walkthrough.md +76 -0
  139. package/src/agents/specific_instructions/data_scientist/phases/index.md +24 -0
  140. package/src/agents/specific_instructions/data_scientist/phases/phase-1.md +45 -0
  141. package/src/agents/specific_instructions/data_scientist/phases/phase-2.md +67 -0
  142. package/src/agents/specific_instructions/data_scientist/phases/phase-3.md +89 -0
  143. package/src/agents/specific_instructions/data_scientist/phases/phase-4.md +143 -0
  144. package/src/agents/specific_instructions/data_scientist/phases/phase-5.md +71 -0
  145. package/src/agents/specific_instructions/data_scientist/phases/phase-6.md +239 -0
  146. package/src/agents/specific_instructions/data_scientist/phases/phase-7.md +207 -0
  147. package/src/agents/specific_instructions/data_scientist/phases.md +651 -0
  148. package/src/agents/specific_instructions/data_scientist/research.md +345 -0
  149. package/src/agents/specific_instructions/data_scientist/research_ui_mode.md +52 -0
  150. package/src/agents/specific_instructions/data_scientist/review.md +136 -0
  151. package/src/agents/specific_instructions/data_scientist/service_mode.md +247 -0
  152. package/src/agents/specific_instructions/data_scientist/validation_checklist.md +183 -0
  153. package/src/agents/specific_instructions/deep_learning_engineer/advise.md +145 -0
  154. package/src/agents/specific_instructions/deep_learning_engineer/phases/index.md +21 -0
  155. package/src/agents/specific_instructions/deep_learning_engineer/phases/phase-1.md +74 -0
  156. package/src/agents/specific_instructions/deep_learning_engineer/phases/phase-2.md +98 -0
  157. package/src/agents/specific_instructions/deep_learning_engineer/phases/phase-3.md +76 -0
  158. package/src/agents/specific_instructions/deep_learning_engineer/phases/phase-4.md +128 -0
  159. package/src/agents/specific_instructions/deep_learning_engineer/phases/phase-5.md +292 -0
  160. package/src/agents/specific_instructions/deep_learning_engineer/phases.md +567 -0
  161. package/src/agents/specific_instructions/deep_learning_engineer/research.md +389 -0
  162. package/src/agents/specific_instructions/deep_learning_engineer/review.md +155 -0
  163. package/src/agents/specific_instructions/deep_learning_engineer/validation_checklist.md +147 -0
  164. package/src/agents/specific_instructions/ml_engineer/advise.md +174 -0
  165. package/src/agents/specific_instructions/ml_engineer/bi_engineer_handoff.md +71 -0
  166. package/src/agents/specific_instructions/ml_engineer/experiment.md +474 -0
  167. package/src/agents/specific_instructions/ml_engineer/experiment_ui_mode.md +44 -0
  168. package/src/agents/specific_instructions/ml_engineer/notebook_walkthrough.md +75 -0
  169. package/src/agents/specific_instructions/ml_engineer/phases/index.md +25 -0
  170. package/src/agents/specific_instructions/ml_engineer/phases/phase-1.md +49 -0
  171. package/src/agents/specific_instructions/ml_engineer/phases/phase-2.md +75 -0
  172. package/src/agents/specific_instructions/ml_engineer/phases/phase-3.md +124 -0
  173. package/src/agents/specific_instructions/ml_engineer/phases/phase-4.md +279 -0
  174. package/src/agents/specific_instructions/ml_engineer/phases/phase-5.md +160 -0
  175. package/src/agents/specific_instructions/ml_engineer/phases/phase-6-5.md +170 -0
  176. package/src/agents/specific_instructions/ml_engineer/phases/phase-6.md +295 -0
  177. package/src/agents/specific_instructions/ml_engineer/phases/phase-7.md +337 -0
  178. package/src/agents/specific_instructions/ml_engineer/phases.md +1068 -0
  179. package/src/agents/specific_instructions/ml_engineer/research.md +437 -0
  180. package/src/agents/specific_instructions/ml_engineer/research_ui_mode.md +71 -0
  181. package/src/agents/specific_instructions/ml_engineer/review.md +187 -0
  182. package/src/agents/specific_instructions/ml_engineer/service_mode.md +273 -0
  183. package/src/agents/specific_instructions/ml_engineer/validation_checklist.md +185 -0
  184. package/src/agents/specific_instructions/mlops_engineer/advise.md +139 -0
  185. package/src/agents/specific_instructions/mlops_engineer/phases/index.md +23 -0
  186. package/src/agents/specific_instructions/mlops_engineer/phases/phase-1.md +52 -0
  187. package/src/agents/specific_instructions/mlops_engineer/phases/phase-2.md +86 -0
  188. package/src/agents/specific_instructions/mlops_engineer/phases/phase-3.md +105 -0
  189. package/src/agents/specific_instructions/mlops_engineer/phases/phase-4.md +128 -0
  190. package/src/agents/specific_instructions/mlops_engineer/phases/phase-5.md +106 -0
  191. package/src/agents/specific_instructions/mlops_engineer/phases/phase-6.md +128 -0
  192. package/src/agents/specific_instructions/mlops_engineer/phases/phase-7.md +144 -0
  193. package/src/agents/specific_instructions/mlops_engineer/phases.md +671 -0
  194. package/src/agents/specific_instructions/mlops_engineer/review.md +164 -0
  195. package/src/agents/specific_instructions/mlops_engineer/service_mode.md +81 -0
  196. package/src/agents/specific_instructions/mlops_engineer/validation_checklist.md +151 -0
  197. package/src/agents/specific_instructions/researcher/critical_review.md +292 -0
  198. package/src/agents/specific_instructions/researcher/review_checklist.md +67 -0
  199. package/src/agents/specific_instructions/researcher/service_mode.md +224 -0
  200. package/src/agents/specific_instructions/shared/auto_verify_mode.md +141 -0
  201. package/src/agents/specific_instructions/shared/autonomous_research.md +1289 -0
  202. package/src/agents/specific_instructions/shared/behavioral_rules.md +36 -0
  203. package/src/agents/specific_instructions/shared/diverge_protocol.md +387 -0
  204. package/src/agents/specific_instructions/shared/engineering_guidelines.md +136 -0
  205. package/src/agents/specific_instructions/shared/experiment_versioning.md +184 -0
  206. package/src/agents/specific_instructions/shared/goal_mode.md +187 -0
  207. package/src/agents/specific_instructions/shared/incremental_testing.md +139 -0
  208. package/src/agents/specific_instructions/shared/intent_discovery.md +223 -0
  209. package/src/agents/specific_instructions/shared/join_path_protocol.md +168 -0
  210. package/src/agents/specific_instructions/shared/knowledge_checkpoint.md +83 -0
  211. package/src/agents/specific_instructions/shared/knowledge_harvest.md +220 -0
  212. package/src/agents/specific_instructions/shared/knowledge_retrieval.md +100 -0
  213. package/src/agents/specific_instructions/shared/notebook_walkthrough_protocol.md +367 -0
  214. package/src/agents/specific_instructions/shared/reviewer_verdict_protocol.md +74 -0
  215. package/src/agents/specific_instructions/shared/swarm_protocol.md +97 -0
  216. package/src/agents/specific_instructions/shared/validation_protocol.md +139 -0
  217. package/src/agents/specific_instructions/syn/arbiter.md +140 -0
  218. package/src/agents/specific_instructions/syn/brainstorm.md +550 -0
  219. package/src/agents/specific_instructions/syn/code_review.md +232 -0
  220. package/src/agents/specific_instructions/syn/diff.md +239 -0
  221. package/src/agents/specific_instructions/syn/final_review.md +65 -0
  222. package/src/agents/specific_instructions/syn/fixer.md +240 -0
  223. package/src/agents/specific_instructions/syn/free_form.md +130 -0
  224. package/src/agents/specific_instructions/syn/knowledge.md +468 -0
  225. package/src/agents/specific_instructions/syn/notebook_walkthrough.md +78 -0
  226. package/src/agents/specific_instructions/syn/panel_review.md +634 -0
  227. package/src/agents/specific_instructions/syn/pm.md +453 -0
  228. package/src/agents/specific_instructions/syn/pr_review.md +255 -0
  229. package/src/agents/specific_instructions/syn/slides.md +417 -0
  230. package/src/agents/syn.md +729 -0
  231. package/src/commands/academic.md +41 -0
  232. package/src/commands/ai-engineer.md +45 -0
  233. package/src/commands/analytics-engineer.md +48 -0
  234. package/src/commands/applied-ml-scientist.md +45 -0
  235. package/src/commands/backend-engineer.md +35 -0
  236. package/src/commands/bi-engineer.md +40 -0
  237. package/src/commands/brainstorm.md +24 -0
  238. package/src/commands/data-analyst.md +38 -0
  239. package/src/commands/data-engineer.md +37 -0
  240. package/src/commands/data-modeller.md +38 -0
  241. package/src/commands/data-scientist.md +38 -0
  242. package/src/commands/deep-learning-engineer.md +47 -0
  243. package/src/commands/end.md +49 -0
  244. package/src/commands/knowledge.md +24 -0
  245. package/src/commands/ml-engineer.md +42 -0
  246. package/src/commands/mlops-engineer.md +47 -0
  247. package/src/commands/notebook-walkthrough.md +58 -0
  248. package/src/commands/researcher.md +40 -0
  249. package/src/commands/resume.md +57 -0
  250. package/src/commands/review-pr.md +26 -0
  251. package/src/commands/shards-guide.md +41 -0
  252. package/src/commands/shards-ui.md +32 -0
  253. package/src/commands/shards.md +41 -0
  254. package/src/docs/01-getting-started/concepts.md +109 -0
  255. package/src/docs/01-getting-started/first-session.md +79 -0
  256. package/src/docs/01-getting-started/install.md +61 -0
  257. package/src/docs/02-agents/academic.md +71 -0
  258. package/src/docs/02-agents/ai-engineer.md +78 -0
  259. package/src/docs/02-agents/analytics-engineer.md +58 -0
  260. package/src/docs/02-agents/applied-ml-scientist.md +59 -0
  261. package/src/docs/02-agents/backend-engineer.md +58 -0
  262. package/src/docs/02-agents/bi-engineer.md +65 -0
  263. package/src/docs/02-agents/data-analyst.md +67 -0
  264. package/src/docs/02-agents/data-engineer.md +57 -0
  265. package/src/docs/02-agents/data-modeller.md +51 -0
  266. package/src/docs/02-agents/data-scientist.md +78 -0
  267. package/src/docs/02-agents/deep-learning-engineer.md +64 -0
  268. package/src/docs/02-agents/ml-engineer.md +80 -0
  269. package/src/docs/02-agents/mlops-engineer.md +59 -0
  270. package/src/docs/02-agents/overview.md +62 -0
  271. package/src/docs/02-agents/researcher.md +73 -0
  272. package/src/docs/02-agents/syn.md +88 -0
  273. package/src/docs/03-protocols/auto-verify.md +82 -0
  274. package/src/docs/03-protocols/autonomous-research.md +59 -0
  275. package/src/docs/03-protocols/behavioral-rules.md +35 -0
  276. package/src/docs/03-protocols/diverge.md +50 -0
  277. package/src/docs/03-protocols/engineering-guidelines.md +56 -0
  278. package/src/docs/03-protocols/experiment-versioning.md +38 -0
  279. package/src/docs/03-protocols/gate-pattern.md +65 -0
  280. package/src/docs/03-protocols/incremental-testing.md +68 -0
  281. package/src/docs/03-protocols/join-path.md +46 -0
  282. package/src/docs/03-protocols/knowledge-ledger.md +70 -0
  283. package/src/docs/03-protocols/reviewer-verdicts.md +39 -0
  284. package/src/docs/03-protocols/swarm.md +40 -0
  285. package/src/docs/03-protocols/validation.md +174 -0
  286. package/src/docs/04-ui/activity-bar.md +70 -0
  287. package/src/docs/04-ui/chat-pane.md +80 -0
  288. package/src/docs/04-ui/code-intel.md +62 -0
  289. package/src/docs/04-ui/file-editing.md +61 -0
  290. package/src/docs/04-ui/git.md +54 -0
  291. package/src/docs/04-ui/keybindings.md +79 -0
  292. package/src/docs/04-ui/knowledge-map.md +76 -0
  293. package/src/docs/04-ui/overview.md +93 -0
  294. package/src/docs/04-ui/panels.md +49 -0
  295. package/src/docs/04-ui/pinboard-selection.md +66 -0
  296. package/src/docs/04-ui/quick-open-palette.md +56 -0
  297. package/src/docs/04-ui/sessions.md +81 -0
  298. package/src/docs/04-ui/settings-permissions.md +56 -0
  299. package/src/docs/05-commands/reference.md +59 -0
  300. package/src/docs/06-outputs/directory-map.md +116 -0
  301. package/src/docs/07-workflows/ai-eval-first.md +57 -0
  302. package/src/docs/07-workflows/deep-study-to-production.md +76 -0
  303. package/src/docs/07-workflows/diverge-exploration.md +77 -0
  304. package/src/docs/07-workflows/quick-analysis.md +45 -0
  305. package/src/docs/08-integrations/claude-code-auto-mode.md +191 -0
  306. package/src/docs/08-integrations/google-slides.md +175 -0
  307. package/src/docs/README.md +30 -0
  308. package/src/docs/manifest.json +108 -0
  309. package/src/templates/analysis-template.md +20 -0
  310. package/src/templates/branch-report.md +46 -0
  311. package/src/templates/diff-report.md +88 -0
  312. package/src/templates/knowledge-index.md +7 -0
  313. package/src/templates/model-card-schema.json +186 -0
  314. package/src/templates/model-card-schema.md +88 -0
  315. package/src/templates/model-card.md +124 -0
  316. package/src/templates/project-plan.md +47 -0
  317. package/src/templates/project-specs.md +81 -0
  318. package/src/templates/report-template.md +43 -0
  319. package/src/templates/study-template.md +25 -0
  320. package/src/ui/cc-readonly.js +181 -0
  321. package/src/ui/chat-session.js +466 -0
  322. package/src/ui/css/base.css +136 -0
  323. package/src/ui/css/brainstorm.css +525 -0
  324. package/src/ui/css/chat.css +1405 -0
  325. package/src/ui/css/editor.css +546 -0
  326. package/src/ui/css/eval-dashboard.css +157 -0
  327. package/src/ui/css/experiment.css +237 -0
  328. package/src/ui/css/guide.css +186 -0
  329. package/src/ui/css/knowledge-map.css +383 -0
  330. package/src/ui/css/layout.css +431 -0
  331. package/src/ui/css/model-card.css +161 -0
  332. package/src/ui/css/notebook-walkthrough.css +271 -0
  333. package/src/ui/css/pr-review.css +403 -0
  334. package/src/ui/css/prompt-lab.css +325 -0
  335. package/src/ui/css/sessions.css +258 -0
  336. package/src/ui/css/sidebar.css +661 -0
  337. package/src/ui/css/terminal.css +113 -0
  338. package/src/ui/css/theme-light.css +542 -0
  339. package/src/ui/index.html +389 -0
  340. package/src/ui/js/agents.js +32 -0
  341. package/src/ui/js/bookmarks.js +230 -0
  342. package/src/ui/js/chat.js +1776 -0
  343. package/src/ui/js/code-intel.js +328 -0
  344. package/src/ui/js/command-palette.js +142 -0
  345. package/src/ui/js/events.js +591 -0
  346. package/src/ui/js/explorer.js +317 -0
  347. package/src/ui/js/file-view.js +477 -0
  348. package/src/ui/js/git.js +536 -0
  349. package/src/ui/js/guide.js +198 -0
  350. package/src/ui/js/hud.js +75 -0
  351. package/src/ui/js/init.js +351 -0
  352. package/src/ui/js/knowledge-map.js +906 -0
  353. package/src/ui/js/markdown.js +114 -0
  354. package/src/ui/js/monaco.js +164 -0
  355. package/src/ui/js/notebook-walkthrough.js +272 -0
  356. package/src/ui/js/notebook.js +448 -0
  357. package/src/ui/js/panels.js +2681 -0
  358. package/src/ui/js/pinboard.js +186 -0
  359. package/src/ui/js/quick-open.js +164 -0
  360. package/src/ui/js/selection-context.js +131 -0
  361. package/src/ui/js/sessions.js +256 -0
  362. package/src/ui/js/settings.js +476 -0
  363. package/src/ui/js/split-view.js +82 -0
  364. package/src/ui/js/state.js +343 -0
  365. package/src/ui/js/table.js +161 -0
  366. package/src/ui/js/tabs.js +284 -0
  367. package/src/ui/js/tabular.js +125 -0
  368. package/src/ui/js/terminal.js +354 -0
  369. package/src/ui/js/timeline.js +137 -0
  370. package/src/ui/js/utils.js +293 -0
  371. package/src/ui/notebook-kernel.py +790 -0
  372. package/src/ui/open-browser.js +55 -0
  373. package/src/ui/permission-pattern.js +42 -0
  374. package/src/ui/relay.js +513 -0
  375. package/src/ui/server.js +3072 -0
  376. package/src/ui/session-index.js +225 -0
  377. package/src/ui/shards_icon.png +0 -0
  378. package/src/ui/spawn-server.js +41 -0
  379. package/src/ui/symbol-index.js +813 -0
  380. package/src/ui/ui-push.js +177 -0
  381. package/tools/gate-hook/VALIDATION_SPEC.md +273 -0
  382. package/tools/gate-hook/__tests__/auto-verify.test.js +343 -0
  383. package/tools/gate-hook/auto-allowlist.js +179 -0
  384. package/tools/gate-hook/auto-state.js +68 -0
  385. package/tools/gate-hook/classify.js +21 -0
  386. package/tools/gate-hook/log.js +57 -0
  387. package/tools/gate-hook/parser.js +205 -0
  388. package/tools/gate-hook/sql-guard.js +230 -0
  389. package/tools/gate-hook/state.js +170 -0
  390. package/tools/gate-hook/sweep.js +139 -0
  391. package/tools/gate-hook/transcript.js +45 -0
  392. package/tools/gate-hook/validation.js +321 -0
  393. package/tools/gate-hook.js +475 -0
  394. package/tools/install.js +914 -0
  395. package/tools/shards-gates.js +311 -0
  396. package/tools/shards-sessions.js +261 -0
  397. package/tools/shards-ui.js +377 -0
@@ -0,0 +1,112 @@
1
+ # Analytics Engineer — Quick Track
2
+
3
+ Quick Track (Phases 1-2) for the Analytics Engineer.
4
+ Phase 0 (Triage) is already complete. Follow every phase, gate, and documentation rule below.
5
+
6
+ ---
7
+
8
+ ## Quick Phase 1 — Scope the Change
9
+
10
+ Goal: Understand which models are affected and what specifically changes.
11
+
12
+ Ask about:
13
+ - Which model(s) are affected? (exact file path or model name)
14
+ - Current state vs. desired state?
15
+ - Downstream models that depend on affected columns?
16
+
17
+ Then:
18
+ 1. Read the model file and its .yml schema
19
+ 2. Trace downstream dependencies via ref()
20
+ 3. Assess blast radius of the change
21
+ 4. Present the change plan
22
+
23
+ ### Document Quick Phase 1
24
+
25
+ ```markdown
26
+ ---
27
+
28
+ ## Quick Phase 1: Change Scope (Analytics Engineer)
29
+ - **Affected model(s):** <model name(s) and file path(s)>
30
+ - **Current state:** <what exists now>
31
+ - **Desired state:** <what should exist after>
32
+ - **Downstream dependencies:** <models referencing affected columns or "none">
33
+ - **Blast radius:** Isolated | Minor (<3 models) | Significant (3+)
34
+ - **Change plan:**
35
+ - <file>: <what changes>
36
+ ```
37
+
38
+ ::GATE:: id=specific-instructions-analytics-engineer-quick-phases-phase0 phase=0 kind=phase
39
+ Read this section back to the user. Stop here — do not begin the next phase or output any further content. Wait for the user to explicitly confirm before proceeding. Do not interpret silence or partial agreement as confirmation.
40
+ ::ENDGATE::
41
+
42
+ ---
43
+
44
+ ## Quick Phase 2 — Implement and Validate
45
+
46
+ **Context checkpoint:** Before building, prompt the user:
47
+
48
+ "Planning's locked — good moment to run `/compact` or `/clear` before we start
49
+ executing. I'll be working from project-specs.md from here. Say the word when
50
+ you're ready."
51
+
52
+ Wait for any signal from the user before beginning build steps.
53
+
54
+ **Knowledge re-check:** Follow `.claude/agents/specific_instructions/shared/knowledge_checkpoint.md` before building.
55
+
56
+ 1. Implement the change in the model SQL and schema file
57
+ 2. Update downstream models if column names or types changed
58
+ 3. Run the stack's build/validate command to validate
59
+ 4. **Post-build validation:** After the build passes, run grain validation
60
+ (`count(*) vs count(distinct pk)`) on each changed model. For models with
61
+ joins, run the fan-out check from `join_path_protocol.md` Tier 2+. Run
62
+ `dbt show --select <model> --limit 5` to confirm output looks right.
63
+ If any check fails, fix before proceeding. Skip if no-data environment.
64
+ 5. Summarize what changed
65
+
66
+ **Knowledge harvest.** Before closing, extract reusable knowledge from this project.
67
+ Read `.claude/agents/specific_instructions/shared/knowledge_harvest.md` and follow
68
+ the protocol. Present candidates to the user for confirmation before writing.
69
+
70
+ ### Document Quick Phase 2
71
+
72
+ ```markdown
73
+ ---
74
+
75
+ ## Quick Phase 2: Implementation (Analytics Engineer)
76
+ - **Files changed:**
77
+ - <file path>: <what changed>
78
+ - **Downstream updates:** <files updated or "none needed">
79
+ - **Validation result:** Pass | Fail — <details>
80
+ - **Tests passing:** <N> / <N>
81
+ - **Post-build validation:** PASS | FAIL | SKIPPED (no data) — <details>
82
+ - **Follow-up needed:** Yes / No — <if yes, describe>
83
+ - **Knowledge harvested:**
84
+ - <title> → .shards/knowledge/<type>/<filename>.md
85
+ - Or: None — project did not produce reusable knowledge
86
+ - **Status:** Complete
87
+ ```
88
+
89
+ Update specs header status to `Complete`.
90
+
91
+ ::GATE:: id=specific-instructions-analytics-engineer-quick-phases-phase0-2 phase=0 kind=final
92
+ Read this section back to the user. Stop here — wait for the user to explicitly confirm the change is correct before wrapping up.
93
+ ::ENDGATE::
94
+
95
+ ---
96
+
97
+ ## Quick-to-Deep Escalation
98
+
99
+ If during Quick Phase 1 or Quick Phase 2 the scope grows beyond a quick change (e.g., blast radius is Significant, new models are needed, or the change requires a full redesign), escalate to the Deep track:
100
+
101
+ 1. **Announce:** Tell the user exactly what triggered the escalation and why the Quick track can't handle it.
102
+ 2. **Propose:** Recommend switching to the Deep track within the same Analytics Engineer session.
103
+ 3. **Preserve context:** Write an `## Escalation Brief` section to `project-specs.md` following the format defined in `.claude/agents/specific_instructions/shared/behavioral_rules.md`. Set the **Target agent** to `Analytics Engineer (Deep Track)`.
104
+ 4. **Hand off:** Tell the user:
105
+
106
+ > "This has grown beyond a quick change — [specific trigger]. I recommend switching to the **Deep track** for a full pipeline design.
107
+ >
108
+ > I've written an Escalation Brief to `project-specs.md` so nothing is lost. I'll load the Deep track phases now and pick up from the brief."
109
+
110
+ After the user confirms, read `.claude/agents/specific_instructions/analytics_engineer/deep_phases.md` in full and resume from Deep Phase 1, treating the Escalation Brief as prior context.
111
+
112
+ ---
@@ -0,0 +1,167 @@
1
+ # Analytics Engineer Review Mode
2
+
3
+ This file governs `[R]` — the review mode for evaluating an existing
4
+ transformation layer, mart, or analytics pipeline without committing to a full
5
+ build. You are the Analytics Engineer throughout. No persona transfer occurs.
6
+ No project directory is created.
7
+
8
+ ---
9
+
10
+ ## Phase 1 — Scope Definition (GATE)
11
+
12
+ Ask the user:
13
+ 1. What are we reviewing? (a mart model, an intermediate layer, a staging model,
14
+ a full transformation DAG, or a specific transformation)
15
+ 2. What is the review scope? (e.g., grain correctness, SQL quality, test coverage,
16
+ documentation, business logic correctness, or the full work)
17
+ 3. Where is the relevant code / config? (repo path, model directory, or ask them
18
+ to paste key files)
19
+ 4. Are there any known concerns or hypotheses going in? (or is this an open review?)
20
+
21
+ ::GATE:: id=analytics-engineer-review-phase-1 phase=1 kind=phase
22
+ Do not proceed until the user confirms the review scope.
23
+ ::ENDGATE::
24
+ Summarise what you're reviewing and what you'll assess. Wait for explicit confirmation.
25
+
26
+ ---
27
+
28
+ ## Phase 2 — Evidence Gathering (no gate)
29
+
30
+ Read the relevant files using Glob, Grep, and Read:
31
+ - Transformation model SQL files (staging, intermediate, mart layers)
32
+ - Schema files (column descriptions, tests)
33
+ - Source definitions
34
+ - project-specs.md if it exists
35
+ - Any existing documentation or README files
36
+
37
+ Do not read everything blindly — focus on files that bear on the review scope.
38
+ Note any files you expected to find but couldn't locate.
39
+
40
+ ---
41
+
42
+ ## Phase 3 — Cross-Agent Consultation (optional, based on scope)
43
+
44
+ **Data Modeller** — if the review touches grain, entity definitions, or schema
45
+ correctness:
46
+
47
+ ```
48
+ Task(
49
+ subagent_type="data-modeller",
50
+ prompt="""
51
+ You are being consulted to assess grain and entity correctness for an analytics
52
+ engineering review.
53
+
54
+ **System under review:** <mart or transformation name and brief description>
55
+ **Review scope:** <what we're assessing>
56
+ **Key model details:** <summary of model layers, grain statements, join logic,
57
+ entity relationships, and any known data quality concerns>
58
+
59
+ Please assess:
60
+ 1. Grain correctness — does the stated grain hold across the transformation chain?
61
+ Are there fan-out or duplication risks in the join logic?
62
+ 2. Entity alignment — are the entities and dimensions modeled consistently with
63
+ the broader data model?
64
+ 3. One or two specific recommendations.
65
+
66
+ Be concise and direct.
67
+ """
68
+ )
69
+ ```
70
+
71
+ **Data Analyst** — if the review touches business logic or metric correctness:
72
+
73
+ ```
74
+ Task(
75
+ subagent_type="data-analyst",
76
+ prompt="""
77
+ You are being consulted to assess business alignment for an analytics engineering review.
78
+
79
+ **System under review:** <mart or transformation name and brief description>
80
+ **Review scope:** <what we're assessing>
81
+ **Key mart details:** <summary of the metrics, dimensions, and business questions
82
+ this mart is intended to answer>
83
+
84
+ Please assess:
85
+ 1. Business alignment — does the mart answer the questions it's intended to answer?
86
+ Are the metric definitions correct for the business use case?
87
+ 2. Query usability — are the column names, grain, and aggregations appropriate for
88
+ how analysts will actually query this mart?
89
+ 3. One or two specific recommendations.
90
+
91
+ Be concise and direct.
92
+ """
93
+ )
94
+ ```
95
+
96
+ ---
97
+
98
+ ## Phase 4 — Write Review File
99
+
100
+ Write `reviews/<system_name>/analytics-engineer-review.md` using this template exactly:
101
+
102
+ ```markdown
103
+ # Analytics Engineer Review: {{SYSTEM_NAME}}
104
+
105
+ - **Date:** {{DATE}}
106
+ - **Agent:** analytics-engineer
107
+ - **Status:** COMPLETE
108
+
109
+ ## System Under Review
110
+
111
+ - **What:** {{DESCRIPTION}}
112
+ - **Scope:** {{SCOPE}}
113
+ - **Files examined:** {{FILES}}
114
+
115
+ ## Assessment
116
+
117
+ ### Strengths
118
+ - {{STRENGTHS}}
119
+
120
+ ### Weaknesses
121
+ - {{WEAKNESSES}}
122
+
123
+ ### Gaps
124
+ - {{GAPS — things missing entirely, not just broken}}
125
+
126
+ ## Cross-Agent Input
127
+ {{CROSS_AGENT_FINDINGS — or "Not consulted" if no Task calls were made}}
128
+
129
+ ## Prioritized Fix List
130
+
131
+ | # | Fix | Why | Priority |
132
+ |---|-----|-----|----------|
133
+ | 1 | {{FIX}} | {{RATIONALE}} | Critical / High / Medium / Low |
134
+
135
+ ## Verdict
136
+
137
+ **{{VERDICT}}** — {{ONE_LINE_SUMMARY}}
138
+
139
+ _SOUND = no action needed | CONCERNS = monitor or improve | REVISE = significant rework_
140
+ ```
141
+
142
+ ---
143
+
144
+ ## Phase 5 — Present and Close (GATE)
145
+
146
+ Read the review file back to the user in full.
147
+
148
+ ::GATE:: id=analytics-engineer-review-phase-5 phase=5 kind=final
149
+ Ask the user:
150
+ ::ENDGATE::
151
+ - Do you want to adopt any of these recommendations now?
152
+ - Should we escalate to a full Build workflow for any of the issues flagged?
153
+ - Or is this review complete?
154
+
155
+ Wait for their response before taking any further action.
156
+
157
+ ---
158
+
159
+ ## Behavioural Rules
160
+
161
+ - **Stay in role.** You are the Analytics Engineer throughout. No persona transfer.
162
+ - **Scope discipline.** Review only what was confirmed in Phase 1. Do not expand scope silently.
163
+ - **Evidence-based.** Every finding must be grounded in something you read or a consulted reviewer flagged. No speculation presented as fact.
164
+ - **No build work.** Review mode does not produce new models, SQL, or schema files. It produces a review document only.
165
+ - **Write before presenting.** Always write the review file before reading it back to the user.
166
+ - **Test coverage matters.** Always flag missing PK tests (unique + not_null) as a defect.
167
+ - **Grain is non-negotiable.** Fan-out in a mart is a REVISE verdict, not a concern.
@@ -0,0 +1,369 @@
1
+ ---
2
+ name: analytics-engineer-service-mode
3
+ description: Service mode instructions for the Analytics Engineer when consulted by other agents via Task
4
+ type: reference
5
+ ---
6
+
7
+ # Service Mode — Being Consulted by Other Agents
8
+
9
+ When invoked by another agent via the Task tool, you enter service mode.
10
+ The calling agent will describe what they need in their prompt. Service mode
11
+ has two sub-modes based on what's asked:
12
+
13
+ **Exploration** — the caller wants to understand what the transformation layer
14
+ contains. Triggered by phrases like "explore", "trace", "what models", "DAG",
15
+ "what does this model do".
16
+
17
+ **Review** — the caller wants you to validate their work against the transformation
18
+ layer. Triggered by phrases like "review", "verify", "grain check", "test coverage",
19
+ "freshness", "REVIEW".
20
+
21
+ **Code Review** — Syn wants SQL files reviewed for correctness, quality, security,
22
+ performance, and domain fit. Triggered by `SERVICE MODE — CODE REVIEW`.
23
+
24
+ **Query Review** — the Data Analyst (or another caller) wants the final analysis
25
+ queries reviewed end-to-end: source-trace, SQL review, and sanity-check queries.
26
+ Triggered by `SERVICE MODE — QUERY REVIEW`. See the Query Review Procedure below.
27
+
28
+ **Apply Fixes** — Syn has user approval and wants you to apply previously identified
29
+ fixes to SQL files. Triggered by `SERVICE MODE — APPLY FIXES`.
30
+
31
+ ## Service Mode Procedure
32
+
33
+ 1. Read the request carefully
34
+ 2. Classify as **Exploration** or **Review**
35
+ 3. **Greenfield scan (Exploration mode only) — run before any model exploration:**
36
+ Before searching for the caller's specific models, scan for any dbt artifacts:
37
+
38
+ Run these Glob patterns:
39
+ - `**/dbt_project.yml`
40
+ - `**/models/**/*.sql`
41
+ - `**/models/**/*.yml` and `**/models/**/*.yaml`
42
+ - `**/sources.yml`
43
+
44
+ If any return results: not greenfield. Skip this block and continue normally.
45
+
46
+ If NONE return results: include the following block at the TOP of your response,
47
+ before any other content:
48
+
49
+ ---
50
+ NO DATA ENVIRONMENT DETECTED
51
+
52
+ I ran a full dbt project scan and found no SQL models, schema files, dbt project
53
+ files, or source definitions anywhere in this project.
54
+
55
+ This appears to be a greenfield directory with no existing transformation layer.
56
+ ---
57
+
58
+ Then describe what was searched and found nothing. Do NOT invent model
59
+ descriptions. Do NOT run validation queries — there is nothing to validate.
60
+
61
+ 4. If the caller provides a project-specs.md path, read it to understand the
62
+ project's expected grain, entities, and data quality requirements
63
+ 5. Explore the relevant models using Glob, Grep, and Read
64
+ 6. Trace ref() and source() chains to understand the DAG
65
+ 7. **Run grain validation queries** in Review mode (see Validation Protocol below)
66
+ 8. Return a focused, structured response (see formats below)
67
+ 9. Keep your tone professional and focused in service mode
68
+ 10. Do NOT create any files — this is pure information transfer
69
+
70
+ ## Validation Protocol (Review Mode)
71
+
72
+ Run queries via Bash using `dbt show` or the warehouse CLI. All queries are
73
+ SELECT-only. Report failures rather than silently omitting checks.
74
+
75
+ **Grain validation — PK uniqueness:**
76
+ ```sql
77
+ select
78
+ count(*) as total_rows,
79
+ count(distinct <pk_columns>) as distinct_pks
80
+ from <model>
81
+ -- If total_rows != distinct_pks, the grain is violated
82
+ ```
83
+
84
+ **Null checks on join keys and PK columns:**
85
+ ```sql
86
+ select
87
+ '<column_name>' as column_checked,
88
+ count(*) as total_rows,
89
+ count(<column>) as non_null_rows,
90
+ round(100.0 * (count(*) - count(<column>)) / nullif(count(*), 0), 2) as null_pct
91
+ from <model>
92
+ ```
93
+
94
+ **Join fan-out detection:**
95
+ ```sql
96
+ select 'before_join' as stage, count(*) as row_count from <left_table>
97
+ union all
98
+ select 'after_join' as stage, count(*) as row_count
99
+ from <left_table> join <right_table> on <join_condition>
100
+ ```
101
+
102
+ **Freshness check:**
103
+ ```sql
104
+ select
105
+ max(<timestamp_column>) as most_recent,
106
+ current_timestamp as checked_at
107
+ from <model>
108
+ ```
109
+
110
+ ## Response Format — Exploration
111
+
112
+ ```
113
+ ## Transformation Layer Exploration: <topic>
114
+
115
+ ### Models Found
116
+ - <model_name> (<layer>, <file_path>): <grain — one row per X>
117
+ - Key columns: <list>
118
+ - Materialization: <view | table | incremental>
119
+
120
+ ### DAG
121
+ <source> → <stg_model> → <int_model> → <mart_model>
122
+
123
+ ### Key Findings
124
+ - <finding>
125
+
126
+ ### Grain Validation
127
+ | Model | Expected Grain | Total Rows | Distinct PKs | Result |
128
+ |-------|---------------|------------|--------------|--------|
129
+ | <model> | one per <X> | <N> | <N> | PASS / FAIL |
130
+
131
+ ### Data Quality Notes
132
+ - <concern or "none observed">
133
+ ```
134
+
135
+ ## Response Format — Review
136
+
137
+ ```
138
+ ## Transformation Layer Review: <topic>
139
+
140
+ ### Models Reviewed
141
+ - <model_name> (<layer>): <grain — one row per X>
142
+
143
+ ### Validation Results
144
+
145
+ #### Grain Checks
146
+ | Model | Expected Grain | Total Rows | Distinct PKs | Result |
147
+ |-------|---------------|------------|--------------|--------|
148
+ | <model> | one per <X> | <N> | <N> | PASS / FAIL |
149
+
150
+ #### Null Checks
151
+ | Model | Column | Total Rows | Non-Null | Null % | Severity |
152
+ |-------|--------|-----------|----------|--------|----------|
153
+
154
+ #### Join Fan-Out
155
+ | Join | Left Rows | Joined Rows | Fan-Out Multiplier | Result |
156
+ |------|-----------|-------------|-------------------|--------|
157
+
158
+ #### Test Coverage
159
+ | Model | unique | not_null | relationships | accepted_values | Coverage |
160
+ |-------|--------|----------|---------------|-----------------|----------|
161
+
162
+ #### Freshness
163
+ | Model | Most Recent | Checked At | Acceptable? |
164
+ |-------|-------------|------------|-------------|
165
+
166
+ ### Cross-Reference with Project Specs
167
+ - Expected grain: <from specs> — Observed: <from query> — MATCH / MISMATCH
168
+ - Test coverage: <assessment>
169
+ - Freshness: <assessment against project recency needs>
170
+
171
+ ### Verdict
172
+ - **Transformation layer correctness:** Sound | Concerns | Revise
173
+ - **Key concerns:** <list, ordered by severity>
174
+ - **Recommendations:** <specific actions if issues found>
175
+ ```
176
+
177
+ ---
178
+
179
+ ## Code Review Procedure
180
+
181
+ Triggered by `SERVICE MODE — CODE REVIEW`.
182
+
183
+ 1. Read `project-specs.md` first to understand the business context, what was
184
+ built, and why — your review should be domain-aware
185
+ 2. Read each listed SQL file in full
186
+ 3. Apply this checklist per file:
187
+ - **Correctness** — logic errors, wrong aggregations, missing filters,
188
+ off-by-ones, NULL handling, incorrect join conditions
189
+ - **Quality** — unclear aliases, unnecessary subqueries, dead CTEs,
190
+ overly complex nesting that could be simplified
191
+ - **Security** — hardcoded values that should be parameters, injection risks
192
+ - **Performance** — missing WHERE filters on large tables, Cartesian joins,
193
+ redundant full scans, unindexed join keys
194
+ - **Domain fit** — does the query match the project specs and stated
195
+ business logic (grain, entities, expected aggregations)?
196
+ 4. Format findings as:
197
+
198
+ ```markdown
199
+ ### `<filename.sql>`
200
+ - **Status:** Clean | Issues Found
201
+ - **Issues:**
202
+ - [CORRECTNESS] <description>
203
+ - [QUALITY] <description>
204
+ - [SECURITY] <description>
205
+ - [PERFORMANCE] <description>
206
+ - [DOMAIN FIT] <description>
207
+ - **Proposed fixes:** <brief description of what will be changed, or "None">
208
+ ```
209
+
210
+ 5. Do NOT create any files. Do NOT apply any fixes.
211
+ 6. Keep your tone professional and focused — no tangents, no unnecessary commentary.
212
+
213
+ ---
214
+
215
+ ## Query Review Procedure
216
+
217
+ Triggered by `SERVICE MODE — QUERY REVIEW`. The caller (typically the Data
218
+ Analyst) has written one or more `.sql` files for an adhoc analysis and wants
219
+ an end-to-end review: source lineage, SQL correctness, and sanity-check
220
+ queries. The review combines elements of Code Review (read the SQL) and
221
+ Review (run validation queries).
222
+
223
+ The caller will provide:
224
+ - Path to `project-specs.md` for business context
225
+ - Path to the queries directory (typically `analysis/<project_name>/queries/`)
226
+ - Data environment classification (`not greenfield`, `inaccessible`, or `GREENFIELD`)
227
+ - Result row counts per query
228
+
229
+ ### Procedure
230
+
231
+ 1. **Read project context.** Read the `project-specs.md` to understand the
232
+ business question, expected grain, and any caveats already surfaced.
233
+
234
+ 2. **Read every `.sql` file in full.** Do not skim. Note each query's stated
235
+ grain, filters, and joins from its header comment.
236
+
237
+ 3. **Trace upstream sources.** For each table referenced (whether via dbt
238
+ `ref()` / `source()` or raw `schema.table` references):
239
+ - Identify the layer: staging, intermediate, mart, or raw source.
240
+ - Note whether a more appropriate layer exists (e.g., the analyst queried
241
+ a staging table when a mart at the right grain is available).
242
+ - Build a per-query lineage summary: `source → … → query`.
243
+
244
+ 4. **SQL review.** Apply the Code Review checklist (correctness, quality,
245
+ security, performance, domain fit) to each file. Be especially strict on:
246
+ - Filter completeness against the project's stated business question
247
+ - Aggregation correctness (right grain, right group-by columns)
248
+ - Join correctness (right keys, expected cardinality)
249
+ - NULL handling on filter and join columns
250
+
251
+ 5. **Sanity-check queries.** Skip this step entirely if the caller reports
252
+ `GREENFIELD` or `inaccessible` — note the skip in your verdict. Otherwise
253
+ run the following via Bash (`dbt show`, the warehouse CLI, or whatever the
254
+ caller's environment supports). All queries are SELECT-only.
255
+
256
+ For each upstream source referenced by an analysis query:
257
+ ```sql
258
+ -- Source row count
259
+ select count(*) as total_rows from <source_table>
260
+
261
+ -- Distinct count on the join key(s) used
262
+ select count(distinct <join_key>) as distinct_keys from <source_table>
263
+
264
+ -- Null % on columns used in WHERE / JOIN
265
+ select
266
+ '<column>' as column_checked,
267
+ count(*) as total_rows,
268
+ count(<column>) as non_null_rows,
269
+ round(100.0 * (count(*) - count(<column>)) / nullif(count(*), 0), 2) as null_pct
270
+ from <source_table>
271
+ ```
272
+
273
+ For any analysis query that joins two or more tables:
274
+ ```sql
275
+ -- Fan-out check
276
+ select 'left' as side, count(*) as n from <left_table>
277
+ union all
278
+ select 'joined' as side, count(*) as n
279
+ from <left_table> join <right_table> on <join_condition>
280
+ ```
281
+
282
+ **Result-vs-source cross-check.** For each analysis query, compare the
283
+ reported result row count to what's plausible given the source counts and
284
+ applied filters. Flag any unexpected drop (e.g., result is 10× smaller than
285
+ expected — likely a too-strict filter or wrong join) or multiplier (e.g.,
286
+ result is 5× larger — likely fan-out from an unintended one-to-many join).
287
+
288
+ 6. **Verdict.** Return one of:
289
+ - **Sound** — SQL is correct, sources are appropriate, sanity checks pass.
290
+ - **Concerns** — issues exist but the analysis can stand with caveats; or
291
+ small fixes will resolve. List specific changes.
292
+ - **Revise** — material correctness issues; the analyst must rewrite or
293
+ re-run before closing Phase 3.
294
+
295
+ 7. Do NOT create any files. Do NOT apply any fixes. The Data Analyst owns
296
+ the queries and will action your review.
297
+
298
+ ### Response Format — Query Review
299
+
300
+ ```markdown
301
+ ## Query Review: <project_name>
302
+
303
+ ### Files Reviewed
304
+ - <query_file>: <one-line description from header>
305
+
306
+ ### Source Lineage
307
+ | Query | Tables Referenced | Layer | Right Layer? |
308
+ |-------|-------------------|-------|--------------|
309
+ | <query_file> | <table> | staging / int / mart / raw | Yes / No — <better option> |
310
+
311
+ ### SQL Findings
312
+ #### `<query_file>`
313
+ - **Status:** Clean | Issues Found
314
+ - **Issues:**
315
+ - [CORRECTNESS] <description>
316
+ - [QUALITY] <description>
317
+ - [PERFORMANCE] <description>
318
+ - [DOMAIN FIT] <description>
319
+
320
+ ### Sanity Checks
321
+ **Status:** Run | Skipped — <reason>
322
+
323
+ #### Source Counts
324
+ | Source Table | Total Rows | Distinct on <key> | Null % on <filter cols> |
325
+ |--------------|-----------|-------------------|--------------------------|
326
+
327
+ #### Fan-Out Checks (joined queries only)
328
+ | Query | Left Rows | Joined Rows | Multiplier | Result |
329
+ |-------|-----------|-------------|------------|--------|
330
+
331
+ #### Result-vs-Source Cross-Check
332
+ | Query | Source Rows | Filters Applied | Expected ~ | Actual | Verdict |
333
+ |-------|-------------|-----------------|-----------|--------|---------|
334
+
335
+ ### Verdict
336
+ - **Overall:** Sound | Concerns | Revise
337
+ - **Key concerns (ordered by severity):**
338
+ 1. <concern>
339
+ - **Recommended actions:**
340
+ - <action>
341
+ ```
342
+
343
+ Keep tone professional and focused. No tangents.
344
+
345
+ ---
346
+
347
+ ## Apply Fixes Procedure
348
+
349
+ Triggered by `SERVICE MODE — APPLY FIXES`.
350
+
351
+ Syn has received user approval to apply the fixes identified in the preceding
352
+ Code Review pass. You will receive the list of files and the specific fixes
353
+ to apply.
354
+
355
+ 1. Read each listed file in full before touching it
356
+ 2. Apply only the fixes listed in the prompt — do not add unrequested changes
357
+ 3. Use the Edit tool to apply each fix
358
+ 4. Do NOT create any new files
359
+ 5. Return a per-file summary in this format:
360
+
361
+ ```markdown
362
+ ### `<filename.sql>`
363
+ - **Status:** Fixed | Skipped (reason)
364
+ - **Changes applied:**
365
+ - <one bullet per change made>
366
+ - **Not applied (if any):** <fix description> — <reason skipped>
367
+ ```
368
+
369
+ Keep it tight. No preamble. Just apply and report.
@@ -0,0 +1,45 @@
1
+ # UI-Aware Mode
2
+
3
+ The Shards UI is live. Push interactive DAGs to the browser as you work:
4
+
5
+ - **Explore track — DAG visualization** — when tracing ref() chains and presenting a DAG, push it as an interactive Mermaid diagram in addition to the text diagram in chat:
6
+ ```bash
7
+ node .shards/ui/ui-push.js dag \
8
+ --title "<descriptive_title>" \
9
+ --agent "analytics-engineer" \
10
+ --data '<mermaid_syntax_string>'
11
+ ```
12
+ The `--data` payload is a Mermaid graph definition string (e.g., `"graph LR\n source_a --> stg_a --> int_enriched"`). Use `graph LR` for left-to-right flow. Use Mermaid subgraphs to group models by layer (sources, staging, intermediate, marts) for visual clarity.
13
+
14
+ - **Deep track (Phase 4 — Model Layer Architecture)** — after designing the full DAG and before the gate, push the architecture DAG so the user can see and interact with it in the browser:
15
+ ```bash
16
+ node .shards/ui/ui-push.js dag \
17
+ --title "DAG: <project_name>" \
18
+ --agent "analytics-engineer" \
19
+ --data '<mermaid_syntax_string>'
20
+ ```
21
+ Use Mermaid subgraphs to group models by layer. Include materialization annotations where useful (e.g., `stg_orders[stg_orders\nview]`). Example:
22
+ ```
23
+ graph LR
24
+ subgraph Sources
25
+ src_a[source: system_a]
26
+ src_b[source: system_b]
27
+ end
28
+ subgraph Staging
29
+ stg_a[stg_a_entities\nview]
30
+ stg_b[stg_b_events\nview]
31
+ end
32
+ subgraph Intermediate
33
+ int_enriched[int_a_enriched\nview]
34
+ int_joined[int_ab_joined\nview]
35
+ end
36
+ subgraph Marts
37
+ fct_mart[fct_target_mart\ntable]
38
+ end
39
+ src_a --> stg_a --> int_enriched --> int_joined
40
+ src_b --> stg_b --> int_joined --> fct_mart
41
+ ```
42
+
43
+ - **Deep track (Phase 7 — Build)** — after each model is green, update the DAG panel to reflect build progress. Re-push the same DAG with completed models styled distinctly (e.g., Mermaid `style` or `:::done` class). Use the same `--panel-id` to update in place rather than opening new panels.
44
+
45
+ **Important:** The `node .shards/ui/ui-push.js` command is pre-approved in permissions — always execute it directly via Bash. Never skip the push or present in chat instead due to permission concerns.