@isaacriehm/cairn-core 0.1.10 → 0.3.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 (399) hide show
  1. package/dist/.tsbuildinfo +1 -1
  2. package/dist/claude/runner.d.ts +1 -1
  3. package/dist/claude/runner.js +62 -1
  4. package/dist/claude/runner.js.map +1 -1
  5. package/dist/claude/types.d.ts +14 -7
  6. package/dist/claude/types.js +5 -7
  7. package/dist/claude/types.js.map +1 -1
  8. package/dist/context/index.d.ts +4 -4
  9. package/dist/context/index.js +3 -4
  10. package/dist/context/index.js.map +1 -1
  11. package/dist/context/spec-delta.js +3 -4
  12. package/dist/context/spec-delta.js.map +1 -1
  13. package/dist/context/task-summary.d.ts +18 -0
  14. package/dist/context/task-summary.js +89 -0
  15. package/dist/context/task-summary.js.map +1 -0
  16. package/dist/decision-capture/id.d.ts +21 -4
  17. package/dist/decision-capture/id.js +56 -5
  18. package/dist/decision-capture/id.js.map +1 -1
  19. package/dist/decision-capture/index.d.ts +7 -22
  20. package/dist/decision-capture/index.js +7 -17
  21. package/dist/decision-capture/index.js.map +1 -1
  22. package/dist/doctor/index.d.ts +2 -2
  23. package/dist/doctor/index.js +5 -60
  24. package/dist/doctor/index.js.map +1 -1
  25. package/dist/events/index.d.ts +1 -1
  26. package/dist/events/index.js +1 -1
  27. package/dist/events/writer.d.ts +1 -1
  28. package/dist/events/writer.js +1 -1
  29. package/dist/gc/canary.d.ts +13 -23
  30. package/dist/gc/canary.js +36 -92
  31. package/dist/gc/canary.js.map +1 -1
  32. package/dist/gc/citation-integrity.d.ts +6 -6
  33. package/dist/gc/citation-integrity.js +64 -20
  34. package/dist/gc/citation-integrity.js.map +1 -1
  35. package/dist/gc/frontmatter.js +1 -1
  36. package/dist/gc/generator-drift.js +1 -1
  37. package/dist/gc/generator-drift.js.map +1 -1
  38. package/dist/gc/index.d.ts +2 -2
  39. package/dist/gc/index.js +1 -1
  40. package/dist/gc/index.js.map +1 -1
  41. package/dist/gc/quality-update.d.ts +4 -4
  42. package/dist/gc/quality-update.js +5 -5
  43. package/dist/gc/quality-update.js.map +1 -1
  44. package/dist/gc/types.d.ts +1 -30
  45. package/dist/ground/index.d.ts +2 -2
  46. package/dist/ground/index.js +1 -1
  47. package/dist/ground/index.js.map +1 -1
  48. package/dist/ground/ledgers.d.ts +0 -4
  49. package/dist/ground/ledgers.js +10 -8
  50. package/dist/ground/ledgers.js.map +1 -1
  51. package/dist/ground/manifest.js +0 -4
  52. package/dist/ground/manifest.js.map +1 -1
  53. package/dist/ground/paths.js +0 -1
  54. package/dist/ground/paths.js.map +1 -1
  55. package/dist/ground/quality-grades.js +3 -1
  56. package/dist/ground/quality-grades.js.map +1 -1
  57. package/dist/ground/schemas.d.ts +2 -7
  58. package/dist/ground/schemas.js +7 -2
  59. package/dist/ground/schemas.js.map +1 -1
  60. package/dist/ground/scope-index.d.ts +62 -14
  61. package/dist/ground/scope-index.js +215 -45
  62. package/dist/ground/scope-index.js.map +1 -1
  63. package/dist/hooks/bypass-detection.js +14 -17
  64. package/dist/hooks/bypass-detection.js.map +1 -1
  65. package/dist/hooks/defer.d.ts +50 -0
  66. package/dist/hooks/defer.js +87 -0
  67. package/dist/hooks/defer.js.map +1 -0
  68. package/dist/hooks/post-tool-use/citation-scanner.d.ts +7 -5
  69. package/dist/hooks/post-tool-use/citation-scanner.js +15 -9
  70. package/dist/hooks/post-tool-use/citation-scanner.js.map +1 -1
  71. package/dist/hooks/post-tool-use/copy-scanner.js +1 -1
  72. package/dist/hooks/post-tool-use/copy-scanner.js.map +1 -1
  73. package/dist/hooks/post-tool-use/ledger-cache.d.ts +10 -2
  74. package/dist/hooks/post-tool-use/ledger-cache.js +58 -4
  75. package/dist/hooks/post-tool-use/ledger-cache.js.map +1 -1
  76. package/dist/hooks/post-tool-use/legend-builder.d.ts +3 -3
  77. package/dist/hooks/post-tool-use/legend-builder.js +30 -8
  78. package/dist/hooks/post-tool-use/legend-builder.js.map +1 -1
  79. package/dist/hooks/post-tool-use/read-enricher.d.ts +1 -1
  80. package/dist/hooks/post-tool-use/read-enricher.js +68 -21
  81. package/dist/hooks/post-tool-use/read-enricher.js.map +1 -1
  82. package/dist/hooks/post-tool-use/write-guardian.js +148 -18
  83. package/dist/hooks/post-tool-use/write-guardian.js.map +1 -1
  84. package/dist/hooks/runners/index.d.ts +3 -0
  85. package/dist/hooks/runners/index.js +2 -0
  86. package/dist/hooks/runners/index.js.map +1 -1
  87. package/dist/hooks/runners/payload.d.ts +1 -1
  88. package/dist/hooks/runners/payload.js +27 -12
  89. package/dist/hooks/runners/payload.js.map +1 -1
  90. package/dist/hooks/runners/session-start.js +250 -75
  91. package/dist/hooks/runners/session-start.js.map +1 -1
  92. package/dist/hooks/runners/stop.d.ts +9 -12
  93. package/dist/hooks/runners/stop.js +129 -41
  94. package/dist/hooks/runners/stop.js.map +1 -1
  95. package/dist/hooks/runners/user-prompt-submit.d.ts +15 -0
  96. package/dist/hooks/runners/user-prompt-submit.js +149 -0
  97. package/dist/hooks/runners/user-prompt-submit.js.map +1 -0
  98. package/dist/hooks/seed-attested.d.ts +25 -0
  99. package/dist/hooks/seed-attested.js +84 -0
  100. package/dist/hooks/seed-attested.js.map +1 -0
  101. package/dist/hooks/user-prompt-submit.d.ts +7 -0
  102. package/dist/hooks/user-prompt-submit.js +12 -0
  103. package/dist/hooks/user-prompt-submit.js.map +1 -0
  104. package/dist/index.d.ts +3 -6
  105. package/dist/index.js +14 -12
  106. package/dist/index.js.map +1 -1
  107. package/dist/init/baseline-audit.d.ts +5 -1
  108. package/dist/init/baseline-audit.js +25 -2
  109. package/dist/init/baseline-audit.js.map +1 -1
  110. package/dist/init/glob-inference.d.ts +16 -0
  111. package/dist/init/glob-inference.js +108 -0
  112. package/dist/init/glob-inference.js.map +1 -0
  113. package/dist/init/index.d.ts +4 -0
  114. package/dist/init/index.js +2 -0
  115. package/dist/init/index.js.map +1 -1
  116. package/dist/init/ingest-docs.d.ts +1 -1
  117. package/dist/init/ingest-docs.js +19 -6
  118. package/dist/init/ingest-docs.js.map +1 -1
  119. package/dist/init/init.js +17 -94
  120. package/dist/init/init.js.map +1 -1
  121. package/dist/init/mapper-merge.d.ts +8 -2
  122. package/dist/init/mapper-merge.js +50 -32
  123. package/dist/init/mapper-merge.js.map +1 -1
  124. package/dist/init/mapper-parallel.d.ts +2 -3
  125. package/dist/init/mapper-parallel.js +9 -38
  126. package/dist/init/mapper-parallel.js.map +1 -1
  127. package/dist/init/mapper-prompts.js +1 -1
  128. package/dist/init/mapper-prompts.js.map +1 -1
  129. package/dist/init/mapper.d.ts +7 -128
  130. package/dist/init/mapper.js +30 -7
  131. package/dist/init/mapper.js.map +1 -1
  132. package/dist/init/module-slicer.d.ts +1 -1
  133. package/dist/init/module-slicer.js +1 -1
  134. package/dist/init/multi-dev/install.d.ts +9 -10
  135. package/dist/init/multi-dev/install.js +15 -84
  136. package/dist/init/multi-dev/install.js.map +1 -1
  137. package/dist/init/overlay.d.ts +14 -0
  138. package/dist/init/overlay.js +65 -0
  139. package/dist/init/overlay.js.map +1 -0
  140. package/dist/init/phases/1-detect.d.ts +10 -0
  141. package/dist/init/phases/1-detect.js +36 -0
  142. package/dist/init/phases/1-detect.js.map +1 -0
  143. package/dist/init/phases/10-strip.d.ts +11 -0
  144. package/dist/init/phases/10-strip.js +79 -0
  145. package/dist/init/phases/10-strip.js.map +1 -0
  146. package/dist/init/phases/12-multidev.d.ts +6 -0
  147. package/dist/init/phases/12-multidev.js +34 -0
  148. package/dist/init/phases/12-multidev.js.map +1 -0
  149. package/dist/init/phases/2-walker.d.ts +8 -0
  150. package/dist/init/phases/2-walker.js +34 -0
  151. package/dist/init/phases/2-walker.js.map +1 -0
  152. package/dist/init/phases/3-mapper.d.ts +14 -0
  153. package/dist/init/phases/3-mapper.js +56 -0
  154. package/dist/init/phases/3-mapper.js.map +1 -0
  155. package/dist/init/phases/3b-seed.d.ts +18 -0
  156. package/dist/init/phases/3b-seed.js +140 -0
  157. package/dist/init/phases/3b-seed.js.map +1 -0
  158. package/dist/init/phases/4-pilot.d.ts +10 -0
  159. package/dist/init/phases/4-pilot.js +108 -0
  160. package/dist/init/phases/4-pilot.js.map +1 -0
  161. package/dist/init/phases/5-brand.d.ts +10 -0
  162. package/dist/init/phases/5-brand.js +66 -0
  163. package/dist/init/phases/5-brand.js.map +1 -0
  164. package/dist/init/phases/6-docs-ingest.d.ts +11 -0
  165. package/dist/init/phases/6-docs-ingest.js +39 -0
  166. package/dist/init/phases/6-docs-ingest.js.map +1 -0
  167. package/dist/init/phases/7b-source-comments.d.ts +6 -0
  168. package/dist/init/phases/7b-source-comments.js +34 -0
  169. package/dist/init/phases/7b-source-comments.js.map +1 -0
  170. package/dist/init/phases/7c-rules-merge.d.ts +6 -0
  171. package/dist/init/phases/7c-rules-merge.js +34 -0
  172. package/dist/init/phases/7c-rules-merge.js.map +1 -0
  173. package/dist/init/phases/8-baseline.d.ts +10 -0
  174. package/dist/init/phases/8-baseline.js +52 -0
  175. package/dist/init/phases/8-baseline.js.map +1 -0
  176. package/dist/init/phases/index.d.ts +15 -0
  177. package/dist/init/phases/index.js +16 -0
  178. package/dist/init/phases/index.js.map +1 -0
  179. package/dist/init/phases/orchestrator.d.ts +49 -0
  180. package/dist/init/phases/orchestrator.js +85 -0
  181. package/dist/init/phases/orchestrator.js.map +1 -0
  182. package/dist/init/phases/state-io.d.ts +19 -0
  183. package/dist/init/phases/state-io.js +73 -0
  184. package/dist/init/phases/state-io.js.map +1 -0
  185. package/dist/init/phases/types.d.ts +93 -0
  186. package/dist/init/phases/types.js +30 -0
  187. package/dist/init/phases/types.js.map +1 -0
  188. package/dist/init/prompts.d.ts +6 -8
  189. package/dist/init/prompts.js +3 -6
  190. package/dist/init/prompts.js.map +1 -1
  191. package/dist/init/rules-merge/ingest.js +1 -1
  192. package/dist/init/seed.js +11 -2
  193. package/dist/init/seed.js.map +1 -1
  194. package/dist/init/source-comments/classify.d.ts +1 -41
  195. package/dist/init/source-comments/classify.js +68 -37
  196. package/dist/init/source-comments/classify.js.map +1 -1
  197. package/dist/init/source-comments/index.d.ts +2 -2
  198. package/dist/init/source-comments/index.js +2 -2
  199. package/dist/init/source-comments/index.js.map +1 -1
  200. package/dist/init/source-comments/ingest.d.ts +38 -2
  201. package/dist/init/source-comments/ingest.js +237 -4
  202. package/dist/init/source-comments/ingest.js.map +1 -1
  203. package/dist/init/source-comments/strip-replace.d.ts +10 -19
  204. package/dist/init/source-comments/strip-replace.js +26 -2
  205. package/dist/init/source-comments/strip-replace.js.map +1 -1
  206. package/dist/init/source-comments/walker.d.ts +9 -2
  207. package/dist/init/source-comments/walker.js +38 -19
  208. package/dist/init/source-comments/walker.js.map +1 -1
  209. package/dist/init/submodules.d.ts +3 -2
  210. package/dist/init/types.d.ts +3 -5
  211. package/dist/init/types.js +3 -5
  212. package/dist/init/types.js.map +1 -1
  213. package/dist/init/visual.d.ts +4 -9
  214. package/dist/init/visual.js +1 -16
  215. package/dist/init/visual.js.map +1 -1
  216. package/dist/init/walker.d.ts +0 -6
  217. package/dist/init/walker.js +2 -3
  218. package/dist/init/walker.js.map +1 -1
  219. package/dist/join/index.js +49 -2
  220. package/dist/join/index.js.map +1 -1
  221. package/dist/logger.d.ts +1 -2
  222. package/dist/logger.js +5 -6
  223. package/dist/logger.js.map +1 -1
  224. package/dist/mcp/context.d.ts +2 -3
  225. package/dist/mcp/context.js.map +1 -1
  226. package/dist/mcp/errors.d.ts +1 -1
  227. package/dist/mcp/errors.js.map +1 -1
  228. package/dist/mcp/history/prompt.d.ts +2 -1
  229. package/dist/mcp/history/walker.js +1 -1
  230. package/dist/mcp/history/walker.js.map +1 -1
  231. package/dist/mcp/path-allowlist.d.ts +0 -6
  232. package/dist/mcp/path-allowlist.js +0 -10
  233. package/dist/mcp/path-allowlist.js.map +1 -1
  234. package/dist/mcp/schemas.d.ts +34 -72
  235. package/dist/mcp/schemas.js +40 -70
  236. package/dist/mcp/schemas.js.map +1 -1
  237. package/dist/mcp/serve.d.ts +1 -1
  238. package/dist/mcp/serve.js +2 -5
  239. package/dist/mcp/serve.js.map +1 -1
  240. package/dist/mcp/server.js +10 -4
  241. package/dist/mcp/server.js.map +1 -1
  242. package/dist/mcp/telemetry.d.ts +8 -1
  243. package/dist/mcp/telemetry.js +16 -0
  244. package/dist/mcp/telemetry.js.map +1 -1
  245. package/dist/mcp/tools/decision-get.js +37 -29
  246. package/dist/mcp/tools/decision-get.js.map +1 -1
  247. package/dist/mcp/tools/decisions-in-scope.js +22 -3
  248. package/dist/mcp/tools/decisions-in-scope.js.map +1 -1
  249. package/dist/mcp/tools/ground-get.js +2 -2
  250. package/dist/mcp/tools/ground-get.js.map +1 -1
  251. package/dist/mcp/tools/index.js +6 -2
  252. package/dist/mcp/tools/index.js.map +1 -1
  253. package/dist/mcp/tools/init-phases.d.ts +24 -0
  254. package/dist/mcp/tools/init-phases.js +140 -0
  255. package/dist/mcp/tools/init-phases.js.map +1 -0
  256. package/dist/mcp/tools/invariant-get.js +1 -1
  257. package/dist/mcp/tools/invariant-get.js.map +1 -1
  258. package/dist/mcp/tools/invariants-in-scope.js +26 -7
  259. package/dist/mcp/tools/invariants-in-scope.js.map +1 -1
  260. package/dist/mcp/tools/query-history.js +3 -3
  261. package/dist/mcp/tools/query-history.js.map +1 -1
  262. package/dist/mcp/tools/resolve-attention.d.ts +6 -4
  263. package/dist/mcp/tools/resolve-attention.js +253 -24
  264. package/dist/mcp/tools/resolve-attention.js.map +1 -1
  265. package/dist/mcp/tools/search.js +3 -4
  266. package/dist/mcp/tools/search.js.map +1 -1
  267. package/dist/mcp/tools/task-create.d.ts +15 -0
  268. package/dist/mcp/tools/task-create.js +96 -0
  269. package/dist/mcp/tools/task-create.js.map +1 -0
  270. package/dist/mcp/tools/timeline.js +3 -7
  271. package/dist/mcp/tools/timeline.js.map +1 -1
  272. package/dist/profiles/types.d.ts +2 -2
  273. package/dist/profiles/types.js +1 -1
  274. package/dist/sensors/catalog.js +8 -3
  275. package/dist/sensors/catalog.js.map +1 -1
  276. package/dist/session/id.d.ts +1 -3
  277. package/dist/session/id.js +1 -1
  278. package/dist/session/id.js.map +1 -1
  279. package/dist/session-start/build.d.ts +7 -11
  280. package/dist/session-start/build.js +62 -34
  281. package/dist/session-start/build.js.map +1 -1
  282. package/dist/session-start/index.d.ts +2 -2
  283. package/dist/session-start/index.js +2 -2
  284. package/dist/session-start/index.js.map +1 -1
  285. package/dist/session-start/templates.d.ts +20 -4
  286. package/dist/session-start/templates.js +45 -35
  287. package/dist/session-start/templates.js.map +1 -1
  288. package/dist/status-line/format.d.ts +20 -9
  289. package/dist/status-line/format.js +45 -35
  290. package/dist/status-line/format.js.map +1 -1
  291. package/dist/status-line/index.d.ts +3 -4
  292. package/dist/status-line/index.js +1 -1
  293. package/dist/status-line/index.js.map +1 -1
  294. package/dist/status-line/reader.d.ts +9 -6
  295. package/dist/status-line/reader.js +50 -18
  296. package/dist/status-line/reader.js.map +1 -1
  297. package/dist/status-line/writer.d.ts +6 -9
  298. package/dist/status-line/writer.js +10 -12
  299. package/dist/status-line/writer.js.map +1 -1
  300. package/dist/trace/index.d.ts +44 -0
  301. package/dist/trace/index.js +51 -0
  302. package/dist/trace/index.js.map +1 -0
  303. package/package.json +2 -3
  304. package/templates/.archive/README.md +3 -3
  305. package/templates/.cairn/JOIN.md +3 -9
  306. package/templates/.cairn/config/sensors.yaml +16 -19
  307. package/templates/.cairn/config/stub-patterns.yaml +4 -4
  308. package/templates/.cairn/config/trust-policy.yaml +3 -35
  309. package/templates/.cairn/config/workflow.md +13 -194
  310. package/templates/.cairn/git-hooks/commit-msg +15 -4
  311. package/templates/.cairn/git-hooks/pre-commit +22 -13
  312. package/templates/.cairn/ground/canonical-map/topics.yaml +3 -26
  313. package/templates/.cairn/ground/capabilities/snippets.yaml +0 -1
  314. package/templates/.cairn/ground/manifest.yaml +5 -8
  315. package/templates/.cairn/ground/product/personas.yaml +0 -1
  316. package/dist/context/checkpoint.d.ts +0 -10
  317. package/dist/context/checkpoint.js +0 -29
  318. package/dist/context/checkpoint.js.map +0 -1
  319. package/dist/decision-capture/capture.d.ts +0 -57
  320. package/dist/decision-capture/capture.js +0 -186
  321. package/dist/decision-capture/capture.js.map +0 -1
  322. package/dist/decision-capture/extractor.d.ts +0 -20
  323. package/dist/decision-capture/extractor.js +0 -103
  324. package/dist/decision-capture/extractor.js.map +0 -1
  325. package/dist/decision-capture/prompt.d.ts +0 -15
  326. package/dist/decision-capture/prompt.js +0 -68
  327. package/dist/decision-capture/prompt.js.map +0 -1
  328. package/dist/decision-capture/refinement-prompt.d.ts +0 -25
  329. package/dist/decision-capture/refinement-prompt.js +0 -146
  330. package/dist/decision-capture/refinement-prompt.js.map +0 -1
  331. package/dist/decision-capture/refinement-schema.d.ts +0 -52
  332. package/dist/decision-capture/refinement-schema.js +0 -61
  333. package/dist/decision-capture/refinement-schema.js.map +0 -1
  334. package/dist/decision-capture/refinement.d.ts +0 -60
  335. package/dist/decision-capture/refinement.js +0 -439
  336. package/dist/decision-capture/refinement.js.map +0 -1
  337. package/dist/decision-capture/schema.d.ts +0 -70
  338. package/dist/decision-capture/schema.js +0 -71
  339. package/dist/decision-capture/schema.js.map +0 -1
  340. package/dist/decision-capture/types.d.ts +0 -201
  341. package/dist/decision-capture/types.js +0 -20
  342. package/dist/decision-capture/types.js.map +0 -1
  343. package/dist/decision-capture/writer.d.ts +0 -90
  344. package/dist/decision-capture/writer.js +0 -267
  345. package/dist/decision-capture/writer.js.map +0 -1
  346. package/dist/frontend-types.d.ts +0 -243
  347. package/dist/frontend-types.js +0 -15
  348. package/dist/frontend-types.js.map +0 -1
  349. package/dist/hooks/index.d.ts +0 -12
  350. package/dist/hooks/index.js +0 -13
  351. package/dist/hooks/index.js.map +0 -1
  352. package/dist/inbox.d.ts +0 -17
  353. package/dist/inbox.js +0 -30
  354. package/dist/inbox.js.map +0 -1
  355. package/dist/mcp/tools/append-run-note.d.ts +0 -18
  356. package/dist/mcp/tools/append-run-note.js +0 -47
  357. package/dist/mcp/tools/append-run-note.js.map +0 -1
  358. package/dist/mcp/tools/append.d.ts +0 -8
  359. package/dist/mcp/tools/append.js +0 -37
  360. package/dist/mcp/tools/append.js.map +0 -1
  361. package/dist/mcp/tools/ask-operator.d.ts +0 -34
  362. package/dist/mcp/tools/ask-operator.js +0 -97
  363. package/dist/mcp/tools/ask-operator.js.map +0 -1
  364. package/dist/mcp/tools/drop-task.d.ts +0 -12
  365. package/dist/mcp/tools/drop-task.js +0 -68
  366. package/dist/mcp/tools/drop-task.js.map +0 -1
  367. package/dist/mcp/tools/record-run-event.d.ts +0 -10
  368. package/dist/mcp/tools/record-run-event.js +0 -32
  369. package/dist/mcp/tools/record-run-event.js.map +0 -1
  370. package/dist/prompt.d.ts +0 -19
  371. package/dist/prompt.js +0 -50
  372. package/dist/prompt.js.map +0 -1
  373. package/dist/tier0/classify.d.ts +0 -10
  374. package/dist/tier0/classify.js +0 -110
  375. package/dist/tier0/classify.js.map +0 -1
  376. package/dist/tier0/index.d.ts +0 -2
  377. package/dist/tier0/index.js +0 -2
  378. package/dist/tier0/index.js.map +0 -1
  379. package/dist/tier0/types.d.ts +0 -24
  380. package/dist/tier0/types.js +0 -9
  381. package/dist/tier0/types.js.map +0 -1
  382. package/dist/tightener/index.d.ts +0 -4
  383. package/dist/tightener/index.js +0 -4
  384. package/dist/tightener/index.js.map +0 -1
  385. package/dist/tightener/prompt.d.ts +0 -3
  386. package/dist/tightener/prompt.js +0 -67
  387. package/dist/tightener/prompt.js.map +0 -1
  388. package/dist/tightener/schema.d.ts +0 -68
  389. package/dist/tightener/schema.js +0 -44
  390. package/dist/tightener/schema.js.map +0 -1
  391. package/dist/tightener/tighten.d.ts +0 -2
  392. package/dist/tightener/tighten.js +0 -66
  393. package/dist/tightener/tighten.js.map +0 -1
  394. package/dist/tightener/types.d.ts +0 -74
  395. package/dist/tightener/types.js +0 -6
  396. package/dist/tightener/types.js.map +0 -1
  397. package/templates/.claude/settings.json +0 -57
  398. package/templates/.mcp.json +0 -8
  399. package/templates/README.md +0 -24
@@ -1,28 +1,44 @@
1
1
  /**
2
2
  * `Stop` hook runner — fires when the assistant turn ends.
3
3
  *
4
- * Current scope:
5
- * • Drain `.cairn/events/` since the per-session marker; stamp the
6
- * poll cursor so the next Stop only sees newer events.
7
- * • Scan `.cairn/tasks/active/<id>/` for tasks that have a
8
- * tightened spec but no `attestation.yaml`; surface a reviewer-
9
- * spawn hint in additionalContext so main Claude can spawn the
10
- * reviewer subagent on the next assistant turn.
11
- * • Patch the per-session status.json `updated_at` (heartbeat).
4
+ * Per PLUGIN_ARCHITECTURE §10:
5
+ * • Drains `.cairn/events/` since the per-session marker.
6
+ * Scans `.cairn/tasks/active/<id>/` for tasks missing attestation.yaml.
7
+ * • Compares HEAD's last 5 commits against `.cairn/.attested-commits`;
8
+ * surfaces bypass hint for `--no-verify` commits.
9
+ * Patches per-session status.json `updated_at` (heartbeat).
12
10
  *
13
- * Future scope (steps 7–8 per PLUGIN_ARCHITECTURE §10):
14
- * Run sensors on staged + unstaged diff; surface findings inline.
15
- * Compare HEAD's last 5 commits against `.attested-commits` marker;
16
- * surface backfill prompt for `--no-verify` bypasses.
11
+ * When context to surface: emits `{ decision: "block", reason: "..." }` so
12
+ * Claude reads the hint and invokes cairn-attention on the next turn.
13
+ * When nothing: emits `{ continue: true }` and Claude stops normally.
17
14
  */
18
- import { existsSync, readdirSync, statSync } from "node:fs";
15
+ import { existsSync, readdirSync, readFileSync, statSync } from "node:fs";
19
16
  import { join } from "node:path";
17
+ import { readActiveTaskSummary } from "../../context/index.js";
20
18
  import { eventsSince, } from "../../events/index.js";
21
19
  import { renderBypassHint, scanBypassedCommits, } from "../bypass-detection.js";
20
+ import { isDeferActive, readDeferState } from "../defer.js";
22
21
  import { resolveRepoRoot } from "../../session-start/index.js";
23
22
  import { readEventsMarker, stampEventsPoll, } from "../../session/index.js";
24
23
  import { writeStatusJson } from "../../status-line/index.js";
25
24
  import { emitShapeB, parseHookPayload, readHookStdin, recordHookTelemetry, } from "./payload.js";
25
+ /** Init in progress means `.cairn/init-state.json` exists at repoRoot. */
26
+ function isInitInProgress(repoRoot) {
27
+ return existsSync(join(repoRoot, ".cairn", "init-state.json"));
28
+ }
29
+ /**
30
+ * Cap the reason text that flows back to Claude Code via decision:block.
31
+ * Both the reviewer hint and the bypass hint can fire on the same Stop
32
+ * tick; 4 KB is generous for two A/B/C strips but small enough that
33
+ * overflow is structurally impossible.
34
+ */
35
+ const MAX_REASON_CHARS = 4_000;
36
+ function clampReason(body) {
37
+ if (body.length <= MAX_REASON_CHARS)
38
+ return body;
39
+ const head = body.slice(0, MAX_REASON_CHARS - 80);
40
+ return `${head}\n\n…(truncated; resolve via cairn-attention)`;
41
+ }
26
42
  export async function runStopHook() {
27
43
  const startedAt = Date.now();
28
44
  const raw = await readHookStdin();
@@ -34,7 +50,7 @@ export async function runStopHook() {
34
50
  let drained = [];
35
51
  let pendingReviews = [];
36
52
  let bypassed = [];
37
- let additionalContext = "";
53
+ let reason = "";
38
54
  if (repoRoot !== null && sessionId !== null && sessionId.length > 0) {
39
55
  try {
40
56
  const marker = readEventsMarker(repoRoot, sessionId);
@@ -49,42 +65,83 @@ export async function runStopHook() {
49
65
  catch (err) {
50
66
  warnings.push(`events_poll_failed: ${err instanceof Error ? err.message : String(err)}`);
51
67
  }
52
- try {
53
- pendingReviews = scanPendingReviews(repoRoot);
54
- if (pendingReviews.length > 0) {
55
- additionalContext = renderReviewerHint(pendingReviews);
56
- }
68
+ const now = new Date();
69
+ // Suppress reviewer + bypass surfaces while init is mid-flight —
70
+ // `.cairn/.attested-commits` may not yet be seeded, and the
71
+ // adoption skill owns the operator's attention until phase 12
72
+ // returns nextPhase=null. The MCP init-phases tool clears the
73
+ // state file as soon as the final phase completes, after which
74
+ // the next Stop tick scans normally.
75
+ const initInProgress = isInitInProgress(repoRoot);
76
+ if (initInProgress) {
77
+ warnings.push("init_in_progress:scans_suppressed");
57
78
  }
58
- catch (err) {
59
- warnings.push(`pending_review_scan_failed: ${err instanceof Error ? err.message : String(err)}`);
60
- }
61
- try {
62
- const bypassResult = scanBypassedCommits(repoRoot);
63
- bypassed = bypassResult.bypassed;
64
- if (bypassed.length > 0) {
65
- const hint = renderBypassHint(bypassed);
66
- additionalContext = additionalContext.length > 0
67
- ? `${additionalContext}\n\n${hint}`
68
- : hint;
79
+ if (!initInProgress) {
80
+ try {
81
+ pendingReviews = scanPendingReviews(repoRoot);
82
+ if (pendingReviews.length > 0) {
83
+ const reviewDefer = readDeferState(repoRoot, "review");
84
+ const suppressed = reviewDefer !== null &&
85
+ isDeferActive(reviewDefer, now, {
86
+ kind: "task_ids",
87
+ values: pendingReviews.map((p) => p.task_id),
88
+ });
89
+ if (suppressed) {
90
+ warnings.push(`review_suppressed_until:${reviewDefer.deferred_at}`);
91
+ }
92
+ else {
93
+ reason = renderReviewerHint(pendingReviews);
94
+ }
95
+ }
96
+ }
97
+ catch (err) {
98
+ warnings.push(`pending_review_scan_failed: ${err instanceof Error ? err.message : String(err)}`);
99
+ }
100
+ try {
101
+ const bypassResult = scanBypassedCommits(repoRoot);
102
+ bypassed = bypassResult.bypassed;
103
+ if (bypassed.length > 0) {
104
+ const bypassDefer = readDeferState(repoRoot, "bypass");
105
+ const suppressed = bypassDefer !== null &&
106
+ isDeferActive(bypassDefer, now, {
107
+ kind: "shas",
108
+ values: bypassed.map((b) => b.sha),
109
+ });
110
+ if (suppressed) {
111
+ warnings.push(`bypass_suppressed_until:${bypassDefer.deferred_at}`);
112
+ }
113
+ else {
114
+ const hint = renderBypassHint(bypassed);
115
+ reason = reason.length > 0 ? `${reason}\n\n${hint}` : hint;
116
+ }
117
+ }
118
+ }
119
+ catch (err) {
120
+ warnings.push(`bypass_scan_failed: ${err instanceof Error ? err.message : String(err)}`);
69
121
  }
70
- }
71
- catch (err) {
72
- warnings.push(`bypass_scan_failed: ${err instanceof Error ? err.message : String(err)}`);
73
122
  }
74
123
  try {
124
+ const active = readActiveTaskSummary(repoRoot);
75
125
  writeStatusJson(repoRoot, sessionId, {
76
126
  updated_at: new Date().toISOString(),
127
+ task_state: active?.taskState ?? "idle",
128
+ task_id: active?.taskId ?? null,
129
+ task_module: active?.taskModule ?? null,
130
+ bypass_count: bypassed.length,
77
131
  });
78
132
  }
79
133
  catch (err) {
80
134
  warnings.push(`status_heartbeat_failed: ${err instanceof Error ? err.message : String(err)}`);
81
135
  }
82
136
  }
83
- // Claude Code's Stop hook schema rejects hookSpecificOutput. Surface
84
- // text via the top-level systemMessage field; empty payload is fine.
85
- const out = { continue: true };
86
- if (additionalContext.length > 0)
87
- out.systemMessage = additionalContext;
137
+ // Stop hook uses decision:block+reason to inject context into Claude
138
+ // (Stop does not support hookSpecificOutput.additionalContext that
139
+ // field is silently ignored by Claude Code for Stop events). When
140
+ // reason is non-empty, blocking keeps the session alive so Claude
141
+ // reads the reason and acts on it (e.g. invokes cairn-attention).
142
+ const out = reason.length > 0
143
+ ? { decision: "block", reason: clampReason(reason) }
144
+ : { continue: true };
88
145
  emitShapeB(out);
89
146
  recordHookTelemetry({
90
147
  hook: "stop",
@@ -97,6 +154,8 @@ export async function runStopHook() {
97
154
  events_drained: drained.length,
98
155
  pending_reviews: pendingReviews.length,
99
156
  bypassed_commits: bypassed.length,
157
+ decision: reason.length > 0 ? "block" : "continue",
158
+ ...(reason.length > 0 ? { reason } : {}),
100
159
  },
101
160
  });
102
161
  }
@@ -109,6 +168,30 @@ export async function runStopHook() {
109
168
  * Older orphans are stale; the operator deals with them via attention
110
169
  * rather than spawning reviewers blindly.
111
170
  */
171
+ // Phases a task moves through. The reviewer-attestation prompt only
172
+ // fires for tasks that are explicitly ready for review — a fresh
173
+ // `running` task has work in flight, no reviewer needed yet.
174
+ const REVIEW_READY_PHASES = new Set(["ready_for_review", "awaiting_attestation"]);
175
+ function readTaskPhase(taskDir) {
176
+ const statusPath = join(taskDir, "status.yaml");
177
+ if (!existsSync(statusPath))
178
+ return null;
179
+ let raw;
180
+ try {
181
+ raw = readFileSync(statusPath, "utf8");
182
+ }
183
+ catch {
184
+ return null;
185
+ }
186
+ // Cheap line scan — `phase: <value>` at top-level. Avoid a full
187
+ // YAML parse (this runs on every Stop tick).
188
+ for (const line of raw.split(/\r?\n/)) {
189
+ const m = line.match(/^phase:\s*(\S+)/);
190
+ if (m && m[1] !== undefined)
191
+ return m[1].replace(/['"]/g, "");
192
+ }
193
+ return null;
194
+ }
112
195
  function scanPendingReviews(repoRoot) {
113
196
  const activeDir = join(repoRoot, ".cairn", "tasks", "active");
114
197
  if (!existsSync(activeDir))
@@ -133,6 +216,10 @@ function scanPendingReviews(repoRoot) {
133
216
  const attestation = join(taskDir, "attestation.yaml");
134
217
  if (existsSync(attestation))
135
218
  continue;
219
+ // Phase gate — `running` / `tightening` / etc. are not review-ready.
220
+ const phase = readTaskPhase(taskDir);
221
+ if (phase !== null && !REVIEW_READY_PHASES.has(phase))
222
+ continue;
136
223
  let mtime = 0;
137
224
  try {
138
225
  mtime = statSync(tightenedSpec).mtimeMs;
@@ -151,13 +238,14 @@ function scanPendingReviews(repoRoot) {
151
238
  }
152
239
  function renderReviewerHint(pending) {
153
240
  const lines = [];
154
- lines.push(`## Reviewer pending (${pending.length} task${pending.length === 1 ? "" : "s"})`);
241
+ const noun = pending.length === 1 ? "task" : "tasks";
242
+ lines.push(`## Cairn — ${pending.length} ${noun} awaiting review attestation`);
155
243
  lines.push("");
156
244
  for (const p of pending) {
157
- lines.push(`- **${p.task_id}** — ${p.spec_path}`);
245
+ lines.push(`- \`${p.task_id}\``);
158
246
  }
159
247
  lines.push("");
160
- lines.push("Spawn the `reviewer` subagent (defined at `agents/reviewer.md` in the cairn plugin) via the Task tool to attest each pending task. The subagent reads the diff, collects subagent attestation files, extracts non-obvious DECs, and writes the consolidated `attestation.yaml`. Once written, this hook will stop surfacing the reminder.");
248
+ lines.push("Invoke the `cairn-attention` skill on the next turn so the operator can pick run review / skip / defer through `AskUserQuestion`.");
161
249
  return lines.join("\n");
162
250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GAAG,CAAC,IAAI,CAAC;YACP,OAAO,EAAE,MAAM;YACf,SAAS,EAAE,uBAAuB,MAAM,oBAAoB;SAC7D,CAAC,CAAC;IACL,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC;AAED,SAAS,kBAAkB,CAAC,OAAwB;IAClD,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,MAAM,IAAI,GAAG,OAAO,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC;IACrD,KAAK,CAAC,IAAI,CACR,cAAc,OAAO,CAAC,MAAM,IAAI,IAAI,8BAA8B,CACnE,CAAC;IACF,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACf,KAAK,MAAM,CAAC,IAAI,OAAO,EAAE,CAAC;QACxB,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,OAAO,IAAI,CAAC,CAAC;IACnC,CAAC;IACD,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACf,KAAK,CAAC,IAAI,CACR,mIAAmI,CACpI,CAAC;IACF,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC"}
@@ -0,0 +1,15 @@
1
+ /**
2
+ * `cairn hook user-prompt-submit` — UserPromptSubmit hook.
3
+ *
4
+ * Claude Code's `@<path>` shorthand attaches file content to the
5
+ * prompt directly, BYPASSING the Read tool — so the
6
+ * PostToolUse(Read) read-enricher hook never fires for those files.
7
+ * This hook fills the gap: it parses `@<path>` patterns from the
8
+ * raw prompt, reads each file, scans for §INV-/§DEC-/TODO(TSK-)
9
+ * citations, builds the same legend the read-enricher would have,
10
+ * and emits it as `additionalContext`. Result: the model sees
11
+ * the resolved citations alongside the attached file content,
12
+ * matching the documented "bare symbols always resolve on Read"
13
+ * contract regardless of attachment path.
14
+ */
15
+ export declare function runUserPromptSubmitHook(): Promise<void>;
@@ -0,0 +1,149 @@
1
+ /**
2
+ * `cairn hook user-prompt-submit` — UserPromptSubmit hook.
3
+ *
4
+ * Claude Code's `@<path>` shorthand attaches file content to the
5
+ * prompt directly, BYPASSING the Read tool — so the
6
+ * PostToolUse(Read) read-enricher hook never fires for those files.
7
+ * This hook fills the gap: it parses `@<path>` patterns from the
8
+ * raw prompt, reads each file, scans for §INV-/§DEC-/TODO(TSK-)
9
+ * citations, builds the same legend the read-enricher would have,
10
+ * and emits it as `additionalContext`. Result: the model sees
11
+ * the resolved citations alongside the attached file content,
12
+ * matching the documented "bare symbols always resolve on Read"
13
+ * contract regardless of attachment path.
14
+ */
15
+ import { existsSync, readFileSync } from "node:fs";
16
+ import { isAbsolute, relative, resolve } from "node:path";
17
+ import { resolveRepoRoot } from "../../session-start/index.js";
18
+ import { scanCitations } from "../post-tool-use/citation-scanner.js";
19
+ import { getDecisionsLedger, getInvariantsLedger, getScopeIndexEntry, lookupTask, } from "../post-tool-use/ledger-cache.js";
20
+ import { buildLegend } from "../post-tool-use/legend-builder.js";
21
+ import { readHookStdin } from "./payload.js";
22
+ const MAX_FILE_BYTES = 512_000;
23
+ // Match `@<path>` only when `@` follows whitespace or is at start of
24
+ // prompt — filters out emails, twitter-style mentions, etc. Path
25
+ // chars: word, dot, slash, hyphen.
26
+ const AT_PATH_RE = /(?:^|\s)@([\w./-]+)/g;
27
+ function parsePayload(text) {
28
+ if (text.trim().length === 0)
29
+ return {};
30
+ try {
31
+ const parsed = JSON.parse(text);
32
+ return typeof parsed === "object" && parsed !== null ? parsed : {};
33
+ }
34
+ catch {
35
+ return {};
36
+ }
37
+ }
38
+ function emitShapeB(additionalContext) {
39
+ const out = {
40
+ continue: true,
41
+ hookSpecificOutput: {
42
+ hookEventName: "UserPromptSubmit",
43
+ additionalContext,
44
+ },
45
+ };
46
+ process.stdout.write(JSON.stringify(out));
47
+ process.stdout.write("\n");
48
+ }
49
+ function extractAttachedPaths(prompt) {
50
+ const out = [];
51
+ for (const m of prompt.matchAll(AT_PATH_RE)) {
52
+ const p = m[1];
53
+ if (typeof p === "string" && p.length > 0)
54
+ out.push(p);
55
+ }
56
+ return out;
57
+ }
58
+ function safeRead(absPath) {
59
+ if (!existsSync(absPath))
60
+ return null;
61
+ try {
62
+ const buf = readFileSync(absPath, "utf8");
63
+ if (buf.length > MAX_FILE_BYTES)
64
+ return buf.slice(0, MAX_FILE_BYTES);
65
+ return buf;
66
+ }
67
+ catch {
68
+ return null;
69
+ }
70
+ }
71
+ export async function runUserPromptSubmitHook() {
72
+ try {
73
+ const raw = await readHookStdin();
74
+ const payload = parsePayload(raw);
75
+ const prompt = typeof payload.prompt === "string" ? payload.prompt : "";
76
+ const cwd = typeof payload.cwd === "string" ? payload.cwd : process.cwd();
77
+ // Fast-path: no `@` token in prompt → no work.
78
+ if (prompt.length === 0 || !prompt.includes("@")) {
79
+ emitShapeB("");
80
+ return;
81
+ }
82
+ const repoRoot = resolveRepoRoot(cwd);
83
+ if (repoRoot === null) {
84
+ emitShapeB("");
85
+ return;
86
+ }
87
+ const paths = extractAttachedPaths(prompt);
88
+ if (paths.length === 0) {
89
+ emitShapeB("");
90
+ return;
91
+ }
92
+ // Aggregate citations across all attached files. Filter to existing
93
+ // files — non-existent `@`-mentions are typically not file refs.
94
+ const aggregated = {
95
+ invariants: [],
96
+ todos: [],
97
+ decisions: [],
98
+ };
99
+ let firstHitRel = null;
100
+ for (const p of paths) {
101
+ const abs = isAbsolute(p) ? p : resolve(repoRoot, p);
102
+ const content = safeRead(abs);
103
+ if (content === null)
104
+ continue;
105
+ const matches = scanCitations(content);
106
+ const hit = matches.invariants.length > 0 ||
107
+ matches.todos.length > 0 ||
108
+ matches.decisions.length > 0;
109
+ if (!hit)
110
+ continue;
111
+ if (firstHitRel === null) {
112
+ const rel = relative(repoRoot, abs);
113
+ if (!rel.startsWith("..") && rel.length > 0) {
114
+ firstHitRel = rel.replace(/\\/g, "/");
115
+ }
116
+ }
117
+ aggregated.invariants.push(...matches.invariants);
118
+ aggregated.todos.push(...matches.todos);
119
+ aggregated.decisions.push(...matches.decisions);
120
+ }
121
+ if (aggregated.invariants.length === 0 &&
122
+ aggregated.todos.length === 0 &&
123
+ aggregated.decisions.length === 0) {
124
+ emitShapeB("");
125
+ return;
126
+ }
127
+ const cachedEntry = firstHitRel !== null ? getScopeIndexEntry(repoRoot, firstHitRel) : null;
128
+ const scopeHint = cachedEntry !== null
129
+ ? {
130
+ decisions: cachedEntry.decisions,
131
+ invariants: cachedEntry.invariants,
132
+ }
133
+ : null;
134
+ const invariantsLedger = getInvariantsLedger(repoRoot);
135
+ const decisionsLedger = getDecisionsLedger(repoRoot);
136
+ const resolveTaskFn = (taskId) => lookupTask(repoRoot, taskId);
137
+ const legend = buildLegend(aggregated, invariantsLedger, decisionsLedger, scopeHint, resolveTaskFn);
138
+ emitShapeB(legend ?? "");
139
+ }
140
+ catch {
141
+ try {
142
+ emitShapeB("");
143
+ }
144
+ catch {
145
+ // last resort
146
+ }
147
+ }
148
+ }
149
+ //# sourceMappingURL=user-prompt-submit.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"user-prompt-submit.js","sourceRoot":"","sources":["../../../src/hooks/runners/user-prompt-submit.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC1D,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,aAAa,EAAyB,MAAM,sCAAsC,CAAC;AAC5F,OAAO,EACL,kBAAkB,EAClB,mBAAmB,EACnB,kBAAkB,EAClB,UAAU,GAEX,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAuB,MAAM,oCAAoC,CAAC;AACtF,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAE7C,MAAM,cAAc,GAAG,OAAO,CAAC;AAC/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AC,IAAI,CAAC,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC;QAClD,CAAC;QAED,IACE,UAAU,CAAC,UAAU,CAAC,MAAM,KAAK,CAAC;YAClC,UAAU,CAAC,KAAK,CAAC,MAAM,KAAK,CAAC;YAC7B,UAAU,CAAC,SAAS,CAAC,MAAM,KAAK,CAAC,EACjC,CAAC;YACD,UAAU,CAAC,EAAE,CAAC,CAAC;YACf,OAAO;QACT,CAAC;QAED,MAAM,WAAW,GACf,WAAW,KAAK,IAAI,CAAC,CAAC,CAAC,kBAAkB,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;QAC1E,MAAM,SAAS,GACb,WAAW,KAAK,IAAI;YAClB,CAAC,CAAC;gBACE,SAAS,EAAE,WAAW,CAAC,SAAS;gBAChC,UAAU,EAAE,WAAW,CAAC,UAAU;aACnC;YACH,CAAC,CAAC,IAAI,CAAC;QAEX,MAAM,gBAAgB,GAAG,mBAAmB,CAAC,QAAQ,CAAC,CAAC;QACvD,MAAM,eAAe,GAAG,kBAAkB,CAAC,QAAQ,CAAC,CAAC;QACrD,MAAM,aAAa,GAAG,CAAC,MAAc,EAAoB,EAAE,CACzD,UAAU,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;QAE/B,MAAM,MAAM,GAAG,WAAW,CACxB,UAAU,EACV,gBAAgB,EAChB,eAAe,EACf,SAAS,EACT,aAAa,CACd,CAAC;QAEF,UAAU,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC;IAC3B,CAAC;IAAC,MAAM,CAAC;QACP,IAAI,CAAC;YACH,UAAU,CAAC,EAAE,CAAC,CAAC;QACjB,CAAC;QAAC,MAAM,CAAC;YACP,cAAc;QAChB,CAAC;IACH,CAAC;AACH,CAAC"}
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Seed `.cairn/.attested-commits` with every commit reachable from
3
+ * HEAD at the time of seeding. Bypass detection then grandfathers all
4
+ * those SHAs as "already attested" — only future bypassed commits
5
+ * surface as attention.
6
+ *
7
+ * Two callers:
8
+ * 1. Phase 3b-seed (during `cairn init`) — seeds for the adopting
9
+ * clone the moment `.cairn/` lands, so the very next Stop hook
10
+ * tick doesn't false-positive every pre-adoption commit.
11
+ * 2. `cairn join` (per-clone bootstrap) — `.attested-commits` is
12
+ * gitignored + per-clone, so each new clone needs its own seed
13
+ * on first bootstrap.
14
+ *
15
+ * Idempotent: if the file already exists with content, we leave it
16
+ * alone (the post-commit hook owns ongoing appends).
17
+ */
18
+ export type SeedAttestedStatus = "ok" | "skipped" | "error";
19
+ export interface SeedAttestedResult {
20
+ status: SeedAttestedStatus;
21
+ detail: string;
22
+ /** SHA count seeded — present only when status="ok". */
23
+ count?: number;
24
+ }
25
+ export declare function seedAttestedCommits(repoRoot: string, dryRun?: boolean): SeedAttestedResult;
@@ -0,0 +1,84 @@
1
+ /**
2
+ * Seed `.cairn/.attested-commits` with every commit reachable from
3
+ * HEAD at the time of seeding. Bypass detection then grandfathers all
4
+ * those SHAs as "already attested" — only future bypassed commits
5
+ * surface as attention.
6
+ *
7
+ * Two callers:
8
+ * 1. Phase 3b-seed (during `cairn init`) — seeds for the adopting
9
+ * clone the moment `.cairn/` lands, so the very next Stop hook
10
+ * tick doesn't false-positive every pre-adoption commit.
11
+ * 2. `cairn join` (per-clone bootstrap) — `.attested-commits` is
12
+ * gitignored + per-clone, so each new clone needs its own seed
13
+ * on first bootstrap.
14
+ *
15
+ * Idempotent: if the file already exists with content, we leave it
16
+ * alone (the post-commit hook owns ongoing appends).
17
+ */
18
+ import { execFileSync } from "node:child_process";
19
+ import { existsSync, mkdirSync, writeFileSync } from "node:fs";
20
+ import { join } from "node:path";
21
+ export function seedAttestedCommits(repoRoot, dryRun = false) {
22
+ const path = join(repoRoot, ".cairn", ".attested-commits");
23
+ if (existsSync(path)) {
24
+ return {
25
+ status: "skipped",
26
+ detail: ".cairn/.attested-commits already exists — leaving as-is",
27
+ };
28
+ }
29
+ if (!existsSync(join(repoRoot, ".git"))) {
30
+ return {
31
+ status: "skipped",
32
+ detail: "no .git/ — bypass detection is git-only, nothing to seed",
33
+ };
34
+ }
35
+ let shas = [];
36
+ try {
37
+ const out = execFileSync("git", ["log", "--format=%H"], {
38
+ cwd: repoRoot,
39
+ encoding: "utf8",
40
+ maxBuffer: 64 * 1024 * 1024,
41
+ stdio: ["ignore", "pipe", "ignore"],
42
+ });
43
+ shas = out.split("\n").filter((s) => s.length > 0);
44
+ }
45
+ catch {
46
+ // git log fails on empty repos (no commits yet) and on edge cases
47
+ // like detached/corrupted state. In all those cases the right
48
+ // semantic is "nothing to seed" — never block adoption / bootstrap
49
+ // on the absence of pre-existing history.
50
+ return {
51
+ status: "skipped",
52
+ detail: "git log returned no commits — nothing to seed",
53
+ };
54
+ }
55
+ if (shas.length === 0) {
56
+ return {
57
+ status: "skipped",
58
+ detail: "git log returned no commits — nothing to seed",
59
+ };
60
+ }
61
+ if (dryRun) {
62
+ return {
63
+ status: "ok",
64
+ detail: `(dry-run) would seed ${shas.length} pre-existing SHA${shas.length === 1 ? "" : "s"}`,
65
+ count: shas.length,
66
+ };
67
+ }
68
+ try {
69
+ mkdirSync(join(repoRoot, ".cairn"), { recursive: true });
70
+ writeFileSync(path, `${shas.join("\n")}\n`, "utf8");
71
+ }
72
+ catch (err) {
73
+ return {
74
+ status: "error",
75
+ detail: `write ${path} failed: ${err instanceof Error ? err.message : String(err)}`,
76
+ };
77
+ }
78
+ return {
79
+ status: "ok",
80
+ detail: `seeded ${shas.length} pre-existing SHA${shas.length === 1 ? "" : "s"} — bypass detection grandfathers them`,
81
+ count: shas.length,
82
+ };
83
+ }
84
+ //# sourceMappingURL=seed-attested.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"seed-attested.js","sourceRoot":"","sources":["../../src/hooks/seed-attested.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,E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C,EAAE,CAAC;QACtB,OAAO;YACL,MAAM,EAAE,SAAS;YACjB,MAAM,EAAE,+CAA+C;SACxD,CAAC;IACJ,CAAC;IACD,IAAI,MAAM,EAAE,CAAC;QACX,OAAO;YACL,MAAM,EAAE,IAAI;YACZ,MAAM,EAAE,wBAAwB,IAAI,CAAC,MAAM,oBAAoB,IAAI,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,EAAE;YAC7F,KAAK,EAAE,IAAI,CAAC,MAAM;SACnB,CAAC;IACJ,CAAC;IACD,IAAI,CAAC;QACH,SAAS,CAAC,IAAI,CAAC,QAAQ,EAAE,QAAQ,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QACzD,aAAa,CAAC,IAAI,EAAE,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IACtD,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,OAAO;YACL,MAAM,EAAE,OAAO;YACf,MAAM,EAAE,SAAS,IAAI,YAAY,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE;SACpF,CAAC;IACJ,CAAC;IACD,OAAO;QACL,MAAM,EAAE,IAAI;QACZ,MAAM,EAAE,UAAU,IAAI,CAAC,MAAM,oBAAoB,IAAI,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,uCAAuC;QACpH,KAAK,EAAE,IAAI,CAAC,MAAM;KACnB,CAAC;AACJ,CAAC"}
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Bin entrypoint — `node cairn-core/dist/hooks/user-prompt-submit.js`.
4
+ * UserPromptSubmit hook; resolves §INV/§DEC/TODO(TSK-) citations in
5
+ * `@`-attached files (Read-bypass path).
6
+ */
7
+ export {};
@@ -0,0 +1,12 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Bin entrypoint — `node cairn-core/dist/hooks/user-prompt-submit.js`.
4
+ * UserPromptSubmit hook; resolves §INV/§DEC/TODO(TSK-) citations in
5
+ * `@`-attached files (Read-bypass path).
6
+ */
7
+ import { runUserPromptSubmitHook } from "./runners/index.js";
8
+ runUserPromptSubmitHook().catch((err) => {
9
+ process.stderr.write(`[cairn user-prompt-submit] ${err instanceof Error ? err.message : String(err)}\n`);
10
+ process.exit(1);
11
+ });
12
+ //# sourceMappingURL=user-prompt-submit.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"user-prompt-submit.js","sourceRoot":"","sources":["../../src/hooks/user-prompt-submit.ts"],"names":[],"mappings":";AACA;;;;GAIG;AAEH,OAAO,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAE7D,uBAAuB,EAAE,CAAC,KAAK,CAAC,CAAC,GAAY,EAAE,EAAE;IAC/C,OAAO,CAAC,MAAM,CAAC,KAAK,CAClB,8BAA8B,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CACnF,CAAC;IACF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
package/dist/index.d.ts CHANGED
@@ -13,6 +13,8 @@ export * from "./decision-capture/index.js";
13
13
  export * from "./doctor/index.js";
14
14
  export * from "./gc/index.js";
15
15
  export * from "./ground/index.js";
16
+ export { clearDeferState, deferStatePath, isDeferActive, readDeferState, writeDeferState, } from "./hooks/defer.js";
17
+ export type { DeferKind, DeferState } from "./hooks/defer.js";
16
18
  export * from "./hooks/post-tool-use/index.js";
17
19
  export * from "./init/index.js";
18
20
  export * from "./join/index.js";
@@ -25,9 +27,4 @@ export * from "./hooks/runners/index.js";
25
27
  export * from "./session/index.js";
26
28
  export * from "./session-start/index.js";
27
29
  export * from "./status-line/index.js";
28
- export * from "./tier0/index.js";
29
- export * from "./tightener/index.js";
30
- export * from "./frontend-types.js";
31
- export { writeInboxRow } from "./inbox.js";
32
- export { loadWorkflowTemplate, renderTemplate } from "./prompt.js";
33
- export type { TemplateContext } from "./prompt.js";
30
+ export { appendTrace, nowEvent, traceDir, traceFilePath, type TraceEvent, type TraceSource, } from "./trace/index.js";