@xhulz/nina 0.36.0 → 0.38.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 (255) hide show
  1. package/package.json +1 -1
  2. package/releases/0.37.0/core/GAPS.md +125 -0
  3. package/releases/0.37.0/core/answered.json +29 -0
  4. package/releases/0.37.0/core/defaults/tree/.claude/agents/architect.md +1 -0
  5. package/releases/0.37.0/core/defaults/tree/.claude/agents/dba.md +3 -0
  6. package/releases/0.37.0/core/defaults/tree/.claude/agents/devops.md +1 -0
  7. package/releases/0.37.0/core/defaults/tree/.claude/agents/implementer.md +1 -0
  8. package/releases/0.37.0/core/defaults/tree/.claude/agents/integration-tester.md +3 -0
  9. package/releases/0.37.0/core/defaults/tree/.claude/agents/qa.md +2 -0
  10. package/releases/0.37.0/core/defaults/tree/.claude/agents/reviewer.md +3 -0
  11. package/releases/0.37.0/core/defaults/tree/.claude/agents/secops.md +3 -0
  12. package/releases/0.37.0/core/defaults/tree/.claude/agents/solidity-auditor.md +3 -0
  13. package/releases/0.37.0/core/defaults/tree/.claude/agents/solidity-dev.md +3 -0
  14. package/releases/0.37.0/core/tree/.claude/agents/architect.md +127 -0
  15. package/releases/0.37.0/core/tree/.claude/agents/dba.md +110 -0
  16. package/releases/0.37.0/core/tree/.claude/agents/devops.md +114 -0
  17. package/releases/0.37.0/core/tree/.claude/agents/implementer.md +156 -0
  18. package/releases/0.37.0/core/tree/.claude/agents/integration-tester.md +168 -0
  19. package/releases/0.37.0/core/tree/.claude/agents/planner.md +132 -0
  20. package/releases/0.37.0/core/tree/.claude/agents/qa.md +153 -0
  21. package/releases/0.37.0/core/tree/.claude/agents/reviewer.md +183 -0
  22. package/releases/0.37.0/core/tree/.claude/agents/secops.md +121 -0
  23. package/releases/0.37.0/core/tree/.claude/agents/solidity-auditor.md +126 -0
  24. package/releases/0.37.0/core/tree/.claude/agents/solidity-dev.md +123 -0
  25. package/releases/0.37.0/core/tree/.claude/agents-overview.md +64 -0
  26. package/releases/0.37.0/core/tree/.claude/frontend.md +10 -0
  27. package/releases/0.37.0/core/tree/.claude/graph.md +75 -0
  28. package/releases/0.37.0/core/tree/.claude/patterns.md +213 -0
  29. package/releases/0.37.0/core/tree/.claude/pills/README.md +146 -0
  30. package/releases/0.37.0/core/tree/.claude/pipeline.md +101 -0
  31. package/releases/0.37.0/core/tree/.claude/retrieval.md +103 -0
  32. package/releases/0.37.0/core/tree/.claude/router.md +198 -0
  33. package/releases/0.37.0/core/tree/.claude/templates/integration.md +45 -0
  34. package/releases/0.37.0/core/tree/CLAUDE.md +161 -0
  35. package/releases/0.37.0/core/tree/scripts/cost-watch.mjs +18 -0
  36. package/releases/0.37.0/core/tree/scripts/edit-guard.mjs +16 -0
  37. package/releases/0.37.0/core/tree/scripts/harness-check.mjs +71 -0
  38. package/releases/0.37.0/core/tree/scripts/loop-gate.mjs +19 -0
  39. package/releases/0.37.0/core/vocabulary.json +13 -0
  40. package/releases/0.37.0/surfaces/blockchain/tree/.claude/agents/architect.md +5 -0
  41. package/releases/0.37.0/surfaces/blockchain/tree/.claude/agents/devops.md +5 -0
  42. package/releases/0.37.0/surfaces/blockchain/tree/.claude/agents/reviewer.md +5 -0
  43. package/releases/0.37.0/surfaces/blockchain/tree/.claude/agents/solidity-auditor.md +18 -0
  44. package/releases/0.37.0/surfaces/blockchain/tree/.claude/agents/solidity-dev.md +16 -0
  45. package/releases/0.37.0/surfaces/blockchain/tree/.claude/agents-overview.md +6 -0
  46. package/releases/0.37.0/surfaces/blockchain/tree/.claude/graph.md +11 -0
  47. package/releases/0.37.0/surfaces/blockchain/tree/.claude/router.md +6 -0
  48. package/releases/0.37.0/surfaces/blockchain/tree/CLAUDE.md +12 -0
  49. package/releases/0.37.0/surfaces/db/tree/.claude/agents/architect.md +5 -0
  50. package/releases/0.37.0/surfaces/db/tree/.claude/agents/dba.md +50 -0
  51. package/releases/0.37.0/surfaces/db/tree/.claude/agents/devops.md +5 -0
  52. package/releases/0.37.0/surfaces/db/tree/.claude/agents/implementer.md +2 -0
  53. package/releases/0.37.0/surfaces/db/tree/.claude/agents/integration-tester.md +10 -0
  54. package/releases/0.37.0/surfaces/db/tree/.claude/agents/planner.md +2 -0
  55. package/releases/0.37.0/surfaces/db/tree/.claude/agents/reviewer.md +22 -0
  56. package/releases/0.37.0/surfaces/db/tree/.claude/agents/secops.md +2 -0
  57. package/releases/0.37.0/surfaces/db/tree/.claude/agents-overview.md +5 -0
  58. package/releases/0.37.0/surfaces/db/tree/.claude/graph.md +8 -0
  59. package/releases/0.37.0/surfaces/db/tree/.claude/patterns.md +19 -0
  60. package/releases/0.37.0/surfaces/db/tree/.claude/pipeline.md +13 -0
  61. package/releases/0.37.0/surfaces/db/tree/.claude/retrieval.md +5 -0
  62. package/releases/0.37.0/surfaces/db/tree/.claude/router.md +4 -0
  63. package/releases/0.37.0/surfaces/db/tree/CLAUDE.md +17 -0
  64. package/releases/0.37.0/surfaces/edge-cf/tree/.claude/agents/architect.md +14 -0
  65. package/releases/0.37.0/surfaces/edge-cf/tree/.claude/agents/dba.md +2 -0
  66. package/releases/0.37.0/surfaces/edge-cf/tree/.claude/agents/devops.md +32 -0
  67. package/releases/0.37.0/surfaces/edge-cf/tree/.claude/agents/implementer.md +14 -0
  68. package/releases/0.37.0/surfaces/edge-cf/tree/.claude/agents/integration-tester.md +11 -0
  69. package/releases/0.37.0/surfaces/edge-cf/tree/.claude/agents/qa.md +3 -0
  70. package/releases/0.37.0/surfaces/edge-cf/tree/.claude/agents/reviewer.md +8 -0
  71. package/releases/0.37.0/surfaces/edge-cf/tree/.claude/agents/secops.md +8 -0
  72. package/releases/0.37.0/surfaces/edge-cf/tree/.claude/patterns.md +17 -0
  73. package/releases/0.37.0/surfaces/edge-cf/tree/.claude/retrieval.md +8 -0
  74. package/releases/0.37.0/surfaces/edge-cf/tree/CLAUDE.md +27 -0
  75. package/releases/0.37.0/surfaces/frontend/tree/.claude/agents/architect.md +20 -0
  76. package/releases/0.37.0/surfaces/frontend/tree/.claude/agents/devops.md +28 -0
  77. package/releases/0.37.0/surfaces/frontend/tree/.claude/agents/implementer.md +25 -0
  78. package/releases/0.37.0/surfaces/frontend/tree/.claude/agents/qa.md +17 -0
  79. package/releases/0.37.0/surfaces/frontend/tree/.claude/agents/reviewer.md +56 -0
  80. package/releases/0.37.0/surfaces/frontend/tree/.claude/patterns.md +8 -0
  81. package/releases/0.37.0/surfaces/frontend/tree/.claude/retrieval.md +2 -0
  82. package/releases/0.37.0/surfaces/frontend/tree/.claude/router.md +14 -0
  83. package/releases/0.37.0/surfaces/frontend/tree/CLAUDE.md +5 -0
  84. package/releases/0.37.0/surfaces/integrations/tree/.claude/agents/architect.md +16 -0
  85. package/releases/0.37.0/surfaces/integrations/tree/.claude/agents/implementer.md +12 -0
  86. package/releases/0.37.0/surfaces/integrations/tree/.claude/agents/integration-tester.md +20 -0
  87. package/releases/0.37.0/surfaces/integrations/tree/.claude/agents/planner.md +2 -0
  88. package/releases/0.37.0/surfaces/integrations/tree/.claude/agents/reviewer.md +21 -0
  89. package/releases/0.37.0/surfaces/integrations/tree/.claude/agents/secops.md +2 -0
  90. package/releases/0.37.0/surfaces/integrations/tree/.claude/agents-overview.md +8 -0
  91. package/releases/0.37.0/surfaces/integrations/tree/.claude/graph.md +10 -0
  92. package/releases/0.37.0/surfaces/integrations/tree/.claude/patterns.md +38 -0
  93. package/releases/0.37.0/surfaces/integrations/tree/.claude/pipeline.md +16 -0
  94. package/releases/0.37.0/surfaces/integrations/tree/.claude/retrieval.md +16 -0
  95. package/releases/0.37.0/surfaces/integrations/tree/.claude/router.md +6 -0
  96. package/releases/0.37.0/surfaces/integrations/tree/CLAUDE.md +17 -0
  97. package/releases/0.37.0/surfaces/money/tree/.claude/agents/architect.md +12 -0
  98. package/releases/0.37.0/surfaces/money/tree/.claude/agents/dba.md +14 -0
  99. package/releases/0.37.0/surfaces/money/tree/.claude/agents/implementer.md +11 -0
  100. package/releases/0.37.0/surfaces/money/tree/.claude/agents/integration-tester.md +3 -0
  101. package/releases/0.37.0/surfaces/money/tree/.claude/agents/reviewer.md +23 -0
  102. package/releases/0.37.0/surfaces/money/tree/.claude/agents/secops.md +5 -0
  103. package/releases/0.37.0/surfaces/money/tree/.claude/agents/solidity-auditor.md +4 -0
  104. package/releases/0.37.0/surfaces/money/tree/.claude/agents/solidity-dev.md +4 -0
  105. package/releases/0.37.0/surfaces/money/tree/.claude/graph.md +2 -0
  106. package/releases/0.37.0/surfaces/money/tree/.claude/patterns.md +49 -0
  107. package/releases/0.37.0/surfaces/money/tree/.claude/pipeline.md +2 -0
  108. package/releases/0.37.0/surfaces/money/tree/.claude/retrieval.md +2 -0
  109. package/releases/0.37.0/surfaces/money/tree/CLAUDE.md +11 -0
  110. package/releases/0.37.0/surfaces/pii/tree/.claude/agents/dba.md +2 -0
  111. package/releases/0.37.0/surfaces/pii/tree/.claude/agents/devops.md +8 -0
  112. package/releases/0.37.0/surfaces/pii/tree/.claude/agents/reviewer.md +8 -0
  113. package/releases/0.37.0/surfaces/pii/tree/.claude/agents/secops.md +2 -0
  114. package/releases/0.37.0/surfaces/pii/tree/.claude/agents/solidity-auditor.md +5 -0
  115. package/releases/0.37.0/surfaces/pii/tree/CLAUDE.md +5 -0
  116. package/releases/0.37.0/surfaces/prisma/tree/.claude/agents/architect.md +2 -0
  117. package/releases/0.37.0/surfaces/prisma/tree/.claude/agents/dba.md +39 -0
  118. package/releases/0.37.0/surfaces/prisma/tree/.claude/agents/devops.md +11 -0
  119. package/releases/0.37.0/surfaces/prisma/tree/.claude/agents/implementer.md +2 -0
  120. package/releases/0.37.0/surfaces/prisma/tree/.claude/agents/integration-tester.md +2 -0
  121. package/releases/0.37.0/surfaces/prisma/tree/.claude/agents/reviewer.md +2 -0
  122. package/releases/0.37.0/surfaces/prisma/tree/.claude/patterns.md +15 -0
  123. package/releases/0.37.0/surfaces/prisma/tree/CLAUDE.md +5 -0
  124. package/releases/0.38.0/core/GAPS.md +125 -0
  125. package/releases/0.38.0/core/answered.json +32 -0
  126. package/releases/0.38.0/core/defaults/tree/.claude/agents/architect.md +1 -0
  127. package/releases/0.38.0/core/defaults/tree/.claude/agents/dba.md +3 -0
  128. package/releases/0.38.0/core/defaults/tree/.claude/agents/devops.md +1 -0
  129. package/releases/0.38.0/core/defaults/tree/.claude/agents/implementer.md +1 -0
  130. package/releases/0.38.0/core/defaults/tree/.claude/agents/integration-tester.md +3 -0
  131. package/releases/0.38.0/core/defaults/tree/.claude/agents/qa.md +2 -0
  132. package/releases/0.38.0/core/defaults/tree/.claude/agents/reviewer.md +3 -0
  133. package/releases/0.38.0/core/defaults/tree/.claude/agents/secops.md +3 -0
  134. package/releases/0.38.0/core/defaults/tree/.claude/agents/solidity-auditor.md +3 -0
  135. package/releases/0.38.0/core/defaults/tree/.claude/agents/solidity-dev.md +3 -0
  136. package/releases/0.38.0/core/tree/.claude/agents/architect.md +127 -0
  137. package/releases/0.38.0/core/tree/.claude/agents/dba.md +110 -0
  138. package/releases/0.38.0/core/tree/.claude/agents/devops.md +114 -0
  139. package/releases/0.38.0/core/tree/.claude/agents/implementer.md +156 -0
  140. package/releases/0.38.0/core/tree/.claude/agents/integration-tester.md +168 -0
  141. package/releases/0.38.0/core/tree/.claude/agents/planner.md +132 -0
  142. package/releases/0.38.0/core/tree/.claude/agents/qa.md +152 -0
  143. package/releases/0.38.0/core/tree/.claude/agents/reviewer.md +183 -0
  144. package/releases/0.38.0/core/tree/.claude/agents/secops.md +121 -0
  145. package/releases/0.38.0/core/tree/.claude/agents/solidity-auditor.md +126 -0
  146. package/releases/0.38.0/core/tree/.claude/agents/solidity-dev.md +123 -0
  147. package/releases/0.38.0/core/tree/.claude/agents-overview.md +64 -0
  148. package/releases/0.38.0/core/tree/.claude/frontend.md +10 -0
  149. package/releases/0.38.0/core/tree/.claude/graph.md +75 -0
  150. package/releases/0.38.0/core/tree/.claude/patterns.md +213 -0
  151. package/releases/0.38.0/core/tree/.claude/pills/README.md +147 -0
  152. package/releases/0.38.0/core/tree/.claude/pipeline.md +101 -0
  153. package/releases/0.38.0/core/tree/.claude/retrieval.md +103 -0
  154. package/releases/0.38.0/core/tree/.claude/router.md +198 -0
  155. package/releases/0.38.0/core/tree/.claude/templates/integration.md +45 -0
  156. package/releases/0.38.0/core/tree/CLAUDE.md +161 -0
  157. package/releases/0.38.0/core/tree/scripts/cost-watch.mjs +18 -0
  158. package/releases/0.38.0/core/tree/scripts/edit-guard.mjs +16 -0
  159. package/releases/0.38.0/core/tree/scripts/harness-check.mjs +71 -0
  160. package/releases/0.38.0/core/tree/scripts/loop-gate.mjs +19 -0
  161. package/releases/0.38.0/core/vocabulary.json +13 -0
  162. package/releases/0.38.0/surfaces/blockchain/tree/.claude/agents/architect.md +5 -0
  163. package/releases/0.38.0/surfaces/blockchain/tree/.claude/agents/devops.md +5 -0
  164. package/releases/0.38.0/surfaces/blockchain/tree/.claude/agents/reviewer.md +5 -0
  165. package/releases/0.38.0/surfaces/blockchain/tree/.claude/agents/solidity-auditor.md +18 -0
  166. package/releases/0.38.0/surfaces/blockchain/tree/.claude/agents/solidity-dev.md +16 -0
  167. package/releases/0.38.0/surfaces/blockchain/tree/.claude/agents-overview.md +6 -0
  168. package/releases/0.38.0/surfaces/blockchain/tree/.claude/graph.md +11 -0
  169. package/releases/0.38.0/surfaces/blockchain/tree/.claude/router.md +6 -0
  170. package/releases/0.38.0/surfaces/blockchain/tree/CLAUDE.md +12 -0
  171. package/releases/0.38.0/surfaces/db/tree/.claude/agents/architect.md +5 -0
  172. package/releases/0.38.0/surfaces/db/tree/.claude/agents/dba.md +50 -0
  173. package/releases/0.38.0/surfaces/db/tree/.claude/agents/devops.md +5 -0
  174. package/releases/0.38.0/surfaces/db/tree/.claude/agents/implementer.md +2 -0
  175. package/releases/0.38.0/surfaces/db/tree/.claude/agents/integration-tester.md +10 -0
  176. package/releases/0.38.0/surfaces/db/tree/.claude/agents/planner.md +2 -0
  177. package/releases/0.38.0/surfaces/db/tree/.claude/agents/reviewer.md +22 -0
  178. package/releases/0.38.0/surfaces/db/tree/.claude/agents/secops.md +2 -0
  179. package/releases/0.38.0/surfaces/db/tree/.claude/agents-overview.md +5 -0
  180. package/releases/0.38.0/surfaces/db/tree/.claude/graph.md +8 -0
  181. package/releases/0.38.0/surfaces/db/tree/.claude/patterns.md +19 -0
  182. package/releases/0.38.0/surfaces/db/tree/.claude/pipeline.md +13 -0
  183. package/releases/0.38.0/surfaces/db/tree/.claude/retrieval.md +5 -0
  184. package/releases/0.38.0/surfaces/db/tree/.claude/router.md +4 -0
  185. package/releases/0.38.0/surfaces/db/tree/CLAUDE.md +17 -0
  186. package/releases/0.38.0/surfaces/edge-cf/tree/.claude/agents/architect.md +14 -0
  187. package/releases/0.38.0/surfaces/edge-cf/tree/.claude/agents/dba.md +2 -0
  188. package/releases/0.38.0/surfaces/edge-cf/tree/.claude/agents/devops.md +32 -0
  189. package/releases/0.38.0/surfaces/edge-cf/tree/.claude/agents/implementer.md +14 -0
  190. package/releases/0.38.0/surfaces/edge-cf/tree/.claude/agents/integration-tester.md +11 -0
  191. package/releases/0.38.0/surfaces/edge-cf/tree/.claude/agents/qa.md +3 -0
  192. package/releases/0.38.0/surfaces/edge-cf/tree/.claude/agents/reviewer.md +8 -0
  193. package/releases/0.38.0/surfaces/edge-cf/tree/.claude/agents/secops.md +8 -0
  194. package/releases/0.38.0/surfaces/edge-cf/tree/.claude/patterns.md +17 -0
  195. package/releases/0.38.0/surfaces/edge-cf/tree/.claude/retrieval.md +8 -0
  196. package/releases/0.38.0/surfaces/edge-cf/tree/CLAUDE.md +27 -0
  197. package/releases/0.38.0/surfaces/frontend/tree/.claude/agents/architect.md +20 -0
  198. package/releases/0.38.0/surfaces/frontend/tree/.claude/agents/devops.md +28 -0
  199. package/releases/0.38.0/surfaces/frontend/tree/.claude/agents/implementer.md +25 -0
  200. package/releases/0.38.0/surfaces/frontend/tree/.claude/agents/qa.md +17 -0
  201. package/releases/0.38.0/surfaces/frontend/tree/.claude/agents/reviewer.md +56 -0
  202. package/releases/0.38.0/surfaces/frontend/tree/.claude/patterns.md +8 -0
  203. package/releases/0.38.0/surfaces/frontend/tree/.claude/retrieval.md +2 -0
  204. package/releases/0.38.0/surfaces/frontend/tree/.claude/router.md +14 -0
  205. package/releases/0.38.0/surfaces/frontend/tree/CLAUDE.md +5 -0
  206. package/releases/0.38.0/surfaces/integrations/tree/.claude/agents/architect.md +16 -0
  207. package/releases/0.38.0/surfaces/integrations/tree/.claude/agents/implementer.md +12 -0
  208. package/releases/0.38.0/surfaces/integrations/tree/.claude/agents/integration-tester.md +20 -0
  209. package/releases/0.38.0/surfaces/integrations/tree/.claude/agents/planner.md +2 -0
  210. package/releases/0.38.0/surfaces/integrations/tree/.claude/agents/reviewer.md +21 -0
  211. package/releases/0.38.0/surfaces/integrations/tree/.claude/agents/secops.md +2 -0
  212. package/releases/0.38.0/surfaces/integrations/tree/.claude/agents-overview.md +8 -0
  213. package/releases/0.38.0/surfaces/integrations/tree/.claude/graph.md +10 -0
  214. package/releases/0.38.0/surfaces/integrations/tree/.claude/patterns.md +38 -0
  215. package/releases/0.38.0/surfaces/integrations/tree/.claude/pipeline.md +16 -0
  216. package/releases/0.38.0/surfaces/integrations/tree/.claude/retrieval.md +16 -0
  217. package/releases/0.38.0/surfaces/integrations/tree/.claude/router.md +6 -0
  218. package/releases/0.38.0/surfaces/integrations/tree/CLAUDE.md +17 -0
  219. package/releases/0.38.0/surfaces/money/tree/.claude/agents/architect.md +12 -0
  220. package/releases/0.38.0/surfaces/money/tree/.claude/agents/dba.md +14 -0
  221. package/releases/0.38.0/surfaces/money/tree/.claude/agents/implementer.md +11 -0
  222. package/releases/0.38.0/surfaces/money/tree/.claude/agents/integration-tester.md +3 -0
  223. package/releases/0.38.0/surfaces/money/tree/.claude/agents/reviewer.md +23 -0
  224. package/releases/0.38.0/surfaces/money/tree/.claude/agents/secops.md +5 -0
  225. package/releases/0.38.0/surfaces/money/tree/.claude/agents/solidity-auditor.md +4 -0
  226. package/releases/0.38.0/surfaces/money/tree/.claude/agents/solidity-dev.md +4 -0
  227. package/releases/0.38.0/surfaces/money/tree/.claude/graph.md +2 -0
  228. package/releases/0.38.0/surfaces/money/tree/.claude/patterns.md +49 -0
  229. package/releases/0.38.0/surfaces/money/tree/.claude/pipeline.md +2 -0
  230. package/releases/0.38.0/surfaces/money/tree/.claude/retrieval.md +2 -0
  231. package/releases/0.38.0/surfaces/money/tree/CLAUDE.md +11 -0
  232. package/releases/0.38.0/surfaces/pii/tree/.claude/agents/dba.md +2 -0
  233. package/releases/0.38.0/surfaces/pii/tree/.claude/agents/devops.md +8 -0
  234. package/releases/0.38.0/surfaces/pii/tree/.claude/agents/reviewer.md +8 -0
  235. package/releases/0.38.0/surfaces/pii/tree/.claude/agents/secops.md +2 -0
  236. package/releases/0.38.0/surfaces/pii/tree/.claude/agents/solidity-auditor.md +5 -0
  237. package/releases/0.38.0/surfaces/pii/tree/CLAUDE.md +5 -0
  238. package/releases/0.38.0/surfaces/prisma/tree/.claude/agents/architect.md +2 -0
  239. package/releases/0.38.0/surfaces/prisma/tree/.claude/agents/dba.md +39 -0
  240. package/releases/0.38.0/surfaces/prisma/tree/.claude/agents/devops.md +11 -0
  241. package/releases/0.38.0/surfaces/prisma/tree/.claude/agents/implementer.md +2 -0
  242. package/releases/0.38.0/surfaces/prisma/tree/.claude/agents/integration-tester.md +2 -0
  243. package/releases/0.38.0/surfaces/prisma/tree/.claude/agents/reviewer.md +2 -0
  244. package/releases/0.38.0/surfaces/prisma/tree/.claude/patterns.md +15 -0
  245. package/releases/0.38.0/surfaces/prisma/tree/CLAUDE.md +5 -0
  246. package/src/commands/gate.mjs +21 -5
  247. package/src/commands/learn.mjs +226 -71
  248. package/src/commands/pills.mjs +32 -9
  249. package/src/commands/stats.mjs +4 -4
  250. package/src/deep.mjs +26 -4
  251. package/src/gate.mjs +58 -36
  252. package/src/graph.mjs +36 -0
  253. package/src/lessons.mjs +55 -0
  254. package/src/transcripts.mjs +1 -1
  255. package/src/wiring.mjs +3 -2
package/src/gate.mjs CHANGED
@@ -9,15 +9,15 @@
9
9
  * the verdict a dispatch answers may not be on disk when the dispatch is about to go out, and the file
10
10
  * is mostly replay: a session resumed over a bridge rewrites its history, three quarters of the bytes
11
11
  * in the one measured. The gate keeps its own ledger instead — one small file per session, metadata
12
- * only, with the ids a report gave its issues as the one thing a model wrote — written by the hooks
12
+ * only, with the ids a report gave its issues and the name an agent was launched with as the only things a
13
+ * model wrote — written by the hooks
13
14
  * that see each fact as it happens:
14
15
  *
15
16
  * PostToolUse on SubagentHandback the report a stage handed back, verbatim — its verdict
16
17
  * SubagentStop the same, for a stage that wrote its report as its last message
17
18
  * PreToolUse / PostToolUse on Agent, Task, SendMessage
18
19
  * a dispatch launched, and the agent it launched
19
- * UserPromptSubmit (human text only), an AskUserQuestion answer
20
- * the owner spoke, and every count starts over
20
+ * UserPromptSubmit (human text only) the owner spoke, and every open loop gets one round more
21
21
  * PreToolUse on Agent, Task, SendMessage
22
22
  * the decision: let it through, or send the round past the cap to
23
23
  * the owner to confirm
@@ -41,7 +41,13 @@
41
41
  * belongs to that round; a pass cancels a rejection only if a fix went out between the two — a later
42
42
  * review that saw the fix — and closes the loop only if it began after the latest fix with no rejection
43
43
  * running beside it; a pass from the stage the source hands its work on to (qa, after the reviewer)
44
- * closes the source's loops; and the owner speaking empties everything. Guessed verdicts never count.
44
+ * closes the source's loops; and the owner speaking gives every loop still open one round more than its cap —
45
+ * it used to empty everything, and since the owner speaks every few minutes no loop ever reached a cap: over
46
+ * two days of one project, sixty resets and not one question. Guessed verdicts never count.
47
+ *
48
+ * A loop is its source's verdict, whichever stage the orchestrator sends the fix to: a rejection routed to
49
+ * the architect one round and to the implementer the next was counted once on each edge, and went round
50
+ * twice its cap before anything asked. Each edge's own cap still decides the round that goes to it.
45
51
  *
46
52
  * It fails open, and it only acts where the project pins a version that ships it. Any error lets the
47
53
  * call through and is logged where `nina gate --selftest`, a detector every project runs, reports it: a
@@ -53,7 +59,8 @@ import { dirname, join } from 'node:path';
53
59
  import { fileURLToPath } from 'node:url';
54
60
  import { TERMINALS, declaredTokens, parseGraph } from './graph.mjs';
55
61
  import { gateDir, slugFor } from './paths.mjs';
56
- import { declaredIssues, isLoopBack } from './transcripts.mjs';
62
+ import { declaredIssues, isLoopBack, saidToAgent } from './transcripts.mjs';
63
+ import { lessonIndex } from './lessons.mjs';
57
64
 
58
65
  /** The package this runs from: its releases say whether a pinned version ships the gate at all. */
59
66
  const PACKAGE = dirname(dirname(fileURLToPath(import.meta.url)));
@@ -266,7 +273,9 @@ function append(path, entry) {
266
273
  * too, the round's number is its most-repeated issue's instead — one more than the rounds that issue
267
274
  * was in since then — and the edge's own number is kept beside it, against a ceiling of twice the cap.
268
275
  * A late sibling's issues are counted in the round it belongs to;
269
- * - a pass from the stage the source hands passing work on to closes the source's loops outright.
276
+ * - a pass from the stage the source hands passing work on to closes the source's loops outright;
277
+ * - the owner speaking gives each loop still open one round more — its `grace` — and closes nothing. A
278
+ * model's own question to the owner (`AskUserQuestion`) is not the owner speaking.
270
279
  *
271
280
  * @param {object[]} entries - The ledger, oldest first.
272
281
  * @param {ReturnType<typeof loopEdges>} loops - The capped loop-back edges.
@@ -307,6 +316,8 @@ export function replay(entries, loops, forward = new Map()) {
307
316
  * @type {Map<string, {n: number, agents?: string[], at?: number, blind?: boolean, edge?: number}>}
308
317
  */
309
318
  const streak = new Map();
319
+ /** `${source}|${token}` → the rounds the owner has given the loop past its cap, by speaking while it was open. */
320
+ const grace = new Map();
310
321
  /** Where each source's latest round went out: a pass must begin after it to say the fix passed. */
311
322
  const lastFix = new Map();
312
323
  /** Completions a dispatch already acted on: a late copy of one is not new. */
@@ -315,7 +326,7 @@ export function replay(entries, loops, forward = new Map()) {
315
326
  const reportedAt = new Map();
316
327
  const made = [];
317
328
  const close = (source) => {
318
- for (const key of [...streak.keys()]) if (key.startsWith(`${source}|`)) streak.delete(key);
329
+ for (const map of [streak, grace]) for (const key of [...map.keys()]) if (key.startsWith(`${source}|`)) map.delete(key);
319
330
  };
320
331
 
321
332
  const effect = (to, at) => {
@@ -329,7 +340,7 @@ export function replay(entries, loops, forward = new Map()) {
329
340
  const closes = passes.some((p) => p.launch > (lastFix.get(source) ?? -1) && !live.some((v) => v.launch < p.at));
330
341
  const routed = live.filter((v) => byToken.get(v.verdict)?.has(to));
331
342
  const fresh = routed.filter((v) => {
332
- const last = streak.get(`${source}|${to}|${v.verdict}`);
343
+ const last = streak.get(`${source}|${v.verdict}`);
333
344
  return closes || !last || v.launch > last.at;
334
345
  });
335
346
  // A late sibling belongs to the round it was running in, so its issues do too: each is counted in
@@ -338,7 +349,7 @@ export function replay(entries, loops, forward = new Map()) {
338
349
  const adopted = new Map();
339
350
  const blinded = new Set();
340
351
  for (const v of routed.filter((r) => !fresh.includes(r))) {
341
- const key = `${source}|${to}|${v.verdict}`;
352
+ const key = `${source}|${v.verdict}`;
342
353
  const edge = streak.get(key);
343
354
  if (!edge) continue;
344
355
  if (!(v.issues?.length > 0)) blinded.add(key);
@@ -349,21 +360,22 @@ export function replay(entries, loops, forward = new Map()) {
349
360
  }
350
361
  if (fresh.length > 0) {
351
362
  const token = fresh.at(-1).verdict;
352
- const key = `${source}|${to}|${token}`;
353
- const max = byToken.get(token).get(to);
363
+ const key = `${source}|${token}`;
364
+ const given = grace.get(key) ?? 0;
365
+ const max = byToken.get(token).get(to) + given;
354
366
  const before = closes ? { n: 0, agents: [] } : (streak.get(key) ?? { n: 0, agents: [] });
355
367
  const agents = [...new Set([...(before.agents ?? []), ...fresh.map((v) => v.agent)])];
356
368
  // Counted by issue only while every round since the loop last closed named its issues: a round
357
369
  // that named nothing advanced no issue's count, so from then on only the edge's count is whole.
358
370
  const named = !before.blind && !blinded.has(key) && fresh.every((v) => v.issues?.length > 0);
359
- const round = { key, source, target: to, token, round: before.n + 1, max, edgeRound: before.n + 1, ceiling: max, blind: !named, agents, at };
371
+ const round = { key, source, target: to, token, round: before.n + 1, max, edgeRound: before.n + 1, ceiling: max, blind: !named, agents, at, given };
360
372
  if (named) {
361
373
  const issues = [...new Set(fresh.flatMap((v) => v.issues))].map((id) => ({
362
374
  id,
363
375
  round: (closes ? 0 : ((adopted.get(`${key}|${id}`) ?? streak.get(`${key}|${id}`))?.n ?? 0)) + 1,
364
376
  }));
365
377
  const worst = issues.reduce((a, b) => (b.round > a.round ? b : a));
366
- Object.assign(round, { round: worst.round, issue: worst.id, issues, ceiling: max * EDGE_CEILING });
378
+ Object.assign(round, { round: worst.round, issue: worst.id, issues, ceiling: (max - given) * EDGE_CEILING + given });
367
379
  }
368
380
  rounds.push(round);
369
381
  }
@@ -374,9 +386,9 @@ export function replay(entries, loops, forward = new Map()) {
374
386
 
375
387
  entries.forEach((e, i) => {
376
388
  if (e.k === 'reset') {
377
- pending.clear();
378
- streak.clear();
379
- lastFix.clear();
389
+ // Ledgers written before the model's own questions stopped counting as the owner speaking hold those too.
390
+ if (e.why === 'ask') return;
391
+ for (const key of streak.keys()) if (key.split('|').length === 2) grace.set(key, (grace.get(key) ?? 0) + 1);
380
392
  return;
381
393
  }
382
394
  if (e.k === 'verdict' && e.declared && e.agent) {
@@ -463,25 +475,25 @@ function withoutRef(to) {
463
475
  }
464
476
 
465
477
  /**
466
- * Who a SendMessage goes to: an agent id the ledger has seen, or — since the tool tells the model to
467
- * prefer names — a name, which in this pipeline is the stage's own, with or without the ` [ref]` a
468
- * listing appends.
478
+ * Who a SendMessage goes to: an agent id the ledger has seen, or a name, with or without the ` [ref]` a
479
+ * listing appends. A name is the one an agent was launched with, or — launched with none — its stage's; and,
480
+ * as Claude Code resolves it, the latest agent to go by it is the one reached. A fixer launched as `fixer` and
481
+ * resumed by that name was seen only after it went out, so no resume of it was ever asked about.
469
482
  *
470
483
  * @returns {{agent: string|null, role: string|null}}
471
484
  */
472
485
  function recipient(entries, project, to) {
473
- const agent = withoutRef(to) || null;
474
- const role = roleOf(entries, agent) ?? (agent && project.graph.stages.has(agent) ? agent : null);
486
+ const said = withoutRef(to) || null;
487
+ const goesBy = (e) => e.name ?? (e.via === 'SendMessage' ? null : e.role);
488
+ const named = said ? entries.findLast((e) => e.k === 'dispatch' && e.agent && goesBy(e) === said) : null;
489
+ const agent = named?.agent ?? said;
490
+ const role = roleOf(entries, agent) ?? (said && project.graph.stages.has(said) ? said : null);
475
491
  return { agent, role };
476
492
  }
477
493
 
478
- /** Where this agent's current completion starts in the ledger: after its latest launch. */
494
+ /** Where this agent's current completion starts in the ledger: after its latest launch. A `pre` names no agent. */
479
495
  function currentLaunch(entries, agent) {
480
- let at = -1;
481
- entries.forEach((e, i) => {
482
- if ((e.k === 'dispatch' || e.k === 'pre') && e.agent === agent) at = i;
483
- });
484
- return at;
496
+ return entries.findLastIndex((e) => e.k === 'dispatch' && e.agent === agent);
485
497
  }
486
498
 
487
499
  /**
@@ -513,8 +525,10 @@ function handbackIn(path) {
513
525
  continue;
514
526
  }
515
527
  const content = row?.message?.content;
516
- // A new prompt — the resume of a finished agent — starts a new completion; its handback is later.
517
- if (row?.type === 'user' && (typeof content === 'string' || (Array.isArray(content) && content.some((b) => b?.type === 'text')))) message = null;
528
+ // A new prompt — the resume of a finished agent — starts a new completion; its handback is later. What
529
+ // counts as one is the parser's: a reminder Claude Code slips in after the handback is not, and read as one
530
+ // it threw away the handback the stop was looking for.
531
+ if (saidToAgent(row)) message = null;
518
532
  if (!Array.isArray(content)) continue;
519
533
  for (const block of content) {
520
534
  if (block?.type === 'tool_use' && block.name === 'SubagentHandback' && typeof block.input?.message === 'string') message = block.input.message;
@@ -566,10 +580,6 @@ function onPost(input, project, path, at) {
566
580
  }
567
581
  // A dispatch made inside a subagent is not the pipeline's: its stages are dispatched by the orchestrator.
568
582
  if (input.agent_id) return null;
569
- if (tool === 'AskUserQuestion') {
570
- append(path, { k: 'reset', at, why: 'ask' });
571
- return null;
572
- }
573
583
  if (!DISPATCH.has(tool)) return null;
574
584
  const response = input.tool_response && typeof input.tool_response === 'object' ? input.tool_response : {};
575
585
  let role;
@@ -584,7 +594,9 @@ function onPost(input, project, path, at) {
584
594
  }
585
595
  if (!role || !project.graph.stages.has(role)) return null;
586
596
  const resumed = tool === 'SendMessage' ? Boolean(response.resumedAgentId) : undefined;
587
- append(path, { k: 'dispatch', at, role, agent, via: tool, id: input.tool_use_id ?? null, ...(resumed === undefined ? {} : { resumed }) });
597
+ // The name an agent was launched with, if any: a later SendMessage may reach it by that name alone.
598
+ const name = tool !== 'SendMessage' && typeof input.tool_input?.name === 'string' ? input.tool_input.name.slice(0, 80) : null;
599
+ append(path, { k: 'dispatch', at, role, agent, via: tool, id: input.tool_use_id ?? null, ...(name ? { name } : {}), ...(resumed === undefined ? {} : { resumed }) });
588
600
  return null;
589
601
  }
590
602
 
@@ -599,9 +611,10 @@ const excess = (r) => Math.max(r.round - r.max, r.edgeRound - r.ceiling);
599
611
  function confirmation(r) {
600
612
  const from = r.agents.length > 0 ? ` The rounds so far came from ${r.agents.join(', ')}.` : '';
601
613
  const edge = `${r.source} → ${r.target} (${r.token})`;
602
- let why = `this would be round ${r.round} on ${edge}, and .claude/graph.md caps that loop at ${r.max}.`;
614
+ const cap = r.given ? `${r.max - r.given}, and your ${r.given} repl${r.given === 1 ? 'y' : 'ies'} since it opened gave it ${r.given} more` : `${r.max}`;
615
+ let why = `this would be round ${r.round} on ${edge}, and .claude/graph.md caps that loop at ${cap}.`;
603
616
  if (r.issue && r.round > r.max) {
604
- why = `this would be round ${r.round} of the issue \`${r.issue}\` on ${edge}, and .claude/graph.md caps that loop at ${r.max}.`;
617
+ why = `this would be round ${r.round} of the issue \`${r.issue}\` on ${edge}, and .claude/graph.md caps that loop at ${cap}.`;
605
618
  } else if (r.issue) {
606
619
  why =
607
620
  `this would be round ${r.edgeRound} on ${edge} with no approval between them. No issue has passed the cap of ${r.max}, ` +
@@ -706,6 +719,15 @@ export function handle(input, { root, now = new Date(), pkg = PACKAGE }) {
706
719
  return null;
707
720
  case 'SubagentStop':
708
721
  return onStop(input, project, path, at);
722
+ case 'SubagentStart': {
723
+ // Not the loop's business, but the one hook every stage passes through as it begins: its lessons. Claude
724
+ // Code reads `additionalContext` from this event's `hookSpecificOutput` into the subagent's context as it
725
+ // starts — its hook schema and handler say so in 2.1.283, and the handler in 2.1.158 — though the help text
726
+ // it prints for a malformed hook output does not list the event.
727
+ const role = input.agent_type;
728
+ const text = role && project.graph.stages.has(role) ? lessonIndex(root, role) : null;
729
+ return text ? { hookSpecificOutput: { hookEventName: 'SubagentStart', additionalContext: text } } : null;
730
+ }
709
731
  case 'PostToolUse':
710
732
  return onPost(input, project, path, at);
711
733
  case 'PreToolUse':
package/src/graph.mjs CHANGED
@@ -158,8 +158,44 @@ export function validateGraph(graph, specs, roles = new Set()) {
158
158
  if (isLoopBack(e.token) && !TERMINALS.has(e.to) && e.max === null) {
159
159
  problems.push(`graph.md:${e.line}: loop-back \`${e.from}\` → \`${e.to}\` has no cap — add "· max N"`);
160
160
  }
161
+ // A cap of none sends every round to the owner: the edge is one to `human`, said another way.
162
+ if (e.max !== null && e.max < 1) problems.push(`graph.md:${e.line}: \`${e.from}\` → \`${e.to}\` is capped at ${e.max} — a cap is one round or more`);
163
+ if (TERMINALS.has(e.from)) problems.push(`graph.md:${e.line}: an edge leaves \`${e.from}\`, where work ends`);
161
164
  }
162
165
 
166
+ // The shape of the whole. Each of these held in every graph composed so far and nothing checked it: a
167
+ // cycle through verdicts that pass work on has no cap and never ends; a stage no edge touches is never
168
+ // dispatched; and one from which no chain of edges reaches `done` or `human` is where work stops unseen.
169
+ const forward = new Map();
170
+ for (const e of edges) if (!isLoopBack(e.token) && stages.has(e.from) && stages.has(e.to)) forward.set(e.from, [...(forward.get(e.from) ?? []), e.to]);
171
+ const state = new Map();
172
+ const cycle = (stage, path) => {
173
+ state.set(stage, 'open');
174
+ for (const next of forward.get(stage) ?? []) {
175
+ if (state.get(next) === 'open') return [...path.slice(path.indexOf(next)), next];
176
+ if (!state.has(next)) {
177
+ const found = cycle(next, [...path, next]);
178
+ if (found) return found;
179
+ }
180
+ }
181
+ state.set(stage, 'done');
182
+ return null;
183
+ };
184
+ for (const s of stages) {
185
+ const found = state.has(s) ? null : cycle(s, [s]);
186
+ if (found) {
187
+ problems.push(`the graph goes round ${found.map((x) => `\`${x}\``).join(' → ')} on verdicts that pass work on — a loop with no cap`);
188
+ break;
189
+ }
190
+ }
191
+ for (const s of stages) if (!edges.some((e) => e.from === s || e.to === s)) problems.push(`stage \`${s}\` has no edge in or out — nothing dispatches it`);
192
+ const ends = new Set(TERMINALS);
193
+ for (let grew = true; grew; ) {
194
+ grew = false;
195
+ for (const e of edges) if (ends.has(e.to) && !ends.has(e.from)) grew = ends.add(e.from) && true;
196
+ }
197
+ for (const s of stages) if (edges.some((e) => e.from === s) && !ends.has(s)) problems.push(`no chain of edges from \`${s}\` reaches \`done\` or \`human\` — work there never ends`);
198
+
163
199
  // The loop gate reads one cap per edge. Two lines naming the same edge with different caps would
164
200
  // leave it guessing which one holds; it would take the larger, but a graph should not need a
165
201
  // tie-breaker.
@@ -0,0 +1,55 @@
1
+ /**
2
+ * The lessons a stage is handed as it starts: the list of its active pills, each with the trigger that says
3
+ * when it applies, given to the subagent by the `SubagentStart` hook.
4
+ *
5
+ * Every spec told its stage to read its pills, and a stage found them by opening files: every pill in its own
6
+ * directory, and every shared one to see whether its `applies_to` named it. So a reviewer read one in only
7
+ * seven of fifteen runs while twelve applied to it, and a stage no pill named opened them in two runs of three.
8
+ * Handed the list, a stage opens the ones whose trigger matches its task, and nothing else.
9
+ */
10
+
11
+ import { readFileSync, readdirSync } from 'node:fs';
12
+ import { join } from 'node:path';
13
+ import { frontmatter, list } from './commands/pills.mjs';
14
+
15
+ /** How much of a trigger goes in the list: enough to say when, not the lesson. */
16
+ const TRIGGER_CHARS = 160;
17
+
18
+ /**
19
+ * A stage's lessons as the text handed to it, or null when it has none.
20
+ *
21
+ * @param {string} root - The project directory.
22
+ * @param {string} role - The stage.
23
+ * @returns {string|null}
24
+ */
25
+ export function lessonIndex(root, role) {
26
+ const found = [];
27
+ for (const sub of [role, 'shared']) {
28
+ let files = [];
29
+ try {
30
+ files = readdirSync(join(root, '.claude', 'pills', sub)).filter((f) => f.endsWith('.md')).sort();
31
+ } catch {
32
+ continue;
33
+ }
34
+ for (const file of files) {
35
+ let fields = null;
36
+ try {
37
+ fields = frontmatter(readFileSync(join(root, '.claude', 'pills', sub, file), 'utf8'));
38
+ } catch {
39
+ continue;
40
+ }
41
+ if (!fields || fields.status === 'retired') continue;
42
+ const applies = list(fields.applies_to);
43
+ // A shared pill is this stage's when it names it; one in the stage's own directory, unless it names others.
44
+ if (sub === 'shared' ? !applies.includes(role) : applies.length > 0 && !applies.includes(role)) continue;
45
+ const trigger = String(fields.trigger ?? '').replace(/\s+/g, ' ').trim();
46
+ const when = trigger ? `when ${trigger.length > TRIGGER_CHARS ? `${trigger.slice(0, TRIGGER_CHARS - 1)}…` : trigger}` : 'on every task';
47
+ found.push(`- \`.claude/pills/${sub}/${file}\` — ${when}`);
48
+ }
49
+ }
50
+ if (found.length === 0) return null;
51
+ return [
52
+ `Your lessons in this project, ${found.length}: before acting, open each one whose trigger matches this task, and only those.`,
53
+ ...found,
54
+ ].join('\n');
55
+ }
@@ -317,7 +317,7 @@ const handsBack = (row) =>
317
317
  * @param {object|null} row - A parsed transcript row.
318
318
  * @returns {boolean}
319
319
  */
320
- const saidToAgent = (row) => {
320
+ export const saidToAgent = (row) => {
321
321
  if (row?.type !== 'user') return false;
322
322
  const content = row.message?.content;
323
323
  if (Array.isArray(content) && content.some((b) => b?.type === 'tool_result')) return false;
package/src/wiring.mjs CHANGED
@@ -109,7 +109,7 @@ const previousCommands = (h) => [command(h.script, h.mode), ...EARLIER_CANNOT_ST
109
109
  * The harness check has two: `Stop` tells the person what a turn left behind, `UserPromptSubmit` puts
110
110
  * the same findings in the model's context before it answers — the only one of the two it reads. The
111
111
  * loop gate has four, one per fact it keeps: a verdict, a dispatch, the owner speaking, and the
112
- * decision itself.
112
+ * decision itself; and a fifth, as each stage starts, that hands the stage its lessons (`src/lessons.mjs`).
113
113
  */
114
114
  export const HOOKS = [
115
115
  {
@@ -125,13 +125,14 @@ export const HOOKS = [
125
125
  },
126
126
  }),
127
127
  },
128
- { event: 'UserPromptSubmit', script: GATE, timeout: 10, why: "the owner's reply never starts a loop's count over" },
128
+ { event: 'UserPromptSubmit', script: GATE, timeout: 10, why: "the owner's reply never gives an open loop its round more" },
129
129
  {
130
130
  event: 'PreToolUse', matcher: 'Agent|Task|SendMessage', script: GATE, timeout: 10, why: 'the caps in .claude/graph.md stay instructions nothing holds',
131
131
  crash: (cannot) => ({ systemMessage: `NINA: the loop gate could not start, so the caps in .claude/graph.md are not held — ${cannot}` }),
132
132
  },
133
133
  { event: 'PostToolUse', matcher: 'Agent|Task|SendMessage|AskUserQuestion|SubagentHandback', script: GATE, timeout: 10, why: 'the gate never learns which rounds went out, or that the owner answered' },
134
134
  { event: 'SubagentStop', script: GATE, timeout: 10, why: 'the gate misses the verdict of a stage that wrote its report as its last message' },
135
+ { event: 'SubagentStart', script: GATE, timeout: 10, why: 'a stage is not handed its lessons, and opens every shared pill to find them, or none' },
135
136
  {
136
137
  event: 'PreToolUse', matcher: 'Edit|Write|MultiEdit|NotebookEdit', script: GUARD, timeout: 10, why: 'a hand edit to a composed file is found only after the turn, as drift, and the next compose overwrites it',
137
138
  crash: (cannot) => ({ systemMessage: `NINA: the edit guard could not start, so composed files can be edited in place — ${cannot}` }),