@afaik-lab/weigh 0.0.0-stage → 0.6.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 (349) hide show
  1. package/.env.example +49 -0
  2. package/LICENSE +373 -0
  3. package/README.md +102 -2
  4. package/dist/agent.d.ts +83 -0
  5. package/dist/agent.d.ts.map +1 -0
  6. package/dist/agent.js +204 -0
  7. package/dist/agent.js.map +1 -0
  8. package/dist/ceilings.d.ts +32 -0
  9. package/dist/ceilings.d.ts.map +1 -0
  10. package/dist/ceilings.js +61 -0
  11. package/dist/ceilings.js.map +1 -0
  12. package/dist/cli.d.ts +3 -0
  13. package/dist/cli.d.ts.map +1 -0
  14. package/dist/cli.js +530 -0
  15. package/dist/cli.js.map +1 -0
  16. package/dist/config-cli.d.ts +15 -0
  17. package/dist/config-cli.d.ts.map +1 -0
  18. package/dist/config-cli.js +132 -0
  19. package/dist/config-cli.js.map +1 -0
  20. package/dist/config.d.ts +198 -0
  21. package/dist/config.d.ts.map +1 -0
  22. package/dist/config.js +373 -0
  23. package/dist/config.js.map +1 -0
  24. package/dist/context-cli.d.ts +35 -0
  25. package/dist/context-cli.d.ts.map +1 -0
  26. package/dist/context-cli.js +251 -0
  27. package/dist/context-cli.js.map +1 -0
  28. package/dist/context.d.ts +118 -0
  29. package/dist/context.d.ts.map +1 -0
  30. package/dist/context.js +159 -0
  31. package/dist/context.js.map +1 -0
  32. package/dist/corrections/correction-set.d.ts +67 -0
  33. package/dist/corrections/correction-set.d.ts.map +1 -0
  34. package/dist/corrections/correction-set.js +104 -0
  35. package/dist/corrections/correction-set.js.map +1 -0
  36. package/dist/corrections/correction.d.ts +74 -0
  37. package/dist/corrections/correction.d.ts.map +1 -0
  38. package/dist/corrections/correction.js +154 -0
  39. package/dist/corrections/correction.js.map +1 -0
  40. package/dist/corrections/follow-up.d.ts +69 -0
  41. package/dist/corrections/follow-up.d.ts.map +1 -0
  42. package/dist/corrections/follow-up.js +217 -0
  43. package/dist/corrections/follow-up.js.map +1 -0
  44. package/dist/corrections/index.d.ts +31 -0
  45. package/dist/corrections/index.d.ts.map +1 -0
  46. package/dist/corrections/index.js +31 -0
  47. package/dist/corrections/index.js.map +1 -0
  48. package/dist/corrections/ledger.d.ts +78 -0
  49. package/dist/corrections/ledger.d.ts.map +1 -0
  50. package/dist/corrections/ledger.js +117 -0
  51. package/dist/corrections/ledger.js.map +1 -0
  52. package/dist/corrections/promotion.d.ts +119 -0
  53. package/dist/corrections/promotion.d.ts.map +1 -0
  54. package/dist/corrections/promotion.js +221 -0
  55. package/dist/corrections/promotion.js.map +1 -0
  56. package/dist/corrections/schema.d.ts +125 -0
  57. package/dist/corrections/schema.d.ts.map +1 -0
  58. package/dist/corrections/schema.js +100 -0
  59. package/dist/corrections/schema.js.map +1 -0
  60. package/dist/corrections-cli.d.ts +28 -0
  61. package/dist/corrections-cli.d.ts.map +1 -0
  62. package/dist/corrections-cli.js +157 -0
  63. package/dist/corrections-cli.js.map +1 -0
  64. package/dist/diff.d.ts +105 -0
  65. package/dist/diff.d.ts.map +1 -0
  66. package/dist/diff.js +202 -0
  67. package/dist/diff.js.map +1 -0
  68. package/dist/doctor.d.ts +38 -0
  69. package/dist/doctor.d.ts.map +1 -0
  70. package/dist/doctor.js +197 -0
  71. package/dist/doctor.js.map +1 -0
  72. package/dist/events.d.ts +21 -0
  73. package/dist/events.d.ts.map +1 -0
  74. package/dist/events.js +5 -0
  75. package/dist/events.js.map +1 -0
  76. package/dist/findings.d.ts +510 -0
  77. package/dist/findings.d.ts.map +1 -0
  78. package/dist/findings.js +645 -0
  79. package/dist/findings.js.map +1 -0
  80. package/dist/follow-up-cli.d.ts +88 -0
  81. package/dist/follow-up-cli.d.ts.map +1 -0
  82. package/dist/follow-up-cli.js +208 -0
  83. package/dist/follow-up-cli.js.map +1 -0
  84. package/dist/harness.d.ts +64 -0
  85. package/dist/harness.d.ts.map +1 -0
  86. package/dist/harness.js +71 -0
  87. package/dist/harness.js.map +1 -0
  88. package/dist/help/command-help.d.ts +9 -0
  89. package/dist/help/command-help.d.ts.map +1 -0
  90. package/dist/help/command-help.js +21 -0
  91. package/dist/help/command-help.js.map +1 -0
  92. package/dist/help/commands/answer.d.ts +3 -0
  93. package/dist/help/commands/answer.d.ts.map +1 -0
  94. package/dist/help/commands/answer.js +39 -0
  95. package/dist/help/commands/answer.js.map +1 -0
  96. package/dist/help/commands/config.d.ts +3 -0
  97. package/dist/help/commands/config.d.ts.map +1 -0
  98. package/dist/help/commands/config.js +25 -0
  99. package/dist/help/commands/config.js.map +1 -0
  100. package/dist/help/commands/context.d.ts +3 -0
  101. package/dist/help/commands/context.d.ts.map +1 -0
  102. package/dist/help/commands/context.js +44 -0
  103. package/dist/help/commands/context.js.map +1 -0
  104. package/dist/help/commands/corrections.d.ts +3 -0
  105. package/dist/help/commands/corrections.d.ts.map +1 -0
  106. package/dist/help/commands/corrections.js +30 -0
  107. package/dist/help/commands/corrections.js.map +1 -0
  108. package/dist/help/commands/doctor.d.ts +3 -0
  109. package/dist/help/commands/doctor.d.ts.map +1 -0
  110. package/dist/help/commands/doctor.js +12 -0
  111. package/dist/help/commands/doctor.js.map +1 -0
  112. package/dist/help/commands/index.d.ts +4 -0
  113. package/dist/help/commands/index.d.ts.map +1 -0
  114. package/dist/help/commands/index.js +27 -0
  115. package/dist/help/commands/index.js.map +1 -0
  116. package/dist/help/commands/memory.d.ts +3 -0
  117. package/dist/help/commands/memory.d.ts.map +1 -0
  118. package/dist/help/commands/memory.js +33 -0
  119. package/dist/help/commands/memory.js.map +1 -0
  120. package/dist/help/commands/models.d.ts +3 -0
  121. package/dist/help/commands/models.d.ts.map +1 -0
  122. package/dist/help/commands/models.js +17 -0
  123. package/dist/help/commands/models.js.map +1 -0
  124. package/dist/help/commands/options.d.ts +4 -0
  125. package/dist/help/commands/options.d.ts.map +1 -0
  126. package/dist/help/commands/options.js +13 -0
  127. package/dist/help/commands/options.js.map +1 -0
  128. package/dist/help/commands/review.d.ts +3 -0
  129. package/dist/help/commands/review.d.ts.map +1 -0
  130. package/dist/help/commands/review.js +50 -0
  131. package/dist/help/commands/review.js.map +1 -0
  132. package/dist/help/commands/sessions.d.ts +3 -0
  133. package/dist/help/commands/sessions.d.ts.map +1 -0
  134. package/dist/help/commands/sessions.js +23 -0
  135. package/dist/help/commands/sessions.js.map +1 -0
  136. package/dist/help/commands/show.d.ts +3 -0
  137. package/dist/help/commands/show.d.ts.map +1 -0
  138. package/dist/help/commands/show.js +18 -0
  139. package/dist/help/commands/show.js.map +1 -0
  140. package/dist/help/help.d.ts +16 -0
  141. package/dist/help/help.d.ts.map +1 -0
  142. package/dist/help/help.js +68 -0
  143. package/dist/help/help.js.map +1 -0
  144. package/dist/help/index.d.ts +4 -0
  145. package/dist/help/index.d.ts.map +1 -0
  146. package/dist/help/index.js +7 -0
  147. package/dist/help/index.js.map +1 -0
  148. package/dist/index.d.ts +80 -0
  149. package/dist/index.d.ts.map +1 -0
  150. package/dist/index.js +51 -0
  151. package/dist/index.js.map +1 -0
  152. package/dist/knowledge/block.d.ts +65 -0
  153. package/dist/knowledge/block.d.ts.map +1 -0
  154. package/dist/knowledge/block.js +89 -0
  155. package/dist/knowledge/block.js.map +1 -0
  156. package/dist/knowledge/claim.d.ts +143 -0
  157. package/dist/knowledge/claim.d.ts.map +1 -0
  158. package/dist/knowledge/claim.js +297 -0
  159. package/dist/knowledge/claim.js.map +1 -0
  160. package/dist/knowledge/index.d.ts +32 -0
  161. package/dist/knowledge/index.d.ts.map +1 -0
  162. package/dist/knowledge/index.js +29 -0
  163. package/dist/knowledge/index.js.map +1 -0
  164. package/dist/knowledge/novelty.d.ts +65 -0
  165. package/dist/knowledge/novelty.d.ts.map +1 -0
  166. package/dist/knowledge/novelty.js +94 -0
  167. package/dist/knowledge/novelty.js.map +1 -0
  168. package/dist/knowledge/recall.d.ts +134 -0
  169. package/dist/knowledge/recall.d.ts.map +1 -0
  170. package/dist/knowledge/recall.js +229 -0
  171. package/dist/knowledge/recall.js.map +1 -0
  172. package/dist/knowledge/recalled-claim.d.ts +35 -0
  173. package/dist/knowledge/recalled-claim.d.ts.map +1 -0
  174. package/dist/knowledge/recalled-claim.js +67 -0
  175. package/dist/knowledge/recalled-claim.js.map +1 -0
  176. package/dist/knowledge/recalled.d.ts +70 -0
  177. package/dist/knowledge/recalled.d.ts.map +1 -0
  178. package/dist/knowledge/recalled.js +149 -0
  179. package/dist/knowledge/recalled.js.map +1 -0
  180. package/dist/knowledge/schema.d.ts +83 -0
  181. package/dist/knowledge/schema.d.ts.map +1 -0
  182. package/dist/knowledge/schema.js +96 -0
  183. package/dist/knowledge/schema.js.map +1 -0
  184. package/dist/knowledge/staleness.d.ts +48 -0
  185. package/dist/knowledge/staleness.d.ts.map +1 -0
  186. package/dist/knowledge/staleness.js +85 -0
  187. package/dist/knowledge/staleness.js.map +1 -0
  188. package/dist/knowledge/store.d.ts +100 -0
  189. package/dist/knowledge/store.d.ts.map +1 -0
  190. package/dist/knowledge/store.js +184 -0
  191. package/dist/knowledge/store.js.map +1 -0
  192. package/dist/memory/compose-file.d.ts +14 -0
  193. package/dist/memory/compose-file.d.ts.map +1 -0
  194. package/dist/memory/compose-file.js +25 -0
  195. package/dist/memory/compose-file.js.map +1 -0
  196. package/dist/memory/index.d.ts +43 -0
  197. package/dist/memory/index.d.ts.map +1 -0
  198. package/dist/memory/index.js +119 -0
  199. package/dist/memory/index.js.map +1 -0
  200. package/dist/memory/oss.d.ts +62 -0
  201. package/dist/memory/oss.d.ts.map +1 -0
  202. package/dist/memory/oss.js +230 -0
  203. package/dist/memory/oss.js.map +1 -0
  204. package/dist/memory/platform.d.ts +37 -0
  205. package/dist/memory/platform.d.ts.map +1 -0
  206. package/dist/memory/platform.js +131 -0
  207. package/dist/memory/platform.js.map +1 -0
  208. package/dist/memory/scope.d.ts +49 -0
  209. package/dist/memory/scope.d.ts.map +1 -0
  210. package/dist/memory/scope.js +70 -0
  211. package/dist/memory/scope.js.map +1 -0
  212. package/dist/memory/types.d.ts +113 -0
  213. package/dist/memory/types.d.ts.map +1 -0
  214. package/dist/memory/types.js +18 -0
  215. package/dist/memory/types.js.map +1 -0
  216. package/dist/memory-cli.d.ts +17 -0
  217. package/dist/memory-cli.d.ts.map +1 -0
  218. package/dist/memory-cli.js +107 -0
  219. package/dist/memory-cli.js.map +1 -0
  220. package/dist/models-cli.d.ts +12 -0
  221. package/dist/models-cli.d.ts.map +1 -0
  222. package/dist/models-cli.js +54 -0
  223. package/dist/models-cli.js.map +1 -0
  224. package/dist/models.d.ts +111 -0
  225. package/dist/models.d.ts.map +1 -0
  226. package/dist/models.js +227 -0
  227. package/dist/models.js.map +1 -0
  228. package/dist/paths.d.ts +35 -0
  229. package/dist/paths.d.ts.map +1 -0
  230. package/dist/paths.js +65 -0
  231. package/dist/paths.js.map +1 -0
  232. package/dist/profile.d.ts +28 -0
  233. package/dist/profile.d.ts.map +1 -0
  234. package/dist/profile.js +154 -0
  235. package/dist/profile.js.map +1 -0
  236. package/dist/progress.d.ts +70 -0
  237. package/dist/progress.d.ts.map +1 -0
  238. package/dist/progress.js +132 -0
  239. package/dist/progress.js.map +1 -0
  240. package/dist/quiet.d.ts +2 -0
  241. package/dist/quiet.d.ts.map +1 -0
  242. package/dist/quiet.js +21 -0
  243. package/dist/quiet.js.map +1 -0
  244. package/dist/reconcile/continuation.d.ts +132 -0
  245. package/dist/reconcile/continuation.d.ts.map +1 -0
  246. package/dist/reconcile/continuation.js +306 -0
  247. package/dist/reconcile/continuation.js.map +1 -0
  248. package/dist/reconcile/index.d.ts +26 -0
  249. package/dist/reconcile/index.d.ts.map +1 -0
  250. package/dist/reconcile/index.js +28 -0
  251. package/dist/reconcile/index.js.map +1 -0
  252. package/dist/reconcile/outcome-set.d.ts +53 -0
  253. package/dist/reconcile/outcome-set.d.ts.map +1 -0
  254. package/dist/reconcile/outcome-set.js +124 -0
  255. package/dist/reconcile/outcome-set.js.map +1 -0
  256. package/dist/reconcile/outcome.d.ts +56 -0
  257. package/dist/reconcile/outcome.d.ts.map +1 -0
  258. package/dist/reconcile/outcome.js +60 -0
  259. package/dist/reconcile/outcome.js.map +1 -0
  260. package/dist/reconcile/reconciliation.d.ts +49 -0
  261. package/dist/reconcile/reconciliation.d.ts.map +1 -0
  262. package/dist/reconcile/reconciliation.js +88 -0
  263. package/dist/reconcile/reconciliation.js.map +1 -0
  264. package/dist/reconcile/schema.d.ts +157 -0
  265. package/dist/reconcile/schema.d.ts.map +1 -0
  266. package/dist/reconcile/schema.js +97 -0
  267. package/dist/reconcile/schema.js.map +1 -0
  268. package/dist/record/index.d.ts +23 -0
  269. package/dist/record/index.d.ts.map +1 -0
  270. package/dist/record/index.js +25 -0
  271. package/dist/record/index.js.map +1 -0
  272. package/dist/record/review-record.d.ts +28 -0
  273. package/dist/record/review-record.d.ts.map +1 -0
  274. package/dist/record/review-record.js +78 -0
  275. package/dist/record/review-record.js.map +1 -0
  276. package/dist/record/schema.d.ts +153 -0
  277. package/dist/record/schema.d.ts.map +1 -0
  278. package/dist/record/schema.js +87 -0
  279. package/dist/record/schema.js.map +1 -0
  280. package/dist/record/store.d.ts +83 -0
  281. package/dist/record/store.d.ts.map +1 -0
  282. package/dist/record/store.js +162 -0
  283. package/dist/record/store.js.map +1 -0
  284. package/dist/record/stored-review.d.ts +36 -0
  285. package/dist/record/stored-review.d.ts.map +1 -0
  286. package/dist/record/stored-review.js +90 -0
  287. package/dist/record/stored-review.js.map +1 -0
  288. package/dist/refute.d.ts +318 -0
  289. package/dist/refute.d.ts.map +1 -0
  290. package/dist/refute.js +513 -0
  291. package/dist/refute.js.map +1 -0
  292. package/dist/render.d.ts +212 -0
  293. package/dist/render.d.ts.map +1 -0
  294. package/dist/render.js +544 -0
  295. package/dist/render.js.map +1 -0
  296. package/dist/review-cli.d.ts +181 -0
  297. package/dist/review-cli.d.ts.map +1 -0
  298. package/dist/review-cli.js +598 -0
  299. package/dist/review-cli.js.map +1 -0
  300. package/dist/reviewer.d.ts +297 -0
  301. package/dist/reviewer.d.ts.map +1 -0
  302. package/dist/reviewer.js +580 -0
  303. package/dist/reviewer.js.map +1 -0
  304. package/dist/session-cli.d.ts +17 -0
  305. package/dist/session-cli.d.ts.map +1 -0
  306. package/dist/session-cli.js +62 -0
  307. package/dist/session-cli.js.map +1 -0
  308. package/dist/session.d.ts +36 -0
  309. package/dist/session.d.ts.map +1 -0
  310. package/dist/session.js +105 -0
  311. package/dist/session.js.map +1 -0
  312. package/dist/settings.d.ts +68 -0
  313. package/dist/settings.d.ts.map +1 -0
  314. package/dist/settings.js +175 -0
  315. package/dist/settings.js.map +1 -0
  316. package/dist/show-cli.d.ts +39 -0
  317. package/dist/show-cli.d.ts.map +1 -0
  318. package/dist/show-cli.js +56 -0
  319. package/dist/show-cli.js.map +1 -0
  320. package/dist/stdout.d.ts +28 -0
  321. package/dist/stdout.d.ts.map +1 -0
  322. package/dist/stdout.js +44 -0
  323. package/dist/stdout.js.map +1 -0
  324. package/dist/target.d.ts +58 -0
  325. package/dist/target.d.ts.map +1 -0
  326. package/dist/target.js +96 -0
  327. package/dist/target.js.map +1 -0
  328. package/dist/tools/index.d.ts +93 -0
  329. package/dist/tools/index.d.ts.map +1 -0
  330. package/dist/tools/index.js +146 -0
  331. package/dist/tools/index.js.map +1 -0
  332. package/dist/tools/root.d.ts +62 -0
  333. package/dist/tools/root.d.ts.map +1 -0
  334. package/dist/tools/root.js +51 -0
  335. package/dist/tools/root.js.map +1 -0
  336. package/dist/usage.d.ts +75 -0
  337. package/dist/usage.d.ts.map +1 -0
  338. package/dist/usage.js +100 -0
  339. package/dist/usage.js.map +1 -0
  340. package/dist/version.d.ts +14 -0
  341. package/dist/version.d.ts.map +1 -0
  342. package/dist/version.js +26 -0
  343. package/dist/version.js.map +1 -0
  344. package/dist/workspace.d.ts +48 -0
  345. package/dist/workspace.d.ts.map +1 -0
  346. package/dist/workspace.js +126 -0
  347. package/dist/workspace.js.map +1 -0
  348. package/docker-compose.yml +61 -0
  349. package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CAAC,EAAE,EAAE,CAAC;SACrB;aACE,MAAM,CAAC,OAAO,CAAC;aACf,IAAI,CAAC,KAAK,CAAC,CAAC;QACf,OAAO,CAAC,KAAK,IAAI,CAAC,IAAI,KAAK,IAAI,CAAC,SAAS,EAAE,EAAE,KAAK,IAAI,EAAE,EAAE,KAAK,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACxG,CAAC;CACF"}
@@ -0,0 +1,32 @@
1
+ /**
2
+ * What Weigh knows about a repository, as opposed to about a change.
3
+ *
4
+ * A review reads code and reports on it. What it cannot read off a diff is what
5
+ * the repository is *like* — which service owns the tokens, which patterns are
6
+ * deliberate, which file everything breaks in. That is written down here, by a
7
+ * priming agent before any review and by Weigh afterwards, and recalled into
8
+ * the review context so a finding about a house convention is never born.
9
+ *
10
+ * One class each: `Claim` is one thing that is true, `Knowledge` is the typed
11
+ * way in and out of the store, and `schema.ts` is the contract every writer is
12
+ * held to. `Recall` is how claims find their way to a change — four mechanisms
13
+ * over three scopes — `KnowledgeBlock` is one labelled group of what it found,
14
+ * and `Recalled` is the whole of it, budgeted and rendered for the prompt.
15
+ * `Novelty` keeps a claim the repository already holds from being written again.
16
+ */
17
+ export { KINDS, SOURCES, claimInputSchema, claimMetadataSchema } from './schema.js';
18
+ export type { ClaimInput, ClaimMetadata, ClaimSource, Kind } from './schema.js';
19
+ export { Claim } from './claim.js';
20
+ export { Knowledge } from './store.js';
21
+ export type { ConfirmAt } from './store.js';
22
+ export { KnowledgeBlock } from './block.js';
23
+ export { RecalledClaim } from './recalled-claim.js';
24
+ export type { Mechanism } from './recalled-claim.js';
25
+ export { Recalled } from './recalled.js';
26
+ export { Recall } from './recall.js';
27
+ export { Novelty } from './novelty.js';
28
+ export type { SkipReason, Skipped } from './novelty.js';
29
+ export { Staleness } from './staleness.js';
30
+ export type { StaleClaim, StaleReason } from './staleness.js';
31
+ export type { ChangeUnderReview, RecallLimits } from './recall.js';
32
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/knowledge/index.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AACpF,YAAY,EAAE,UAAU,EAAE,aAAa,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAChF,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,YAAY,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,YAAY,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,YAAY,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACxD,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,YAAY,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC9D,YAAY,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC"}
@@ -0,0 +1,29 @@
1
+ // This Source Code Form is subject to the terms of the Mozilla Public
2
+ // License, v. 2.0. If a copy of the MPL was not distributed with this
3
+ // file, You can obtain one at https://mozilla.org/MPL/2.0/.
4
+ /**
5
+ * What Weigh knows about a repository, as opposed to about a change.
6
+ *
7
+ * A review reads code and reports on it. What it cannot read off a diff is what
8
+ * the repository is *like* — which service owns the tokens, which patterns are
9
+ * deliberate, which file everything breaks in. That is written down here, by a
10
+ * priming agent before any review and by Weigh afterwards, and recalled into
11
+ * the review context so a finding about a house convention is never born.
12
+ *
13
+ * One class each: `Claim` is one thing that is true, `Knowledge` is the typed
14
+ * way in and out of the store, and `schema.ts` is the contract every writer is
15
+ * held to. `Recall` is how claims find their way to a change — four mechanisms
16
+ * over three scopes — `KnowledgeBlock` is one labelled group of what it found,
17
+ * and `Recalled` is the whole of it, budgeted and rendered for the prompt.
18
+ * `Novelty` keeps a claim the repository already holds from being written again.
19
+ */
20
+ export { KINDS, SOURCES, claimInputSchema, claimMetadataSchema } from './schema.js';
21
+ export { Claim } from './claim.js';
22
+ export { Knowledge } from './store.js';
23
+ export { KnowledgeBlock } from './block.js';
24
+ export { RecalledClaim } from './recalled-claim.js';
25
+ export { Recalled } from './recalled.js';
26
+ export { Recall } from './recall.js';
27
+ export { Novelty } from './novelty.js';
28
+ export { Staleness } from './staleness.js';
29
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/knowledge/index.ts"],"names":[],"mappings":"AAAA,sEAAsE;AACtE,sEAAsE;AACtE,4DAA4D;AAE5D;;;;;;;;;;;;;;;GAeG;AACH,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAEpF,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAEvC,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEvC,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC"}
@@ -0,0 +1,65 @@
1
+ import type { Scope } from '../memory/scope.js';
2
+ import type { Claim } from './claim.js';
3
+ import type { Knowledge } from './store.js';
4
+ /**
5
+ * Why a claim was not written.
6
+ *
7
+ * - `held`: the repository already holds this sentence.
8
+ * - `repeated`: an earlier claim in the same batch says it.
9
+ * - `similar`: a held claim reads closely enough to be the same fact in other
10
+ * words. Not written, so a person or the writer can decide.
11
+ */
12
+ export type SkipReason = 'held' | 'repeated' | 'similar';
13
+ /** A claim that was not written, and the claim it was matched to. */
14
+ export interface Skipped {
15
+ claim: Claim;
16
+ reason: SkipReason;
17
+ /** The claim it matched: one held by the store, or one earlier in the batch. */
18
+ match: Claim;
19
+ }
20
+ /**
21
+ * Which of a batch of claims the repository does not hold yet.
22
+ *
23
+ * `context add` writes whatever it is handed, and the store keeps it word for
24
+ * word. A claim written twice is recalled twice and paid for twice in every
25
+ * review it reaches. A fleet of explorers produces duplicates by construction,
26
+ * so this is what `context add --if-new` runs before it writes.
27
+ *
28
+ * Two checks, because neither is enough alone:
29
+ *
30
+ * - The same sentence, compared after folding case, spacing and a closing
31
+ * full stop. Read from one listing of the scope, not from a search, so
32
+ * whether it is found never depends on a similarity score.
33
+ * - A close match in meaning, for the same fact in other words. Measured on
34
+ * this repository's own claims, reworded duplicates came in at 0.79 – 0.89
35
+ * and related but different claims at 0.71 – 0.74. Too close for a number to
36
+ * decide alone, so a claim above the floor is held back and named with its
37
+ * match, never dropped silently and never written on a guess.
38
+ *
39
+ * Held to the vector similarity, not the search's score: mem0 blends keyword
40
+ * and entity matches into that and scales it by what else the search found,
41
+ * so one pair scored 0.92 in one store and 0.49 in another. The search is by
42
+ * the statement alone. The stored text carries the cited paths too, and
43
+ * searching with them pushed every claim about the same files towards the
44
+ * floor, related or not.
45
+ */
46
+ export declare class Novelty {
47
+ private readonly _knowledge;
48
+ /** The score at which a held claim counts as the same fact. 1 checks exact repeats only. */
49
+ private readonly _similar;
50
+ /** How many similarity searches run at once. */
51
+ private static readonly _PARALLEL;
52
+ constructor(_knowledge: Knowledge,
53
+ /** The score at which a held claim counts as the same fact. 1 checks exact repeats only. */
54
+ _similar: number);
55
+ /** The claims to write, and the ones held back with what they matched. */
56
+ sift(claims: readonly Claim[], scope: Scope): Promise<{
57
+ fresh: Claim[];
58
+ skipped: Skipped[];
59
+ }>;
60
+ /** The closest held claim at or above the floor, if there is one. */
61
+ private _nearest;
62
+ /** A statement with case, spacing and a closing full stop folded away. */
63
+ private static _key;
64
+ }
65
+ //# sourceMappingURL=novelty.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"novelty.d.ts","sourceRoot":"","sources":["../../src/knowledge/novelty.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACxC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAE5C;;;;;;;GAOG;AACH,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,UAAU,GAAG,SAAS,CAAC;AAEzD,qEAAqE;AACrE,MAAM,WAAW,OAAO;IACtB,KAAK,EAAE,KAAK,CAAC;IACb,MAAM,EAAE,UAAU,CAAC;IACnB,gFAAgF;IAChF,KAAK,EAAE,KAAK,CAAC;CACd;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,qBAAa,OAAO;IAKhB,OAAO,CAAC,QAAQ,CAAC,UAAU;IAC3B,4FAA4F;IAC5F,OAAO,CAAC,QAAQ,CAAC,QAAQ;IAN3B,gDAAgD;IAChD,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,SAAS,CAAK;IAEtC,YACmB,UAAU,EAAE,SAAS;IACtC,4FAA4F;IAC3E,QAAQ,EAAE,MAAM,EAC/B;IAEJ,0EAA0E;IACpE,IAAI,CAAC,MAAM,EAAE,SAAS,KAAK,EAAE,EAAE,KAAK,EAAE,KAAK,GAAG,OAAO,CAAC;QAAE,KAAK,EAAE,KAAK,EAAE,CAAC;QAAC,OAAO,EAAE,OAAO,EAAE,CAAA;KAAE,CAAC,CAiClG;IAED,qEAAqE;YACvD,QAAQ;IAStB,0EAA0E;IAC1E,OAAO,CAAC,MAAM,CAAC,IAAI;CAGpB"}
@@ -0,0 +1,94 @@
1
+ // This Source Code Form is subject to the terms of the Mozilla Public
2
+ // License, v. 2.0. If a copy of the MPL was not distributed with this
3
+ // file, You can obtain one at https://mozilla.org/MPL/2.0/.
4
+ import PQueue from 'p-queue';
5
+ /**
6
+ * Which of a batch of claims the repository does not hold yet.
7
+ *
8
+ * `context add` writes whatever it is handed, and the store keeps it word for
9
+ * word. A claim written twice is recalled twice and paid for twice in every
10
+ * review it reaches. A fleet of explorers produces duplicates by construction,
11
+ * so this is what `context add --if-new` runs before it writes.
12
+ *
13
+ * Two checks, because neither is enough alone:
14
+ *
15
+ * - The same sentence, compared after folding case, spacing and a closing
16
+ * full stop. Read from one listing of the scope, not from a search, so
17
+ * whether it is found never depends on a similarity score.
18
+ * - A close match in meaning, for the same fact in other words. Measured on
19
+ * this repository's own claims, reworded duplicates came in at 0.79 – 0.89
20
+ * and related but different claims at 0.71 – 0.74. Too close for a number to
21
+ * decide alone, so a claim above the floor is held back and named with its
22
+ * match, never dropped silently and never written on a guess.
23
+ *
24
+ * Held to the vector similarity, not the search's score: mem0 blends keyword
25
+ * and entity matches into that and scales it by what else the search found,
26
+ * so one pair scored 0.92 in one store and 0.49 in another. The search is by
27
+ * the statement alone. The stored text carries the cited paths too, and
28
+ * searching with them pushed every claim about the same files towards the
29
+ * floor, related or not.
30
+ */
31
+ export class Novelty {
32
+ _knowledge;
33
+ _similar;
34
+ /** How many similarity searches run at once. */
35
+ static _PARALLEL = 8;
36
+ constructor(_knowledge,
37
+ /** The score at which a held claim counts as the same fact. 1 checks exact repeats only. */
38
+ _similar) {
39
+ this._knowledge = _knowledge;
40
+ this._similar = _similar;
41
+ }
42
+ /** The claims to write, and the ones held back with what they matched. */
43
+ async sift(claims, scope) {
44
+ const held = new Map();
45
+ for (const claim of await this._knowledge.list(scope)) {
46
+ const key = Novelty._key(claim);
47
+ if (!held.has(key))
48
+ held.set(key, claim);
49
+ }
50
+ const unseen = [];
51
+ const skipped = [];
52
+ const batch = new Map();
53
+ for (const claim of claims) {
54
+ const key = Novelty._key(claim);
55
+ const same = held.get(key);
56
+ const earlier = batch.get(key);
57
+ if (same)
58
+ skipped.push({ claim, reason: 'held', match: same });
59
+ else if (earlier)
60
+ skipped.push({ claim, reason: 'repeated', match: earlier });
61
+ else {
62
+ batch.set(key, claim);
63
+ unseen.push(claim);
64
+ }
65
+ }
66
+ if (this._similar >= 1 || unseen.length === 0)
67
+ return { fresh: unseen, skipped };
68
+ const queue = new PQueue({ concurrency: Novelty._PARALLEL });
69
+ const nearest = await queue.addAll(unseen.map((claim) => () => this._nearest(claim, scope)));
70
+ const fresh = [];
71
+ for (const [i, claim] of unseen.entries()) {
72
+ const match = nearest[i];
73
+ if (match)
74
+ skipped.push({ claim, reason: 'similar', match });
75
+ else
76
+ fresh.push(claim);
77
+ }
78
+ return { fresh, skipped };
79
+ }
80
+ /** The closest held claim at or above the floor, if there is one. */
81
+ async _nearest(claim, scope) {
82
+ const near = await this._knowledge.search(claim.statement, scope, { topK: 3, threshold: this._similar });
83
+ // Checked here as well: a backend that ignores the threshold must not
84
+ // turn every nearest neighbour into a duplicate. Similarity alone where
85
+ // the backend reports it, since a blended score moves with the store.
86
+ const close = (one) => one.similarity ?? one.score ?? 0;
87
+ return near.filter((one) => close(one) >= this._similar).sort((a, b) => close(b) - close(a))[0];
88
+ }
89
+ /** A statement with case, spacing and a closing full stop folded away. */
90
+ static _key(claim) {
91
+ return claim.statement.toLowerCase().replace(/\s+/g, ' ').trim().replace(/[.;]+$/, '');
92
+ }
93
+ }
94
+ //# sourceMappingURL=novelty.js.map
@@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7D,KAAK,CAAC,QAAQ,CAAC,KAAY,EAAE,KAAY;QAC/C,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,KAAK,CAAC,SAAS,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE,SAAS,EAAE,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC;QACzG,sEAAsE;QACtE,wEAAwE;QACxE,sEAAsE;QACtE,MAAM,KAAK,GAAG,CAAC,GAAU,EAAE,EAAE,CAAC,GAAG,CAAC,UAAU,IAAI,GAAG,CAAC,KAAK,IAAI,CAAC,CAAC;QAC/D,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAClG,CAAC;IAED,0EAA0E;IAClE,MAAM,CAAC,IAAI,CAAC,KAAY;QAC9B,OAAO,KAAK,CAAC,SAAS,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;IACzF,CAAC;CACF"}
@@ -0,0 +1,134 @@
1
+ import type { ChangedFile } from '../diff.js';
2
+ import { Recalled } from './recalled.js';
3
+ import type { Knowledge } from './store.js';
4
+ /**
5
+ * The numbers the retrieval is tuned by.
6
+ *
7
+ * All of them provisional, and all of them settings, because this is a
8
+ * retrieval design and a retrieval design is only as good as its measurements.
9
+ * `weigh context recall` prints what each one lets through.
10
+ */
11
+ export interface RecallLimits {
12
+ /** Relevance a proximity hit needs. Below this it is noise with a score. */
13
+ threshold: number;
14
+ /** Claims per changed-file query. */
15
+ perFile: number;
16
+ /** Changed files queried by proximity, code first. */
17
+ files: number;
18
+ /** Proximity hits kept across the whole repository scope. */
19
+ repoCap: number;
20
+ /** Claims listed from user scope. */
21
+ userCap: number;
22
+ /** Repository claims enumerated for the always-injected and glob mechanisms. */
23
+ scan: number;
24
+ /** Characters of claims to inline. */
25
+ budget: number;
26
+ }
27
+ /** The change the claims are being found for. */
28
+ export interface ChangeUnderReview {
29
+ /**
30
+ * The repository the claims are about: the user's checkout, not the
31
+ * workspace, which in worktree mode is a disposable clone under the cache.
32
+ */
33
+ target: string;
34
+ branch: string | null;
35
+ files: readonly ChangedFile[];
36
+ }
37
+ /**
38
+ * Finds what Weigh knows that bears on one change.
39
+ *
40
+ * Four mechanisms, each matched to what it is good at:
41
+ *
42
+ * - **Always injected** — a claim marked `applies: ["*"]`. These are the rules
43
+ * of the house: a sentence each, a few dozen at most, and their whole purpose
44
+ * is to shape every judgement. You do not search for them, you post them on
45
+ * the wall.
46
+ * - **Path matched** — a claim whose glob names a changed file. A guarantee,
47
+ * not a ranking: the glob is how a writer says "this governs these files",
48
+ * and a guarantee that competed with a similarity score would not be one.
49
+ * - **Proximity, queried from the hunks** — the mechanism that earns the vector
50
+ * store. What carries meaning in a change is its code: the identifiers, the
51
+ * imports, the call sites. A hunk that adds a call to the Volvo API embeds
52
+ * next to "all Volvo API calls go through VolvoAuthService" because they
53
+ * share the concept, and no glob on the API package would have caught it.
54
+ * Queried per changed file rather than over the whole diff, which is a blur
55
+ * that matches nothing well — and queried from the code rather than the path,
56
+ * because "TypeScript files do not use semicolons" has almost nothing in
57
+ * common with the string `src/record/store.ts`.
58
+ * - **Listed** — the thread on this branch, and user scope. Relevance plays no
59
+ * part in either: a correction must never be the eleventh most relevant and
60
+ * therefore absent, and user scope is small enough to read in full.
61
+ *
62
+ * Nothing here fails a review. Memory is an enhancement, so a backend that is
63
+ * down costs the run its context and says so, exactly as recall does on the
64
+ * prompt path.
65
+ */
66
+ export declare class Recall {
67
+ private readonly _knowledge;
68
+ private readonly _limits;
69
+ private readonly _onWarn?;
70
+ constructor(_knowledge: Knowledge, _limits: RecallLimits, _onWarn?: ((message: string) => void) | undefined);
71
+ for(change: ChangeUnderReview): Promise<Recalled>;
72
+ /** Repository scope: the house rules, the globs, then the proximity hits. */
73
+ private _repo;
74
+ /**
75
+ * The repository claims nearest the hunks, best first.
76
+ *
77
+ * Ranked across the whole scope and capped there, rather than per file: ten
78
+ * files that all touch the same service should not each contribute their own
79
+ * third-best match.
80
+ */
81
+ private _nearby;
82
+ /**
83
+ * Target scope: the thread on this change, listed in full.
84
+ *
85
+ * Uncapped and unsearched. This is where a human's correction lives, and a
86
+ * cosine score is a poor thing to stake "did the reviewer see that you said
87
+ * this was deliberate" on.
88
+ */
89
+ private _thread;
90
+ /**
91
+ * User scope: small, and always in.
92
+ *
93
+ * Read wide and filtered here, because user scope is the one scope that
94
+ * filters on nothing narrower than the user — a list at that scope answers
95
+ * with every repository's claims as well, which would put another project's
96
+ * conventions in front of this review under the heading of how you work.
97
+ * What belongs in this block is what was written with no scope at all.
98
+ */
99
+ private _reviewer;
100
+ /**
101
+ * The changed files worth embedding: code first, and the biggest change
102
+ * within each group.
103
+ *
104
+ * A deleted file still carries signal — the code that went is as much a clue
105
+ * to what this change is about as the code that arrived — but a binary has
106
+ * nothing to embed and a lockfile embeds to nothing useful.
107
+ *
108
+ * Size alone would be the wrong order. A README rewritten in one sitting is
109
+ * four hundred changed lines of prose that no claim is phrased in, and it
110
+ * would take a query slot from the six-line change to the service the claims
111
+ * are actually about. So the comparison by size happens inside a group and
112
+ * never across one, and the files most likely to sit near a claim are the
113
+ * ones that survive the cap.
114
+ */
115
+ private static _queryable;
116
+ /** 0 for code, 1 for the prose and data around it. */
117
+ private static _group;
118
+ /** How much of the file this change touched. */
119
+ private static _churn;
120
+ /**
121
+ * One file's change as a query.
122
+ *
123
+ * Diff markers and hunk headers come off: `@@ -1,7 +1,9 @@` is noise in an
124
+ * embedding, and a leading `+` makes two copies of the same line of code look
125
+ * like two different strings. The path leads, because it is weak signal that
126
+ * costs nothing beside the code.
127
+ */
128
+ private static _query;
129
+ /** How many searches a recall has in flight at once. */
130
+ private static readonly _PARALLEL;
131
+ /** A read that costs the review its context rather than its run. */
132
+ private _safe;
133
+ }
134
+ //# sourceMappingURL=recall.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"recall.d.ts","sourceRoot":"","sources":["../../src/knowledge/recall.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAI9C,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAE5C;;;;;;GAMG;AACH,MAAM,WAAW,YAAY;IAC3B,4EAA4E;IAC5E,SAAS,EAAE,MAAM,CAAC;IAClB,qCAAqC;IACrC,OAAO,EAAE,MAAM,CAAC;IAChB,sDAAsD;IACtD,KAAK,EAAE,MAAM,CAAC;IACd,6DAA6D;IAC7D,OAAO,EAAE,MAAM,CAAC;IAChB,qCAAqC;IACrC,OAAO,EAAE,MAAM,CAAC;IAChB,gFAAgF;IAChF,IAAI,EAAE,MAAM,CAAC;IACb,sCAAsC;IACtC,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,iDAAiD;AACjD,MAAM,WAAW,iBAAiB;IAChC;;;OAGG;IACH,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,KAAK,EAAE,SAAS,WAAW,EAAE,CAAC;CAC/B;AAeD;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,qBAAa,MAAM;IAEf,OAAO,CAAC,QAAQ,CAAC,UAAU;IAC3B,OAAO,CAAC,QAAQ,CAAC,OAAO;IACxB,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC;IAH3B,YACmB,UAAU,EAAE,SAAS,EACrB,OAAO,EAAE,YAAY,EACrB,OAAO,CAAC,GAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,aAAA,EAClD;IAEE,GAAG,CAAC,MAAM,EAAE,iBAAiB,GAAG,OAAO,CAAC,QAAQ,CAAC,CAqBtD;IAED,6EAA6E;YAC/D,KAAK;IA+BnB;;;;;;OAMG;YACW,OAAO;IA4CrB;;;;;;OAMG;YACW,OAAO;IAUrB;;;;;;;;OAQG;YACW,SAAS;IAavB;;;;;;;;;;;;;;OAcG;IACH,OAAO,CAAC,MAAM,CAAC,UAAU;IAOzB,sDAAsD;IACtD,OAAO,CAAC,MAAM,CAAC,MAAM;IAIrB,gDAAgD;IAChD,OAAO,CAAC,MAAM,CAAC,MAAM;IAIrB;;;;;;;OAOG;IACH,OAAO,CAAC,MAAM,CAAC,MAAM;IAYrB,wDAAwD;IACxD,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,SAAS,CAAK;IAEtC,oEAAoE;YACtD,KAAK;CAQpB"}
@@ -0,0 +1,229 @@
1
+ // This Source Code Form is subject to the terms of the Mozilla Public
2
+ // License, v. 2.0. If a copy of the MPL was not distributed with this
3
+ // file, You can obtain one at https://mozilla.org/MPL/2.0/.
4
+ import PQueue from 'p-queue';
5
+ import { looksGenerated } from '../context.js';
6
+ import { Scope } from '../memory/scope.js';
7
+ import { KnowledgeBlock } from './block.js';
8
+ import { Recalled } from './recalled.js';
9
+ /** Characters of hunk text that go into one proximity query. */
10
+ const QUERY_CHARS = 2_000;
11
+ /**
12
+ * Paths whose size says little about what a change is about.
13
+ *
14
+ * Prose and data, by extension and by the handful of conventional names that
15
+ * carry none. Not excluded — a claim can be about where the docs live — only
16
+ * queried after the code.
17
+ */
18
+ const PROSE_OR_DATA = /\.(md|mdx|markdown|rst|adoc|txt|json|jsonc|ya?ml|toml|ini|csv|tsv|svg)$|(^|\/)(LICENSE|NOTICE|CHANGELOG|AUTHORS|CODEOWNERS)$/i;
19
+ /**
20
+ * Finds what Weigh knows that bears on one change.
21
+ *
22
+ * Four mechanisms, each matched to what it is good at:
23
+ *
24
+ * - **Always injected** — a claim marked `applies: ["*"]`. These are the rules
25
+ * of the house: a sentence each, a few dozen at most, and their whole purpose
26
+ * is to shape every judgement. You do not search for them, you post them on
27
+ * the wall.
28
+ * - **Path matched** — a claim whose glob names a changed file. A guarantee,
29
+ * not a ranking: the glob is how a writer says "this governs these files",
30
+ * and a guarantee that competed with a similarity score would not be one.
31
+ * - **Proximity, queried from the hunks** — the mechanism that earns the vector
32
+ * store. What carries meaning in a change is its code: the identifiers, the
33
+ * imports, the call sites. A hunk that adds a call to the Volvo API embeds
34
+ * next to "all Volvo API calls go through VolvoAuthService" because they
35
+ * share the concept, and no glob on the API package would have caught it.
36
+ * Queried per changed file rather than over the whole diff, which is a blur
37
+ * that matches nothing well — and queried from the code rather than the path,
38
+ * because "TypeScript files do not use semicolons" has almost nothing in
39
+ * common with the string `src/record/store.ts`.
40
+ * - **Listed** — the thread on this branch, and user scope. Relevance plays no
41
+ * part in either: a correction must never be the eleventh most relevant and
42
+ * therefore absent, and user scope is small enough to read in full.
43
+ *
44
+ * Nothing here fails a review. Memory is an enhancement, so a backend that is
45
+ * down costs the run its context and says so, exactly as recall does on the
46
+ * prompt path.
47
+ */
48
+ export class Recall {
49
+ _knowledge;
50
+ _limits;
51
+ _onWarn;
52
+ constructor(_knowledge, _limits, _onWarn) {
53
+ this._knowledge = _knowledge;
54
+ this._limits = _limits;
55
+ this._onWarn = _onWarn;
56
+ }
57
+ async for(change) {
58
+ const repo = new KnowledgeBlock('This repository', 'House rules, and what is recorded about the files in this change.', 1);
59
+ const thread = new KnowledgeBlock('This change', 'What has already been said about the work on this branch.', 0);
60
+ const reviewer = new KnowledgeBlock('How you review', 'What holds wherever this reviewer is working, repository or not.', 2);
61
+ // Independent reads against three scopes, so they go out together.
62
+ await Promise.all([this._repo(repo, change), this._thread(thread, change), this._reviewer(reviewer)]);
63
+ return new Recalled([repo, thread, reviewer], this._limits.budget);
64
+ }
65
+ /** Repository scope: the house rules, the globs, then the proximity hits. */
66
+ async _repo(block, change) {
67
+ const scope = Scope.repo(change.target);
68
+ const known = await this._safe('what this repository is like', () => this._knowledge.list(scope, this._limits.scan));
69
+ // A listing that came back full is a listing with more behind it, and the
70
+ // two mechanisms below are guarantees — so say it rather than quietly
71
+ // guaranteeing less than was asked for.
72
+ if (known.length >= this._limits.scan) {
73
+ this._onWarn?.(`read the first ${this._limits.scan} claims about this repository; there may be more (WEIGH_KNOWLEDGE_SCAN)`);
74
+ }
75
+ for (const claim of known) {
76
+ if (claim.isHouseRule)
77
+ block.add(claim, 'always');
78
+ }
79
+ const paths = change.files.map((file) => file.path);
80
+ for (const claim of known) {
81
+ if (claim.isHouseRule)
82
+ continue;
83
+ const hit = paths.find((path) => claim.appliesTo(path));
84
+ if (hit)
85
+ block.add(claim, 'path', hit);
86
+ }
87
+ for (const near of await this._nearby(scope, change, block)) {
88
+ block.add(near.claim, 'proximity', near.path);
89
+ }
90
+ }
91
+ /**
92
+ * The repository claims nearest the hunks, best first.
93
+ *
94
+ * Ranked across the whole scope and capped there, rather than per file: ten
95
+ * files that all touch the same service should not each contribute their own
96
+ * third-best match.
97
+ */
98
+ async _nearby(scope, change, block) {
99
+ const files = Recall._queryable(change.files, this._limits.files);
100
+ // One search per file, a few at a time. Each failure is caught by _safe,
101
+ // so addAll never rejects and one bad file costs only its own claims.
102
+ const queue = new PQueue({ concurrency: Recall._PARALLEL });
103
+ const found = await queue.addAll(files.map((file) => () => this._safe(`claims near ${file.path}`, () => this._knowledge.search(Recall._query(file), scope, {
104
+ topK: this._limits.perFile,
105
+ threshold: this._limits.threshold,
106
+ }))));
107
+ const seen = new Set();
108
+ return files
109
+ .flatMap((file, i) => (found[i] ?? []).map((claim) => ({ claim, path: file.path })))
110
+ .filter(({ claim }) => {
111
+ // The floor is applied here as well as passed to the backend. One of
112
+ // the two adapters forwards it to a vector store and the other hands
113
+ // it to a hosted API, and a floor that is only a request is not a
114
+ // floor — this is the number `weigh context recall` is calibrated
115
+ // against, so it has to mean the same thing on both. A hit with no
116
+ // score at all is kept: that is a backend reporting nothing, not a
117
+ // claim scoring zero.
118
+ if (claim.score !== undefined && claim.score < this._limits.threshold)
119
+ return false;
120
+ const key = claim.id ?? claim.statement;
121
+ // Deduped before the cap, not after: the same claim found by four
122
+ // files must not spend four of the ten places.
123
+ if (seen.has(key) || block.has(claim))
124
+ return false;
125
+ seen.add(key);
126
+ return true;
127
+ })
128
+ .sort((a, b) => (b.claim.score ?? 0) - (a.claim.score ?? 0))
129
+ .slice(0, this._limits.repoCap);
130
+ }
131
+ /**
132
+ * Target scope: the thread on this change, listed in full.
133
+ *
134
+ * Uncapped and unsearched. This is where a human's correction lives, and a
135
+ * cosine score is a poor thing to stake "did the reviewer see that you said
136
+ * this was deliberate" on.
137
+ */
138
+ async _thread(block, change) {
139
+ // A detached HEAD has no branch, and the thread is keyed to one: there is
140
+ // nothing that makes a claim belong to this change rather than another.
141
+ if (!change.branch)
142
+ return;
143
+ const scope = Scope.target(change.target, change.branch);
144
+ for (const claim of await this._safe('what was said about this change', () => this._knowledge.list(scope))) {
145
+ block.add(claim, 'listed');
146
+ }
147
+ }
148
+ /**
149
+ * User scope: small, and always in.
150
+ *
151
+ * Read wide and filtered here, because user scope is the one scope that
152
+ * filters on nothing narrower than the user — a list at that scope answers
153
+ * with every repository's claims as well, which would put another project's
154
+ * conventions in front of this review under the heading of how you work.
155
+ * What belongs in this block is what was written with no scope at all.
156
+ */
157
+ async _reviewer(block) {
158
+ const everything = await this._safe('how you review', () => this._knowledge.list(Scope.user(), this._limits.scan));
159
+ const mine = everything.filter((claim) => !claim.scope);
160
+ if (everything.length >= this._limits.scan && mine.length < this._limits.userCap) {
161
+ this._onWarn?.(`read the first ${this._limits.scan} memories looking for what holds everywhere; there may be more (WEIGH_KNOWLEDGE_SCAN)`);
162
+ }
163
+ for (const claim of mine.slice(0, this._limits.userCap))
164
+ block.add(claim, 'listed');
165
+ }
166
+ /**
167
+ * The changed files worth embedding: code first, and the biggest change
168
+ * within each group.
169
+ *
170
+ * A deleted file still carries signal — the code that went is as much a clue
171
+ * to what this change is about as the code that arrived — but a binary has
172
+ * nothing to embed and a lockfile embeds to nothing useful.
173
+ *
174
+ * Size alone would be the wrong order. A README rewritten in one sitting is
175
+ * four hundred changed lines of prose that no claim is phrased in, and it
176
+ * would take a query slot from the six-line change to the service the claims
177
+ * are actually about. So the comparison by size happens inside a group and
178
+ * never across one, and the files most likely to sit near a claim are the
179
+ * ones that survive the cap.
180
+ */
181
+ static _queryable(files, cap) {
182
+ return files
183
+ .filter((file) => !file.binary && file.hunks.length > 0 && !looksGenerated(file.path))
184
+ .sort((a, b) => Recall._group(a.path) - Recall._group(b.path) || Recall._churn(b) - Recall._churn(a))
185
+ .slice(0, cap);
186
+ }
187
+ /** 0 for code, 1 for the prose and data around it. */
188
+ static _group(path) {
189
+ return PROSE_OR_DATA.test(path) ? 1 : 0;
190
+ }
191
+ /** How much of the file this change touched. */
192
+ static _churn(file) {
193
+ return file.additions + file.deletions;
194
+ }
195
+ /**
196
+ * One file's change as a query.
197
+ *
198
+ * Diff markers and hunk headers come off: `@@ -1,7 +1,9 @@` is noise in an
199
+ * embedding, and a leading `+` makes two copies of the same line of code look
200
+ * like two different strings. The path leads, because it is weak signal that
201
+ * costs nothing beside the code.
202
+ */
203
+ static _query(file) {
204
+ const lines = [];
205
+ for (const hunk of file.hunks) {
206
+ for (const line of hunk.text.split('\n')) {
207
+ if (line.startsWith('@@') || line.startsWith('+++') || line.startsWith('---'))
208
+ continue;
209
+ const code = line.replace(/^[+\- ]/, '').trim();
210
+ if (code)
211
+ lines.push(code);
212
+ }
213
+ }
214
+ return [file.path, ...lines].join('\n').slice(0, QUERY_CHARS);
215
+ }
216
+ /** How many searches a recall has in flight at once. */
217
+ static _PARALLEL = 8;
218
+ /** A read that costs the review its context rather than its run. */
219
+ async _safe(what, read) {
220
+ try {
221
+ return await read();
222
+ }
223
+ catch (err) {
224
+ this._onWarn?.(`could not recall ${what} — ${err?.message ?? err}`);
225
+ return [];
226
+ }
227
+ }
228
+ }
229
+ //# sourceMappingURL=recall.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"recall.js","sourceRoot":"","sources":["../../src/knowledge/recall.ts"],"names":[],"mappings":"AAAA,sEAAsE;AACtE,sEAAsE;AACtE,4DAA4D;AAE5D,OAAO,MAAM,MAAM,SAAS,CAAC;AAC7B,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAE/C,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAE5C,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAsCzC,gEAAgE;AAChE,MAAM,WAAW,GAAG,KAAK,CAAC;AAE1B;;;;;;GAMG;AACH,MAAM,aAAa,GACjB,+HAA+H,CAAC;AAElI;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,MAAM,OAAO,MAAM;IAEE,UAAU;IACV,OAAO;IACP,OAAO;IAH1B,YACmB,UAAqB,EACrB,OAAqB,EACrB,OAAmC;0BAFnC,UAAU;uBACV,OAAO;uBACP,OAAO;IACvB,CAAC;IAEJ,KAAK,CAAC,GAAG,CAAC,MAAyB;QACjC,MAAM,IAAI,GAAG,IAAI,cAAc,CAC7B,iBAAiB,EACjB,mEAAmE,EACnE,CAAC,CACF,CAAC;QACF,MAAM,MAAM,GAAG,IAAI,cAAc,CAC/B,aAAa,EACb,2DAA2D,EAC3D,CAAC,CACF,CAAC;QACF,MAAM,QAAQ,GAAG,IAAI,cAAc,CACjC,gBAAgB,EAChB,kEAAkE,EAClE,CAAC,CACF,CAAC;QAEF,mEAAmE;QACnE,MAAM,OAAO,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,MAAM,CAAC,EAAE,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,IAAI,CAAC,SAAS,C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