@winspan/claude-forge 8.54.3 → 9.2.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 (879) hide show
  1. package/DEVELOPMENT.md +649 -33
  2. package/README.md +155 -17
  3. package/dist/catalogs/agents.json +72 -0
  4. package/dist/catalogs/skills.json +194 -0
  5. package/dist/claudemd/claudemd-generator.d.ts +45 -45
  6. package/dist/claudemd/claudemd-generator.d.ts.map +1 -1
  7. package/dist/claudemd/claudemd-generator.js +128 -449
  8. package/dist/claudemd/claudemd-generator.js.map +1 -1
  9. package/dist/claudemd/index.d.ts +14 -4
  10. package/dist/claudemd/index.d.ts.map +1 -1
  11. package/dist/claudemd/index.js +15 -4
  12. package/dist/claudemd/index.js.map +1 -1
  13. package/dist/claudemd/resume-manager.d.ts.map +1 -1
  14. package/dist/claudemd/resume-manager.js +37 -9
  15. package/dist/claudemd/resume-manager.js.map +1 -1
  16. package/dist/claudemd/templates/swarm-protocol.md +35 -186
  17. package/dist/claudemd/violations-manager.d.ts +40 -0
  18. package/dist/claudemd/violations-manager.d.ts.map +1 -0
  19. package/dist/claudemd/violations-manager.js +106 -0
  20. package/dist/claudemd/violations-manager.js.map +1 -0
  21. package/dist/cli/commands/admin.d.ts +15 -0
  22. package/dist/cli/commands/admin.d.ts.map +1 -0
  23. package/dist/cli/commands/admin.js +177 -0
  24. package/dist/cli/commands/admin.js.map +1 -0
  25. package/dist/cli/commands/agents.d.ts +18 -0
  26. package/dist/cli/commands/agents.d.ts.map +1 -0
  27. package/dist/cli/commands/agents.js +160 -0
  28. package/dist/cli/commands/agents.js.map +1 -0
  29. package/dist/cli/commands/bypass.d.ts +18 -0
  30. package/dist/cli/commands/bypass.d.ts.map +1 -0
  31. package/dist/cli/commands/bypass.js +87 -0
  32. package/dist/cli/commands/bypass.js.map +1 -0
  33. package/dist/cli/commands/claudemd.d.ts +60 -0
  34. package/dist/cli/commands/claudemd.d.ts.map +1 -1
  35. package/dist/cli/commands/claudemd.js +174 -37
  36. package/dist/cli/commands/claudemd.js.map +1 -1
  37. package/dist/cli/commands/config.d.ts.map +1 -1
  38. package/dist/cli/commands/config.js +94 -1
  39. package/dist/cli/commands/config.js.map +1 -1
  40. package/dist/cli/commands/daemon.d.ts +39 -0
  41. package/dist/cli/commands/daemon.d.ts.map +1 -1
  42. package/dist/cli/commands/daemon.js +167 -20
  43. package/dist/cli/commands/daemon.js.map +1 -1
  44. package/dist/cli/commands/decisions.d.ts +129 -0
  45. package/dist/cli/commands/decisions.d.ts.map +1 -0
  46. package/dist/cli/commands/decisions.js +669 -0
  47. package/dist/cli/commands/decisions.js.map +1 -0
  48. package/dist/cli/commands/doctor.d.ts +29 -0
  49. package/dist/cli/commands/doctor.d.ts.map +1 -0
  50. package/dist/cli/commands/doctor.js +124 -0
  51. package/dist/cli/commands/doctor.js.map +1 -0
  52. package/dist/cli/commands/entropy.d.ts +35 -0
  53. package/dist/cli/commands/entropy.d.ts.map +1 -0
  54. package/dist/cli/commands/entropy.js +121 -0
  55. package/dist/cli/commands/entropy.js.map +1 -0
  56. package/dist/cli/commands/executions.d.ts +1 -0
  57. package/dist/cli/commands/executions.d.ts.map +1 -1
  58. package/dist/cli/commands/executions.js +10 -1
  59. package/dist/cli/commands/executions.js.map +1 -1
  60. package/dist/cli/commands/fix.d.ts +31 -0
  61. package/dist/cli/commands/fix.d.ts.map +1 -0
  62. package/dist/cli/commands/fix.js +108 -0
  63. package/dist/cli/commands/fix.js.map +1 -0
  64. package/dist/cli/commands/governance.d.ts +21 -0
  65. package/dist/cli/commands/governance.d.ts.map +1 -0
  66. package/dist/cli/commands/governance.js +60 -0
  67. package/dist/cli/commands/governance.js.map +1 -0
  68. package/dist/cli/commands/init.d.ts +27 -0
  69. package/dist/cli/commands/init.d.ts.map +1 -1
  70. package/dist/cli/commands/init.js +158 -146
  71. package/dist/cli/commands/init.js.map +1 -1
  72. package/dist/cli/commands/insights-goal-check.d.ts +50 -0
  73. package/dist/cli/commands/insights-goal-check.d.ts.map +1 -0
  74. package/dist/cli/commands/insights-goal-check.js +318 -0
  75. package/dist/cli/commands/insights-goal-check.js.map +1 -0
  76. package/dist/cli/commands/insights.d.ts +15 -0
  77. package/dist/cli/commands/insights.d.ts.map +1 -0
  78. package/dist/cli/commands/insights.js +127 -0
  79. package/dist/cli/commands/insights.js.map +1 -0
  80. package/dist/cli/commands/knowledge.d.ts +66 -0
  81. package/dist/cli/commands/knowledge.d.ts.map +1 -0
  82. package/dist/cli/commands/knowledge.js +897 -0
  83. package/dist/cli/commands/knowledge.js.map +1 -0
  84. package/dist/cli/commands/mcp.d.ts +0 -12
  85. package/dist/cli/commands/mcp.d.ts.map +1 -1
  86. package/dist/cli/commands/mcp.js +11 -5
  87. package/dist/cli/commands/mcp.js.map +1 -1
  88. package/dist/cli/commands/menu.d.ts.map +1 -1
  89. package/dist/cli/commands/menu.js +10 -184
  90. package/dist/cli/commands/menu.js.map +1 -1
  91. package/dist/cli/commands/project.d.ts +98 -0
  92. package/dist/cli/commands/project.d.ts.map +1 -0
  93. package/dist/cli/commands/project.js +382 -0
  94. package/dist/cli/commands/project.js.map +1 -0
  95. package/dist/cli/commands/skills.d.ts.map +1 -1
  96. package/dist/cli/commands/skills.js +14 -128
  97. package/dist/cli/commands/skills.js.map +1 -1
  98. package/dist/cli/commands/spec.d.ts +40 -0
  99. package/dist/cli/commands/spec.d.ts.map +1 -0
  100. package/dist/cli/commands/spec.js +49 -0
  101. package/dist/cli/commands/spec.js.map +1 -0
  102. package/dist/cli/commands/stats.d.ts.map +1 -1
  103. package/dist/cli/commands/stats.js +3 -2
  104. package/dist/cli/commands/stats.js.map +1 -1
  105. package/dist/cli/commands/status.d.ts.map +1 -1
  106. package/dist/cli/commands/status.js +17 -2
  107. package/dist/cli/commands/status.js.map +1 -1
  108. package/dist/cli/commands/trace.d.ts.map +1 -1
  109. package/dist/cli/commands/trace.js +4 -9
  110. package/dist/cli/commands/trace.js.map +1 -1
  111. package/dist/cli/commands/violations.d.ts +14 -0
  112. package/dist/cli/commands/violations.d.ts.map +1 -0
  113. package/dist/cli/commands/violations.js +43 -0
  114. package/dist/cli/commands/violations.js.map +1 -0
  115. package/dist/cli/index.js +26 -0
  116. package/dist/cli/index.js.map +1 -1
  117. package/dist/cli/init/hook-manager.d.ts +1 -1
  118. package/dist/cli/init/hook-manager.d.ts.map +1 -1
  119. package/dist/cli/init/hook-manager.js +6 -0
  120. package/dist/cli/init/hook-manager.js.map +1 -1
  121. package/dist/cli/utils/resolve-session.d.ts +32 -0
  122. package/dist/cli/utils/resolve-session.d.ts.map +1 -0
  123. package/dist/cli/utils/resolve-session.js +39 -0
  124. package/dist/cli/utils/resolve-session.js.map +1 -0
  125. package/dist/core/config.d.ts +4 -1
  126. package/dist/core/config.d.ts.map +1 -1
  127. package/dist/core/config.js +11 -23
  128. package/dist/core/config.js.map +1 -1
  129. package/dist/core/constants.d.ts +14 -13
  130. package/dist/core/constants.d.ts.map +1 -1
  131. package/dist/core/constants.js +20 -13
  132. package/dist/core/constants.js.map +1 -1
  133. package/dist/core/diagnostics/checks.d.ts +151 -0
  134. package/dist/core/diagnostics/checks.d.ts.map +1 -0
  135. package/dist/core/diagnostics/checks.js +765 -0
  136. package/dist/core/diagnostics/checks.js.map +1 -0
  137. package/dist/core/diagnostics/daemon-status.d.ts +77 -0
  138. package/dist/core/diagnostics/daemon-status.d.ts.map +1 -0
  139. package/dist/core/diagnostics/daemon-status.js +113 -0
  140. package/dist/core/diagnostics/daemon-status.js.map +1 -0
  141. package/dist/core/diagnostics/entropy-checks.d.ts +82 -0
  142. package/dist/core/diagnostics/entropy-checks.d.ts.map +1 -0
  143. package/dist/core/diagnostics/entropy-checks.js +395 -0
  144. package/dist/core/diagnostics/entropy-checks.js.map +1 -0
  145. package/dist/core/diagnostics/fix-runner.d.ts +54 -0
  146. package/dist/core/diagnostics/fix-runner.d.ts.map +1 -0
  147. package/dist/core/diagnostics/fix-runner.js +90 -0
  148. package/dist/core/diagnostics/fix-runner.js.map +1 -0
  149. package/dist/core/diagnostics/knip-runner.d.ts +49 -0
  150. package/dist/core/diagnostics/knip-runner.d.ts.map +1 -0
  151. package/dist/core/diagnostics/knip-runner.js +100 -0
  152. package/dist/core/diagnostics/knip-runner.js.map +1 -0
  153. package/dist/core/diagnostics/markers.d.ts +96 -0
  154. package/dist/core/diagnostics/markers.d.ts.map +1 -0
  155. package/dist/core/diagnostics/markers.js +153 -0
  156. package/dist/core/diagnostics/markers.js.map +1 -0
  157. package/dist/core/governance/global-inject.d.ts +60 -0
  158. package/dist/core/governance/global-inject.d.ts.map +1 -0
  159. package/dist/core/governance/global-inject.js +129 -0
  160. package/dist/core/governance/global-inject.js.map +1 -0
  161. package/dist/core/queue/index.d.ts +16 -3
  162. package/dist/core/queue/index.d.ts.map +1 -1
  163. package/dist/core/queue/index.js +14 -3
  164. package/dist/core/queue/index.js.map +1 -1
  165. package/dist/core/storage/base.d.ts +158 -0
  166. package/dist/core/storage/base.d.ts.map +1 -1
  167. package/dist/core/storage/base.js +570 -0
  168. package/dist/core/storage/base.js.map +1 -1
  169. package/dist/core/storage/codec/tool-input-codec.d.ts +93 -0
  170. package/dist/core/storage/codec/tool-input-codec.d.ts.map +1 -0
  171. package/dist/core/storage/codec/tool-input-codec.js +159 -0
  172. package/dist/core/storage/codec/tool-input-codec.js.map +1 -0
  173. package/dist/core/storage/decisions.d.ts +362 -0
  174. package/dist/core/storage/decisions.d.ts.map +1 -0
  175. package/dist/core/storage/decisions.js +502 -0
  176. package/dist/core/storage/decisions.js.map +1 -0
  177. package/dist/core/storage/events.d.ts +112 -8
  178. package/dist/core/storage/events.d.ts.map +1 -1
  179. package/dist/core/storage/events.js +390 -39
  180. package/dist/core/storage/events.js.map +1 -1
  181. package/dist/core/storage/feedback.d.ts +131 -0
  182. package/dist/core/storage/feedback.d.ts.map +1 -0
  183. package/dist/core/storage/feedback.js +187 -0
  184. package/dist/core/storage/feedback.js.map +1 -0
  185. package/dist/core/storage/forge-config.d.ts +40 -0
  186. package/dist/core/storage/forge-config.d.ts.map +1 -0
  187. package/dist/core/storage/forge-config.js +65 -0
  188. package/dist/core/storage/forge-config.js.map +1 -0
  189. package/dist/core/storage/injections.d.ts +28 -0
  190. package/dist/core/storage/injections.d.ts.map +1 -1
  191. package/dist/core/storage/injections.js +62 -5
  192. package/dist/core/storage/injections.js.map +1 -1
  193. package/dist/core/storage/knowledge.d.ts +106 -0
  194. package/dist/core/storage/knowledge.d.ts.map +1 -0
  195. package/dist/core/storage/knowledge.js +202 -0
  196. package/dist/core/storage/knowledge.js.map +1 -0
  197. package/dist/core/storage/maintenance.d.ts +36 -9
  198. package/dist/core/storage/maintenance.d.ts.map +1 -1
  199. package/dist/core/storage/maintenance.js +56 -24
  200. package/dist/core/storage/maintenance.js.map +1 -1
  201. package/dist/core/storage/pipeline-rollup.d.ts +117 -0
  202. package/dist/core/storage/pipeline-rollup.d.ts.map +1 -0
  203. package/dist/core/storage/pipeline-rollup.js +471 -0
  204. package/dist/core/storage/pipeline-rollup.js.map +1 -0
  205. package/dist/core/storage/routing.d.ts +16 -3
  206. package/dist/core/storage/routing.d.ts.map +1 -1
  207. package/dist/core/storage/routing.js +39 -8
  208. package/dist/core/storage/routing.js.map +1 -1
  209. package/dist/core/storage/rows.d.ts +50 -7
  210. package/dist/core/storage/rows.d.ts.map +1 -1
  211. package/dist/core/storage/schema.sql +302 -23
  212. package/dist/core/storage/sessions.d.ts +136 -0
  213. package/dist/core/storage/sessions.d.ts.map +1 -1
  214. package/dist/core/storage/sessions.js +351 -15
  215. package/dist/core/storage/sessions.js.map +1 -1
  216. package/dist/core/storage/skills.d.ts +1 -0
  217. package/dist/core/storage/skills.d.ts.map +1 -1
  218. package/dist/core/storage/skills.js +21 -6
  219. package/dist/core/storage/skills.js.map +1 -1
  220. package/dist/core/storage/sqlite.d.ts +253 -20
  221. package/dist/core/storage/sqlite.d.ts.map +1 -1
  222. package/dist/core/storage/sqlite.js +425 -16
  223. package/dist/core/storage/sqlite.js.map +1 -1
  224. package/dist/core/storage/tasks.d.ts +474 -2
  225. package/dist/core/storage/tasks.d.ts.map +1 -1
  226. package/dist/core/storage/tasks.js +1213 -18
  227. package/dist/core/storage/tasks.js.map +1 -1
  228. package/dist/core/storage/tool-intercepts.d.ts +69 -0
  229. package/dist/core/storage/tool-intercepts.d.ts.map +1 -0
  230. package/dist/core/storage/tool-intercepts.js +116 -0
  231. package/dist/core/storage/tool-intercepts.js.map +1 -0
  232. package/dist/core/storage/workflow-recommendations.d.ts +124 -0
  233. package/dist/core/storage/workflow-recommendations.d.ts.map +1 -0
  234. package/dist/core/storage/workflow-recommendations.js +274 -0
  235. package/dist/core/storage/workflow-recommendations.js.map +1 -0
  236. package/dist/core/types.d.ts +112 -17
  237. package/dist/core/types.d.ts.map +1 -1
  238. package/dist/core/types.js +12 -0
  239. package/dist/core/types.js.map +1 -1
  240. package/dist/core/utils/backup.d.ts +81 -0
  241. package/dist/core/utils/backup.d.ts.map +1 -0
  242. package/dist/core/utils/backup.js +98 -0
  243. package/dist/core/utils/backup.js.map +1 -0
  244. package/dist/core/utils/binary-paths.d.ts +92 -0
  245. package/dist/core/utils/binary-paths.d.ts.map +1 -0
  246. package/dist/core/utils/binary-paths.js +166 -0
  247. package/dist/core/utils/binary-paths.js.map +1 -0
  248. package/dist/core/utils/bypass-token.d.ts +75 -0
  249. package/dist/core/utils/bypass-token.d.ts.map +1 -0
  250. package/dist/core/utils/bypass-token.js +133 -0
  251. package/dist/core/utils/bypass-token.js.map +1 -0
  252. package/dist/core/utils/cc-builtin-agents.d.ts +3 -0
  253. package/dist/core/utils/cc-builtin-agents.d.ts.map +1 -0
  254. package/dist/core/utils/cc-builtin-agents.js +29 -0
  255. package/dist/core/utils/cc-builtin-agents.js.map +1 -0
  256. package/dist/core/utils/claude-cli-spawn.d.ts +106 -0
  257. package/dist/core/utils/claude-cli-spawn.d.ts.map +1 -0
  258. package/dist/core/utils/claude-cli-spawn.js +219 -0
  259. package/dist/core/utils/claude-cli-spawn.js.map +1 -0
  260. package/dist/core/utils/forge-resume-block.d.ts.map +1 -1
  261. package/dist/core/utils/forge-resume-block.js +3 -2
  262. package/dist/core/utils/forge-resume-block.js.map +1 -1
  263. package/dist/core/utils/logger.d.ts +15 -3
  264. package/dist/core/utils/logger.d.ts.map +1 -1
  265. package/dist/core/utils/logger.js +20 -2
  266. package/dist/core/utils/logger.js.map +1 -1
  267. package/dist/core/utils/noise-prompt.d.ts +97 -0
  268. package/dist/core/utils/noise-prompt.d.ts.map +1 -0
  269. package/dist/core/utils/noise-prompt.js +127 -0
  270. package/dist/core/utils/noise-prompt.js.map +1 -0
  271. package/dist/core/utils/path.d.ts +0 -4
  272. package/dist/core/utils/path.d.ts.map +1 -1
  273. package/dist/core/utils/path.js +0 -7
  274. package/dist/core/utils/path.js.map +1 -1
  275. package/dist/core/utils/time.d.ts +41 -0
  276. package/dist/core/utils/time.d.ts.map +1 -1
  277. package/dist/core/utils/time.js +114 -0
  278. package/dist/core/utils/time.js.map +1 -1
  279. package/dist/daemon/agent-sync.d.ts +24 -0
  280. package/dist/daemon/agent-sync.d.ts.map +1 -0
  281. package/dist/daemon/agent-sync.js +114 -0
  282. package/dist/daemon/agent-sync.js.map +1 -0
  283. package/dist/daemon/config-store.d.ts +55 -0
  284. package/dist/daemon/config-store.d.ts.map +1 -0
  285. package/dist/daemon/config-store.js +137 -0
  286. package/dist/daemon/config-store.js.map +1 -0
  287. package/dist/daemon/event-parser.d.ts +22 -0
  288. package/dist/daemon/event-parser.d.ts.map +1 -1
  289. package/dist/daemon/event-parser.js +49 -3
  290. package/dist/daemon/event-parser.js.map +1 -1
  291. package/dist/daemon/handlers/history-exporter.d.ts.map +1 -1
  292. package/dist/daemon/handlers/history-exporter.js +9 -8
  293. package/dist/daemon/handlers/history-exporter.js.map +1 -1
  294. package/dist/daemon/handlers/post-tool-use.d.ts +58 -4
  295. package/dist/daemon/handlers/post-tool-use.d.ts.map +1 -1
  296. package/dist/daemon/handlers/post-tool-use.js +261 -8
  297. package/dist/daemon/handlers/post-tool-use.js.map +1 -1
  298. package/dist/daemon/handlers/pre-tool-use.d.ts +156 -0
  299. package/dist/daemon/handlers/pre-tool-use.d.ts.map +1 -0
  300. package/dist/daemon/handlers/pre-tool-use.js +585 -0
  301. package/dist/daemon/handlers/pre-tool-use.js.map +1 -0
  302. package/dist/daemon/handlers/stop.d.ts +35 -7
  303. package/dist/daemon/handlers/stop.d.ts.map +1 -1
  304. package/dist/daemon/handlers/stop.js +157 -8
  305. package/dist/daemon/handlers/stop.js.map +1 -1
  306. package/dist/daemon/handlers/user-prompt.d.ts +36 -14
  307. package/dist/daemon/handlers/user-prompt.d.ts.map +1 -1
  308. package/dist/daemon/handlers/user-prompt.js +135 -48
  309. package/dist/daemon/handlers/user-prompt.js.map +1 -1
  310. package/dist/daemon/hook-sync.d.ts.map +1 -1
  311. package/dist/daemon/hook-sync.js +2 -1
  312. package/dist/daemon/hook-sync.js.map +1 -1
  313. package/dist/daemon/index.d.ts.map +1 -1
  314. package/dist/daemon/index.js +471 -43
  315. package/dist/daemon/index.js.map +1 -1
  316. package/dist/daemon/lifecycle.d.ts +48 -1
  317. package/dist/daemon/lifecycle.d.ts.map +1 -1
  318. package/dist/daemon/lifecycle.js +98 -2
  319. package/dist/daemon/lifecycle.js.map +1 -1
  320. package/dist/daemon/router.d.ts +4 -1
  321. package/dist/daemon/router.d.ts.map +1 -1
  322. package/dist/daemon/router.js +4 -2
  323. package/dist/daemon/router.js.map +1 -1
  324. package/dist/daemon/rules/defaults.d.ts +20 -0
  325. package/dist/daemon/rules/defaults.d.ts.map +1 -0
  326. package/dist/daemon/rules/defaults.js +692 -0
  327. package/dist/daemon/rules/defaults.js.map +1 -0
  328. package/dist/daemon/rules/registry.d.ts +47 -0
  329. package/dist/daemon/rules/registry.d.ts.map +1 -0
  330. package/dist/daemon/rules/registry.js +84 -0
  331. package/dist/daemon/rules/registry.js.map +1 -0
  332. package/dist/daemon/rules/types.d.ts +170 -0
  333. package/dist/daemon/rules/types.d.ts.map +1 -0
  334. package/dist/daemon/rules/types.js +15 -0
  335. package/dist/daemon/rules/types.js.map +1 -0
  336. package/dist/daemon/rules/whitelist.d.ts +101 -0
  337. package/dist/daemon/rules/whitelist.d.ts.map +1 -0
  338. package/dist/daemon/rules/whitelist.js +210 -0
  339. package/dist/daemon/rules/whitelist.js.map +1 -0
  340. package/dist/daemon/rules/workflow-defaults.d.ts +52 -0
  341. package/dist/daemon/rules/workflow-defaults.d.ts.map +1 -0
  342. package/dist/daemon/rules/workflow-defaults.js +521 -0
  343. package/dist/daemon/rules/workflow-defaults.js.map +1 -0
  344. package/dist/daemon/server.d.ts +11 -1
  345. package/dist/daemon/server.d.ts.map +1 -1
  346. package/dist/daemon/server.js +7 -1
  347. package/dist/daemon/server.js.map +1 -1
  348. package/dist/daemon/services/context-injector.d.ts +34 -0
  349. package/dist/daemon/services/context-injector.d.ts.map +1 -0
  350. package/dist/daemon/services/context-injector.js +61 -0
  351. package/dist/daemon/services/context-injector.js.map +1 -0
  352. package/dist/daemon/services/decision-hint.d.ts +203 -0
  353. package/dist/daemon/services/decision-hint.d.ts.map +1 -0
  354. package/dist/daemon/services/decision-hint.js +487 -0
  355. package/dist/daemon/services/decision-hint.js.map +1 -0
  356. package/dist/daemon/services/event-ttl-sweep.d.ts +86 -0
  357. package/dist/daemon/services/event-ttl-sweep.d.ts.map +1 -0
  358. package/dist/daemon/services/event-ttl-sweep.js +123 -0
  359. package/dist/daemon/services/event-ttl-sweep.js.map +1 -0
  360. package/dist/daemon/services/experience-extractor.d.ts +67 -0
  361. package/dist/daemon/services/experience-extractor.d.ts.map +1 -0
  362. package/dist/daemon/services/experience-extractor.js +323 -0
  363. package/dist/daemon/services/experience-extractor.js.map +1 -0
  364. package/dist/daemon/services/feedback-aggregator.d.ts +179 -0
  365. package/dist/daemon/services/feedback-aggregator.d.ts.map +1 -0
  366. package/dist/daemon/services/feedback-aggregator.js +455 -0
  367. package/dist/daemon/services/feedback-aggregator.js.map +1 -0
  368. package/dist/daemon/services/heartbeat-writer.d.ts +55 -0
  369. package/dist/daemon/services/heartbeat-writer.d.ts.map +1 -0
  370. package/dist/daemon/services/heartbeat-writer.js +111 -0
  371. package/dist/daemon/services/heartbeat-writer.js.map +1 -0
  372. package/dist/daemon/services/idle-session-sweeper.d.ts +61 -0
  373. package/dist/daemon/services/idle-session-sweeper.d.ts.map +1 -0
  374. package/dist/daemon/services/idle-session-sweeper.js +94 -0
  375. package/dist/daemon/services/idle-session-sweeper.js.map +1 -0
  376. package/dist/daemon/services/idle-task-budget.d.ts +50 -0
  377. package/dist/daemon/services/idle-task-budget.d.ts.map +1 -0
  378. package/dist/daemon/services/idle-task-budget.js +72 -0
  379. package/dist/daemon/services/idle-task-budget.js.map +1 -0
  380. package/dist/daemon/services/intercept-revive.d.ts +60 -0
  381. package/dist/daemon/services/intercept-revive.d.ts.map +1 -0
  382. package/dist/daemon/services/intercept-revive.js +86 -0
  383. package/dist/daemon/services/intercept-revive.js.map +1 -0
  384. package/dist/daemon/services/intercept-rollback-guard.d.ts +105 -0
  385. package/dist/daemon/services/intercept-rollback-guard.d.ts.map +1 -0
  386. package/dist/daemon/services/intercept-rollback-guard.js +152 -0
  387. package/dist/daemon/services/intercept-rollback-guard.js.map +1 -0
  388. package/dist/daemon/services/intercept-timeout-sweeper.d.ts +58 -0
  389. package/dist/daemon/services/intercept-timeout-sweeper.d.ts.map +1 -0
  390. package/dist/daemon/services/intercept-timeout-sweeper.js +83 -0
  391. package/dist/daemon/services/intercept-timeout-sweeper.js.map +1 -0
  392. package/dist/daemon/services/kb-injector.d.ts +57 -0
  393. package/dist/daemon/services/kb-injector.d.ts.map +1 -0
  394. package/dist/daemon/services/kb-injector.js +140 -0
  395. package/dist/daemon/services/kb-injector.js.map +1 -0
  396. package/dist/daemon/services/outcome-classification-service.d.ts +49 -0
  397. package/dist/daemon/services/outcome-classification-service.d.ts.map +1 -0
  398. package/dist/daemon/services/outcome-classification-service.js +214 -0
  399. package/dist/daemon/services/outcome-classification-service.js.map +1 -0
  400. package/dist/daemon/services/outcome-classifier.d.ts +136 -0
  401. package/dist/daemon/services/outcome-classifier.d.ts.map +1 -0
  402. package/dist/daemon/services/outcome-classifier.js +178 -0
  403. package/dist/daemon/services/outcome-classifier.js.map +1 -0
  404. package/dist/daemon/services/outcome-nudge.d.ts +107 -0
  405. package/dist/daemon/services/outcome-nudge.d.ts.map +1 -0
  406. package/dist/daemon/services/outcome-nudge.js +242 -0
  407. package/dist/daemon/services/outcome-nudge.js.map +1 -0
  408. package/dist/daemon/services/spec-approval.d.ts +127 -0
  409. package/dist/daemon/services/spec-approval.d.ts.map +1 -0
  410. package/dist/daemon/services/spec-approval.js +216 -0
  411. package/dist/daemon/services/spec-approval.js.map +1 -0
  412. package/dist/daemon/services/spec-gate.d.ts +54 -0
  413. package/dist/daemon/services/spec-gate.d.ts.map +1 -0
  414. package/dist/daemon/services/spec-gate.js +113 -0
  415. package/dist/daemon/services/spec-gate.js.map +1 -0
  416. package/dist/daemon/services/task-boundary-classifier.d.ts +78 -0
  417. package/dist/daemon/services/task-boundary-classifier.d.ts.map +1 -0
  418. package/dist/daemon/services/task-boundary-classifier.js +202 -0
  419. package/dist/daemon/services/task-boundary-classifier.js.map +1 -0
  420. package/dist/daemon/services/task-segmenter.d.ts +219 -1
  421. package/dist/daemon/services/task-segmenter.d.ts.map +1 -1
  422. package/dist/daemon/services/task-segmenter.js +481 -17
  423. package/dist/daemon/services/task-segmenter.js.map +1 -1
  424. package/dist/daemon/services/violation-reporter.d.ts +130 -0
  425. package/dist/daemon/services/violation-reporter.d.ts.map +1 -0
  426. package/dist/daemon/services/violation-reporter.js +339 -0
  427. package/dist/daemon/services/violation-reporter.js.map +1 -0
  428. package/dist/daemon/skill-sync.d.ts +7 -2
  429. package/dist/daemon/skill-sync.d.ts.map +1 -1
  430. package/dist/daemon/skill-sync.js +114 -9
  431. package/dist/daemon/skill-sync.js.map +1 -1
  432. package/dist/daemon/templates/agents/claudemd-writer.md +101 -0
  433. package/dist/daemon/templates/agents/coder.md +105 -0
  434. package/dist/daemon/templates/agents/decision-maker.md +460 -0
  435. package/dist/daemon/templates/agents/doc-reviewer.md +115 -0
  436. package/dist/daemon/templates/agents/harness-debug-full.md +114 -0
  437. package/dist/daemon/templates/agents/harness-hotfix.md +99 -0
  438. package/dist/daemon/templates/agents/hybrid-feature-with-safety.md +104 -0
  439. package/dist/daemon/templates/agents/knowledge-builder.md +119 -0
  440. package/dist/daemon/templates/agents/patch-applier.md +144 -0
  441. package/dist/daemon/templates/agents/planner.md +165 -0
  442. package/dist/daemon/templates/agents/refactor-specialist.md +98 -0
  443. package/dist/daemon/templates/agents/skill-distiller.md +113 -0
  444. package/dist/daemon/templates/agents/task-boundary-classifier.md +64 -0
  445. package/dist/daemon/templates/agents/verify-agent.md +136 -0
  446. package/dist/daemon/utils/inject-block.d.ts +39 -0
  447. package/dist/daemon/utils/inject-block.d.ts.map +1 -0
  448. package/dist/daemon/utils/inject-block.js +25 -0
  449. package/dist/daemon/utils/inject-block.js.map +1 -0
  450. package/dist/hooks/hook-lib.sh +8 -0
  451. package/dist/hooks/notification.sh +19 -8
  452. package/dist/hooks/post-tool-use.sh +41 -23
  453. package/dist/hooks/pre-tool-use.sh +54 -23
  454. package/dist/hooks/session-start.sh +68 -0
  455. package/dist/hooks/stop.sh +24 -10
  456. package/dist/hooks/user-prompt-submit.sh +37 -21
  457. package/dist/knowledge/adapters/go-adapter.d.ts +65 -0
  458. package/dist/knowledge/adapters/go-adapter.d.ts.map +1 -0
  459. package/dist/knowledge/adapters/go-adapter.js +294 -0
  460. package/dist/knowledge/adapters/go-adapter.js.map +1 -0
  461. package/dist/knowledge/adapters/index.d.ts +41 -0
  462. package/dist/knowledge/adapters/index.d.ts.map +1 -0
  463. package/dist/knowledge/adapters/index.js +71 -0
  464. package/dist/knowledge/adapters/index.js.map +1 -0
  465. package/dist/knowledge/adapters/java-adapter.d.ts +66 -0
  466. package/dist/knowledge/adapters/java-adapter.d.ts.map +1 -0
  467. package/dist/knowledge/adapters/java-adapter.js +260 -0
  468. package/dist/knowledge/adapters/java-adapter.js.map +1 -0
  469. package/dist/knowledge/adapters/js-vue-adapter.d.ts +56 -0
  470. package/dist/knowledge/adapters/js-vue-adapter.d.ts.map +1 -0
  471. package/dist/knowledge/adapters/js-vue-adapter.js +203 -0
  472. package/dist/knowledge/adapters/js-vue-adapter.js.map +1 -0
  473. package/dist/knowledge/adapters/kotlin-adapter.d.ts +55 -0
  474. package/dist/knowledge/adapters/kotlin-adapter.d.ts.map +1 -0
  475. package/dist/knowledge/adapters/kotlin-adapter.js +209 -0
  476. package/dist/knowledge/adapters/kotlin-adapter.js.map +1 -0
  477. package/dist/knowledge/adapters/monorepo-adapter.d.ts +77 -0
  478. package/dist/knowledge/adapters/monorepo-adapter.d.ts.map +1 -0
  479. package/dist/knowledge/adapters/monorepo-adapter.js +170 -0
  480. package/dist/knowledge/adapters/monorepo-adapter.js.map +1 -0
  481. package/dist/knowledge/adapters/python-adapter.d.ts +89 -0
  482. package/dist/knowledge/adapters/python-adapter.d.ts.map +1 -0
  483. package/dist/knowledge/adapters/python-adapter.js +358 -0
  484. package/dist/knowledge/adapters/python-adapter.js.map +1 -0
  485. package/dist/knowledge/adapters/rust-adapter.d.ts +73 -0
  486. package/dist/knowledge/adapters/rust-adapter.d.ts.map +1 -0
  487. package/dist/knowledge/adapters/rust-adapter.js +329 -0
  488. package/dist/knowledge/adapters/rust-adapter.js.map +1 -0
  489. package/dist/knowledge/adapters/types.d.ts +99 -0
  490. package/dist/knowledge/adapters/types.d.ts.map +1 -0
  491. package/dist/knowledge/adapters/types.js +17 -0
  492. package/dist/knowledge/adapters/types.js.map +1 -0
  493. package/dist/knowledge/adapters/typescript-adapter.d.ts +57 -0
  494. package/dist/knowledge/adapters/typescript-adapter.d.ts.map +1 -0
  495. package/dist/knowledge/adapters/typescript-adapter.js +171 -0
  496. package/dist/knowledge/adapters/typescript-adapter.js.map +1 -0
  497. package/dist/knowledge/audit-applier.d.ts +70 -0
  498. package/dist/knowledge/audit-applier.d.ts.map +1 -0
  499. package/dist/knowledge/audit-applier.js +251 -0
  500. package/dist/knowledge/audit-applier.js.map +1 -0
  501. package/dist/knowledge/builder.d.ts +261 -0
  502. package/dist/knowledge/builder.d.ts.map +1 -0
  503. package/dist/knowledge/builder.js +937 -0
  504. package/dist/knowledge/builder.js.map +1 -0
  505. package/dist/knowledge/cli-provider.d.ts +151 -0
  506. package/dist/knowledge/cli-provider.d.ts.map +1 -0
  507. package/dist/knowledge/cli-provider.js +313 -0
  508. package/dist/knowledge/cli-provider.js.map +1 -0
  509. package/dist/knowledge/constants.d.ts +73 -0
  510. package/dist/knowledge/constants.d.ts.map +1 -0
  511. package/dist/knowledge/constants.js +93 -0
  512. package/dist/knowledge/constants.js.map +1 -0
  513. package/dist/knowledge/cross-module.d.ts +139 -0
  514. package/dist/knowledge/cross-module.d.ts.map +1 -0
  515. package/dist/knowledge/cross-module.js +370 -0
  516. package/dist/knowledge/cross-module.js.map +1 -0
  517. package/dist/knowledge/git-hooks.d.ts +67 -0
  518. package/dist/knowledge/git-hooks.d.ts.map +1 -0
  519. package/dist/knowledge/git-hooks.js +258 -0
  520. package/dist/knowledge/git-hooks.js.map +1 -0
  521. package/dist/knowledge/module-hash.d.ts +88 -0
  522. package/dist/knowledge/module-hash.d.ts.map +1 -0
  523. package/dist/knowledge/module-hash.js +162 -0
  524. package/dist/knowledge/module-hash.js.map +1 -0
  525. package/dist/knowledge/project-detector.d.ts +101 -0
  526. package/dist/knowledge/project-detector.d.ts.map +1 -0
  527. package/dist/knowledge/project-detector.js +223 -0
  528. package/dist/knowledge/project-detector.js.map +1 -0
  529. package/dist/knowledge/prompt.d.ts +228 -0
  530. package/dist/knowledge/prompt.d.ts.map +1 -0
  531. package/dist/knowledge/prompt.js +404 -0
  532. package/dist/knowledge/prompt.js.map +1 -0
  533. package/dist/knowledge/query.d.ts +105 -0
  534. package/dist/knowledge/query.d.ts.map +1 -0
  535. package/dist/knowledge/query.js +341 -0
  536. package/dist/knowledge/query.js.map +1 -0
  537. package/dist/knowledge/repo-map.d.ts +91 -0
  538. package/dist/knowledge/repo-map.d.ts.map +1 -0
  539. package/dist/knowledge/repo-map.js +408 -0
  540. package/dist/knowledge/repo-map.js.map +1 -0
  541. package/dist/knowledge/tools/index.d.ts +14 -0
  542. package/dist/knowledge/tools/index.d.ts.map +1 -0
  543. package/dist/knowledge/tools/index.js +11 -0
  544. package/dist/knowledge/tools/index.js.map +1 -0
  545. package/dist/knowledge/tools/knowledge-get-page.d.ts +46 -0
  546. package/dist/knowledge/tools/knowledge-get-page.d.ts.map +1 -0
  547. package/dist/knowledge/tools/knowledge-get-page.js +101 -0
  548. package/dist/knowledge/tools/knowledge-get-page.js.map +1 -0
  549. package/dist/knowledge/tools/knowledge-query.d.ts +77 -0
  550. package/dist/knowledge/tools/knowledge-query.d.ts.map +1 -0
  551. package/dist/knowledge/tools/knowledge-query.js +104 -0
  552. package/dist/knowledge/tools/knowledge-query.js.map +1 -0
  553. package/dist/knowledge/tools/repo-map-lookup.d.ts +45 -0
  554. package/dist/knowledge/tools/repo-map-lookup.d.ts.map +1 -0
  555. package/dist/knowledge/tools/repo-map-lookup.js +82 -0
  556. package/dist/knowledge/tools/repo-map-lookup.js.map +1 -0
  557. package/dist/knowledge/types.d.ts +269 -0
  558. package/dist/knowledge/types.d.ts.map +1 -0
  559. package/dist/knowledge/types.js +10 -0
  560. package/dist/knowledge/types.js.map +1 -0
  561. package/dist/knowledge/validator.d.ts +90 -0
  562. package/dist/knowledge/validator.d.ts.map +1 -0
  563. package/dist/knowledge/validator.js +288 -0
  564. package/dist/knowledge/validator.js.map +1 -0
  565. package/dist/mcp/server.d.ts.map +1 -1
  566. package/dist/mcp/server.js +222 -1
  567. package/dist/mcp/server.js.map +1 -1
  568. package/dist/skills/builtin-skills.d.ts +35 -0
  569. package/dist/skills/builtin-skills.d.ts.map +1 -0
  570. package/dist/skills/builtin-skills.js +68 -0
  571. package/dist/skills/builtin-skills.js.map +1 -0
  572. package/dist/skills/distill/attribution.d.ts +59 -0
  573. package/dist/skills/distill/attribution.d.ts.map +1 -0
  574. package/dist/skills/distill/attribution.js +101 -0
  575. package/dist/skills/distill/attribution.js.map +1 -0
  576. package/dist/skills/distill/claude-cli-resolver.d.ts +26 -0
  577. package/dist/skills/distill/claude-cli-resolver.d.ts.map +1 -0
  578. package/dist/skills/distill/claude-cli-resolver.js +115 -0
  579. package/dist/skills/distill/claude-cli-resolver.js.map +1 -0
  580. package/dist/skills/distill/distiller.d.ts +161 -0
  581. package/dist/skills/distill/distiller.d.ts.map +1 -0
  582. package/dist/skills/distill/distiller.js +461 -0
  583. package/dist/skills/distill/distiller.js.map +1 -0
  584. package/dist/skills/distill/index.d.ts +223 -0
  585. package/dist/skills/distill/index.d.ts.map +1 -0
  586. package/dist/skills/distill/index.js +466 -0
  587. package/dist/skills/distill/index.js.map +1 -0
  588. package/dist/skills/distill/project-anchor-guard.d.ts +116 -0
  589. package/dist/skills/distill/project-anchor-guard.d.ts.map +1 -0
  590. package/dist/skills/distill/project-anchor-guard.js +334 -0
  591. package/dist/skills/distill/project-anchor-guard.js.map +1 -0
  592. package/dist/skills/distill/topic-deduper.d.ts +77 -0
  593. package/dist/skills/distill/topic-deduper.d.ts.map +1 -0
  594. package/dist/skills/distill/topic-deduper.js +119 -0
  595. package/dist/skills/distill/topic-deduper.js.map +1 -0
  596. package/dist/skills/distill/upstream-fetcher.d.ts +71 -0
  597. package/dist/skills/distill/upstream-fetcher.d.ts.map +1 -0
  598. package/dist/skills/distill/upstream-fetcher.js +202 -0
  599. package/dist/skills/distill/upstream-fetcher.js.map +1 -0
  600. package/dist/skills/distilled/distilled-api-design.md +491 -0
  601. package/dist/skills/distilled/distilled-architecture-decision.md +173 -0
  602. package/dist/skills/distilled/distilled-creator.md +178 -0
  603. package/dist/skills/distilled/distilled-db-schema-design.md +245 -0
  604. package/dist/skills/distilled/distilled-defi-amm-security.md +293 -0
  605. package/dist/skills/distilled/distilled-executing-plans.md +113 -0
  606. package/dist/skills/distilled/distilled-harness-engineering.md +242 -0
  607. package/dist/skills/distilled/distilled-karpathy-guidelines.md +104 -0
  608. package/dist/skills/distilled/distilled-performance-optimization.md +175 -0
  609. package/dist/skills/distilled/distilled-spec-driven-design.md +193 -0
  610. package/dist/skills/distilled/distilled-systematic-debugging.md +306 -0
  611. package/dist/skills/distilled/distilled-verification-before-completion.md +203 -0
  612. package/dist/skills/keyword-score.d.ts +29 -0
  613. package/dist/skills/keyword-score.d.ts.map +1 -0
  614. package/dist/skills/keyword-score.js +54 -0
  615. package/dist/skills/keyword-score.js.map +1 -0
  616. package/dist/skills/registry.d.ts +64 -20
  617. package/dist/skills/registry.d.ts.map +1 -1
  618. package/dist/skills/registry.js +102 -105
  619. package/dist/skills/registry.js.map +1 -1
  620. package/dist/skills/tools/pipeline-suggest.js +14 -14
  621. package/dist/skills/tools/skill-invoke.d.ts +1 -1
  622. package/dist/skills/tools/skill-invoke.js +1 -1
  623. package/dist/web/routes/agent-content.d.ts +30 -0
  624. package/dist/web/routes/agent-content.d.ts.map +1 -0
  625. package/dist/web/routes/agent-content.js +139 -0
  626. package/dist/web/routes/agent-content.js.map +1 -0
  627. package/dist/web/routes/decisions.d.ts +15 -0
  628. package/dist/web/routes/decisions.d.ts.map +1 -0
  629. package/dist/web/routes/decisions.js +181 -0
  630. package/dist/web/routes/decisions.js.map +1 -0
  631. package/dist/web/routes/diagnostics.d.ts +61 -0
  632. package/dist/web/routes/diagnostics.d.ts.map +1 -0
  633. package/dist/web/routes/diagnostics.js +203 -0
  634. package/dist/web/routes/diagnostics.js.map +1 -0
  635. package/dist/web/routes/events.d.ts.map +1 -1
  636. package/dist/web/routes/events.js +24 -0
  637. package/dist/web/routes/events.js.map +1 -1
  638. package/dist/web/routes/health.d.ts +33 -0
  639. package/dist/web/routes/health.d.ts.map +1 -0
  640. package/dist/web/routes/health.js +37 -0
  641. package/dist/web/routes/health.js.map +1 -0
  642. package/dist/web/routes/insights.d.ts +0 -5
  643. package/dist/web/routes/insights.d.ts.map +1 -1
  644. package/dist/web/routes/insights.js +783 -2
  645. package/dist/web/routes/insights.js.map +1 -1
  646. package/dist/web/routes/knowledge.d.ts +16 -0
  647. package/dist/web/routes/knowledge.d.ts.map +1 -0
  648. package/dist/web/routes/knowledge.js +661 -0
  649. package/dist/web/routes/knowledge.js.map +1 -0
  650. package/dist/web/routes/patch.d.ts +60 -1
  651. package/dist/web/routes/patch.d.ts.map +1 -1
  652. package/dist/web/routes/patch.js +170 -64
  653. package/dist/web/routes/patch.js.map +1 -1
  654. package/dist/web/routes/pipeline.d.ts +37 -0
  655. package/dist/web/routes/pipeline.d.ts.map +1 -0
  656. package/dist/web/routes/pipeline.js +149 -0
  657. package/dist/web/routes/pipeline.js.map +1 -0
  658. package/dist/web/routes/rules.d.ts.map +1 -1
  659. package/dist/web/routes/rules.js +6 -1
  660. package/dist/web/routes/rules.js.map +1 -1
  661. package/dist/web/routes/sessions.d.ts.map +1 -1
  662. package/dist/web/routes/sessions.js +9 -1
  663. package/dist/web/routes/sessions.js.map +1 -1
  664. package/dist/web/routes/skill-content.d.ts +30 -0
  665. package/dist/web/routes/skill-content.d.ts.map +1 -0
  666. package/dist/web/routes/skill-content.js +117 -0
  667. package/dist/web/routes/skill-content.js.map +1 -0
  668. package/dist/web/routes/skills-distill.d.ts +29 -0
  669. package/dist/web/routes/skills-distill.d.ts.map +1 -0
  670. package/dist/web/routes/skills-distill.js +552 -0
  671. package/dist/web/routes/skills-distill.js.map +1 -0
  672. package/dist/web/routes/skills.js +7 -7
  673. package/dist/web/routes/skills.js.map +1 -1
  674. package/dist/web/routes/task-timeline.d.ts +102 -0
  675. package/dist/web/routes/task-timeline.d.ts.map +1 -0
  676. package/dist/web/routes/task-timeline.js +274 -0
  677. package/dist/web/routes/task-timeline.js.map +1 -0
  678. package/dist/web/routes/tasks.d.ts.map +1 -1
  679. package/dist/web/routes/tasks.js +355 -8
  680. package/dist/web/routes/tasks.js.map +1 -1
  681. package/dist/web/routes/trace.d.ts.map +1 -1
  682. package/dist/web/routes/trace.js +3 -2
  683. package/dist/web/routes/trace.js.map +1 -1
  684. package/dist/web/routes/types.d.ts +0 -4
  685. package/dist/web/routes/types.d.ts.map +1 -1
  686. package/dist/web/routes/types.js +1 -1
  687. package/dist/web/routes/types.js.map +1 -1
  688. package/dist/web/routes/violations.d.ts +14 -0
  689. package/dist/web/routes/violations.d.ts.map +1 -0
  690. package/dist/web/routes/violations.js +111 -0
  691. package/dist/web/routes/violations.js.map +1 -0
  692. package/dist/web/server.d.ts.map +1 -1
  693. package/dist/web/server.js +79 -19
  694. package/dist/web/server.js.map +1 -1
  695. package/dist/web/services/build-manager.d.ts +72 -0
  696. package/dist/web/services/build-manager.d.ts.map +1 -0
  697. package/dist/web/services/build-manager.js +189 -0
  698. package/dist/web/services/build-manager.js.map +1 -0
  699. package/dist/web/services/distill-manager.d.ts +125 -0
  700. package/dist/web/services/distill-manager.d.ts.map +1 -0
  701. package/dist/web/services/distill-manager.js +308 -0
  702. package/dist/web/services/distill-manager.js.map +1 -0
  703. package/dist/web/static/assets/AgentContentPage-DkeRNxok.js +2 -0
  704. package/dist/web/static/assets/AgentContentPage-DkeRNxok.js.map +1 -0
  705. package/dist/web/static/assets/AgentDelegationTable-ByBa0x1l.js +2 -0
  706. package/dist/web/static/assets/AgentDelegationTable-ByBa0x1l.js.map +1 -0
  707. package/dist/web/static/assets/ContextInsightsPage-oUk7_I8u.js +3 -0
  708. package/dist/web/static/assets/ContextInsightsPage-oUk7_I8u.js.map +1 -0
  709. package/dist/web/static/assets/DaemonHealthPage-DG2fyOP7.js +2 -0
  710. package/dist/web/static/assets/DaemonHealthPage-DG2fyOP7.js.map +1 -0
  711. package/dist/web/static/assets/DecisionsPage-CMAPEnKb.js +2 -0
  712. package/dist/web/static/assets/DecisionsPage-CMAPEnKb.js.map +1 -0
  713. package/dist/web/static/assets/DiagnosticsPage-DQd-Zm4r.js +2 -0
  714. package/dist/web/static/assets/DiagnosticsPage-DQd-Zm4r.js.map +1 -0
  715. package/dist/web/static/assets/DriftTab-DqpepOhI.js +2 -0
  716. package/dist/web/static/assets/DriftTab-DqpepOhI.js.map +1 -0
  717. package/dist/web/static/assets/HealthHomePage-CN6zNIie.js +3 -0
  718. package/dist/web/static/assets/HealthHomePage-CN6zNIie.js.map +1 -0
  719. package/dist/web/static/assets/KbHitRateTable-ByEIWujF.js +2 -0
  720. package/dist/web/static/assets/KbHitRateTable-ByEIWujF.js.map +1 -0
  721. package/dist/web/static/assets/MarkdownRenderer-DZmTl-8J.js +3 -0
  722. package/dist/web/static/assets/MarkdownRenderer-DZmTl-8J.js.map +1 -0
  723. package/dist/web/static/assets/NotFound-BQPh0vaF.js +2 -0
  724. package/dist/web/static/assets/NotFound-BQPh0vaF.js.map +1 -0
  725. package/dist/web/static/assets/ProjectSwitcher-D3lZMFd3.js +2 -0
  726. package/dist/web/static/assets/ProjectSwitcher-D3lZMFd3.js.map +1 -0
  727. package/dist/web/static/assets/SettingsPage-oLJBNzQj.js +2 -0
  728. package/dist/web/static/assets/SettingsPage-oLJBNzQj.js.map +1 -0
  729. package/dist/web/static/assets/SkillContentPage-DK5rgfgw.js +2 -0
  730. package/dist/web/static/assets/SkillContentPage-DK5rgfgw.js.map +1 -0
  731. package/dist/web/static/assets/SkillStatsTable-DYMzjEUV.js +2 -0
  732. package/dist/web/static/assets/SkillStatsTable-DYMzjEUV.js.map +1 -0
  733. package/dist/web/static/assets/SkillsDistillTab-C7qaG8q3.js +2 -0
  734. package/dist/web/static/assets/SkillsDistillTab-C7qaG8q3.js.map +1 -0
  735. package/dist/web/static/assets/TasksHubPage-03wsRRsJ.js +6 -0
  736. package/dist/web/static/assets/TasksHubPage-03wsRRsJ.js.map +1 -0
  737. package/dist/web/static/assets/ViolationsPage-DSiLr-9O.js +3 -0
  738. package/dist/web/static/assets/ViolationsPage-DSiLr-9O.js.map +1 -0
  739. package/dist/web/static/assets/arco-Bhi3a6Qp.js +14 -0
  740. package/dist/web/static/assets/arco-Bhi3a6Qp.js.map +1 -0
  741. package/dist/web/static/assets/arco-DFQA6dO_.css +1 -0
  742. package/dist/web/static/assets/charts-BuHQWDbQ.js +37 -0
  743. package/dist/web/static/assets/charts-BuHQWDbQ.js.map +1 -0
  744. package/dist/web/static/assets/date-fns-sbWH3_uq.js +2 -0
  745. package/dist/web/static/assets/date-fns-sbWH3_uq.js.map +1 -0
  746. package/dist/web/static/assets/index-7bl3kbcx.css +1 -0
  747. package/dist/web/static/assets/index-BIYnq1Dx.js +4 -0
  748. package/dist/web/static/assets/index-BIYnq1Dx.js.map +1 -0
  749. package/dist/web/static/assets/lucide-CnlPQoG8.js +72 -0
  750. package/dist/web/static/assets/lucide-CnlPQoG8.js.map +1 -0
  751. package/dist/web/static/assets/outcome-DUn1NjlC.js +2 -0
  752. package/dist/web/static/assets/outcome-DUn1NjlC.js.map +1 -0
  753. package/dist/web/static/assets/query-S6X1S7K9.js +2 -0
  754. package/dist/web/static/assets/{query-C99w429o.js.map → query-S6X1S7K9.js.map} +1 -1
  755. package/dist/web/static/assets/{react-router-r79dBVy4.js → react-router-JVUrkhdd.js} +3 -3
  756. package/dist/web/static/assets/{react-router-r79dBVy4.js.map → react-router-JVUrkhdd.js.map} +1 -1
  757. package/dist/web/static/assets/react-vendor-tkvCrao7.js +57 -0
  758. package/dist/web/static/assets/react-vendor-tkvCrao7.js.map +1 -0
  759. package/dist/web/static/assets/syntax-highlighter-BkZfCDsz.js +6 -0
  760. package/dist/web/static/assets/syntax-highlighter-BkZfCDsz.js.map +1 -0
  761. package/dist/web/static/assets/useTabsParam-k8qte_0C.js +2 -0
  762. package/dist/web/static/assets/useTabsParam-k8qte_0C.js.map +1 -0
  763. package/dist/web/static/assets/vendor-DWgdB1eY.js +65 -0
  764. package/dist/web/static/assets/vendor-DWgdB1eY.js.map +1 -0
  765. package/dist/web/static/index.html +12 -8
  766. package/package.json +14 -3
  767. package/dist/core/ai/provider.d.ts +0 -63
  768. package/dist/core/ai/provider.d.ts.map +0 -1
  769. package/dist/core/ai/provider.js +0 -241
  770. package/dist/core/ai/provider.js.map +0 -1
  771. package/dist/core/ai/types.d.ts +0 -43
  772. package/dist/core/ai/types.d.ts.map +0 -1
  773. package/dist/core/ai/types.js +0 -5
  774. package/dist/core/ai/types.js.map +0 -1
  775. package/dist/core/storage/token-usage.d.ts +0 -36
  776. package/dist/core/storage/token-usage.d.ts.map +0 -1
  777. package/dist/core/storage/token-usage.js +0 -59
  778. package/dist/core/storage/token-usage.js.map +0 -1
  779. package/dist/core/utils/token-tracker.d.ts +0 -39
  780. package/dist/core/utils/token-tracker.d.ts.map +0 -1
  781. package/dist/core/utils/token-tracker.js +0 -69
  782. package/dist/core/utils/token-tracker.js.map +0 -1
  783. package/dist/skills/index.d.ts +0 -3
  784. package/dist/skills/index.d.ts.map +0 -1
  785. package/dist/skills/index.js +0 -3
  786. package/dist/skills/index.js.map +0 -1
  787. package/dist/skills/matcher.d.ts +0 -26
  788. package/dist/skills/matcher.d.ts.map +0 -1
  789. package/dist/skills/matcher.js +0 -113
  790. package/dist/skills/matcher.js.map +0 -1
  791. package/dist/skills/official/code-simplifier.md +0 -52
  792. package/dist/skills/official/find-skills.md +0 -142
  793. package/dist/skills/official/official-api-design.md +0 -30
  794. package/dist/skills/official/official-architecture-decision.md +0 -41
  795. package/dist/skills/official/official-bmad.md +0 -118
  796. package/dist/skills/official/official-db-schema-design.md +0 -34
  797. package/dist/skills/official/official-debug.md +0 -25
  798. package/dist/skills/official/official-doc-driven.md +0 -31
  799. package/dist/skills/official/official-harness-engineering.md +0 -108
  800. package/dist/skills/official/official-performance-optimization.md +0 -30
  801. package/dist/skills/official/official-pr-review.md +0 -35
  802. package/dist/skills/official/official-release-checklist.md +0 -30
  803. package/dist/skills/official/official-security-hardening.md +0 -32
  804. package/dist/skills/official/official-spec-driven-design.md +0 -31
  805. package/dist/skills/official/planning-with-files.md +0 -241
  806. package/dist/skills/official/ui-ux-pro-max.md +0 -105
  807. package/dist/skills/official/webapp-testing.md +0 -96
  808. package/dist/skills/official-skills.d.ts +0 -26
  809. package/dist/skills/official-skills.d.ts.map +0 -1
  810. package/dist/skills/official-skills.js +0 -73
  811. package/dist/skills/official-skills.js.map +0 -1
  812. package/dist/skills/semantic-matcher.d.ts +0 -60
  813. package/dist/skills/semantic-matcher.d.ts.map +0 -1
  814. package/dist/skills/semantic-matcher.js +0 -192
  815. package/dist/skills/semantic-matcher.js.map +0 -1
  816. package/dist/skills/upgrade-engine.d.ts +0 -93
  817. package/dist/skills/upgrade-engine.d.ts.map +0 -1
  818. package/dist/skills/upgrade-engine.js +0 -447
  819. package/dist/skills/upgrade-engine.js.map +0 -1
  820. package/dist/skills/upgrade-prompt.d.ts +0 -20
  821. package/dist/skills/upgrade-prompt.d.ts.map +0 -1
  822. package/dist/skills/upgrade-prompt.js +0 -75
  823. package/dist/skills/upgrade-prompt.js.map +0 -1
  824. package/dist/web/routes/ai.d.ts +0 -10
  825. package/dist/web/routes/ai.d.ts.map +0 -1
  826. package/dist/web/routes/ai.js +0 -186
  827. package/dist/web/routes/ai.js.map +0 -1
  828. package/dist/web/routes/token-usage.d.ts +0 -7
  829. package/dist/web/routes/token-usage.d.ts.map +0 -1
  830. package/dist/web/routes/token-usage.js +0 -18
  831. package/dist/web/routes/token-usage.js.map +0 -1
  832. package/dist/web/ssrf-guard.d.ts +0 -35
  833. package/dist/web/ssrf-guard.d.ts.map +0 -1
  834. package/dist/web/ssrf-guard.js +0 -93
  835. package/dist/web/ssrf-guard.js.map +0 -1
  836. package/dist/web/static/assets/AIConfig-CdDWzJyO.js +0 -2
  837. package/dist/web/static/assets/AIConfig-CdDWzJyO.js.map +0 -1
  838. package/dist/web/static/assets/Dashboard-CoEmmIDt.js +0 -2
  839. package/dist/web/static/assets/Dashboard-CoEmmIDt.js.map +0 -1
  840. package/dist/web/static/assets/Drawer-DdRTzlLB.js +0 -2
  841. package/dist/web/static/assets/Drawer-DdRTzlLB.js.map +0 -1
  842. package/dist/web/static/assets/Events-DrIq1SUS.js +0 -2
  843. package/dist/web/static/assets/Events-DrIq1SUS.js.map +0 -1
  844. package/dist/web/static/assets/Reports-DFBM3MDK.js +0 -2
  845. package/dist/web/static/assets/Reports-DFBM3MDK.js.map +0 -1
  846. package/dist/web/static/assets/SearchInput-qCj_jAcf.js +0 -2
  847. package/dist/web/static/assets/SearchInput-qCj_jAcf.js.map +0 -1
  848. package/dist/web/static/assets/SessionDetail-CCzwdoT7.js +0 -2
  849. package/dist/web/static/assets/SessionDetail-CCzwdoT7.js.map +0 -1
  850. package/dist/web/static/assets/Sessions-FfLYkAw9.js +0 -2
  851. package/dist/web/static/assets/Sessions-FfLYkAw9.js.map +0 -1
  852. package/dist/web/static/assets/Skills-C8Gvs3Qa.js +0 -2
  853. package/dist/web/static/assets/Skills-C8Gvs3Qa.js.map +0 -1
  854. package/dist/web/static/assets/TaskDetail-BS8pYhaR.js +0 -2
  855. package/dist/web/static/assets/TaskDetail-BS8pYhaR.js.map +0 -1
  856. package/dist/web/static/assets/Tasks-CyuhizG8.js +0 -2
  857. package/dist/web/static/assets/Tasks-CyuhizG8.js.map +0 -1
  858. package/dist/web/static/assets/charts-CLrM0_uM.js +0 -37
  859. package/dist/web/static/assets/charts-CLrM0_uM.js.map +0 -1
  860. package/dist/web/static/assets/date-fns-CZ_bHujz.js +0 -2
  861. package/dist/web/static/assets/date-fns-CZ_bHujz.js.map +0 -1
  862. package/dist/web/static/assets/export-L_VBD2p1.js +0 -4
  863. package/dist/web/static/assets/export-L_VBD2p1.js.map +0 -1
  864. package/dist/web/static/assets/index-CBX47X8l.js +0 -3
  865. package/dist/web/static/assets/index-CBX47X8l.js.map +0 -1
  866. package/dist/web/static/assets/index-DjIoMdoR.css +0 -1
  867. package/dist/web/static/assets/lucide-Bs_edTLa.js +0 -232
  868. package/dist/web/static/assets/lucide-Bs_edTLa.js.map +0 -1
  869. package/dist/web/static/assets/query-C99w429o.js +0 -2
  870. package/dist/web/static/assets/react-vendor-CSp-GLFF.js +0 -49
  871. package/dist/web/static/assets/react-vendor-CSp-GLFF.js.map +0 -1
  872. package/dist/web/static/assets/syntax-highlighter-44FakypI.js +0 -9
  873. package/dist/web/static/assets/syntax-highlighter-44FakypI.js.map +0 -1
  874. package/dist/web/static/assets/task-title-BhOcemuR.js +0 -2
  875. package/dist/web/static/assets/task-title-BhOcemuR.js.map +0 -1
  876. package/dist/web/static/assets/time-Bxuk0M-C.js +0 -2
  877. package/dist/web/static/assets/time-Bxuk0M-C.js.map +0 -1
  878. package/dist/web/static/assets/vendor-CMMjVdZs.js +0 -64
  879. package/dist/web/static/assets/vendor-CMMjVdZs.js.map +0 -1
@@ -0,0 +1,692 @@
1
+ /**
2
+ * Default tool_intercept rules (v9.x Phase 1, D1 strict mode).
3
+ *
4
+ * 5 deny + 1 warn — see master-roadmap D1 decision (2026-05-22) for the
5
+ * rationale on each. Hints follow the spec §4.2 design:
6
+ * 1. Specific fix command (spawn X with prompt Y)
7
+ * 2. CLAUDE.md anchor for the rule narrative
8
+ * 3. Bypass mechanism made explicit
9
+ *
10
+ * Adding a new rule: keep `match` purely on `ToolInputFields` + `RuleContext`;
11
+ * if a rule needs DB lookup, pre-compute the signal in PreToolUseHandler and
12
+ * expose it on `RuleContext` (so rules stay synchronous + cheap).
13
+ */
14
+ import { isQuestionPrompt, hasDirectFixOverride, scoreKeywordBuckets, } from './workflow-defaults.js';
15
+ // ── Helpers ────────────────────────────────────────────────────────────────
16
+ /** Token-aware command splitter that respects single/double quotes. */
17
+ function splitCommand(cmd) {
18
+ const tokens = [];
19
+ let buf = '';
20
+ let inSingle = false;
21
+ let inDouble = false;
22
+ for (const ch of cmd) {
23
+ if (ch === "'" && !inDouble) {
24
+ inSingle = !inSingle;
25
+ buf += ch;
26
+ continue;
27
+ }
28
+ if (ch === '"' && !inSingle) {
29
+ inDouble = !inDouble;
30
+ buf += ch;
31
+ continue;
32
+ }
33
+ if (/\s/.test(ch) && !inSingle && !inDouble) {
34
+ if (buf) {
35
+ tokens.push(buf);
36
+ buf = '';
37
+ }
38
+ continue;
39
+ }
40
+ buf += ch;
41
+ }
42
+ if (buf)
43
+ tokens.push(buf);
44
+ return tokens;
45
+ }
46
+ /**
47
+ * Does the command target multiple files / a directory rather than a single
48
+ * named file? Used by Bash grep / find rules so that the trivial single-file
49
+ * use-case (`grep foo bar.ts`) is NOT intercepted.
50
+ *
51
+ * Heuristics (intentionally conservative — false negatives are OK, false
52
+ * positives are not):
53
+ * • -r / -R / --recursive present → multi-file
54
+ * • final positional arg ends with '/' → directory
55
+ * • a positional arg is exactly 'src' / 'tests' → directory
56
+ * • glob characters ('*' / '?' / brace) in args → multi-file
57
+ * • file extension wildcards (`*.ts`, `*.js`) → multi-file
58
+ */
59
+ function looksMultiFile(tokens) {
60
+ const args = tokens.slice(1); // drop the command name itself
61
+ for (const a of args) {
62
+ if (a === '-r' || a === '-R' || a === '--recursive')
63
+ return true;
64
+ }
65
+ // Positional args (skip flags). We only inspect non-flag args because a
66
+ // grep PATTERN like '-foo' would otherwise be misread as a flag.
67
+ const positionals = args.filter((a) => !a.startsWith('-'));
68
+ // Skip the very first positional (it's usually the search pattern).
69
+ const fileArgs = positionals.slice(1);
70
+ for (const a of fileArgs) {
71
+ if (a.endsWith('/'))
72
+ return true;
73
+ if (a === 'src' || a === 'tests' || a === 'lib' || a === 'app')
74
+ return true;
75
+ if (a.includes('*') || a.includes('?') || a.includes('{'))
76
+ return true;
77
+ }
78
+ // No file arg at all (e.g. `grep -r foo` with no positional dir) — treat as multi-file
79
+ // because grep defaults to cwd in recursive mode.
80
+ if (fileArgs.length === 0 && args.some((a) => a === '-r' || a === '-R'))
81
+ return true;
82
+ return false;
83
+ }
84
+ /**
85
+ * Recognised search-tool head commands for `bash-grep-multi-file`.
86
+ *
87
+ * Live-data triage (2026-05-26) found the rule firing on `cp -r ... && grep`,
88
+ * `rm -rf ... | grep Health`, `chmod ... && bash` etc. where the user intent
89
+ * is clearly the leading mutation command and grep is just a post-verification
90
+ * filter. Narrowing to "first token must be a search tool" eliminates those
91
+ * false positives while preserving real exploratory grep/rg/ag/git-grep cases.
92
+ *
93
+ * NOTE: `find` is handled by the separate `bash-find-source` rule and is NOT
94
+ * included here.
95
+ */
96
+ const GREP_HEAD_TOOLS = new Set([
97
+ 'grep',
98
+ 'rg',
99
+ 'ripgrep',
100
+ 'ack',
101
+ 'ag',
102
+ ]);
103
+ /**
104
+ * True if the FIRST shell command of the line is a recognised search tool.
105
+ *
106
+ * "First command" = before any of `&&`, `||`, `;`, `|`, `&` (the connectors
107
+ * that introduce a *new* command). Leading `time` / env-prefix etc. are NOT
108
+ * stripped (rare in practice; keeping the matcher simple).
109
+ *
110
+ * Special-case `git grep` — when first token is `git` and second is `grep`,
111
+ * still counts as a grep head.
112
+ */
113
+ function isGrepHeadCommand(cmd) {
114
+ // Take everything up to the first shell connector.
115
+ // Order matters: && before & so we split on the longer token first.
116
+ let head = cmd;
117
+ for (const sep of ['&&', '||', ';', '|', '&']) {
118
+ const idx = head.indexOf(sep);
119
+ if (idx !== -1)
120
+ head = head.slice(0, idx);
121
+ }
122
+ head = head.trim();
123
+ if (!head)
124
+ return false;
125
+ const firstTokens = splitCommand(head);
126
+ if (firstTokens.length === 0)
127
+ return false;
128
+ const first = firstTokens[0];
129
+ if (GREP_HEAD_TOOLS.has(first))
130
+ return true;
131
+ // `git grep` form: first=git, second=grep.
132
+ if (first === 'git' && firstTokens.length >= 2 && firstTokens[1] === 'grep')
133
+ return true;
134
+ return false;
135
+ }
136
+ /** Detect a single-file `git log` / `git diff` use (i.e. `-- <file>` is present). */
137
+ function gitHasFileSelector(tokens) {
138
+ // Look for the `--` separator followed by at least one positional arg.
139
+ const dashDash = tokens.indexOf('--');
140
+ if (dashDash === -1)
141
+ return false;
142
+ const after = tokens.slice(dashDash + 1).filter((t) => t && !t.startsWith('-'));
143
+ return after.length >= 1;
144
+ }
145
+ /**
146
+ * P0-3 fix (2026-05-27): whitelist for `git log` / `git diff` flag forms that
147
+ * are part of normal workflows (CLAUDE.md commit checklist requires
148
+ * `git log --oneline -N` to mimic commit message style; PR review needs
149
+ * `git diff --stat` / `--name-only`). Returns true when the command is one
150
+ * of these structured forms and the rule should bypass.
151
+ *
152
+ * Patterns covered (only fires when `\\bgit\\s+(log|diff)` is also present):
153
+ * • git log --oneline / --pretty / --graph (history summary)
154
+ * • git log -n N / -N (numeric line cap)
155
+ * • git log --format / --since / --author / --grep (filtered queries)
156
+ * • git diff --stat / --name-only / --shortstat (summary forms)
157
+ */
158
+ function isGitLogDiffWorkflowForm(cmd) {
159
+ // git log --oneline / --pretty / --graph
160
+ if (/\bgit\s+log\s+(--oneline|--pretty|--graph)/.test(cmd))
161
+ return true;
162
+ // git log -n N / -N (e.g. `git log -30` / `git log -n 30`)
163
+ if (/\bgit\s+log\s+-(n\s+\d+|\d+)\b/.test(cmd))
164
+ return true;
165
+ // git log --format / --since / --author / --grep (filtered queries)
166
+ if (/\bgit\s+log\s+--(format|since|author|grep)/.test(cmd))
167
+ return true;
168
+ // git diff --stat / --name-only / --shortstat (review summary forms)
169
+ if (/\bgit\s+diff\s+(--stat|--name-only|--shortstat)/.test(cmd))
170
+ return true;
171
+ return false;
172
+ }
173
+ /**
174
+ * P0-2 fix (2026-05-27): "filter-then-mutate" pattern detection.
175
+ *
176
+ * When a command starts with a grep/rg/etc. AND chains through `&&` to a
177
+ * mutation verb (git add / cp / mv / rm / chmod / bash), the user intent is
178
+ * "filter some files then act on them" — not exploratory cross-file search.
179
+ * The bash-grep-multi-file rule should bypass these.
180
+ *
181
+ * VERIFY-B1 sample analysis (386 dry_run rows / 7d): most false-positives are
182
+ * already covered by `recent_agent_spawn` once F6 is fixed; this guard catches
183
+ * the residual cases where a main-thread filter+mutate pipeline survives.
184
+ *
185
+ * Conservative regex — only fires when ALL of: head is search tool, `&&`
186
+ * present, and the part after `&&` starts with one of the mutation verbs.
187
+ */
188
+ const MUTATION_VERBS = ['git add', 'cp ', 'mv ', 'rm ', 'chmod ', 'bash '];
189
+ function looksFilterContext(cmd) {
190
+ // Need at least one `&&` for the filter→mutate pattern.
191
+ if (!cmd.includes('&&'))
192
+ return false;
193
+ const parts = cmd.split('&&').map((p) => p.trim()).filter(Boolean);
194
+ // Iterate parts AFTER the first; if any begins with a mutation verb, treat
195
+ // the whole line as filter context.
196
+ for (let i = 1; i < parts.length; i++) {
197
+ const p = parts[i].toLowerCase();
198
+ if (MUTATION_VERBS.some((v) => p.startsWith(v)))
199
+ return true;
200
+ }
201
+ return false;
202
+ }
203
+ /** True if the prompt explicitly declares hook-protocol repair intent. */
204
+ function isHookRepairIntent(prompt) {
205
+ if (!prompt)
206
+ return false;
207
+ const lower = prompt.toLowerCase();
208
+ return /(hook.{0,8}(protocol|协议|契约))/i.test(prompt)
209
+ || /修复.*hook/.test(prompt)
210
+ || lower.includes('fix hook')
211
+ || lower.includes('repair hook');
212
+ }
213
+ // ── Rule definitions ───────────────────────────────────────────────────────
214
+ const BYPASS_SUFFIX = '\n\n如确认需要继续,请在命令末尾追加 `# forge:bypass=<原因>`(或 Edit/Write 内容里加 `// forge:bypass=<原因>` 注释)。';
215
+ const RULE_BASH_GREP_MULTI_FILE = {
216
+ id: 'bash-grep-multi-file',
217
+ kind: 'tool_intercept',
218
+ description: 'Bash 跨多文件 grep / git grep 应 spawn Explore agent',
219
+ claudemdRef: 'CLAUDE.md:112 强制 spawn 的场景 → 查/找/看/列出',
220
+ tool: 'Bash',
221
+ decision: 'deny',
222
+ match: (input, ctx) => {
223
+ const cmd = (input.command ?? '').trim();
224
+ if (!cmd)
225
+ return false;
226
+ // C4 hotfix (2026-05-26): head-command gate. Only fire when the FIRST
227
+ // shell command is a recognised search tool (grep/rg/ripgrep/ack/ag/
228
+ // `git grep`). Eliminates false positives where mutation commands
229
+ // (`cp`, `rm`, `mkdir`, `chmod`, `cat`, `ls`) have a trailing grep used
230
+ // for post-verification. See triage in
231
+ // docs/implementation/2026-05-26/HHMM-c4-obey-ratio-fix-changelog.md.
232
+ if (!isGrepHeadCommand(cmd))
233
+ return false;
234
+ // Recent agent spawn relaxes the rule (we're likely inside an Explore agent).
235
+ if (ctx.recent_agent_spawn)
236
+ return false;
237
+ // P0-2 fix (2026-05-27): filter-then-mutate guard — `grep ... && git add ...`
238
+ // is a workflow pattern (filter files, then act on the result), not a
239
+ // cross-file exploratory grep. Skip these.
240
+ if (looksFilterContext(cmd))
241
+ return false;
242
+ const tokens = splitCommand(cmd);
243
+ return looksMultiFile(tokens);
244
+ },
245
+ hint: (input) => {
246
+ const cmd = (input.command ?? '').slice(0, 120);
247
+ return [
248
+ `跨文件 grep / git grep 属于探索任务(CLAUDE.md:104 「查/找/看/列出 → Explore agent」)。`,
249
+ `命令:${cmd}`,
250
+ ``,
251
+ `请改用 Task tool spawn subagent_type='general-purpose' 并在 prompt 里写:`,
252
+ ` 「find <pattern> in <path>,列出 file:line 与匹配上下文」`,
253
+ ``,
254
+ `这样能让 sub-agent 处理大量文件 IO,主线程上下文保持干净。`,
255
+ ].join('\n') + BYPASS_SUFFIX;
256
+ },
257
+ };
258
+ const RULE_BASH_FIND_SOURCE = {
259
+ id: 'bash-find-source',
260
+ kind: 'tool_intercept',
261
+ description: 'Bash find 源码文件应 spawn Explore agent',
262
+ claudemdRef: 'CLAUDE.md:112 强制 spawn 的场景 → 查/找/看/列出',
263
+ tool: 'Bash',
264
+ decision: 'deny',
265
+ match: (input, ctx) => {
266
+ const cmd = (input.command ?? '').trim();
267
+ if (!cmd)
268
+ return false;
269
+ if (!/\bfind\b/.test(cmd))
270
+ return false;
271
+ if (ctx.recent_agent_spawn)
272
+ return false;
273
+ // P1-4 fix (2026-05-27): whitelist build artifacts / 3rd-party deps /
274
+ // test fixtures / scratch dirs — scanning these is operational (rg dist
275
+ // for stale builds, find node_modules for orphan vendor files, etc.),
276
+ // not source-code exploration.
277
+ if (/\b(dist|node_modules|tests?|tmp|build|\.next|coverage|test-results)\b/.test(cmd)) {
278
+ return false;
279
+ }
280
+ // Look for -name "*.ext" with a code/text extension.
281
+ // Cover common source extensions; intentionally NOT exhaustive.
282
+ return /-name\s+["']?\*\.(ts|tsx|js|jsx|mjs|cjs|py|rs|go|java|kt|swift|c|cc|cpp|h|hpp|rb|php|sh|md|json|yaml|yml|toml)['"]?/.test(cmd);
283
+ },
284
+ hint: (input) => {
285
+ const cmd = (input.command ?? '').slice(0, 120);
286
+ return [
287
+ `find ... -name "*.ext" 跨源码搜索属于探索任务(CLAUDE.md:104)。`,
288
+ `命令:${cmd}`,
289
+ ``,
290
+ `请改用 Task tool spawn subagent_type='general-purpose',在 prompt 里写:`,
291
+ ` 「locate files matching <pattern> in <path>」`,
292
+ ].join('\n') + BYPASS_SUFFIX;
293
+ },
294
+ };
295
+ const RULE_EDIT_MULTI_FILE_HARD = {
296
+ id: 'edit-multi-file-hard',
297
+ kind: 'tool_intercept',
298
+ description: '同 session ≥3 文件 Edit/Write 必须 spawn agent',
299
+ claudemdRef: 'CLAUDE.md:8 自检 #1 修改 ≥2 个文件应 spawn Agent;硬阈值 3',
300
+ tool: 'Edit',
301
+ decision: 'deny',
302
+ match: (input, ctx) => {
303
+ if (ctx.recent_agent_spawn)
304
+ return false;
305
+ const currentFile = (input.file_path ?? '').trim();
306
+ // P0-1 fix (2026-05-27): drop files edited BEFORE the most recent agent
307
+ // spawn — those are sub-agent edits, not main-thread accumulation. Only
308
+ // count files the main thread has touched POST-spawn (plus the current
309
+ // file). When `last_spawn_ts` is null OR the timestamped data is missing,
310
+ // fall back to the legacy behaviour (count the whole `edited_files` set).
311
+ let postSpawnFiles;
312
+ if (ctx.last_spawn_ts && ctx.edited_files_with_ts && ctx.edited_files_with_ts.length > 0) {
313
+ postSpawnFiles = new Set();
314
+ for (const { path, ts } of ctx.edited_files_with_ts) {
315
+ if (ts > ctx.last_spawn_ts)
316
+ postSpawnFiles.add(path);
317
+ }
318
+ }
319
+ else {
320
+ postSpawnFiles = new Set(ctx.edited_files);
321
+ }
322
+ // The handler computes edited_files BEFORE evaluating rules; the current
323
+ // event has not yet been logged. We count distinct files INCLUDING the
324
+ // current one to trigger at "this would become the 3rd distinct file".
325
+ if (currentFile)
326
+ postSpawnFiles.add(currentFile);
327
+ return postSpawnFiles.size >= 3;
328
+ },
329
+ hint: (input, ctx) => {
330
+ const cnt = ctx.edited_files.size + ((input.file_path && !ctx.edited_files.has(input.file_path)) ? 1 : 0);
331
+ return [
332
+ `本 session 已经触及 ${cnt} 个文件(硬阈值 3)。CLAUDE.md:13 「自检 #1」要求 spawn agent。`,
333
+ ``,
334
+ `请改用 Task tool spawn subagent_type='general-purpose' 或更专门的 coder / refactor-specialist,把后续改动委托给 sub-agent;主线程只协调与汇总。`,
335
+ ].join('\n') + BYPASS_SUFFIX;
336
+ },
337
+ };
338
+ // Edit 与 Write 共用阈值规则 — 用同一个 match/hint,仅 tool 字段不同。
339
+ const RULE_WRITE_MULTI_FILE_HARD = {
340
+ ...RULE_EDIT_MULTI_FILE_HARD,
341
+ id: 'write-multi-file-hard',
342
+ tool: 'Write',
343
+ };
344
+ const RULE_BASH_GIT_LOG_DIFF_NO_FILE = {
345
+ id: 'bash-git-log-diff-no-file',
346
+ kind: 'tool_intercept',
347
+ description: 'git log / git diff 未限定文件多半为探索查询',
348
+ claudemdRef: 'CLAUDE.md:112 强制 spawn 的场景 (D1 策略升级 warn → deny)',
349
+ tool: 'Bash',
350
+ decision: 'deny',
351
+ match: (input, ctx) => {
352
+ const cmd = (input.command ?? '').trim();
353
+ if (!cmd)
354
+ return false;
355
+ // Only match git log / git diff (not git status / git show etc.).
356
+ if (!/\bgit\s+(log|diff)\b/.test(cmd))
357
+ return false;
358
+ if (ctx.recent_agent_spawn)
359
+ return false;
360
+ // P0-3 fix (2026-05-27): bypass structured workflow forms that
361
+ // CLAUDE.md itself requires (commit-mimic `git log --oneline -N`,
362
+ // PR-review `git diff --stat`, etc.). See `isGitLogDiffWorkflowForm`.
363
+ if (isGitLogDiffWorkflowForm(cmd))
364
+ return false;
365
+ const tokens = splitCommand(cmd);
366
+ return !gitHasFileSelector(tokens);
367
+ },
368
+ hint: (input) => {
369
+ const cmd = (input.command ?? '').slice(0, 120);
370
+ return [
371
+ `git log / git diff 未带 \`-- <file>\` 限定,多半是探索性查询(CLAUDE.md:104)。`,
372
+ `命令:${cmd}`,
373
+ ``,
374
+ `请二选一:`,
375
+ ` 1) spawn Explore agent: Task tool subagent_type='general-purpose' with prompt`,
376
+ ` 「summarize recent commits / diffs in <path>」`,
377
+ ` 2) 只是 commit 前 self-review → 加 \`-- <file>\` 限定到具体文件`,
378
+ ].join('\n') + BYPASS_SUFFIX;
379
+ },
380
+ };
381
+ const RULE_EDIT_HOOK_SCRIPT = {
382
+ id: 'edit-hook-script-from-main',
383
+ kind: 'tool_intercept',
384
+ description: 'src/hooks/*.sh 是 daemon 通信契约,主线程禁止直接 Edit/Write',
385
+ claudemdRef: 'CLAUDE.md:170 项目模块覆盖现状 hooks/*.sh 0 测试 必走 Hybrid',
386
+ tool: 'Edit',
387
+ decision: 'deny',
388
+ match: (input, ctx) => {
389
+ const fp = (input.file_path ?? '').trim();
390
+ if (!fp)
391
+ return false;
392
+ if (ctx.recent_agent_spawn)
393
+ return false;
394
+ return /(^|\/)src\/hooks\/[^/]+\.sh$/.test(fp);
395
+ },
396
+ hint: (input, ctx) => {
397
+ const fp = input.file_path ?? '';
398
+ const intentNote = isHookRepairIntent(ctx.recent_prompt)
399
+ ? '(已识别到 prompt 含 hook 协议修复意图 — 仍建议 spawn agent 以确保有 safety-net)'
400
+ : '';
401
+ return [
402
+ `${fp} 是 daemon ↔ Claude Code 的通信契约,主线程直接改极易引入协议错误。`,
403
+ ``,
404
+ `请 spawn Task tool subagent_type='general-purpose'(或 hybrid-feature-with-safety),在 prompt 里写:`,
405
+ ` 「修改 ${fp},需求:<...>;先跑 daemon roundtrip 验证再改」`,
406
+ intentNote,
407
+ ].filter(Boolean).join('\n') + BYPASS_SUFFIX;
408
+ },
409
+ };
410
+ const RULE_WRITE_HOOK_SCRIPT = {
411
+ ...RULE_EDIT_HOOK_SCRIPT,
412
+ id: 'write-hook-script-from-main',
413
+ tool: 'Write',
414
+ };
415
+ // ── Warn-level rule ────────────────────────────────────────────────────────
416
+ const RULE_EDIT_MULTI_FILE_NO_AGENT = {
417
+ id: 'edit-multi-file-no-agent',
418
+ kind: 'tool_intercept',
419
+ description: '同 session ≥2 文件 Edit/Write 且无 Agent spawn → 建议 spawn',
420
+ claudemdRef: 'CLAUDE.md:8 自检 #1 软提醒(硬阈值 3 由 edit-multi-file-hard 处理)',
421
+ tool: 'Edit',
422
+ decision: 'warn',
423
+ match: (input, ctx) => {
424
+ if (ctx.recent_agent_spawn)
425
+ return false;
426
+ const projected = new Set(ctx.edited_files);
427
+ const fp = (input.file_path ?? '').trim();
428
+ if (fp)
429
+ projected.add(fp);
430
+ // 2-file: warn; ≥3: handed off to the hard rule (which has higher precedence
431
+ // because we list it BEFORE this one in `defaultRules`).
432
+ return projected.size === 2;
433
+ },
434
+ hint: (_input, ctx) => {
435
+ return [
436
+ `本 session 已修改 ${Math.max(2, ctx.edited_files.size + 1)} 个文件。`,
437
+ `CLAUDE.md:13 「自检 #1」建议 ≥2 文件改动 spawn Agent 委托;继续手改将在第 3 个文件被硬拦截。`,
438
+ ``,
439
+ `若继续手改是有意为之,可加 \`// forge:bypass=<原因>\` 注释。`,
440
+ ].join('\n');
441
+ },
442
+ };
443
+ const RULE_WRITE_MULTI_FILE_NO_AGENT = {
444
+ ...RULE_EDIT_MULTI_FILE_NO_AGENT,
445
+ id: 'write-multi-file-no-agent',
446
+ tool: 'Write',
447
+ };
448
+ // ── Phase 5 deny rule: Task spawn must match pending workflow recommendation ─
449
+ /**
450
+ * RULE_TASK_WORKFLOW_MISMATCH (Phase 5 / D4 strict)
451
+ *
452
+ * Fires when the main thread invokes the Task tool but `subagent_type`
453
+ * doesn't match the most recent PENDING `workflow_recommendations` row
454
+ * (populated by PreToolUseHandler.buildContext as `pending_workflow_rec`).
455
+ *
456
+ * Bypass paths (handled by handler, NOT this matcher):
457
+ * • Phase 5 flag OFF → handler skips populating pending_workflow_rec
458
+ * • `forge:bypass=` token in description / prompt → PreToolUse handler
459
+ * converts deny → bypass row and allows the tool
460
+ *
461
+ * The matcher itself only enforces the mismatch — it stays a pure function
462
+ * of input + ctx.
463
+ */
464
+ const PHASE5_WINDOW_MS = 5 * 60 * 1000;
465
+ const RULE_TASK_WORKFLOW_MISMATCH = {
466
+ id: 'workflow-recommendation-mismatch',
467
+ kind: 'tool_intercept',
468
+ description: 'Task spawn subagent_type 与 5min 内的 pending 工作流推荐不匹配',
469
+ claudemdRef: 'docs/design/2026-05-22/0200-master-roadmap-full-loop.md §3 + §7 D4 (strict)',
470
+ tool: 'Task',
471
+ decision: 'deny',
472
+ match: (input, ctx) => {
473
+ const pending = ctx.pending_workflow_rec;
474
+ if (!pending)
475
+ return false;
476
+ const ageMs = ctx.timestamp_ms - parseTimestampMsLocal(pending.timestamp);
477
+ if (ageMs > PHASE5_WINDOW_MS)
478
+ return false;
479
+ const spawned = typeof input.subagent_type === 'string' ? input.subagent_type : '';
480
+ if (!spawned)
481
+ return false;
482
+ return spawned !== pending.recommended_agent_type;
483
+ },
484
+ hint: (input, ctx) => {
485
+ const pending = ctx.pending_workflow_rec;
486
+ const spawned = typeof input.subagent_type === 'string' ? input.subagent_type : '<missing>';
487
+ if (!pending) {
488
+ return `工作流推荐已失效(无 pending 行),允许 spawn '${spawned}'。` + BYPASS_SUFFIX;
489
+ }
490
+ const ageMin = Math.max(1, Math.round((ctx.timestamp_ms - parseTimestampMsLocal(pending.timestamp)) / 60000));
491
+ return [
492
+ `你在 ${ageMin}min 前被推荐 spawn '${pending.recommended_agent_type}'(rule: ${pending.rule_id})。`,
493
+ `理由: ${pending.reason ?? '(无 reason 记录)'}`,
494
+ `当前 Task spawn 的是 '${spawned}',不匹配。`,
495
+ ``,
496
+ `请二选一:`,
497
+ ` 1) 重新调 Task tool subagent_type='${pending.recommended_agent_type}',按推荐的工作流执行`,
498
+ ` 2) 如确认要忽略此推荐,在 Task description / prompt 末尾追加 \`# forge:bypass=<原因>\` token`,
499
+ ].join('\n') + BYPASS_SUFFIX;
500
+ },
501
+ };
502
+ // ── v9.x Phase 2 (2026-05-26): user-question default BMAD gate ────────────
503
+ //
504
+ // Spec: docs/design/2026-05-26/1707-user-question-default-bmad-spec.md
505
+ //
506
+ // Fires when:
507
+ // • tool = Task
508
+ // • subagent_type ∈ implementation agents (coder / harness-* / hybrid /
509
+ // refactor-specialist) — NOT planner / Explore / doc-reviewer / verify
510
+ // • ctx.recent_prompt is question-style (see isQuestionPrompt)
511
+ // • prompt does NOT contain DIRECT_FIX_OVERRIDE escape hatch
512
+ // • feature flag `question_default_bmad.enforce` is true (default false
513
+ // during 7-day dry_run starting 2026-05-26 → reassess 2026-06-02)
514
+ // • we are not already inside a sub-agent spawn (recent_agent_spawn=false)
515
+ //
516
+ // Hint guides user to either re-spawn as `planner` or add `直接修` (natural
517
+ // language) or `forge:bypass=...` (token) to skip the gate. The deny row in
518
+ // `tool_intercepts` is tagged `rule_id='task-question-needs-bmad'` so the C4
519
+ // KPI can split obey ratio per-rule.
520
+ const IMPL_AGENT_TYPES = new Set([
521
+ 'coder',
522
+ 'harness-hotfix',
523
+ 'harness-debug-full',
524
+ 'hybrid-feature-with-safety',
525
+ 'refactor-specialist',
526
+ ]);
527
+ const RULE_TASK_QUESTION_NEEDS_BMAD = {
528
+ id: 'task-question-needs-bmad',
529
+ kind: 'tool_intercept',
530
+ description: '用户疑问句 spawn 实现 agent — 应先走 BMAD spec gate',
531
+ // External docs ref — Phase 9 lint skips non-CLAUDE.md refs, but the link
532
+ // is still discoverable in code search.
533
+ claudemdRef: 'docs/design/2026-05-26/1707-user-question-default-bmad-spec.md',
534
+ tool: 'Task',
535
+ decision: 'deny',
536
+ match: (input, ctx) => {
537
+ // Feature-flag gate — dry_run by default; only fires when explicitly
538
+ // opted in via `cf config set question_default_bmad.enforce true`.
539
+ if (!ctx.question_default_bmad_enforce)
540
+ return false;
541
+ // Sub-agent context relaxation — we're already inside a spawn flow.
542
+ if (ctx.recent_agent_spawn)
543
+ return false;
544
+ const sub = typeof input.subagent_type === 'string' ? input.subagent_type : '';
545
+ if (!IMPL_AGENT_TYPES.has(sub))
546
+ return false;
547
+ const prompt = ctx.recent_prompt ?? '';
548
+ if (!isQuestionPrompt(prompt))
549
+ return false;
550
+ // Escape hatch — natural-language override.
551
+ if (hasDirectFixOverride(prompt))
552
+ return false;
553
+ return true;
554
+ },
555
+ hint: (input, _ctx) => {
556
+ const sub = typeof input.subagent_type === 'string' ? input.subagent_type : '<missing>';
557
+ return [
558
+ `检测到最近一条 user prompt 是疑问句,但你 spawn 了 '${sub}'(实现/修复类 agent)。`,
559
+ `CLAUDE.md 自检 #0 + spec docs/design/2026-05-26/1707-user-question-default-bmad-spec.md`,
560
+ `要求:用户疑问句默认先走 BMAD — spawn 'planner' 出 spec → 等用户批准 → 才进入实现。`,
561
+ ``,
562
+ `请三选一:`,
563
+ ` 1) 重新 spawn Task subagent_type='planner',按 BMAD 走 spec → 用户审批 → 实现`,
564
+ ` 2) 在用户 prompt 里加 "直接修" / "just fix" / "skip spec" — 自然语言逃逸 (R7 边界锚定)`,
565
+ ` 3) 在 Task description / prompt 末尾追加 \`# forge:bypass=<原因>\` token`,
566
+ ].join('\n') + BYPASS_SUFFIX;
567
+ },
568
+ };
569
+ // ── v9.x 8-in-1 Phase C (2026-05-27): general-purpose misuse gate ────────
570
+ //
571
+ // Spec: docs/design/2026-05-27/1006-intercept-enforcement-fix-spec.md §C step 11
572
+ //
573
+ // Fires when:
574
+ // • tool = Task
575
+ // • subagent_type === 'general-purpose'
576
+ // • last user prompt scores ≥2 hits against one of the IMPL workflow buckets
577
+ // (harness-hotfix / harness-debug / refactor / hybrid)
578
+ // • prompt does NOT contain the escape hatch ("general-purpose" mention /
579
+ // "用 general" / forge:bypass=)
580
+ // • we are not already inside a sub-agent spawn (recent_agent_spawn=false)
581
+ //
582
+ // Lives behind a 24h `observation_until` window — see SPEC § R-5 (24h dry_run
583
+ // before hard deny). Lets us measure misuse rate without breaking legitimate
584
+ // general-purpose calls (Explore-style 文件 IO).
585
+ const IMPL_BUCKET_TYPES = new Set([
586
+ 'harness-hotfix',
587
+ 'harness-debug',
588
+ 'refactor',
589
+ 'hybrid',
590
+ ]);
591
+ const MISUSE_MIN_BUCKET_HITS = 2;
592
+ // Escape hatch — boundary-anchored mention of the literal "general-purpose"
593
+ // agent name, or natural-language "用 general" / "use general" phrasing.
594
+ const MISUSE_ESCAPE_PATTERN = /(\bgeneral[-_ ]purpose\b|用\s*general|use\s+general|forge:bypass=)/i;
595
+ // 24h observation window: today + 24h. Hard-coded ISO to keep the rule
596
+ // deterministic across daemon restarts; bumped by a future spec if needed.
597
+ const MISUSE_OBSERVATION_UNTIL = '2026-05-28T02:30:00Z';
598
+ /** Default agent recommendation per IMPL bucket — surfaced in the hint. */
599
+ const MISUSE_BUCKET_AGENT_HINT = Object.freeze({
600
+ 'harness-hotfix': 'harness-hotfix',
601
+ 'harness-debug': 'harness-debug-full',
602
+ 'refactor': 'refactor-specialist',
603
+ 'hybrid': 'hybrid-feature-with-safety',
604
+ });
605
+ const RULE_TASK_SPAWN_GENERAL_PURPOSE_MISUSE = {
606
+ id: 'task-spawn-general-purpose-misuse',
607
+ kind: 'tool_intercept',
608
+ description: 'Task spawn general-purpose 但任务匹配专门 agent — 应改用 specialist',
609
+ claudemdRef: 'docs/architecture/governance.md §6 可用 subagent_type 清单 + 自查触发条件',
610
+ tool: 'Task',
611
+ decision: 'deny',
612
+ observation_until: MISUSE_OBSERVATION_UNTIL,
613
+ match: (input, ctx) => {
614
+ const sub = typeof input.subagent_type === 'string' ? input.subagent_type : '';
615
+ if (sub !== 'general-purpose')
616
+ return false;
617
+ if (ctx.recent_agent_spawn)
618
+ return false;
619
+ const prompt = ctx.recent_prompt ?? '';
620
+ if (!prompt)
621
+ return false;
622
+ // Escape hatch — user explicitly asked for general-purpose or used the
623
+ // bypass token.
624
+ if (MISUSE_ESCAPE_PATTERN.test(prompt))
625
+ return false;
626
+ const scored = scoreKeywordBuckets(prompt);
627
+ if (!scored)
628
+ return false;
629
+ if (!IMPL_BUCKET_TYPES.has(scored.workflow_type))
630
+ return false;
631
+ if (scored.matched.length < MISUSE_MIN_BUCKET_HITS)
632
+ return false;
633
+ return true;
634
+ },
635
+ hint: (_input, ctx) => {
636
+ const prompt = ctx.recent_prompt ?? '';
637
+ const scored = scoreKeywordBuckets(prompt);
638
+ const bucket = scored?.workflow_type ?? '(未识别)';
639
+ const recommended = MISUSE_BUCKET_AGENT_HINT[bucket] ?? '(对应 specialist)';
640
+ const matchedList = scored?.matched.join(', ') ?? '(无)';
641
+ return [
642
+ `检测到你 spawn 了 'general-purpose',但 prompt 匹配 '${bucket}' 工作流`,
643
+ `(命中关键词:${matchedList})。`,
644
+ ``,
645
+ `CLAUDE.md L175-197「可用 subagent_type 清单」要求:`,
646
+ ` ${bucket} 类任务 → spawn '${recommended}'(自带 safety-net / spec-gate / verify-gate)。`,
647
+ ``,
648
+ `general-purpose 是兜底,专门 agent 的工作流约束在 general-purpose 下不生效。`,
649
+ ``,
650
+ `请二选一:`,
651
+ ` 1) 重新调 Task tool subagent_type='${recommended}'`,
652
+ ` 2) 如确认要用 general-purpose(如批量文件 IO),在 prompt 里加 "用 general" 或追加 \`# forge:bypass=<原因>\``,
653
+ ].join('\n') + BYPASS_SUFFIX;
654
+ },
655
+ };
656
+ // ── Registry export ────────────────────────────────────────────────────────
657
+ /**
658
+ * Order matters: PreToolUseHandler matches the FIRST rule that fires.
659
+ * Put `deny` rules before `warn` rules so a 3-file Edit is denied (not warned).
660
+ */
661
+ export const defaultRules = [
662
+ // Bash deny rules
663
+ RULE_BASH_GREP_MULTI_FILE,
664
+ RULE_BASH_FIND_SOURCE,
665
+ RULE_BASH_GIT_LOG_DIFF_NO_FILE,
666
+ // Edit/Write hook protection (deny)
667
+ RULE_EDIT_HOOK_SCRIPT,
668
+ RULE_WRITE_HOOK_SCRIPT,
669
+ // Edit/Write hard threshold (deny)
670
+ RULE_EDIT_MULTI_FILE_HARD,
671
+ RULE_WRITE_MULTI_FILE_HARD,
672
+ // 8-in-1 Phase C (2026-05-27): general-purpose misuse gate (deny, 24h
673
+ // observation window). MUST come BEFORE workflow-mismatch — that rule is
674
+ // the more specific recommendation-based gate; misuse is the keyword-bucket
675
+ // fallback when no pending recommendation exists for the same task.
676
+ RULE_TASK_SPAWN_GENERAL_PURPOSE_MISUSE,
677
+ // Phase 5: Task spawn must match pending workflow recommendation (deny)
678
+ RULE_TASK_WORKFLOW_MISMATCH,
679
+ // v9.x Phase 2 (2026-05-26): user-question default BMAD gate (deny). MUST
680
+ // come AFTER workflow-mismatch — that rule is the more specific signal
681
+ // (we already have a pending recommendation); the question-default rule
682
+ // is the fallback when no pending row exists.
683
+ RULE_TASK_QUESTION_NEEDS_BMAD,
684
+ // Edit/Write soft threshold (warn) — must come AFTER the hard variant.
685
+ RULE_EDIT_MULTI_FILE_NO_AGENT,
686
+ RULE_WRITE_MULTI_FILE_NO_AGENT,
687
+ ];
688
+ function parseTimestampMsLocal(ts) {
689
+ const ms = Date.parse(ts);
690
+ return Number.isFinite(ms) ? ms : Date.now();
691
+ }
692
+ //# sourceMappingURL=defaults.js.map