@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,184 @@
1
+ ---
2
+ name: experiment-versioning
3
+ description: >
4
+ Versioning protocol for experiment mode. Detects DVC or git availability
5
+ and creates checkpoints after each experiment result. Referenced by all
6
+ experiment-capable agents during their Phase 2 loop.
7
+ type: reference
8
+ ---
9
+
10
+ # Experiment Versioning Protocol
11
+
12
+ This protocol governs artifact versioning during experiment mode. It is
13
+ referenced by all experiment-capable agents (ML Engineer, AI Engineer, Data
14
+ Scientist) at specific points in their experiment workflow.
15
+
16
+ ---
17
+
18
+ ## Section A — Detection
19
+
20
+ Run this section once during Setup, after establishing the `experiments/`
21
+ subdirectory and before agreeing on experiment parameters with the user.
22
+
23
+ 1. Run `dvc version` via Bash. If it succeeds, check whether `.dvc/` exists at
24
+ the repository root (`ls -d .dvc/ 2>/dev/null`).
25
+ - If both succeed: versioning mode is **dvc**.
26
+ - If `dvc version` fails or `.dvc/` does not exist: proceed to step 2.
27
+
28
+ 2. Run `git rev-parse --is-inside-work-tree` via Bash.
29
+ - If it succeeds: versioning mode is **git**.
30
+ - If it fails: versioning mode is **none**.
31
+
32
+ 3. Announce the result to the user:
33
+ - **dvc:** "Experiment versioning enabled via DVC. Checkpoints will be
34
+ created after each experiment — you can restore any previous state."
35
+ - **git:** "Experiment versioning enabled via git. Tags and commits will be
36
+ created after each experiment — you can restore any previous state with
37
+ `git checkout <tag>`."
38
+ - **none:** "No DVC or git detected. Experiment versioning is disabled —
39
+ results will be tracked in markdown and JSON only. To enable versioning,
40
+ initialize a git repo (`git init`) before running experiments."
41
+
42
+ 4. If versioning mode is **dvc** or **git**: run `git status --porcelain` and
43
+ check for uncommitted changes outside the experiment directory. If there are
44
+ uncommitted changes, warn the user:
45
+ "There are uncommitted changes in this repo. Experiment checkpoints will
46
+ commit experiment files only — your other changes will remain unstaged.
47
+ Consider committing or stashing your work before starting experiments."
48
+
49
+ Record the versioning mode internally — you will reference it in Section B
50
+ and Section E.
51
+
52
+ ---
53
+
54
+ ## Section B — Checkpoint Creation
55
+
56
+ Run this section after each experiment's results are written (after updating
57
+ `experiments/results.json` and writing the experiment result file), and before
58
+ consulting the reviewer (Data Scientist or Researcher).
59
+
60
+ ### If versioning mode is `none`:
61
+
62
+ Skip this section silently. Do not print anything.
63
+
64
+ ### If versioning mode is `git`:
65
+
66
+ Run the following commands via Bash. If any command fails, follow Section C
67
+ (Error Handling) and continue.
68
+
69
+ ```bash
70
+ # Stage experiment files and any files modified during this experiment
71
+ git add experiments/
72
+
73
+ # Also stage any other files you modified during this experiment's
74
+ # implementation step (Step 2). You know which files you changed —
75
+ # add them explicitly by path.
76
+ git add <paths of files modified in Step 2>
77
+
78
+ # Commit with standardized message
79
+ git commit -m "experiment: <N> <name> — <outcome_metric> delta: <delta>"
80
+
81
+ # Create annotated tag with metrics in the message
82
+ git tag -a "exp/<project_name>/<N>-<name>" \
83
+ -m "Experiment <N>: <name> | <outcome_metric>: <before> -> <after> (delta: <delta>)"
84
+ ```
85
+
86
+ After a successful checkpoint, capture the commit SHA:
87
+ ```bash
88
+ git rev-parse HEAD
89
+ ```
90
+
91
+ Record the tag name and commit SHA — you will write them to `results.json`.
92
+
93
+ ### If versioning mode is `dvc`:
94
+
95
+ Run the same git commands as above (stage, commit, tag). Additionally, before
96
+ staging:
97
+
98
+ 1. Check if any large artifacts were produced by this experiment (model files,
99
+ serialized objects, datasets > 10MB). If so, run `dvc add <artifact_path>`
100
+ for each large artifact before `git add`.
101
+
102
+ 2. After the git commit and tag, attempt `dvc push` via Bash. If it fails
103
+ (no remote configured), print a one-line note: "DVC push skipped — no
104
+ remote configured." Do not treat this as an error.
105
+
106
+ Record the tag name and commit SHA as with git mode.
107
+
108
+ ---
109
+
110
+ ## Section C — Error Handling
111
+
112
+ If any git or dvc command fails during checkpoint creation:
113
+
114
+ 1. Print a warning: "Checkpoint creation failed: `<error message>`.
115
+ Continuing without versioning for this experiment."
116
+ 2. Do **NOT** stop the experiment loop.
117
+ 3. Do **NOT** retry the failed command.
118
+ 4. In the experiment result file (`experiments/experiment_<N>_<name>.md`),
119
+ append a section:
120
+
121
+ ```markdown
122
+ ## Versioning
123
+ - **Status:** Failed
124
+ - **Reason:** <error message>
125
+ ```
126
+
127
+ 5. Set the `checkpoint` field in `results.json` to:
128
+ ```json
129
+ {
130
+ "type": null,
131
+ "tag": null,
132
+ "commit": null,
133
+ "error": "<error message>"
134
+ }
135
+ ```
136
+
137
+ ---
138
+
139
+ ## Section D — JSON Schema Additions
140
+
141
+ ### Top-level field (add during results.json initialization in Phase 1)
142
+
143
+ Add this field to the root of `results.json`:
144
+
145
+ ```json
146
+ "versioningMode": "dvc" | "git" | "none"
147
+ ```
148
+
149
+ ### Per-experiment field (add to each experiment entry in Phase 2 Step 5)
150
+
151
+ Add this field to each experiment object in the `experiments` array:
152
+
153
+ ```json
154
+ "checkpoint": {
155
+ "type": "git" | "dvc" | null,
156
+ "tag": "exp/<project_name>/<N>-<name>" | null,
157
+ "commit": "<sha>" | null
158
+ }
159
+ ```
160
+
161
+ If versioning mode is `none`, set the entire `checkpoint` object to:
162
+ ```json
163
+ "checkpoint": { "type": null, "tag": null, "commit": null }
164
+ ```
165
+
166
+ ---
167
+
168
+ ## Section E — Summary Enhancement
169
+
170
+ In Phase 3, after writing `experiments/experiment_summary.md`, append this
171
+ section if versioning mode is not `none`:
172
+
173
+ ```markdown
174
+ ## Versioning
175
+
176
+ - **Mode:** <DVC | git>
177
+ - **Checkpoints created:** <count of experiments with successful checkpoints>
178
+ - **Failed checkpoints:** <count, or "none">
179
+ - **Tag prefix:** `exp/<project_name>/`
180
+ - **To restore experiment N:** `git checkout exp/<project_name>/<N>-<name>`
181
+ - **To list all experiment tags:** `git tag -l "exp/<project_name>/*" -n1`
182
+ ```
183
+
184
+ If versioning mode is `none`, do not append this section.
@@ -0,0 +1,187 @@
1
+ ---
2
+ name: goal-mode-protocol
3
+ description: Shared protocol — opt-in /goal activation for gate-free autonomous loops (AR Phase 2 and Experiment Phase 2)
4
+ type: reference
5
+ ---
6
+
7
+ # `/goal` Mode Protocol
8
+
9
+ `/goal <condition>` (Claude Code v2.1.139+) is a session-scoped, prompt-based
10
+ Stop hook. After every turn, a small fast model (Haiku by default) reads the
11
+ condition + the conversation transcript and decides yes/no. "No" feeds the
12
+ reason back as next-turn guidance; "yes" clears the goal and logs the
13
+ achievement.
14
+
15
+ This protocol governs how Shards specialists *propose* a `/goal` to drive their
16
+ **gate-free autonomous loops**:
17
+
18
+ - AR Phase 2 (per `shared/autonomous_research.md` Section B)
19
+ - Experiment Phase 2 (per each agent's `experiment.md`)
20
+
21
+ The agent never runs `/goal` itself — slash commands are user-typed. The agent
22
+ composes a sound condition, prints it as a copy-paste block at the pre-loop
23
+ gate, and the user decides whether to activate it.
24
+
25
+ Outside the two phases listed above, gates fire on every turn anyway, so
26
+ `/goal` would have no effect.
27
+
28
+ ## Eligibility
29
+
30
+ Before proposing a goal, confirm all of:
31
+
32
+ 1. **Mode.** AR Phase 2 or Experiment Phase 2. Not Phase 0/1/3 — those are gated.
33
+ 2. **Versioning.** AR requires git/DVC for auto-revert (already enforced at Phase 0). `/goal` does not change this.
34
+ 3. **Hooks enabled.** `/goal` is unavailable when `disableAllHooks` or `allowManagedHooksOnly` is set anywhere in settings. If the user reports the command is rejected, accept that and proceed — §E convergence and §G safety rails still terminate the loop.
35
+ 4. **Claude Code version.** v2.1.139 or later. If the user's Code is older, skip the proposal silently.
36
+
37
+ If any condition fails, the loop runs exactly as designed without `/goal` —
38
+ this is a quality-of-life layer, not a hard dependency.
39
+
40
+ ## Activation flow
41
+
42
+ The agent **cannot** issue `/goal` itself. The flow is:
43
+
44
+ 1. At the pre-loop gate (AR Phase 1 or Experiment Phase 1), compose the goal
45
+ condition from the Phase 0 parameters: primary/outcome metric, target,
46
+ iteration/experiment budget, metric floor, cost ceiling.
47
+ 2. Print the candidate condition in a copy-paste block **before** emitting
48
+ the Phase 1 gate fence.
49
+ 3. Tell the user the activation is optional — autonomy quality-of-life on top
50
+ of the existing stop logic.
51
+ 4. The user either pastes the `/goal …` command (autonomous mode) or skips
52
+ (the existing in-loop convergence/stop logic alone drives the loop).
53
+ 5. After the Phase 1 gate confirms, proceed to Phase 2 normally.
54
+
55
+ `/goal` clears itself when the condition holds — the agent's Phase 3 summary
56
+ turn is the natural "yes" boundary. If the user wants to abort early, they run
57
+ `/goal clear`. Steering Notes "STOP" (AR §B.1) still works regardless.
58
+
59
+ ## Writing a sound condition
60
+
61
+ The evaluator has **no tools** — it only reads the conversation transcript. A
62
+ condition that depends on a file the agent never echoes will never resolve.
63
+ Three rules:
64
+
65
+ 1. **Anchor every clause to evidence surfaced inline.** Phrase clauses as
66
+ "the most recent inline iteration summary shows …", not "the file
67
+ contains …". The transcript-discipline echoes (see below) are the substrate.
68
+ 2. **Always include a turn bound as a backstop.** `Or stop after <budget+5>
69
+ turns` prevents a malformed condition from looping forever.
70
+ 3. **Keep it under 4,000 characters.** Concise conditions evaluate faster
71
+ and more reliably.
72
+
73
+ ### Template — AR (autonomous research)
74
+
75
+ ```text
76
+ /goal The AR loop is complete when ANY of the following is true:
77
+ (a) the most recent inline iteration summary shows <primary_metric_name>
78
+ has <crossed target value X in the maximize direction |
79
+ dropped below target value X in the minimize direction>;
80
+ (b) the most recent iteration summary or status line contains
81
+ "Convergence detected" with reason in {plateau, diminishing-returns,
82
+ budget-exhausted, cost-ceiling, consecutive-failures,
83
+ metric-floor-breach, user-interrupt, reviewer-pause,
84
+ scope-violation, error-limit, timeout-limit};
85
+ (c) the agent has begun writing the Phase 3 research summary (look for
86
+ "Phase 3" or "research_summary.md").
87
+ Or stop after <budget+5> turns.
88
+ ```
89
+
90
+ ### Template — Experiment
91
+
92
+ ```text
93
+ /goal The experiment run is complete when ANY of the following is true:
94
+ (a) the most recent inline experiment summary shows <outcome_metric>
95
+ has <reached or exceeded <success_threshold> if the metric is being
96
+ maximized | dropped to or below <success_threshold> if the metric is
97
+ being minimized>;
98
+ (b) the agent has printed "Experiment <N> complete" with N == <planned_count>;
99
+ (c) the agent has begun writing the Phase 3 summary (look for
100
+ "experiment_summary.md" or "Phase 3").
101
+ Or stop after <planned_count+3> turns.
102
+ ```
103
+
104
+ If no success threshold was set, drop clause (a) and rely on (b) and (c).
105
+
106
+ ## Transcript discipline (required when `/goal` is active)
107
+
108
+ The evaluator only reads the conversation. Each iteration the agent already
109
+ announces and writes a per-iteration file. With `/goal` active, the agent
110
+ **must** also print an inline iteration summary in the same assistant turn
111
+ that closes the iteration. The required shape:
112
+
113
+ For AR iterations:
114
+
115
+ ```text
116
+ [AR] Iteration N complete.
117
+ Primary metric: <metric_name> <before> → <after> (delta: <+/->)
118
+ Auto-decision: <GREEN | RED | YELLOW> — <one-sentence reason>
119
+ Action: <Kept | Reverted | Kept with next-steps>
120
+ ```
121
+
122
+ For Experiment iterations:
123
+
124
+ ```text
125
+ Experiment N complete.
126
+ Outcome metric: <metric_name> <before> → <after> (<+/->)
127
+ Outcome: <Improvement | Regression | Neutral>
128
+ Recommendation: <Adopt | Revert | Refine>
129
+ ```
130
+
131
+ When a §E stop condition fires (AR) or a Phase 2 stop condition fires
132
+ (Experiment), additionally print on the same turn:
133
+
134
+ ```text
135
+ Convergence detected: <reason>
136
+ ```
137
+
138
+ These echoes are on top of `results.json` and the per-iteration markdown, not
139
+ instead of them. Files remain the system of record; the inline copy makes the
140
+ run readable in the transcript and lets the goal evaluator decide.
141
+
142
+ ## Interaction with the gate hook
143
+
144
+ `/goal` and Shards' gate hook (`.shards/hooks/gate-hook.js`) both register on
145
+ Stop. Behavior:
146
+
147
+ - **Gates always win.** When a `::GATE::` fence is open (`kind=phase`,
148
+ `kind=execute`, `kind=final`, or `kind=checkpoint`), the gate hook blocks
149
+ the next turn. The `/goal` evaluator does not bypass that.
150
+ - **Phase 2 is gate-free.** That's where `/goal` does real work — turn-by-turn
151
+ evaluation without per-iteration prompts.
152
+ - **`/goal` does not suppress the Phase 3 gate.** When the loop exits and
153
+ Phase 3 starts, the gate fires, the user is asked the standard
154
+ "what do you want to adopt" question, and `/goal` clears on the summary turn.
155
+
156
+ If the gate hook and `/goal` evaluator misbehave together in practice, the
157
+ escape hatch is `/goal clear` — the loop still has its own convergence and
158
+ stop logic.
159
+
160
+ ## Failure modes to avoid
161
+
162
+ - **File-only conditions.** "`results.json` shows `status=complete`" will
163
+ never fire — the evaluator can't read files. Anchor to inline transcript
164
+ phrases.
165
+ - **Unbounded conditions.** A condition without "or stop after N turns" can
166
+ loop until the user intervenes. Always include the bound.
167
+ - **Goal bound tighter than §E.** If the goal says "stop at 20" but the
168
+ iteration budget is 100, `/goal` stops the run before §E does — and you
169
+ may miss real signal. Set the goal bound to `budget + small buffer`, so
170
+ §E does the real stopping and the goal bound is just a backstop.
171
+ - **Setting `/goal` outside Phase 2.** The proposal happens at the Phase 1
172
+ gate. Setting it during Phase 0 means the evaluator runs during setup
173
+ turns and may stop the session before the loop starts.
174
+ - **Forgetting transcript discipline.** Writing the iteration to file but
175
+ not echoing inline means the evaluator never sees the metric move, so the
176
+ goal never resolves except by hitting the turn bound.
177
+
178
+ ## Escape hatch
179
+
180
+ If `/goal` is unavailable for any reason, the existing stop logic still
181
+ terminates the loop:
182
+
183
+ - AR: `autonomous_research.md` §E (convergence) and §G (safety rails)
184
+ - Experiment: each `experiment.md` Phase 2 stop conditions
185
+
186
+ `/goal` is an autonomy quality-of-life layer on top of those — it removes
187
+ the per-turn prompts, not the underlying stop logic.
@@ -0,0 +1,139 @@
1
+ ---
2
+ name: incremental-testing
3
+ description: Shared protocol — test each component as you build it and emit a checkpoint gate before writing the next one
4
+ type: reference
5
+ ---
6
+
7
+ # Incremental Testing Protocol
8
+
9
+ When building notebooks, pipelines, or multi-step scripts, you do not write more than one component ahead of your last passing test. After each component, you execute it in isolation, record the evidence (shape, row count, error or success), and emit a machine-enforced **checkpoint gate** for the user to confirm before you write the next component.
10
+
11
+ This is what stops a notebook from "hanging" in cell 12 when it actually died silently in cell 2, and what prevents a bad join from running for ten minutes before you realize it needs a `LIMIT`. Run-all is not a development technique — it is the last step after every component has already passed in isolation.
12
+
13
+ ## The Contract
14
+
15
+ Every build phase eligible for this protocol produces:
16
+
17
+ 1. **One tested component at a time.** You do not write component N+1 until component N has been executed, produced observable evidence, and been confirmed at a checkpoint gate.
18
+ 2. **A visible test command.** The exact command you ran to exercise the component is recorded in the checkpoint readback. No "I tested it in my head."
19
+ 3. **Evidence, not assertion.** Shape, row count, loss value, returned status code, sample output — a measured fact, not a claim. (Mirrors the evidence discipline in `validation_protocol.md`.)
20
+ 4. **A `kind=checkpoint` gate fence.** Machine-enforced — the gate hook blocks all tools except Read/Glob/Grep until the user confirms.
21
+
22
+ If any of the four is missing, you are not following the protocol — you are writing-then-running, which is the failure mode this protocol exists to prevent.
23
+
24
+ ## What Counts as a Component
25
+
26
+ A component is the smallest self-contained unit whose correctness you can check independently. Examples:
27
+
28
+ | Artifact | Component examples |
29
+ |---|---|
30
+ | Jupyter notebook | Data load + sanity-print; EDA cell group; feature transform; baseline fit + eval; candidate fit + eval |
31
+ | SQL pipeline | One staging model; one intermediate model; one mart model; a join between two CTEs |
32
+ | Training script | Dataset loader; model forward pass; single-batch training step; multi-epoch loop |
33
+ | Serving code | One endpoint handler; one auth path; one monitoring hook |
34
+ | dbt project | One model + its tests; one seed; one snapshot |
35
+
36
+ A component is **not** the same as "one line of code" or "one cell." A tight group of 2-5 cells that share a single purpose (load data + describe + assert shape) is one component. Breaking too fine defeats the point; leaving too coarse produces the run-all pathology.
37
+
38
+ When in doubt: **if this piece fails, what would I need to debug in isolation?** That is the component.
39
+
40
+ ## How to Test — Techniques by Artifact Type
41
+
42
+ ### Notebook cells
43
+
44
+ - **Execute cells programmatically** via Bash rather than eyeballing a run-all. Use `jupyter execute <notebook> --inplace --kernel-name=<kernel>` with a per-cell timeout (`--ExecutePreprocessor.timeout=60`). Inspect the resulting `.ipynb` outputs or check the exit code.
45
+ - **Print shapes and heads** immediately after every data load or transform: `print(df.shape); df.head()`. If the shape isn't what Phase 3 predicted, stop.
46
+ - **Never introduce a new cell that depends on an untested cell.** If cell 3 hasn't been exercised, do not write cell 4.
47
+ - **Watch for the silent-fail pattern.** A cell that runs without raising but whose output is empty (`df` with 0 rows, a plot with no data) counts as a failure — assert row count `> 0` explicitly.
48
+ - **Keep cell outputs clean.** Never print secrets, API keys, tokens, or passwords into a cell — load them from the environment (`os.environ` / a `.env` file) and never echo them; they get committed into the `.ipynb` and, in walkthrough mode, streamed into agent context. Prefer summaries (`df.head()`, `df.shape`, `df.describe()`, `.value_counts().head()`) over dumping a full DataFrame — a full dump bloats the notebook and, because the kernel writes outputs back into the `.ipynb` *and* into the agent's context, is a token cost paid on every state read.
49
+ - **Install with `%pip` / `%conda`, not `!pip`.** The magics install into the running kernel's own environment; `!pip` shells out and may target a different interpreter, leaving imports silently failing on the live kernel.
50
+ - **Never modify or delete raw data in place.** Read source/raw data read-only; write every derived or cleaned artifact to a separate path (`data/derived/`, `results/`). A transform that overwrites its own input is unrecoverable and destroys reproducibility.
51
+
52
+ ### SQL
53
+
54
+ - **Develop with `LIMIT 100`.** Every query in development carries a limit. Only remove it after the shape, sample, and `EXPLAIN` plan all look right.
55
+ - **Run `EXPLAIN` / `EXPLAIN ANALYZE` on any join of 3+ tables** before running the real query. If the plan shows a cross-join or an unbounded scan, stop.
56
+ - **Check count-before vs count-after** at every join (see `join_path_protocol.md`). A 10x fan-out that you didn't predict is a component failure, not a "the query took a while."
57
+ - **Time out long-running queries.** If a dev query hasn't returned in 60 seconds, interrupt it and diagnose — don't assume it will "finish eventually."
58
+
59
+ ### ML training
60
+
61
+ - **Smoke-fit on ≤1% of data for 1-2 epochs** before touching the full dataset. Confirm loss decreases. If loss is flat or NaN, stop.
62
+ - **Forward-pass one batch** before starting any training loop: feed a single batch through the untrained model, confirm the output shape and dtype match expectation.
63
+ - **Overfit a tiny batch on purpose** as a sanity check — if the model cannot memorize 8 examples, the setup is broken and full training will waste hours.
64
+ - **Checkpoint after each smoke test passes.** The checkpoint gate is separate from `experiment_versioning.md` DVC/git snapshots — one logs the incremental build, the other logs experiment results.
65
+
66
+ ### Transforms / feature engineering
67
+
68
+ - **Assert invariants after every transform.** Shape, dtype, non-null rate, unique-key count — whatever the transform should preserve. One line of `assert` costs nothing and catches silent drops.
69
+ - **Materialize intermediate outputs** for the first pass. You can stream through at the end; while building, write each stage's output to disk and inspect it.
70
+
71
+ ### Pipeline / service code
72
+
73
+ - **Dry-run each step in isolation** before chaining. A pipeline that works end-to-end only works if each step works in isolation.
74
+ - **Hit new endpoints with `curl` / `httpie` once each** before wiring them into client code.
75
+
76
+ ## Checkpoint Gate Usage
77
+
78
+ After every component passes its test, emit a checkpoint gate. Format:
79
+
80
+ ```
81
+ ::GATE:: id=<agent-name>-phase-<N>-checkpoint-<component> phase=<N> kind=checkpoint
82
+ Component: <human-readable name>
83
+ Test command: <exact command you ran>
84
+ Evidence:
85
+ - <measured fact 1, e.g. "df.shape = (48211, 47)">
86
+ - <measured fact 2, e.g. "null rate on join key = 0.00%">
87
+ - <measured fact 3, e.g. "sample head matches expected schema">
88
+ Status: PASS | FAIL — <one-line summary>
89
+ Next: <what you'll build after this is confirmed>
90
+ Stop here — await explicit confirmation before writing the next component.
91
+ ::ENDGATE::
92
+ ```
93
+
94
+ **Gate ID scheme.** Kebab-case, agent name + phase number + short component slug:
95
+ - `ml-engineer-phase-6-checkpoint-data`
96
+ - `data-scientist-phase-6-checkpoint-notebook`
97
+ - `analytics-engineer-phase-7-checkpoint-staging`
98
+ - `deep-learning-engineer-phase-4-checkpoint-smoke-fit`
99
+
100
+ The `phase=<N>` attribute matches the current phase number (checkpoints live *within* a phase — they do not advance it). The `kind=checkpoint` attribute is what distinguishes this from a `kind=phase` transition gate.
101
+
102
+ **What to read back to the user.** The fence body itself — component name, test command, evidence, status, next step. No additional prose outside the fence. The user confirms with any standard affirmative ("ok", "yes", "proceed") or explicitly via `::GATE-CONFIRM:: <id>`.
103
+
104
+ **When a checkpoint fails.** If Status is FAIL, do not write the next component. Diagnose, fix, re-run the test, and re-emit the checkpoint with the updated evidence. A FAIL checkpoint is a stopping point, not a formality to announce before pressing on.
105
+
106
+ **How many checkpoints per phase.** Usually 2-5. Fewer than 2 means you are batching too much and will rediscover the run-all pathology. More than 5 usually means you are checkpointing individual cells rather than components — combine them.
107
+
108
+ ## Composition with Other Protocols
109
+
110
+ - **Validation protocol** (`validation_protocol.md`) — still required at the phase gate. Checkpoint evidence feeds the final `## Validation` evidence table but does not replace it.
111
+ - **Join path protocol** (`join_path_protocol.md`) — still required *before* writing any join. The checkpoint fires *after* the join has been executed and verified.
112
+ - **Experiment versioning** (`experiment_versioning.md`) — checkpoints are build-time; experiment snapshots are result-time. In `[X]` or `[AR]` modes both apply: snapshot after each experiment result, checkpoint after each component within each experiment.
113
+ - **Gate pattern** — the phase-level `kind=phase` gate still fires at the end of the phase. Checkpoints do not replace it; they punctuate the build leading up to it.
114
+ - **Knowledge checkpoint** (`knowledge_checkpoint.md`) — if a checkpoint surfaces a pattern (known bad distribution, known grain issue), cite it in the Evidence block.
115
+
116
+ ## Restart & Run All — the Final Reproducibility Check
117
+
118
+ Incremental testing proves each component works *in isolation*. It does **not** prove the notebook runs clean top-to-bottom on a fresh kernel — cells can pass out of order, depend on state left by a since-edited cell, or rely on a variable that no longer exists after a restart. A notebook only truly works if **"Restart Kernel & Run All" completes without error**.
119
+
120
+ This check runs **once, at the end** — after every component has already passed its checkpoint. It is the final step, never the first execution (see the "Run-all is not a development technique" framing above and the failure mode below).
121
+
122
+ - **In Notebook Walkthrough mode**, run it via the kernel helper: `python .shards/ui/notebook-kernel.py run-all <session_id>`. The helper restarts the kernel, executes every code cell in order against the fresh kernel, stops at the first failing cell, and returns a per-cell pass/fail roll-up with the first error (`firstError`). Surface the result to the user; on a failure, stop and diagnose — do not declare the notebook done.
123
+ - **Standalone** (no walkthrough session), run `jupyter nbconvert --execute --to notebook --inplace <notebook>` (or `jupyter execute <notebook> --inplace`) and confirm a zero exit code.
124
+ - **Set seeds** (`numpy`, `random`, and any framework — `sklearn`, `torch`) so the fresh run is deterministic and headline metrics reproduce. A run-all that "works" but produces different numbers each time is not reproducible.
125
+
126
+ For the Data Scientist this is the **DS-11** validation check (`Restart & Run All: N cells, no errors | seed=42 | log: results/notebook_rerun.log`); the `run-all` subcommand is how that evidence is produced. Other notebook-producing agents apply the same check at their final notebook validation.
127
+
128
+ ## Failure Modes to Avoid
129
+
130
+ - **Write-whole-notebook-then-run-all.** The pathology this protocol exists to prevent. If your first execution of the notebook is `Restart & Run All`, you are doing it wrong — the hanging-on-cell-12 behavior will return.
131
+ - **Unbounded SELECT in development.** A query without `LIMIT` during dev is a time bomb. Keep the limit on until the shape is confirmed.
132
+ - **Training on full data before a smoke fit.** "It'll probably work" is how you discover at hour three that the loss has been NaN since step 1.
133
+ - **Swallowing exceptions with bare `try/except`.** A cell that catches everything and prints "done" is indistinguishable from a cell that silently failed. Let errors propagate during development.
134
+ - **Skipping checkpoints because "this one's obviously fine."** The checkpoint that feels unnecessary is often the one that catches the bug. If it's truly trivial, combine it with the next component — don't skip it.
135
+ - **Emitting a checkpoint without running the test.** The fence's Evidence block must reflect a real execution. Writing "Evidence: looks good" makes the checkpoint theater.
136
+
137
+ ## Escape Hatch
138
+
139
+ The `SHARDS_CHECKPOINT_ENFORCE=0` environment variable downgrades checkpoint gates to advisory — they are printed but do not block tool use. The `SHARDS_GATE_ENFORCE=0` variable continues to disable all gate enforcement (phase gates included). Do not default to either. The escape hatches exist for harness issues, not for skipping incremental testing under time pressure — skipping is exactly how you end up debugging at 2am.