forge-server 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (412) hide show
  1. package/.claude/hooks/worktree-create.sh +64 -0
  2. package/.claude/hooks/worktree-remove.sh +57 -0
  3. package/.claude/settings.local.json +29 -0
  4. package/.forge/knowledge/conventions.yaml +1 -0
  5. package/.forge/knowledge/decisions.yaml +1 -0
  6. package/.forge/knowledge/gotchas.yaml +1 -0
  7. package/.forge/knowledge/patterns.yaml +1 -0
  8. package/.forge/manifest.yaml +6 -0
  9. package/CLAUDE.md +144 -0
  10. package/bin/setup-forge.sh +132 -0
  11. package/dist/cli.d.ts +3 -0
  12. package/dist/cli.d.ts.map +1 -0
  13. package/dist/cli.js +553 -0
  14. package/dist/cli.js.map +1 -0
  15. package/dist/context/codebase.d.ts +57 -0
  16. package/dist/context/codebase.d.ts.map +1 -0
  17. package/dist/context/codebase.js +301 -0
  18. package/dist/context/codebase.js.map +1 -0
  19. package/dist/context/injector.d.ts +147 -0
  20. package/dist/context/injector.d.ts.map +1 -0
  21. package/dist/context/injector.js +533 -0
  22. package/dist/context/injector.js.map +1 -0
  23. package/dist/context/memory.d.ts +32 -0
  24. package/dist/context/memory.d.ts.map +1 -0
  25. package/dist/context/memory.js +140 -0
  26. package/dist/context/memory.js.map +1 -0
  27. package/dist/context/session-index.d.ts +54 -0
  28. package/dist/context/session-index.d.ts.map +1 -0
  29. package/dist/context/session-index.js +265 -0
  30. package/dist/context/session-index.js.map +1 -0
  31. package/dist/context/session.d.ts +42 -0
  32. package/dist/context/session.d.ts.map +1 -0
  33. package/dist/context/session.js +121 -0
  34. package/dist/context/session.js.map +1 -0
  35. package/dist/index.d.ts +3 -0
  36. package/dist/index.d.ts.map +1 -0
  37. package/dist/index.js +37 -0
  38. package/dist/index.js.map +1 -0
  39. package/dist/ingestion/chunker.d.ts +19 -0
  40. package/dist/ingestion/chunker.d.ts.map +1 -0
  41. package/dist/ingestion/chunker.js +189 -0
  42. package/dist/ingestion/chunker.js.map +1 -0
  43. package/dist/ingestion/embedder.d.ts +45 -0
  44. package/dist/ingestion/embedder.d.ts.map +1 -0
  45. package/dist/ingestion/embedder.js +152 -0
  46. package/dist/ingestion/embedder.js.map +1 -0
  47. package/dist/ingestion/git-analyzer.d.ts +77 -0
  48. package/dist/ingestion/git-analyzer.d.ts.map +1 -0
  49. package/dist/ingestion/git-analyzer.js +437 -0
  50. package/dist/ingestion/git-analyzer.js.map +1 -0
  51. package/dist/ingestion/indexer.d.ts +79 -0
  52. package/dist/ingestion/indexer.d.ts.map +1 -0
  53. package/dist/ingestion/indexer.js +766 -0
  54. package/dist/ingestion/indexer.js.map +1 -0
  55. package/dist/ingestion/markdown-chunker.d.ts +19 -0
  56. package/dist/ingestion/markdown-chunker.d.ts.map +1 -0
  57. package/dist/ingestion/markdown-chunker.js +243 -0
  58. package/dist/ingestion/markdown-chunker.js.map +1 -0
  59. package/dist/ingestion/markdown-knowledge.d.ts +21 -0
  60. package/dist/ingestion/markdown-knowledge.d.ts.map +1 -0
  61. package/dist/ingestion/markdown-knowledge.js +129 -0
  62. package/dist/ingestion/markdown-knowledge.js.map +1 -0
  63. package/dist/ingestion/parser.d.ts +20 -0
  64. package/dist/ingestion/parser.d.ts.map +1 -0
  65. package/dist/ingestion/parser.js +429 -0
  66. package/dist/ingestion/parser.js.map +1 -0
  67. package/dist/ingestion/watcher.d.ts +28 -0
  68. package/dist/ingestion/watcher.d.ts.map +1 -0
  69. package/dist/ingestion/watcher.js +147 -0
  70. package/dist/ingestion/watcher.js.map +1 -0
  71. package/dist/knowledge/hydrator.d.ts +37 -0
  72. package/dist/knowledge/hydrator.d.ts.map +1 -0
  73. package/dist/knowledge/hydrator.js +220 -0
  74. package/dist/knowledge/hydrator.js.map +1 -0
  75. package/dist/knowledge/registry.d.ts +129 -0
  76. package/dist/knowledge/registry.d.ts.map +1 -0
  77. package/dist/knowledge/registry.js +361 -0
  78. package/dist/knowledge/registry.js.map +1 -0
  79. package/dist/knowledge/search.d.ts +114 -0
  80. package/dist/knowledge/search.d.ts.map +1 -0
  81. package/dist/knowledge/search.js +428 -0
  82. package/dist/knowledge/search.js.map +1 -0
  83. package/dist/knowledge/store.d.ts +76 -0
  84. package/dist/knowledge/store.d.ts.map +1 -0
  85. package/dist/knowledge/store.js +230 -0
  86. package/dist/knowledge/store.js.map +1 -0
  87. package/dist/learning/confidence.d.ts +30 -0
  88. package/dist/learning/confidence.d.ts.map +1 -0
  89. package/dist/learning/confidence.js +165 -0
  90. package/dist/learning/confidence.js.map +1 -0
  91. package/dist/learning/patterns.d.ts +52 -0
  92. package/dist/learning/patterns.d.ts.map +1 -0
  93. package/dist/learning/patterns.js +290 -0
  94. package/dist/learning/patterns.js.map +1 -0
  95. package/dist/learning/trajectory.d.ts +55 -0
  96. package/dist/learning/trajectory.d.ts.map +1 -0
  97. package/dist/learning/trajectory.js +200 -0
  98. package/dist/learning/trajectory.js.map +1 -0
  99. package/dist/memory/memory-compat.d.ts +100 -0
  100. package/dist/memory/memory-compat.d.ts.map +1 -0
  101. package/dist/memory/memory-compat.js +146 -0
  102. package/dist/memory/memory-compat.js.map +1 -0
  103. package/dist/memory/observation-store.d.ts +57 -0
  104. package/dist/memory/observation-store.d.ts.map +1 -0
  105. package/dist/memory/observation-store.js +154 -0
  106. package/dist/memory/observation-store.js.map +1 -0
  107. package/dist/memory/session-tracker.d.ts +81 -0
  108. package/dist/memory/session-tracker.d.ts.map +1 -0
  109. package/dist/memory/session-tracker.js +262 -0
  110. package/dist/memory/session-tracker.js.map +1 -0
  111. package/dist/pipeline/engine.d.ts +179 -0
  112. package/dist/pipeline/engine.d.ts.map +1 -0
  113. package/dist/pipeline/engine.js +691 -0
  114. package/dist/pipeline/engine.js.map +1 -0
  115. package/dist/pipeline/events.d.ts +54 -0
  116. package/dist/pipeline/events.d.ts.map +1 -0
  117. package/dist/pipeline/events.js +157 -0
  118. package/dist/pipeline/events.js.map +1 -0
  119. package/dist/pipeline/parallel.d.ts +83 -0
  120. package/dist/pipeline/parallel.d.ts.map +1 -0
  121. package/dist/pipeline/parallel.js +277 -0
  122. package/dist/pipeline/parallel.js.map +1 -0
  123. package/dist/pipeline/state-machine.d.ts +65 -0
  124. package/dist/pipeline/state-machine.d.ts.map +1 -0
  125. package/dist/pipeline/state-machine.js +176 -0
  126. package/dist/pipeline/state-machine.js.map +1 -0
  127. package/dist/query/graph-queries.d.ts +84 -0
  128. package/dist/query/graph-queries.d.ts.map +1 -0
  129. package/dist/query/graph-queries.js +216 -0
  130. package/dist/query/graph-queries.js.map +1 -0
  131. package/dist/query/hybrid-search.d.ts +34 -0
  132. package/dist/query/hybrid-search.d.ts.map +1 -0
  133. package/dist/query/hybrid-search.js +263 -0
  134. package/dist/query/hybrid-search.js.map +1 -0
  135. package/dist/query/intent-detector.d.ts +35 -0
  136. package/dist/query/intent-detector.d.ts.map +1 -0
  137. package/dist/query/intent-detector.js +115 -0
  138. package/dist/query/intent-detector.js.map +1 -0
  139. package/dist/query/ranking.d.ts +57 -0
  140. package/dist/query/ranking.d.ts.map +1 -0
  141. package/dist/query/ranking.js +109 -0
  142. package/dist/query/ranking.js.map +1 -0
  143. package/dist/server.d.ts +3 -0
  144. package/dist/server.d.ts.map +1 -0
  145. package/dist/server.js +291 -0
  146. package/dist/server.js.map +1 -0
  147. package/dist/storage/falkordb-store.d.ts +73 -0
  148. package/dist/storage/falkordb-store.d.ts.map +1 -0
  149. package/dist/storage/falkordb-store.js +346 -0
  150. package/dist/storage/falkordb-store.js.map +1 -0
  151. package/dist/storage/file-cache.d.ts +32 -0
  152. package/dist/storage/file-cache.d.ts.map +1 -0
  153. package/dist/storage/file-cache.js +115 -0
  154. package/dist/storage/file-cache.js.map +1 -0
  155. package/dist/storage/interfaces.d.ts +151 -0
  156. package/dist/storage/interfaces.d.ts.map +1 -0
  157. package/dist/storage/interfaces.js +7 -0
  158. package/dist/storage/interfaces.js.map +1 -0
  159. package/dist/storage/qdrant-store.d.ts +110 -0
  160. package/dist/storage/qdrant-store.d.ts.map +1 -0
  161. package/dist/storage/qdrant-store.js +467 -0
  162. package/dist/storage/qdrant-store.js.map +1 -0
  163. package/dist/storage/schema.d.ts +4 -0
  164. package/dist/storage/schema.d.ts.map +1 -0
  165. package/dist/storage/schema.js +136 -0
  166. package/dist/storage/schema.js.map +1 -0
  167. package/dist/storage/sqlite.d.ts +35 -0
  168. package/dist/storage/sqlite.d.ts.map +1 -0
  169. package/dist/storage/sqlite.js +132 -0
  170. package/dist/storage/sqlite.js.map +1 -0
  171. package/dist/tools/collaboration-tools.d.ts +111 -0
  172. package/dist/tools/collaboration-tools.d.ts.map +1 -0
  173. package/dist/tools/collaboration-tools.js +174 -0
  174. package/dist/tools/collaboration-tools.js.map +1 -0
  175. package/dist/tools/context-tools.d.ts +293 -0
  176. package/dist/tools/context-tools.d.ts.map +1 -0
  177. package/dist/tools/context-tools.js +437 -0
  178. package/dist/tools/context-tools.js.map +1 -0
  179. package/dist/tools/graph-tools.d.ts +129 -0
  180. package/dist/tools/graph-tools.d.ts.map +1 -0
  181. package/dist/tools/graph-tools.js +237 -0
  182. package/dist/tools/graph-tools.js.map +1 -0
  183. package/dist/tools/ingestion-tools.d.ts +96 -0
  184. package/dist/tools/ingestion-tools.d.ts.map +1 -0
  185. package/dist/tools/ingestion-tools.js +90 -0
  186. package/dist/tools/ingestion-tools.js.map +1 -0
  187. package/dist/tools/learning-tools.d.ts +168 -0
  188. package/dist/tools/learning-tools.d.ts.map +1 -0
  189. package/dist/tools/learning-tools.js +158 -0
  190. package/dist/tools/learning-tools.js.map +1 -0
  191. package/dist/tools/memory-tools.d.ts +183 -0
  192. package/dist/tools/memory-tools.d.ts.map +1 -0
  193. package/dist/tools/memory-tools.js +197 -0
  194. package/dist/tools/memory-tools.js.map +1 -0
  195. package/dist/tools/phase-tools.d.ts +954 -0
  196. package/dist/tools/phase-tools.d.ts.map +1 -0
  197. package/dist/tools/phase-tools.js +1215 -0
  198. package/dist/tools/phase-tools.js.map +1 -0
  199. package/dist/tools/pipeline-tools.d.ts +140 -0
  200. package/dist/tools/pipeline-tools.d.ts.map +1 -0
  201. package/dist/tools/pipeline-tools.js +162 -0
  202. package/dist/tools/pipeline-tools.js.map +1 -0
  203. package/dist/tools/registration-tools.d.ts +220 -0
  204. package/dist/tools/registration-tools.d.ts.map +1 -0
  205. package/dist/tools/registration-tools.js +391 -0
  206. package/dist/tools/registration-tools.js.map +1 -0
  207. package/dist/util/circuit-breaker.d.ts +75 -0
  208. package/dist/util/circuit-breaker.d.ts.map +1 -0
  209. package/dist/util/circuit-breaker.js +159 -0
  210. package/dist/util/circuit-breaker.js.map +1 -0
  211. package/dist/util/config.d.ts +23 -0
  212. package/dist/util/config.d.ts.map +1 -0
  213. package/dist/util/config.js +164 -0
  214. package/dist/util/config.js.map +1 -0
  215. package/dist/util/logger.d.ts +13 -0
  216. package/dist/util/logger.d.ts.map +1 -0
  217. package/dist/util/logger.js +45 -0
  218. package/dist/util/logger.js.map +1 -0
  219. package/dist/util/token-counter.d.ts +24 -0
  220. package/dist/util/token-counter.d.ts.map +1 -0
  221. package/dist/util/token-counter.js +48 -0
  222. package/dist/util/token-counter.js.map +1 -0
  223. package/dist/util/types.d.ts +525 -0
  224. package/dist/util/types.d.ts.map +1 -0
  225. package/dist/util/types.js +5 -0
  226. package/dist/util/types.js.map +1 -0
  227. package/docker-compose.yml +20 -0
  228. package/docs/plans/2026-02-27-swarm-coordination/architecture.md +203 -0
  229. package/docs/plans/2026-02-27-swarm-coordination/vision.md +57 -0
  230. package/docs/plans/completed/2026-02-26-forge-plugin-bundling/architecture.md +1 -0
  231. package/docs/plans/completed/2026-02-26-forge-plugin-bundling/vision.md +300 -0
  232. package/docs/plans/completed/2026-02-27-forge-swarm-learning/architecture.md +480 -0
  233. package/docs/plans/completed/2026-02-27-forge-swarm-learning/verification-checklist.md +462 -0
  234. package/docs/plans/completed/2026-02-27-git-history-atlassian/git-jira-plan.md +181 -0
  235. package/package.json +39 -0
  236. package/plugin/.claude-plugin/plugin.json +8 -0
  237. package/plugin/.mcp.json +15 -0
  238. package/plugin/README.md +134 -0
  239. package/plugin/agents/architect.md +367 -0
  240. package/plugin/agents/backend-specialist.md +263 -0
  241. package/plugin/agents/brainstormer.md +122 -0
  242. package/plugin/agents/data-specialist.md +266 -0
  243. package/plugin/agents/designer.md +408 -0
  244. package/plugin/agents/frontend-specialist.md +241 -0
  245. package/plugin/agents/inspector.md +406 -0
  246. package/plugin/agents/knowledge-keeper.md +443 -0
  247. package/plugin/agents/platform-engineer.md +326 -0
  248. package/plugin/agents/product-manager.md +268 -0
  249. package/plugin/agents/product-owner.md +438 -0
  250. package/plugin/agents/pulse-checker.md +73 -0
  251. package/plugin/agents/qa-strategist.md +500 -0
  252. package/plugin/agents/self-improver.md +310 -0
  253. package/plugin/agents/strategist.md +360 -0
  254. package/plugin/agents/supervisor.md +380 -0
  255. package/plugin/commands/brainstorm.md +25 -0
  256. package/plugin/commands/forge.md +88 -0
  257. package/plugin/docs/atlassian-integration.md +110 -0
  258. package/plugin/docs/workflow.md +126 -0
  259. package/plugin/skills/agent-development/.skillfish.json +10 -0
  260. package/plugin/skills/agent-development/SKILL.md +415 -0
  261. package/plugin/skills/agent-development/examples/agent-creation-prompt.md +238 -0
  262. package/plugin/skills/agent-development/examples/complete-agent-examples.md +427 -0
  263. package/plugin/skills/agent-development/references/agent-creation-system-prompt.md +207 -0
  264. package/plugin/skills/agent-development/references/system-prompt-design.md +411 -0
  265. package/plugin/skills/agent-development/references/triggering-examples.md +491 -0
  266. package/plugin/skills/agent-development/scripts/validate-agent.sh +217 -0
  267. package/plugin/skills/agent-handoff/SKILL.md +335 -0
  268. package/plugin/skills/anti-stub/SKILL.md +317 -0
  269. package/plugin/skills/brainstorm/SKILL.md +31 -0
  270. package/plugin/skills/debugging/SKILL.md +276 -0
  271. package/plugin/skills/fix/SKILL.md +62 -0
  272. package/plugin/skills/frontend-design/.skillfish.json +10 -0
  273. package/plugin/skills/frontend-design/SKILL.md +42 -0
  274. package/plugin/skills/gotchas/SKILL.md +61 -0
  275. package/plugin/skills/graph-orchestrator/SKILL.md +38 -0
  276. package/plugin/skills/history/SKILL.md +58 -0
  277. package/plugin/skills/impact/SKILL.md +59 -0
  278. package/plugin/skills/implementation-execution/SKILL.md +291 -0
  279. package/plugin/skills/index-repo/SKILL.md +55 -0
  280. package/plugin/skills/interviewing/SKILL.md +225 -0
  281. package/plugin/skills/knowledge-curation/SKILL.md +393 -0
  282. package/plugin/skills/learn/SKILL.md +69 -0
  283. package/plugin/skills/mcp-integration/.skillfish.json +10 -0
  284. package/plugin/skills/mcp-integration/SKILL.md +554 -0
  285. package/plugin/skills/mcp-integration/examples/http-server.json +20 -0
  286. package/plugin/skills/mcp-integration/examples/sse-server.json +19 -0
  287. package/plugin/skills/mcp-integration/examples/stdio-server.json +26 -0
  288. package/plugin/skills/mcp-integration/references/authentication.md +549 -0
  289. package/plugin/skills/mcp-integration/references/server-types.md +536 -0
  290. package/plugin/skills/mcp-integration/references/tool-usage.md +538 -0
  291. package/plugin/skills/nestjs/.skillfish.json +10 -0
  292. package/plugin/skills/nestjs/SKILL.md +669 -0
  293. package/plugin/skills/nestjs/drizzle-reference.md +1894 -0
  294. package/plugin/skills/nestjs/reference.md +1447 -0
  295. package/plugin/skills/nestjs/workflow-optimization.md +229 -0
  296. package/plugin/skills/parallel-dispatch/SKILL.md +308 -0
  297. package/plugin/skills/project-discovery/SKILL.md +304 -0
  298. package/plugin/skills/search/SKILL.md +56 -0
  299. package/plugin/skills/security-audit/SKILL.md +362 -0
  300. package/plugin/skills/skill-development/.skillfish.json +10 -0
  301. package/plugin/skills/skill-development/SKILL.md +637 -0
  302. package/plugin/skills/skill-development/references/skill-creator-original.md +209 -0
  303. package/plugin/skills/tdd/SKILL.md +273 -0
  304. package/plugin/skills/terminal-presentation/SKILL.md +395 -0
  305. package/plugin/skills/test-strategy/SKILL.md +365 -0
  306. package/plugin/skills/verification-protocol/SKILL.md +256 -0
  307. package/plugin/skills/visual-explainer/CHANGELOG.md +97 -0
  308. package/plugin/skills/visual-explainer/LICENSE +21 -0
  309. package/plugin/skills/visual-explainer/README.md +137 -0
  310. package/plugin/skills/visual-explainer/SKILL.md +352 -0
  311. package/plugin/skills/visual-explainer/banner.png +0 -0
  312. package/plugin/skills/visual-explainer/package.json +11 -0
  313. package/plugin/skills/visual-explainer/prompts/diff-review.md +68 -0
  314. package/plugin/skills/visual-explainer/prompts/fact-check.md +63 -0
  315. package/plugin/skills/visual-explainer/prompts/generate-slides.md +18 -0
  316. package/plugin/skills/visual-explainer/prompts/generate-web-diagram.md +10 -0
  317. package/plugin/skills/visual-explainer/prompts/plan-review.md +86 -0
  318. package/plugin/skills/visual-explainer/prompts/project-recap.md +61 -0
  319. package/plugin/skills/visual-explainer/references/css-patterns.md +1188 -0
  320. package/plugin/skills/visual-explainer/references/libraries.md +470 -0
  321. package/plugin/skills/visual-explainer/references/responsive-nav.md +212 -0
  322. package/plugin/skills/visual-explainer/references/slide-patterns.md +1403 -0
  323. package/plugin/skills/visual-explainer/templates/architecture.html +596 -0
  324. package/plugin/skills/visual-explainer/templates/data-table.html +540 -0
  325. package/plugin/skills/visual-explainer/templates/mermaid-flowchart.html +435 -0
  326. package/plugin/skills/visual-explainer/templates/slide-deck.html +913 -0
  327. package/src/cli.ts +655 -0
  328. package/src/context/.gitkeep +0 -0
  329. package/src/context/codebase.ts +393 -0
  330. package/src/context/injector.ts +797 -0
  331. package/src/context/memory.ts +187 -0
  332. package/src/context/session-index.ts +327 -0
  333. package/src/context/session.ts +152 -0
  334. package/src/index.ts +47 -0
  335. package/src/ingestion/.gitkeep +0 -0
  336. package/src/ingestion/chunker.ts +277 -0
  337. package/src/ingestion/embedder.ts +167 -0
  338. package/src/ingestion/git-analyzer.ts +545 -0
  339. package/src/ingestion/indexer.ts +984 -0
  340. package/src/ingestion/markdown-chunker.ts +337 -0
  341. package/src/ingestion/markdown-knowledge.ts +175 -0
  342. package/src/ingestion/parser.ts +475 -0
  343. package/src/ingestion/watcher.ts +182 -0
  344. package/src/knowledge/.gitkeep +0 -0
  345. package/src/knowledge/hydrator.ts +246 -0
  346. package/src/knowledge/registry.ts +463 -0
  347. package/src/knowledge/search.ts +565 -0
  348. package/src/knowledge/store.ts +262 -0
  349. package/src/learning/.gitkeep +0 -0
  350. package/src/learning/confidence.ts +193 -0
  351. package/src/learning/patterns.ts +360 -0
  352. package/src/learning/trajectory.ts +268 -0
  353. package/src/memory/.gitkeep +0 -0
  354. package/src/memory/memory-compat.ts +233 -0
  355. package/src/memory/observation-store.ts +224 -0
  356. package/src/memory/session-tracker.ts +332 -0
  357. package/src/pipeline/.gitkeep +0 -0
  358. package/src/pipeline/engine.ts +1139 -0
  359. package/src/pipeline/events.ts +253 -0
  360. package/src/pipeline/parallel.ts +394 -0
  361. package/src/pipeline/state-machine.ts +199 -0
  362. package/src/query/.gitkeep +0 -0
  363. package/src/query/graph-queries.ts +262 -0
  364. package/src/query/hybrid-search.ts +337 -0
  365. package/src/query/intent-detector.ts +131 -0
  366. package/src/query/ranking.ts +161 -0
  367. package/src/server.ts +352 -0
  368. package/src/storage/.gitkeep +0 -0
  369. package/src/storage/falkordb-store.ts +388 -0
  370. package/src/storage/file-cache.ts +141 -0
  371. package/src/storage/interfaces.ts +201 -0
  372. package/src/storage/qdrant-store.ts +557 -0
  373. package/src/storage/schema.ts +139 -0
  374. package/src/storage/sqlite.ts +168 -0
  375. package/src/tools/.gitkeep +0 -0
  376. package/src/tools/collaboration-tools.ts +208 -0
  377. package/src/tools/context-tools.ts +493 -0
  378. package/src/tools/graph-tools.ts +295 -0
  379. package/src/tools/ingestion-tools.ts +122 -0
  380. package/src/tools/learning-tools.ts +181 -0
  381. package/src/tools/memory-tools.ts +234 -0
  382. package/src/tools/phase-tools.ts +1452 -0
  383. package/src/tools/pipeline-tools.ts +188 -0
  384. package/src/tools/registration-tools.ts +450 -0
  385. package/src/util/.gitkeep +0 -0
  386. package/src/util/circuit-breaker.ts +193 -0
  387. package/src/util/config.ts +177 -0
  388. package/src/util/logger.ts +53 -0
  389. package/src/util/token-counter.ts +52 -0
  390. package/src/util/types.ts +710 -0
  391. package/tests/context/.gitkeep +0 -0
  392. package/tests/integration/.gitkeep +0 -0
  393. package/tests/knowledge/.gitkeep +0 -0
  394. package/tests/learning/.gitkeep +0 -0
  395. package/tests/pipeline/.gitkeep +0 -0
  396. package/tests/tools/.gitkeep +0 -0
  397. package/tsconfig.json +21 -0
  398. package/vitest.config.ts +10 -0
  399. package/vscode-extension/.vscodeignore +7 -0
  400. package/vscode-extension/README.md +43 -0
  401. package/vscode-extension/out/edge-collector.js +274 -0
  402. package/vscode-extension/out/edge-collector.js.map +1 -0
  403. package/vscode-extension/out/extension.js +264 -0
  404. package/vscode-extension/out/extension.js.map +1 -0
  405. package/vscode-extension/out/forge-client.js +318 -0
  406. package/vscode-extension/out/forge-client.js.map +1 -0
  407. package/vscode-extension/package-lock.json +59 -0
  408. package/vscode-extension/package.json +71 -0
  409. package/vscode-extension/src/edge-collector.ts +320 -0
  410. package/vscode-extension/src/extension.ts +269 -0
  411. package/vscode-extension/src/forge-client.ts +364 -0
  412. package/vscode-extension/tsconfig.json +19 -0
@@ -0,0 +1,335 @@
1
+ ---
2
+ name: agent-handoff
3
+ description: >
4
+ This skill should be used when transitioning work between forge agents — passing context from
5
+ one phase to the next, summarizing completed work, or preparing input for the next agent in
6
+ the workflow. Used by all forge agents.
7
+ user-invocable: false
8
+ ---
9
+
10
+ # Agent Handoff Skill
11
+
12
+ ## Document-Based Handoff Principle
13
+
14
+ Agents in the Forge system do not share conversation context. They do not pass memory, chat history, or internal state between each other. All inter-agent communication happens through plan documents written to the filesystem.
15
+
16
+ This is by design, not by limitation. Document-based handoff produces:
17
+
18
+ - **Auditability**: every decision, every handoff, every scope change is recorded in a document that humans and agents can review.
19
+ - **Resumability**: if a workflow is interrupted (crash, timeout, user stepping away), any agent can pick up from the last written document without loss of context.
20
+ - **Parallelism**: multiple agents can read the same plan documents simultaneously without contention, because documents are write-once-then-read-many during any given phase.
21
+ - **Token efficiency**: instead of forwarding thousands of tokens of conversation history, write a structured summary to disk and let the next agent read only what it needs.
22
+
23
+ The cardinal rule: **if information is not written to a plan document, it does not exist for the next agent.** Verbal agreements, in-context decisions, and implicit assumptions that are not persisted are lost at handoff.
24
+
25
+ ## What to Write to Documents
26
+
27
+ Every agent that produces work must write its findings, decisions, and deliverables to the appropriate plan document before handing off. The following categories of information must always be captured:
28
+
29
+ ### Decisions Made
30
+
31
+ Record every non-trivial decision with its rationale. A decision without rationale is useless to the next agent — it cannot tell whether the decision was a careful choice or an arbitrary default.
32
+
33
+ Format:
34
+
35
+ ```
36
+ | Date | Decision | Rationale | Decided By |
37
+ |------|----------|-----------|------------|
38
+ | 2026-02-25 | Use WebSocket for real-time updates | Polling at 1s interval would create 86K requests/user/day; WebSocket reduces to one persistent connection | Architect |
39
+ | 2026-02-25 | Store media in S3 with presigned URLs | Direct upload to S3 avoids proxying large files through the API server, reducing memory pressure | Architect |
40
+ ```
41
+
42
+ ### Constraints Identified
43
+
44
+ New constraints discovered during work that were not in the original vision. These are critical for downstream agents.
45
+
46
+ Examples:
47
+
48
+ - "The existing `users` table uses UUID v4 primary keys, so all foreign keys referencing it must also be UUID."
49
+ - "The Keycloak OIDC provider returns `sub` as the user identifier, not `email`. Auth module must use `sub` for identity mapping."
50
+ - "The target Kubernetes cluster has a 512Mi memory limit per pod. The application must stay within this envelope."
51
+
52
+ ### Open Questions
53
+
54
+ Questions that arose during work and could not be answered from existing documents. These must be surfaced — not buried in agent output — so the Strategist or user can resolve them.
55
+
56
+ Format:
57
+
58
+ ```
59
+ ## Open Questions
60
+ - Should rate limiting apply per-user or per-API-key? (Affects whether we track limits in session store or a separate Redis key space)
61
+ - Is the 30-day retention policy a hard requirement, or can we make it configurable? (Affects schema design)
62
+ - Does the media upload flow need virus scanning? (Affects architecture — adds an async processing step)
63
+ ```
64
+
65
+ ### Deliverables Produced
66
+
67
+ List every file created or modified, with a one-line description of what it contains. The next agent should not have to read every file to understand what was produced.
68
+
69
+ ## What to Summarize (Not Copy)
70
+
71
+ Certain types of information are too large or too detailed to include verbatim in handoff documents. Summarize these instead:
72
+
73
+ - **Large code blocks**: do not paste entire files into plan documents. Instead, reference the file path and describe what the code does. Example: "Created `src/modules/auth/auth.service.ts` — handles JWT validation, token refresh, and session management. Uses `jsonwebtoken` with RS256 signing."
74
+ - **Long conversations**: if the Strategist had a multi-turn interview with the user, summarize the key decisions and requirements. Do not paste the full transcript.
75
+ - **Debugging sessions**: if the Debugger traced a complex issue, summarize the root cause, the fix applied, and the regression test added. Do not paste the full stack trace analysis.
76
+ - **Research findings**: if an agent investigated multiple approaches, summarize the options considered, the one chosen, and why. Do not paste all the documentation links and comparison notes.
77
+
78
+ The test for good summarization: can the next agent understand what happened and why without asking any follow-up questions? If yes, the summary is sufficient.
79
+
80
+ ## Handoff Document Locations
81
+
82
+ All plan documents live under a date-stamped directory:
83
+
84
+ ```
85
+ docs/plans/YYYY-MM-DD-{TITLE}/
86
+ ```
87
+
88
+ Where `YYYY-MM-DD` is the project start date and `{TITLE}` is a lowercase-kebab-case slug derived from the feature name.
89
+
90
+ ### Standard Document Set
91
+
92
+ | Document | Author | Purpose |
93
+ |----------|--------|---------|
94
+ | `vision.md` | Strategist | Problem statement, goals, non-goals, success criteria, user stories, constraints, risks |
95
+ | `requirements.md` | Strategist / Product Manager | Detailed functional and non-functional requirements, acceptance criteria |
96
+ | `xd-plan.md` | Designer | Experience design: page layouts, component hierarchy, interaction patterns, responsive behavior |
97
+ | `architecture.md` | Architect | System design: module structure, API contracts, data models, infrastructure, sequence diagrams |
98
+ | `test-plan.md` | QA Strategist | Test pyramid allocation, test cases by layer, test data requirements, coverage targets |
99
+
100
+ ### Agent Output Directory
101
+
102
+ Individual agent outputs from parallel dispatch go in:
103
+
104
+ ```
105
+ docs/plans/YYYY-MM-DD-{TITLE}/agent-output/
106
+ ```
107
+
108
+ Each agent writes its completion report to:
109
+
110
+ ```
111
+ docs/plans/YYYY-MM-DD-{TITLE}/agent-output/{agent-type}-{scope}.md
112
+ ```
113
+
114
+ Example: `agent-output/backend-auth.md`, `agent-output/frontend-dashboard.md`, `agent-output/data-content-schema.md`.
115
+
116
+ ## Agent-to-Agent Handoff Format
117
+
118
+ When an agent completes its work and hands off to the next agent (or reports back to the Strategist), use this structured format:
119
+
120
+ ```markdown
121
+ # Handoff: {Phase/Task Name}
122
+
123
+ **FROM**: {agent name} (e.g., Architect)
124
+ **TO**: {next agent name or "Strategist for review"}
125
+ **DATE**: YYYY-MM-DD
126
+ **STATUS**: Complete | Partial | Blocked
127
+
128
+ ## Deliverables
129
+
130
+ | File | Action | Description |
131
+ |------|--------|-------------|
132
+ | `src/modules/auth/auth.module.ts` | Created | NestJS module with JWT, session, and RBAC providers |
133
+ | `src/modules/auth/auth.service.ts` | Created | Core auth logic: login, refresh, validate, revoke |
134
+ | `src/common/dto/auth.dto.ts` | Created | Shared DTOs: LoginRequest, LoginResponse, TokenPayload |
135
+ | `drizzle/migrations/0001_create_users.sql` | Created | Users table with UUID PK, email unique, hashed password |
136
+
137
+ ## Decisions Made
138
+
139
+ | Decision | Rationale |
140
+ |----------|-----------|
141
+ | RS256 for JWT signing | Asymmetric keys allow token verification without sharing the signing secret |
142
+ | Refresh tokens stored in DB, not cookies | Enables server-side revocation and multi-device session management |
143
+ | 15-minute access token TTL | Balances security (short window) with UX (infrequent re-auth) |
144
+
145
+ ## Constraints Discovered
146
+
147
+ - The Keycloak OIDC `sub` claim is a UUID, not an email. All downstream identity references must use this UUID.
148
+ - Existing database uses `timestamptz` for all date columns. New tables must follow this convention.
149
+
150
+ ## Open Questions
151
+
152
+ - Should failed login attempts trigger a CAPTCHA after N attempts, or just account lockout? (Needs Strategist/user input)
153
+ - Is there a requirement for "remember me" functionality extending the session beyond the default TTL?
154
+
155
+ ## Recommendations for Next Agent
156
+
157
+ - The Builder implementing the auth module should read `architecture.md` section "Authentication Flow" before starting.
158
+ - The Tester should prioritize token expiration and refresh edge cases — these are the most security-critical paths.
159
+ - The Frontend agent should use the `TokenPayload` type from `src/common/dto/auth.dto.ts` for client-side token decoding.
160
+
161
+ ## Integration Points
162
+
163
+ - `auth.module.ts` must be registered in `app.module.ts` (not done yet — reserved for the integration phase).
164
+ - The `AuthGuard` exported from this module should be applied globally or per-controller by the Builder.
165
+ - The `users` table created by migration 0001 is referenced by: content module (author FK), media module (uploader FK).
166
+ ```
167
+
168
+ ### Minimal Handoff (For Small Tasks)
169
+
170
+ For small, single-agent tasks that do not warrant a full handoff document:
171
+
172
+ ```markdown
173
+ # Handoff: {Task Name}
174
+
175
+ **FROM**: {agent name}
176
+ **STATUS**: Complete
177
+ **DELIVERABLES**: {file1}, {file2}, {file3}
178
+ **DECISIONS**: {one-line per decision}
179
+ **OPEN QUESTIONS**: None
180
+ **RECOMMENDATIONS**: {one-line for next agent}
181
+ ```
182
+
183
+ ## Receiving Protocol
184
+
185
+ When an agent receives a handoff (either a direct handoff from another agent or a task dispatch from the Strategist/Architect), follow this protocol before doing any work:
186
+
187
+ ### Step 1: Read All Relevant Plan Documents
188
+
189
+ Read the documents that establish context for the task:
190
+
191
+ 1. `vision.md` — understand the project goals and constraints.
192
+ 2. `architecture.md` — understand the technical design and where this task fits.
193
+ 3. `test-plan.md` — understand the testing expectations (if implementing or testing).
194
+ 4. `xd-plan.md` — understand the UX design (if working on frontend).
195
+ 5. Any prior handoff documents in `agent-output/` that are relevant to this task.
196
+
197
+ ### Step 2: Acknowledge Scope
198
+
199
+ Before starting work, internally verify:
200
+
201
+ - What exactly is the scope of this task? (Files to create/modify, boundaries)
202
+ - What is explicitly out of scope? (Files owned by other agents, deferred work)
203
+ - What decisions have already been made that constrain this work?
204
+ - What shared types/interfaces/contracts must be used (not recreated)?
205
+
206
+ ### Step 3: Flag Concerns
207
+
208
+ If anything in the handoff is unclear, contradictory, or seems wrong, flag it before proceeding:
209
+
210
+ - If the architecture document specifies a pattern that conflicts with a project convention, raise it.
211
+ - If the scope appears to overlap with another agent's scope, raise it.
212
+ - If a required dependency (shared type, base table, configuration) does not exist yet, raise it.
213
+ - If the task seems larger than a single dispatch unit, raise it.
214
+
215
+ Raise concerns by writing them to the handoff output document under "Concerns Raised" and, if the concern is blocking, escalating to the Strategist.
216
+
217
+ ### Step 4: Begin Work
218
+
219
+ Only after reading, acknowledging, and flagging proceed with implementation. Work within the stated scope. Do not expand scope without escalation.
220
+
221
+ ## Token Efficiency
222
+
223
+ Context windows are finite and expensive. The handoff system is designed to minimize token waste.
224
+
225
+ ### Rules for Token-Efficient Handoff
226
+
227
+ 1. **Never pass raw conversation history between agents.** A 50-turn debugging conversation might be 20K tokens. The handoff summary should be 500 tokens: root cause, fix, regression test, done.
228
+
229
+ 2. **Write findings to documents, not to parent context.** When a sub-agent finishes, it writes its results to a file. The orchestrating agent reads the file. The orchestrating agent does NOT need to include the sub-agent's full output in its own context — just the file path and a status summary.
230
+
231
+ 3. **Reference, do not inline.** Instead of pasting the contents of `architecture.md` into a task prompt, instruct the agent: "Read `docs/plans/2026-02-25-notifications/architecture.md`, section 'WebSocket Gateway'." The agent reads what it needs; the prompt stays small.
232
+
233
+ 4. **Summarize at phase boundaries.** At the end of each Forge phase (Vision, Architecture, Implementation, Quality, Documentation, Deployment), the leading agent writes a phase summary to the plan directory. Subsequent phases read the summary, not the full working history.
234
+
235
+ 5. **Prune completed handoff data.** Once a handoff is acknowledged and work begins, the receiving agent does not need to keep the handoff document in its active context. Read it once, extract what is needed, proceed.
236
+
237
+ ### What Belongs in Context vs. in Documents
238
+
239
+ | In Agent Context (prompt) | In Plan Documents (filesystem) |
240
+ |--------------------------|-------------------------------|
241
+ | Current task description | Full architecture design |
242
+ | Immediate scope boundaries | Complete vision document |
243
+ | Key constraints (3-5 bullets) | Detailed test plan |
244
+ | Shared type definitions (if small) | All agent output reports |
245
+ | Error messages being debugged | Historical decision logs |
246
+
247
+ ## Escalation Protocol
248
+
249
+ Not all handoffs go smoothly. When an agent encounters a situation it cannot resolve within its scope, escalate to the Strategist.
250
+
251
+ ### When to Escalate
252
+
253
+ - **Scope change detected.** The work required to fulfill the task exceeds or differs from the original scope defined in the architecture/vision documents. Example: "The architecture says to use REST, but the requirements imply real-time bidirectional communication — this needs a WebSocket design that is not in the architecture."
254
+ - **Blocker encountered.** A dependency is missing, a service is unavailable, a required decision has not been made, or a technical constraint makes the planned approach impossible.
255
+ - **Conflicting requirements.** Two plan documents (or two sections of the same document) specify contradictory behavior. Example: "The vision says 'offline-first' but the architecture shows a stateless API with no local storage."
256
+ - **Quality threshold not met.** The Inspector or Tester finds issues that cannot be fixed within the current agent's scope (e.g., a security vulnerability that requires architectural change).
257
+ - **User input required.** A decision is too impactful, too irreversible, or too far from established patterns to make autonomously.
258
+
259
+ ### Escalation Format
260
+
261
+ ```markdown
262
+ # ESCALATION
263
+
264
+ **FROM**: {agent name}
265
+ **TO**: Strategist
266
+ **PRIORITY**: Blocking | High | Low
267
+ **DATE**: YYYY-MM-DD
268
+
269
+ ## Issue
270
+
271
+ {Clear, concise description of the problem}
272
+
273
+ ## Context
274
+
275
+ {What task was being performed, what was discovered}
276
+
277
+ ## Options Considered
278
+
279
+ | Option | Pros | Cons |
280
+ |--------|------|------|
281
+ | A: {description} | ... | ... |
282
+ | B: {description} | ... | ... |
283
+
284
+ ## Recommendation
285
+
286
+ {Agent's recommended option, if any, with rationale}
287
+
288
+ ## Impact if Unresolved
289
+
290
+ {What happens if this escalation is not resolved — blocked agents, degraded quality, scope gap}
291
+ ```
292
+
293
+ ### Escalation Flow
294
+
295
+ 1. Agent writes escalation to `docs/plans/YYYY-MM-DD-{TITLE}/escalations/{agent}-{topic}.md`.
296
+ 2. Agent pauses work on the blocked item (continues on unblocked items if any).
297
+ 3. Strategist reviews the escalation, consults the user if needed, and writes a resolution directive.
298
+ 4. Agent reads the resolution and resumes work.
299
+
300
+ ## Handoff Anti-Patterns
301
+
302
+ ### "Just Read My Code"
303
+
304
+ Never hand off by pointing to code files and saying "the implementation speaks for itself." Code captures what was built, not why. The receiving agent needs rationale, constraints, and context that code alone does not provide.
305
+
306
+ ### Context Dump
307
+
308
+ Never hand off by pasting the entire conversation history or every file that was touched. This wastes tokens and forces the receiving agent to sift through noise. Summarize, structure, and distill.
309
+
310
+ ### Implicit Scope
311
+
312
+ Never hand off without explicit scope boundaries. "Build the frontend" is not a handoff. "Build the dashboard page per xd-plan.md section 3, creating files in `src/pages/dashboard/`, using shared components from `src/components/ui/`, consuming the `/api/v1/metrics` endpoint defined in architecture.md section 5.2" is a handoff.
313
+
314
+ ### Missing Decisions
315
+
316
+ Never hand off with undocumented decisions. If the Architect chose PostgreSQL over MongoDB, or chose WebSocket over SSE, or chose UUID over auto-increment — it must be in the handoff with rationale. The Builder should not rediscover or re-debate these decisions.
317
+
318
+ ### Orphaned Open Questions
319
+
320
+ Never hand off open questions without directing them to someone. Each open question should name who is expected to resolve it (Strategist, user, next agent) and what the default assumption is if it remains unresolved.
321
+
322
+ ## Handoff Verification Checklist
323
+
324
+ Before finalizing a handoff, verify:
325
+
326
+ - [ ] All deliverable files are listed with paths and descriptions.
327
+ - [ ] All non-trivial decisions are recorded with rationale.
328
+ - [ ] All new constraints are documented.
329
+ - [ ] All open questions name an owner and a default assumption.
330
+ - [ ] The next agent's scope is explicitly defined (what to do AND what not to do).
331
+ - [ ] Shared dependencies are identified (files to import, not recreate).
332
+ - [ ] The handoff document is written to the correct path under `docs/plans/`.
333
+ - [ ] The handoff status is accurate (Complete, Partial, or Blocked).
334
+ - [ ] Recommendations for the receiving agent are actionable and specific.
335
+ - [ ] No raw conversation history or large code blocks are included — only summaries and references.
@@ -0,0 +1,317 @@
1
+ ---
2
+ name: anti-stub
3
+ description: This skill should be used when writing production code, reviewing code for completeness, or verifying that implementations are fully wired. Used by the inspector agent for enforcement and by all implementation agents for self-discipline. Detects and prevents incomplete implementations, placeholder returns, and TODO stubs.
4
+ user-invocable: false
5
+ ---
6
+
7
+ # Anti-Stub Skill
8
+
9
+ ## Purpose
10
+
11
+ Provide a rigorous detection and prevention methodology for incomplete implementations, placeholder returns, TODO stubs, and fake data in production code. Apply this skill when writing production code (as a self-check), when reviewing code for completeness, and when verifying that a feature is truly implemented — not merely sketched. Stubs are the most insidious form of technical debt because they silently masquerade as completed work.
12
+
13
+ ---
14
+
15
+ ## Why Stubs Are Dangerous
16
+
17
+ ### False Confidence in the Test Suite
18
+
19
+ Tests that pass against stubbed implementations create an illusion of correctness. The test suite is green, code review looks clean, and the feature appears done. But the stub returns hardcoded data that happens to match the test's expectations. When real data flows through the system, the stub fails — often in production, long after the team has moved on.
20
+
21
+ ### Cascading Dependency Debt
22
+
23
+ Other code builds on stubbed interfaces. If `getUserPermissions()` returns a hardcoded `['admin']`, the authorization layer, the UI, and the audit log all develop around that assumption. When the real implementation arrives, every dependent system needs reworking. The longer the stub exists, the more code depends on it, and the more expensive the replacement becomes.
24
+
25
+ ### Stubs Get Forgotten
26
+
27
+ "Temporary" becomes permanent. Every stub is created with the intention of replacing it later. Most are not tracked in any task system. They hide in utility functions, seed files, and service implementations. Within weeks, nobody remembers that the function is a stub. Within months, the developer who created it has moved on to other work. The stub becomes a permanent fixture of the codebase.
28
+
29
+ ### Stubs Hide Missing Requirements
30
+
31
+ The existence of a function implies the feature exists. If `calculateShippingCost()` returns `0`, the product manager sees shipping cost on the invoice and assumes it works. The missing requirement — "integrate with the shipping rate API" — never surfaces because the stub gives the appearance of completion.
32
+
33
+ ---
34
+
35
+ ## What Stubs Look Like: Detection Patterns
36
+
37
+ ### Hardcoded Return Values
38
+
39
+ Functions that return static, predetermined data instead of computing or fetching real results:
40
+
41
+ ```typescript
42
+ // STUB: Returns empty collection instead of querying
43
+ async getUsers(): Promise<User[]> {
44
+ return [];
45
+ }
46
+
47
+ // STUB: Returns hardcoded object instead of database lookup
48
+ async getConfig(): Promise<AppConfig> {
49
+ return { theme: 'dark', language: 'en' };
50
+ }
51
+
52
+ // STUB: Returns null instead of implementing logic
53
+ async calculateDiscount(order: Order): Promise<number | null> {
54
+ return null;
55
+ }
56
+
57
+ // STUB: Returns placeholder string
58
+ async generateReport(): Promise<string> {
59
+ return 'TODO';
60
+ }
61
+ ```
62
+
63
+ ### TODO/FIXME/HACK Comments in Production Code
64
+
65
+ Any comment containing keywords that signal incomplete work:
66
+
67
+ - `TODO` — acknowledged incompleteness
68
+ - `FIXME` — acknowledged incorrectness
69
+ - `HACK` — acknowledged inappropriate implementation
70
+ - `PLACEHOLDER` — explicitly temporary
71
+ - `STUB` — explicitly unimplemented
72
+ - `NOT IMPLEMENTED` — explicitly unimplemented
73
+ - `TEMP` — explicitly temporary (when used to mark temporary code, not temporary data)
74
+
75
+ These comments are acceptable in test files, in documentation, and in issue trackers. They are NOT acceptable in production source code that will be deployed.
76
+
77
+ ### Empty or Swallowed Error Handlers
78
+
79
+ ```typescript
80
+ // STUB: Swallows errors silently
81
+ try {
82
+ await riskyOperation();
83
+ } catch (e) {}
84
+
85
+ // STUB: Logs but does not handle
86
+ try {
87
+ await riskyOperation();
88
+ } catch (e) {
89
+ console.log(e);
90
+ }
91
+
92
+ // STUB: Returns default value on error instead of handling
93
+ try {
94
+ return await fetchData();
95
+ } catch (e) {
96
+ return []; // Silently returns empty, caller never knows it failed
97
+ }
98
+ ```
99
+
100
+ ### Hardcoded Data in Production Services
101
+
102
+ Mock data, seed data, or fake data embedded in production service files:
103
+
104
+ ```typescript
105
+ // STUB: Hardcoded user list instead of database query
106
+ const users = [
107
+ { id: 1, name: 'Test User', email: 'test@example.com' },
108
+ { id: 2, name: 'Admin', email: 'admin@example.com' },
109
+ ];
110
+
111
+ // STUB: Hardcoded configuration instead of config service
112
+ const API_URL = 'http://localhost:3000';
113
+ ```
114
+
115
+ ### Placeholder UI Content
116
+
117
+ ```tsx
118
+ // STUB: Placeholder text
119
+ <p>Lorem ipsum dolor sit amet</p>
120
+
121
+ // STUB: Unimplemented page
122
+ <div>Coming soon</div>
123
+
124
+ // STUB: Feature facade
125
+ <div>Under construction</div>
126
+
127
+ // STUB: Fake data in component
128
+ const items = ['Item 1', 'Item 2', 'Item 3'];
129
+ ```
130
+
131
+ ### Not-Implemented Throw Patterns
132
+
133
+ ```typescript
134
+ // STUB: Function signature exists but body is a throw
135
+ async processPayment(payment: Payment): Promise<Receipt> {
136
+ throw new Error('Not implemented');
137
+ }
138
+
139
+ // STUB: Method exists but does nothing
140
+ onNotification(notification: Notification): void {
141
+ // will implement later
142
+ }
143
+ ```
144
+
145
+ ### API Endpoints with Empty Bodies
146
+
147
+ ```typescript
148
+ // STUB: Returns 200 but no real data
149
+ @Get('analytics')
150
+ async getAnalytics() {
151
+ return {};
152
+ }
153
+
154
+ // STUB: Accepts input but ignores it
155
+ @Post('webhook')
156
+ async handleWebhook(@Body() body: any) {
157
+ return { received: true };
158
+ }
159
+ ```
160
+
161
+ ---
162
+
163
+ ## Anti-Stub Rules
164
+
165
+ ### Rule 1: Every Function Must Return Real Data from a Real Source
166
+
167
+ If a function queries users, it must query the actual database (or data layer). If a function calculates a total, it must perform the actual calculation. If a function fetches external data, it must call the actual external API. No hardcoded returns. No inline mock data.
168
+
169
+ ### Rule 2: Every API Endpoint Must Connect to a Real Service
170
+
171
+ Every controller method must invoke the service layer, which must invoke the data layer. An endpoint that returns a hardcoded response is not an endpoint — it is a lie. Leave the endpoint out entirely until the service is ready.
172
+
173
+ ### Rule 3: Every UI Component Must Render Real Content
174
+
175
+ Components render data from props, from state, or from API responses. Never from hardcoded arrays or objects defined inside the component. Proper loading states ("Loading...") and empty states ("No items found") are real UI features, not stubs — they handle actual application conditions.
176
+
177
+ ### Rule 4: Every Error Handler Must Handle the Error
178
+
179
+ Error handling means one or more of: logging the error with context, retrying the operation, surfacing the error to the user, triggering a fallback behavior, or propagating the error up the call stack. An empty catch block is not error handling. A `console.log` is not error handling.
180
+
181
+ ### Rule 5: If the Real Implementation Is Not Ready, Do Not Create the Stub
182
+
183
+ The absence of a function is honest. A stub function is dishonest. If the payment processing integration is not ready, do not create a `processPayment` function that returns a fake receipt. Leave the payment module out of the codebase entirely until it can be implemented for real.
184
+
185
+ This is counterintuitive — it feels like "progress" to create the stub. But progress that creates false confidence is negative progress.
186
+
187
+ ### Rule 6: If a Dependency Is Unavailable, Throw a Clear Error
188
+
189
+ When a function cannot be implemented because an external dependency (API, service, database table) does not exist yet, throw an explicit error instead of returning fake data:
190
+
191
+ ```typescript
192
+ async getExchangeRate(currency: string): Promise<number> {
193
+ throw new NotImplementedException(
194
+ 'Exchange rate API integration pending — blocked by PROJ-1234'
195
+ );
196
+ }
197
+ ```
198
+
199
+ This is honest. It fails loudly. It includes a tracking reference. It cannot be mistaken for a working implementation.
200
+
201
+ ---
202
+
203
+ ## Grep Patterns for Detection
204
+
205
+ Use these patterns to scan a codebase for stubs. Run these against production source files only (exclude test files, fixture files, and seed files).
206
+
207
+ ### Comment-Based Stubs
208
+
209
+ ```
210
+ TODO|FIXME|HACK|PLACEHOLDER|STUB|NOT.IMPLEMENTED|TEMP.FIX|WILL.IMPLEMENT
211
+ ```
212
+
213
+ ### Return-Based Stubs
214
+
215
+ ```
216
+ return \[\]|return \{\}|return null|return ''|return 'TODO'|return undefined
217
+ ```
218
+
219
+ ### Content-Based Stubs
220
+
221
+ ```
222
+ lorem ipsum|coming soon|under construction|placeholder text|sample data
223
+ ```
224
+
225
+ ### Error-Handling Stubs
226
+
227
+ ```
228
+ catch.*\{\s*\}|catch.*console\.log
229
+ ```
230
+
231
+ ### Throw-Based Stubs
232
+
233
+ ```
234
+ throw new Error\('Not implemented|throw new NotImplementedException
235
+ ```
236
+
237
+ ### Hardcoded Localhost
238
+
239
+ ```
240
+ localhost:\d{4}|127\.0\.0\.1:\d{4}
241
+ ```
242
+
243
+ When running these patterns, review each match in context. Not every match is a stub — the patterns cast a wide net intentionally. A `return []` in a function that genuinely finds no results is not a stub. A `return []` in a function that should be querying a database is.
244
+
245
+ ---
246
+
247
+ ## What IS Acceptable
248
+
249
+ ### Mocks in Test Files
250
+
251
+ Test files (`*.spec.ts`, `*.test.ts`, `*.test.tsx`) exist to isolate behavior. Mocks, stubs, and fake data in test files are correct and necessary. The anti-stub rules apply to production source code only.
252
+
253
+ ### Loading and Empty States in UI
254
+
255
+ A component that renders "Loading..." while waiting for an API response is not a stub — it is a real feature that handles a real application state. Similarly, "No results found" for an empty search result is real behavior. The distinction: stubs replace real functionality; loading and empty states augment it.
256
+
257
+ ### Feature Flags
258
+
259
+ A feature flag that gates an incomplete feature is acceptable — the code behind the flag is real (or absent), and the flag explicitly communicates that the feature is not yet available. The stub problem is about deception; a feature flag is transparent.
260
+
261
+ ```typescript
262
+ // ACCEPTABLE: Feature flagged, clearly gated
263
+ if (featureFlags.isEnabled('advanced-analytics')) {
264
+ return this.analyticsService.getAdvancedReport(params);
265
+ }
266
+ return this.analyticsService.getBasicReport(params);
267
+ ```
268
+
269
+ ### Graceful Degradation
270
+
271
+ When an external service is down and the system falls back to cached data or reduced functionality, that is not a stub — it is resilience. The key difference: graceful degradation is an intentional, documented, monitored behavior. A stub is an undocumented omission.
272
+
273
+ ```typescript
274
+ // ACCEPTABLE: Intentional fallback with logging
275
+ try {
276
+ return await this.exchangeRateApi.getRate(currency);
277
+ } catch (error) {
278
+ this.logger.warn({ currency, error }, 'Exchange rate API unavailable, using cached rate');
279
+ return await this.cache.get(`exchange-rate:${currency}`);
280
+ }
281
+ ```
282
+
283
+ ### Default Values in Configuration
284
+
285
+ Configuration defaults are not stubs when they represent the actual default behavior of the system. A default page size of 20, a default timeout of 30 seconds, or a default locale of 'en-US' is legitimate application behavior.
286
+
287
+ ---
288
+
289
+ ## Enforcement During Code Review
290
+
291
+ When reviewing code for stub violations, check the following:
292
+
293
+ 1. **New functions**: Does every new function have a real implementation? Check return statements for hardcoded values.
294
+ 2. **New endpoints**: Does every new API endpoint call through to a real service? Trace the call from controller to service to data layer.
295
+ 3. **New components**: Does every new UI component receive data from props or hooks? Check for inline data arrays or objects.
296
+ 4. **Error handling**: Does every try/catch block handle the error? Search for empty catch bodies.
297
+ 5. **Comments**: Search for TODO, FIXME, HACK, and related keywords. If found, ask: is this a tracking comment (acceptable if linked to a ticket) or a replacement for actual implementation (unacceptable)?
298
+
299
+ ---
300
+
301
+ ## Interaction with TDD
302
+
303
+ The anti-stub skill and the TDD skill reinforce each other:
304
+
305
+ - **TDD prevents stubs** by requiring a test to fail before code is written. A test that demands real behavior will not pass with a stub (if the test is well-written).
306
+ - **Anti-stub catches TDD gaps** by identifying cases where the test passed with a stub because the test's assertions were too weak.
307
+ - **Together**: write a test that demands real behavior (TDD), implement the real behavior (anti-stub), verify that the test fails when the behavior is reverted to a stub (anti-stub validation).
308
+
309
+ If a test passes when the production code returns `return []`, the test is insufficient. Either add assertions that check for specific expected data, or add additional test cases that vary the input and verify corresponding output variation. A function that always returns the same value regardless of input is, by definition, a stub.
310
+
311
+ ---
312
+
313
+ ## The Anti-Stub Mindset
314
+
315
+ Stubs exist because of a well-intentioned impulse: "Let me get the structure in place and fill in the details later." The anti-stub discipline replaces this with: "Let me build only what I can build completely, right now."
316
+
317
+ This means smaller increments, more focused pull requests, and fewer half-built features. It means a codebase where every function that exists actually works, every endpoint that responds actually does something, and every component that renders actually shows real data. The codebase becomes trustworthy — when something exists, it works.
@@ -0,0 +1,31 @@
1
+ ---
2
+ name: brainstorm
3
+ description: Explore ideas before committing to a plan. Creative divergent thinking, then converge on a direction.
4
+ version: 0.1.0
5
+ ---
6
+
7
+ # /brainstorm — Creative Exploration
8
+
9
+ Dispatch the **brainstormer** agent for pre-pipeline creative exploration.
10
+
11
+ ## Behavior
12
+
13
+ **User provides a topic** (e.g., `/brainstorm multi-tenancy`):
14
+ - Dispatch the brainstormer agent with the topic as the seed.
15
+ - The brainstormer explores possibilities, challenges assumptions, and converges on a direction.
16
+
17
+ **No topic provided** (bare `/brainstorm`):
18
+ - Dispatch the brainstormer agent in open exploration mode.
19
+ - The brainstormer asks what's on the user's mind.
20
+
21
+ ## Handoff to Forge Pipeline
22
+
23
+ - The brainstormer produces a Brief document at `docs/plans/YYYY-MM-DD-{TITLE}/brief.md`.
24
+ - When the user is ready to build, create a pipeline project with `mcp__dk-forge__create_project` and start the Strategist with the Brief summary as `initial_request`.
25
+ - This handoff bridges creative exploration into the structured Forge pipeline.
26
+
27
+ ## Key Distinction
28
+
29
+ - `/brainstorm` is standalone creative exploration — no pipeline engine interaction.
30
+ - `/forge` is the structured pipeline entry point.
31
+ - A brainstorm session naturally flows into `/forge` when the user decides to build.