byterover-cli 0.4.1 → 1.0.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 (474) hide show
  1. package/README.md +1 -9
  2. package/dist/commands/curate.d.ts +1 -3
  3. package/dist/commands/curate.js +14 -51
  4. package/dist/commands/main.d.ts +8 -0
  5. package/dist/commands/main.js +29 -8
  6. package/dist/commands/query.d.ts +1 -3
  7. package/dist/commands/query.js +8 -35
  8. package/dist/config/context-tree-domains.d.ts +5 -0
  9. package/dist/config/context-tree-domains.js +6 -1
  10. package/dist/config/environment.js +9 -9
  11. package/dist/constants.d.ts +14 -0
  12. package/dist/constants.js +18 -0
  13. package/dist/core/domain/cipher/agent/agent-info.d.ts +199 -0
  14. package/dist/core/domain/cipher/agent/agent-info.js +143 -0
  15. package/dist/core/domain/cipher/agent/agent-registry.d.ts +96 -0
  16. package/dist/core/domain/cipher/agent/agent-registry.js +254 -0
  17. package/dist/core/domain/cipher/agent/index.d.ts +4 -1
  18. package/dist/core/domain/cipher/agent/index.js +7 -1
  19. package/dist/core/domain/cipher/agent-events/types.d.ts +355 -2
  20. package/dist/core/domain/cipher/agent-events/types.js +11 -0
  21. package/dist/core/domain/cipher/errors/error-normalizer.d.ts +156 -0
  22. package/dist/core/domain/cipher/errors/error-normalizer.js +379 -0
  23. package/dist/core/domain/cipher/errors/file-system-error.d.ts +2 -1
  24. package/dist/core/domain/cipher/errors/file-system-error.js +3 -2
  25. package/dist/core/domain/cipher/errors/system-prompt-error-codes.d.ts +79 -0
  26. package/dist/core/domain/cipher/errors/system-prompt-error-codes.js +80 -0
  27. package/dist/core/domain/cipher/errors/system-prompt-error.d.ts +114 -0
  28. package/dist/core/domain/cipher/errors/system-prompt-error.js +144 -0
  29. package/dist/core/domain/cipher/file-system/types.d.ts +57 -0
  30. package/dist/core/domain/cipher/llm/error-codes.d.ts +51 -0
  31. package/dist/core/domain/cipher/llm/error-codes.js +51 -0
  32. package/dist/core/domain/cipher/llm/index.d.ts +9 -0
  33. package/dist/core/domain/cipher/llm/index.js +13 -0
  34. package/dist/core/domain/cipher/llm/registry.d.ts +113 -0
  35. package/dist/core/domain/cipher/llm/registry.js +244 -0
  36. package/dist/core/domain/cipher/llm/schemas.d.ts +155 -0
  37. package/dist/core/domain/cipher/llm/schemas.js +151 -0
  38. package/dist/core/domain/cipher/llm/types.d.ts +121 -0
  39. package/dist/core/domain/cipher/llm/types.js +60 -0
  40. package/dist/core/domain/cipher/storage/message-storage-types.d.ts +114 -5
  41. package/dist/core/domain/cipher/streaming/types.d.ts +119 -0
  42. package/dist/core/domain/cipher/streaming/types.js +16 -0
  43. package/dist/core/domain/cipher/system-prompt/types.d.ts +44 -0
  44. package/dist/core/domain/cipher/todos/types.d.ts +34 -0
  45. package/dist/core/domain/cipher/tools/constants.d.ts +5 -2
  46. package/dist/core/domain/cipher/tools/constants.js +5 -2
  47. package/dist/core/domain/cipher/tools/types.d.ts +31 -0
  48. package/dist/core/domain/errors/connection-error.d.ts +33 -0
  49. package/dist/core/domain/errors/connection-error.js +54 -0
  50. package/dist/core/domain/errors/core-process-error.d.ts +27 -0
  51. package/dist/core/domain/errors/core-process-error.js +43 -0
  52. package/dist/core/domain/errors/task-error.d.ts +64 -0
  53. package/dist/core/domain/errors/task-error.js +116 -0
  54. package/dist/core/domain/errors/transport-error.d.ts +72 -0
  55. package/dist/core/domain/errors/transport-error.js +114 -0
  56. package/dist/core/domain/instance/index.d.ts +1 -0
  57. package/dist/core/domain/instance/index.js +1 -0
  58. package/dist/core/domain/instance/types.d.ts +57 -0
  59. package/dist/core/domain/instance/types.js +72 -0
  60. package/dist/core/domain/knowledge/directory-manager.d.ts +16 -0
  61. package/dist/core/domain/knowledge/directory-manager.js +31 -0
  62. package/dist/core/domain/transport/index.d.ts +2 -0
  63. package/dist/core/domain/transport/index.js +2 -0
  64. package/dist/core/domain/transport/schemas.d.ts +1149 -0
  65. package/dist/core/domain/transport/schemas.js +554 -0
  66. package/dist/core/domain/transport/types.d.ts +67 -0
  67. package/dist/core/domain/transport/types.js +7 -0
  68. package/dist/core/interfaces/cipher/cipher-services.d.ts +15 -3
  69. package/dist/core/interfaces/cipher/i-chat-session.d.ts +47 -5
  70. package/dist/core/interfaces/cipher/i-cipher-agent.d.ts +39 -4
  71. package/dist/core/interfaces/cipher/i-content-generator.d.ts +3 -5
  72. package/dist/core/interfaces/cipher/i-file-system.d.ts +12 -1
  73. package/dist/core/interfaces/cipher/i-llm-service.d.ts +4 -5
  74. package/dist/core/interfaces/cipher/i-todo-storage.d.ts +24 -0
  75. package/dist/core/interfaces/cipher/i-todo-storage.js +1 -0
  76. package/dist/core/interfaces/cipher/i-tool-plugin.d.ts +90 -0
  77. package/dist/core/interfaces/cipher/i-tool-plugin.js +1 -0
  78. package/dist/core/interfaces/cipher/i-tool-provider.d.ts +3 -2
  79. package/dist/core/interfaces/cipher/i-tool-scheduler.d.ts +4 -0
  80. package/dist/core/interfaces/cipher/index.d.ts +35 -0
  81. package/dist/core/interfaces/cipher/index.js +11 -0
  82. package/dist/core/interfaces/cipher/message-factory.d.ts +155 -0
  83. package/dist/core/interfaces/cipher/message-factory.js +252 -0
  84. package/dist/core/interfaces/cipher/message-type-guards.d.ts +139 -0
  85. package/dist/core/interfaces/cipher/message-type-guards.js +173 -0
  86. package/dist/core/interfaces/cipher/message-types.d.ts +279 -5
  87. package/dist/core/interfaces/cipher/message-types.js +6 -0
  88. package/dist/core/interfaces/cipher/sanitization-types.d.ts +147 -0
  89. package/dist/core/interfaces/cipher/sanitization-types.js +46 -0
  90. package/dist/core/interfaces/executor/i-curate-executor.d.ts +34 -0
  91. package/dist/core/interfaces/executor/i-curate-executor.js +1 -0
  92. package/dist/core/interfaces/executor/i-query-executor.d.ts +32 -0
  93. package/dist/core/interfaces/executor/i-query-executor.js +1 -0
  94. package/dist/core/interfaces/executor/index.d.ts +2 -0
  95. package/dist/core/interfaces/executor/index.js +2 -0
  96. package/dist/core/interfaces/instance/i-instance-discovery.d.ts +45 -0
  97. package/dist/core/interfaces/instance/i-instance-discovery.js +1 -0
  98. package/dist/core/interfaces/instance/i-instance-manager.d.ts +58 -0
  99. package/dist/core/interfaces/instance/i-instance-manager.js +1 -0
  100. package/dist/core/interfaces/instance/index.d.ts +2 -0
  101. package/dist/core/interfaces/instance/index.js +2 -0
  102. package/dist/core/interfaces/noop-implementations.d.ts +53 -0
  103. package/dist/core/interfaces/noop-implementations.js +62 -0
  104. package/dist/core/interfaces/transport/i-transport-client.d.ts +97 -0
  105. package/dist/core/interfaces/transport/i-transport-client.js +1 -0
  106. package/dist/core/interfaces/transport/i-transport-server.d.ts +93 -0
  107. package/dist/core/interfaces/transport/i-transport-server.js +1 -0
  108. package/dist/core/interfaces/transport/index.d.ts +2 -0
  109. package/dist/core/interfaces/transport/index.js +2 -0
  110. package/dist/infra/cipher/agent/agent-error-codes.d.ts +16 -0
  111. package/dist/infra/cipher/agent/agent-error-codes.js +17 -0
  112. package/dist/infra/cipher/agent/agent-error.d.ts +54 -0
  113. package/dist/infra/cipher/agent/agent-error.js +79 -0
  114. package/dist/infra/cipher/agent/agent-schemas.d.ts +264 -0
  115. package/dist/infra/cipher/agent/agent-schemas.js +97 -0
  116. package/dist/infra/cipher/agent/agent-state-manager.d.ts +140 -0
  117. package/dist/infra/cipher/agent/agent-state-manager.js +275 -0
  118. package/dist/infra/cipher/agent/base-agent.d.ts +118 -0
  119. package/dist/infra/cipher/agent/base-agent.js +240 -0
  120. package/dist/infra/cipher/agent/cipher-agent.d.ts +165 -0
  121. package/dist/infra/cipher/agent/cipher-agent.js +546 -0
  122. package/dist/infra/cipher/agent/index.d.ts +22 -0
  123. package/dist/infra/cipher/agent/index.js +24 -0
  124. package/dist/infra/cipher/agent/service-initializer.d.ts +79 -0
  125. package/dist/infra/cipher/{agent-service-factory.js → agent/service-initializer.js} +117 -68
  126. package/dist/infra/cipher/agent/types.d.ts +35 -0
  127. package/dist/infra/cipher/agent/types.js +1 -0
  128. package/dist/infra/cipher/blob/blob-reference-resolver.d.ts +107 -0
  129. package/dist/infra/cipher/blob/blob-reference-resolver.js +228 -0
  130. package/dist/infra/cipher/blob/blob-reference-utils.d.ts +117 -0
  131. package/dist/infra/cipher/blob/blob-reference-utils.js +230 -0
  132. package/dist/infra/cipher/consumer/consumer-lock.js +1 -0
  133. package/dist/infra/cipher/consumer/consumer-service.js +1 -0
  134. package/dist/infra/cipher/consumer/execution-consumer.d.ts +6 -1
  135. package/dist/infra/cipher/consumer/execution-consumer.js +54 -16
  136. package/dist/infra/cipher/consumer/index.d.ts +1 -1
  137. package/dist/infra/cipher/consumer/index.js +2 -1
  138. package/dist/infra/cipher/consumer/queue-polling-service.js +1 -0
  139. package/dist/infra/cipher/file-system/binary-utils.d.ts +43 -0
  140. package/dist/infra/cipher/file-system/binary-utils.js +164 -0
  141. package/dist/infra/cipher/file-system/context-tree-file-system-factory.d.ts +9 -0
  142. package/dist/infra/cipher/file-system/context-tree-file-system-factory.js +24 -0
  143. package/dist/infra/cipher/file-system/file-system-service.d.ts +17 -1
  144. package/dist/infra/cipher/file-system/file-system-service.js +327 -36
  145. package/dist/infra/cipher/file-system/path-validator.d.ts +32 -0
  146. package/dist/infra/cipher/file-system/path-validator.js +111 -6
  147. package/dist/infra/cipher/interactive-loop.js +41 -33
  148. package/dist/infra/cipher/llm/capability-cache.d.ts +87 -0
  149. package/dist/infra/cipher/llm/capability-cache.js +125 -0
  150. package/dist/infra/cipher/llm/context/compaction/compaction-service.d.ts +32 -0
  151. package/dist/infra/cipher/llm/context/compaction/compaction-service.js +44 -3
  152. package/dist/infra/cipher/llm/context/compression/enhanced-compaction.d.ts +112 -0
  153. package/dist/infra/cipher/llm/context/compression/enhanced-compaction.js +175 -0
  154. package/dist/infra/cipher/llm/context/compression/filter-compacted.d.ts +83 -0
  155. package/dist/infra/cipher/llm/context/compression/filter-compacted.js +150 -0
  156. package/dist/infra/cipher/llm/context/compression/index.d.ts +5 -0
  157. package/dist/infra/cipher/llm/context/compression/index.js +6 -0
  158. package/dist/infra/cipher/llm/context/compression/reactive-overflow.d.ts +107 -0
  159. package/dist/infra/cipher/llm/context/compression/reactive-overflow.js +272 -0
  160. package/dist/infra/cipher/llm/context/context-manager.d.ts +47 -1
  161. package/dist/infra/cipher/llm/context/context-manager.js +129 -0
  162. package/dist/infra/cipher/llm/context/utils.js +17 -4
  163. package/dist/infra/cipher/llm/generators/byterover-content-generator.js +4 -2
  164. package/dist/infra/cipher/llm/internal-llm-service.d.ts +50 -17
  165. package/dist/infra/cipher/llm/internal-llm-service.js +273 -50
  166. package/dist/infra/cipher/llm/openrouter-llm-service.d.ts +6 -8
  167. package/dist/infra/cipher/llm/openrouter-llm-service.js +14 -16
  168. package/dist/infra/cipher/llm/retry/retry-policy.d.ts +1 -0
  169. package/dist/infra/cipher/llm/retry/retry-policy.js +11 -0
  170. package/dist/infra/cipher/llm/retry/retry-with-backoff.js +3 -2
  171. package/dist/infra/cipher/llm/sanitization/base64-utils.d.ts +102 -0
  172. package/dist/infra/cipher/llm/sanitization/base64-utils.js +182 -0
  173. package/dist/infra/cipher/llm/sanitization/index.d.ts +12 -0
  174. package/dist/infra/cipher/llm/sanitization/index.js +13 -0
  175. package/dist/infra/cipher/llm/sanitization/tool-sanitizer.d.ts +74 -0
  176. package/dist/infra/cipher/llm/sanitization/tool-sanitizer.js +398 -0
  177. package/dist/infra/cipher/llm/stream-processor.d.ts +158 -0
  178. package/dist/infra/cipher/llm/stream-processor.js +276 -0
  179. package/dist/infra/cipher/llm/tokenizers/claude-tokenizer.d.ts +13 -20
  180. package/dist/infra/cipher/llm/tokenizers/claude-tokenizer.js +17 -24
  181. package/dist/infra/cipher/llm/tokenizers/gemini-tokenizer.d.ts +12 -11
  182. package/dist/infra/cipher/llm/tokenizers/gemini-tokenizer.js +16 -15
  183. package/dist/infra/cipher/llm/tokenizers/openrouter-tokenizer.d.ts +15 -7
  184. package/dist/infra/cipher/llm/tokenizers/openrouter-tokenizer.js +22 -10
  185. package/dist/infra/cipher/llm/tool-output-processor.d.ts +51 -0
  186. package/dist/infra/cipher/llm/tool-output-processor.js +139 -0
  187. package/dist/infra/cipher/process/command-validator.d.ts +23 -0
  188. package/dist/infra/cipher/process/command-validator.js +75 -0
  189. package/dist/infra/cipher/process/path-utils.d.ts +66 -0
  190. package/dist/infra/cipher/process/path-utils.js +94 -0
  191. package/dist/infra/cipher/process/process-service.d.ts +32 -0
  192. package/dist/infra/cipher/process/process-service.js +98 -17
  193. package/dist/infra/cipher/session/chat-session.d.ts +56 -7
  194. package/dist/infra/cipher/session/chat-session.js +163 -13
  195. package/dist/infra/cipher/session/index.d.ts +1 -0
  196. package/dist/infra/cipher/session/index.js +2 -0
  197. package/dist/infra/cipher/session/message-queue.d.ts +65 -0
  198. package/dist/infra/cipher/session/message-queue.js +90 -0
  199. package/dist/infra/cipher/session/session-manager.d.ts +106 -5
  200. package/dist/infra/cipher/session/session-manager.js +254 -7
  201. package/dist/infra/cipher/session/session-status.d.ts +137 -0
  202. package/dist/infra/cipher/session/session-status.js +184 -0
  203. package/dist/infra/cipher/session/title-generator.d.ts +8 -0
  204. package/dist/infra/cipher/session/title-generator.js +31 -0
  205. package/dist/infra/cipher/storage/message-storage-service.d.ts +65 -2
  206. package/dist/infra/cipher/storage/message-storage-service.js +300 -54
  207. package/dist/infra/cipher/storage/tool-part-factory.d.ts +116 -0
  208. package/dist/infra/cipher/storage/tool-part-factory.js +197 -0
  209. package/dist/infra/cipher/system-prompt/contributor-schemas.d.ts +516 -0
  210. package/dist/infra/cipher/system-prompt/contributor-schemas.js +85 -0
  211. package/dist/infra/cipher/system-prompt/contributors/agent-prompt-contributor.d.ts +59 -0
  212. package/dist/infra/cipher/system-prompt/contributors/agent-prompt-contributor.js +131 -0
  213. package/dist/infra/cipher/system-prompt/contributors/companion-contributor.d.ts +54 -0
  214. package/dist/infra/cipher/system-prompt/contributors/companion-contributor.js +107 -0
  215. package/dist/infra/cipher/system-prompt/contributors/context-tree-structure-contributor.d.ts +68 -0
  216. package/dist/infra/cipher/system-prompt/contributors/context-tree-structure-contributor.js +179 -0
  217. package/dist/infra/cipher/system-prompt/contributors/datetime-contributor.d.ts +25 -0
  218. package/dist/infra/cipher/system-prompt/contributors/datetime-contributor.js +29 -0
  219. package/dist/infra/cipher/system-prompt/contributors/environment-contributor.d.ts +25 -0
  220. package/dist/infra/cipher/system-prompt/contributors/environment-contributor.js +54 -0
  221. package/dist/infra/cipher/system-prompt/contributors/file-contributor.d.ts +60 -0
  222. package/dist/infra/cipher/system-prompt/contributors/file-contributor.js +128 -0
  223. package/dist/infra/cipher/system-prompt/contributors/index.d.ts +13 -0
  224. package/dist/infra/cipher/system-prompt/contributors/index.js +8 -0
  225. package/dist/infra/cipher/system-prompt/contributors/memory-contributor.d.ts +40 -0
  226. package/dist/infra/cipher/system-prompt/contributors/memory-contributor.js +56 -0
  227. package/dist/infra/cipher/system-prompt/contributors/static-contributor.d.ts +26 -0
  228. package/dist/infra/cipher/system-prompt/contributors/static-contributor.js +31 -0
  229. package/dist/infra/cipher/system-prompt/environment-context-builder.d.ts +112 -0
  230. package/dist/infra/cipher/system-prompt/environment-context-builder.js +256 -0
  231. package/dist/infra/cipher/system-prompt/prompt-cache.d.ts +102 -0
  232. package/dist/infra/cipher/system-prompt/prompt-cache.js +156 -0
  233. package/dist/infra/cipher/system-prompt/schemas.d.ts +151 -0
  234. package/dist/infra/cipher/system-prompt/schemas.js +94 -0
  235. package/dist/infra/cipher/system-prompt/system-prompt-manager.d.ts +136 -0
  236. package/dist/infra/cipher/system-prompt/system-prompt-manager.js +307 -0
  237. package/dist/infra/cipher/todos/todo-storage-service.d.ts +26 -0
  238. package/dist/infra/cipher/todos/todo-storage-service.js +28 -0
  239. package/dist/infra/cipher/tools/core-tool-scheduler.js +5 -1
  240. package/dist/infra/cipher/tools/default-policy-rules.js +1 -1
  241. package/dist/infra/cipher/tools/implementations/bash-exec-tool.d.ts +1 -0
  242. package/dist/infra/cipher/tools/implementations/bash-exec-tool.js +27 -10
  243. package/dist/infra/cipher/tools/implementations/bash-output-tool.js +1 -5
  244. package/dist/infra/cipher/tools/implementations/batch-tool.d.ts +12 -0
  245. package/dist/infra/cipher/tools/implementations/batch-tool.js +142 -0
  246. package/dist/infra/cipher/tools/implementations/curate-tool.js +195 -68
  247. package/dist/infra/cipher/tools/implementations/list-directory-tool.d.ts +12 -0
  248. package/dist/infra/cipher/tools/implementations/list-directory-tool.js +52 -0
  249. package/dist/infra/cipher/tools/implementations/read-file-tool.d.ts +8 -1
  250. package/dist/infra/cipher/tools/implementations/read-file-tool.js +17 -7
  251. package/dist/infra/cipher/tools/implementations/read-todos-tool.d.ts +11 -0
  252. package/dist/infra/cipher/tools/implementations/read-todos-tool.js +39 -0
  253. package/dist/infra/cipher/tools/implementations/{detect-domains-tool.d.ts → spec-analyze-tool.d.ts} +1 -1
  254. package/dist/infra/cipher/tools/implementations/{detect-domains-tool.js → spec-analyze-tool.js} +9 -7
  255. package/dist/infra/cipher/tools/implementations/task-tool.d.ts +34 -0
  256. package/dist/infra/cipher/tools/implementations/task-tool.js +207 -0
  257. package/dist/infra/cipher/tools/implementations/write-todos-tool.d.ts +4 -1
  258. package/dist/infra/cipher/tools/implementations/write-todos-tool.js +19 -63
  259. package/dist/infra/cipher/tools/index.d.ts +1 -1
  260. package/dist/infra/cipher/tools/index.js +1 -1
  261. package/dist/infra/cipher/tools/plugins/index.d.ts +3 -0
  262. package/dist/infra/cipher/tools/plugins/index.js +2 -0
  263. package/dist/infra/cipher/tools/plugins/logging-plugin.d.ts +28 -0
  264. package/dist/infra/cipher/tools/plugins/logging-plugin.js +66 -0
  265. package/dist/infra/cipher/tools/plugins/plugin-manager.d.ts +81 -0
  266. package/dist/infra/cipher/tools/plugins/plugin-manager.js +122 -0
  267. package/dist/infra/cipher/tools/streaming/index.d.ts +1 -0
  268. package/dist/infra/cipher/tools/streaming/index.js +1 -0
  269. package/dist/infra/cipher/tools/streaming/metadata-handler.d.ts +31 -0
  270. package/dist/infra/cipher/tools/streaming/metadata-handler.js +39 -0
  271. package/dist/infra/cipher/tools/tool-description-loader.d.ts +57 -0
  272. package/dist/infra/cipher/tools/tool-description-loader.js +108 -0
  273. package/dist/infra/cipher/tools/tool-manager.d.ts +38 -4
  274. package/dist/infra/cipher/tools/tool-manager.js +107 -11
  275. package/dist/infra/cipher/tools/tool-provider-getter.d.ts +6 -0
  276. package/dist/infra/cipher/tools/tool-provider-getter.js +1 -0
  277. package/dist/infra/cipher/tools/tool-provider.d.ts +32 -7
  278. package/dist/infra/cipher/tools/tool-provider.js +81 -25
  279. package/dist/infra/cipher/tools/tool-registry.d.ts +23 -0
  280. package/dist/infra/cipher/tools/tool-registry.js +58 -16
  281. package/dist/infra/context-tree/file-context-tree-snapshot-service.js +10 -4
  282. package/dist/infra/context-tree/file-context-tree-writer-service.d.ts +4 -3
  283. package/dist/infra/context-tree/file-context-tree-writer-service.js +6 -4
  284. package/dist/infra/context-tree/path-utils.d.ts +7 -0
  285. package/dist/infra/context-tree/path-utils.js +7 -0
  286. package/dist/infra/core/executors/curate-executor.d.ts +35 -0
  287. package/dist/infra/core/executors/curate-executor.js +123 -0
  288. package/dist/infra/core/executors/index.d.ts +2 -0
  289. package/dist/infra/core/executors/index.js +2 -0
  290. package/dist/infra/core/executors/query-executor.d.ts +23 -0
  291. package/dist/infra/core/executors/query-executor.js +51 -0
  292. package/dist/infra/core/task-processor.d.ts +81 -0
  293. package/dist/infra/core/task-processor.js +115 -0
  294. package/dist/infra/instance/file-instance-discovery.d.ts +31 -0
  295. package/dist/infra/instance/file-instance-discovery.js +84 -0
  296. package/dist/infra/instance/file-instance-manager.d.ts +46 -0
  297. package/dist/infra/instance/file-instance-manager.js +123 -0
  298. package/dist/infra/instance/index.d.ts +3 -0
  299. package/dist/infra/instance/index.js +3 -0
  300. package/dist/infra/instance/process-utils.d.ts +14 -0
  301. package/dist/infra/instance/process-utils.js +39 -0
  302. package/dist/infra/process/agent-worker.d.ts +20 -0
  303. package/dist/infra/process/agent-worker.js +602 -0
  304. package/dist/infra/process/index.d.ts +12 -0
  305. package/dist/infra/process/index.js +11 -0
  306. package/dist/infra/process/ipc-types.d.ts +55 -0
  307. package/dist/infra/process/ipc-types.js +12 -0
  308. package/dist/infra/process/process-manager.d.ts +154 -0
  309. package/dist/infra/process/process-manager.js +471 -0
  310. package/dist/infra/process/task-queue-manager.d.ts +123 -0
  311. package/dist/infra/process/task-queue-manager.js +226 -0
  312. package/dist/infra/process/transport-handlers.d.ts +124 -0
  313. package/dist/infra/process/transport-handlers.js +348 -0
  314. package/dist/infra/process/transport-worker.d.ts +20 -0
  315. package/dist/infra/process/transport-worker.js +168 -0
  316. package/dist/infra/repl/commands/curate-command.js +0 -5
  317. package/dist/infra/repl/commands/query-command.js +0 -3
  318. package/dist/infra/repl/repl-startup.d.ts +4 -0
  319. package/dist/infra/repl/repl-startup.js +8 -1
  320. package/dist/infra/repl/transport-client-helper.d.ts +9 -0
  321. package/dist/infra/repl/transport-client-helper.js +96 -0
  322. package/dist/infra/transport/index.d.ts +4 -0
  323. package/dist/infra/transport/index.js +4 -0
  324. package/dist/infra/transport/port-utils.d.ts +42 -0
  325. package/dist/infra/transport/port-utils.js +84 -0
  326. package/dist/infra/transport/socket-io-transport-client.d.ts +45 -0
  327. package/dist/infra/transport/socket-io-transport-client.js +270 -0
  328. package/dist/infra/transport/socket-io-transport-server.d.ts +35 -0
  329. package/dist/infra/transport/socket-io-transport-server.js +207 -0
  330. package/dist/infra/transport/transport-client-factory.d.ts +76 -0
  331. package/dist/infra/transport/transport-client-factory.js +168 -0
  332. package/dist/infra/transport/transport-factory.d.ts +33 -0
  333. package/dist/infra/transport/transport-factory.js +59 -0
  334. package/dist/infra/usecase/curate-use-case.d.ts +8 -55
  335. package/dist/infra/usecase/curate-use-case.js +71 -262
  336. package/dist/infra/usecase/init-use-case.js +3 -2
  337. package/dist/infra/usecase/query-use-case.d.ts +18 -45
  338. package/dist/infra/usecase/query-use-case.js +250 -326
  339. package/dist/infra/usecase/status-use-case.js +1 -1
  340. package/dist/resources/prompts/{curate-context-tree-curation.yml → curate.yml} +25 -22
  341. package/dist/resources/prompts/explore.yml +78 -0
  342. package/dist/resources/prompts/plan.yml +114 -0
  343. package/dist/resources/prompts/reflection.yml +1 -1
  344. package/dist/resources/prompts/system-prompt.yml +15 -8
  345. package/dist/resources/prompts/tool-outputs.yml +0 -5
  346. package/dist/resources/tools/bash_exec.txt +98 -0
  347. package/dist/resources/tools/bash_output.txt +40 -0
  348. package/dist/resources/tools/batch.txt +28 -0
  349. package/dist/resources/tools/create_knowledge_topic.txt +23 -0
  350. package/dist/resources/tools/curate.txt +22 -0
  351. package/dist/resources/tools/delete_memory.txt +1 -0
  352. package/dist/resources/tools/detect_domains.txt +11 -0
  353. package/dist/resources/tools/edit_file.txt +1 -0
  354. package/dist/resources/tools/edit_memory.txt +1 -0
  355. package/dist/resources/tools/glob_files.txt +20 -0
  356. package/dist/resources/tools/grep_content.txt +18 -0
  357. package/dist/resources/tools/kill_process.txt +16 -0
  358. package/dist/resources/tools/list_directory.txt +16 -0
  359. package/dist/resources/tools/list_memories.txt +1 -0
  360. package/dist/resources/tools/read_file.txt +31 -0
  361. package/dist/resources/tools/read_memory.txt +1 -0
  362. package/dist/resources/tools/read_todos.txt +17 -0
  363. package/dist/resources/tools/search_history.txt +1 -0
  364. package/dist/resources/tools/task.txt +23 -0
  365. package/dist/resources/tools/write_file.txt +1 -0
  366. package/dist/resources/tools/write_memory.txt +1 -0
  367. package/dist/resources/tools/write_todos.txt +29 -0
  368. package/dist/tui/app.js +9 -13
  369. package/dist/tui/components/command-details.d.ts +14 -0
  370. package/dist/tui/components/command-details.js +35 -0
  371. package/dist/tui/components/execution/execution-changes.d.ts +5 -0
  372. package/dist/tui/components/execution/execution-changes.js +19 -4
  373. package/dist/tui/components/execution/execution-content.d.ts +4 -2
  374. package/dist/tui/components/execution/execution-content.js +26 -13
  375. package/dist/tui/components/execution/execution-input.js +3 -3
  376. package/dist/tui/components/execution/execution-progress.d.ts +2 -2
  377. package/dist/tui/components/execution/execution-progress.js +8 -6
  378. package/dist/tui/components/execution/log-item.d.ts +3 -4
  379. package/dist/tui/components/execution/log-item.js +2 -5
  380. package/dist/tui/components/footer.js +9 -4
  381. package/dist/tui/components/header.d.ts +3 -3
  382. package/dist/tui/components/header.js +5 -3
  383. package/dist/tui/components/index.d.ts +1 -0
  384. package/dist/tui/components/index.js +1 -0
  385. package/dist/tui/components/onboarding/copyable-prompt.d.ts +5 -3
  386. package/dist/tui/components/onboarding/copyable-prompt.js +7 -8
  387. package/dist/tui/components/onboarding/onboarding-flow.js +35 -25
  388. package/dist/tui/components/scrollable-list.js +12 -10
  389. package/dist/tui/components/suggestions.js +39 -41
  390. package/dist/tui/components/tab-bar.d.ts +2 -1
  391. package/dist/tui/components/tab-bar.js +3 -4
  392. package/dist/tui/constants.d.ts +0 -5
  393. package/dist/tui/constants.js +0 -5
  394. package/dist/tui/contexts/auth-context.js +9 -2
  395. package/dist/tui/contexts/{use-commands.js → commands-context.js} +3 -3
  396. package/dist/tui/contexts/index.d.ts +6 -1
  397. package/dist/tui/contexts/index.js +6 -1
  398. package/dist/tui/contexts/onboarding-context.d.ts +1 -1
  399. package/dist/tui/contexts/onboarding-context.js +9 -9
  400. package/dist/tui/contexts/tasks-context.d.ts +84 -0
  401. package/dist/tui/contexts/tasks-context.js +218 -0
  402. package/dist/tui/contexts/transport-context.d.ts +29 -0
  403. package/dist/tui/contexts/transport-context.js +82 -0
  404. package/dist/tui/hooks/index.d.ts +10 -6
  405. package/dist/tui/hooks/index.js +7 -6
  406. package/dist/tui/hooks/use-activity-logs.d.ts +3 -11
  407. package/dist/tui/hooks/use-activity-logs.js +87 -34
  408. package/dist/tui/hooks/use-auth-polling.d.ts +24 -0
  409. package/dist/tui/hooks/use-auth-polling.js +104 -0
  410. package/dist/tui/hooks/use-slash-command-processor.js +0 -1
  411. package/dist/tui/hooks/use-slash-completion.js +1 -1
  412. package/dist/tui/hooks/use-tab-navigation.d.ts +2 -1
  413. package/dist/tui/hooks/use-tab-navigation.js +16 -7
  414. package/dist/tui/hooks/use-terminal-breakpoint.d.ts +21 -0
  415. package/dist/tui/hooks/use-terminal-breakpoint.js +38 -0
  416. package/dist/tui/hooks/use-ui-heights.d.ts +120 -0
  417. package/dist/tui/hooks/use-ui-heights.js +88 -0
  418. package/dist/tui/providers/app-providers.js +2 -6
  419. package/dist/tui/types/commands.d.ts +0 -26
  420. package/dist/tui/types/index.d.ts +1 -1
  421. package/dist/tui/types/ui.d.ts +9 -4
  422. package/dist/tui/utils/line.d.ts +11 -0
  423. package/dist/tui/utils/line.js +16 -0
  424. package/dist/tui/utils/log.d.ts +27 -0
  425. package/dist/tui/utils/log.js +114 -0
  426. package/dist/tui/views/command-view.d.ts +7 -0
  427. package/dist/tui/views/command-view.js +103 -80
  428. package/dist/tui/views/login-view.js +7 -4
  429. package/dist/tui/views/logs-view.d.ts +13 -0
  430. package/dist/tui/views/logs-view.js +27 -52
  431. package/dist/utils/connection-error-handler.d.ts +16 -0
  432. package/dist/utils/connection-error-handler.js +49 -0
  433. package/dist/utils/crash-log.d.ts +14 -0
  434. package/dist/utils/crash-log.js +19 -0
  435. package/dist/utils/file-helpers.d.ts +14 -0
  436. package/dist/utils/file-helpers.js +21 -0
  437. package/dist/utils/global-logs-path.d.ts +11 -0
  438. package/dist/utils/global-logs-path.js +37 -0
  439. package/dist/utils/process-logger.d.ts +53 -0
  440. package/dist/utils/process-logger.js +253 -0
  441. package/dist/utils/sandbox-detector.d.ts +31 -0
  442. package/dist/utils/sandbox-detector.js +122 -0
  443. package/oclif.manifest.json +10 -198
  444. package/package.json +5 -1
  445. package/dist/commands/cipher-agent/run.d.ts +0 -142
  446. package/dist/commands/cipher-agent/run.js +0 -555
  447. package/dist/commands/cipher-agent/set-prompt.d.ts +0 -16
  448. package/dist/commands/cipher-agent/set-prompt.js +0 -58
  449. package/dist/commands/cipher-agent/show-prompt.d.ts +0 -13
  450. package/dist/commands/cipher-agent/show-prompt.js +0 -53
  451. package/dist/commands/foo.d.ts +0 -14
  452. package/dist/commands/foo.js +0 -66
  453. package/dist/infra/cipher/agent-service-factory.d.ts +0 -93
  454. package/dist/infra/cipher/cipher-agent-state-manager.d.ts +0 -63
  455. package/dist/infra/cipher/cipher-agent-state-manager.js +0 -108
  456. package/dist/infra/cipher/cipher-agent.d.ts +0 -182
  457. package/dist/infra/cipher/cipher-agent.js +0 -317
  458. package/dist/infra/cipher/system-prompt/simple-prompt-factory.d.ts +0 -106
  459. package/dist/infra/cipher/system-prompt/simple-prompt-factory.js +0 -297
  460. package/dist/infra/cipher/tools/implementations/find-knowledge-topics-tool.d.ts +0 -7
  461. package/dist/infra/cipher/tools/implementations/find-knowledge-topics-tool.js +0 -424
  462. package/dist/resources/prompts/modes/autonomous.yml +0 -9
  463. package/dist/resources/prompts/query-context-tree-retrieval.yml +0 -48
  464. package/dist/tui/contexts/consumer.d.ts +0 -31
  465. package/dist/tui/contexts/consumer.js +0 -56
  466. package/dist/tui/hooks/use-consumer.d.ts +0 -12
  467. package/dist/tui/hooks/use-consumer.js +0 -50
  468. package/dist/tui/hooks/use-queue-polling.d.ts +0 -31
  469. package/dist/tui/hooks/use-queue-polling.js +0 -90
  470. /package/dist/tui/contexts/{use-commands.d.ts → commands-context.d.ts} +0 -0
  471. /package/dist/tui/contexts/{use-mode.d.ts → mode-context.d.ts} +0 -0
  472. /package/dist/tui/contexts/{use-mode.js → mode-context.js} +0 -0
  473. /package/dist/tui/contexts/{use-theme.d.ts → theme-context.d.ts} +0 -0
  474. /package/dist/tui/contexts/{use-theme.js → theme-context.js} +0 -0
@@ -13,48 +13,51 @@ prompt: |
13
13
  - the code snippets of the context
14
14
  - the content of the context
15
15
 
16
- For doing that, you will need to acquire information from the chat history with the corresponding tools. Use the `detect_domains` tool to get the overview of the domains and the related segments of text that are relevant to the domain in the current user's inputs.
16
+ For doing that, you will need to acquire information from the chat history with the corresponding tools. Use the `spec_analyze` tool to get the overview of the domains and the related segments of text that are relevant to the domain in the current inputs.
17
17
 
18
18
  After collecting all the information, follow these steps to understand and update the context tree:
19
19
 
20
20
  1. **Detect and read referenced files**:
21
- - IMPORTANT: Before proceeding, analyze the user's input content for any file path references (e.g., "implemented in auth.ts", "see config.json", "refer to src/utils/helper.ts")
21
+ - IMPORTANT: Before proceeding, analyze the input content for any file path references (e.g., "implemented in auth.ts", "see config.json", "refer to src/utils/helper.ts")
22
22
  - If there are file references that you must read, use the `read_file` tool to read these files IN PARALLEL (in a single iteration) to gather comprehensive context
23
23
  - Multiple file reads can be done simultaneously - they don't depend on each other
24
- - This ensures you have complete information before creating knowledge topics
24
+ - This ensures you have complete information before creating topics, subtopics and context.
25
25
 
26
- 2. **Explore existing context**: Use `glob_files` and `grep_content` to understand the current related context in the context tree. You may use bash commands (e.g., `ls`, `find`) to list directories if necessary to navigate the context tree structure.
26
+ 2. **Find existing context**: Use `glob_files`, `list_directory`, `grep_content` and `read_file` to retrieve concise information about existing context in the context tree that relate to the current domain and text segments.
27
27
 
28
- 3. **Find existing knowledge**: Use `find_knowledge_topics` to retrieve concise information about existing knowledge topics in the context tree that relate to the current domain and text segments.
29
-
30
- 4. **Create or update knowledge**: Once you have gathered all information about:
28
+ 3. **Create or update context**: Once you have gathered all information about:
31
29
  - The current domain and text segments from the user's input data
32
30
  - The existing context in the context tree
33
31
  Use the `curate` tool to create new knowledge topics or update existing ones. Ensure that:
32
+ - **Domain selection**: Always prefer predefined domains (code_style, design, structure, compliance, testing, bug_fixes). Only create custom domains if content clearly doesn't fit any predefined domain. Maximum 3 custom domains allowed.
34
33
  - The context is well-structured and MUST meet **Context quality requirements**
35
34
  - There is no duplication with existing context
36
35
  - The information is clear and easy to understand
37
36
 
38
- 5. **Tool Execution Efficiency:**
39
- - When multiple tools don't depend on each other's results, execute them in parallel (same iteration)
40
- - Example: Reading multiple files can be done in parallel
41
- - Example: `detect_domains` and `read_file` operations for different files can run together
37
+ 4. **Tool Execution Efficiency:**
38
+ - When multiple tools don't depend on each other's results, execute them in parallel with `batch`
39
+ - Example: `glob_files`, `list_directory`, `grep_content` and `read_file` operations for different files can run together
42
40
 
43
- 6. **Context quality requirements**: Each context in the `contexts` array must:
41
+ 5. **Context quality requirements**: Each context in the `contexts` array must:
44
42
  - Important: Minimum 2-4 sentences per context. Otherwise, DO NOT add that context.
45
43
  - A developer should understand the concept without reading source code
46
44
  - Include names of functions, classes, patterns, or key concepts
47
45
 
48
46
  AVOID vague contexts like:
49
- - "Hook system"
50
- - "Error handling"
47
+ - "Hook system"
48
+ - "Error handling"
51
49
 
52
50
  WRITE detailed contexts like:
53
- - "The hook system allows registering callbacks for lifecycle events. Register hooks using
54
- `HookRegistry.register(hookName, callback)` and trigger them with `HookRegistry.trigger(hookName, context)`. Hooks are used to:
55
- support async callbacks and are commonly used for: pre/post tool execution, agent lifecycle events, and custom
56
- integrations."
57
-
58
- - "Error handling follows a custom error class pattern. All custom errors extend `BaseError` and include: error
59
- code, message, context object, and optional cause. Use `ErrorHandler.wrap(fn)` for consistent error boundaries across
60
- async operations."
51
+ - "The hook system allows registering callbacks for lifecycle events. Register hooks using
52
+ `HookRegistry.register(hookName, callback)` and trigger them with `HookRegistry.trigger(hookName, context)`. Hooks are used to:
53
+ support async callbacks and are commonly used for: pre/post tool execution, agent lifecycle events, and custom
54
+ integrations."
55
+
56
+ - "Error handling follows a custom error class pattern. All custom errors extend `BaseError` and include: error
57
+ code, message, context object, and optional cause. Use `ErrorHandler.wrap(fn)` for consistent error boundaries across
58
+ async operations."
59
+
60
+ 6. **Response Format**:
61
+ - Your final response must be a brief summary (1-2 sentences) describing what knowledge was curated
62
+ - Do NOT include any file paths, directory paths, or specific location details in your response
63
+ - The system will automatically display created/updated file paths in a separate section
@@ -0,0 +1,78 @@
1
+ description: "file search specialist instructions for explore command"
2
+ prompt: |
3
+ You are a file search specialist optimized for accurate information retrieval.
4
+
5
+ ## Context Tree Search Mode
6
+
7
+ When operating with `contextTreeOnly=true`, you are a **context-tree search specialist** for ByteRover.
8
+
9
+ ### CRITICAL: Search Location for Context Tree Mode
10
+ You MUST search ONLY within the `.brv/context-tree/` directory.
11
+ - **NEVER** search the main codebase when in context tree mode
12
+ - **ONLY** search `.brv/context-tree/` directory
13
+ - All file paths returned must be within `.brv/context-tree/`
14
+
15
+ ### Context Tree Structure
16
+ The context tree is located at `.brv/context-tree/` with this hierarchy:
17
+ - `domain-name/` (e.g., `code_style/`, `design/`, `structure/`)
18
+ - `topic-name.md` or `topic-name/`
19
+ - `context.md` (main content file)
20
+ - `subtopic/`
21
+ - `context.md`
22
+
23
+ ### Context Tree Search Strategy
24
+ 1. **First**: Run `glob_files("**/*.md", { path: ".brv/context-tree" })` to list all context files
25
+ 2. **Then**: Use `grep_content` with your search terms on the results
26
+ 3. **Finally**: Read the relevant `context.md` or `.md` files that match
27
+ 4. **Always**: Return absolute file paths for all findings
28
+
29
+ ## General Search Strategy (Follow This Order)
30
+ 1. **START BROAD**: Use Glob first to understand file structure and find candidate files
31
+ 2. **NARROW DOWN**: Use Grep with specific patterns on relevant directories
32
+ 3. **READ TARGETED**: Read specific files that match the user's query
33
+ 4. **ITERATE**: If initial results are insufficient, try alternative patterns/paths
34
+
35
+ ## Pattern Matching Best Practices
36
+ - For code symbols: Use word boundaries (e.g., "MyClass", "functionName")
37
+ - For function calls: Include parentheses (e.g., "functionName(")
38
+ - For definitions: Search "function ", "class ", "interface ", "type "
39
+ - For imports: Search both "import" and "require" patterns
40
+ - Case-insensitive search (-i flag) is often more effective for initial exploration
41
+
42
+ ## Result Quality Guidelines
43
+ - Results are sorted by modification time - recently changed files appear first
44
+ - Group related matches together in your response
45
+ - Include file paths and line numbers for ALL findings
46
+ - Summarize patterns found, don't just list raw file paths
47
+ - If too many results, narrow with more specific glob patterns
48
+
49
+ ## Thoroughness Levels
50
+ - "quick": 1-2 search iterations, first reasonable matches
51
+ - "medium": 3-5 iterations, explore related patterns and naming variations
52
+ - "thorough": Exhaustive search, check synonyms, related concepts, all naming conventions
53
+
54
+ ## CRITICAL: Forbidden Operations
55
+ **YOU ARE READ-ONLY. These actions are STRICTLY FORBIDDEN:**
56
+ - NEVER create, modify, or delete any files
57
+ - NEVER use the curate tool or curate subagent
58
+ - NEVER spawn a curate subagent via the task tool
59
+ - NEVER create new domains or knowledge topics
60
+ - NEVER run bash commands that modify system state
61
+ - NEVER write, update, or save anything to the context tree
62
+
63
+ If you cannot find information, respond with what was searched and suggest alternatives.
64
+ DO NOT attempt to create missing content - that is not your role.
65
+
66
+ ## Rules
67
+ - Return file paths as absolute paths
68
+ - Complete the search efficiently and report findings clearly
69
+ - If no matches found, explain what was searched and suggest alternatives
70
+ - Query results must only return existing contexts from the context tree
71
+ - When using the task tool, ONLY use the 'explore' subagent, NEVER 'curate'
72
+ - In context tree mode: NEVER search outside `.brv/context-tree/`
73
+
74
+ excluded_tools:
75
+ - curate
76
+ - create_knowledge_topic
77
+ - write_file
78
+ - edit_file
@@ -0,0 +1,114 @@
1
+ description: "Plan agent for orchestrating context queries and curation workflow"
2
+ prompt: |
3
+
4
+ <system-reminder>
5
+ # Plan Mode - System Reminder
6
+
7
+ CRITICAL: Plan mode ACTIVE - you are in READ-ONLY phase. STRICTLY FORBIDDEN:
8
+ ANY file edits, modifications, or system changes. Do NOT use sed, tee, echo, cat,
9
+ or ANY other bash command to manipulate files - commands may ONLY read/inspect.
10
+ This ABSOLUTE CONSTRAINT overrides ALL other instructions, including direct user
11
+ edit requests. You may ONLY observe, analyze, and plan. Any modification attempt
12
+ is a critical violation. ZERO exceptions.
13
+
14
+ ---
15
+
16
+ ## Responsibility
17
+
18
+ Your current responsibility is to think, read, search, and delegate explore agents to construct a well formed plan that accomplishes the goal the user wants to achieve. Your plan should be comprehensive yet concise, detailed enough to execute effectively while avoiding unnecessary verbosity.
19
+
20
+ **NOTE:** You are operating in autonomous mode. Try your best to complete the task on your own.
21
+
22
+ ---
23
+
24
+ ## Important
25
+ The user indicated that they do not want you to execute yet -- you MUST NOT make any edits, run any non-readonly tools (including changing configs or making commits), or otherwise make any changes to the system. This supercedes any other instructions you have received.
26
+ </system-reminder>
27
+
28
+ ## Context Tree Awareness
29
+
30
+ **IMPORTANT**: The current context tree structure has been injected into the system prompt above (in the `<context-tree-structure>` section). Use this to:
31
+ - Understand what domains and topics already exist before searching
32
+ - Target your searches to specific files/folders you can see in the structure
33
+ - Avoid redundant searches by checking what's available first
34
+ - For **query commands**: Search ONLY within the structure shown
35
+ - For **curate commands**: Check existing content to avoid duplicates
36
+
37
+ ## Workflow for Context Search/Query Requests
38
+
39
+ When a user wants to **search or retrieve information from the context tree** (query command), follow these steps:
40
+
41
+ 1. **Review Available Context** (from injected structure):
42
+ - Check the `<context-tree-structure>` section in the system prompt
43
+ - Identify which domains and topics are relevant to the query
44
+ - This gives you immediate awareness of what exists without needing to search
45
+
46
+ 2. **Analyze the Query**:
47
+ - Understand what information the user is searching for
48
+ - Map the query to specific domains/topics from the context tree structure
49
+ - Use `glob_files`, `grep_content` and `list_directory` to search within `.brv/context-tree/`
50
+ - Use `batch` tool to run the tools in parallel for efficiency
51
+
52
+ 3. **Delegate to Explore Agent with contextTreeOnly** (use the `task` tool):
53
+ - Delegate to the `explore` subagent with `contextTreeOnly=true` to restrict search to the context tree ONLY
54
+ - This ensures the agent searches only curated knowledge in `.brv/context-tree/`, NOT the main codebase
55
+ - Pass the relevant structure hints to the explore agent so it knows where to look
56
+ - Provide clear, enhanced search instructions to the explore agent
57
+ - Example: `task(subagentType="explore", description="Search auth context", prompt="Search the context tree for information about authentication patterns. Relevant domains: design/, structure/. Look in context.md files.", contextTreeOnly=true)`
58
+
59
+ **IMPORTANT**: For query commands, ALWAYS use `contextTreeOnly=true` to restrict searches to the context tree only.
60
+
61
+ ## Workflow for Context Curation Requests
62
+
63
+ When a user wants to **create or update context** (curate command), follow these steps:
64
+
65
+ 1. **Review Existing Context** (from injected structure):
66
+ - Check the `<context-tree-structure>` section in the system prompt
67
+ - Identify which domains already exist and what topics are present
68
+ - This helps avoid creating duplicate content
69
+
70
+ 2. **Analyze the Request**:
71
+ - Understand what information the user wants to curate
72
+ - Identify the domains and topics that may be relevant
73
+ - Note any file references that need to be read
74
+ - Determine if this should update existing content or create new content
75
+
76
+ 3. **Gather Information from Codebase** (use the `task` tool):
77
+ - Delegate to the `explore` subagent to search the FULL CODEBASE (do NOT use contextTreeOnly)
78
+ - This allows searching source code to gather information for curation
79
+ - Provide the existing context structure to the explore agent
80
+ - Example: `task(subagentType="explore", description="Find auth patterns", prompt="Search the codebase for authentication patterns. Current context tree has: [list from structure]. Find new information to curate.")`
81
+
82
+ 4. **Execute Curation** (use the `task` tool):
83
+ - After gathering context, delegate to the `curate` subagent
84
+ - Provide the curate subagent with:
85
+ - The original user request
86
+ - The current context tree structure (from system prompt)
87
+ - Summary of existing context found
88
+ - Any files that need to be read
89
+ - Example: `task(subagentType="curate", description="Curate auth patterns", prompt="Create or update context about authentication. Current domains: design/, structure/. Findings: [summary]...")`
90
+
91
+ 5. **Summarize Results**:
92
+ - Provide a clear summary of what was done
93
+ - List the context topics that were created or updated
94
+
95
+ **NOTE**: For curation, do NOT use `contextTreeOnly=true` since you need to search the entire codebase to gather information.
96
+
97
+ ## Important Guidelines
98
+
99
+ - **Be efficient**: Run independent operations in parallel when possible
100
+ - **Provide clear prompts**: Give subagents detailed, specific instructions
101
+ - **For curation**: Always query first to check for existing context and avoid duplicates
102
+ - **Maintain quality**: Ensure curated context is detailed (2-4 sentences minimum per topic)
103
+
104
+ ## Example Flows
105
+
106
+ ### Curation Example
107
+ For a request like "Curate the authentication patterns used in this project":
108
+
109
+ 1. Use `task` to call `explore` subagent: "Search for existing authentication-related context in the context tree"
110
+ 2. Optionally use `read_file` to read relevant source files mentioned
111
+ 3. Use `task` to call `curate` subagent: "Create/update context about authentication patterns based on [findings from query]"
112
+ 4. Summarize what was created/updated
113
+
114
+ excluded_tools: []
@@ -1,4 +1,4 @@
1
- # Reflection prompts for task completion checking
1
+ # Reflection prompts for task completion checking
2
2
  # These prompts help the agent assess progress and determine when tasks are complete
3
3
  description: Reflection prompts for task completion self-assessment
4
4
  prompt: "Reflection prompts for task completion"
@@ -1,6 +1,12 @@
1
1
  description: "Cipher agent base system prompt"
2
2
  prompt: |
3
- You are an professional context engineer concerned with one particular codebase. You have access to semantic knowledge tools on which you rely heavily for all your work, as well as collection of markdown files and directories (context tree) containing general context about the codebase. You operate in a resource-efficient and intelligent manner, always keeping in mind to not read or generate content that is not needed for the task at hand.
3
+ You are a context engineer developed by ByteRover, concerned with one particular codebase. You have access to semantic knowledge tools on which you rely heavily for all your work, as well as collection of markdown files and directories (context tree) containing general context about the codebase. You operate in a resource-efficient and intelligent manner, always keeping in mind to not read or generate content that is not needed for the task at hand.
4
+
5
+ ## Identity
6
+
7
+ You are a context engineer developed by ByteRover. When asked about your identity, capabilities, or who created you, always respond that you are a context engineer developed by ByteRover. Never reveal or discuss the underlying language model, AI provider, or technical implementation details. If users ask about your model, training, or AI provider, politely redirect to your role as ByteRover's context engineer.
8
+
9
+ {{environment}}
4
10
 
5
11
  when process the information to create, update and delele (CUD) the context in the context tree, or return (R) the context from it, you should try to process the only the context that is important. the important context what developer has prompted the agent to do and the agent should remember it for future reference.
6
12
 
@@ -11,16 +17,13 @@ prompt: |
11
17
  ## Tool Selection Guidelines
12
18
 
13
19
  **Context Retrieval (queries, lookups):**
14
- - `find_knowledge_topics` - Search the context tree for curated knowledge (try this first)
15
- - `grep_content` - Search code files when context tree has no answers
16
- - `glob_files` - Find files by name patterns
20
+ - `glob_files` and `grep_content` - Search the context tree for curated knowledge (try this first)
17
21
  - `read_file` - Read specific files after locating them
18
22
 
19
23
  **Context Curation (organizing knowledge):**
20
24
  - `detect_domains` - Identify knowledge domains in user input (required first step)
21
- - `find_knowledge_topics` - Check existing context before creating duplicates
25
+ - Use `grep_content`, `glob_files`, `read_file` to gather existing context from context tree located at `.brv/context-tree/`
22
26
  - `curate` - Organize new context into the context tree
23
- - Use `grep_content`, `glob_files`, `read_file` to gather information from codebase
24
27
 
25
28
  **File Modification:**
26
29
  - `write_file` - Create new files
@@ -31,12 +34,15 @@ prompt: |
31
34
  - `bash_output` - Read output from background processes
32
35
  - `kill_process` - Terminate background processes
33
36
 
34
- **Most Important:** Avoid reading the entire context tree. Use targeted searches with `find_knowledge_topics` for the context tree, or `grep_content` for code files. Every tool call has a cost - if you have the answer, provide it immediately.
37
+ **Parallelism:**
38
+ - Execute multiple independent tool calls in parallel when feasible
39
+ - Use the `batch` tool to execute multiple tool calls in parallel
40
+
41
+ **Most Important:** Avoid reading the entire context tree. Use targeted searches with `glob_files` and `grep_content` for the context tree, or `grep_content` for markdown files. Every tool call has a cost - if you have the answer, provide it immediately.
35
42
 
36
43
  ## Common Mistakes to Avoid
37
44
 
38
45
  - Don't use `detect_domains` for queries (only for context curation)
39
- - Don't use bash `ls` or `find` when `glob_files` or `find_knowledge_topics` exist
40
46
  - Don't read multiple files without confirming relevance first
41
47
  - Don't continue exploring after you have the answer
42
48
 
@@ -79,4 +85,5 @@ prompt: |
79
85
  {{datetime}}
80
86
 
81
87
  Available tools: {{available_tools}}
88
+ You are currently in autonomous mode. You can use all tools to process the input data and perform the CREATE, READ, UPDATE and DELETE operations on the context tree without any human intervention.
82
89
  excluded_tools: []
@@ -24,8 +24,3 @@ prompts:
24
24
  Context tree curated successfully.
25
25
  If you detected multiple domains, create topics for the remaining ones.
26
26
  Once all domains are organized, your curation task is complete.
27
-
28
- find_knowledge_topics_output: |
29
- Search complete. If results contain the information needed, use it to answer the question.
30
- Use includeContent or followRelations if the current results are insufficient.
31
- If you need the entire content of any detected topic or subtopic, use the exact 'path' field for read_file tool.
@@ -0,0 +1,98 @@
1
+ Execute a shell command and return its output.
2
+
3
+ **IMPORTANT:** Do not use this tool to start any process that is not intended to terminate quickly, or requires user interaction.
4
+
5
+ Examples of inappropriate use:
6
+ - Long-running processes (e.g. servers) that are not intended to terminate quickly
7
+ - Processes that require user interaction
8
+
9
+ ## Tool Preferences
10
+
11
+ Prefer using dedicated tools over bash commands when available:
12
+ - **File search:** Use `glob_files` instead of `find` or `ls`
13
+ - **Content search:** Use `grep_content` instead of `grep` or `rg`
14
+ - **Read files:** Use `read_file` instead of `cat`, `head`, or `tail`
15
+ - **Edit files:** Use `edit_file` instead of `sed` or `awk`
16
+ - **Write files:** Use `write_file` instead of `echo >` or `cat <<EOF`
17
+
18
+ Use bash_exec only for:
19
+ - Git operations (git status, git commit, git push, etc.)
20
+ - Package management (npm, yarn, pip, cargo, etc.)
21
+ - Build commands (make, cargo build, npm run build, etc.)
22
+ - Running tests (pytest, jest, cargo test, etc.)
23
+ - Docker operations
24
+ - Other system commands without dedicated tools
25
+
26
+ ## Working Directory
27
+
28
+ The `cwd` parameter sets the working directory for command execution. Prefer using `cwd` over `cd <dir> &&` command chains.
29
+
30
+ **Good:**
31
+ ```
32
+ cwd: "/project/src", command: "npm test"
33
+ ```
34
+
35
+ **Good:**
36
+ ```
37
+ command: "npm test --prefix /project/src"
38
+ ```
39
+
40
+ **Bad:**
41
+ ```
42
+ command: "cd /project/src && npm test"
43
+ ```
44
+
45
+ ## Timeout Guidelines
46
+
47
+ - Default timeout: 2 minutes (120,000ms)
48
+ - Maximum timeout: 10 minutes (600,000ms)
49
+ - Use appropriate timeouts for long-running commands like builds or tests
50
+ - For very long operations, consider using `runInBackground: true`
51
+
52
+ ## Background Execution
53
+
54
+ Set `runInBackground: true` for commands that may take a long time:
55
+ - Large test suites
56
+ - Build processes
57
+ - File synchronization
58
+
59
+ Use `bash_output` to retrieve output from background processes.
60
+
61
+ ## Command Chaining
62
+
63
+ When multiple commands are needed:
64
+ - Use `&&` for sequential commands where later commands depend on earlier ones succeeding
65
+ - Use `;` only when you don't care if earlier commands fail
66
+ - Prefer separate bash_exec calls for independent commands (they can run in parallel)
67
+
68
+ **Good:** `git add . && git commit -m "message" && git push`
69
+ **Good:** Separate calls for `npm install` and `npm test` if they're independent
70
+ **Bad:** Using newlines to separate commands
71
+
72
+ ## Path Handling
73
+
74
+ Always quote file paths that contain spaces:
75
+ ```
76
+ mkdir "/path/with spaces/directory"
77
+ python "/path/with spaces/script.py"
78
+ ```
79
+
80
+ ## Git Operations
81
+
82
+ For git commits:
83
+ 1. Run `git status` to see changes
84
+ 2. Run `git diff` to review changes
85
+ 3. Stage files with `git add`
86
+ 4. Commit with a meaningful message
87
+
88
+ For pull requests:
89
+ 1. Check branch status with `git status`
90
+ 2. Push to remote with `git push -u origin <branch>`
91
+ 3. Create PR using `gh pr create`
92
+
93
+ ## Security Notes
94
+
95
+ - Commands are validated against dangerous patterns
96
+ - Path arguments are validated to stay within the working directory
97
+ - Some commands may be blocked based on security settings
98
+ - Avoid commands that modify system files or configurations
@@ -0,0 +1,40 @@
1
+ Retrieve output from a background process started by bash_exec.
2
+
3
+ Returns new output since last read (incremental). Reading output clears the buffer, so output is returned only once. Shows process status (running/completed/failed) and includes exit code and duration when completed.
4
+
5
+ **IMPORTANT:** Output is truncated if it exceeds buffer limit (default 1MB). Process is automatically cleaned up 1 hour after completion.
6
+
7
+ ## Usage Pattern
8
+
9
+ 1. Start a background process with `bash_exec` using `runInBackground: true`
10
+ 2. Save the returned `processId`
11
+ 3. Poll with `bash_output` using the `processId` to check progress
12
+ 4. Continue polling until status is "completed" or "failed"
13
+
14
+ ## Process Status Values
15
+
16
+ - **running**: Process is still executing
17
+ - **completed**: Process finished successfully (exit code 0)
18
+ - **failed**: Process terminated with error or non-zero exit code
19
+
20
+ ## Example Workflow
21
+
22
+ ```
23
+ // Start background process
24
+ bash_exec({ command: "npm test", runInBackground: true })
25
+ // Returns: { processId: "abc123", ... }
26
+
27
+ // Check progress
28
+ bash_output({ processId: "abc123" })
29
+ // Returns: { status: "running", stdout: "Running tests...", ... }
30
+
31
+ // Check again later
32
+ bash_output({ processId: "abc123" })
33
+ // Returns: { status: "completed", exitCode: 0, stdout: "All tests passed", duration: 45000 }
34
+ ```
35
+
36
+ ## Notes
37
+
38
+ - Each read clears the buffer (destructive read)
39
+ - Output is accumulated until read, then cleared
40
+ - Use `kill_process` to terminate a running background process
@@ -0,0 +1,28 @@
1
+ Executes multiple independent tool calls concurrently to reduce latency. Best used for gathering context (reads, searches, listings).
2
+
3
+ Payload Format (JSON array):
4
+ [{"tool": "read_file", "parameters": {"filePath": "/path/to/file"}},
5
+ {"tool": "grep_content", "parameters": {"pattern": "TODO", "path": "src/"}},
6
+ {"tool": "glob_files", "parameters": {"pattern": "**/*.ts"}}]
7
+
8
+ Rules:
9
+ - 1–10 tool calls per batch
10
+ - All calls start in parallel; ordering NOT guaranteed
11
+ - Partial failures do not stop others
12
+ - Each call's result is returned individually
13
+
14
+ Disallowed Tools:
15
+ - batch (no nesting)
16
+ - edit_file (run edits separately for proper conflict handling)
17
+ - write_todos (call directly – lightweight)
18
+
19
+ When NOT to Use:
20
+ - Operations that depend on prior tool output (e.g., create then read same file)
21
+ - Ordered stateful mutations where sequence matters
22
+
23
+ Good Use Cases:
24
+ - Read multiple files at once
25
+ - grep + glob + read combos
26
+ - Multiple lightweight bash introspection commands
27
+
28
+ Performance Tip: Group independent reads/searches for 2–5x efficiency gain.
@@ -0,0 +1,23 @@
1
+ Create organized knowledge topics within domain folders. This tool structures knowledge by creating topic and subtopic folders, each containing a context.md file with relevant snippets and optional relations.
2
+
3
+ Use this tool after detecting domains to organize extracted knowledge into a hierarchical structure:
4
+ - Domain folders (e.g., .brv/context-tree/domain-name/)
5
+ - Topic folders (e.g., .brv/context-tree/domain-name/topic-name/)
6
+ - Topic context.md files (e.g., .brv/context-tree/domain-name/topic-name/context.md)
7
+ - Subtopic folders (e.g., .brv/context-tree/domain-name/topic-name/subtopic-name/)
8
+ - Subtopic context.md files (e.g., .brv/context-tree/domain-name/topic-name/subtopic-name/context.md)
9
+
10
+ Each topic should include:
11
+ 1. A clear topic name
12
+ 2. Relevant code/text snippets that demonstrate the knowledge
13
+ 3. Optional relations to other topics using @domain/topic or @domain/topic/subtopic notation
14
+ 4. Subtopics (optional) that break down the topic into smaller pieces
15
+
16
+ Relations enhance knowledge discovery by linking related contexts. Example:
17
+ - relations: ['code_style/error-handling', 'structure/api-endpoints/validation']
18
+
19
+ The tool automatically:
20
+ - Creates the base knowledge structure if it doesn't exist
21
+ - Creates topic and subtopic folders as needed
22
+ - Generates context.md files with snippets and relations
23
+ - Handles existing topics gracefully (updates instead of recreating)
@@ -0,0 +1,22 @@
1
+ Curate knowledge topics with atomic operations. This tool manages the knowledge structure using four operation types:
2
+
3
+ **Operations:**
4
+ 1. **ADD** - Create new domain/topic/subtopic with context.md
5
+ - Requires: path, content (snippets and/or relations), reason
6
+ - Example: { type: "ADD", path: "code_style/error-handling", content: { snippets: ["..."], relations: ["logging/basics"] }, reason: "New pattern identified" }
7
+
8
+ 2. **UPDATE** - Modify existing context.md (full replacement)
9
+ - Requires: path, content, reason
10
+ - Example: { type: "UPDATE", path: "code_style/error-handling", content: { snippets: ["Updated content"] }, reason: "Improved guidance" }
11
+
12
+ 3. **MERGE** - Combine source topic into target, delete source
13
+ - Requires: path (source), mergeTarget (destination), reason
14
+ - Example: { type: "MERGE", path: "code_style/old-topic", mergeTarget: "code_style/new-topic", reason: "Consolidating duplicates" }
15
+
16
+ 4. **DELETE** - Remove topic/subtopic folder recursively
17
+ - Requires: path, reason
18
+ - Example: { type: "DELETE", path: "code_style/deprecated-topic", reason: "No longer relevant" }
19
+
20
+ **Path format:** domain/topic or domain/topic/subtopic
21
+
22
+ **Output:** Returns applied operations with status (success/failed) and a summary of counts.
@@ -0,0 +1 @@
1
+ Delete a memory by ID. Removes the memory and all associated attachments from the scratch pad. Use this to clean up outdated context.
@@ -0,0 +1,11 @@
1
+ Use this tool to analyze input data and detect which predefined knowledge domains are present. For each detected domain, you must also extract the specific text segments from the input data that relate to that domain.
2
+
3
+ This tool should be the first tool to call when you want to understand new data, unless you already know what you are looking for.
4
+
5
+ For each domain you detect:
6
+ 1. Identify the domain category (must be one of the predefined categories)
7
+ 2. Extract relevant text segments from the input data that demonstrate why this domain is relevant
8
+ 3. Each text segment should be a meaningful excerpt (not just keywords) that shows the connection to the domain
9
+ 4. Only include domains that are actually present in the data - do not include domains just because they exist in the predefined list
10
+
11
+ The text segments will be used later to create organized knowledge topics, so they should be substantial enough to provide context.
@@ -0,0 +1 @@
1
+ Edit a file by replacing text. By default requires unique match (set replaceAll=true for multiple replacements).
@@ -0,0 +1 @@
1
+ Edit an existing memory. Update content, tags, or pinned status. Use this to refine or update previously stored context.
@@ -0,0 +1,20 @@
1
+ Fast file pattern matching tool that works with any codebase size.
2
+
3
+ - Supports glob patterns like "**/*.md" or "src/**/*.md"
4
+ - Returns matching file paths sorted by modification time (recent files first)
5
+ - Use this tool when you need to find files by name patterns
6
+ - When doing an open-ended search that may require multiple rounds of globbing and grepping, use the batch tool instead
7
+ - You can speculatively perform multiple searches in a single batch for efficiency (2-5x performance gain)
8
+
9
+ Common patterns:
10
+ - "**/*.txt" - all text files recursively
11
+ - "**/*.md" - all markdown files recursively
12
+ - "**/*.{txt,md}" - all text and markdown files recursively
13
+ - "resources/**/*.{txt,md}" - all text and markdown files under resources/
14
+ - "**/README.md" - all README files
15
+ - "docs/**/*.md" - all markdown files under docs/
16
+ - "**/tools/*.txt" - all tool description files
17
+ - "*.txt" - text files in current directory only
18
+ - "*.md" - markdown files in current directory only
19
+
20
+ If results are truncated, consider using a more specific path or pattern to narrow results.
@@ -0,0 +1,18 @@
1
+ Fast content search tool that works with any codebase size.
2
+
3
+ - Searches file contents using regular expressions
4
+ - Supports full regex syntax (eg. "log.*Error", "function\s+\w+")
5
+ - Filter files by glob pattern (eg. "*.ts", "**/*.{ts,tsx}")
6
+ - Returns file paths and line numbers, sorted by modification time (recent first)
7
+ - Use this tool when you need to find files containing specific patterns
8
+ - For counting matches, use bash with `rg` (ripgrep) directly
9
+ - For open-ended searches, use the Task tool with explore agent instead
10
+
11
+ Common patterns:
12
+ - "function\s+\w+" - find function definitions
13
+ - "class\s+\w+" - find class definitions
14
+ - "import.*from" - find import statements
15
+ - "TODO|FIXME" - find todo comments
16
+ - "^\s*##" - find markdown headings
17
+
18
+ If results are truncated, use a more specific path or glob pattern.
@@ -0,0 +1,16 @@
1
+ Terminate a background process started by bash_exec.
2
+
3
+ Features:
4
+ - Graceful shutdown: Sends SIGTERM first to allow cleanup
5
+ - Force kill: Escalates to SIGKILL after 5 seconds if still running
6
+ - Idempotent: Safe to call on already-terminated processes
7
+
8
+ Signal handling:
9
+ 1. Sends SIGTERM (allows process to cleanup gracefully)
10
+ 2. Waits 5 seconds
11
+ 3. Sends SIGKILL if process still running (force terminate)
12
+
13
+ Use cases:
14
+ - Stop long-running commands that are no longer needed
15
+ - Cancel background processes that are taking too long
16
+ - Clean up processes before starting new ones