@isaacriehm/cairn 0.1.0 → 0.1.3

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 (533) hide show
  1. package/dist/.tsbuildinfo +1 -1
  2. package/dist/index.d.ts +0 -1
  3. package/dist/index.js +0 -1
  4. package/dist/index.js.map +1 -1
  5. package/package.json +4 -4
  6. package/dist/backprop/id.d.ts +0 -14
  7. package/dist/backprop/id.js +0 -40
  8. package/dist/backprop/id.js.map +0 -1
  9. package/dist/backprop/index.d.ts +0 -23
  10. package/dist/backprop/index.js +0 -21
  11. package/dist/backprop/index.js.map +0 -1
  12. package/dist/backprop/prompt.d.ts +0 -16
  13. package/dist/backprop/prompt.js +0 -101
  14. package/dist/backprop/prompt.js.map +0 -1
  15. package/dist/backprop/runner.d.ts +0 -18
  16. package/dist/backprop/runner.js +0 -95
  17. package/dist/backprop/runner.js.map +0 -1
  18. package/dist/backprop/schema.d.ts +0 -61
  19. package/dist/backprop/schema.js +0 -55
  20. package/dist/backprop/schema.js.map +0 -1
  21. package/dist/backprop/types.d.ts +0 -101
  22. package/dist/backprop/types.js +0 -24
  23. package/dist/backprop/types.js.map +0 -1
  24. package/dist/backprop/writer.d.ts +0 -27
  25. package/dist/backprop/writer.js +0 -301
  26. package/dist/backprop/writer.js.map +0 -1
  27. package/dist/claude/error.d.ts +0 -33
  28. package/dist/claude/error.js +0 -58
  29. package/dist/claude/error.js.map +0 -1
  30. package/dist/claude/index.d.ts +0 -3
  31. package/dist/claude/index.js +0 -3
  32. package/dist/claude/index.js.map +0 -1
  33. package/dist/claude/runner.d.ts +0 -11
  34. package/dist/claude/runner.js +0 -132
  35. package/dist/claude/runner.js.map +0 -1
  36. package/dist/claude/types.d.ts +0 -52
  37. package/dist/claude/types.js +0 -14
  38. package/dist/claude/types.js.map +0 -1
  39. package/dist/cli/daemon.d.ts +0 -54
  40. package/dist/cli/daemon.js +0 -351
  41. package/dist/cli/daemon.js.map +0 -1
  42. package/dist/cli/install.d.ts +0 -52
  43. package/dist/cli/install.js +0 -308
  44. package/dist/cli/install.js.map +0 -1
  45. package/dist/cli/mirror.d.ts +0 -1
  46. package/dist/cli/mirror.js +0 -97
  47. package/dist/cli/mirror.js.map +0 -1
  48. package/dist/cli/run.d.ts +0 -1
  49. package/dist/cli/run.js +0 -174
  50. package/dist/cli/run.js.map +0 -1
  51. package/dist/cli/task.d.ts +0 -18
  52. package/dist/cli/task.js +0 -137
  53. package/dist/cli/task.js.map +0 -1
  54. package/dist/cli/watch.d.ts +0 -1
  55. package/dist/cli/watch.js +0 -73
  56. package/dist/cli/watch.js.map +0 -1
  57. package/dist/decision-capture/capture.d.ts +0 -57
  58. package/dist/decision-capture/capture.js +0 -186
  59. package/dist/decision-capture/capture.js.map +0 -1
  60. package/dist/decision-capture/extractor.d.ts +0 -20
  61. package/dist/decision-capture/extractor.js +0 -103
  62. package/dist/decision-capture/extractor.js.map +0 -1
  63. package/dist/decision-capture/id.d.ts +0 -14
  64. package/dist/decision-capture/id.js +0 -44
  65. package/dist/decision-capture/id.js.map +0 -1
  66. package/dist/decision-capture/index.d.ts +0 -25
  67. package/dist/decision-capture/index.js +0 -21
  68. package/dist/decision-capture/index.js.map +0 -1
  69. package/dist/decision-capture/prompt.d.ts +0 -15
  70. package/dist/decision-capture/prompt.js +0 -68
  71. package/dist/decision-capture/prompt.js.map +0 -1
  72. package/dist/decision-capture/refinement-prompt.d.ts +0 -25
  73. package/dist/decision-capture/refinement-prompt.js +0 -146
  74. package/dist/decision-capture/refinement-prompt.js.map +0 -1
  75. package/dist/decision-capture/refinement-schema.d.ts +0 -52
  76. package/dist/decision-capture/refinement-schema.js +0 -61
  77. package/dist/decision-capture/refinement-schema.js.map +0 -1
  78. package/dist/decision-capture/refinement.d.ts +0 -60
  79. package/dist/decision-capture/refinement.js +0 -439
  80. package/dist/decision-capture/refinement.js.map +0 -1
  81. package/dist/decision-capture/schema.d.ts +0 -70
  82. package/dist/decision-capture/schema.js +0 -71
  83. package/dist/decision-capture/schema.js.map +0 -1
  84. package/dist/decision-capture/types.d.ts +0 -201
  85. package/dist/decision-capture/types.js +0 -20
  86. package/dist/decision-capture/types.js.map +0 -1
  87. package/dist/decision-capture/writer.d.ts +0 -90
  88. package/dist/decision-capture/writer.js +0 -267
  89. package/dist/decision-capture/writer.js.map +0 -1
  90. package/dist/frontend/discord/acl.d.ts +0 -6
  91. package/dist/frontend/discord/acl.js +0 -19
  92. package/dist/frontend/discord/acl.js.map +0 -1
  93. package/dist/frontend/discord/channels.d.ts +0 -29
  94. package/dist/frontend/discord/channels.js +0 -58
  95. package/dist/frontend/discord/channels.js.map +0 -1
  96. package/dist/frontend/discord/classifier.d.ts +0 -16
  97. package/dist/frontend/discord/classifier.js +0 -29
  98. package/dist/frontend/discord/classifier.js.map +0 -1
  99. package/dist/frontend/discord/index.d.ts +0 -118
  100. package/dist/frontend/discord/index.js +0 -1104
  101. package/dist/frontend/discord/index.js.map +0 -1
  102. package/dist/frontend/discord/slash.d.ts +0 -18
  103. package/dist/frontend/discord/slash.js +0 -90
  104. package/dist/frontend/discord/slash.js.map +0 -1
  105. package/dist/frontend/inbox.d.ts +0 -17
  106. package/dist/frontend/inbox.js +0 -30
  107. package/dist/frontend/inbox.js.map +0 -1
  108. package/dist/frontend/index.d.ts +0 -8
  109. package/dist/frontend/index.js +0 -6
  110. package/dist/frontend/index.js.map +0 -1
  111. package/dist/frontend/stub/index.d.ts +0 -58
  112. package/dist/frontend/stub/index.js +0 -144
  113. package/dist/frontend/stub/index.js.map +0 -1
  114. package/dist/frontend/types.d.ts +0 -247
  115. package/dist/frontend/types.js +0 -15
  116. package/dist/frontend/types.js.map +0 -1
  117. package/dist/gc/apply.d.ts +0 -26
  118. package/dist/gc/apply.js +0 -48
  119. package/dist/gc/apply.js.map +0 -1
  120. package/dist/gc/canary.d.ts +0 -42
  121. package/dist/gc/canary.js +0 -134
  122. package/dist/gc/canary.js.map +0 -1
  123. package/dist/gc/classify.d.ts +0 -25
  124. package/dist/gc/classify.js +0 -89
  125. package/dist/gc/classify.js.map +0 -1
  126. package/dist/gc/doc-gardening.d.ts +0 -29
  127. package/dist/gc/doc-gardening.js +0 -146
  128. package/dist/gc/doc-gardening.js.map +0 -1
  129. package/dist/gc/frontmatter.d.ts +0 -35
  130. package/dist/gc/frontmatter.js +0 -111
  131. package/dist/gc/frontmatter.js.map +0 -1
  132. package/dist/gc/generator-drift.d.ts +0 -28
  133. package/dist/gc/generator-drift.js +0 -53
  134. package/dist/gc/generator-drift.js.map +0 -1
  135. package/dist/gc/index.d.ts +0 -35
  136. package/dist/gc/index.js +0 -26
  137. package/dist/gc/index.js.map +0 -1
  138. package/dist/gc/quality-update.d.ts +0 -23
  139. package/dist/gc/quality-update.js +0 -69
  140. package/dist/gc/quality-update.js.map +0 -1
  141. package/dist/gc/stub-hits.d.ts +0 -31
  142. package/dist/gc/stub-hits.js +0 -125
  143. package/dist/gc/stub-hits.js.map +0 -1
  144. package/dist/gc/sweep.d.ts +0 -56
  145. package/dist/gc/sweep.js +0 -178
  146. package/dist/gc/sweep.js.map +0 -1
  147. package/dist/gc/types.d.ts +0 -129
  148. package/dist/gc/types.js +0 -26
  149. package/dist/gc/types.js.map +0 -1
  150. package/dist/ground/drift.d.ts +0 -8
  151. package/dist/ground/drift.js +0 -23
  152. package/dist/ground/drift.js.map +0 -1
  153. package/dist/ground/frontmatter.d.ts +0 -20
  154. package/dist/ground/frontmatter.js +0 -49
  155. package/dist/ground/frontmatter.js.map +0 -1
  156. package/dist/ground/glob.d.ts +0 -10
  157. package/dist/ground/glob.js +0 -46
  158. package/dist/ground/glob.js.map +0 -1
  159. package/dist/ground/index.d.ts +0 -14
  160. package/dist/ground/index.js +0 -10
  161. package/dist/ground/index.js.map +0 -1
  162. package/dist/ground/ledgers.d.ts +0 -18
  163. package/dist/ground/ledgers.js +0 -103
  164. package/dist/ground/ledgers.js.map +0 -1
  165. package/dist/ground/manifest.d.ts +0 -10
  166. package/dist/ground/manifest.js +0 -88
  167. package/dist/ground/manifest.js.map +0 -1
  168. package/dist/ground/paths.d.ts +0 -20
  169. package/dist/ground/paths.js +0 -61
  170. package/dist/ground/paths.js.map +0 -1
  171. package/dist/ground/quality-grades.d.ts +0 -11
  172. package/dist/ground/quality-grades.js +0 -98
  173. package/dist/ground/quality-grades.js.map +0 -1
  174. package/dist/ground/schemas.d.ts +0 -306
  175. package/dist/ground/schemas.js +0 -188
  176. package/dist/ground/schemas.js.map +0 -1
  177. package/dist/ground/walk.d.ts +0 -7
  178. package/dist/ground/walk.js +0 -53
  179. package/dist/ground/walk.js.map +0 -1
  180. package/dist/init/detect.d.ts +0 -25
  181. package/dist/init/detect.js +0 -336
  182. package/dist/init/detect.js.map +0 -1
  183. package/dist/init/index.d.ts +0 -14
  184. package/dist/init/index.js +0 -9
  185. package/dist/init/index.js.map +0 -1
  186. package/dist/init/init.d.ts +0 -68
  187. package/dist/init/init.js +0 -673
  188. package/dist/init/init.js.map +0 -1
  189. package/dist/init/mapper.d.ts +0 -160
  190. package/dist/init/mapper.js +0 -248
  191. package/dist/init/mapper.js.map +0 -1
  192. package/dist/init/prompts.d.ts +0 -70
  193. package/dist/init/prompts.js +0 -80
  194. package/dist/init/prompts.js.map +0 -1
  195. package/dist/init/secrets.d.ts +0 -18
  196. package/dist/init/secrets.js +0 -76
  197. package/dist/init/secrets.js.map +0 -1
  198. package/dist/init/seed.d.ts +0 -21
  199. package/dist/init/seed.js +0 -75
  200. package/dist/init/seed.js.map +0 -1
  201. package/dist/init/setup-runners.d.ts +0 -17
  202. package/dist/init/setup-runners.js +0 -70
  203. package/dist/init/setup-runners.js.map +0 -1
  204. package/dist/init/types.d.ts +0 -59
  205. package/dist/init/types.js +0 -10
  206. package/dist/init/types.js.map +0 -1
  207. package/dist/init/walker.d.ts +0 -53
  208. package/dist/init/walker.js +0 -460
  209. package/dist/init/walker.js.map +0 -1
  210. package/dist/init/workflow-block.d.ts +0 -34
  211. package/dist/init/workflow-block.js +0 -110
  212. package/dist/init/workflow-block.js.map +0 -1
  213. package/dist/logger.d.ts +0 -3
  214. package/dist/logger.js +0 -23
  215. package/dist/logger.js.map +0 -1
  216. package/dist/mcp/context.d.ts +0 -16
  217. package/dist/mcp/context.js +0 -8
  218. package/dist/mcp/context.js.map +0 -1
  219. package/dist/mcp/errors.d.ts +0 -17
  220. package/dist/mcp/errors.js +0 -23
  221. package/dist/mcp/errors.js.map +0 -1
  222. package/dist/mcp/index.d.ts +0 -10
  223. package/dist/mcp/index.js +0 -7
  224. package/dist/mcp/index.js.map +0 -1
  225. package/dist/mcp/path-allowlist.d.ts +0 -25
  226. package/dist/mcp/path-allowlist.js +0 -66
  227. package/dist/mcp/path-allowlist.js.map +0 -1
  228. package/dist/mcp/result.d.ts +0 -8
  229. package/dist/mcp/result.js +0 -18
  230. package/dist/mcp/result.js.map +0 -1
  231. package/dist/mcp/schemas.d.ts +0 -153
  232. package/dist/mcp/schemas.js +0 -135
  233. package/dist/mcp/schemas.js.map +0 -1
  234. package/dist/mcp/server.d.ts +0 -11
  235. package/dist/mcp/server.js +0 -58
  236. package/dist/mcp/server.js.map +0 -1
  237. package/dist/mcp/telemetry.d.ts +0 -15
  238. package/dist/mcp/telemetry.js +0 -13
  239. package/dist/mcp/telemetry.js.map +0 -1
  240. package/dist/mcp/tools/append.d.ts +0 -8
  241. package/dist/mcp/tools/append.js +0 -33
  242. package/dist/mcp/tools/append.js.map +0 -1
  243. package/dist/mcp/tools/archive.d.ts +0 -8
  244. package/dist/mcp/tools/archive.js +0 -49
  245. package/dist/mcp/tools/archive.js.map +0 -1
  246. package/dist/mcp/tools/ask-operator.d.ts +0 -34
  247. package/dist/mcp/tools/ask-operator.js +0 -93
  248. package/dist/mcp/tools/ask-operator.js.map +0 -1
  249. package/dist/mcp/tools/canonical-for-topic.d.ts +0 -6
  250. package/dist/mcp/tools/canonical-for-topic.js +0 -40
  251. package/dist/mcp/tools/canonical-for-topic.js.map +0 -1
  252. package/dist/mcp/tools/decision-get.d.ts +0 -6
  253. package/dist/mcp/tools/decision-get.js +0 -49
  254. package/dist/mcp/tools/decision-get.js.map +0 -1
  255. package/dist/mcp/tools/decisions-for-symbol.d.ts +0 -7
  256. package/dist/mcp/tools/decisions-for-symbol.js +0 -42
  257. package/dist/mcp/tools/decisions-for-symbol.js.map +0 -1
  258. package/dist/mcp/tools/decisions-in-scope.d.ts +0 -7
  259. package/dist/mcp/tools/decisions-in-scope.js +0 -47
  260. package/dist/mcp/tools/decisions-in-scope.js.map +0 -1
  261. package/dist/mcp/tools/drop-task.d.ts +0 -12
  262. package/dist/mcp/tools/drop-task.js +0 -47
  263. package/dist/mcp/tools/drop-task.js.map +0 -1
  264. package/dist/mcp/tools/get-full.d.ts +0 -7
  265. package/dist/mcp/tools/get-full.js +0 -46
  266. package/dist/mcp/tools/get-full.js.map +0 -1
  267. package/dist/mcp/tools/ground-get.d.ts +0 -7
  268. package/dist/mcp/tools/ground-get.js +0 -80
  269. package/dist/mcp/tools/ground-get.js.map +0 -1
  270. package/dist/mcp/tools/index.d.ts +0 -3
  271. package/dist/mcp/tools/index.js +0 -44
  272. package/dist/mcp/tools/index.js.map +0 -1
  273. package/dist/mcp/tools/invariant-get.d.ts +0 -6
  274. package/dist/mcp/tools/invariant-get.js +0 -49
  275. package/dist/mcp/tools/invariant-get.js.map +0 -1
  276. package/dist/mcp/tools/invariants-in-scope.d.ts +0 -7
  277. package/dist/mcp/tools/invariants-in-scope.js +0 -65
  278. package/dist/mcp/tools/invariants-in-scope.js.map +0 -1
  279. package/dist/mcp/tools/query-history.d.ts +0 -9
  280. package/dist/mcp/tools/query-history.js +0 -33
  281. package/dist/mcp/tools/query-history.js.map +0 -1
  282. package/dist/mcp/tools/record-decision.d.ts +0 -14
  283. package/dist/mcp/tools/record-decision.js +0 -101
  284. package/dist/mcp/tools/record-decision.js.map +0 -1
  285. package/dist/mcp/tools/record-run-event.d.ts +0 -10
  286. package/dist/mcp/tools/record-run-event.js +0 -28
  287. package/dist/mcp/tools/record-run-event.js.map +0 -1
  288. package/dist/mcp/tools/search.d.ts +0 -9
  289. package/dist/mcp/tools/search.js +0 -165
  290. package/dist/mcp/tools/search.js.map +0 -1
  291. package/dist/mcp/tools/supersedes-chain.d.ts +0 -6
  292. package/dist/mcp/tools/supersedes-chain.js +0 -66
  293. package/dist/mcp/tools/supersedes-chain.js.map +0 -1
  294. package/dist/mcp/tools/timeline.d.ts +0 -9
  295. package/dist/mcp/tools/timeline.js +0 -65
  296. package/dist/mcp/tools/timeline.js.map +0 -1
  297. package/dist/mcp/tools/types.d.ts +0 -9
  298. package/dist/mcp/tools/types.js +0 -2
  299. package/dist/mcp/tools/types.js.map +0 -1
  300. package/dist/mirror/clone.d.ts +0 -6
  301. package/dist/mirror/clone.js +0 -48
  302. package/dist/mirror/clone.js.map +0 -1
  303. package/dist/mirror/dirty-overlap.d.ts +0 -13
  304. package/dist/mirror/dirty-overlap.js +0 -77
  305. package/dist/mirror/dirty-overlap.js.map +0 -1
  306. package/dist/mirror/index.d.ts +0 -7
  307. package/dist/mirror/index.js +0 -7
  308. package/dist/mirror/index.js.map +0 -1
  309. package/dist/mirror/paths.d.ts +0 -18
  310. package/dist/mirror/paths.js +0 -45
  311. package/dist/mirror/paths.js.map +0 -1
  312. package/dist/mirror/push.d.ts +0 -9
  313. package/dist/mirror/push.js +0 -27
  314. package/dist/mirror/push.js.map +0 -1
  315. package/dist/mirror/state.d.ts +0 -4
  316. package/dist/mirror/state.js +0 -36
  317. package/dist/mirror/state.js.map +0 -1
  318. package/dist/mirror/sync.d.ts +0 -9
  319. package/dist/mirror/sync.js +0 -33
  320. package/dist/mirror/sync.js.map +0 -1
  321. package/dist/mirror/types.d.ts +0 -77
  322. package/dist/mirror/types.js +0 -2
  323. package/dist/mirror/types.js.map +0 -1
  324. package/dist/orchestrator/activity-summarizer.d.ts +0 -33
  325. package/dist/orchestrator/activity-summarizer.js +0 -120
  326. package/dist/orchestrator/activity-summarizer.js.map +0 -1
  327. package/dist/orchestrator/inbox.d.ts +0 -78
  328. package/dist/orchestrator/inbox.js +0 -115
  329. package/dist/orchestrator/inbox.js.map +0 -1
  330. package/dist/orchestrator/index.d.ts +0 -9
  331. package/dist/orchestrator/index.js +0 -7
  332. package/dist/orchestrator/index.js.map +0 -1
  333. package/dist/orchestrator/orchestrator.d.ts +0 -154
  334. package/dist/orchestrator/orchestrator.js +0 -2437
  335. package/dist/orchestrator/orchestrator.js.map +0 -1
  336. package/dist/orchestrator/prompt.d.ts +0 -19
  337. package/dist/orchestrator/prompt.js +0 -50
  338. package/dist/orchestrator/prompt.js.map +0 -1
  339. package/dist/orchestrator/queue.d.ts +0 -21
  340. package/dist/orchestrator/queue.js +0 -80
  341. package/dist/orchestrator/queue.js.map +0 -1
  342. package/dist/orchestrator/run-log.d.ts +0 -53
  343. package/dist/orchestrator/run-log.js +0 -92
  344. package/dist/orchestrator/run-log.js.map +0 -1
  345. package/dist/orchestrator/runner.d.ts +0 -56
  346. package/dist/orchestrator/runner.js +0 -172
  347. package/dist/orchestrator/runner.js.map +0 -1
  348. package/dist/orchestrator/tool-digest.d.ts +0 -35
  349. package/dist/orchestrator/tool-digest.js +0 -116
  350. package/dist/orchestrator/tool-digest.js.map +0 -1
  351. package/dist/orchestrator/types.d.ts +0 -263
  352. package/dist/orchestrator/types.js +0 -2
  353. package/dist/orchestrator/types.js.map +0 -1
  354. package/dist/orchestrator/workspace.d.ts +0 -21
  355. package/dist/orchestrator/workspace.js +0 -31
  356. package/dist/orchestrator/workspace.js.map +0 -1
  357. package/dist/profiles/index.d.ts +0 -3
  358. package/dist/profiles/index.js +0 -3
  359. package/dist/profiles/index.js.map +0 -1
  360. package/dist/profiles/registry.d.ts +0 -5
  361. package/dist/profiles/registry.js +0 -31
  362. package/dist/profiles/registry.js.map +0 -1
  363. package/dist/profiles/types.d.ts +0 -48
  364. package/dist/profiles/types.js +0 -11
  365. package/dist/profiles/types.js.map +0 -1
  366. package/dist/profiles/unknown.d.ts +0 -9
  367. package/dist/profiles/unknown.js +0 -17
  368. package/dist/profiles/unknown.js.map +0 -1
  369. package/dist/reviewer/index.d.ts +0 -6
  370. package/dist/reviewer/index.js +0 -5
  371. package/dist/reviewer/index.js.map +0 -1
  372. package/dist/reviewer/prompt.d.ts +0 -11
  373. package/dist/reviewer/prompt.js +0 -132
  374. package/dist/reviewer/prompt.js.map +0 -1
  375. package/dist/reviewer/remediation.d.ts +0 -15
  376. package/dist/reviewer/remediation.js +0 -61
  377. package/dist/reviewer/remediation.js.map +0 -1
  378. package/dist/reviewer/reviewer.d.ts +0 -9
  379. package/dist/reviewer/reviewer.js +0 -89
  380. package/dist/reviewer/reviewer.js.map +0 -1
  381. package/dist/reviewer/schema.d.ts +0 -45
  382. package/dist/reviewer/schema.js +0 -43
  383. package/dist/reviewer/schema.js.map +0 -1
  384. package/dist/reviewer/types.d.ts +0 -74
  385. package/dist/reviewer/types.js +0 -14
  386. package/dist/reviewer/types.js.map +0 -1
  387. package/dist/sensors/attestation.d.ts +0 -44
  388. package/dist/sensors/attestation.js +0 -262
  389. package/dist/sensors/attestation.js.map +0 -1
  390. package/dist/sensors/catalog.d.ts +0 -41
  391. package/dist/sensors/catalog.js +0 -123
  392. package/dist/sensors/catalog.js.map +0 -1
  393. package/dist/sensors/decisions.d.ts +0 -30
  394. package/dist/sensors/decisions.js +0 -393
  395. package/dist/sensors/decisions.js.map +0 -1
  396. package/dist/sensors/diff.d.ts +0 -27
  397. package/dist/sensors/diff.js +0 -148
  398. package/dist/sensors/diff.js.map +0 -1
  399. package/dist/sensors/index.d.ts +0 -13
  400. package/dist/sensors/index.js +0 -9
  401. package/dist/sensors/index.js.map +0 -1
  402. package/dist/sensors/remediation.d.ts +0 -20
  403. package/dist/sensors/remediation.js +0 -65
  404. package/dist/sensors/remediation.js.map +0 -1
  405. package/dist/sensors/runner.d.ts +0 -44
  406. package/dist/sensors/runner.js +0 -95
  407. package/dist/sensors/runner.js.map +0 -1
  408. package/dist/sensors/structural.d.ts +0 -30
  409. package/dist/sensors/structural.js +0 -204
  410. package/dist/sensors/structural.js.map +0 -1
  411. package/dist/sensors/stub-catalog.d.ts +0 -39
  412. package/dist/sensors/stub-catalog.js +0 -115
  413. package/dist/sensors/stub-catalog.js.map +0 -1
  414. package/dist/sensors/types.d.ts +0 -135
  415. package/dist/sensors/types.js +0 -14
  416. package/dist/sensors/types.js.map +0 -1
  417. package/dist/tier0/classify.d.ts +0 -5
  418. package/dist/tier0/classify.js +0 -91
  419. package/dist/tier0/classify.js.map +0 -1
  420. package/dist/tier0/index.d.ts +0 -3
  421. package/dist/tier0/index.js +0 -3
  422. package/dist/tier0/index.js.map +0 -1
  423. package/dist/tier0/ollama.d.ts +0 -22
  424. package/dist/tier0/ollama.js +0 -63
  425. package/dist/tier0/ollama.js.map +0 -1
  426. package/dist/tier0/types.d.ts +0 -24
  427. package/dist/tier0/types.js +0 -7
  428. package/dist/tier0/types.js.map +0 -1
  429. package/dist/tightener/index.d.ts +0 -4
  430. package/dist/tightener/index.js +0 -4
  431. package/dist/tightener/index.js.map +0 -1
  432. package/dist/tightener/prompt.d.ts +0 -3
  433. package/dist/tightener/prompt.js +0 -67
  434. package/dist/tightener/prompt.js.map +0 -1
  435. package/dist/tightener/schema.d.ts +0 -68
  436. package/dist/tightener/schema.js +0 -44
  437. package/dist/tightener/schema.js.map +0 -1
  438. package/dist/tightener/tighten.d.ts +0 -2
  439. package/dist/tightener/tighten.js +0 -66
  440. package/dist/tightener/tighten.js.map +0 -1
  441. package/dist/tightener/types.d.ts +0 -74
  442. package/dist/tightener/types.js +0 -6
  443. package/dist/tightener/types.js.map +0 -1
  444. package/dist/uat/bundle.d.ts +0 -68
  445. package/dist/uat/bundle.js +0 -168
  446. package/dist/uat/bundle.js.map +0 -1
  447. package/dist/uat/index.d.ts +0 -15
  448. package/dist/uat/index.js +0 -10
  449. package/dist/uat/index.js.map +0 -1
  450. package/dist/uat/persistent.d.ts +0 -64
  451. package/dist/uat/persistent.js +0 -206
  452. package/dist/uat/persistent.js.map +0 -1
  453. package/dist/uat/probes/cli.d.ts +0 -11
  454. package/dist/uat/probes/cli.js +0 -107
  455. package/dist/uat/probes/cli.js.map +0 -1
  456. package/dist/uat/probes/http.d.ts +0 -12
  457. package/dist/uat/probes/http.js +0 -139
  458. package/dist/uat/probes/http.js.map +0 -1
  459. package/dist/uat/probes/index.d.ts +0 -21
  460. package/dist/uat/probes/index.js +0 -30
  461. package/dist/uat/probes/index.js.map +0 -1
  462. package/dist/uat/probes/integration.d.ts +0 -18
  463. package/dist/uat/probes/integration.js +0 -188
  464. package/dist/uat/probes/integration.js.map +0 -1
  465. package/dist/uat/probes/sql/config.d.ts +0 -14
  466. package/dist/uat/probes/sql/config.js +0 -57
  467. package/dist/uat/probes/sql/config.js.map +0 -1
  468. package/dist/uat/probes/sql/index.d.ts +0 -29
  469. package/dist/uat/probes/sql/index.js +0 -43
  470. package/dist/uat/probes/sql/index.js.map +0 -1
  471. package/dist/uat/probes/sql/mysql.d.ts +0 -12
  472. package/dist/uat/probes/sql/mysql.js +0 -96
  473. package/dist/uat/probes/sql/mysql.js.map +0 -1
  474. package/dist/uat/probes/sql/pg.d.ts +0 -20
  475. package/dist/uat/probes/sql/pg.js +0 -102
  476. package/dist/uat/probes/sql/pg.js.map +0 -1
  477. package/dist/uat/probes/sql/sqlite.d.ts +0 -9
  478. package/dist/uat/probes/sql/sqlite.js +0 -58
  479. package/dist/uat/probes/sql/sqlite.js.map +0 -1
  480. package/dist/uat/probes/sql/types.d.ts +0 -46
  481. package/dist/uat/probes/sql/types.js +0 -10
  482. package/dist/uat/probes/sql/types.js.map +0 -1
  483. package/dist/uat/probes/sql.d.ts +0 -9
  484. package/dist/uat/probes/sql.js +0 -119
  485. package/dist/uat/probes/sql.js.map +0 -1
  486. package/dist/uat/probes/ui.d.ts +0 -19
  487. package/dist/uat/probes/ui.js +0 -244
  488. package/dist/uat/probes/ui.js.map +0 -1
  489. package/dist/uat/prompt.d.ts +0 -10
  490. package/dist/uat/prompt.js +0 -85
  491. package/dist/uat/prompt.js.map +0 -1
  492. package/dist/uat/question.d.ts +0 -50
  493. package/dist/uat/question.js +0 -139
  494. package/dist/uat/question.js.map +0 -1
  495. package/dist/uat/rejection.d.ts +0 -58
  496. package/dist/uat/rejection.js +0 -163
  497. package/dist/uat/rejection.js.map +0 -1
  498. package/dist/uat/runner.d.ts +0 -6
  499. package/dist/uat/runner.js +0 -96
  500. package/dist/uat/runner.js.map +0 -1
  501. package/dist/uat/schema.d.ts +0 -322
  502. package/dist/uat/schema.js +0 -189
  503. package/dist/uat/schema.js.map +0 -1
  504. package/dist/uat/types.d.ts +0 -268
  505. package/dist/uat/types.js +0 -18
  506. package/dist/uat/types.js.map +0 -1
  507. package/dist/uat/uat.d.ts +0 -89
  508. package/dist/uat/uat.js +0 -256
  509. package/dist/uat/uat.js.map +0 -1
  510. package/dist/voice/index.d.ts +0 -4
  511. package/dist/voice/index.js +0 -4
  512. package/dist/voice/index.js.map +0 -1
  513. package/dist/voice/model.d.ts +0 -23
  514. package/dist/voice/model.js +0 -46
  515. package/dist/voice/model.js.map +0 -1
  516. package/dist/voice/pipe.d.ts +0 -9
  517. package/dist/voice/pipe.js +0 -47
  518. package/dist/voice/pipe.js.map +0 -1
  519. package/dist/voice/transcribe.d.ts +0 -3
  520. package/dist/voice/transcribe.js +0 -43
  521. package/dist/voice/transcribe.js.map +0 -1
  522. package/dist/voice/types.d.ts +0 -26
  523. package/dist/voice/types.js +0 -9
  524. package/dist/voice/types.js.map +0 -1
  525. package/dist/watch/daemon.d.ts +0 -21
  526. package/dist/watch/daemon.js +0 -143
  527. package/dist/watch/daemon.js.map +0 -1
  528. package/dist/watch/index.d.ts +0 -4
  529. package/dist/watch/index.js +0 -3
  530. package/dist/watch/index.js.map +0 -1
  531. package/dist/watch/regenerate.d.ts +0 -25
  532. package/dist/watch/regenerate.js +0 -51
  533. package/dist/watch/regenerate.js.map +0 -1
package/dist/index.d.ts CHANGED
@@ -5,4 +5,3 @@
5
5
  * from "@isaacriehm/cairn"`. See docs/PLUGIN_ARCHITECTURE.md.
6
6
  */
7
7
  export * from "@isaacriehm/cairn-core";
8
- export * from "@isaacriehm/cairn-frontend-stub";
package/dist/index.js CHANGED
@@ -5,5 +5,4 @@
5
5
  * from "@isaacriehm/cairn"`. See docs/PLUGIN_ARCHITECTURE.md.
6
6
  */
7
7
  export * from "@isaacriehm/cairn-core";
8
- export * from "@isaacriehm/cairn-frontend-stub";
9
8
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,cAAc,wBAAwB,CAAC;AACvC,cAAc,iCAAiC,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,cAAc,wBAAwB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@isaacriehm/cairn",
3
- "version": "0.1.0",
3
+ "version": "0.1.3",
4
4
  "description": "Cairn — state + context-loading layer for AI coding agents.",
5
5
  "author": "Isaac Riehm",
6
6
  "license": "MIT",
@@ -34,14 +34,14 @@
34
34
  "dependencies": {
35
35
  "simple-git": "^3.36.0",
36
36
  "yaml": "^2.8.4",
37
- "@isaacriehm/cairn-core": "0.1.0",
38
- "@isaacriehm/cairn-frontend-stub": "0.1.0"
37
+ "@isaacriehm/cairn-core": "0.1.3"
39
38
  },
40
39
  "devDependencies": {
41
40
  "@modelcontextprotocol/sdk": "^1.29.0",
42
41
  "@types/node": "^25.6.0",
43
42
  "tsx": "^4.21.0",
44
- "typescript": "^6.0.3"
43
+ "typescript": "^6.0.3",
44
+ "@isaacriehm/cairn-frontend-stub": "0.1.3"
45
45
  },
46
46
  "scripts": {
47
47
  "build": "tsc -b",
@@ -1,14 +0,0 @@
1
- /**
2
- * Invariant id allocator. Per L13.2:
3
- * - Monotonic, never reused.
4
- * - Format: V<NNNN>, zero-padded to four digits.
5
- * - Even superseded invariants keep their id; allocation only ever
6
- * advances forward.
7
- */
8
- /**
9
- * Scan `<repoRoot>/.harness/ground/invariants/V*.md` and return the next
10
- * free id formatted as `V<NNNN>`. The scan is liberal — any V-prefixed
11
- * markdown counts toward the high-water mark, including ones marked
12
- * superseded.
13
- */
14
- export declare function allocateInvariantId(repoRoot: string): string;
@@ -1,40 +0,0 @@
1
- /**
2
- * Invariant id allocator. Per L13.2:
3
- * - Monotonic, never reused.
4
- * - Format: V<NNNN>, zero-padded to four digits.
5
- * - Even superseded invariants keep their id; allocation only ever
6
- * advances forward.
7
- */
8
- import { existsSync, readdirSync } from "node:fs";
9
- import { invariantsDir } from "../ground/paths.js";
10
- const FILENAME_RE = /^V(\d{4,})\.md$/;
11
- /**
12
- * Scan `<repoRoot>/.harness/ground/invariants/V*.md` and return the next
13
- * free id formatted as `V<NNNN>`. The scan is liberal — any V-prefixed
14
- * markdown counts toward the high-water mark, including ones marked
15
- * superseded.
16
- */
17
- export function allocateInvariantId(repoRoot) {
18
- const dir = invariantsDir(repoRoot);
19
- let max = 0;
20
- if (existsSync(dir)) {
21
- let entries;
22
- try {
23
- entries = readdirSync(dir, { encoding: "utf8" });
24
- }
25
- catch {
26
- entries = [];
27
- }
28
- for (const name of entries) {
29
- const match = name.match(FILENAME_RE);
30
- if (!match)
31
- continue;
32
- const n = Number.parseInt(match[1] ?? "0", 10);
33
- if (Number.isFinite(n) && n > max)
34
- max = n;
35
- }
36
- }
37
- const next = max + 1;
38
- return `V${next.toString().padStart(4, "0")}`;
39
- }
40
- //# sourceMappingURL=id.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"id.js","sourceRoot":"","sources":["../../src/backprop/id.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEnD,MAAM,WAAW,GAAG,iBAAiB,CAAC;AAEtC;;;;;GAKG;AACH,MAAM,UAAU,mBAAmB,CAAC,QAAgB;IAClD,MAAM,GAAG,GAAG,aAAa,CAAC,QAAQ,CAAC,CAAC;IACpC,IAAI,GAAG,GAAG,CAAC,CAAC;IACZ,IAAI,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;QACpB,IAAI,OAAiB,CAAC;QACtB,IAAI,CAAC;YACH,OAAO,GAAG,WAAW,CAAC,GAAG,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC,CAAC;QACnD,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,GAAG,EAAE,CAAC;QACf,CAAC;QACD,KAAK,MAAM,IAAI,IAAI,OAAO,EAAE,CAAC;YAC3B,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;YACtC,IAAI,CAAC,KAAK;gBAAE,SAAS;YACrB,MAAM,CAAC,GAAG,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,GAAG,EAAE,EAAE,CAAC,CAAC;YAC/C,IAAI,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,GAAG;gBAAE,GAAG,GAAG,CAAC,CAAC;QAC7C,CAAC;IACH,CAAC;IACD,MAAM,IAAI,GAAG,GAAG,GAAG,CAAC,CAAC;IACrB,OAAO,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,CAAC;AAChD,CAAC"}
@@ -1,23 +0,0 @@
1
- /**
2
- * Phase 13 — backprop protocol.
3
- *
4
- * After a code-class run lands its fix, the backprop subagent reads the
5
- * tightened spec + diff + failure that motivated the fix, distills a
6
- * permanent §V invariant, and emits a sensor (or named E2E case) that
7
- * catches a regression of that invariant on every future run.
8
- *
9
- * Public surface:
10
- * - runBackprop(args) → writes invariant + sensor, returns result
11
- * - allocateInvariantId(repoRoot) → next monotonic V-id
12
- * - writeInvariantArtifacts(args) → mechanical writer (used by runBackprop)
13
- * - BACKPROP_OUTPUT_SCHEMA, BACKPROP_SYSTEM_PROMPT — for consumers that
14
- * want to call `runClaude` directly (smoke convenience).
15
- */
16
- export type { BackpropInput, BackpropOutput, BackpropResult, EnforcementKind, } from "./types.js";
17
- export { allocateInvariantId } from "./id.js";
18
- export { BACKPROP_SYSTEM_PROMPT, buildBackpropUserPrompt, } from "./prompt.js";
19
- export { BACKPROP_OUTPUT_SCHEMA } from "./schema.js";
20
- export { runBackprop } from "./runner.js";
21
- export type { RunBackpropArgs } from "./runner.js";
22
- export { writeInvariantArtifacts, } from "./writer.js";
23
- export type { WriteInvariantArgs, WriteInvariantResult, } from "./writer.js";
@@ -1,21 +0,0 @@
1
- /**
2
- * Phase 13 — backprop protocol.
3
- *
4
- * After a code-class run lands its fix, the backprop subagent reads the
5
- * tightened spec + diff + failure that motivated the fix, distills a
6
- * permanent §V invariant, and emits a sensor (or named E2E case) that
7
- * catches a regression of that invariant on every future run.
8
- *
9
- * Public surface:
10
- * - runBackprop(args) → writes invariant + sensor, returns result
11
- * - allocateInvariantId(repoRoot) → next monotonic V-id
12
- * - writeInvariantArtifacts(args) → mechanical writer (used by runBackprop)
13
- * - BACKPROP_OUTPUT_SCHEMA, BACKPROP_SYSTEM_PROMPT — for consumers that
14
- * want to call `runClaude` directly (smoke convenience).
15
- */
16
- export { allocateInvariantId } from "./id.js";
17
- export { BACKPROP_SYSTEM_PROMPT, buildBackpropUserPrompt, } from "./prompt.js";
18
- export { BACKPROP_OUTPUT_SCHEMA } from "./schema.js";
19
- export { runBackprop } from "./runner.js";
20
- export { writeInvariantArtifacts, } from "./writer.js";
21
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/backprop/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AASH,OAAO,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAC9C,OAAO,EACL,sBAAsB,EACtB,uBAAuB,GACxB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C,OAAO,EACL,uBAAuB,GACxB,MAAM,aAAa,CAAC"}
@@ -1,16 +0,0 @@
1
- /**
2
- * Backprop subagent prompts.
3
- *
4
- * The agent reads the tightened spec, the failure that motivated this fix,
5
- * and the diff that resolved it. It produces a single typed object —
6
- * `BackpropOutput` — that the harness uses to write the invariant file +
7
- * generate the sensor.
8
- *
9
- * The agent does NOT touch the filesystem; the schema and prompt
10
- * deliberately do not surface tools. Per L13.1: "Naming convention:
11
- * sensor scripts and E2E cases cite the invariant ID — the harness
12
- * mints the id, so the agent only supplies the slug."
13
- */
14
- import type { BackpropInput } from "./types.js";
15
- export declare const BACKPROP_SYSTEM_PROMPT = "You are the **backprop subagent** for an agent harness. A fix has just landed; your job is to capture the underlying invariant so the same class of bug becomes mechanically detectable forever.\n\nYou read three things and you emit one structured object.\n\nYou read:\n1. The tightened spec the implementer worked from.\n2. The failure that motivated this fix (a sensor finding, reviewer gap, UAT rejection note, or operator bug report).\n3. The diff that resolved it.\n\nYou emit a single JSON object matching the supplied schema. Required fields:\n- `slug`: short kebab-case identifier (\u226430 chars). Use the invariant's *what*, not the bug. `no-jsonb-userid-filter` is good; `fix-bug-from-yesterday` is bad.\n- `title`: imperative one-liner describing the invariant. Example: \"All user-scoped queries MUST filter by `user_id` in addition to provider keys\".\n- `body_markdown`: 2\u20136 paragraphs explaining (a) the rule, (b) why it exists / what bug it prevents, (c) how to satisfy it on future code, (d) known exceptions if any.\n- `introduced_for_bug`: the original failure summary, distilled to one paragraph.\n- `enforcement`: ONE mechanism that catches a regression of this invariant.\n\nTwo enforcement kinds:\n\n**`regex_sensor`** \u2014 for invariants that are mechanically detectable by a single regex pattern over source files. Most invariants are this kind. Required sub-fields:\n- `regex`: a JS-flavored regex pattern (string, no leading/trailing slashes). It MUST match the BAD pattern (i.e., a hit means the invariant is violated). Use `(?!...)` or `(?=...)` lookarounds when needed.\n- `target_globs`: list of repo-relative globs the sensor scans. Example: `[\"src/**/*.ts\", \"core/src/**/*.ts\"]`. Default to the directory the fix touched if uncertain.\n- `language`: one of typescript, javascript, python, ruby, go, rust, sql. Filters which files the regex runs against.\n- `failure_message`: imperative one-liner the sensor prints when it hits. Should tell the next agent what to do.\n\n**`named_e2e`** \u2014 for invariants that only show up at runtime (e.g., cross-tenant scoping, multi-step user flows). Required sub-fields:\n- `e2e_path`: relative path the harness will create. Use the form `e2e/V<N>_<slug>.spec.ts`. The harness substitutes V<N>; you supply the rest.\n\nDO NOT:\n- Suggest a `regex_sensor` whose pattern would have false positives. A noisy sensor is worse than no sensor.\n- Capture an invariant that's a tautology (\"don't write bugs\"). The invariant must be a *specific structural rule* that, if obeyed, makes a class of bug impossible.\n- Output any free text outside the JSON envelope.\n\nIf the diff is genuinely too small or generic to extract a useful invariant \u2014 for example, a typo fix or a trivial copy update \u2014 emit a regex_sensor with a wildly-permissive pattern that will never hit AND a body_markdown that says \"no enforceable invariant; fix was cosmetic\". The id allocator still mints a V-id; it's better to record \"no invariant here\" than to fabricate one.";
16
- export declare function buildBackpropUserPrompt(input: BackpropInput): string;
@@ -1,101 +0,0 @@
1
- /**
2
- * Backprop subagent prompts.
3
- *
4
- * The agent reads the tightened spec, the failure that motivated this fix,
5
- * and the diff that resolved it. It produces a single typed object —
6
- * `BackpropOutput` — that the harness uses to write the invariant file +
7
- * generate the sensor.
8
- *
9
- * The agent does NOT touch the filesystem; the schema and prompt
10
- * deliberately do not surface tools. Per L13.1: "Naming convention:
11
- * sensor scripts and E2E cases cite the invariant ID — the harness
12
- * mints the id, so the agent only supplies the slug."
13
- */
14
- /**
15
- * Maximum characters per file emitted in the prompt. Larger files
16
- * are truncated with an explicit elision marker.
17
- */
18
- const PER_FILE_CHAR_CAP = 16_000;
19
- export const BACKPROP_SYSTEM_PROMPT = `You are the **backprop subagent** for an agent harness. A fix has just landed; your job is to capture the underlying invariant so the same class of bug becomes mechanically detectable forever.
20
-
21
- You read three things and you emit one structured object.
22
-
23
- You read:
24
- 1. The tightened spec the implementer worked from.
25
- 2. The failure that motivated this fix (a sensor finding, reviewer gap, UAT rejection note, or operator bug report).
26
- 3. The diff that resolved it.
27
-
28
- You emit a single JSON object matching the supplied schema. Required fields:
29
- - \`slug\`: short kebab-case identifier (≤30 chars). Use the invariant's *what*, not the bug. \`no-jsonb-userid-filter\` is good; \`fix-bug-from-yesterday\` is bad.
30
- - \`title\`: imperative one-liner describing the invariant. Example: "All user-scoped queries MUST filter by \`user_id\` in addition to provider keys".
31
- - \`body_markdown\`: 2–6 paragraphs explaining (a) the rule, (b) why it exists / what bug it prevents, (c) how to satisfy it on future code, (d) known exceptions if any.
32
- - \`introduced_for_bug\`: the original failure summary, distilled to one paragraph.
33
- - \`enforcement\`: ONE mechanism that catches a regression of this invariant.
34
-
35
- Two enforcement kinds:
36
-
37
- **\`regex_sensor\`** — for invariants that are mechanically detectable by a single regex pattern over source files. Most invariants are this kind. Required sub-fields:
38
- - \`regex\`: a JS-flavored regex pattern (string, no leading/trailing slashes). It MUST match the BAD pattern (i.e., a hit means the invariant is violated). Use \`(?!...)\` or \`(?=...)\` lookarounds when needed.
39
- - \`target_globs\`: list of repo-relative globs the sensor scans. Example: \`["src/**/*.ts", "core/src/**/*.ts"]\`. Default to the directory the fix touched if uncertain.
40
- - \`language\`: one of typescript, javascript, python, ruby, go, rust, sql. Filters which files the regex runs against.
41
- - \`failure_message\`: imperative one-liner the sensor prints when it hits. Should tell the next agent what to do.
42
-
43
- **\`named_e2e\`** — for invariants that only show up at runtime (e.g., cross-tenant scoping, multi-step user flows). Required sub-fields:
44
- - \`e2e_path\`: relative path the harness will create. Use the form \`e2e/V<N>_<slug>.spec.ts\`. The harness substitutes V<N>; you supply the rest.
45
-
46
- DO NOT:
47
- - Suggest a \`regex_sensor\` whose pattern would have false positives. A noisy sensor is worse than no sensor.
48
- - Capture an invariant that's a tautology ("don't write bugs"). The invariant must be a *specific structural rule* that, if obeyed, makes a class of bug impossible.
49
- - Output any free text outside the JSON envelope.
50
-
51
- If the diff is genuinely too small or generic to extract a useful invariant — for example, a typo fix or a trivial copy update — emit a regex_sensor with a wildly-permissive pattern that will never hit AND a body_markdown that says "no enforceable invariant; fix was cosmetic". The id allocator still mints a V-id; it's better to record "no invariant here" than to fabricate one.`;
52
- export function buildBackpropUserPrompt(input) {
53
- const sections = [];
54
- sections.push("## Run");
55
- sections.push(`run_id: ${input.run_id}`);
56
- if (input.in_scope_decision_ids.length > 0) {
57
- sections.push(`decisions in scope: ${input.in_scope_decision_ids.join(", ")}`);
58
- }
59
- sections.push("\n## Tightened spec");
60
- sections.push(input.tightened_spec.trim());
61
- if (input.acceptance_criteria.length > 0) {
62
- sections.push("\n## Acceptance criteria");
63
- for (const ac of input.acceptance_criteria) {
64
- sections.push(`- ${ac}`);
65
- }
66
- }
67
- sections.push("\n## Failure that motivated this fix");
68
- sections.push(input.failure_summary.trim());
69
- sections.push("\n## Diff that landed");
70
- sections.push(formatDiff(input.diff));
71
- sections.push("\n## Your task");
72
- sections.push("Extract the invariant. Emit the structured object per the schema. " +
73
- "The harness will mint the invariant id, write the file, and generate the sensor.");
74
- return sections.join("\n");
75
- }
76
- function formatDiff(diff) {
77
- if (diff.length === 0)
78
- return "(empty diff)";
79
- const out = [];
80
- for (const entry of diff) {
81
- out.push(`### ${entry.path} [${entry.status}]`);
82
- if (entry.status === "deleted") {
83
- out.push("(file deleted)");
84
- continue;
85
- }
86
- const after = entry.afterContent ?? "";
87
- if (after.length === 0) {
88
- out.push("(empty after content)");
89
- continue;
90
- }
91
- if (after.length > PER_FILE_CHAR_CAP) {
92
- out.push(after.slice(0, PER_FILE_CHAR_CAP));
93
- out.push(`\n…[truncated; ${after.length - PER_FILE_CHAR_CAP} chars elided]`);
94
- }
95
- else {
96
- out.push(after);
97
- }
98
- }
99
- return out.join("\n\n");
100
- }
101
- //# sourceMappingURL=prompt.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"prompt.js","sourceRoot":"","sources":["../../src/backprop/prompt.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAKH;;;GAGG;AACH,MAAM,iBAAiB,GAAG,MAAM,CAAC;AAEjC,MAAM,CAAC,MAAM,sBAAsB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4XAgCsV,CAAC;AAE7X,MAAM,UAAU,uBAAuB,CAAC,KAAoB;IAC1D,MAAM,QAAQ,GAAa,EAAE,CAAC;IAE9B,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACxB,QAAQ,CAAC,IAAI,CAAC,WAAW,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC;IACzC,IAAI,KAAK,CAAC,qBAAqB,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC3C,QAAQ,CAAC,IAAI,CAAC,uBAAuB,KAAK,CAAC,qBAAqB,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACjF,CAAC;IAED,QAAQ,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAC;IACrC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,IAAI,EAAE,CAAC,CAAC;IAE3C,IAAI,KAAK,CAAC,mBAAmB,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACzC,QAAQ,CAAC,IAAI,CAAC,0BAA0B,CAAC,CAAC;QAC1C,KAAK,MAAM,EAAE,IAAI,KAAK,CAAC,mBAAmB,EAAE,CAAC;YAC3C,QAAQ,CAAC,IAAI,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;QAC3B,CAAC;IACH,CAAC;IAED,QAAQ,CAAC,IAAI,CAAC,sCAAsC,CAAC,CAAC;IACtD,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,eAAe,CAAC,IAAI,EAAE,CAAC,CAAC;IAE5C,QAAQ,CAAC,IAAI,CAAC,uBAAuB,CAAC,CAAC;IACvC,QAAQ,CAAC,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;IAEtC,QAAQ,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;IAChC,QAAQ,CAAC,IAAI,CACX,oEAAoE;QAClE,kFAAkF,CACrF,CAAC;IAEF,OAAO,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC7B,CAAC;AAED,SAAS,UAAU,CAAC,IAA0B;IAC5C,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,cAAc,CAAC;IAC7C,MAAM,GAAG,GAAa,EAAE,CAAC;IACzB,KAAK,MAAM,KAAK,IAAI,IAAI,EAAE,CAAC;QACzB,GAAG,CAAC,IAAI,CAAC,OAAO,KAAK,CAAC,IAAI,MAAM,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC;QACjD,IAAI,KAAK,CAAC,MAAM,KAAK,SAAS,EAAE,CAAC;YAC/B,GAAG,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;YAC3B,SAAS;QACX,CAAC;QACD,MAAM,KAAK,GAAG,KAAK,CAAC,YAAY,IAAI,EAAE,CAAC;QACvC,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACvB,GAAG,CAAC,IAAI,CAAC,uBAAuB,CAAC,CAAC;YAClC,SAAS;QACX,CAAC;QACD,IAAI,KAAK,CAAC,MAAM,GAAG,iBAAiB,EAAE,CAAC;YACrC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,iBAAiB,CAAC,CAAC,CAAC;YAC5C,GAAG,CAAC,IAAI,CAAC,kBAAkB,KAAK,CAAC,MAAM,GAAG,iBAAiB,gBAAgB,CAAC,CAAC;QAC/E,CAAC;aAAM,CAAC;YACN,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAClB,CAAC;IACH,CAAC;IACD,OAAO,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AAC1B,CAAC"}
@@ -1,18 +0,0 @@
1
- /**
2
- * Backprop subagent runner — Phase 13.
3
- *
4
- * Single Tier-N call (Sonnet by default per workflow.md `backprop_author: 2`)
5
- * via the `claude` subprocess. Output is gated by `--json-schema`. The
6
- * harness consumes the structured payload, allocates a monotonic V-id,
7
- * and writes both the invariant file + the enforcement artifact.
8
- *
9
- * The runner does NOT commit. The orchestrator commits after the writer
10
- * succeeds, so a failed write doesn't leave a half-written invariant in
11
- * the mirror.
12
- */
13
- import type { BackpropInput, BackpropResult } from "./types.js";
14
- export interface RunBackpropArgs extends BackpropInput {
15
- /** Mirror path the artifacts are written into. */
16
- mirrorPath: string;
17
- }
18
- export declare function runBackprop(args: RunBackpropArgs): Promise<BackpropResult>;
@@ -1,95 +0,0 @@
1
- /**
2
- * Backprop subagent runner — Phase 13.
3
- *
4
- * Single Tier-N call (Sonnet by default per workflow.md `backprop_author: 2`)
5
- * via the `claude` subprocess. Output is gated by `--json-schema`. The
6
- * harness consumes the structured payload, allocates a monotonic V-id,
7
- * and writes both the invariant file + the enforcement artifact.
8
- *
9
- * The runner does NOT commit. The orchestrator commits after the writer
10
- * succeeds, so a failed write doesn't leave a half-written invariant in
11
- * the mirror.
12
- */
13
- import { runClaude } from "../claude/index.js";
14
- import { logger } from "../logger.js";
15
- import { allocateInvariantId } from "./id.js";
16
- import { buildBackpropUserPrompt, BACKPROP_SYSTEM_PROMPT } from "./prompt.js";
17
- import { BACKPROP_OUTPUT_SCHEMA } from "./schema.js";
18
- import { writeInvariantArtifacts } from "./writer.js";
19
- const log = logger("backprop");
20
- export async function runBackprop(args) {
21
- const userPrompt = buildBackpropUserPrompt(args);
22
- log.info({
23
- tier: args.tier,
24
- diff_files: args.diff.length,
25
- run_id: args.run_id,
26
- decisions: args.in_scope_decision_ids.length,
27
- }, "backprop dispatch");
28
- const result = await runClaude({
29
- tier: args.tier,
30
- prompt: userPrompt,
31
- system: BACKPROP_SYSTEM_PROMPT,
32
- jsonSchema: BACKPROP_OUTPUT_SCHEMA,
33
- timeoutMs: args.timeout_ms ?? 300_000,
34
- });
35
- if (!isOutput(result.parsed)) {
36
- throw new Error(`backprop returned malformed output. preview: ${result.text.slice(0, 200)}`);
37
- }
38
- const output = result.parsed;
39
- const invariantId = allocateInvariantId(args.mirrorPath);
40
- const writeResult = writeInvariantArtifacts({
41
- repoRoot: args.mirrorPath,
42
- invariantId,
43
- output,
44
- runId: args.run_id,
45
- });
46
- log.info({
47
- invariant_id: invariantId,
48
- slug: output.slug,
49
- enforcement: output.enforcement.kind,
50
- invariant_path: writeResult.invariant_path,
51
- sensor_path: writeResult.sensor_path,
52
- duration_ms: result.durationMs,
53
- }, "backprop complete");
54
- return {
55
- id: invariantId,
56
- invariant_path: writeResult.invariant_path,
57
- sensor_path: writeResult.sensor_path,
58
- output,
59
- tier: args.tier,
60
- duration_ms: result.durationMs,
61
- ...(result.usage !== undefined
62
- ? {
63
- usage: {
64
- ...(result.usage["input_tokens"] !== undefined
65
- ? { input_tokens: result.usage["input_tokens"] }
66
- : {}),
67
- ...(result.usage["output_tokens"] !== undefined
68
- ? { output_tokens: result.usage["output_tokens"] }
69
- : {}),
70
- },
71
- }
72
- : {}),
73
- };
74
- }
75
- function isOutput(value) {
76
- if (typeof value !== "object" || value === null)
77
- return false;
78
- const v = value;
79
- if (typeof v["slug"] !== "string")
80
- return false;
81
- if (typeof v["title"] !== "string")
82
- return false;
83
- if (typeof v["body_markdown"] !== "string")
84
- return false;
85
- if (typeof v["introduced_for_bug"] !== "string")
86
- return false;
87
- const enforcement = v["enforcement"];
88
- if (typeof enforcement !== "object" || enforcement === null)
89
- return false;
90
- const e = enforcement;
91
- if (e["kind"] !== "regex_sensor" && e["kind"] !== "named_e2e")
92
- return false;
93
- return true;
94
- }
95
- //# sourceMappingURL=runner.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"runner.js","sourceRoot":"","sources":["../../src/backprop/runner.ts"],"names":[],"mappings":"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"}
@@ -1,61 +0,0 @@
1
- /**
2
- * JSON Schema enforced by `claude --json-schema` for the backprop output.
3
- * Mirrors `BackpropOutput` exactly. Keep in sync with types.ts.
4
- */
5
- export declare const BACKPROP_OUTPUT_SCHEMA: {
6
- readonly type: "object";
7
- readonly additionalProperties: false;
8
- readonly properties: {
9
- readonly slug: {
10
- readonly type: "string";
11
- readonly pattern: "^[a-z0-9][a-z0-9-]{0,29}$";
12
- };
13
- readonly title: {
14
- readonly type: "string";
15
- readonly minLength: 1;
16
- };
17
- readonly body_markdown: {
18
- readonly type: "string";
19
- readonly minLength: 1;
20
- };
21
- readonly source_decision_ids: {
22
- readonly type: "array";
23
- readonly items: {
24
- readonly type: "string";
25
- };
26
- };
27
- readonly introduced_for_bug: {
28
- readonly type: "string";
29
- readonly minLength: 1;
30
- };
31
- readonly enforcement: {
32
- readonly type: "object";
33
- readonly additionalProperties: false;
34
- readonly properties: {
35
- readonly kind: {
36
- readonly enum: readonly ["regex_sensor", "named_e2e"];
37
- };
38
- readonly regex: {
39
- readonly type: "string";
40
- };
41
- readonly target_globs: {
42
- readonly type: "array";
43
- readonly items: {
44
- readonly type: "string";
45
- };
46
- };
47
- readonly language: {
48
- readonly enum: readonly ["typescript", "javascript", "python", "ruby", "go", "rust", "sql"];
49
- };
50
- readonly failure_message: {
51
- readonly type: "string";
52
- };
53
- readonly e2e_path: {
54
- readonly type: "string";
55
- };
56
- };
57
- readonly required: readonly ["kind"];
58
- };
59
- };
60
- readonly required: readonly ["slug", "title", "body_markdown", "introduced_for_bug", "enforcement"];
61
- };
@@ -1,55 +0,0 @@
1
- /**
2
- * JSON Schema enforced by `claude --json-schema` for the backprop output.
3
- * Mirrors `BackpropOutput` exactly. Keep in sync with types.ts.
4
- */
5
- export const BACKPROP_OUTPUT_SCHEMA = {
6
- type: "object",
7
- additionalProperties: false,
8
- properties: {
9
- slug: {
10
- type: "string",
11
- pattern: "^[a-z0-9][a-z0-9-]{0,29}$",
12
- },
13
- title: { type: "string", minLength: 1 },
14
- body_markdown: { type: "string", minLength: 1 },
15
- source_decision_ids: {
16
- type: "array",
17
- items: { type: "string" },
18
- },
19
- introduced_for_bug: { type: "string", minLength: 1 },
20
- enforcement: {
21
- type: "object",
22
- additionalProperties: false,
23
- properties: {
24
- kind: { enum: ["regex_sensor", "named_e2e"] },
25
- regex: { type: "string" },
26
- target_globs: {
27
- type: "array",
28
- items: { type: "string" },
29
- },
30
- language: {
31
- enum: [
32
- "typescript",
33
- "javascript",
34
- "python",
35
- "ruby",
36
- "go",
37
- "rust",
38
- "sql",
39
- ],
40
- },
41
- failure_message: { type: "string" },
42
- e2e_path: { type: "string" },
43
- },
44
- required: ["kind"],
45
- },
46
- },
47
- required: [
48
- "slug",
49
- "title",
50
- "body_markdown",
51
- "introduced_for_bug",
52
- "enforcement",
53
- ],
54
- };
55
- //# sourceMappingURL=schema.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"schema.js","sourceRoot":"","sources":["../../src/backprop/schema.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG;IACpC,IAAI,EAAE,QAAQ;IACd,oBAAoB,EAAE,KAAK;IAC3B,UAAU,EAAE;QACV,IAAI,EAAE;YACJ,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE,2BAA2B;SACrC;QACD,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC,EAAE;QACvC,aAAa,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC,EAAE;QAC/C,mBAAmB,EAAE;YACnB,IAAI,EAAE,OAAO;YACb,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;SAC1B;QACD,kBAAkB,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC,EAAE;QACpD,WAAW,EAAE;YACX,IAAI,EAAE,QAAQ;YACd,oBAAoB,EAAE,KAAK;YAC3B,UAAU,EAAE;gBACV,IAAI,EAAE,EAAE,IAAI,EAAE,CAAC,cAAc,EAAE,WAAW,CAAC,EAAE;gBAC7C,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;gBACzB,YAAY,EAAE;oBACZ,IAAI,EAAE,OAAO;oBACb,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;iBAC1B;gBACD,QAAQ,EAAE;oBACR,IAAI,EAAE;wBACJ,YAAY;wBACZ,YAAY;wBACZ,QAAQ;wBACR,MAAM;wBACN,IAAI;wBACJ,MAAM;wBACN,KAAK;qBACN;iBACF;gBACD,eAAe,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;gBACnC,QAAQ,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;aAC7B;YACD,QAAQ,EAAE,CAAC,MAAM,CAAC;SACnB;KACF;IACD,QAAQ,EAAE;QACR,MAAM;QACN,OAAO;QACP,eAAe;QACf,oBAAoB;QACpB,aAAa;KACd;CACO,CAAC"}
@@ -1,101 +0,0 @@
1
- /**
2
- * Backprop subagent (Phase 13).
3
- *
4
- * Per PRIMER §13 + INTEGRATION_PLAN §5 Phase 13: every code-class fix
5
- * produces a permanent §V invariant + a sensor (or named E2E case) that
6
- * enforces it going forward. Backprop runs as a second commit phase AFTER
7
- * sensors/reviewer/UAT all pass.
8
- *
9
- * Design constraints:
10
- * - Tier 2 (Sonnet) by default per templates/.harness/config/workflow.md
11
- * `backprop_author: 2`. Override via BackpropInput.tier.
12
- * - Structured output via `--json-schema` — backprop returns a typed
13
- * payload; the harness writes the invariant file + generates the
14
- * sensor script mechanically. The agent does NOT touch the filesystem.
15
- * - Invariant ids are monotonic, never reused (L13.2). The id allocator
16
- * scans existing `.harness/ground/invariants/V*.md` and returns the
17
- * next free integer.
18
- * - Sensor script template is a regex sniff over the diff. The agent
19
- * supplies the regex + a one-line failure message; the harness emits
20
- * the boilerplate around it. Future: a Tier-2-authored bespoke sensor
21
- * when the regex form is insufficient.
22
- */
23
- import type { ClaudeTier } from "../claude/index.js";
24
- import type { DiffEntry } from "../sensors/index.js";
25
- /** Surface that enforces the invariant. */
26
- export type EnforcementKind = "regex_sensor" | "named_e2e";
27
- /**
28
- * The structured object the backprop subagent emits. Constrained by
29
- * `BACKPROP_OUTPUT_SCHEMA` to keep the surface narrow and machine-checkable.
30
- */
31
- export interface BackpropOutput {
32
- /**
33
- * Short kebab-case slug used in the invariant filename + sensor filename.
34
- * Example: "no-jsonb-userid-filter". 30 char max.
35
- */
36
- slug: string;
37
- /** One-line invariant title. Imperative voice. */
38
- title: string;
39
- /** Markdown body of the invariant — what + why + how to enforce. */
40
- body_markdown: string;
41
- /** Names of decisions the invariant derives from, if any. */
42
- source_decision_ids?: string[];
43
- /** Original failure that motivated the fix (one paragraph). */
44
- introduced_for_bug: string;
45
- /** Mechanism that enforces the invariant going forward. */
46
- enforcement: {
47
- kind: EnforcementKind;
48
- /** When kind=regex_sensor: a JS-flavored regex pattern (string). */
49
- regex?: string;
50
- /** When kind=regex_sensor: which file globs to scan. Default `**\/*.ts`. */
51
- target_globs?: string[];
52
- /** When kind=regex_sensor: language hint for filtering. */
53
- language?: "typescript" | "javascript" | "python" | "ruby" | "go" | "rust" | "sql";
54
- /** When kind=regex_sensor: the failure message the sensor prints on a hit. */
55
- failure_message?: string;
56
- /** When kind=named_e2e: relative path of the generated test stub. */
57
- e2e_path?: string;
58
- };
59
- }
60
- export interface BackpropInput {
61
- /** The tightened spec body the implementer was given. */
62
- tightened_spec: string;
63
- /** Acceptance criteria the run satisfied. */
64
- acceptance_criteria: string[];
65
- /** Files touched by the fix run, with post-change content. */
66
- diff: DiffEntry[];
67
- /**
68
- * The failure that motivated this fix — the prior sensor finding,
69
- * reviewer hard gap, UAT rejection note, or human-supplied bug report.
70
- */
71
- failure_summary: string;
72
- /** Run id for cross-reference. Becomes `source_run` in the invariant frontmatter. */
73
- run_id: string;
74
- /** Decision ids whose scope this fix touches (for source_decision linkage). */
75
- in_scope_decision_ids: string[];
76
- /** Tier — default 2 (Sonnet) per workflow.md. */
77
- tier: ClaudeTier;
78
- /** Per-call timeout. Default 300_000 ms. */
79
- timeout_ms?: number;
80
- }
81
- /**
82
- * Result handed back to the orchestrator. The harness has already written
83
- * the invariant + sensor files into the mirror at this point; the caller
84
- * decides whether to commit.
85
- */
86
- export interface BackpropResult {
87
- /** Allocated invariant id. */
88
- id: string;
89
- /** Path of the written invariant file (repo-relative). */
90
- invariant_path: string;
91
- /** Path of the written sensor / E2E (repo-relative). */
92
- sensor_path: string;
93
- /** Original agent output for telemetry. */
94
- output: BackpropOutput;
95
- tier: ClaudeTier;
96
- duration_ms: number;
97
- usage?: {
98
- input_tokens?: number;
99
- output_tokens?: number;
100
- };
101
- }