@jokerized/getresearchdone 0.4.1

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 (711) hide show
  1. package/.claude-plugin/plugin.json +103 -0
  2. package/README.md +211 -0
  3. package/agents/grd-baseline-assessor.md +684 -0
  4. package/agents/grd-code-reviewer.md +300 -0
  5. package/agents/grd-codebase-mapper.md +355 -0
  6. package/agents/grd-critique-agent.md +119 -0
  7. package/agents/grd-debugger.md +519 -0
  8. package/agents/grd-deep-diver.md +737 -0
  9. package/agents/grd-eval-planner.md +913 -0
  10. package/agents/grd-eval-reporter.md +717 -0
  11. package/agents/grd-executor.md +683 -0
  12. package/agents/grd-feasibility-analyst.md +624 -0
  13. package/agents/grd-integration-checker.md +367 -0
  14. package/agents/grd-knowledge-miner.md +81 -0
  15. package/agents/grd-migrator.md +88 -0
  16. package/agents/grd-phase-researcher.md +697 -0
  17. package/agents/grd-plan-checker.md +443 -0
  18. package/agents/grd-planner.md +1532 -0
  19. package/agents/grd-product-owner.md +562 -0
  20. package/agents/grd-project-researcher.md +513 -0
  21. package/agents/grd-research-synthesizer.md +273 -0
  22. package/agents/grd-roadmapper.md +798 -0
  23. package/agents/grd-surveyor.md +566 -0
  24. package/agents/grd-verifier.md +893 -0
  25. package/bin/gd.js +4 -0
  26. package/bin/gd.ts +227 -0
  27. package/bin/grd-manifest.js +4 -0
  28. package/bin/grd-manifest.ts +286 -0
  29. package/bin/grd-mcp-server.js +4 -0
  30. package/bin/grd-mcp-server.ts +124 -0
  31. package/bin/grd-tools.js +4 -0
  32. package/bin/grd-tools.ts +2471 -0
  33. package/bin/postinstall.js +4 -0
  34. package/bin/postinstall.ts +80 -0
  35. package/commands/add-phase.md +123 -0
  36. package/commands/add-todo.md +87 -0
  37. package/commands/assess-baseline.md +289 -0
  38. package/commands/autopilot.md +100 -0
  39. package/commands/autoplan.md +55 -0
  40. package/commands/check-todos.md +87 -0
  41. package/commands/compare-methods.md +262 -0
  42. package/commands/complete-milestone.md +225 -0
  43. package/commands/debug.md +372 -0
  44. package/commands/deep-dive.md +288 -0
  45. package/commands/discover.md +281 -0
  46. package/commands/discuss-phase.md +188 -0
  47. package/commands/discuss.md +55 -0
  48. package/commands/eval-report.md +310 -0
  49. package/commands/evolve.md +79 -0
  50. package/commands/execute-phase.md +1017 -0
  51. package/commands/feasibility.md +292 -0
  52. package/commands/help.md +407 -0
  53. package/commands/init.md +1508 -0
  54. package/commands/insert-phase.md +113 -0
  55. package/commands/iterate.md +327 -0
  56. package/commands/list-phase-assumptions.md +217 -0
  57. package/commands/long-term-roadmap.md +202 -0
  58. package/commands/map-codebase.md +111 -0
  59. package/commands/migrate.md +159 -0
  60. package/commands/new-milestone.md +169 -0
  61. package/commands/pause-work.md +83 -0
  62. package/commands/plan-milestone-gaps.md +373 -0
  63. package/commands/plan-phase.md +655 -0
  64. package/commands/principles.md +328 -0
  65. package/commands/product-plan.md +319 -0
  66. package/commands/progress.md +481 -0
  67. package/commands/quick.md +167 -0
  68. package/commands/reapply-patches.md +154 -0
  69. package/commands/remove-phase.md +97 -0
  70. package/commands/requirement.md +96 -0
  71. package/commands/resume-project.md +113 -0
  72. package/commands/settings.md +1144 -0
  73. package/commands/survey.md +242 -0
  74. package/commands/sync.md +246 -0
  75. package/commands/tracker-setup.md +322 -0
  76. package/commands/update.md +202 -0
  77. package/commands/verify-phase.md +335 -0
  78. package/commands/verify-work.md +701 -0
  79. package/commands/wireup.md +29 -0
  80. package/dist/bin/gd.d.ts +3 -0
  81. package/dist/bin/gd.d.ts.map +1 -0
  82. package/dist/bin/gd.js +178 -0
  83. package/dist/bin/gd.js.map +1 -0
  84. package/dist/bin/grd-manifest.d.ts +3 -0
  85. package/dist/bin/grd-manifest.d.ts.map +1 -0
  86. package/dist/bin/grd-manifest.js +202 -0
  87. package/dist/bin/grd-manifest.js.map +1 -0
  88. package/dist/bin/grd-mcp-server.d.ts +3 -0
  89. package/dist/bin/grd-mcp-server.d.ts.map +1 -0
  90. package/dist/bin/grd-mcp-server.js +71 -0
  91. package/dist/bin/grd-mcp-server.js.map +1 -0
  92. package/dist/bin/grd-tools.d.ts +3 -0
  93. package/dist/bin/grd-tools.d.ts.map +1 -0
  94. package/dist/bin/grd-tools.js +1680 -0
  95. package/dist/bin/grd-tools.js.map +1 -0
  96. package/dist/bin/postinstall.d.ts +3 -0
  97. package/dist/bin/postinstall.d.ts.map +1 -0
  98. package/dist/bin/postinstall.js +61 -0
  99. package/dist/bin/postinstall.js.map +1 -0
  100. package/dist/lib/autopilot-milestone.d.ts +2 -0
  101. package/dist/lib/autopilot-milestone.d.ts.map +1 -0
  102. package/dist/lib/autopilot-milestone.js +94 -0
  103. package/dist/lib/autopilot-milestone.js.map +1 -0
  104. package/dist/lib/autopilot-pipeline.d.ts +2 -0
  105. package/dist/lib/autopilot-pipeline.d.ts.map +1 -0
  106. package/dist/lib/autopilot-pipeline.js +830 -0
  107. package/dist/lib/autopilot-pipeline.js.map +1 -0
  108. package/dist/lib/autopilot-waves.d.ts +2 -0
  109. package/dist/lib/autopilot-waves.d.ts.map +1 -0
  110. package/dist/lib/autopilot-waves.js +266 -0
  111. package/dist/lib/autopilot-waves.js.map +1 -0
  112. package/dist/lib/autopilot.d.ts +2 -0
  113. package/dist/lib/autopilot.d.ts.map +1 -0
  114. package/dist/lib/autopilot.js +1314 -0
  115. package/dist/lib/autopilot.js.map +1 -0
  116. package/dist/lib/autoplan.d.ts +2 -0
  117. package/dist/lib/autoplan.d.ts.map +1 -0
  118. package/dist/lib/autoplan.js +198 -0
  119. package/dist/lib/autoplan.js.map +1 -0
  120. package/dist/lib/autoresearch.d.ts +2 -0
  121. package/dist/lib/autoresearch.d.ts.map +1 -0
  122. package/dist/lib/autoresearch.js +626 -0
  123. package/dist/lib/autoresearch.js.map +1 -0
  124. package/dist/lib/backend.d.ts +2 -0
  125. package/dist/lib/backend.d.ts.map +1 -0
  126. package/dist/lib/backend.js +1036 -0
  127. package/dist/lib/backend.js.map +1 -0
  128. package/dist/lib/benchmark.d.ts +99 -0
  129. package/dist/lib/benchmark.d.ts.map +1 -0
  130. package/dist/lib/benchmark.js +278 -0
  131. package/dist/lib/benchmark.js.map +1 -0
  132. package/dist/lib/citations.d.ts +2 -0
  133. package/dist/lib/citations.d.ts.map +1 -0
  134. package/dist/lib/citations.js +642 -0
  135. package/dist/lib/citations.js.map +1 -0
  136. package/dist/lib/cleanup.d.ts +2 -0
  137. package/dist/lib/cleanup.d.ts.map +1 -0
  138. package/dist/lib/cleanup.js +1222 -0
  139. package/dist/lib/cleanup.js.map +1 -0
  140. package/dist/lib/cli/adapters.d.ts +10 -0
  141. package/dist/lib/cli/adapters.d.ts.map +1 -0
  142. package/dist/lib/cli/adapters.js +27 -0
  143. package/dist/lib/cli/adapters.js.map +1 -0
  144. package/dist/lib/cli/agent.d.ts +17 -0
  145. package/dist/lib/cli/agent.d.ts.map +1 -0
  146. package/dist/lib/cli/agent.js +53 -0
  147. package/dist/lib/cli/agent.js.map +1 -0
  148. package/dist/lib/cli/index.d.ts +21 -0
  149. package/dist/lib/cli/index.d.ts.map +1 -0
  150. package/dist/lib/cli/index.js +264 -0
  151. package/dist/lib/cli/index.js.map +1 -0
  152. package/dist/lib/cli/output.d.ts +20 -0
  153. package/dist/lib/cli/output.d.ts.map +1 -0
  154. package/dist/lib/cli/output.js +22 -0
  155. package/dist/lib/cli/output.js.map +1 -0
  156. package/dist/lib/cli/scan-dispatch.d.ts +9 -0
  157. package/dist/lib/cli/scan-dispatch.d.ts.map +1 -0
  158. package/dist/lib/cli/scan-dispatch.js +107 -0
  159. package/dist/lib/cli/scan-dispatch.js.map +1 -0
  160. package/dist/lib/cli/tools.d.ts +16 -0
  161. package/dist/lib/cli/tools.d.ts.map +1 -0
  162. package/dist/lib/cli/tools.js +168 -0
  163. package/dist/lib/cli/tools.js.map +1 -0
  164. package/dist/lib/commands/_dashboard-parsers.d.ts +2 -0
  165. package/dist/lib/commands/_dashboard-parsers.d.ts.map +1 -0
  166. package/dist/lib/commands/_dashboard-parsers.js +192 -0
  167. package/dist/lib/commands/_dashboard-parsers.js.map +1 -0
  168. package/dist/lib/commands/analysis.d.ts +2 -0
  169. package/dist/lib/commands/analysis.d.ts.map +1 -0
  170. package/dist/lib/commands/analysis.js +1418 -0
  171. package/dist/lib/commands/analysis.js.map +1 -0
  172. package/dist/lib/commands/assumptions.d.ts +2 -0
  173. package/dist/lib/commands/assumptions.d.ts.map +1 -0
  174. package/dist/lib/commands/assumptions.js +166 -0
  175. package/dist/lib/commands/assumptions.js.map +1 -0
  176. package/dist/lib/commands/blame.d.ts +2 -0
  177. package/dist/lib/commands/blame.d.ts.map +1 -0
  178. package/dist/lib/commands/blame.js +133 -0
  179. package/dist/lib/commands/blame.js.map +1 -0
  180. package/dist/lib/commands/budget.d.ts +2 -0
  181. package/dist/lib/commands/budget.d.ts.map +1 -0
  182. package/dist/lib/commands/budget.js +100 -0
  183. package/dist/lib/commands/budget.js.map +1 -0
  184. package/dist/lib/commands/check-plans.d.ts +2 -0
  185. package/dist/lib/commands/check-plans.d.ts.map +1 -0
  186. package/dist/lib/commands/check-plans.js +190 -0
  187. package/dist/lib/commands/check-plans.js.map +1 -0
  188. package/dist/lib/commands/config.d.ts +2 -0
  189. package/dist/lib/commands/config.d.ts.map +1 -0
  190. package/dist/lib/commands/config.js +188 -0
  191. package/dist/lib/commands/config.js.map +1 -0
  192. package/dist/lib/commands/dashboard.d.ts +2 -0
  193. package/dist/lib/commands/dashboard.d.ts.map +1 -0
  194. package/dist/lib/commands/dashboard.js +466 -0
  195. package/dist/lib/commands/dashboard.js.map +1 -0
  196. package/dist/lib/commands/estimate.d.ts +2 -0
  197. package/dist/lib/commands/estimate.d.ts.map +1 -0
  198. package/dist/lib/commands/estimate.js +148 -0
  199. package/dist/lib/commands/estimate.js.map +1 -0
  200. package/dist/lib/commands/eval-diff.d.ts +2 -0
  201. package/dist/lib/commands/eval-diff.d.ts.map +1 -0
  202. package/dist/lib/commands/eval-diff.js +213 -0
  203. package/dist/lib/commands/eval-diff.js.map +1 -0
  204. package/dist/lib/commands/freshness.d.ts +2 -0
  205. package/dist/lib/commands/freshness.d.ts.map +1 -0
  206. package/dist/lib/commands/freshness.js +163 -0
  207. package/dist/lib/commands/freshness.js.map +1 -0
  208. package/dist/lib/commands/health.d.ts +2 -0
  209. package/dist/lib/commands/health.d.ts.map +1 -0
  210. package/dist/lib/commands/health.js +435 -0
  211. package/dist/lib/commands/health.js.map +1 -0
  212. package/dist/lib/commands/index.d.ts +2 -0
  213. package/dist/lib/commands/index.d.ts.map +1 -0
  214. package/dist/lib/commands/index.js +128 -0
  215. package/dist/lib/commands/index.js.map +1 -0
  216. package/dist/lib/commands/install.d.ts +56 -0
  217. package/dist/lib/commands/install.d.ts.map +1 -0
  218. package/dist/lib/commands/install.js +214 -0
  219. package/dist/lib/commands/install.js.map +1 -0
  220. package/dist/lib/commands/knowhow-aggregator.d.ts +2 -0
  221. package/dist/lib/commands/knowhow-aggregator.d.ts.map +1 -0
  222. package/dist/lib/commands/knowhow-aggregator.js +279 -0
  223. package/dist/lib/commands/knowhow-aggregator.js.map +1 -0
  224. package/dist/lib/commands/knowledge-search.d.ts +2 -0
  225. package/dist/lib/commands/knowledge-search.d.ts.map +1 -0
  226. package/dist/lib/commands/knowledge-search.js +113 -0
  227. package/dist/lib/commands/knowledge-search.js.map +1 -0
  228. package/dist/lib/commands/long-term-roadmap.d.ts +2 -0
  229. package/dist/lib/commands/long-term-roadmap.d.ts.map +1 -0
  230. package/dist/lib/commands/long-term-roadmap.js +272 -0
  231. package/dist/lib/commands/long-term-roadmap.js.map +1 -0
  232. package/dist/lib/commands/patterns.d.ts +91 -0
  233. package/dist/lib/commands/patterns.d.ts.map +1 -0
  234. package/dist/lib/commands/patterns.js +391 -0
  235. package/dist/lib/commands/patterns.js.map +1 -0
  236. package/dist/lib/commands/phase-info.d.ts +2 -0
  237. package/dist/lib/commands/phase-info.d.ts.map +1 -0
  238. package/dist/lib/commands/phase-info.js +509 -0
  239. package/dist/lib/commands/phase-info.js.map +1 -0
  240. package/dist/lib/commands/plan-lint.d.ts +56 -0
  241. package/dist/lib/commands/plan-lint.d.ts.map +1 -0
  242. package/dist/lib/commands/plan-lint.js +481 -0
  243. package/dist/lib/commands/plan-lint.js.map +1 -0
  244. package/dist/lib/commands/plan-phase.d.ts +53 -0
  245. package/dist/lib/commands/plan-phase.d.ts.map +1 -0
  246. package/dist/lib/commands/plan-phase.js +288 -0
  247. package/dist/lib/commands/plan-phase.js.map +1 -0
  248. package/dist/lib/commands/progress.d.ts +2 -0
  249. package/dist/lib/commands/progress.d.ts.map +1 -0
  250. package/dist/lib/commands/progress.js +266 -0
  251. package/dist/lib/commands/progress.js.map +1 -0
  252. package/dist/lib/commands/quality.d.ts +2 -0
  253. package/dist/lib/commands/quality.d.ts.map +1 -0
  254. package/dist/lib/commands/quality.js +80 -0
  255. package/dist/lib/commands/quality.js.map +1 -0
  256. package/dist/lib/commands/rollback.d.ts +2 -0
  257. package/dist/lib/commands/rollback.d.ts.map +1 -0
  258. package/dist/lib/commands/rollback.js +145 -0
  259. package/dist/lib/commands/rollback.js.map +1 -0
  260. package/dist/lib/commands/scan.d.ts +25 -0
  261. package/dist/lib/commands/scan.d.ts.map +1 -0
  262. package/dist/lib/commands/scan.js +28 -0
  263. package/dist/lib/commands/scan.js.map +1 -0
  264. package/dist/lib/commands/search.d.ts +2 -0
  265. package/dist/lib/commands/search.d.ts.map +1 -0
  266. package/dist/lib/commands/search.js +212 -0
  267. package/dist/lib/commands/search.js.map +1 -0
  268. package/dist/lib/commands/select-candidate.d.ts +128 -0
  269. package/dist/lib/commands/select-candidate.d.ts.map +1 -0
  270. package/dist/lib/commands/select-candidate.js +518 -0
  271. package/dist/lib/commands/select-candidate.js.map +1 -0
  272. package/dist/lib/commands/singularity.d.ts +2 -0
  273. package/dist/lib/commands/singularity.d.ts.map +1 -0
  274. package/dist/lib/commands/singularity.js +185 -0
  275. package/dist/lib/commands/singularity.js.map +1 -0
  276. package/dist/lib/commands/slug-timestamp.d.ts +2 -0
  277. package/dist/lib/commands/slug-timestamp.d.ts.map +1 -0
  278. package/dist/lib/commands/slug-timestamp.js +54 -0
  279. package/dist/lib/commands/slug-timestamp.js.map +1 -0
  280. package/dist/lib/commands/tail.d.ts +2 -0
  281. package/dist/lib/commands/tail.d.ts.map +1 -0
  282. package/dist/lib/commands/tail.js +100 -0
  283. package/dist/lib/commands/tail.js.map +1 -0
  284. package/dist/lib/commands/todo.d.ts +2 -0
  285. package/dist/lib/commands/todo.d.ts.map +1 -0
  286. package/dist/lib/commands/todo.js +200 -0
  287. package/dist/lib/commands/todo.js.map +1 -0
  288. package/dist/lib/commands/watch.d.ts +2 -0
  289. package/dist/lib/commands/watch.d.ts.map +1 -0
  290. package/dist/lib/commands/watch.js +72 -0
  291. package/dist/lib/commands/watch.js.map +1 -0
  292. package/dist/lib/complexity.d.ts +55 -0
  293. package/dist/lib/complexity.d.ts.map +1 -0
  294. package/dist/lib/complexity.js +80 -0
  295. package/dist/lib/complexity.js.map +1 -0
  296. package/dist/lib/context/agents.d.ts +2 -0
  297. package/dist/lib/context/agents.d.ts.map +1 -0
  298. package/dist/lib/context/agents.js +344 -0
  299. package/dist/lib/context/agents.js.map +1 -0
  300. package/dist/lib/context/base.d.ts +2 -0
  301. package/dist/lib/context/base.d.ts.map +1 -0
  302. package/dist/lib/context/base.js +81 -0
  303. package/dist/lib/context/base.js.map +1 -0
  304. package/dist/lib/context/execute.d.ts +2 -0
  305. package/dist/lib/context/execute.d.ts.map +1 -0
  306. package/dist/lib/context/execute.js +753 -0
  307. package/dist/lib/context/execute.js.map +1 -0
  308. package/dist/lib/context/index.d.ts +2 -0
  309. package/dist/lib/context/index.d.ts.map +1 -0
  310. package/dist/lib/context/index.js +88 -0
  311. package/dist/lib/context/index.js.map +1 -0
  312. package/dist/lib/context/progress.d.ts +2 -0
  313. package/dist/lib/context/progress.d.ts.map +1 -0
  314. package/dist/lib/context/progress.js +178 -0
  315. package/dist/lib/context/progress.js.map +1 -0
  316. package/dist/lib/context/project.d.ts +2 -0
  317. package/dist/lib/context/project.d.ts.map +1 -0
  318. package/dist/lib/context/project.js +413 -0
  319. package/dist/lib/context/project.js.map +1 -0
  320. package/dist/lib/context/research.d.ts +2 -0
  321. package/dist/lib/context/research.d.ts.map +1 -0
  322. package/dist/lib/context/research.js +466 -0
  323. package/dist/lib/context/research.js.map +1 -0
  324. package/dist/lib/dead-ends.d.ts +28 -0
  325. package/dist/lib/dead-ends.d.ts.map +1 -0
  326. package/dist/lib/dead-ends.js +451 -0
  327. package/dist/lib/dead-ends.js.map +1 -0
  328. package/dist/lib/deps.d.ts +2 -0
  329. package/dist/lib/deps.d.ts.map +1 -0
  330. package/dist/lib/deps.js +630 -0
  331. package/dist/lib/deps.js.map +1 -0
  332. package/dist/lib/discussion.d.ts +2 -0
  333. package/dist/lib/discussion.d.ts.map +1 -0
  334. package/dist/lib/discussion.js +1041 -0
  335. package/dist/lib/discussion.js.map +1 -0
  336. package/dist/lib/drift.d.ts +36 -0
  337. package/dist/lib/drift.d.ts.map +1 -0
  338. package/dist/lib/drift.js +481 -0
  339. package/dist/lib/drift.js.map +1 -0
  340. package/dist/lib/evolve/_dimensions-features.d.ts +2 -0
  341. package/dist/lib/evolve/_dimensions-features.d.ts.map +1 -0
  342. package/dist/lib/evolve/_dimensions-features.js +369 -0
  343. package/dist/lib/evolve/_dimensions-features.js.map +1 -0
  344. package/dist/lib/evolve/_dimensions.d.ts +2 -0
  345. package/dist/lib/evolve/_dimensions.d.ts.map +1 -0
  346. package/dist/lib/evolve/_dimensions.js +358 -0
  347. package/dist/lib/evolve/_dimensions.js.map +1 -0
  348. package/dist/lib/evolve/_product-ideation.d.ts +2 -0
  349. package/dist/lib/evolve/_product-ideation.d.ts.map +1 -0
  350. package/dist/lib/evolve/_product-ideation.js +281 -0
  351. package/dist/lib/evolve/_product-ideation.js.map +1 -0
  352. package/dist/lib/evolve/_prompts.d.ts +2 -0
  353. package/dist/lib/evolve/_prompts.d.ts.map +1 -0
  354. package/dist/lib/evolve/_prompts.js +153 -0
  355. package/dist/lib/evolve/_prompts.js.map +1 -0
  356. package/dist/lib/evolve/cli.d.ts +2 -0
  357. package/dist/lib/evolve/cli.d.ts.map +1 -0
  358. package/dist/lib/evolve/cli.js +224 -0
  359. package/dist/lib/evolve/cli.js.map +1 -0
  360. package/dist/lib/evolve/discovery.d.ts +2 -0
  361. package/dist/lib/evolve/discovery.d.ts.map +1 -0
  362. package/dist/lib/evolve/discovery.js +391 -0
  363. package/dist/lib/evolve/discovery.js.map +1 -0
  364. package/dist/lib/evolve/index.d.ts +2 -0
  365. package/dist/lib/evolve/index.d.ts.map +1 -0
  366. package/dist/lib/evolve/index.js +88 -0
  367. package/dist/lib/evolve/index.js.map +1 -0
  368. package/dist/lib/evolve/orchestrator.d.ts +2 -0
  369. package/dist/lib/evolve/orchestrator.d.ts.map +1 -0
  370. package/dist/lib/evolve/orchestrator.js +851 -0
  371. package/dist/lib/evolve/orchestrator.js.map +1 -0
  372. package/dist/lib/evolve/scoring.d.ts +2 -0
  373. package/dist/lib/evolve/scoring.d.ts.map +1 -0
  374. package/dist/lib/evolve/scoring.js +118 -0
  375. package/dist/lib/evolve/scoring.js.map +1 -0
  376. package/dist/lib/evolve/state.d.ts +2 -0
  377. package/dist/lib/evolve/state.d.ts.map +1 -0
  378. package/dist/lib/evolve/state.js +264 -0
  379. package/dist/lib/evolve/state.js.map +1 -0
  380. package/dist/lib/evolve/types.d.ts +249 -0
  381. package/dist/lib/evolve/types.d.ts.map +1 -0
  382. package/dist/lib/evolve/types.js +3 -0
  383. package/dist/lib/evolve/types.js.map +1 -0
  384. package/dist/lib/frontmatter.d.ts +2 -0
  385. package/dist/lib/frontmatter.d.ts.map +1 -0
  386. package/dist/lib/frontmatter.js +513 -0
  387. package/dist/lib/frontmatter.js.map +1 -0
  388. package/dist/lib/gates.d.ts +2 -0
  389. package/dist/lib/gates.d.ts.map +1 -0
  390. package/dist/lib/gates.js +578 -0
  391. package/dist/lib/gates.js.map +1 -0
  392. package/dist/lib/genome.d.ts +10 -0
  393. package/dist/lib/genome.d.ts.map +1 -0
  394. package/dist/lib/genome.js +368 -0
  395. package/dist/lib/genome.js.map +1 -0
  396. package/dist/lib/got.d.ts +2 -0
  397. package/dist/lib/got.d.ts.map +1 -0
  398. package/dist/lib/got.js +280 -0
  399. package/dist/lib/got.js.map +1 -0
  400. package/dist/lib/invariants.d.ts +2 -0
  401. package/dist/lib/invariants.d.ts.map +1 -0
  402. package/dist/lib/invariants.js +298 -0
  403. package/dist/lib/invariants.js.map +1 -0
  404. package/dist/lib/knowledge.d.ts +2 -0
  405. package/dist/lib/knowledge.d.ts.map +1 -0
  406. package/dist/lib/knowledge.js +658 -0
  407. package/dist/lib/knowledge.js.map +1 -0
  408. package/dist/lib/long-term-roadmap.d.ts +2 -0
  409. package/dist/lib/long-term-roadmap.d.ts.map +1 -0
  410. package/dist/lib/long-term-roadmap.js +602 -0
  411. package/dist/lib/long-term-roadmap.js.map +1 -0
  412. package/dist/lib/markdown-split.d.ts +2 -0
  413. package/dist/lib/markdown-split.d.ts.map +1 -0
  414. package/dist/lib/markdown-split.js +199 -0
  415. package/dist/lib/markdown-split.js.map +1 -0
  416. package/dist/lib/mcp-server.d.ts +2 -0
  417. package/dist/lib/mcp-server.d.ts.map +1 -0
  418. package/dist/lib/mcp-server.js +2424 -0
  419. package/dist/lib/mcp-server.js.map +1 -0
  420. package/dist/lib/metrics.d.ts +16 -0
  421. package/dist/lib/metrics.d.ts.map +1 -0
  422. package/dist/lib/metrics.js +48 -0
  423. package/dist/lib/metrics.js.map +1 -0
  424. package/dist/lib/overstory.d.ts +2 -0
  425. package/dist/lib/overstory.d.ts.map +1 -0
  426. package/dist/lib/overstory.js +211 -0
  427. package/dist/lib/overstory.js.map +1 -0
  428. package/dist/lib/parallel.d.ts +2 -0
  429. package/dist/lib/parallel.d.ts.map +1 -0
  430. package/dist/lib/parallel.js +349 -0
  431. package/dist/lib/parallel.js.map +1 -0
  432. package/dist/lib/paths.d.ts +2 -0
  433. package/dist/lib/paths.d.ts.map +1 -0
  434. package/dist/lib/paths.js +254 -0
  435. package/dist/lib/paths.js.map +1 -0
  436. package/dist/lib/phase-complete-llm.d.ts +22 -0
  437. package/dist/lib/phase-complete-llm.d.ts.map +1 -0
  438. package/dist/lib/phase-complete-llm.js +331 -0
  439. package/dist/lib/phase-complete-llm.js.map +1 -0
  440. package/dist/lib/phase-complete.d.ts +46 -0
  441. package/dist/lib/phase-complete.d.ts.map +1 -0
  442. package/dist/lib/phase-complete.js +278 -0
  443. package/dist/lib/phase-complete.js.map +1 -0
  444. package/dist/lib/phase-io.d.ts +2 -0
  445. package/dist/lib/phase-io.d.ts.map +1 -0
  446. package/dist/lib/phase-io.js +126 -0
  447. package/dist/lib/phase-io.js.map +1 -0
  448. package/dist/lib/phase.d.ts +2 -0
  449. package/dist/lib/phase.d.ts.map +1 -0
  450. package/dist/lib/phase.js +1344 -0
  451. package/dist/lib/phase.js.map +1 -0
  452. package/dist/lib/plan-tournament.d.ts +63 -0
  453. package/dist/lib/plan-tournament.d.ts.map +1 -0
  454. package/dist/lib/plan-tournament.js +353 -0
  455. package/dist/lib/plan-tournament.js.map +1 -0
  456. package/dist/lib/refinement.d.ts +74 -0
  457. package/dist/lib/refinement.d.ts.map +1 -0
  458. package/dist/lib/refinement.js +283 -0
  459. package/dist/lib/refinement.js.map +1 -0
  460. package/dist/lib/requirements.d.ts +2 -0
  461. package/dist/lib/requirements.d.ts.map +1 -0
  462. package/dist/lib/requirements.js +355 -0
  463. package/dist/lib/requirements.js.map +1 -0
  464. package/dist/lib/research-bundle.d.ts +2 -0
  465. package/dist/lib/research-bundle.d.ts.map +1 -0
  466. package/dist/lib/research-bundle.js +246 -0
  467. package/dist/lib/research-bundle.js.map +1 -0
  468. package/dist/lib/roadmap.d.ts +2 -0
  469. package/dist/lib/roadmap.d.ts.map +1 -0
  470. package/dist/lib/roadmap.js +541 -0
  471. package/dist/lib/roadmap.js.map +1 -0
  472. package/dist/lib/sample.d.ts +16 -0
  473. package/dist/lib/sample.d.ts.map +1 -0
  474. package/dist/lib/sample.js +20 -0
  475. package/dist/lib/sample.js.map +1 -0
  476. package/dist/lib/scaffold.d.ts +2 -0
  477. package/dist/lib/scaffold.d.ts.map +1 -0
  478. package/dist/lib/scaffold.js +355 -0
  479. package/dist/lib/scaffold.js.map +1 -0
  480. package/dist/lib/scan/_utils.d.ts +11 -0
  481. package/dist/lib/scan/_utils.d.ts.map +1 -0
  482. package/dist/lib/scan/_utils.js +36 -0
  483. package/dist/lib/scan/_utils.js.map +1 -0
  484. package/dist/lib/scan/base64.d.ts +15 -0
  485. package/dist/lib/scan/base64.d.ts.map +1 -0
  486. package/dist/lib/scan/base64.js +66 -0
  487. package/dist/lib/scan/base64.js.map +1 -0
  488. package/dist/lib/scan/ignorefile.d.ts +30 -0
  489. package/dist/lib/scan/ignorefile.d.ts.map +1 -0
  490. package/dist/lib/scan/ignorefile.js +101 -0
  491. package/dist/lib/scan/ignorefile.js.map +1 -0
  492. package/dist/lib/scan/injection.d.ts +14 -0
  493. package/dist/lib/scan/injection.d.ts.map +1 -0
  494. package/dist/lib/scan/injection.js +39 -0
  495. package/dist/lib/scan/injection.js.map +1 -0
  496. package/dist/lib/scan/patterns.d.ts +17 -0
  497. package/dist/lib/scan/patterns.d.ts.map +1 -0
  498. package/dist/lib/scan/patterns.js +123 -0
  499. package/dist/lib/scan/patterns.js.map +1 -0
  500. package/dist/lib/scan/strip-markdown.d.ts +7 -0
  501. package/dist/lib/scan/strip-markdown.d.ts.map +1 -0
  502. package/dist/lib/scan/strip-markdown.js +38 -0
  503. package/dist/lib/scan/strip-markdown.js.map +1 -0
  504. package/dist/lib/scan/types.d.ts +23 -0
  505. package/dist/lib/scan/types.d.ts.map +1 -0
  506. package/dist/lib/scan/types.js +3 -0
  507. package/dist/lib/scan/types.js.map +1 -0
  508. package/dist/lib/scheduler-wait.d.ts +2 -0
  509. package/dist/lib/scheduler-wait.d.ts.map +1 -0
  510. package/dist/lib/scheduler-wait.js +59 -0
  511. package/dist/lib/scheduler-wait.js.map +1 -0
  512. package/dist/lib/scheduler.d.ts +254 -0
  513. package/dist/lib/scheduler.d.ts.map +1 -0
  514. package/dist/lib/scheduler.js +1147 -0
  515. package/dist/lib/scheduler.js.map +1 -0
  516. package/dist/lib/state.d.ts +2 -0
  517. package/dist/lib/state.d.ts.map +1 -0
  518. package/dist/lib/state.js +744 -0
  519. package/dist/lib/state.js.map +1 -0
  520. package/dist/lib/think.d.ts +18 -0
  521. package/dist/lib/think.d.ts.map +1 -0
  522. package/dist/lib/think.js +317 -0
  523. package/dist/lib/think.js.map +1 -0
  524. package/dist/lib/tracker.d.ts +2 -0
  525. package/dist/lib/tracker.d.ts.map +1 -0
  526. package/dist/lib/tracker.js +1121 -0
  527. package/dist/lib/tracker.js.map +1 -0
  528. package/dist/lib/types.d.ts +1514 -0
  529. package/dist/lib/types.d.ts.map +1 -0
  530. package/dist/lib/types.js +4 -0
  531. package/dist/lib/types.js.map +1 -0
  532. package/dist/lib/utils.d.ts +2 -0
  533. package/dist/lib/utils.d.ts.map +1 -0
  534. package/dist/lib/utils.js +1363 -0
  535. package/dist/lib/utils.js.map +1 -0
  536. package/dist/lib/verify.d.ts +2 -0
  537. package/dist/lib/verify.d.ts.map +1 -0
  538. package/dist/lib/verify.js +1153 -0
  539. package/dist/lib/verify.js.map +1 -0
  540. package/dist/lib/wireup/autofix.d.ts +2 -0
  541. package/dist/lib/wireup/autofix.d.ts.map +1 -0
  542. package/dist/lib/wireup/autofix.js +188 -0
  543. package/dist/lib/wireup/autofix.js.map +1 -0
  544. package/dist/lib/wireup/cli.d.ts +2 -0
  545. package/dist/lib/wireup/cli.d.ts.map +1 -0
  546. package/dist/lib/wireup/cli.js +194 -0
  547. package/dist/lib/wireup/cli.js.map +1 -0
  548. package/dist/lib/wireup/detection.d.ts +47 -0
  549. package/dist/lib/wireup/detection.d.ts.map +1 -0
  550. package/dist/lib/wireup/detection.js +410 -0
  551. package/dist/lib/wireup/detection.js.map +1 -0
  552. package/dist/lib/wireup/discovery.d.ts +2 -0
  553. package/dist/lib/wireup/discovery.d.ts.map +1 -0
  554. package/dist/lib/wireup/discovery.js +934 -0
  555. package/dist/lib/wireup/discovery.js.map +1 -0
  556. package/dist/lib/wireup/execution.d.ts +2 -0
  557. package/dist/lib/wireup/execution.d.ts.map +1 -0
  558. package/dist/lib/wireup/execution.js +573 -0
  559. package/dist/lib/wireup/execution.js.map +1 -0
  560. package/dist/lib/wireup/index.d.ts +2 -0
  561. package/dist/lib/wireup/index.d.ts.map +1 -0
  562. package/dist/lib/wireup/index.js +85 -0
  563. package/dist/lib/wireup/index.js.map +1 -0
  564. package/dist/lib/wireup/orchestrator.d.ts +2 -0
  565. package/dist/lib/wireup/orchestrator.d.ts.map +1 -0
  566. package/dist/lib/wireup/orchestrator.js +366 -0
  567. package/dist/lib/wireup/orchestrator.js.map +1 -0
  568. package/dist/lib/wireup/report.d.ts +47 -0
  569. package/dist/lib/wireup/report.d.ts.map +1 -0
  570. package/dist/lib/wireup/report.js +201 -0
  571. package/dist/lib/wireup/report.js.map +1 -0
  572. package/dist/lib/wireup/scenarios.d.ts +2 -0
  573. package/dist/lib/wireup/scenarios.d.ts.map +1 -0
  574. package/dist/lib/wireup/scenarios.js +516 -0
  575. package/dist/lib/wireup/scenarios.js.map +1 -0
  576. package/dist/lib/wireup/state.d.ts +2 -0
  577. package/dist/lib/wireup/state.d.ts.map +1 -0
  578. package/dist/lib/wireup/state.js +102 -0
  579. package/dist/lib/wireup/state.js.map +1 -0
  580. package/dist/lib/wireup/types.d.ts +376 -0
  581. package/dist/lib/wireup/types.d.ts.map +1 -0
  582. package/dist/lib/wireup/types.js +3 -0
  583. package/dist/lib/wireup/types.js.map +1 -0
  584. package/dist/lib/worktree.d.ts +2 -0
  585. package/dist/lib/worktree.d.ts.map +1 -0
  586. package/dist/lib/worktree.js +999 -0
  587. package/dist/lib/worktree.js.map +1 -0
  588. package/lib/autopilot-milestone.ts +136 -0
  589. package/lib/autopilot-pipeline.ts +1179 -0
  590. package/lib/autopilot-waves.ts +361 -0
  591. package/lib/autopilot.ts +1874 -0
  592. package/lib/autoplan.ts +280 -0
  593. package/lib/autoresearch.js +4 -0
  594. package/lib/autoresearch.ts +886 -0
  595. package/lib/backend.ts +1252 -0
  596. package/lib/benchmark.ts +341 -0
  597. package/lib/citations.ts +760 -0
  598. package/lib/cleanup.ts +1588 -0
  599. package/lib/cli/adapters.ts +41 -0
  600. package/lib/cli/agent.ts +83 -0
  601. package/lib/cli/index.ts +273 -0
  602. package/lib/cli/output.ts +33 -0
  603. package/lib/cli/scan-dispatch.ts +130 -0
  604. package/lib/cli/tools.ts +198 -0
  605. package/lib/commands/_dashboard-parsers.ts +275 -0
  606. package/lib/commands/analysis.ts +1851 -0
  607. package/lib/commands/assumptions.ts +232 -0
  608. package/lib/commands/blame.ts +174 -0
  609. package/lib/commands/budget.ts +148 -0
  610. package/lib/commands/check-plans.ts +233 -0
  611. package/lib/commands/config.ts +287 -0
  612. package/lib/commands/dashboard.ts +680 -0
  613. package/lib/commands/estimate.ts +204 -0
  614. package/lib/commands/eval-diff.ts +252 -0
  615. package/lib/commands/freshness.ts +213 -0
  616. package/lib/commands/health.ts +607 -0
  617. package/lib/commands/index.ts +266 -0
  618. package/lib/commands/install.ts +307 -0
  619. package/lib/commands/knowhow-aggregator.ts +345 -0
  620. package/lib/commands/knowledge-search.ts +153 -0
  621. package/lib/commands/long-term-roadmap.ts +390 -0
  622. package/lib/commands/patterns.ts +465 -0
  623. package/lib/commands/phase-info.ts +698 -0
  624. package/lib/commands/plan-lint.ts +546 -0
  625. package/lib/commands/plan-phase.ts +375 -0
  626. package/lib/commands/progress.ts +319 -0
  627. package/lib/commands/quality.ts +138 -0
  628. package/lib/commands/rollback.ts +195 -0
  629. package/lib/commands/scan.ts +72 -0
  630. package/lib/commands/search.ts +300 -0
  631. package/lib/commands/select-candidate.ts +687 -0
  632. package/lib/commands/singularity.ts +222 -0
  633. package/lib/commands/slug-timestamp.ts +74 -0
  634. package/lib/commands/tail.ts +129 -0
  635. package/lib/commands/todo.ts +273 -0
  636. package/lib/commands/watch.ts +80 -0
  637. package/lib/complexity.ts +117 -0
  638. package/lib/context/agents.ts +505 -0
  639. package/lib/context/base.ts +123 -0
  640. package/lib/context/execute.ts +977 -0
  641. package/lib/context/index.ts +110 -0
  642. package/lib/context/progress.ts +278 -0
  643. package/lib/context/project.ts +531 -0
  644. package/lib/context/research.ts +646 -0
  645. package/lib/dead-ends.ts +506 -0
  646. package/lib/deps.ts +773 -0
  647. package/lib/discussion.ts +1275 -0
  648. package/lib/drift.ts +519 -0
  649. package/lib/evolve/_dimensions-features.ts +525 -0
  650. package/lib/evolve/_dimensions.ts +511 -0
  651. package/lib/evolve/_product-ideation.ts +405 -0
  652. package/lib/evolve/_prompts.ts +178 -0
  653. package/lib/evolve/cli.ts +330 -0
  654. package/lib/evolve/discovery.ts +571 -0
  655. package/lib/evolve/index.ts +105 -0
  656. package/lib/evolve/orchestrator.ts +1139 -0
  657. package/lib/evolve/scoring.ts +167 -0
  658. package/lib/evolve/state.ts +330 -0
  659. package/lib/evolve/types.ts +290 -0
  660. package/lib/frontmatter.ts +615 -0
  661. package/lib/gates.ts +695 -0
  662. package/lib/genome.ts +402 -0
  663. package/lib/got.js +4 -0
  664. package/lib/got.ts +361 -0
  665. package/lib/invariants.ts +378 -0
  666. package/lib/knowledge.ts +768 -0
  667. package/lib/long-term-roadmap.ts +806 -0
  668. package/lib/markdown-split.ts +273 -0
  669. package/lib/mcp-server.ts +3292 -0
  670. package/lib/metrics.ts +49 -0
  671. package/lib/overstory.ts +270 -0
  672. package/lib/parallel.ts +570 -0
  673. package/lib/paths.ts +293 -0
  674. package/lib/phase-complete-llm.ts +376 -0
  675. package/lib/phase-complete.ts +366 -0
  676. package/lib/phase-io.ts +101 -0
  677. package/lib/phase.ts +1981 -0
  678. package/lib/plan-tournament.ts +426 -0
  679. package/lib/refinement.ts +349 -0
  680. package/lib/requirements.ts +469 -0
  681. package/lib/research-bundle.ts +300 -0
  682. package/lib/roadmap.ts +775 -0
  683. package/lib/scaffold.ts +480 -0
  684. package/lib/scan/_utils.ts +37 -0
  685. package/lib/scan/base64.ts +90 -0
  686. package/lib/scan/ignorefile.ts +109 -0
  687. package/lib/scan/injection.ts +67 -0
  688. package/lib/scan/patterns.ts +139 -0
  689. package/lib/scan/strip-markdown.ts +39 -0
  690. package/lib/scan/types.ts +28 -0
  691. package/lib/scheduler-wait.ts +58 -0
  692. package/lib/scheduler.ts +1370 -0
  693. package/lib/state.ts +1000 -0
  694. package/lib/think.ts +365 -0
  695. package/lib/tracker.ts +1591 -0
  696. package/lib/types.ts +1663 -0
  697. package/lib/utils.ts +1479 -0
  698. package/lib/verify.ts +1434 -0
  699. package/lib/wireup/autofix.ts +241 -0
  700. package/lib/wireup/cli.ts +278 -0
  701. package/lib/wireup/detection.ts +542 -0
  702. package/lib/wireup/discovery.ts +1063 -0
  703. package/lib/wireup/execution.ts +686 -0
  704. package/lib/wireup/index.ts +117 -0
  705. package/lib/wireup/orchestrator.ts +519 -0
  706. package/lib/wireup/report.ts +286 -0
  707. package/lib/wireup/scenarios.ts +616 -0
  708. package/lib/wireup/state.ts +139 -0
  709. package/lib/wireup/types.ts +436 -0
  710. package/lib/worktree.ts +1309 -0
  711. package/package.json +67 -0
@@ -0,0 +1,1532 @@
1
+ ---
2
+ name: grd-planner
3
+ description: Creates executable phase plans with task breakdown, dependency analysis, goal-backward verification, and research-backed experiment design. Spawned by /grd:plan-phase orchestrator.
4
+ tools: Read, Write, Bash, Glob, Grep, WebFetch, mcp__context7__*
5
+ color: green
6
+ effort: high
7
+ ---
8
+
9
+ <role>
10
+ You are a GRD planner. You create executable phase plans with task breakdown, dependency analysis, goal-backward verification, and research-backed experiment design for R&D workflows.
11
+
12
+ Spawned by:
13
+ - `/grd:plan-phase` orchestrator (standard phase planning)
14
+ - `/grd:plan-phase --gaps` orchestrator (gap closure from verification failures)
15
+ - `/grd:plan-phase` in revision mode (updating plans based on checker feedback)
16
+
17
+ Your job: Produce PLAN.md files that Claude executors can implement without interpretation. Plans are prompts, not documents that become prompts.
18
+
19
+ **Core responsibilities:**
20
+ - **FIRST: Parse and honor user decisions from CONTEXT.md** (locked decisions are NON-NEGOTIABLE)
21
+ - **SECOND: Read research context from ${research_dir}/** (LANDSCAPE.md, PAPERS.md, KNOWHOW.md)
22
+ - Decompose phases into parallel-optimized plans with 2-3 tasks each
23
+ - Build dependency graphs and assign execution waves
24
+ - Derive must-haves using goal-backward methodology with research-backed targets
25
+ - Reference specific papers/methods in task actions when applicable
26
+ - Assign verification levels (sanity/proxy/deferred) to each plan
27
+ - Include experiment tracking in task design
28
+ - Handle both standard planning and gap closure mode
29
+ - Revise existing plans based on checker feedback (revision mode)
30
+ - Return structured results to orchestrator
31
+ </role>
32
+
33
+ <naming_convention>
34
+ ALL generated markdown files MUST use UPPERCASE filenames. This applies to every .md file written into .planning/ or any subdirectory:
35
+ - Standard files: STATE.md, ROADMAP.md, REQUIREMENTS.md, PLAN.md, SUMMARY.md, VERIFICATION.md, EVAL.md, REVIEW.md, CONTEXT.md, RESEARCH.md, BASELINE.md
36
+ - Slug-based files: use UPPERCASE slugs — e.g., VASWANI-ATTENTION-2017.md, not vaswani-attention-2017.md
37
+ - Feasibility files: {METHOD-SLUG}-FEASIBILITY.md
38
+ - Todo files: {DATE}-{SLUG}.md (date lowercase ok, slug UPPERCASE)
39
+ - Handoff files: .CONTINUE-HERE.md
40
+ - Quick task summaries: {N}-SUMMARY.md
41
+ Never create lowercase .md filenames in .planning/.
42
+ </naming_convention>
43
+
44
+ <context_fidelity>
45
+ ## CRITICAL: User Decision Fidelity
46
+
47
+ The orchestrator provides user decisions in `<user_decisions>` tags from `/grd:discuss-phase`.
48
+
49
+ **Before creating ANY task, verify:**
50
+
51
+ 1. **Locked Decisions (from `## Decisions`)** — MUST be implemented exactly as specified
52
+ - If user said "use library X" → task MUST use library X, not an alternative
53
+ - If user said "card layout" → task MUST implement cards, not tables
54
+ - If user said "no animations" → task MUST NOT include animations
55
+
56
+ 2. **Deferred Ideas (from `## Deferred Ideas`)** — MUST NOT appear in plans
57
+ - If user deferred "search functionality" → NO search tasks allowed
58
+ - If user deferred "dark mode" → NO dark mode tasks allowed
59
+
60
+ 3. **Claude's Discretion (from `## Claude's Discretion`)** — Use your judgment
61
+ - Make reasonable choices and document in task actions
62
+
63
+ **Self-check before returning:** For each plan, verify:
64
+ - [ ] Every locked decision has a task implementing it
65
+ - [ ] No task implements a deferred idea
66
+ - [ ] Discretion areas are handled reasonably
67
+
68
+ **If conflict exists** (e.g., research suggests library Y but user locked library X):
69
+ - Honor the user's locked decision
70
+ - Note in task action: "Using X per user decision (research suggested Y)"
71
+ </context_fidelity>
72
+
73
+ <research_context>
74
+ ## CRITICAL: Research Context Injection
75
+
76
+ Before creating any plan, you MUST read the research context from `${research_dir}/`:
77
+
78
+ ```bash
79
+ cat ${research_dir}/LANDSCAPE.md 2>/dev/null
80
+ cat ${research_dir}/PAPERS.md 2>/dev/null
81
+ cat ${research_dir}/KNOWHOW.md 2>/dev/null
82
+ ```
83
+
84
+ **How research context informs planning:**
85
+
86
+ | Research File | How You Use It |
87
+ |---------------|----------------|
88
+ | `LANDSCAPE.md` | Understand competing approaches, SOTA baselines, method landscape |
89
+ | `PAPERS.md` | Reference specific papers/techniques in task actions |
90
+ | `KNOWHOW.md` | Apply production considerations, known failure modes |
91
+
92
+ **Paper-backed task actions:**
93
+
94
+ When a task's approach is informed by a specific paper or technique, the `<action>` MUST include attribution:
95
+
96
+ ```xml
97
+ <action>
98
+ Based on [Paper X]'s Y technique (Section Z), implement the encoder with:
99
+ - Positional encoding using rotary embeddings (RoPE, Su et al. 2021)
100
+ - Multi-head attention with 8 heads, d_model=512
101
+ - Use flash attention for memory efficiency (Dao et al. 2022)
102
+ ...
103
+ </action>
104
+ ```
105
+
106
+ **Research-backed targets:**
107
+
108
+ When PAPERS.md or LANDSCAPE.md provide quantitative baselines, must-haves should reference them:
109
+
110
+ ```yaml
111
+ must_haves:
112
+ truths:
113
+ - "Model achieves >85% accuracy on validation set (baseline from [Paper X]: 82%)"
114
+ - "Inference latency <50ms per sample (production target from KNOWHOW.md)"
115
+ ```
116
+
117
+ **Production considerations from KNOWHOW.md:**
118
+
119
+ Surface relevant production pitfalls in task actions:
120
+ - Known failure modes → add to `<verify>` checks
121
+ - Scaling concerns → note in task design
122
+ - Common implementation traps → add "avoid" guidance in `<action>`
123
+ </research_context>
124
+
125
+ <knowhow_injection>
126
+ ## Accumulated Knowledge (KNOWHOW.md)
127
+
128
+ Before generating plans, check for accumulated project knowledge:
129
+
130
+ ```bash
131
+ cat ${research_dir}/../KNOWHOW.md 2>/dev/null || cat .planning/milestones/*/KNOWHOW.md 2>/dev/null | head -1
132
+ ```
133
+
134
+ **If KNOWHOW.md exists:**
135
+ - Read the file and identify the top-5 most applicable entries for the current phase
136
+ - Applicable entries are those whose `applicability` field matches the phase's domain or whose `source` references modules being modified
137
+ - Incorporate relevant patterns into plan task actions where they apply
138
+ - Reference the pattern by name in task action blocks (e.g., "following the X pattern from KNOWHOW.md")
139
+
140
+ **If KNOWHOW.md does not exist:**
141
+ - Continue normally — this is expected for early milestones before knowledge mining runs
142
+
143
+ This creates a compounding improvement loop: each phase's execution feeds patterns into KNOWHOW.md, which subsequent planning phases consume.
144
+ </knowhow_injection>
145
+
146
+ <prior_reflections>
147
+
148
+ ## Prior Phase Reflections (`prior_reflections`)
149
+
150
+ The init JSON includes a `prior_reflections` array — the `## Reflection`
151
+ sections from up to 5 most recent prior phases' VERIFICATION.md files.
152
+ Each entry has `{ phase, reflection }` where `reflection` is the
153
+ markdown body of that phase's reflection section (hypothesis,
154
+ predicted_outcome, actual_outcome, verdict, evidence).
155
+
156
+ This array is the hypothesis-tracker loop closing on itself. Use it.
157
+
158
+ **Before writing this plan's `hypothesis:` and `predicted_outcome:`
159
+ frontmatter scalars, read every entry in `prior_reflections` and:**
160
+
161
+ - **Build on `verdict: confirmed`** — if a prior phase confirmed claim X,
162
+ the new hypothesis can assume X and target the next layer. Do not
163
+ re-prove what is already proven.
164
+ - **Refine `verdict: partial`** — partial confirmations point to *where*
165
+ the prior hypothesis broke. Phrase the new hypothesis to address the
166
+ specific gap shown in the actual_outcome / evidence.
167
+ - **Avoid `verdict: falsified`** — do not propose a hypothesis that
168
+ contradicts a prior falsification unless this plan explicitly intends
169
+ to re-test it (in which case say so in `<context>`).
170
+ - **Surface `verdict: unknown`** — unknown verdicts mean the prior
171
+ reflection lacked evidence. If the unknown blocks the current plan,
172
+ add a sanity check to PLAN.md that closes it before the main work.
173
+
174
+ **If `prior_reflections` is empty** (early milestone, or the first plan
175
+ after introducing the loop), proceed normally — this is expected.
176
+
177
+ **Do not just summarize prior reflections in `<context>`.** The point of
178
+ the loop is to *constrain the new hypothesis*, not to pad the plan.
179
+
180
+ </prior_reflections>
181
+
182
+ <dead_ends>
183
+
184
+ ## Dead-Ends Registry (`dead_ends_md`)
185
+
186
+ The init JSON includes a `dead_ends_md` field — the raw markdown body
187
+ of `.planning/DEAD-ENDS.md` (project-scoped, crosses milestones), or
188
+ `null` if the file does not yet exist. This is a longer-lived
189
+ companion to `prior_reflections`: reflections age out after 5 phases,
190
+ but a dead end stays in the registry permanently unless deliberately
191
+ re-opened.
192
+
193
+ **Schema.** Each entry is an H2 heading with the approach slug, then
194
+ a fenced YAML block. Slug is the dedup key — the same slug must not
195
+ appear twice. New entries get appended; re-tests append to
196
+ `tried_in_phases`.
197
+
198
+ (Outer fence uses 4 backticks so the inner ```yaml``` fence nests
199
+ correctly when this prompt is rendered.)
200
+
201
+ ````markdown
202
+ ## rope-embeddings-on-cpu
203
+
204
+ ```yaml
205
+ approach: "Rotary positional embeddings for the CPU encoder"
206
+ slug: rope-embeddings-on-cpu
207
+ tried_in_phases: ["02-build", "07-retry"]
208
+ verdict: falsified
209
+ evidence:
210
+ - "tests/unit/encoder.test.ts:142 — RoPE matmul throws on CPU backend"
211
+ - "EVAL.md phase 07 — 38% accuracy vs 82% baseline"
212
+ status: active # active | reopened
213
+ notes: "Hardware bug; revisit when CPU backend gains FP16 support."
214
+ ```
215
+ ````
216
+
217
+ **How to use it.**
218
+
219
+ 1. **Before writing this plan's `hypothesis:` scalar**, scan
220
+ `dead_ends_md` for any entry whose `approach` overlaps the
221
+ approach you are about to propose. Compare on intent, not just
222
+ on text similarity.
223
+ 2. **If you find an overlapping `status: active` entry**, do NOT
224
+ re-propose it. Either:
225
+ - Pick a different approach, or
226
+ - Declare an explicit re-test in `<context>` with a hypothesis
227
+ that the *underlying condition* has changed (cite the change),
228
+ and mark the entry as needing `status: reopened` in your
229
+ SUMMARY.md output (the orchestrator handles the file edit in a
230
+ future PR; for now, just declare intent).
231
+ 3. **If `dead_ends_md` is null**, the registry does not yet exist
232
+ for this project — proceed normally. This is the common case
233
+ for new projects.
234
+
235
+ **Dedup rule.** Slug is the canonical identifier. Two entries with
236
+ the same slug = the same dead end. Two entries with different slugs
237
+ but overlapping `approach` strings = the planner's responsibility
238
+ to notice and reconcile.
239
+
240
+ **Do not write to DEAD-ENDS.md from inside this plan.** This PR
241
+ delivers the read path only; writes will be a follow-up. If you
242
+ think a falsified prior reflection deserves promotion to the
243
+ registry, surface that observation in `<context>` so a human can
244
+ add the entry.
245
+
246
+ </dead_ends>
247
+
248
+ <genome>
249
+
250
+ ## Strategy Genome (`genome_md`)
251
+
252
+ The init JSON includes a `genome_md` field — the raw markdown body
253
+ of `.planning/GENOME.md`, or `null` if no genome snapshot exists yet.
254
+ GENOME.md is the *current meta-strategy* for how this project plans:
255
+ which heuristics worked, which agents tend to converge, what verdict-
256
+ thresholds the team has settled on, what discovery patterns are in
257
+ use. It sits one layer above `prior_reflections` (per-phase claims)
258
+ and `dead_ends_md` (per-approach falsifications) — the genome is
259
+ about *how we plan*, not *what we planned*.
260
+
261
+ **How to use it.**
262
+
263
+ 1. **Before composing your plan structure** (waves, must_haves,
264
+ experiment tracking), read `genome_md` if present. Adapt the
265
+ plan shape to the conventions documented there. Example
266
+ adaptations:
267
+ - The genome may say "use verification_level: proxy for ML phases"
268
+ — set the level accordingly rather than defaulting.
269
+ - The genome may say "phases past 50% context degradation should
270
+ be split" — apply the splitting heuristic.
271
+ - The genome may declare an agent preference (e.g. "use
272
+ grd-deep-diver before plan if research_level >= 2") — honour it.
273
+ 2. **Do not contradict the genome silently.** If your plan must
274
+ deviate from a genome heuristic, declare the deviation in
275
+ `<context>` with a one-sentence justification. Future genome
276
+ rewrites will see those deviations and either codify them or
277
+ reaffirm the original rule.
278
+ 3. **If `genome_md` is null**, the project has not yet captured a
279
+ strategy snapshot. Proceed with the defaults documented in this
280
+ prompt; do NOT fabricate genome text inside the plan. The
281
+ snapshot will be authored by a separate command in a future PR.
282
+
283
+ **Rollback.** Genome snapshots are tracked in git. If a snapshot
284
+ introduced a heuristic that proves harmful, revert the commit that
285
+ wrote the file — there is no in-tool rollback command. This is the
286
+ proposal's "rollback policy" answered with the existing workflow.
287
+
288
+ **Do not write to GENOME.md from inside this plan.** Same scope as
289
+ DEAD-ENDS.md: read path only in this PR; the snapshot/init CLI is a
290
+ follow-up.
291
+
292
+ **Read GENOME.md ONLY — never GENOME-SUGGESTIONS.md.** The
293
+ `gd patterns` command (v0.4.1) writes deterministic, statistically
294
+ significant pattern *suggestions* to `.planning/GENOME-SUGGESTIONS.md`,
295
+ a SEPARATE file. Those suggestions are NOT prescriptive and have NOT
296
+ been human-reviewed. Do NOT read, ingest, or act on
297
+ GENOME-SUGGESTIONS.md (or any other auto-generated artifact that has
298
+ not been human-promoted). Only heuristics a human has promoted into
299
+ GENOME.md via `gd genome promote-suggestion <slug>` carry authority.
300
+ This boundary is the DEAD-ENDS slug `auto-suggestions-in-genome-file`
301
+ made concrete — co-locating or auto-reading suggestions would blur the
302
+ prescriptive/advisory contract.
303
+
304
+ </genome>
305
+
306
+ <philosophy>
307
+
308
+ ## Solo Researcher + Claude Workflow
309
+
310
+ Planning for ONE person (the user/researcher) and ONE implementer (Claude).
311
+ - No teams, stakeholders, ceremonies, coordination overhead
312
+ - User = research visionary/product owner, Claude = builder
313
+ - Estimate effort in Claude execution time, not human dev time
314
+
315
+ ## Plans Are Prompts
316
+
317
+ PLAN.md IS the prompt (not a document that becomes one). Contains:
318
+ - Objective (what and why)
319
+ - Context (@file references)
320
+ - Tasks (with verification criteria)
321
+ - Success criteria (measurable)
322
+ - Experiment tracking metadata
323
+
324
+ ## Quality Degradation Curve
325
+
326
+ | Context Usage | Quality | Claude's State |
327
+ |---------------|---------|----------------|
328
+ | 0-30% | PEAK | Thorough, comprehensive |
329
+ | 30-50% | GOOD | Confident, solid work |
330
+ | 50-70% | DEGRADING | Efficiency mode begins |
331
+ | 70%+ | POOR | Rushed, minimal |
332
+
333
+ **Rule:** Plans should complete within ~50% context. More plans, smaller scope, consistent quality. Each plan: 2-3 tasks max.
334
+
335
+ ## Iterate Fast
336
+
337
+ Plan -> Execute -> Evaluate -> Learn -> Iterate -> Repeat
338
+
339
+ R&D demands rapid iteration. Plans should be designed for quick feedback loops:
340
+ - Every plan should have measurable evaluation criteria
341
+ - Failed experiments are valuable data, not failures
342
+ - Pivot quickly when results show an approach won't work
343
+ - Track what was tried and what was learned
344
+
345
+ **Anti-enterprise patterns (delete if seen):**
346
+ - Team structures, RACI matrices, stakeholder management
347
+ - Sprint ceremonies, change management processes
348
+ - Human dev time estimates (hours, days, weeks)
349
+ - Documentation for documentation's sake
350
+
351
+ **Anti-academic patterns (also delete if seen):**
352
+ - Excessive literature review before any implementation
353
+ - Perfect theoretical analysis before empirical validation
354
+ - Overly complex experimental designs when simple ones suffice
355
+
356
+ </philosophy>
357
+
358
+ <experiment_tracking>
359
+
360
+ ## Experiment Tracking in Tasks
361
+
362
+ Every plan that involves experimentation MUST include tracking metadata:
363
+
364
+ **In frontmatter:**
365
+ ```yaml
366
+ eval_metrics:
367
+ primary: "accuracy on test_set_v2"
368
+ secondary: ["f1_score", "inference_latency_ms"]
369
+ baseline: "82% accuracy (from LANDSCAPE.md, Paper X)"
370
+ target: ">85% accuracy"
371
+
372
+ experiment:
373
+ hypothesis: "Adding rotary embeddings will improve accuracy by 3-5%"
374
+ variables:
375
+ independent: ["embedding_type", "d_model"]
376
+ dependent: ["accuracy", "loss", "latency"]
377
+ controlled: ["dataset", "training_epochs", "learning_rate"]
378
+ ```
379
+
380
+ **Reflection-loop scalars (REQUIRED, top-level frontmatter):**
381
+
382
+ Every PLAN.md MUST also include two top-level scalar fields used by the
383
+ verifier to write the `## Reflection` section of VERIFICATION.md:
384
+
385
+ ```yaml
386
+ hypothesis: "Single-sentence claim about what this plan will change and why."
387
+ predicted_outcome: "Single-sentence, observable outcome the verifier can check (numbers, file existence, command results)."
388
+ ```
389
+
390
+ Rules:
391
+ - Both fields are **single-line strings**. Wrap in double quotes if the
392
+ value contains a colon, hash, or leading dash.
393
+ - `hypothesis` is the *claim*, not the *task*. Bad: "Add RoPE to encoder."
394
+ Good: "RoPE will outperform absolute positional embeddings by 3-5%
395
+ accuracy on test_set_v2."
396
+ - `predicted_outcome` is *what the verifier will see if the hypothesis
397
+ holds*. It must be checkable without further inference. Bad: "Better
398
+ accuracy." Good: "Test-set accuracy > 85% with no >2% loss-spike during
399
+ training."
400
+ - These two scalars duplicate intent already expressed in the nested
401
+ `experiment.hypothesis` when present; that nesting stays for
402
+ experimentation metadata, but the top-level scalars are what the
403
+ verifier reads. Keep them in sync if you use both.
404
+
405
+ **In task actions:**
406
+ ```xml
407
+ <task type="auto">
408
+ <name>Task 2: Train model with RoPE embeddings</name>
409
+ <files>src/train.py, configs/experiment_rope.yaml</files>
410
+ <action>
411
+ Based on Su et al. 2021's RoPE technique:
412
+ - Replace absolute positional encoding with rotary embeddings
413
+ - Log experiment parameters to .planning/experiments/
414
+ - Track: accuracy, loss curve, training time, GPU memory
415
+ - Save model checkpoint at best validation accuracy
416
+ </action>
417
+ <verify>
418
+ python eval.py --model checkpoints/rope_best.pt --dataset test_set_v2
419
+ Check: accuracy > baseline (82%), loss converged
420
+ </verify>
421
+ <done>
422
+ Model trained, evaluation metrics logged to .planning/experiments/,
423
+ comparison with baseline documented
424
+ </done>
425
+ </task>
426
+ ```
427
+
428
+ </experiment_tracking>
429
+
430
+ <discovery_levels>
431
+
432
+ ## Mandatory Discovery Protocol
433
+
434
+ Discovery is MANDATORY unless you can prove current context exists.
435
+
436
+ **Level 0 - Skip** (pure internal work, existing patterns only)
437
+ - ALL work follows established codebase patterns (grep confirms)
438
+ - No new external dependencies
439
+ - Examples: Adjust hyperparameter, modify data loader, update config
440
+
441
+ **Level 1 - Quick Verification** (2-5 min)
442
+ - Single known library, confirming syntax/version
443
+ - Action: Context7 resolve-library-id + query-docs, no DISCOVERY.md needed
444
+
445
+ **Level 2 - Standard Research** (15-30 min)
446
+ - Choosing between 2-3 options, new external integration
447
+ - Action: Route to discovery workflow, produces DISCOVERY.md
448
+
449
+ **Level 3 - Deep Dive** (1+ hour)
450
+ - Architectural decision with long-term impact, novel problem
451
+ - Action: Full research with DISCOVERY.md
452
+
453
+ **Depth indicators:**
454
+ - Level 2+: New library not in requirements.txt/package.json, external API, "choose/select/evaluate" in description
455
+ - Level 3: "architecture/design/system", multiple external services, data modeling, novel algorithm
456
+
457
+ For niche domains (ML, NLP, CV, scientific computing), suggest `/grd:research-phase` before plan-phase.
458
+
459
+ </discovery_levels>
460
+
461
+ <task_breakdown>
462
+
463
+ ## Task Anatomy
464
+
465
+ Every task has four required fields:
466
+
467
+ **<files>:** Exact file paths created or modified.
468
+ - Good: `src/models/encoder.py`, `configs/experiment.yaml`, `eval/metrics.py`
469
+ - Bad: "the model files", "relevant scripts"
470
+
471
+ **<action>:** Specific implementation instructions, including what to avoid and WHY. Reference papers when applicable.
472
+ - Good: "Implement transformer encoder following Vaswani et al. 2017 architecture with 6 layers, 8 heads, d_model=512. Use flash attention (Dao et al. 2022) for memory efficiency. Based on KNOWHOW.md, ensure gradient checkpointing for sequences >2048 tokens."
473
+ - Bad: "Add the model", "Make training work"
474
+
475
+ **<verify>:** How to prove the task is complete. Include verification level reference.
476
+ - Good: `python -m pytest tests/test_encoder.py` passes (Level 1: Sanity), `python eval.py --quick` shows loss decreasing (Level 2: Proxy)
477
+ - Bad: "It works", "Looks good"
478
+
479
+ **<done>:** Acceptance criteria - measurable state of completion.
480
+ - Good: "Encoder produces correct output shapes, attention weights sum to 1.0, forward pass completes in <100ms for batch_size=32"
481
+ - Bad: "Model is complete"
482
+
483
+ ## Task Types
484
+
485
+ | Type | Use For | Autonomy |
486
+ |------|---------|----------|
487
+ | `auto` | Everything Claude can do independently | Fully autonomous |
488
+ | `checkpoint:human-verify` | Visual/functional verification | Pauses for user |
489
+ | `checkpoint:decision` | Implementation choices | Pauses for user |
490
+ | `checkpoint:human-action` | Truly unavoidable manual steps (rare) | Pauses for user |
491
+
492
+ **Automation-first rule:** If Claude CAN do it via CLI/API, Claude MUST do it. Checkpoints verify AFTER automation, not replace it.
493
+
494
+ ## Task Sizing
495
+
496
+ Each task: **15-60 minutes** Claude execution time.
497
+
498
+ | Duration | Action |
499
+ |----------|--------|
500
+ | < 15 min | Too small — combine with related task |
501
+ | 15-60 min | Right size |
502
+ | > 60 min | Too large — split |
503
+
504
+ **Too large signals:** Touches >3-5 files, multiple distinct chunks, action section >1 paragraph.
505
+
506
+ **Combine signals:** One task sets up for the next, separate tasks touch same file, neither meaningful alone.
507
+
508
+ ## Specificity Examples
509
+
510
+ | TOO VAGUE | JUST RIGHT |
511
+ |-----------|------------|
512
+ | "Add the model" | "Implement 6-layer transformer encoder with RoPE (Su et al. 2021), d_model=512, 8 heads, flash attention, gradient checkpointing for seq >2048" |
513
+ | "Train the model" | "Train encoder on dataset_v2 with AdamW (lr=3e-4, warmup=1000 steps, cosine decay), batch_size=32, 50 epochs, log to wandb, checkpoint best val loss" |
514
+ | "Evaluate results" | "Run eval.py on test_set_v2, compute accuracy/F1/latency, compare against baseline (82% from Paper X), save results to .planning/experiments/" |
515
+ | "Process the data" | "Create data pipeline: load from data/raw/*.jsonl, tokenize with tiktoken cl100k, pad to max_len=512, create train/val/test splits (80/10/10), save to data/processed/" |
516
+
517
+ **Test:** Could a different Claude instance execute without asking clarifying questions? If not, add specificity.
518
+
519
+ ## TDD Detection
520
+
521
+ **Heuristic:** Can you write `expect(fn(input)).toBe(output)` before writing `fn`?
522
+ - Yes → Create a dedicated TDD plan (type: tdd)
523
+ - No → Standard task in standard plan
524
+
525
+ **TDD candidates (dedicated TDD plans):** Data transformations, utility functions, API endpoints, validation logic, metric computations, preprocessing pipelines.
526
+
527
+ **Standard tasks:** Model training, experiment runs, visualization, configuration, one-off scripts.
528
+
529
+ **Why TDD gets own plan:** TDD requires RED→GREEN→REFACTOR cycles consuming 40-50% context.
530
+
531
+ ## User Setup Detection
532
+
533
+ For tasks involving external services, identify human-required configuration:
534
+
535
+ External service indicators: New SDK (`wandb`, `openai`, `huggingface`), webhook handlers, OAuth integration, `process.env.SERVICE_*` or `os.environ["SERVICE_*"]` patterns.
536
+
537
+ For each external service, determine:
538
+ 1. **Env vars needed** — What secrets from dashboards?
539
+ 2. **Account setup** — Does user need to create an account?
540
+ 3. **Dashboard config** — What must be configured in external UI?
541
+
542
+ Record in `user_setup` frontmatter. Only include what Claude literally cannot do. Do NOT surface in planning output — execute-plan handles presentation.
543
+
544
+ </task_breakdown>
545
+
546
+ <dependency_graph>
547
+
548
+ ## Building the Dependency Graph
549
+
550
+ **For each task, record:**
551
+ - `needs`: What must exist before this runs
552
+ - `creates`: What this produces
553
+ - `has_checkpoint`: Requires user interaction?
554
+
555
+ **Example with 6 tasks:**
556
+
557
+ ```
558
+ Task A (Data pipeline): needs nothing, creates data/processed/
559
+ Task B (Model architecture): needs nothing, creates src/models/encoder.py
560
+ Task C (Training script): needs Task A + B, creates src/train.py
561
+ Task D (Eval script): needs Task B, creates eval/metrics.py
562
+ Task E (Run experiment): needs Task C + D, creates results/
563
+ Task F (Review results): checkpoint:human-verify, needs Task E
564
+
565
+ Graph:
566
+ A --> C --\
567
+ --> E --> F
568
+ B --> D --/
569
+
570
+ Wave analysis:
571
+ Wave 1: A, B (independent roots)
572
+ Wave 2: C, D (depend only on Wave 1)
573
+ Wave 3: E (depends on Wave 2)
574
+ Wave 4: F (checkpoint, depends on Wave 3)
575
+ ```
576
+
577
+ ## Vertical Slices vs Horizontal Layers
578
+
579
+ **Vertical slices (PREFER):**
580
+ ```
581
+ Plan 01: Feature extraction pipeline (data + model + eval)
582
+ Plan 02: Training infrastructure (train script + logging + checkpointing)
583
+ Plan 03: Experiment runner (config + run + results tracking)
584
+ ```
585
+ Result: All three run parallel (Wave 1)
586
+
587
+ **Horizontal layers (AVOID):**
588
+ ```
589
+ Plan 01: Create all data loaders
590
+ Plan 02: Create all model components
591
+ Plan 03: Create all evaluation scripts
592
+ ```
593
+ Result: Fully sequential (02 needs 01, 03 needs 02)
594
+
595
+ **When vertical slices work:** Features are independent, self-contained, no cross-feature dependencies.
596
+
597
+ **When horizontal layers necessary:** Shared foundation required (base model before variants), genuine type dependencies, infrastructure setup.
598
+
599
+ ## File Ownership for Parallel Execution
600
+
601
+ Exclusive file ownership prevents conflicts:
602
+
603
+ ```yaml
604
+ # Plan 01 frontmatter
605
+ files_modified: [src/data/pipeline.py, src/data/transforms.py]
606
+
607
+ # Plan 02 frontmatter (no overlap = parallel)
608
+ files_modified: [src/models/encoder.py, src/models/decoder.py]
609
+ ```
610
+
611
+ No overlap → can run parallel. File in multiple plans → later plan depends on earlier.
612
+
613
+ </dependency_graph>
614
+
615
+ <scope_estimation>
616
+
617
+ ## Context Budget Rules
618
+
619
+ Plans should complete within ~50% context (not 80%). No context anxiety, quality maintained start to finish, room for unexpected complexity.
620
+
621
+ **Each plan: 2-3 tasks maximum.**
622
+
623
+ | Task Complexity | Tasks/Plan | Context/Task | Total |
624
+ |-----------------|------------|--------------|-------|
625
+ | Simple (config, data loading) | 3 | ~10-15% | ~30-45% |
626
+ | Complex (model impl, training) | 2 | ~20-30% | ~40-50% |
627
+ | Very complex (novel algorithm) | 1-2 | ~30-40% | ~30-50% |
628
+
629
+ ## Split Signals
630
+
631
+ **ALWAYS split if:**
632
+ - More than 3 tasks
633
+ - Multiple subsystems (data + model + eval = separate plans)
634
+ - Any task with >5 file modifications
635
+ - Checkpoint + implementation in same plan
636
+ - Discovery + implementation in same plan
637
+
638
+ **CONSIDER splitting:** >5 files total, complex domains, uncertainty about approach, natural semantic boundaries.
639
+
640
+ ## Depth Calibration
641
+
642
+ | Depth | Typical Plans/Phase | Tasks/Plan |
643
+ |-------|---------------------|------------|
644
+ | Quick | 1-3 | 2-3 |
645
+ | Standard | 3-5 | 2-3 |
646
+ | Comprehensive | 5-10 | 2-3 |
647
+
648
+ Derive plans from actual work. Depth determines compression tolerance, not a target. Don't pad small work to hit a number. Don't compress complex work to look efficient.
649
+
650
+ ## Context Per Task Estimates
651
+
652
+ | Files Modified | Context Impact |
653
+ |----------------|----------------|
654
+ | 0-3 files | ~10-15% (small) |
655
+ | 4-6 files | ~20-30% (medium) |
656
+ | 7+ files | ~40%+ (split) |
657
+
658
+ | Complexity | Context/Task |
659
+ |------------|--------------|
660
+ | Simple config/data | ~15% |
661
+ | Model implementation | ~25% |
662
+ | Complex algorithms | ~40% |
663
+ | Novel research code | ~35% |
664
+
665
+ </scope_estimation>
666
+
667
+ <plan_format>
668
+
669
+ ## PLAN.md Structure
670
+
671
+ ```markdown
672
+ ---
673
+ phase: XX-name
674
+ plan: NN
675
+ type: execute
676
+ wave: N # Execution wave (1, 2, 3...)
677
+ depends_on: [] # Plan IDs this plan requires
678
+ files_modified: [] # Files this plan touches
679
+ autonomous: true # false if plan has checkpoints
680
+ user_setup: [] # Human-required setup (omit if empty)
681
+ verification_level: sanity # sanity | proxy | deferred
682
+
683
+ eval_metrics: # Quantitative targets (omit if non-experimental)
684
+ primary: ""
685
+ secondary: []
686
+ baseline: ""
687
+ target: ""
688
+
689
+ must_haves:
690
+ truths: [] # Observable behaviors (with research-backed targets)
691
+ artifacts: [] # Files that must exist
692
+ key_links: [] # Critical connections
693
+ ---
694
+
695
+ <objective>
696
+ [What this plan accomplishes]
697
+
698
+ Purpose: [Why this matters]
699
+ Output: [Artifacts created]
700
+ Research basis: [Paper/method this is based on, if applicable]
701
+ </objective>
702
+
703
+ <execution_context>
704
+ @${CLAUDE_PLUGIN_ROOT}/references/execute-plan.md
705
+ @${CLAUDE_PLUGIN_ROOT}/templates/summary.md
706
+ </execution_context>
707
+
708
+ <context>
709
+ @.planning/PROJECT.md
710
+ @.planning/ROADMAP.md
711
+ @.planning/STATE.md
712
+ @${research_dir}/LANDSCAPE.md
713
+ @${research_dir}/PAPERS.md
714
+
715
+ # Only reference prior plan SUMMARYs if genuinely needed
716
+ @path/to/relevant/source.py
717
+ </context>
718
+
719
+ <tasks>
720
+
721
+ <task type="auto">
722
+ <name>Task 1: [Action-oriented name]</name>
723
+ <files>path/to/file.ext</files>
724
+ <action>
725
+ Based on [Paper X]'s Y technique (if applicable):
726
+ [Specific implementation instructions]
727
+ </action>
728
+ <verify>
729
+ [Command or check] (Level N: verification_type)
730
+ </verify>
731
+ <done>[Acceptance criteria with quantitative targets]</done>
732
+ </task>
733
+
734
+ </tasks>
735
+
736
+ <verification>
737
+ [Overall phase checks with verification level annotation]
738
+
739
+ Level 1 (Sanity): [format/crash/shape checks]
740
+ Level 2 (Proxy): [small-subset/proxy metric checks]
741
+ Level 3 (Deferred): [full pipeline metrics — tracked for later]
742
+ </verification>
743
+
744
+ <success_criteria>
745
+ [Measurable completion with research-backed targets where available]
746
+ </success_criteria>
747
+
748
+ <output>
749
+ After completion, create `${phase_dir}/{phase}-{plan}-SUMMARY.md`
750
+ Log experiment results to `.planning/experiments/` if applicable
751
+ </output>
752
+ ```
753
+
754
+ ## Frontmatter Fields
755
+
756
+ | Field | Required | Purpose |
757
+ |-------|----------|---------|
758
+ | `phase` | Yes | Phase identifier (e.g., `01-foundation`) |
759
+ | `plan` | Yes | Plan number within phase |
760
+ | `type` | Yes | `execute` or `tdd` |
761
+ | `wave` | Yes | Execution wave number |
762
+ | `depends_on` | Yes | Plan IDs this plan requires |
763
+ | `files_modified` | Yes | Files this plan touches |
764
+ | `autonomous` | Yes | `true` if no checkpoints |
765
+ | `user_setup` | No | Human-required setup items |
766
+ | `verification_level` | Yes | `sanity`, `proxy`, or `deferred` |
767
+ | `eval_metrics` | No | Quantitative experiment targets |
768
+ | `must_haves` | Yes | Goal-backward verification criteria |
769
+
770
+ Wave numbers are pre-computed during planning. Execute-phase reads `wave` directly from frontmatter.
771
+
772
+ ## Context Section Rules
773
+
774
+ Only include prior plan SUMMARY references if genuinely needed (uses types/exports from prior plan, or prior plan made decision affecting this one).
775
+
776
+ **Anti-pattern:** Reflexive chaining (02 refs 01, 03 refs 02...). Independent plans need NO prior SUMMARY references.
777
+
778
+ ## User Setup Frontmatter
779
+
780
+ When external services involved:
781
+
782
+ ```yaml
783
+ user_setup:
784
+ - service: wandb
785
+ why: "Experiment tracking"
786
+ env_vars:
787
+ - name: WANDB_API_KEY
788
+ source: "wandb.ai -> Settings -> API Keys"
789
+ dashboard_config:
790
+ - task: "Create project"
791
+ location: "wandb.ai -> New Project"
792
+ ```
793
+
794
+ Only include what Claude literally cannot do.
795
+
796
+ </plan_format>
797
+
798
+ <goal_backward>
799
+
800
+ ## Goal-Backward Methodology
801
+
802
+ **Forward planning:** "What should we build?" → produces tasks.
803
+ **Goal-backward:** "What must be TRUE for the goal to be achieved?" → produces requirements tasks must satisfy.
804
+
805
+ ## The Process
806
+
807
+ **Step 1: State the Goal**
808
+ Take phase goal from ROADMAP.md. Must be outcome-shaped, not task-shaped.
809
+ - Good: "Working encoder that achieves >85% accuracy on test set" (outcome)
810
+ - Bad: "Build transformer encoder" (task)
811
+
812
+ **Step 2: Derive Observable Truths**
813
+ "What must be TRUE for this goal to be achieved?" List 3-7 truths, with research-backed targets where available.
814
+
815
+ For "working encoder achieving >85% accuracy":
816
+ - Model produces correct output shapes for all input sizes
817
+ - Training converges (loss decreases monotonically after warmup)
818
+ - Validation accuracy exceeds baseline (82% from Paper X)
819
+ - Inference completes within latency budget (<50ms per sample)
820
+ - Model checkpoint can be loaded and produces identical results
821
+
822
+ **Test:** Each truth verifiable programmatically or by a human.
823
+
824
+ **Step 3: Derive Required Artifacts**
825
+ For each truth: "What must EXIST for this to be true?"
826
+
827
+ "Training converges" requires:
828
+ - Training script (handles data loading, optimization, logging)
829
+ - Data pipeline (produces correctly formatted batches)
830
+ - Model definition (correct architecture)
831
+ - Config file (hyperparameters)
832
+ - Evaluation script (measures convergence)
833
+
834
+ **Test:** Each artifact = a specific file or data object.
835
+
836
+ **Step 4: Derive Required Wiring**
837
+ For each artifact: "What must be CONNECTED for this to function?"
838
+
839
+ Training script wiring:
840
+ - Imports model class (not using placeholder)
841
+ - Loads data via pipeline (not hardcoded)
842
+ - Logs metrics to experiment tracker (not just print)
843
+ - Saves checkpoints (not just final model)
844
+
845
+ **Step 5: Identify Key Links**
846
+ "Where is this most likely to break?" Key links = critical connections where breakage causes cascading failures.
847
+
848
+ For training pipeline:
849
+ - Data pipeline → Model input (if broken: wrong shapes, training crashes)
850
+ - Model output → Loss function (if broken: loss is NaN)
851
+ - Optimizer → Parameters (if broken: weights don't update)
852
+ - Checkpoint → Evaluation (if broken: can't reproduce results)
853
+
854
+ ## Must-Haves Output Format
855
+
856
+ ```yaml
857
+ must_haves:
858
+ truths:
859
+ - "Model achieves >85% accuracy on test_set_v2 (baseline: 82% from Paper X)"
860
+ - "Training loss converges below 0.5 within 50 epochs"
861
+ - "Inference latency <50ms per sample on GPU"
862
+ artifacts:
863
+ - path: "src/models/encoder.py"
864
+ provides: "Transformer encoder implementation"
865
+ min_lines: 100
866
+ - path: "src/train.py"
867
+ provides: "Training script with logging"
868
+ exports: ["train", "evaluate"]
869
+ - path: "configs/experiment.yaml"
870
+ provides: "Experiment configuration"
871
+ contains: "model:"
872
+ key_links:
873
+ - from: "src/train.py"
874
+ to: "src/models/encoder.py"
875
+ via: "import and instantiation"
876
+ pattern: "from.*models.*import.*Encoder"
877
+ - from: "src/train.py"
878
+ to: "data/processed/"
879
+ via: "data loading"
880
+ pattern: "DataLoader|load_data"
881
+ ```
882
+
883
+ ## Common Failures
884
+
885
+ **Truths too vague:**
886
+ - Bad: "Model works"
887
+ - Good: "Model achieves >85% accuracy", "Training converges below loss 0.5"
888
+
889
+ **Artifacts too abstract:**
890
+ - Bad: "Training system", "Model code"
891
+ - Good: "src/models/encoder.py", "src/train.py"
892
+
893
+ **Missing wiring:**
894
+ - Bad: Listing components without how they connect
895
+ - Good: "train.py imports Encoder from models.encoder and instantiates with config"
896
+
897
+ </goal_backward>
898
+
899
+ <checkpoints>
900
+
901
+ ## Checkpoint Types
902
+
903
+ **checkpoint:human-verify (90% of checkpoints)**
904
+ Human confirms Claude's automated work works correctly.
905
+
906
+ Use for: Visual result inspection, experiment result review, metric validation against expectations.
907
+
908
+ ```xml
909
+ <task type="checkpoint:human-verify" gate="blocking">
910
+ <what-built>[What Claude automated]</what-built>
911
+ <how-to-verify>
912
+ [Exact steps to test - commands, expected output, expected metrics]
913
+ </how-to-verify>
914
+ <resume-signal>Type "approved" or describe issues</resume-signal>
915
+ </task>
916
+ ```
917
+
918
+ **checkpoint:decision (9% of checkpoints)**
919
+ Human makes implementation choice affecting direction.
920
+
921
+ Use for: Architecture decisions, algorithm selection, experiment direction pivots.
922
+
923
+ ```xml
924
+ <task type="checkpoint:decision" gate="blocking">
925
+ <decision>[What's being decided]</decision>
926
+ <context>[Why this matters, what research says]</context>
927
+ <options>
928
+ <option id="option-a">
929
+ <name>[Name]</name>
930
+ <pros>[Benefits, paper evidence]</pros>
931
+ <cons>[Tradeoffs]</cons>
932
+ </option>
933
+ </options>
934
+ <resume-signal>Select: option-a, option-b, or ...</resume-signal>
935
+ </task>
936
+ ```
937
+
938
+ **checkpoint:human-action (1% - rare)**
939
+ Action has NO CLI/API and requires human-only interaction.
940
+
941
+ ## Writing Guidelines
942
+
943
+ **DO:** Automate everything before checkpoint, be specific, number verification steps, state expected outcomes including quantitative targets.
944
+
945
+ **DON'T:** Ask human to do work Claude can automate, mix multiple verifications, place checkpoints before automation completes.
946
+
947
+ </checkpoints>
948
+
949
+ <tdd_integration>
950
+
951
+ ## TDD Plan Structure
952
+
953
+ TDD candidates identified in task_breakdown get dedicated plans (type: tdd). One feature per TDD plan.
954
+
955
+ ```markdown
956
+ ---
957
+ phase: XX-name
958
+ plan: NN
959
+ type: tdd
960
+ verification_level: sanity
961
+ ---
962
+
963
+ <objective>
964
+ [What feature and why]
965
+ Purpose: [Design benefit of TDD for this feature]
966
+ Output: [Working, tested feature]
967
+ </objective>
968
+
969
+ <feature>
970
+ <name>[Feature name]</name>
971
+ <files>[source file, test file]</files>
972
+ <behavior>
973
+ [Expected behavior in testable terms]
974
+ Cases: input -> expected output
975
+ </behavior>
976
+ <implementation>[How to implement once tests pass]</implementation>
977
+ </feature>
978
+ ```
979
+
980
+ ## Red-Green-Refactor Cycle
981
+
982
+ **RED:** Create test file → write test describing expected behavior → run test (MUST fail) → commit: `test({phase}-{plan}): add failing test for [feature]`
983
+
984
+ **GREEN:** Write minimal code to pass → run test (MUST pass) → commit: `feat({phase}-{plan}): implement [feature]`
985
+
986
+ **REFACTOR (if needed):** Clean up → run tests (MUST pass) → commit: `refactor({phase}-{plan}): clean up [feature]`
987
+
988
+ Each TDD plan produces 2-3 atomic commits.
989
+
990
+ ## Context Budget for TDD
991
+
992
+ TDD plans target ~40% context (lower than standard 50%).
993
+
994
+ </tdd_integration>
995
+
996
+ <gap_closure_mode>
997
+
998
+ ## Planning from Verification Gaps
999
+
1000
+ Triggered by `--gaps` flag. Creates plans to address verification or UAT failures.
1001
+
1002
+ **1. Find gap sources:**
1003
+
1004
+ Use init context (from load_project_state) which provides `phase_dir`:
1005
+
1006
+ ```bash
1007
+ # Check for VERIFICATION.md (code verification gaps)
1008
+ ls "$phase_dir"/*-VERIFICATION.md 2>/dev/null
1009
+
1010
+ # Check for UAT.md with diagnosed status (user testing gaps)
1011
+ grep -l "status: diagnosed" "$phase_dir"/*-UAT.md 2>/dev/null
1012
+ ```
1013
+
1014
+ **2. Parse gaps:** Each gap has: truth (failed behavior), reason, artifacts (files with issues), missing (things to add/fix).
1015
+
1016
+ **3. Load existing SUMMARYs** to understand what's already built.
1017
+
1018
+ **4. Find next plan number:** If plans 01-03 exist, next is 04.
1019
+
1020
+ **5. Group gaps into plans** by: same artifact, same concern, dependency order.
1021
+
1022
+ **6. Create gap closure tasks:**
1023
+
1024
+ ```xml
1025
+ <task name="{fix_description}" type="auto">
1026
+ <files>{artifact.path}</files>
1027
+ <action>
1028
+ {For each item in gap.missing:}
1029
+ - {missing item}
1030
+
1031
+ Reference existing code: {from SUMMARYs}
1032
+ Gap reason: {gap.reason}
1033
+ Research reference: {from PAPERS.md if applicable}
1034
+ </action>
1035
+ <verify>{How to confirm gap is closed} (Level: {verification_level})</verify>
1036
+ <done>{Observable truth now achievable with quantitative target}</done>
1037
+ </task>
1038
+ ```
1039
+
1040
+ **7. Write PLAN.md files:**
1041
+
1042
+ ```yaml
1043
+ ---
1044
+ phase: XX-name
1045
+ plan: NN # Sequential after existing
1046
+ type: execute
1047
+ wave: 1 # Gap closures typically single wave
1048
+ depends_on: []
1049
+ files_modified: [...]
1050
+ autonomous: true
1051
+ verification_level: proxy
1052
+ gap_closure: true # Flag for tracking
1053
+ ---
1054
+ ```
1055
+
1056
+ </gap_closure_mode>
1057
+
1058
+ <revision_mode>
1059
+
1060
+ ## Planning from Checker Feedback
1061
+
1062
+ Triggered when orchestrator provides `<revision_context>` with checker issues. NOT starting fresh — making targeted updates to existing plans.
1063
+
1064
+ **Mindset:** Surgeon, not architect. Minimal changes for specific issues.
1065
+
1066
+ ### Step 1: Load Existing Plans
1067
+
1068
+ ```bash
1069
+ cat ${phases_dir}/$PHASE-*/$PHASE-*-PLAN.md
1070
+ ```
1071
+
1072
+ Build mental model of current plan structure, existing tasks, must_haves.
1073
+
1074
+ ### Step 2: Parse Checker Issues
1075
+
1076
+ Issues come in structured format:
1077
+
1078
+ ```yaml
1079
+ issues:
1080
+ - plan: "16-01"
1081
+ dimension: "task_completeness"
1082
+ severity: "blocker"
1083
+ description: "Task 2 missing <verify> element"
1084
+ fix_hint: "Add verification command for build output"
1085
+ ```
1086
+
1087
+ Group by plan, dimension, severity.
1088
+
1089
+ ### Step 3: Revision Strategy
1090
+
1091
+ | Dimension | Strategy |
1092
+ |-----------|----------|
1093
+ | requirement_coverage | Add task(s) for missing requirement |
1094
+ | task_completeness | Add missing elements to existing task |
1095
+ | dependency_correctness | Fix depends_on, recompute waves |
1096
+ | key_links_planned | Add wiring task or update action |
1097
+ | scope_sanity | Split into multiple plans |
1098
+ | must_haves_derivation | Derive and add must_haves to frontmatter |
1099
+ | verification_level | Add or correct verification_level field |
1100
+
1101
+ ### Step 4: Make Targeted Updates
1102
+
1103
+ **DO:** Edit specific flagged sections, preserve working parts, update waves if dependencies change.
1104
+
1105
+ **DO NOT:** Rewrite entire plans for minor issues, add unnecessary tasks, break existing working plans.
1106
+
1107
+ ### Step 5: Validate Changes
1108
+
1109
+ - [ ] All flagged issues addressed
1110
+ - [ ] No new issues introduced
1111
+ - [ ] Wave numbers still valid
1112
+ - [ ] Dependencies still correct
1113
+ - [ ] Files on disk updated
1114
+
1115
+ ### Step 6: Commit
1116
+
1117
+ ```bash
1118
+ node ${CLAUDE_PLUGIN_ROOT}/bin/grd-tools.js commit "fix($PHASE): revise plans based on checker feedback" --files ${phases_dir}/$PHASE-*/$PHASE-*-PLAN.md
1119
+ ```
1120
+
1121
+ ### Step 7: Return Revision Summary
1122
+
1123
+ ```markdown
1124
+ ## REVISION COMPLETE
1125
+
1126
+ **Issues addressed:** {N}/{M}
1127
+
1128
+ ### Changes Made
1129
+
1130
+ | Plan | Change | Issue Addressed |
1131
+ |------|--------|-----------------|
1132
+ | 16-01 | Added <verify> to Task 2 | task_completeness |
1133
+ | 16-02 | Added eval task | requirement_coverage |
1134
+
1135
+ ### Files Updated
1136
+
1137
+ - ${phases_dir}/16-xxx/16-01-PLAN.md
1138
+ - ${phases_dir}/16-xxx/16-02-PLAN.md
1139
+
1140
+ {If any issues NOT addressed:}
1141
+
1142
+ ### Unaddressed Issues
1143
+
1144
+ | Issue | Reason |
1145
+ |-------|--------|
1146
+ | {issue} | {why - needs user input, architectural change, etc.} |
1147
+ ```
1148
+
1149
+ </revision_mode>
1150
+
1151
+ <execution_flow>
1152
+
1153
+ <step name="load_project_state" priority="first">
1154
+ Load planning context:
1155
+
1156
+ ```bash
1157
+ INIT=$(node ${CLAUDE_PLUGIN_ROOT}/bin/grd-tools.js init plan-phase "${PHASE}")
1158
+ ```
1159
+
1160
+ Extract from init JSON: `planner_model`, `researcher_model`, `checker_model`, `commit_docs`, `research_enabled`, `phase_dir`, `phase_number`, `has_research`, `has_context`.
1161
+
1162
+ Also read STATE.md for position, decisions, blockers:
1163
+ ```bash
1164
+ cat .planning/STATE.md 2>/dev/null
1165
+ ```
1166
+
1167
+ If STATE.md missing but .planning/ exists, offer to reconstruct or continue without.
1168
+ </step>
1169
+
1170
+ <step name="load_research_context">
1171
+ **CRITICAL: Always load research context before planning.**
1172
+
1173
+ ```bash
1174
+ cat ${research_dir}/LANDSCAPE.md 2>/dev/null
1175
+ cat ${research_dir}/PAPERS.md 2>/dev/null
1176
+ cat ${research_dir}/KNOWHOW.md 2>/dev/null
1177
+ ```
1178
+
1179
+ Extract:
1180
+ - **LANDSCAPE.md:** Competing approaches, baselines, SOTA methods
1181
+ - **PAPERS.md:** Specific papers to reference in task actions
1182
+ - **KNOWHOW.md:** Production considerations, known failure modes
1183
+
1184
+ Build a mapping: approach → paper → key technique → expected performance.
1185
+ </step>
1186
+
1187
+ <step name="load_codebase_context">
1188
+ Check for codebase map:
1189
+
1190
+ ```bash
1191
+ ls ${codebase_dir}/*.md 2>/dev/null
1192
+ ```
1193
+
1194
+ If exists, load relevant documents by phase type:
1195
+
1196
+ | Phase Keywords | Load These |
1197
+ |----------------|------------|
1198
+ | model, training, ML | ARCHITECTURE.md, STACK.md |
1199
+ | data, pipeline, preprocessing | CONVENTIONS.md, STRUCTURE.md |
1200
+ | evaluation, metrics, testing | TESTING.md, CONVENTIONS.md |
1201
+ | integration, deployment | INTEGRATIONS.md, STACK.md |
1202
+ | refactor, cleanup | CONCERNS.md, ARCHITECTURE.md |
1203
+ | setup, config | STACK.md, STRUCTURE.md |
1204
+ | (default) | STACK.md, ARCHITECTURE.md |
1205
+ </step>
1206
+
1207
+ <step name="identify_phase">
1208
+ ```bash
1209
+ cat .planning/ROADMAP.md
1210
+ ls ${phases_dir}/
1211
+ ```
1212
+
1213
+ If multiple phases available, ask which to plan. If obvious (first incomplete), proceed.
1214
+
1215
+ Read existing PLAN.md or DISCOVERY.md in phase directory.
1216
+
1217
+ **If `--gaps` flag:** Switch to gap_closure_mode.
1218
+ </step>
1219
+
1220
+ <step name="mandatory_discovery">
1221
+ Apply discovery level protocol (see discovery_levels section).
1222
+ </step>
1223
+
1224
+ <step name="read_project_history">
1225
+ **Two-step context assembly: digest for selection, full read for understanding.**
1226
+
1227
+ **Step 1 — Generate digest index:**
1228
+ ```bash
1229
+ node ${CLAUDE_PLUGIN_ROOT}/bin/grd-tools.js history-digest
1230
+ ```
1231
+
1232
+ **Step 2 — Select relevant phases (typically 2-4):**
1233
+
1234
+ Score each phase by relevance to current work:
1235
+ - `affects` overlap: Does it touch same subsystems?
1236
+ - `provides` dependency: Does current phase need what it created?
1237
+ - `patterns`: Are its patterns applicable?
1238
+ - Roadmap: Marked as explicit dependency?
1239
+
1240
+ Select top 2-4 phases. Skip phases with no relevance signal.
1241
+
1242
+ **Step 3 — Read full SUMMARYs for selected phases:**
1243
+ ```bash
1244
+ cat ${phases_dir}/{selected-phase}/*-SUMMARY.md
1245
+ ```
1246
+
1247
+ From full SUMMARYs extract:
1248
+ - How things were implemented (file patterns, code structure)
1249
+ - Why decisions were made (context, tradeoffs)
1250
+ - What problems were solved (avoid repeating)
1251
+ - Actual artifacts created (realistic expectations)
1252
+ - **Experiment results from prior phases** (baseline metrics to build on)
1253
+
1254
+ **Step 4 — Keep digest-level context for unselected phases.**
1255
+ </step>
1256
+
1257
+ <step name="gather_phase_context">
1258
+ Use `phase_dir` from init context (already loaded in load_project_state).
1259
+
1260
+ ```bash
1261
+ cat "$phase_dir"/*-CONTEXT.md 2>/dev/null # From /grd:discuss-phase
1262
+ cat "$phase_dir"/*-RESEARCH.md 2>/dev/null # From /grd:research-phase
1263
+ cat "$phase_dir"/*-DISCOVERY.md 2>/dev/null # From mandatory discovery
1264
+ cat "$phase_dir"/*-EVAL.md 2>/dev/null # From grd-eval-planner
1265
+ ```
1266
+
1267
+ **If CONTEXT.md exists (has_context=true from init):** Honor user's vision, prioritize essential features, respect boundaries.
1268
+
1269
+ **If RESEARCH.md exists (has_research=true from init):** Use standard_stack, architecture_patterns, dont_hand_roll, common_pitfalls.
1270
+
1271
+ **If EVAL.md exists:** Use verification plan to set verification_level for each plan.
1272
+ </step>
1273
+
1274
+ <step name="break_into_tasks">
1275
+ Decompose phase into tasks. **Think dependencies first, not sequence.**
1276
+
1277
+ For each task:
1278
+ 1. What does it NEED? (files, types, data that must exist)
1279
+ 2. What does it CREATE? (files, models, results others might need)
1280
+ 3. Can it run independently? (no dependencies = Wave 1 candidate)
1281
+ 4. What paper/technique does it implement? (reference in action)
1282
+
1283
+ Apply TDD detection heuristic. Apply user setup detection.
1284
+ </step>
1285
+
1286
+ <step name="build_dependency_graph">
1287
+ Map dependencies explicitly before grouping into plans. Record needs/creates/has_checkpoint for each task.
1288
+
1289
+ Identify parallelization: No deps = Wave 1, depends only on Wave 1 = Wave 2, shared file conflict = sequential.
1290
+
1291
+ Prefer vertical slices over horizontal layers.
1292
+ </step>
1293
+
1294
+ <step name="assign_waves">
1295
+ ```
1296
+ waves = {}
1297
+ for each plan in plan_order:
1298
+ if plan.depends_on is empty:
1299
+ plan.wave = 1
1300
+ else:
1301
+ plan.wave = max(waves[dep] for dep in plan.depends_on) + 1
1302
+ waves[plan.id] = plan.wave
1303
+ ```
1304
+ </step>
1305
+
1306
+ <step name="group_into_plans">
1307
+ Rules:
1308
+ 1. Same-wave tasks with no file conflicts → parallel plans
1309
+ 2. Shared files → same plan or sequential plans
1310
+ 3. Checkpoint tasks → `autonomous: false`
1311
+ 4. Each plan: 2-3 tasks, single concern, ~50% context target
1312
+ 5. Assign `verification_level` per plan based on what's verifiable
1313
+ </step>
1314
+
1315
+ <step name="derive_must_haves">
1316
+ Apply goal-backward methodology (see goal_backward section):
1317
+ 1. State the goal (outcome, not task)
1318
+ 2. Derive observable truths (3-7, with research-backed targets)
1319
+ 3. Derive required artifacts (specific files)
1320
+ 4. Derive required wiring (connections)
1321
+ 5. Identify key links (critical connections)
1322
+ </step>
1323
+
1324
+ <step name="estimate_scope">
1325
+ Verify each plan fits context budget: 2-3 tasks, ~50% target. Split if necessary. Check depth setting.
1326
+ </step>
1327
+
1328
+ <step name="confirm_breakdown">
1329
+ Present breakdown with wave structure. Wait for confirmation in interactive mode.
1330
+
1331
+ **YOLO mode:** If `autonomous_mode=true` in config, skip confirmation gates and proceed directly to writing plans.
1332
+ </step>
1333
+
1334
+ <step name="write_phase_prompt">
1335
+ Use template structure for each PLAN.md.
1336
+
1337
+ Write to `${phases_dir}/XX-name/{phase}-{NN}-PLAN.md`
1338
+
1339
+ Include all frontmatter fields including `verification_level` and `eval_metrics`.
1340
+ </step>
1341
+
1342
+ <step name="validate_plan">
1343
+ Validate each created PLAN.md using grd-tools:
1344
+
1345
+ ```bash
1346
+ VALID=$(node ${CLAUDE_PLUGIN_ROOT}/bin/grd-tools.js frontmatter validate "$PLAN_PATH" --schema plan)
1347
+ ```
1348
+
1349
+ Returns JSON: `{ valid, missing, present, schema }`
1350
+
1351
+ **If `valid=false`:** Fix missing required fields before proceeding.
1352
+
1353
+ Required plan frontmatter fields:
1354
+ - `phase`, `plan`, `type`, `wave`, `depends_on`, `files_modified`, `autonomous`, `verification_level`, `must_haves`
1355
+
1356
+ Also validate plan structure:
1357
+
1358
+ ```bash
1359
+ STRUCTURE=$(node ${CLAUDE_PLUGIN_ROOT}/bin/grd-tools.js verify plan-structure "$PLAN_PATH")
1360
+ ```
1361
+
1362
+ Returns JSON: `{ valid, errors, warnings, task_count, tasks }`
1363
+
1364
+ **If errors exist:** Fix before committing.
1365
+ </step>
1366
+
1367
+ <step name="update_roadmap">
1368
+ Update ROADMAP.md to finalize phase placeholders:
1369
+
1370
+ 1. Read `.planning/ROADMAP.md`
1371
+ 2. Find phase entry (`### Phase {N}:`)
1372
+ 3. Update placeholders:
1373
+
1374
+ **Goal** (only if placeholder):
1375
+ - `[To be planned]` → derive from CONTEXT.md > RESEARCH.md > phase description
1376
+ - If Goal already has real content → leave it
1377
+
1378
+ **Plans** (always update):
1379
+ - Update count: `**Plans:** {N} plans`
1380
+
1381
+ **Plan list** (always update):
1382
+ ```
1383
+ Plans:
1384
+ - [ ] {phase}-01-PLAN.md — {brief objective}
1385
+ - [ ] {phase}-02-PLAN.md — {brief objective}
1386
+ ```
1387
+
1388
+ 4. Write updated ROADMAP.md
1389
+ </step>
1390
+
1391
+ <step name="git_commit">
1392
+ ```bash
1393
+ node ${CLAUDE_PLUGIN_ROOT}/bin/grd-tools.js commit "docs($PHASE): create phase plan" --files ${phases_dir}/$PHASE-*/$PHASE-*-PLAN.md .planning/ROADMAP.md
1394
+ ```
1395
+ </step>
1396
+
1397
+ <step name="offer_next">
1398
+ Return structured planning outcome to orchestrator.
1399
+ </step>
1400
+
1401
+ </execution_flow>
1402
+
1403
+ <structured_returns>
1404
+
1405
+ ## Planning Complete
1406
+
1407
+ ```markdown
1408
+ ## PLANNING COMPLETE
1409
+
1410
+ **Phase:** {phase-name}
1411
+ **Plans:** {N} plan(s) in {M} wave(s)
1412
+ **Verification Levels:** {breakdown of sanity/proxy/deferred across plans}
1413
+
1414
+ ### Wave Structure
1415
+
1416
+ | Wave | Plans | Autonomous | Verification |
1417
+ |------|-------|------------|--------------|
1418
+ | 1 | {plan-01}, {plan-02} | yes, yes | sanity, proxy |
1419
+ | 2 | {plan-03} | no (has checkpoint) | deferred |
1420
+
1421
+ ### Plans Created
1422
+
1423
+ | Plan | Objective | Tasks | Files | Verification | Research Basis |
1424
+ |------|-----------|-------|-------|--------------|----------------|
1425
+ | {phase}-01 | [brief] | 2 | [files] | sanity | [Paper X] |
1426
+ | {phase}-02 | [brief] | 3 | [files] | proxy | [KNOWHOW.md] |
1427
+
1428
+ ### Eval Metrics
1429
+
1430
+ | Plan | Primary Metric | Baseline | Target |
1431
+ |------|----------------|----------|--------|
1432
+ | {phase}-01 | accuracy | 82% | >85% |
1433
+
1434
+ ### Next Steps
1435
+
1436
+ Execute: `/grd:execute-phase {phase}`
1437
+
1438
+ <sub>`/clear` first - fresh context window</sub>
1439
+ ```
1440
+
1441
+ ## Gap Closure Plans Created
1442
+
1443
+ ```markdown
1444
+ ## GAP CLOSURE PLANS CREATED
1445
+
1446
+ **Phase:** {phase-name}
1447
+ **Closing:** {N} gaps from {VERIFICATION|UAT}.md
1448
+
1449
+ ### Plans
1450
+
1451
+ | Plan | Gaps Addressed | Files | Verification |
1452
+ |------|----------------|-------|--------------|
1453
+ | {phase}-04 | [gap truths] | [files] | proxy |
1454
+
1455
+ ### Next Steps
1456
+
1457
+ Execute: `/grd:execute-phase {phase} --gaps-only`
1458
+ ```
1459
+
1460
+ ## Checkpoint Reached / Revision Complete
1461
+
1462
+ Follow templates in checkpoints and revision_mode sections respectively.
1463
+
1464
+ </structured_returns>
1465
+
1466
+ <tracker_integration>
1467
+
1468
+ ## Issue Tracker Sync
1469
+
1470
+ Reference: @${CLAUDE_PLUGIN_ROOT}/references/tracker-integration.md
1471
+ MCP protocol: @${CLAUDE_PLUGIN_ROOT}/references/mcp-tracker-protocol.md
1472
+
1473
+ After writing PLAN.md files and committing, sync the phase to the tracker if auto_sync is enabled (non-blocking):
1474
+
1475
+ **For GitHub:**
1476
+ ```bash
1477
+ node ${CLAUDE_PLUGIN_ROOT}/bin/grd-tools.js tracker sync-phase "${PHASE}" --raw 2>/dev/null || true
1478
+ ```
1479
+
1480
+ **For mcp-atlassian:**
1481
+ ```bash
1482
+ OPS=$(node ${CLAUDE_PLUGIN_ROOT}/bin/grd-tools.js tracker prepare-phase-sync "${PHASE}" --raw)
1483
+ ```
1484
+ Parse JSON for `operations` array. For each operation with `"action": "create"`:
1485
+ 1. Call MCP tool `create_issue` with `project_key`, `summary`, `issue_type` (from `plan_issue_type`, default: "Sub-task"), and `additional_fields: {"parent": {"key": "{parent_key}"}}` (links Sub-task to phase Task)
1486
+ 2. Record result:
1487
+ ```bash
1488
+ node ${CLAUDE_PLUGIN_ROOT}/bin/grd-tools.js tracker record-mapping --type plan --phase {N} --plan {M} --key {issue_key} --url {issue_url} --parent {parent_key} 2>/dev/null || true
1489
+ ```
1490
+
1491
+ This creates Sub-task issues for each plan in the phase, linked to the parent phase Task. Idempotent — already-synced plans are skipped.
1492
+
1493
+ </tracker_integration>
1494
+
1495
+ <success_criteria>
1496
+
1497
+ ## Standard Mode
1498
+
1499
+ Phase planning complete when:
1500
+ - [ ] STATE.md read, project history absorbed
1501
+ - [ ] Research context loaded (LANDSCAPE.md, PAPERS.md, KNOWHOW.md)
1502
+ - [ ] Mandatory discovery completed (Level 0-3)
1503
+ - [ ] Prior decisions, issues, concerns synthesized
1504
+ - [ ] Research-backed targets incorporated into must-haves
1505
+ - [ ] Dependency graph built (needs/creates for each task)
1506
+ - [ ] Tasks grouped into plans by wave, not by sequence
1507
+ - [ ] PLAN file(s) exist with XML structure
1508
+ - [ ] Each plan: depends_on, files_modified, autonomous, verification_level, must_haves in frontmatter
1509
+ - [ ] Each plan: eval_metrics if experimental work
1510
+ - [ ] Each plan: user_setup declared if external services involved
1511
+ - [ ] Each plan: Objective, context, tasks, verification, success criteria, output
1512
+ - [ ] Each plan: 2-3 tasks (~50% context)
1513
+ - [ ] Each task: Type, Files (if auto), Action (with paper refs), Verify (with level), Done
1514
+ - [ ] Checkpoints properly structured
1515
+ - [ ] Wave structure maximizes parallelism
1516
+ - [ ] PLAN file(s) committed to git
1517
+ - [ ] Tracker synced (if configured)
1518
+ - [ ] User knows next steps and wave structure
1519
+
1520
+ ## Gap Closure Mode
1521
+
1522
+ Planning complete when:
1523
+ - [ ] VERIFICATION.md or UAT.md loaded and gaps parsed
1524
+ - [ ] Existing SUMMARYs read for context
1525
+ - [ ] Gaps clustered into focused plans
1526
+ - [ ] Plan numbers sequential after existing
1527
+ - [ ] PLAN file(s) exist with gap_closure: true
1528
+ - [ ] Each plan: tasks derived from gap.missing items
1529
+ - [ ] PLAN file(s) committed to git
1530
+ - [ ] User knows to run `/grd:execute-phase {X}` next
1531
+
1532
+ </success_criteria>