@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,68 +0,0 @@
1
- import { mkdirSync, writeFileSync } from "node:fs";
2
- import { join } from "node:path";
3
- import { stringify as stringifyYaml } from "yaml";
4
- import { writeInvalidationEvent } from "../../events/index.js";
5
- import { withWriteLock } from "../../lock.js";
6
- import { requireBootstrap } from "../bootstrap-guard.js";
7
- import { dropTaskInput } from "../schemas.js";
8
- async function handler(ctx, input) {
9
- const block = requireBootstrap(ctx.repoRoot);
10
- if (block !== null)
11
- return block;
12
- return withWriteLock(ctx.repoRoot, () => {
13
- const today = new Date().toISOString().slice(0, 10);
14
- const slug = input.title
15
- .toLowerCase()
16
- .replace(/[^a-z0-9]+/g, "-")
17
- .replace(/^-+|-+$/g, "")
18
- .slice(0, 60);
19
- // ms-suffix gives uniqueness when the same agent files multiple tasks per second.
20
- const id = `TSK-${today}-${slug || "task"}-${Date.now() % 100000}`;
21
- const dir = join(ctx.repoRoot, ".cairn", "tasks", "active", id);
22
- mkdirSync(dir, { recursive: true });
23
- const frontmatter = {
24
- id,
25
- type: "spec",
26
- status: "tightening",
27
- audience: "dual",
28
- generated: new Date().toISOString(),
29
- source: input.source ?? "agent_spawned",
30
- intent: input.intent,
31
- priority: input.priority ?? 5,
32
- ...(input.parent_task_id !== undefined ? { parent_task_id: input.parent_task_id } : {}),
33
- ...(input.target_path_globs !== undefined
34
- ? { target_path_globs: input.target_path_globs }
35
- : {}),
36
- trust_class: "code",
37
- };
38
- const spec = `---\n${stringifyYaml(frontmatter)}---\n\n# ${input.title}\n\n${input.body}\n`;
39
- writeFileSync(join(dir, "spec.md"), spec, "utf8");
40
- const status = {
41
- phase: "tightening",
42
- attempts: 0,
43
- last_event_at: new Date().toISOString(),
44
- queued_position: null,
45
- related_run_ids: [],
46
- };
47
- writeFileSync(join(dir, "status.yaml"), stringifyYaml(status), "utf8");
48
- try {
49
- writeInvalidationEvent(ctx.repoRoot, {
50
- kind: "task_created",
51
- refs: [{ kind: "task", id }],
52
- path: `.cairn/tasks/active/${id}/spec.md`,
53
- source: { session_id: ctx.sessionId ?? null, tool: "cairn_drop_task" },
54
- });
55
- }
56
- catch {
57
- // Event emission must never roll back the task spec write.
58
- }
59
- return { ok: true, id, path: `.cairn/tasks/active/${id}/spec.md` };
60
- });
61
- }
62
- export const dropTaskTool = {
63
- name: "cairn_drop_task",
64
- description: "Create a new active task — writes spec.md + status.yaml under .cairn/tasks/active/<id>/. Used by spec-planner subagent. Operator-issued tasks come via the frontend adapter, not this tool.",
65
- inputSchema: dropTaskInput,
66
- handler,
67
- };
68
- //# sourceMappingURL=drop-task.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"drop-task.js","sourceRoot":"","sources":["../../../src/mcp/tools/drop-task.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,SAAS,IAAI,aAAa,EAAE,MAAM,MAAM,CAAC;AAElD,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAC/D,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAa9C,KAAK,UAAU,OAAO,CAAC,GAAe,EAAE,KAAY;IAClD,MAAM,KAAK,GAAG,gBAAgB,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IAC7C,IAAI,KAAK,KAAK,IAAI;QAAE,OAAO,KAAK,CAAC;IACjC,OAAO,aAAa,CAAC,GAAG,CAAC,QAAQ,EAAE,GAAG,EAAE;QACtC,MAAM,KAAK,GAAG,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;QACpD,MAAM,IAAI,GAAG,KAA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,CAAC,IAAI,CAAC,GAAG,EAAE,SAAS,CAAC,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;QAElD,MAAM,MAAM,GAAG;YACb,KAAK,EAAE,YAAY;YACnB,QAAQ,EAAE,CAAC;YACX,aAAa,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;YACvC,eAAe,EAAE,IAAI;YACrB,eAAe,EAAE,EAAE;SACpB,CAAC;QACF,aAAa,CAAC,IAAI,CAAC,GAAG,EAAE,aAAa,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,CAAC;QAEvE,IAAI,CAAC;YACH,sBAAsB,CAAC,GAAG,CAAC,QAAQ,EAAE;gBACnC,IAAI,EAAE,cAAc;gBACpB,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC;gBAC5B,IAAI,EAAE,uBAAuB,EAAE,UAAU;gBACzC,MAAM,EAAE,EAAE,UAAU,EAAE,GAAG,CAAC,SAAS,IAAI,IAAI,EAAE,IAAI,EAAE,iBAAiB,EAAE;aACvE,CAAC,CAAC;QACL,CAAC;QAAC,MAAM,CAAC;YACP,2DAA2D;QAC7D,CAAC;QAED,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,IAAI,EAAE,uBAAuB,EAAE,UAAU,EAAE,CAAC;IACrE,CAAC,CAAC,CAAC;AACL,CAAC;AAED,MAAM,CAAC,MAAM,YAAY,GAAmB;IAC1C,IAAI,EAAE,iBAAiB;IACvB,WAAW,EACT,6LAA6L;IAC/L,WAAW,EAAE,aAAa;IAC1B,OAAO;CACR,CAAC"}
@@ -1,10 +0,0 @@
1
- import type { ToolDef } from "./types.js";
2
- interface Input {
3
- run_id: string;
4
- event: {
5
- kind: string;
6
- payload?: unknown;
7
- };
8
- }
9
- export declare const recordRunEventTool: ToolDef<Input>;
10
- export {};
@@ -1,32 +0,0 @@
1
- import { appendFileSync, existsSync, mkdirSync } from "node:fs";
2
- import { join } from "node:path";
3
- import { requireBootstrap } from "../bootstrap-guard.js";
4
- import { mcpError } from "../errors.js";
5
- import { recordRunEventInput } from "../schemas.js";
6
- async function handler(ctx, input) {
7
- const block = requireBootstrap(ctx.repoRoot);
8
- if (block !== null)
9
- return block;
10
- const runDir = join(ctx.repoRoot, ".cairn", "runs", "active", input.run_id);
11
- if (!existsSync(runDir)) {
12
- return mcpError("RUN_NOT_FOUND", `No active run dir at ${runDir}`);
13
- }
14
- const path = join(runDir, "events.jsonl");
15
- // Server-fills ts. Seq is omitted in this naive implementation; the orchestrator
16
- // re-numbers in the post-run pass when it materializes the canonical event log.
17
- const row = {
18
- ts: new Date().toISOString(),
19
- kind: input.event.kind,
20
- ...(input.event.payload !== undefined ? { payload: input.event.payload } : {}),
21
- };
22
- mkdirSync(runDir, { recursive: true });
23
- appendFileSync(path, `${JSON.stringify(row)}\n`, "utf8");
24
- return { ok: true, run_id: input.run_id, kind: input.event.kind };
25
- }
26
- export const recordRunEventTool = {
27
- name: "cairn_record_run_event",
28
- description: "Append a structured event to .cairn/runs/active/<run_id>/events.jsonl. Server fills `ts`; sequence is renumbered in post-run materialization.",
29
- inputSchema: recordRunEventInput,
30
- handler,
31
- };
32
- //# sourceMappingURL=record-run-event.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"record-run-event.js","sourceRoot":"","sources":["../../../src/mcp/tools/record-run-event.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAChE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACxC,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAQpD,KAAK,UAAU,OAAO,CAAC,GAAe,EAAE,KAAY;IAClD,MAAM,KAAK,GAAG,gB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ompt.d.ts DELETED
@@ -1,19 +0,0 @@
1
- /**
2
- * Minimal Liquid-style template renderer. Supports:
3
- * {{var}} — substitute scalar value
4
- * {{#each LIST}}...{{/each}} — repeat block per item; inside the block
5
- * {{this}} resolves to the current item;
6
- * for object items, {{this.field}} works.
7
- *
8
- * Anything not matched is left literal. No conditionals, no nested blocks
9
- * beyond {{#each}}. The cairn's prompt template (`templates/.cairn/
10
- * config/workflow.md`) was authored to fit this surface.
11
- */
12
- export type TemplateContext = Record<string, string | number | boolean | string[] | Record<string, string>[] | undefined>;
13
- export declare function renderTemplate(template: string, ctx: TemplateContext): string;
14
- /**
15
- * Read the workflow.md template from `<repoRoot>/.cairn/config/workflow.md`,
16
- * strip the YAML frontmatter, and return only the prompt body (everything
17
- * after the second `---`).
18
- */
19
- export declare function loadWorkflowTemplate(repoRoot: string): string;
package/dist/prompt.js DELETED
@@ -1,50 +0,0 @@
1
- import { readFileSync } from "node:fs";
2
- import { join } from "node:path";
3
- export function renderTemplate(template, ctx) {
4
- // 1. Each blocks first — they are coarser than scalar substitutions.
5
- const eachBlockRe = /\{\{#each\s+(\w+)\}\}([\s\S]*?)\{\{\/each\}\}/g;
6
- let out = template.replace(eachBlockRe, (_, key, body) => {
7
- const list = ctx[key];
8
- if (!Array.isArray(list))
9
- return "";
10
- return list
11
- .map((item) => {
12
- if (typeof item === "string") {
13
- return body.replace(/\{\{this\}\}/g, item);
14
- }
15
- if (typeof item === "object" && item !== null) {
16
- let chunk = body.replace(/\{\{this\}\}/g, JSON.stringify(item));
17
- chunk = chunk.replace(/\{\{this\.(\w+)\}\}/g, (_m, field) => {
18
- const v = item[field];
19
- return v === undefined ? "" : String(v);
20
- });
21
- return chunk;
22
- }
23
- return "";
24
- })
25
- .join("");
26
- });
27
- // 2. Scalar substitutions.
28
- out = out.replace(/\{\{(\w+)\}\}/g, (_match, key) => {
29
- const v = ctx[key];
30
- if (v === undefined)
31
- return "";
32
- if (Array.isArray(v))
33
- return v.join(", ");
34
- return String(v);
35
- });
36
- return out;
37
- }
38
- /**
39
- * Read the workflow.md template from `<repoRoot>/.cairn/config/workflow.md`,
40
- * strip the YAML frontmatter, and return only the prompt body (everything
41
- * after the second `---`).
42
- */
43
- export function loadWorkflowTemplate(repoRoot) {
44
- const path = join(repoRoot, ".cairn", "config", "workflow.md");
45
- const raw = readFileSync(path, "utf8");
46
- // Frontmatter ends at the second `---` line.
47
- const match = raw.match(/^---\n[\s\S]*?\n---\n([\s\S]*)$/);
48
- return match ? (match[1] ?? "") : raw;
49
- }
50
- //# sourceMappingURL=prompt.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"prompt.js","sourceRoot":"","sources":["../src/prompt.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAmBjC,MAAM,UAAU,cAAc,CAAC,QAAgB,EAAE,GAAoB;IACnE,qEAAqE;IACrE,MAAM,WAAW,GAAG,gDAAgD,CAAC;IACrE,IAAI,GAAG,GAAG,QAAQ,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC,CAAC,EAAE,GAAW,EAAE,IAAY,EAAE,EAAE;QACvE,MAAM,IAAI,GAAG,GAAG,CAAC,GAAG,CAAC,CAAC;QACtB,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC;YAAE,OAAO,EAAE,CAAC;QACpC,OAAO,IAAI;aACR,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;YACZ,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE,CAAC;gBAC7B,OAAO,IAAI,CAAC,OAAO,CAAC,eAAe,EAAE,IAAI,CAAC,CAAC;YAC7C,CAAC;YACD,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,KAAK,IAAI,EAAE,CAAC;gBAC9C,IAAI,KAAK,GAAG,IAAI,CAAC,OAAO,CAAC,eAAe,EAAE,IAAI,CAAC,SAAS,CAAC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I,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;AACxC,CAAC"}
@@ -1,10 +0,0 @@
1
- import type { ClassificationResult, Tier0ClassifyOptions, Tier0RegexFallback } from "./types.js";
2
- export declare const REGEX_FALLBACK: Tier0RegexFallback;
3
- /**
4
- * Classify a free-text developer message into a tier0 intent. Calls the
5
- * Claude binary (Haiku tier) for nuanced reasoning; falls back to a regex
6
- * matcher when the binary is unreachable so smoke tests + scripted callers
7
- * stay green. The regex fallback is escape-only — production flows assume
8
- * the Claude binary is present (per docs/PLUGIN_ARCHITECTURE.md §16).
9
- */
10
- export declare function classifyTier0(text: string, opts?: Tier0ClassifyOptions): Promise<ClassificationResult>;
@@ -1,110 +0,0 @@
1
- import { ClaudeError, runClaude } from "../claude/index.js";
2
- import { logger } from "../logger.js";
3
- const log = logger("tier0.classify");
4
- const VALID_INTENTS = [
5
- "code_task",
6
- "review",
7
- "direction",
8
- "question",
9
- "halt",
10
- "status",
11
- "unknown",
12
- ];
13
- const SYSTEM_PROMPT = [
14
- "You classify a free-text developer message into a single intent for the cairn.",
15
- 'Respond ONLY with JSON: { "intent": <one of: code_task, review, direction, question, halt, status, unknown>, "confidence": <number between 0 and 1> }.',
16
- "Definitions:",
17
- "- code_task: operator wants code written or changed (fix, add, build, refactor, delete, migrate, wire, hook).",
18
- "- review: read-only audit/check of code or docs (no code change).",
19
- "- direction: a binding decision change. Phrases like 'scrap that', 'going forward', 'from now on', 'new direction'.",
20
- "- question: operator is asking, not directing.",
21
- "- halt: operator wants something stopped/cancelled.",
22
- "- status: operator wants current state of cairn or run.",
23
- "- unknown: none of the above match.",
24
- "Be honest with confidence; below 0.7 means it is genuinely ambiguous.",
25
- ].join("\n");
26
- const INTENT_SCHEMA = {
27
- type: "object",
28
- required: ["intent", "confidence"],
29
- additionalProperties: false,
30
- properties: {
31
- intent: {
32
- type: "string",
33
- enum: [
34
- "code_task",
35
- "review",
36
- "direction",
37
- "question",
38
- "halt",
39
- "status",
40
- "unknown",
41
- ],
42
- },
43
- confidence: { type: "number", minimum: 0, maximum: 1 },
44
- },
45
- };
46
- function regexFallbackDefault(text) {
47
- const rules = [
48
- { intent: "halt", pattern: /^\s*(halt|stop|cancel|kill)\b/i },
49
- { intent: "status", pattern: /^\s*(status|state|how['’]?s it going)\b/i },
50
- {
51
- intent: "direction",
52
- pattern: /^\s*(scrap that|actually|new direction|going forward|from now on)\b/i,
53
- },
54
- {
55
- intent: "code_task",
56
- pattern: /^\s*(fix|add|update|create|build|implement|refactor|delete|remove|migrate|wire|hook|land|rip out|rip)\b/i,
57
- },
58
- {
59
- intent: "review",
60
- pattern: /^\s*(review|audit|check|inspect|look at|smoke|sanity)\b/i,
61
- },
62
- {
63
- intent: "question",
64
- pattern: /^\s*(why|how|what|when|where|which|is|are|does|do|can|should)\b/i,
65
- },
66
- ];
67
- for (const r of rules) {
68
- if (r.pattern.test(text))
69
- return { intent: r.intent, confidence: 0.6 };
70
- }
71
- return { intent: "unknown", confidence: 0 };
72
- }
73
- export const REGEX_FALLBACK = regexFallbackDefault;
74
- /**
75
- * Classify a free-text developer message into a tier0 intent. Calls the
76
- * Claude binary (Haiku tier) for nuanced reasoning; falls back to a regex
77
- * matcher when the binary is unreachable so smoke tests + scripted callers
78
- * stay green. The regex fallback is escape-only — production flows assume
79
- * the Claude binary is present (per docs/PLUGIN_ARCHITECTURE.md §16).
80
- */
81
- export async function classifyTier0(text, opts = {}) {
82
- const fallback = opts.regexFallback ?? REGEX_FALLBACK;
83
- const timeoutMs = opts.timeoutMs ?? 30_000;
84
- try {
85
- const res = await runClaude({
86
- tier: "haiku",
87
- system: SYSTEM_PROMPT,
88
- prompt: `Message:\n${text}\n\nReturn the JSON now.`,
89
- jsonSchema: INTENT_SCHEMA,
90
- timeoutMs,
91
- });
92
- const parsed = (res.parsed ??
93
- JSON.parse(res.text));
94
- const intent = typeof parsed.intent === "string" &&
95
- VALID_INTENTS.includes(parsed.intent)
96
- ? parsed.intent
97
- : "unknown";
98
- const confidence = typeof parsed.confidence === "number" && Number.isFinite(parsed.confidence)
99
- ? Math.max(0, Math.min(1, parsed.confidence))
100
- : 0;
101
- return { intent, confidence, source: "claude" };
102
- }
103
- catch (err) {
104
- const reason = err instanceof ClaudeError ? err.kind : err instanceof Error ? err.message : String(err);
105
- log.warn({ reason }, "tier0 claude classify failed; falling back to regex");
106
- const r = fallback(text);
107
- return { intent: r.intent, confidence: r.confidence, source: "fallback" };
108
- }
109
- }
110
- //# sourceMappingURL=classify.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"classify.js","sourceRoot":"","sources":["../../src/tier0/classify.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAQtC,MAAM,GAAG,GAAG,MAAM,CAAC,gBAAgB,CAAC,CAAC;AAErC,MAAM,aAAa,GAA2B;IAC5C,WAAW;IACX,QAAQ;IACR,WAAW;IACX,UAAU;IACV,MAAM;IACN,QAAQ;IACR,SAAS;CACV,CAAC;AAEF,MAAM,aAAa,GAAG;IACpB,gFAAgF;IAChF,wJAAwJ;IACxJ,cAAc;IACd,+GAA+G;IAC/G,mEAAmE;IACnE,qHAAqH;IACrH,gDAAgD;IAChD,qDAAqD;IACrD,yDAAyD;IACzD,qCAAqC;IACrC,uEAAuE;CACxE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAEb,MAAM,aAAa,GAAG;IACpB,IAAI,EAAE,QAAQ;IACd,QAAQ,EAAE,CAAC,QAAQ,EAAE,YAAY,CAAC;IAClC,oBAAoB,EAAE,KAAK;IAC3B,UAAU,EAAE;QACV,MAAM,EAAE;YACN,IAAI,EAAE,QAAQ;YACd,IAAI,EAAE;gBACJ,WAAW;gBACX,QAAQ;gBACR,WAAW;gBACX,UAAU;gBACV,MAAM;gBACN,QAAQ;gBACR,SAAS;aACV;SACF;QACD,UAAU,EAAE,EAAE,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ier0, REGEX_FALLBACK } from "./classify.js";
2
- export type { ClassificationResult, Tier0ClassifyOptions, Tier0Intent, Tier0RegexFallback, } from "./types.js";
@@ -1,2 +0,0 @@
1
- export { classifyTier0, REGEX_FALLBACK } from "./classify.js";
2
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/tier0/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC"}
@@ -1,24 +0,0 @@
1
- /**
2
- * Tier-0 classifier contract. Per docs/PLUGIN_ARCHITECTURE.md §14: Haiku
3
- * (escalating to Sonnet for complex prompts) via the Claude binary
4
- * subprocess. Falls back to a deterministic regex matcher if the Claude
5
- * binary is unavailable so smoke tests + scripted callers stay green.
6
- * Production flows assume the Claude binary is present.
7
- */
8
- export type Tier0Intent = "code_task" | "review" | "direction" | "question" | "halt" | "status" | "unknown";
9
- export interface ClassificationResult {
10
- intent: Tier0Intent;
11
- confidence: number;
12
- source: "claude" | "fallback";
13
- }
14
- export interface Tier0RegexFallback {
15
- (text: string): {
16
- intent: Tier0Intent;
17
- confidence: number;
18
- };
19
- }
20
- export interface Tier0ClassifyOptions {
21
- timeoutMs?: number;
22
- /** Used when the Claude binary is unreachable or returns malformed output. */
23
- regexFallback?: Tier0RegexFallback;
24
- }
@@ -1,9 +0,0 @@
1
- /**
2
- * Tier-0 classifier contract. Per docs/PLUGIN_ARCHITECTURE.md §14: Haiku
3
- * (escalating to Sonnet for complex prompts) via the Claude binary
4
- * subprocess. Falls back to a deterministic regex matcher if the Claude
5
- * binary is unavailable so smoke tests + scripted callers stay green.
6
- * Production flows assume the Claude binary is present.
7
- */
8
- export {};
9
- //# sourceMappingURL=types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/tier0/types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG"}
@@ -1,4 +0,0 @@
1
- export { tightenSpec } from "./tighten.js";
2
- export { TIGHTENER_OUTPUT_SCHEMA } from "./schema.js";
3
- export { TIGHTENER_SYSTEM_PROMPT, buildTightenerUserPrompt, } from "./prompt.js";
4
- export type { Ambiguity, TightenerInput, TightenerOutput, TightenerResult, } from "./types.js";
@@ -1,4 +0,0 @@
1
- export { tightenSpec } from "./tighten.js";
2
- export { TIGHTENER_OUTPUT_SCHEMA } from "./schema.js";
3
- export { TIGHTENER_SYSTEM_PROMPT, buildTightenerUserPrompt, } from "./prompt.js";
4
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/tightener/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AACtD,OAAO,EACL,uBAAuB,EACvB,wBAAwB,GACzB,MAAM,aAAa,CAAC"}
@@ -1,3 +0,0 @@
1
- import type { TightenerInput } from "./types.js";
2
- export declare const TIGHTENER_SYSTEM_PROMPT: string;
3
- export declare function buildTightenerUserPrompt(input: TightenerInput): string;
@@ -1,67 +0,0 @@
1
- export const TIGHTENER_SYSTEM_PROMPT = [
2
- "You are the SPEC TIGHTENER for a developer cairn.",
3
- "",
4
- "Your job: read a task spec and decide if an implementer can act on it without asking questions. You DO NOT write code, run tools, or modify files. You analyze the spec and return one structured JSON object.",
5
- "",
6
- "Examine the spec for:",
7
- "- AMBIGUITIES — wording that an honest implementer could read two ways. Each ambiguity gets a stable id (Q1, Q2, ...), a focused question, and 2-4 concrete A/B/C/D candidate resolutions (per the cairn UX rule: squares-into-square-holes, no free-text-only options).",
8
- "- CONFLICTS — direct contradictions with decisions or invariants in scope.",
9
- "- MISSING ACCEPTANCE — observable behaviors the spec implies but does not state, that an implementer would need to assert.",
10
- "- SCOPE CONCERNS — paths/modules the spec might touch that look out of bounds.",
11
- "- EXISTING STUB OVERLAP — TODOs / placeholder functions the spec would resolve, called out explicitly so the implementer doesn't add a parallel implementation.",
12
- "",
13
- "Score the spec 0-10 on `spec_quality_score`:",
14
- " 0-3 = vague, multiple interpretations, missing acceptance",
15
- " 4-6 = workable but several decisions deferred",
16
- " 7-8 = clear, minor wording-level ambiguities at most",
17
- " 9-10 = unambiguous, complete acceptance, ready to dispatch",
18
- "",
19
- "Set `ready_to_execute = true` ONLY when score >= 7 AND `ambiguities` is empty AND no conflicts. Otherwise false.",
20
- "",
21
- "Always populate `tightened_spec_proposal` with your best rewrite of the spec, taking the most defensible default for each ambiguity. This is the fallback if the operator clicks `[approve as drafted]` without resolving questions individually (per cairn Codex audit Finding #7 — collapse 3+ ambiguities into one tightened-proposal-with-edit-button).",
22
- "",
23
- "Return ONLY the JSON object. No prose, no preamble.",
24
- ].join("\n");
25
- export function buildTightenerUserPrompt(input) {
26
- const parts = [];
27
- parts.push("# Task spec to tighten");
28
- parts.push("");
29
- parts.push(`## Title`);
30
- parts.push(input.title);
31
- parts.push("");
32
- parts.push(`## Body`);
33
- parts.push(input.body);
34
- if (input.decisions_in_scope && input.decisions_in_scope.length > 0) {
35
- parts.push("");
36
- parts.push("## Decisions in scope");
37
- for (const d of input.decisions_in_scope) {
38
- parts.push(`- **${d.id}** — ${d.title}: ${d.summary}`);
39
- }
40
- }
41
- if (input.invariants_in_scope && input.invariants_in_scope.length > 0) {
42
- parts.push("");
43
- parts.push("## Invariants in scope");
44
- for (const v of input.invariants_in_scope) {
45
- parts.push(`- **${v.id}** — ${v.title}`);
46
- }
47
- }
48
- if (input.ground_extracts && input.ground_extracts.length > 0) {
49
- parts.push("");
50
- parts.push("## Ground extracts");
51
- for (const g of input.ground_extracts) {
52
- parts.push(`### ${g.key}`);
53
- parts.push(g.snippet);
54
- }
55
- }
56
- if (input.existing_stubs && input.existing_stubs.length > 0) {
57
- parts.push("");
58
- parts.push("## Existing stubs / TODOs the spec may step on");
59
- for (const stub of input.existing_stubs) {
60
- parts.push(`- ${stub}`);
61
- }
62
- }
63
- parts.push("");
64
- parts.push("Now return the JSON object per the schema.");
65
- return parts.join("\n");
66
- }
67
- //# sourceMappingURL=prompt.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"prompt.js","sourceRoot":"","sources":["../../src/tightener/prompt.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,uBAAuB,GAAG;IACrC,mDAAmD;IACnD,EAAE;IACF,gNAAgN;IAChN,EAAE;IACF,uBAAuB;IACvB,0QAA0Q;IAC1Q,4EAA4E;IAC5E,4HAA4H;IAC5H,gFAAgF;IAChF,iKAAiK;IACjK,EAAE;IACF,8CAA8C;IAC9C,6DAA6D;IAC7D,iDAAiD;IACjD,wDAAwD;IACxD,8DAA8D;IAC9D,EAAE;IACF,kHAAkH;IAClH,EAAE;IACF,6VAA6V;IAC7V,EAAE;IACF,qDAAqD;CACtD,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAEb,MAAM,UAAU,wBAAwB,CAAC,KAAqB;IAC5D,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,KAAK,CAAC,IAAI,CAAC,wBAAwB,CAAC,CAAC;IACrC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACf,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IACvB,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IACxB,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACf,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IACtB,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAEvB,IAAI,KAAK,CAAC,kBAAkB,IAAI,KAAK,CAAC,kBAAkB,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACpE,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACf,KAAK,CAAC,IAAI,CAAC,uBAAuB,CAAC,CAAC;QACpC,KAAK,MAAM,CAAC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IAAI,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC;QAC1B,CAAC;IACH,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACf,KAAK,CAAC,IAAI,CAAC,4CAA4C,CAAC,CAAC;IACzD,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC"}
@@ -1,68 +0,0 @@
1
- /**
2
- * JSON Schema enforced by `claude --json-schema` for the tightener output.
3
- * Mirrors `TightenerOutput` exactly. Keep in sync.
4
- */
5
- export declare const TIGHTENER_OUTPUT_SCHEMA: {
6
- readonly type: "object";
7
- readonly additionalProperties: false;
8
- readonly properties: {
9
- readonly ambiguities: {
10
- readonly type: "array";
11
- readonly items: {
12
- readonly type: "object";
13
- readonly additionalProperties: false;
14
- readonly properties: {
15
- readonly id: {
16
- readonly type: "string";
17
- };
18
- readonly question: {
19
- readonly type: "string";
20
- };
21
- readonly candidate_resolutions: {
22
- readonly type: "array";
23
- readonly items: {
24
- readonly type: "string";
25
- };
26
- };
27
- };
28
- readonly required: readonly ["id", "question", "candidate_resolutions"];
29
- };
30
- };
31
- readonly conflicts: {
32
- readonly type: "array";
33
- readonly items: {
34
- readonly type: "string";
35
- };
36
- };
37
- readonly missing_acceptance: {
38
- readonly type: "array";
39
- readonly items: {
40
- readonly type: "string";
41
- };
42
- };
43
- readonly scope_concerns: {
44
- readonly type: "array";
45
- readonly items: {
46
- readonly type: "string";
47
- };
48
- };
49
- readonly existing_stub_overlap: {
50
- readonly type: "array";
51
- readonly items: {
52
- readonly type: "string";
53
- };
54
- };
55
- readonly spec_quality_score: {
56
- readonly type: "integer";
57
- readonly minimum: 0;
58
- readonly maximum: 10;
59
- };
60
- readonly ready_to_execute: {
61
- readonly type: "boolean";
62
- };
63
- readonly tightened_spec_proposal: {
64
- readonly type: "string";
65
- };
66
- };
67
- readonly required: readonly ["ambiguities", "conflicts", "missing_acceptance", "scope_concerns", "existing_stub_overlap", "spec_quality_score", "ready_to_execute", "tightened_spec_proposal"];
68
- };
@@ -1,44 +0,0 @@
1
- /**
2
- * JSON Schema enforced by `claude --json-schema` for the tightener output.
3
- * Mirrors `TightenerOutput` exactly. Keep in sync.
4
- */
5
- export const TIGHTENER_OUTPUT_SCHEMA = {
6
- type: "object",
7
- additionalProperties: false,
8
- properties: {
9
- ambiguities: {
10
- type: "array",
11
- items: {
12
- type: "object",
13
- additionalProperties: false,
14
- properties: {
15
- id: { type: "string" },
16
- question: { type: "string" },
17
- candidate_resolutions: {
18
- type: "array",
19
- items: { type: "string" },
20
- },
21
- },
22
- required: ["id", "question", "candidate_resolutions"],
23
- },
24
- },
25
- conflicts: { type: "array", items: { type: "string" } },
26
- missing_acceptance: { type: "array", items: { type: "string" } },
27
- scope_concerns: { type: "array", items: { type: "string" } },
28
- existing_stub_overlap: { type: "array", items: { type: "string" } },
29
- spec_quality_score: { type: "integer", minimum: 0, maximum: 10 },
30
- ready_to_execute: { type: "boolean" },
31
- tightened_spec_proposal: { type: "string" },
32
- },
33
- required: [
34
- "ambiguities",
35
- "conflicts",
36
- "missing_acceptance",
37
- "scope_concerns",
38
- "existing_stub_overlap",
39
- "spec_quality_score",
40
- "ready_to_execute",
41
- "tightened_spec_proposal",
42
- ],
43
- };
44
- //# sourceMappingURL=schema.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"schema.js","sourceRoot":"","sources":["../../src/tightener/schema.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG;IACrC,IAAI,EAAE,QAAQ;IACd,oBAAoB,EAAE,KAAK;IAC3B,UAAU,EAAE;QACV,WAAW,EAAE;YACX,IAAI,EAAE,OAAO;YACb,KAAK,EAAE;gBACL,IAAI,EAAE,QAAQ;gBACd,oBAAoB,EAAE,KAAK;gBAC3B,UAAU,EAAE;oBACV,EAAE,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;oBACtB,QAAQ,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;oBAC5B,qBAAqB,EAAE;wBACrB,IAAI,EAAE,OAAO;wBACb,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;qBAC1B;iBACF;gBACD,QAAQ,EAAE,CAAC,IAAI,EAAE,UAAU,EAAE,uBAAuB,CAAC;aACtD;SACF;QACD,SAAS,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE;QACvD,kBAAkB,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE;QAChE,cAAc,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE;QAC5D,qBAAqB,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE;QACnE,kBAAkB,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE;QAChE,gBAAgB,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE;QACrC,uBAAuB,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;KAC5C;IACD,QAAQ,EAAE;QACR,aAAa;QACb,WAAW;QACX,oBAAoB;QACpB,gBAAgB;QAChB,uBAAuB;QACvB,oBAAoB;QACpB,kBAAkB;QAClB,yBAAyB;KAC1B;CACO,CAAC"}
@@ -1,2 +0,0 @@
1
- import type { TightenerInput, TightenerResult } from "./types.js";
2
- export declare function tightenSpec(input: TightenerInput): Promise<TightenerResult>;