rhachet-roles-bhrain 0.3.0 → 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (240) hide show
  1. package/dist/access/sdk/sdkOpenAi.d.ts +25 -0
  2. package/dist/access/sdk/sdkOpenAi.js +122 -0
  3. package/dist/access/sdk/sdkOpenAi.js.map +1 -1
  4. package/dist/access/sdks/anthropic/sdkAnthropic.d.ts +31 -0
  5. package/dist/access/sdks/anthropic/sdkAnthropic.js +151 -0
  6. package/dist/access/sdks/anthropic/sdkAnthropic.js.map +1 -0
  7. package/dist/access/sdks/qwen/sdkQwen.d.ts +31 -0
  8. package/dist/access/sdks/qwen/sdkQwen.js +134 -0
  9. package/dist/access/sdks/qwen/sdkQwen.js.map +1 -0
  10. package/dist/domain.objects/BrainArch1/BrainArch1Actor.d.ts +67 -0
  11. package/dist/domain.objects/BrainArch1/BrainArch1Actor.js +12 -0
  12. package/dist/domain.objects/BrainArch1/BrainArch1Actor.js.map +1 -0
  13. package/dist/domain.objects/BrainArch1/BrainArch1Atom.d.ts +40 -0
  14. package/dist/domain.objects/BrainArch1/BrainArch1Atom.js +3 -0
  15. package/dist/domain.objects/BrainArch1/BrainArch1Atom.js.map +1 -0
  16. package/dist/domain.objects/BrainArch1/BrainArch1Context.d.ts +30 -0
  17. package/dist/domain.objects/BrainArch1/BrainArch1Context.js +3 -0
  18. package/dist/domain.objects/BrainArch1/BrainArch1Context.js.map +1 -0
  19. package/dist/domain.objects/BrainArch1/BrainArch1LoopIteration.d.ts +34 -0
  20. package/dist/domain.objects/BrainArch1/BrainArch1LoopIteration.js +8 -0
  21. package/dist/domain.objects/BrainArch1/BrainArch1LoopIteration.js.map +1 -0
  22. package/dist/domain.objects/BrainArch1/BrainArch1LoopIterationCompletedEvent.d.ts +23 -0
  23. package/dist/domain.objects/BrainArch1/BrainArch1LoopIterationCompletedEvent.js +9 -0
  24. package/dist/domain.objects/BrainArch1/BrainArch1LoopIterationCompletedEvent.js.map +1 -0
  25. package/dist/domain.objects/BrainArch1/BrainArch1LoopResult.d.ts +49 -0
  26. package/dist/domain.objects/BrainArch1/BrainArch1LoopResult.js +8 -0
  27. package/dist/domain.objects/BrainArch1/BrainArch1LoopResult.js.map +1 -0
  28. package/dist/domain.objects/BrainArch1/BrainArch1MemoryCompactedEvent.d.ts +31 -0
  29. package/dist/domain.objects/BrainArch1/BrainArch1MemoryCompactedEvent.js +9 -0
  30. package/dist/domain.objects/BrainArch1/BrainArch1MemoryCompactedEvent.js.map +1 -0
  31. package/dist/domain.objects/BrainArch1/BrainArch1MemoryCompactionResult.d.ts +27 -0
  32. package/dist/domain.objects/BrainArch1/BrainArch1MemoryCompactionResult.js +8 -0
  33. package/dist/domain.objects/BrainArch1/BrainArch1MemoryCompactionResult.js.map +1 -0
  34. package/dist/domain.objects/BrainArch1/BrainArch1MemoryManager.d.ts +45 -0
  35. package/dist/domain.objects/BrainArch1/BrainArch1MemoryManager.js +3 -0
  36. package/dist/domain.objects/BrainArch1/BrainArch1MemoryManager.js.map +1 -0
  37. package/dist/domain.objects/BrainArch1/BrainArch1MemoryTokenUsage.d.ts +29 -0
  38. package/dist/domain.objects/BrainArch1/BrainArch1MemoryTokenUsage.js +8 -0
  39. package/dist/domain.objects/BrainArch1/BrainArch1MemoryTokenUsage.js.map +1 -0
  40. package/dist/domain.objects/BrainArch1/BrainArch1PermissionDecision.d.ts +22 -0
  41. package/dist/domain.objects/BrainArch1/BrainArch1PermissionDecision.js +8 -0
  42. package/dist/domain.objects/BrainArch1/BrainArch1PermissionDecision.js.map +1 -0
  43. package/dist/domain.objects/BrainArch1/BrainArch1PermissionGuard.d.ts +30 -0
  44. package/dist/domain.objects/BrainArch1/BrainArch1PermissionGuard.js +3 -0
  45. package/dist/domain.objects/BrainArch1/BrainArch1PermissionGuard.js.map +1 -0
  46. package/dist/domain.objects/BrainArch1/BrainArch1Session.d.ts +47 -0
  47. package/dist/domain.objects/BrainArch1/BrainArch1Session.js +17 -0
  48. package/dist/domain.objects/BrainArch1/BrainArch1Session.js.map +1 -0
  49. package/dist/domain.objects/BrainArch1/BrainArch1SessionMessage.d.ts +34 -0
  50. package/dist/domain.objects/BrainArch1/BrainArch1SessionMessage.js +12 -0
  51. package/dist/domain.objects/BrainArch1/BrainArch1SessionMessage.js.map +1 -0
  52. package/dist/domain.objects/BrainArch1/BrainArch1ToolCall.d.ts +21 -0
  53. package/dist/domain.objects/BrainArch1/BrainArch1ToolCall.js +8 -0
  54. package/dist/domain.objects/BrainArch1/BrainArch1ToolCall.js.map +1 -0
  55. package/dist/domain.objects/BrainArch1/BrainArch1ToolDefinition.d.ts +54 -0
  56. package/dist/domain.objects/BrainArch1/BrainArch1ToolDefinition.js +20 -0
  57. package/dist/domain.objects/BrainArch1/BrainArch1ToolDefinition.js.map +1 -0
  58. package/dist/domain.objects/BrainArch1/BrainArch1ToolExecutionCompletedEvent.d.ts +36 -0
  59. package/dist/domain.objects/BrainArch1/BrainArch1ToolExecutionCompletedEvent.js +9 -0
  60. package/dist/domain.objects/BrainArch1/BrainArch1ToolExecutionCompletedEvent.js.map +1 -0
  61. package/dist/domain.objects/BrainArch1/BrainArch1ToolResult.d.ts +25 -0
  62. package/dist/domain.objects/BrainArch1/BrainArch1ToolResult.js +8 -0
  63. package/dist/domain.objects/BrainArch1/BrainArch1ToolResult.js.map +1 -0
  64. package/dist/domain.objects/BrainArch1/BrainArch1Toolbox.d.ts +31 -0
  65. package/dist/domain.objects/BrainArch1/BrainArch1Toolbox.js +3 -0
  66. package/dist/domain.objects/BrainArch1/BrainArch1Toolbox.js.map +1 -0
  67. package/dist/domain.objects/Reviewer/ReviewerReflectManifest.d.ts +44 -0
  68. package/dist/domain.objects/Reviewer/ReviewerReflectManifest.js +8 -0
  69. package/dist/domain.objects/Reviewer/ReviewerReflectManifest.js.map +1 -0
  70. package/dist/domain.objects/Reviewer/ReviewerReflectManifestOperation.d.ts +30 -0
  71. package/dist/domain.objects/Reviewer/ReviewerReflectManifestOperation.js +35 -0
  72. package/dist/domain.objects/Reviewer/ReviewerReflectManifestOperation.js.map +1 -0
  73. package/dist/domain.objects/Reviewer/ReviewerReflectMetrics.d.ts +89 -0
  74. package/dist/domain.objects/Reviewer/ReviewerReflectMetrics.js +8 -0
  75. package/dist/domain.objects/Reviewer/ReviewerReflectMetrics.js.map +1 -0
  76. package/dist/domain.objects/Reviewer/ReviewerReflectRuleProposal.d.ts +43 -0
  77. package/dist/domain.objects/Reviewer/ReviewerReflectRuleProposal.js +8 -0
  78. package/dist/domain.objects/Reviewer/ReviewerReflectRuleProposal.js.map +1 -0
  79. package/dist/domain.operations/artifact/genLoopFeedback.js +1 -1
  80. package/dist/domain.operations/artifact/genLoopFeedback.js.map +1 -1
  81. package/dist/domain.operations/artifact/genStepGrabCallerFeedbackToArtifact.d.ts +1 -1
  82. package/dist/domain.operations/brain.replic.arch1/core/invokeBrainArch1.d.ts +13 -0
  83. package/dist/domain.operations/brain.replic.arch1/core/invokeBrainArch1.js +106 -0
  84. package/dist/domain.operations/brain.replic.arch1/core/invokeBrainArch1.js.map +1 -0
  85. package/dist/domain.operations/brain.replic.arch1/llm/generateBrainArch1LlmResponse.d.ts +18 -0
  86. package/dist/domain.operations/brain.replic.arch1/llm/generateBrainArch1LlmResponse.js +16 -0
  87. package/dist/domain.operations/brain.replic.arch1/llm/generateBrainArch1LlmResponse.js.map +1 -0
  88. package/dist/domain.operations/brain.replic.arch1/loop/iterateBrainArch1Loop.d.ts +30 -0
  89. package/dist/domain.operations/brain.replic.arch1/loop/iterateBrainArch1Loop.js +71 -0
  90. package/dist/domain.operations/brain.replic.arch1/loop/iterateBrainArch1Loop.js.map +1 -0
  91. package/dist/domain.operations/brain.replic.arch1/loop/runBrainArch1Loop.d.ts +20 -0
  92. package/dist/domain.operations/brain.replic.arch1/loop/runBrainArch1Loop.js +90 -0
  93. package/dist/domain.operations/brain.replic.arch1/loop/runBrainArch1Loop.js.map +1 -0
  94. package/dist/domain.operations/brain.replic.arch1/plugins/atoms/anthropic.d.ts +8 -0
  95. package/dist/domain.operations/brain.replic.arch1/plugins/atoms/anthropic.js +31 -0
  96. package/dist/domain.operations/brain.replic.arch1/plugins/atoms/anthropic.js.map +1 -0
  97. package/dist/domain.operations/brain.replic.arch1/plugins/atoms/index.d.ts +3 -0
  98. package/dist/domain.operations/brain.replic.arch1/plugins/atoms/index.js +10 -0
  99. package/dist/domain.operations/brain.replic.arch1/plugins/atoms/index.js.map +1 -0
  100. package/dist/domain.operations/brain.replic.arch1/plugins/atoms/openai.d.ts +8 -0
  101. package/dist/domain.operations/brain.replic.arch1/plugins/atoms/openai.js +31 -0
  102. package/dist/domain.operations/brain.replic.arch1/plugins/atoms/openai.js.map +1 -0
  103. package/dist/domain.operations/brain.replic.arch1/plugins/atoms/qwen.d.ts +8 -0
  104. package/dist/domain.operations/brain.replic.arch1/plugins/atoms/qwen.js +32 -0
  105. package/dist/domain.operations/brain.replic.arch1/plugins/atoms/qwen.js.map +1 -0
  106. package/dist/domain.operations/brain.replic.arch1/plugins/memoryManagers/slidingWindow.d.ts +6 -0
  107. package/dist/domain.operations/brain.replic.arch1/plugins/memoryManagers/slidingWindow.js +80 -0
  108. package/dist/domain.operations/brain.replic.arch1/plugins/memoryManagers/slidingWindow.js.map +1 -0
  109. package/dist/domain.operations/brain.replic.arch1/plugins/permissionGuards/allowAll.d.ts +6 -0
  110. package/dist/domain.operations/brain.replic.arch1/plugins/permissionGuards/allowAll.js +14 -0
  111. package/dist/domain.operations/brain.replic.arch1/plugins/permissionGuards/allowAll.js.map +1 -0
  112. package/dist/domain.operations/brain.replic.arch1/plugins/permissionGuards/promptUser.d.ts +8 -0
  113. package/dist/domain.operations/brain.replic.arch1/plugins/permissionGuards/promptUser.js +52 -0
  114. package/dist/domain.operations/brain.replic.arch1/plugins/permissionGuards/promptUser.js.map +1 -0
  115. package/dist/domain.operations/brain.replic.arch1/plugins/permissionGuards/readOnly.d.ts +8 -0
  116. package/dist/domain.operations/brain.replic.arch1/plugins/permissionGuards/readOnly.js +38 -0
  117. package/dist/domain.operations/brain.replic.arch1/plugins/permissionGuards/readOnly.js.map +1 -0
  118. package/dist/domain.operations/brain.replic.arch1/plugins/toolboxes/bash/exec.d.ts +33 -0
  119. package/dist/domain.operations/brain.replic.arch1/plugins/toolboxes/bash/exec.js +100 -0
  120. package/dist/domain.operations/brain.replic.arch1/plugins/toolboxes/bash/exec.js.map +1 -0
  121. package/dist/domain.operations/brain.replic.arch1/plugins/toolboxes/bash/index.d.ts +6 -0
  122. package/dist/domain.operations/brain.replic.arch1/plugins/toolboxes/bash/index.js +26 -0
  123. package/dist/domain.operations/brain.replic.arch1/plugins/toolboxes/bash/index.js.map +1 -0
  124. package/dist/domain.operations/brain.replic.arch1/plugins/toolboxes/files/edit.d.ts +41 -0
  125. package/dist/domain.operations/brain.replic.arch1/plugins/toolboxes/files/edit.js +107 -0
  126. package/dist/domain.operations/brain.replic.arch1/plugins/toolboxes/files/edit.js.map +1 -0
  127. package/dist/domain.operations/brain.replic.arch1/plugins/toolboxes/files/glob.d.ts +33 -0
  128. package/dist/domain.operations/brain.replic.arch1/plugins/toolboxes/files/glob.js +68 -0
  129. package/dist/domain.operations/brain.replic.arch1/plugins/toolboxes/files/glob.js.map +1 -0
  130. package/dist/domain.operations/brain.replic.arch1/plugins/toolboxes/files/grep.d.ts +41 -0
  131. package/dist/domain.operations/brain.replic.arch1/plugins/toolboxes/files/grep.js +97 -0
  132. package/dist/domain.operations/brain.replic.arch1/plugins/toolboxes/files/grep.js.map +1 -0
  133. package/dist/domain.operations/brain.replic.arch1/plugins/toolboxes/files/index.d.ts +6 -0
  134. package/dist/domain.operations/brain.replic.arch1/plugins/toolboxes/files/index.js +65 -0
  135. package/dist/domain.operations/brain.replic.arch1/plugins/toolboxes/files/index.js.map +1 -0
  136. package/dist/domain.operations/brain.replic.arch1/plugins/toolboxes/files/read.d.ts +37 -0
  137. package/dist/domain.operations/brain.replic.arch1/plugins/toolboxes/files/read.js +96 -0
  138. package/dist/domain.operations/brain.replic.arch1/plugins/toolboxes/files/read.js.map +1 -0
  139. package/dist/domain.operations/brain.replic.arch1/plugins/toolboxes/files/write.d.ts +33 -0
  140. package/dist/domain.operations/brain.replic.arch1/plugins/toolboxes/files/write.js +81 -0
  141. package/dist/domain.operations/brain.replic.arch1/plugins/toolboxes/files/write.js.map +1 -0
  142. package/dist/domain.operations/brain.replic.arch1/plugins/toolboxes/web/fetch.d.ts +33 -0
  143. package/dist/domain.operations/brain.replic.arch1/plugins/toolboxes/web/fetch.js +113 -0
  144. package/dist/domain.operations/brain.replic.arch1/plugins/toolboxes/web/fetch.js.map +1 -0
  145. package/dist/domain.operations/brain.replic.arch1/plugins/toolboxes/web/index.d.ts +6 -0
  146. package/dist/domain.operations/brain.replic.arch1/plugins/toolboxes/web/index.js +36 -0
  147. package/dist/domain.operations/brain.replic.arch1/plugins/toolboxes/web/index.js.map +1 -0
  148. package/dist/domain.operations/brain.replic.arch1/plugins/toolboxes/web/search.d.ts +36 -0
  149. package/dist/domain.operations/brain.replic.arch1/plugins/toolboxes/web/search.js +101 -0
  150. package/dist/domain.operations/brain.replic.arch1/plugins/toolboxes/web/search.js.map +1 -0
  151. package/dist/domain.operations/brain.replic.arch1/tool/executeBrainArch1ToolCall.d.ts +14 -0
  152. package/dist/domain.operations/brain.replic.arch1/tool/executeBrainArch1ToolCall.js +45 -0
  153. package/dist/domain.operations/brain.replic.arch1/tool/executeBrainArch1ToolCall.js.map +1 -0
  154. package/dist/domain.operations/brain.replic.arch1/tool/mergeBrainArch1Toolboxes.d.ts +19 -0
  155. package/dist/domain.operations/brain.replic.arch1/tool/mergeBrainArch1Toolboxes.js +35 -0
  156. package/dist/domain.operations/brain.replic.arch1/tool/mergeBrainArch1Toolboxes.js.map +1 -0
  157. package/dist/domain.operations/git/genGitHubFileUrl.d.ts +9 -0
  158. package/dist/domain.operations/git/genGitHubFileUrl.js +55 -0
  159. package/dist/domain.operations/git/genGitHubFileUrl.js.map +1 -0
  160. package/dist/domain.operations/git/getGitRemoteUrl.d.ts +7 -0
  161. package/dist/domain.operations/git/getGitRemoteUrl.js +40 -0
  162. package/dist/domain.operations/git/getGitRemoteUrl.js.map +1 -0
  163. package/dist/domain.operations/hooks/getInvokeHooks.js +1 -1
  164. package/dist/domain.operations/hooks/getInvokeHooks.js.map +1 -1
  165. package/dist/domain.operations/reflect/createDraftDirectory.d.ts +11 -0
  166. package/dist/domain.operations/reflect/createDraftDirectory.js +46 -0
  167. package/dist/domain.operations/reflect/createDraftDirectory.js.map +1 -0
  168. package/dist/domain.operations/reflect/enumFeedbackFiles.d.ts +7 -0
  169. package/dist/domain.operations/reflect/enumFeedbackFiles.js +69 -0
  170. package/dist/domain.operations/reflect/enumFeedbackFiles.js.map +1 -0
  171. package/dist/domain.operations/reflect/extractJsonFromResultText.d.ts +7 -0
  172. package/dist/domain.operations/reflect/extractJsonFromResultText.js +19 -0
  173. package/dist/domain.operations/reflect/extractJsonFromResultText.js.map +1 -0
  174. package/dist/domain.operations/reflect/invokeClaudeCodeForReflect.d.ts +46 -0
  175. package/dist/domain.operations/reflect/invokeClaudeCodeForReflect.js +120 -0
  176. package/dist/domain.operations/reflect/invokeClaudeCodeForReflect.js.map +1 -0
  177. package/dist/domain.operations/reflect/metrics/computeMetricsExpected.d.ts +12 -0
  178. package/dist/domain.operations/reflect/metrics/computeMetricsExpected.js +28 -0
  179. package/dist/domain.operations/reflect/metrics/computeMetricsExpected.js.map +1 -0
  180. package/dist/domain.operations/reflect/metrics/computeMetricsRealized.d.ts +26 -0
  181. package/dist/domain.operations/reflect/metrics/computeMetricsRealized.js +66 -0
  182. package/dist/domain.operations/reflect/metrics/computeMetricsRealized.js.map +1 -0
  183. package/dist/domain.operations/reflect/metrics/writeLogArtifact.d.ts +17 -0
  184. package/dist/domain.operations/reflect/metrics/writeLogArtifact.js +93 -0
  185. package/dist/domain.operations/reflect/metrics/writeLogArtifact.js.map +1 -0
  186. package/dist/domain.operations/reflect/step1/compileCitationsMarkdown.d.ts +8 -0
  187. package/dist/domain.operations/reflect/step1/compileCitationsMarkdown.js +28 -0
  188. package/dist/domain.operations/reflect/step1/compileCitationsMarkdown.js.map +1 -0
  189. package/dist/domain.operations/reflect/step1/compileReflectStep1Prompt.d.ts +14 -0
  190. package/dist/domain.operations/reflect/step1/compileReflectStep1Prompt.js +93 -0
  191. package/dist/domain.operations/reflect/step1/compileReflectStep1Prompt.js.map +1 -0
  192. package/dist/domain.operations/reflect/step2/compileReflectStep2Prompt.d.ts +18 -0
  193. package/dist/domain.operations/reflect/step2/compileReflectStep2Prompt.js +208 -0
  194. package/dist/domain.operations/reflect/step2/compileReflectStep2Prompt.js.map +1 -0
  195. package/dist/domain.operations/reflect/step2/executeManifestOperations.d.ts +17 -0
  196. package/dist/domain.operations/reflect/step2/executeManifestOperations.js +189 -0
  197. package/dist/domain.operations/reflect/step2/executeManifestOperations.js.map +1 -0
  198. package/dist/domain.operations/reflect/step2/parseManifestOperations.d.ts +8 -0
  199. package/dist/domain.operations/reflect/step2/parseManifestOperations.js +73 -0
  200. package/dist/domain.operations/reflect/step2/parseManifestOperations.js.map +1 -0
  201. package/dist/domain.operations/reflect/validateSourceDirectory.d.ts +9 -0
  202. package/dist/domain.operations/reflect/validateSourceDirectory.js +63 -0
  203. package/dist/domain.operations/reflect/validateSourceDirectory.js.map +1 -0
  204. package/dist/domain.operations/reflect/validateTargetDirectory.d.ts +10 -0
  205. package/dist/domain.operations/reflect/validateTargetDirectory.js +59 -0
  206. package/dist/domain.operations/reflect/validateTargetDirectory.js.map +1 -0
  207. package/dist/index.js.map +1 -1
  208. package/dist/roles/architect/getArchitectRole.d.ts +6 -0
  209. package/dist/roles/architect/getArchitectRole.js +31 -0
  210. package/dist/roles/architect/getArchitectRole.js.map +1 -0
  211. package/dist/roles/brain/getBrainRole.d.ts +6 -0
  212. package/dist/roles/brain/getBrainRole.js +28 -0
  213. package/dist/roles/brain/getBrainRole.js.map +1 -0
  214. package/dist/roles/brain/skills/act/skillAct.d.ts +5 -0
  215. package/dist/roles/brain/skills/act/skillAct.js +147 -0
  216. package/dist/roles/brain/skills/act/skillAct.js.map +1 -0
  217. package/dist/roles/brain/skills/act/skillAct.ts +186 -0
  218. package/dist/roles/brain/skills/act/stepAct.d.ts +27 -0
  219. package/dist/roles/brain/skills/act/stepAct.js +95 -0
  220. package/dist/roles/brain/skills/act/stepAct.js.map +1 -0
  221. package/dist/roles/brain/skills/act/stepAct.ts +123 -0
  222. package/dist/roles/getRoleRegistry.js +5 -4
  223. package/dist/roles/getRoleRegistry.js.map +1 -1
  224. package/dist/roles/reviewer/briefs/on.rules/rules101.[article].md +41 -0
  225. package/dist/roles/reviewer/briefs/on.rules/rules101.citations.[article].md +88 -0
  226. package/dist/roles/reviewer/briefs/on.rules/rules101.collocated.[article].md +97 -0
  227. package/dist/roles/reviewer/briefs/on.rules/rules101.content.[article].md +228 -0
  228. package/dist/roles/reviewer/briefs/on.rules/rules101.content.[demo].forbid.failhide.md +87 -0
  229. package/dist/roles/reviewer/briefs/on.rules/rules101.content.[demo].forbid.gerunds.md +85 -0
  230. package/dist/roles/reviewer/briefs/on.rules/rules101.content.[demo].require.failfast.md +73 -0
  231. package/dist/roles/reviewer/briefs/on.rules/rules101.structure.[article].md +70 -0
  232. package/dist/roles/reviewer/skills/reflect/reflect.d.ts +30 -0
  233. package/dist/roles/reviewer/skills/reflect/reflect.js +305 -0
  234. package/dist/roles/reviewer/skills/reflect/reflect.js.map +1 -0
  235. package/dist/roles/reviewer/skills/reflect/reflect.sh +38 -0
  236. package/dist/roles/reviewer/skills/reflect/reflect.ts +356 -0
  237. package/dist/roles/thinker/getThinkerBrief.d.ts +1 -1
  238. package/dist/roles/thinker/getThinkerRole.js +8 -8
  239. package/dist/roles/thinker/getThinkerRole.js.map +1 -1
  240. package/package.json +5 -3
@@ -0,0 +1,123 @@
1
+ import * as fs from 'fs/promises';
2
+ import {
3
+ asStitcherFlat,
4
+ type GStitcher,
5
+ genStitchRoute,
6
+ type RoleContext,
7
+ StitchStepCompute,
8
+ type Threads,
9
+ } from 'rhachet';
10
+ import type { Artifact } from 'rhachet-artifact';
11
+ import type { GitFile } from 'rhachet-artifact-git';
12
+
13
+ import type { BrainArch1Actor } from '@src/domain.objects/BrainArch1/BrainArch1Actor';
14
+ import type { BrainArch1Context } from '@src/domain.objects/BrainArch1/BrainArch1Context';
15
+ import { invokeBrainArch1 } from '@src/domain.operations/brain.replic.arch1/core/invokeBrainArch1';
16
+
17
+ /**
18
+ * .what = stitcher type for the act skill
19
+ * .why = defines the input/output contract for agentic task completion
20
+ */
21
+ export type StitcherAct = GStitcher<
22
+ Threads<{
23
+ caller: RoleContext<
24
+ 'caller',
25
+ {
26
+ ask: string;
27
+ art: {
28
+ result: Artifact<typeof GitFile>;
29
+ log: Artifact<typeof GitFile>;
30
+ };
31
+ }
32
+ >;
33
+ brain: RoleContext<
34
+ 'brain',
35
+ {
36
+ actor: BrainArch1Actor;
37
+ systemPromptPath: string | null;
38
+ }
39
+ >;
40
+ }>,
41
+ BrainArch1Context & GStitcher['context']
42
+ >;
43
+
44
+ /**
45
+ * .what = step to invoke brain and persist results
46
+ * .why = core step for agentic task completion
47
+ */
48
+ const stepInvokeBrain = new StitchStepCompute<StitcherAct>({
49
+ form: 'COMPUTE',
50
+ readme: 'invokes brain agentic loop and persists results',
51
+ slug: '@[brain]<act>',
52
+ stitchee: 'brain',
53
+ invoke: async ({ threads }, context) => {
54
+ const { caller, brain } = threads;
55
+
56
+ // load custom system prompt if specified
57
+ let systemPrompt = brain.context.stash.actor.role.systemPrompt;
58
+ if (brain.context.stash.systemPromptPath) {
59
+ systemPrompt = await fs.readFile(
60
+ brain.context.stash.systemPromptPath,
61
+ 'utf-8',
62
+ );
63
+ }
64
+
65
+ // invoke the brain
66
+ const result = await invokeBrainArch1(
67
+ {
68
+ actor: {
69
+ ...brain.context.stash.actor,
70
+ role: {
71
+ ...brain.context.stash.actor.role,
72
+ systemPrompt,
73
+ },
74
+ },
75
+ userInput: caller.context.stash.ask,
76
+ },
77
+ context,
78
+ );
79
+
80
+ // write result to output artifact
81
+ await caller.context.stash.art.result.set({
82
+ content: result.finalResponse ?? '',
83
+ });
84
+
85
+ // write execution log to log artifact
86
+ const logContent = [
87
+ `# brain act execution log`,
88
+ '',
89
+ `## summary`,
90
+ `- termination: ${result.terminationReason}`,
91
+ `- iterations: ${result.iterationCount}`,
92
+ `- tokens: ${result.totalTokenUsage.totalTokens}`,
93
+ '',
94
+ `## final response`,
95
+ '```',
96
+ result.finalResponse ?? '(no response)',
97
+ '```',
98
+ '',
99
+ result.error ? `## error\n${result.error}` : '',
100
+ ]
101
+ .filter(Boolean)
102
+ .join('\n');
103
+
104
+ await caller.context.stash.art.log.set({ content: logContent });
105
+
106
+ return {
107
+ input: { ask: caller.context.stash.ask },
108
+ output: { content: result.finalResponse ?? '' },
109
+ };
110
+ },
111
+ });
112
+
113
+ /**
114
+ * .what = executes agentic task completion via brain invocation
115
+ * .why = enables llm with tools to autonomously complete tasks
116
+ */
117
+ export const stepAct = asStitcherFlat<StitcherAct>(
118
+ genStitchRoute({
119
+ slug: '@[brain]<act>',
120
+ readme: '@[brain]<act> -> agentic task completion',
121
+ sequence: [stepInvokeBrain],
122
+ }),
123
+ );
@@ -2,9 +2,10 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getRoleRegistry = void 0;
4
4
  const rhachet_1 = require("rhachet");
5
- const getRoleRegistry_readme_1 = require("./getRoleRegistry.readme");
6
- const getReviewerRole_1 = require("./reviewer/getReviewerRole");
7
- const getThinkerRole_1 = require("./thinker/getThinkerRole");
5
+ const getBrainRole_1 = require("../roles/brain/getBrainRole");
6
+ const getRoleRegistry_readme_1 = require("../roles/getRoleRegistry.readme");
7
+ const getReviewerRole_1 = require("../roles/reviewer/getReviewerRole");
8
+ const getThinkerRole_1 = require("../roles/thinker/getThinkerRole");
8
9
  /**
9
10
  * .what = returns the core registry of predefined roles and skills
10
11
  * .why =
@@ -14,7 +15,7 @@ const getThinkerRole_1 = require("./thinker/getThinkerRole");
14
15
  const getRoleRegistry = () => new rhachet_1.RoleRegistry({
15
16
  slug: 'bhrain',
16
17
  readme: getRoleRegistry_readme_1.BHRAIN_REGISTRY_README,
17
- roles: [getThinkerRole_1.ROLE_THINKER, getReviewerRole_1.ROLE_REVIEWER],
18
+ roles: [getThinkerRole_1.ROLE_THINKER, getReviewerRole_1.ROLE_REVIEWER, getBrainRole_1.ROLE_BRAIN],
18
19
  });
19
20
  exports.getRoleRegistry = getRoleRegistry;
20
21
  //# sourceMappingURL=getRoleRegistry.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"getRoleRegistry.js","sourceRoot":"","sources":["../../src/roles/getRoleRegistry.ts"],"names":[],"mappings":";;;AAAA,qCAAuC;AAEvC,qEAAkE;AAClE,gEAA2D;AAC3D,6DAAwD;AAExD;;;;;GAKG;AACI,MAAM,eAAe,GAAG,GAAiB,EAAE,CAChD,IAAI,sBAAY,CAAC;IACf,IAAI,EAAE,QAAQ;IACd,MAAM,EAAE,+CAAsB;IAC9B,KAAK,EAAE,CAAC,6BAAY,EAAE,+BAAa,CAAC;CACrC,CAAC,CAAC;AALQ,QAAA,eAAe,mBAKvB"}
1
+ {"version":3,"file":"getRoleRegistry.js","sourceRoot":"","sources":["../../src/roles/getRoleRegistry.ts"],"names":[],"mappings":";;;AAAA,qCAAuC;AAEvC,gEAA2D;AAC3D,8EAA2E;AAC3E,yEAAoE;AACpE,sEAAiE;AAEjE;;;;;GAKG;AACI,MAAM,eAAe,GAAG,GAAiB,EAAE,CAChD,IAAI,sBAAY,CAAC;IACf,IAAI,EAAE,QAAQ;IACd,MAAM,EAAE,+CAAsB;IAC9B,KAAK,EAAE,CAAC,6BAAY,EAAE,+BAAa,EAAE,yBAAU,CAAC;CACjD,CAAC,CAAC;AALQ,QAAA,eAAe,mBAKvB"}
@@ -0,0 +1,41 @@
1
+ # rules
2
+
3
+ ## .what
4
+
5
+ rules are materialized feedback patterns that encode best practices and quality standards for a domain.
6
+
7
+ each rule represents a generalized insight extracted from real feedback - a distillation of lessons learned from actual experience.
8
+
9
+ ## .why
10
+
11
+ rules enable consistent quality by making implicit knowledge explicit:
12
+
13
+ - capture hard-won lessons from feedback cycles
14
+ - prevent repeat mistakes across team members and projects
15
+ - provide a shared vocabulary for discussing quality
16
+ - enable automated review and validation
17
+
18
+ ## .how rules relate to practices
19
+
20
+ practices organize rules by domain concern. each practice directory contains rules that apply to that domain. rules within the same practice share context and may reference each other.
21
+
22
+ the specific practice domains vary by project and role - there is no prescribed set of practices.
23
+
24
+ ## .how rules materialize from feedback
25
+
26
+ feedback flows through a reflection process to become rules:
27
+
28
+ 1. **feedback occurs** - human provides guidance on specific artifact
29
+ 2. **pattern emerges** - similar feedback repeats across contexts
30
+ 3. **rule crystallizes** - generalized rule extracted from pattern
31
+ 4. **citation traces** - each rule links back to origin feedback
32
+
33
+ this materialization process ensures rules are grounded in real needs, not imagined requirements.
34
+
35
+ ## .note
36
+
37
+ rules are living documents. as new feedback emerges, rules may be:
38
+ - refined (clarify edge cases)
39
+ - updated (incorporate new insights)
40
+ - deprecated (superseded by better understanding)
41
+ - split (single rule becomes multiple specific rules)
@@ -0,0 +1,88 @@
1
+ # rules citations
2
+
3
+ ## .what
4
+
5
+ citations trace rules back to their origin feedback, providing provenance and context for why each rule exists.
6
+
7
+ ## citation format
8
+
9
+ citations appear in the `## .citations` section of the `# deets` block:
10
+
11
+ ```md
12
+ ## .citations
13
+
14
+ > exact quote from the feedback that led to this rule
15
+
16
+ source: https://github.com/org/repo/blob/commit/path/to/feedback.md
17
+ ```
18
+
19
+ ## github url format
20
+
21
+ citation urls must be permanent github links that include:
22
+
23
+ - organization/owner
24
+ - repository name
25
+ - commit hash or branch
26
+ - full file path
27
+
28
+ ### url pattern
29
+
30
+ ```
31
+ https://github.com/{org}/{repo}/blob/{ref}/{path}
32
+ ```
33
+
34
+ ### examples
35
+
36
+ ```md
37
+ source: https://github.com/ehmpathy/declastruct-aws/blob/main/.behavior/v2025_12_05.aws-account-provision/5.1.execution.phase0_to_phaseN.v1.i1.md.%5Bfeedback%5D.v1.%5Bgiven%5D.by_human.md
38
+
39
+ source: https://github.com/acme/project/blob/abc123/.behavior/v2025_01_01.feature/execution.md.[feedback].v2.[given].by_human.md
40
+ ```
41
+
42
+ ## quote inclusion
43
+
44
+ quotes capture the specific feedback that inspired the rule:
45
+
46
+ ### single quote
47
+
48
+ ```md
49
+ ## .citations
50
+
51
+ > never hide errors in try/catch blocks without explicit handling
52
+
53
+ source: https://github.com/...
54
+ ```
55
+
56
+ ### multiple quotes
57
+
58
+ when a rule consolidates multiple feedback instances:
59
+
60
+ ```md
61
+ ## .citations
62
+
63
+ > always use named arguments for readability
64
+
65
+ source: https://github.com/org/repo1/blob/.../feedback.v1.md
66
+
67
+ ---
68
+
69
+ > positional args are a maintenance nightmare
70
+
71
+ source: https://github.com/org/repo2/blob/.../feedback.v3.md
72
+ ```
73
+
74
+ ## provenance track
75
+
76
+ citations enable:
77
+
78
+ - **audit trail** - trace any rule back to real experience
79
+ - **context recovery** - understand the situation that prompted the rule
80
+ - **credibility** - rules grounded in actual feedback, not theory
81
+ - **evolution** - track how rules emerged and refined over time
82
+
83
+ ## .note
84
+
85
+ - always use the full github url, not relative paths
86
+ - prefer permalinks with commit hashes for immutable references
87
+ - when feedback files are renamed or moved, update citations
88
+ - if origin feedback is deleted, preserve the quote with a note about the removed source
@@ -0,0 +1,97 @@
1
+ # rules collocated
2
+
3
+ ## .what
4
+
5
+ collocated documents are support materials that live alongside rule files, providing examples, references, and educational content.
6
+
7
+ ## collocation pattern
8
+
9
+ support documents follow the rule file name with a suffix:
10
+
11
+ ```
12
+ rule.$directive.$topic.[suffix].$qualifier.md
13
+ ```
14
+
15
+ - **[suffix]** = document type: `[demo]`, `[ref]`, `[lesson]`
16
+ - **$qualifier** = distinguishing name for multiple documents
17
+
18
+ ## suffix types
19
+
20
+ ### [demo] - examples and demonstrations
21
+
22
+ concrete examples showing the rule in action:
23
+
24
+ ```
25
+ rule.forbid.error_hiding.[demo].try_catch.md
26
+ rule.prefer.early_returns.[demo].guard_clauses.md
27
+ rule.require.tests.[demo].integration.md
28
+ ```
29
+
30
+ demos typically include:
31
+ - working code samples
32
+ - before/after comparisons
33
+ - annotated walkthroughs
34
+
35
+ ### [ref] - reference materials
36
+
37
+ supporting documentation and external references:
38
+
39
+ ```
40
+ rule.require.domain_objects.[ref].package.md
41
+ rule.prefer.dependency_injection.[ref].article.md
42
+ rule.forbid.barrel_exports.[ref].circular_deps.md
43
+ ```
44
+
45
+ refs typically include:
46
+ - links to external documentation
47
+ - package usage guides
48
+ - architectural diagrams
49
+
50
+ ### [lesson] - educational content
51
+
52
+ teaching materials that explain concepts in depth:
53
+
54
+ ```
55
+ rule.require.narrative_flow.[lesson].code_paragraphs.md
56
+ rule.prefer.transformers.[lesson].pipelines_vs_conditionals.md
57
+ rule.require.idempotency.[lesson].findsert_upsert.md
58
+ ```
59
+
60
+ lessons typically include:
61
+ - conceptual explanations
62
+ - mental models
63
+ - learning progressions
64
+
65
+ ## directory layout
66
+
67
+ collocated documents appear alongside their parent rule:
68
+
69
+ ```
70
+ practices/code.prod/evolvable.procedures/
71
+ ├── rule.forbid.positional_args.md
72
+ ├── rule.forbid.positional_args.[demo].shell.md
73
+ ├── rule.forbid.positional_args.[lesson].named_args.md
74
+ ├── rule.require.input_context_pattern.md
75
+ ├── rule.require.input_context_pattern.[ref].package.md
76
+ └── rule.require.dependency_injection.md
77
+ ```
78
+
79
+ ## .when to collocate
80
+
81
+ collocate when:
82
+ - a rule benefits from concrete examples
83
+ - external resources clarify the rule
84
+ - deeper explanation aids understanding
85
+ - multiple examples illustrate different aspects
86
+
87
+ keep separate when:
88
+ - the document applies to multiple rules
89
+ - the content is general reference (put in briefs/knowledge/)
90
+ - the document is too large to be a quick supplement
91
+
92
+ ## .note
93
+
94
+ - collocated documents inherit context from their parent rule
95
+ - multiple suffixed documents can exist for one rule
96
+ - qualifiers should be descriptive but concise
97
+ - load order: rule first, then demos, refs, lessons
@@ -0,0 +1,228 @@
1
+ # rules content
2
+
3
+ ## .what
4
+
5
+ rules follow a two-section structure that separates quick reference from detailed guidance.
6
+
7
+ ## two-section structure
8
+
9
+ every rule has two sections separated by a triple separator:
10
+
11
+ ```md
12
+ # tldr
13
+
14
+ [quick reference content]
15
+
16
+ ---
17
+ ---
18
+ ---
19
+
20
+ # deets
21
+
22
+ [detailed content]
23
+ ```
24
+
25
+ ## # tldr section
26
+
27
+ the tldr section provides at-a-glance understanding:
28
+
29
+ ### ## severity header
30
+
31
+ ```md
32
+ ## severity: blocker
33
+ ```
34
+
35
+ or
36
+
37
+ ```md
38
+ ## severity: nitpick
39
+ ```
40
+
41
+ the severity must match the directive:
42
+ - `forbid` / `require` → `blocker`
43
+ - `avoid` / `prefer` → `nitpick`
44
+
45
+ ### .what summary
46
+
47
+ immediately after severity, state what the rule is:
48
+
49
+ ```md
50
+ ## severity: blocker
51
+
52
+ never use positional arguments in procedure signatures
53
+
54
+ use named arguments via destructured input objects instead
55
+ ```
56
+
57
+ ### .why rationale
58
+
59
+ explain why this rule matters:
60
+
61
+ ```md
62
+ positional arguments are fragile - adding, removing, or reordering parameters breaks callers.
63
+ named arguments are self-documenting and order-independent.
64
+ ```
65
+
66
+ ## # deets section
67
+
68
+ the deets section provides expanded guidance:
69
+
70
+ ### ## .what (optional)
71
+
72
+ expanded explanation of what the rule covers.
73
+
74
+ ### ## .why (optional)
75
+
76
+ deeper rationale, including tradeoffs and edge cases.
77
+
78
+ ### ## severity (required)
79
+
80
+ repeat the severity and explain why this level was chosen, tying to hazard, time cost, and money cost.
81
+
82
+ for negative directives (`forbid`/`avoid`), explain the cost of violation:
83
+
84
+ ```md
85
+ ## severity: blocker
86
+
87
+ hidden errors reach production and cost hours to debug, damaging customer trust.
88
+ ```
89
+
90
+ for positive directives (`require`/`prefer`), explain the benefit of compliance:
91
+
92
+ ```md
93
+ ## severity: blocker
94
+
95
+ fail-fast surfaces errors immediately with rich context, cutting debug time from hours to minutes.
96
+ ```
97
+
98
+ ### ## .where (optional)
99
+
100
+ scope or location where this rule applies:
101
+
102
+ ```md
103
+ ## .where
104
+
105
+ - all exported procedures in domain.operations/
106
+ - all public API endpoints
107
+ - exempt: anonymous inline callbacks
108
+ ```
109
+
110
+ ### ## .when (optional)
111
+
112
+ conditions under which the rule applies:
113
+
114
+ ```md
115
+ ## .when
116
+
117
+ - applies when defining function signatures
118
+ - applies when refactoring existing code
119
+ - does not apply to third-party API callbacks
120
+ ```
121
+
122
+ ### ## .how (optional)
123
+
124
+ guidance on detecting violations and applying the rule:
125
+
126
+ ```md
127
+ ## .how
128
+
129
+ search for patterns like:
130
+ - `function foo(a, b, c)`
131
+ - `const bar = (x, y) =>`
132
+
133
+ refactor to:
134
+ - `const foo = ({ a, b, c }: Input) =>`
135
+ ```
136
+
137
+ ### ## .note (optional)
138
+
139
+ caveats, edge cases, or special considerations:
140
+
141
+ ```md
142
+ ## .note
143
+
144
+ legacy code may still use positional args.
145
+ prioritize new code; refactor legacy opportunistically.
146
+ ```
147
+
148
+ ### ## .examples (optional)
149
+
150
+ concrete positive and negative patterns:
151
+
152
+ ```md
153
+ ## .examples
154
+
155
+ ### positive
156
+
157
+ const setCustomerPhone = ({ customer, phone }: Input) => {
158
+ return { ...customer, phone };
159
+ };
160
+
161
+ ### negative
162
+
163
+ function setCustomerPhone(customer, phone) { // forbidden
164
+ return { ...customer, phone };
165
+ }
166
+ ```
167
+
168
+ ## complete template
169
+
170
+ ```md
171
+ # tldr
172
+
173
+ ## severity: blocker|nitpick
174
+
175
+ [.what summary - what the rule is]
176
+
177
+ [.why rationale - why it matters]
178
+
179
+ ---
180
+ ---
181
+ ---
182
+
183
+ # deets
184
+
185
+ ## .what
186
+
187
+ [expanded summary]
188
+
189
+ ## .why
190
+
191
+ [expanded rationale]
192
+
193
+ ## severity: blocker|nitpick
194
+
195
+ [for forbid/avoid: cost of violation | for require/prefer: benefit of compliance]
196
+
197
+ ## .where
198
+
199
+ [scope/location]
200
+
201
+ ## .when
202
+
203
+ [conditions]
204
+
205
+ ## .how
206
+
207
+ [detection and usage guidance]
208
+
209
+ ## .note
210
+
211
+ [caveats]
212
+
213
+ ## .examples
214
+
215
+ ### positive
216
+
217
+ [correct usage]
218
+
219
+ ### negative
220
+
221
+ [violation]
222
+
223
+ ## .citations
224
+
225
+ > [quote from origin feedback]
226
+
227
+ source: [github url]
228
+ ```
@@ -0,0 +1,87 @@
1
+ # tldr
2
+
3
+ ## severity: blocker
4
+
5
+ never hide errors via blanket try/catch blocks.
6
+
7
+ hidden errors lead to silent defects and hours of pointless debugging. if an error is thrown, it must be rethrown unless explicitly allowlisted and carefully handled.
8
+
9
+ ---
10
+ ---
11
+ ---
12
+
13
+ # deets
14
+
15
+ ## .what
16
+
17
+ forbid any scenario where real errors are silently swallowed or hidden, commonly via try/catch blocks that catch all errors without rethrowing unexpected ones.
18
+
19
+ ## .why
20
+
21
+ - hidden errors cause silent defects that are extremely hard to diagnose
22
+ - blanket catch blocks mask the root cause of failures
23
+ - debugging becomes exponentially harder when errors don't surface
24
+ - fail-fast is impossible when errors are swallowed
25
+
26
+ ## severity: blocker
27
+
28
+ swallowed exceptions cause silent defects that cost hours or days to diagnose and erode customer trust.
29
+
30
+ ## .when
31
+
32
+ the only acceptable try/catch pattern:
33
+ - the catch has an explicit allowlist of expected errors
34
+ - those specific errors are carefully handled
35
+ - all other errors are rethrown
36
+
37
+ ## .how
38
+
39
+ search for patterns:
40
+ - `try { ... } catch (e) { }` — empty catch blocks
41
+ - `try { ... } catch (e) { return null; }` — swallowing with fallback
42
+ - `try { ... } catch (e) { console.log(e); }` — logging without rethrowing
43
+
44
+ ## .examples
45
+
46
+ ### positive
47
+
48
+ ```ts
49
+ try {
50
+ await doSomething({ userUuid });
51
+ } catch (error) {
52
+ if (!(error instanceof Error)) throw error;
53
+
54
+ // only handle specific expected error
55
+ if (error.message.includes('NOT_FOUND')) {
56
+ return null; // expected case: resource doesn't exist
57
+ }
58
+
59
+ // rethrow all unexpected errors
60
+ throw error;
61
+ }
62
+ ```
63
+
64
+ ### negative
65
+
66
+ ```ts
67
+ // ⛔ blanket catch hides all errors
68
+ try {
69
+ await doSomething({ userUuid });
70
+ } catch (error) {
71
+ console.log('something went wrong');
72
+ return null;
73
+ }
74
+ ```
75
+
76
+ ```ts
77
+ // ⛔ empty catch block
78
+ try {
79
+ await riskyOperation();
80
+ } catch (e) {
81
+ // silently swallowed
82
+ }
83
+ ```
84
+
85
+ ## .note
86
+
87
+ this is a mega blocker. any detection of failhide patterns should immediately halt review until resolved.