@lucern/contracts 0.3.0-alpha.1 → 0.3.0-alpha.11

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 (303) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/dist/api-enums.contract.d.ts +5 -3
  3. package/dist/api-enums.contract.js +14 -12
  4. package/dist/api-enums.contract.js.map +1 -1
  5. package/dist/component-boundary.contract.d.ts +14 -0
  6. package/dist/component-boundary.contract.js +174 -0
  7. package/dist/component-boundary.contract.js.map +1 -0
  8. package/dist/component-host-boundary.contract.d.ts +46 -0
  9. package/dist/component-host-boundary.contract.js +60 -0
  10. package/dist/component-host-boundary.contract.js.map +1 -0
  11. package/dist/context-pack.contract.d.ts +5 -3
  12. package/dist/context-pack.contract.js.map +1 -1
  13. package/dist/{defineTable-CBQ03FXl.d.ts → defineTable-t1wr5wgn.d.ts} +1 -1
  14. package/dist/{dsl-BgpoVOVQ.d.ts → dsl-DVPthQGY.d.ts} +2 -2
  15. package/dist/dsl.d.ts +2 -2
  16. package/dist/dsl.js +1 -4
  17. package/dist/dsl.js.map +1 -1
  18. package/dist/edge-policy-manifest-Dw5IhT1L.d.ts +133 -0
  19. package/dist/function-registry/beliefs.d.ts +54 -41
  20. package/dist/function-registry/beliefs.js +759 -38
  21. package/dist/function-registry/beliefs.js.map +1 -1
  22. package/dist/function-registry/coding.d.ts +9 -0
  23. package/dist/function-registry/coding.js +811 -39
  24. package/dist/function-registry/coding.js.map +1 -1
  25. package/dist/function-registry/context.d.ts +19 -13
  26. package/dist/function-registry/context.js +750 -42
  27. package/dist/function-registry/context.js.map +1 -1
  28. package/dist/function-registry/contracts.d.ts +6 -0
  29. package/dist/function-registry/contracts.js +715 -35
  30. package/dist/function-registry/contracts.js.map +1 -1
  31. package/dist/function-registry/coordination.d.ts +12 -0
  32. package/dist/function-registry/coordination.js +715 -35
  33. package/dist/function-registry/coordination.js.map +1 -1
  34. package/dist/function-registry/edges.d.ts +165 -0
  35. package/dist/function-registry/edges.js +923 -67
  36. package/dist/function-registry/edges.js.map +1 -1
  37. package/dist/function-registry/evidence.d.ts +44 -33
  38. package/dist/function-registry/evidence.js +769 -47
  39. package/dist/function-registry/evidence.js.map +1 -1
  40. package/dist/function-registry/graph.d.ts +149 -53
  41. package/dist/function-registry/graph.js +831 -42
  42. package/dist/function-registry/graph.js.map +1 -1
  43. package/dist/function-registry/helpers.d.ts +6 -3
  44. package/dist/function-registry/helpers.js +716 -36
  45. package/dist/function-registry/helpers.js.map +1 -1
  46. package/dist/function-registry/identity.d.ts +6 -0
  47. package/dist/function-registry/identity.js +715 -35
  48. package/dist/function-registry/identity.js.map +1 -1
  49. package/dist/function-registry/index.d.ts +5 -3
  50. package/dist/function-registry/index.js +722 -39
  51. package/dist/function-registry/index.js.map +1 -1
  52. package/dist/function-registry/judgments.d.ts +14 -9
  53. package/dist/function-registry/judgments.js +727 -38
  54. package/dist/function-registry/judgments.js.map +1 -1
  55. package/dist/function-registry/legacy.d.ts +4 -0
  56. package/dist/function-registry/legacy.js +715 -35
  57. package/dist/function-registry/legacy.js.map +1 -1
  58. package/dist/function-registry/lenses.d.ts +24 -17
  59. package/dist/function-registry/lenses.js +738 -38
  60. package/dist/function-registry/lenses.js.map +1 -1
  61. package/dist/function-registry/manifest.d.ts +6 -6
  62. package/dist/function-registry/manifest.js +18 -2
  63. package/dist/function-registry/manifest.js.map +1 -1
  64. package/dist/function-registry/nodes.d.ts +412 -0
  65. package/dist/function-registry/nodes.js +5303 -0
  66. package/dist/function-registry/nodes.js.map +1 -0
  67. package/dist/function-registry/ontologies.d.ts +59 -45
  68. package/dist/function-registry/ontologies.js +733 -41
  69. package/dist/function-registry/ontologies.js.map +1 -1
  70. package/dist/function-registry/pipeline.d.ts +19 -13
  71. package/dist/function-registry/pipeline.js +724 -38
  72. package/dist/function-registry/pipeline.js.map +1 -1
  73. package/dist/function-registry/questions.d.ts +64 -49
  74. package/dist/function-registry/questions.js +812 -43
  75. package/dist/function-registry/questions.js.map +1 -1
  76. package/dist/function-registry/tasks.d.ts +24 -17
  77. package/dist/function-registry/tasks.js +776 -44
  78. package/dist/function-registry/tasks.js.map +1 -1
  79. package/dist/function-registry/topics.d.ts +109 -21
  80. package/dist/function-registry/topics.js +797 -39
  81. package/dist/function-registry/topics.js.map +1 -1
  82. package/dist/function-registry/types.d.ts +6 -2
  83. package/dist/function-registry/worktrees.d.ts +94 -41
  84. package/dist/function-registry/worktrees.js +854 -47
  85. package/dist/function-registry/worktrees.js.map +1 -1
  86. package/dist/function-registry-input-audit.d.ts +13 -0
  87. package/dist/function-registry-input-audit.js +166 -0
  88. package/dist/function-registry-input-audit.js.map +1 -0
  89. package/dist/gateway.contract.d.ts +5 -0
  90. package/dist/gateway.contract.js.map +1 -1
  91. package/dist/generated/convexSchemas.d.ts +3 -3
  92. package/dist/generated/convexSchemas.js +38 -18
  93. package/dist/generated/convexSchemas.js.map +1 -1
  94. package/dist/generated/infisicalRuntimeEnv.d.ts +70 -0
  95. package/dist/generated/infisicalRuntimeEnv.js +26572 -0
  96. package/dist/generated/infisicalRuntimeEnv.js.map +1 -0
  97. package/dist/generated/lucernGatewayEnv.d.ts +17 -0
  98. package/dist/generated/lucernGatewayEnv.js +38 -0
  99. package/dist/generated/lucernGatewayEnv.js.map +1 -0
  100. package/dist/generated/lucernWebPublicEnv.d.ts +26 -0
  101. package/dist/generated/lucernWebPublicEnv.js +32 -0
  102. package/dist/generated/lucernWebPublicEnv.js.map +1 -0
  103. package/dist/generated/lucernWebServerEnv.d.ts +33 -0
  104. package/dist/generated/lucernWebServerEnv.js +51 -0
  105. package/dist/generated/lucernWebServerEnv.js.map +1 -0
  106. package/dist/generated/schema-manifest.json +1199 -138
  107. package/dist/generated/tableOwnership.d.ts +47 -27
  108. package/dist/generated/tableOwnership.js +66 -26
  109. package/dist/generated/tableOwnership.js.map +1 -1
  110. package/dist/generated/tier-expectations.json +62 -8
  111. package/dist/graph-intelligence.contract.d.ts +506 -0
  112. package/dist/graph-intelligence.contract.js +595 -0
  113. package/dist/graph-intelligence.contract.js.map +1 -0
  114. package/dist/graph-types/index.d.ts +5 -1
  115. package/dist/graph-types/index.js +15 -4
  116. package/dist/graph-types/index.js.map +1 -1
  117. package/dist/index-CM1Pl_vI.d.ts +28 -0
  118. package/dist/index.d.ts +29 -414
  119. package/dist/index.js +34791 -1088
  120. package/dist/index.js.map +1 -1
  121. package/dist/infisical-runtime.contract.d.ts +1768 -0
  122. package/dist/infisical-runtime.contract.js +3093 -0
  123. package/dist/infisical-runtime.contract.js.map +1 -0
  124. package/dist/lens-filter.contract.js +4 -3
  125. package/dist/lens-filter.contract.js.map +1 -1
  126. package/dist/lens-workflow.contract.js +4 -3
  127. package/dist/lens-workflow.contract.js.map +1 -1
  128. package/dist/manifests/edge-policy-manifest.d.ts +2 -0
  129. package/dist/manifests/edge-policy-manifest.data.d.ts +13 -0
  130. package/dist/manifests/edge-policy-manifest.data.js +26 -0
  131. package/dist/manifests/edge-policy-manifest.data.js.map +1 -0
  132. package/dist/manifests/edge-policy-manifest.js +92 -0
  133. package/dist/manifests/edge-policy-manifest.js.map +1 -0
  134. package/dist/manifests/infisical-runtime-manifest.d.ts +1672 -0
  135. package/dist/manifests/infisical-runtime-manifest.js +2948 -0
  136. package/dist/manifests/infisical-runtime-manifest.js.map +1 -0
  137. package/dist/manifests/invariant-manifest.d.ts +65 -0
  138. package/dist/manifests/invariant-manifest.js +18 -0
  139. package/dist/manifests/invariant-manifest.js.map +1 -0
  140. package/dist/manifests/invariants/ast-utils.d.ts +14 -0
  141. package/dist/manifests/invariants/ast-utils.js +54 -0
  142. package/dist/manifests/invariants/ast-utils.js.map +1 -0
  143. package/dist/manifests/invariants/index.d.ts +15 -0
  144. package/dist/manifests/invariants/index.js +183 -0
  145. package/dist/manifests/invariants/index.js.map +1 -0
  146. package/dist/manifests/invariants/inv-1-beliefs-append-only.d.ts +12 -0
  147. package/dist/manifests/invariants/inv-1-beliefs-append-only.js +94 -0
  148. package/dist/manifests/invariants/inv-1-beliefs-append-only.js.map +1 -0
  149. package/dist/manifests/invariants/inv-14-no-silent-transitions.d.ts +12 -0
  150. package/dist/manifests/invariants/inv-14-no-silent-transitions.js +99 -0
  151. package/dist/manifests/invariants/inv-14-no-silent-transitions.js.map +1 -0
  152. package/dist/manifests/invariants/manifest-1-projections-declare-audit.d.ts +12 -0
  153. package/dist/manifests/invariants/manifest-1-projections-declare-audit.js +42 -0
  154. package/dist/manifests/invariants/manifest-1-projections-declare-audit.js.map +1 -0
  155. package/dist/manifests/tenant-client-manifest.d.ts +322 -0
  156. package/dist/manifests/tenant-client-manifest.js +432 -0
  157. package/dist/manifests/tenant-client-manifest.js.map +1 -0
  158. package/dist/mcp-gateway-boundary.contract.d.ts +201 -0
  159. package/dist/mcp-gateway-boundary.contract.js +45 -0
  160. package/dist/mcp-gateway-boundary.contract.js.map +1 -0
  161. package/dist/projections/check-convex-args-shape.d.ts +3 -0
  162. package/dist/projections/check-convex-args-shape.js +403 -0
  163. package/dist/projections/check-convex-args-shape.js.map +1 -0
  164. package/dist/projections/create-evidence.projection.d.ts +176 -0
  165. package/dist/projections/create-evidence.projection.js +130 -0
  166. package/dist/projections/create-evidence.projection.js.map +1 -0
  167. package/dist/projections/index.d.ts +102 -0
  168. package/dist/projections/index.js +352 -0
  169. package/dist/projections/index.js.map +1 -0
  170. package/dist/projections/list-beliefs.projection.d.ts +36 -0
  171. package/dist/projections/list-beliefs.projection.js +54 -0
  172. package/dist/projections/list-beliefs.projection.js.map +1 -0
  173. package/dist/projections/list-tasks.projection.d.ts +44 -0
  174. package/dist/projections/list-tasks.projection.js +57 -0
  175. package/dist/projections/list-tasks.projection.js.map +1 -0
  176. package/dist/projections/modulate-confidence.projection.d.ts +219 -0
  177. package/dist/projections/modulate-confidence.projection.js +148 -0
  178. package/dist/projections/modulate-confidence.projection.js.map +1 -0
  179. package/dist/projections/projection-dsl.d.ts +11 -0
  180. package/dist/projections/projection-dsl.js +8 -0
  181. package/dist/projections/projection-dsl.js.map +1 -0
  182. package/dist/proof-attestation.json +45 -0
  183. package/dist/schema-helpers/enumValidation.js +2 -5
  184. package/dist/schema-helpers/enumValidation.js.map +1 -1
  185. package/dist/schema-helpers/spine/nodes/decision.js +2 -1
  186. package/dist/schema-helpers/spine/nodes/decision.js.map +1 -1
  187. package/dist/schema-helpers/spine/tables/epistemicNodes.js +27 -27
  188. package/dist/schema-helpers/spine/tables/epistemicNodes.js.map +1 -1
  189. package/dist/schemas/component-table-manifest.d.ts +6 -6
  190. package/dist/schemas/component-table-manifest.js +2 -2
  191. package/dist/schemas/component-table-manifest.js.map +1 -1
  192. package/dist/schemas/enums.d.ts +5 -2
  193. package/dist/schemas/enums.js +5 -2
  194. package/dist/schemas/enums.js.map +1 -1
  195. package/dist/schemas/index.d.ts +3 -3
  196. package/dist/schemas/index.js +1129 -139
  197. package/dist/schemas/index.js.map +1 -1
  198. package/dist/schemas/manifest.d.ts +2979 -949
  199. package/dist/schemas/manifest.js +1127 -137
  200. package/dist/schemas/manifest.js.map +1 -1
  201. package/dist/schemas/sl-opinion.d.ts +4 -4
  202. package/dist/schemas/tables/controlPlane/accessControl.d.ts +260 -0
  203. package/dist/schemas/tables/controlPlane/accessControl.js +653 -0
  204. package/dist/schemas/tables/controlPlane/accessControl.js.map +1 -0
  205. package/dist/schemas/tables/{identity → controlPlane}/agent.d.ts +1 -1
  206. package/dist/schemas/tables/{identity → controlPlane}/agent.js +3 -3
  207. package/dist/schemas/tables/controlPlane/agent.js.map +1 -0
  208. package/dist/schemas/tables/{identity → controlPlane}/epistemic.d.ts +1 -1
  209. package/dist/schemas/tables/{identity → controlPlane}/epistemic.js +3 -3
  210. package/dist/schemas/tables/controlPlane/epistemic.js.map +1 -0
  211. package/dist/schemas/tables/{identity → controlPlane}/model.d.ts +1 -1
  212. package/dist/schemas/tables/{identity → controlPlane}/model.js +6 -6
  213. package/dist/schemas/tables/controlPlane/model.js.map +1 -0
  214. package/dist/schemas/tables/{identity → controlPlane}/platform.d.ts +11 -11
  215. package/dist/schemas/tables/{identity → controlPlane}/platform.js +18 -18
  216. package/dist/schemas/tables/controlPlane/platform.js.map +1 -0
  217. package/dist/schemas/tables/{identity → controlPlane}/project.d.ts +1 -1
  218. package/dist/schemas/tables/{identity → controlPlane}/project.js +3 -3
  219. package/dist/schemas/tables/controlPlane/project.js.map +1 -0
  220. package/dist/schemas/tables/{identity → controlPlane}/user.d.ts +1 -1
  221. package/dist/schemas/tables/{identity → controlPlane}/user.js +3 -3
  222. package/dist/schemas/tables/controlPlane/user.js.map +1 -0
  223. package/dist/schemas/tables/kernel/config.d.ts +1 -1
  224. package/dist/schemas/tables/kernel/config.js.map +1 -1
  225. package/dist/schemas/tables/kernel/coordination.d.ts +1 -1
  226. package/dist/schemas/tables/kernel/coordination.js.map +1 -1
  227. package/dist/schemas/tables/kernel/decision.d.ts +1 -1
  228. package/dist/schemas/tables/kernel/decision.js.map +1 -1
  229. package/dist/schemas/tables/kernel/embedding.d.ts +1 -1
  230. package/dist/schemas/tables/kernel/embedding.js.map +1 -1
  231. package/dist/schemas/tables/kernel/epistemic.d.ts +7 -7
  232. package/dist/schemas/tables/kernel/epistemic.js.map +1 -1
  233. package/dist/schemas/tables/kernel/idempotency.d.ts +1 -1
  234. package/dist/schemas/tables/kernel/idempotency.js.map +1 -1
  235. package/dist/schemas/tables/kernel/infra.d.ts +5 -5
  236. package/dist/schemas/tables/kernel/infra.js.map +1 -1
  237. package/dist/schemas/tables/kernel/intelligence.d.ts +11 -11
  238. package/dist/schemas/tables/kernel/intelligence.js.map +1 -1
  239. package/dist/schemas/tables/kernel/lens.d.ts +5 -5
  240. package/dist/schemas/tables/kernel/lens.js.map +1 -1
  241. package/dist/schemas/tables/kernel/ontology.d.ts +1 -1
  242. package/dist/schemas/tables/kernel/ontology.js.map +1 -1
  243. package/dist/schemas/tables/kernel/platform.d.ts +13 -13
  244. package/dist/schemas/tables/kernel/platform.js.map +1 -1
  245. package/dist/schemas/tables/kernel/spine.d.ts +5 -4
  246. package/dist/schemas/tables/kernel/spine.js +6 -2
  247. package/dist/schemas/tables/kernel/spine.js.map +1 -1
  248. package/dist/schemas/tables/kernel/task.d.ts +43 -43
  249. package/dist/schemas/tables/kernel/task.js.map +1 -1
  250. package/dist/schemas/tables/kernel/topic.d.ts +1 -1
  251. package/dist/schemas/tables/kernel/topic.js +5 -1
  252. package/dist/schemas/tables/kernel/topic.js.map +1 -1
  253. package/dist/schemas/tables/kernel/workflow.d.ts +1 -1
  254. package/dist/schemas/tables/kernel/workflow.js.map +1 -1
  255. package/dist/schemas/tables/kernel/worktree.d.ts +55 -55
  256. package/dist/schemas/tables/kernel/worktree.js.map +1 -1
  257. package/dist/schemas/tables/mc/identity.d.ts +44 -4
  258. package/dist/schemas/tables/mc/identity.js +66 -1
  259. package/dist/schemas/tables/mc/identity.js.map +1 -1
  260. package/dist/schemas/tables/mc/methodology.d.ts +1 -1
  261. package/dist/schemas/tables/mc/methodology.js.map +1 -1
  262. package/dist/schemas/tables/mc/pack.d.ts +21 -21
  263. package/dist/schemas/tables/mc/pack.js.map +1 -1
  264. package/dist/schemas/tables/mc/policy.d.ts +2 -2
  265. package/dist/schemas/tables/mc/policy.js +1 -1
  266. package/dist/schemas/tables/mc/policy.js.map +1 -1
  267. package/dist/schemas/tables/mc/registry.d.ts +5 -5
  268. package/dist/schemas/tables/mc/registry.js.map +1 -1
  269. package/dist/schemas/tables/mc/runtime.d.ts +109 -3
  270. package/dist/schemas/tables/mc/runtime.js +330 -104
  271. package/dist/schemas/tables/mc/runtime.js.map +1 -1
  272. package/dist/schemas/tables/mc/tenant.d.ts +3 -2
  273. package/dist/schemas/tables/mc/tenant.js +2 -1
  274. package/dist/schemas/tables/mc/tenant.js.map +1 -1
  275. package/dist/schemas/tables/mc/workspace.d.ts +28 -5
  276. package/dist/schemas/tables/mc/workspace.js +36 -2
  277. package/dist/schemas/tables/mc/workspace.js.map +1 -1
  278. package/dist/sdk-methods.contract.d.ts +2 -2
  279. package/dist/{sdk-tools.contract-S4ia0TTo.d.ts → sdk-tools.contract-BNklQDfB.d.ts} +2 -2
  280. package/dist/sdk-tools.contract.d.ts +2 -2
  281. package/dist/sdk-tools.contract.js +672 -24
  282. package/dist/sdk-tools.contract.js.map +1 -1
  283. package/dist/tenant-bootstrap-seed.contract.d.ts +1269 -0
  284. package/dist/tenant-bootstrap-seed.contract.js +751 -0
  285. package/dist/tenant-bootstrap-seed.contract.js.map +1 -0
  286. package/dist/tenant-bootstrap-seed.defaults.d.ts +16 -0
  287. package/dist/tenant-bootstrap-seed.defaults.js +303 -0
  288. package/dist/tenant-bootstrap-seed.defaults.js.map +1 -0
  289. package/dist/tenant-client.contract.d.ts +349 -0
  290. package/dist/tenant-client.contract.js +488 -0
  291. package/dist/tenant-client.contract.js.map +1 -0
  292. package/dist/{tool-contracts-C92-9ueT.d.ts → tool-contracts-BevD9Ho2.d.ts} +36 -2
  293. package/dist/tool-contracts.d.ts +1 -1
  294. package/dist/tool-contracts.js +673 -25
  295. package/dist/tool-contracts.js.map +1 -1
  296. package/package.json +30 -1
  297. package/dist/index-CV-0_VWJ.d.ts +0 -25
  298. package/dist/schemas/tables/identity/agent.js.map +0 -1
  299. package/dist/schemas/tables/identity/epistemic.js.map +0 -1
  300. package/dist/schemas/tables/identity/model.js.map +0 -1
  301. package/dist/schemas/tables/identity/platform.js.map +0 -1
  302. package/dist/schemas/tables/identity/project.js.map +0 -1
  303. package/dist/schemas/tables/identity/user.js.map +0 -1
@@ -2,6 +2,20 @@ import { z } from 'zod';
2
2
 
3
3
  // src/function-registry/helpers.ts
4
4
 
5
+ // src/types/reasoning-method.ts
6
+ var REASONING_METHODS = [
7
+ "deductive",
8
+ "inductive",
9
+ "abductive",
10
+ "analogical",
11
+ "causal",
12
+ "correlational",
13
+ "testimonial",
14
+ "statistical",
15
+ "implicit",
16
+ "pattern_match"
17
+ ];
18
+
5
19
  // src/lens-workflow.contract.ts
6
20
  var LENS_PERSPECTIVE_TYPES = [
7
21
  "investigation",
@@ -422,7 +436,22 @@ var ADD_WORKTREE = {
422
436
  description: "Check out a branch into an active worktree for investigation. Like `git worktree add <branch>` \u2014 creates independent working state on a thematic branch. Beliefs committed within the worktree can be freely amended (draft code on a feature branch). When investigation is complete, `merge` integrates findings into main.",
423
437
  parameters: {
424
438
  title: { type: "string", description: "Worktree name/objective" },
425
- topicId: { type: "string", description: "Optional topic scope hint" },
439
+ name: {
440
+ type: "string",
441
+ description: "Optional storage-name alias for callers that already use backend naming"
442
+ },
443
+ projectId: {
444
+ type: "string",
445
+ description: "Legacy topicId alias or resolver hint"
446
+ },
447
+ topicId: {
448
+ type: "string",
449
+ description: "Optional topic scope hint for resolver validation"
450
+ },
451
+ topicHint: {
452
+ type: "string",
453
+ description: "Natural-language topic hint for automatic topic resolution"
454
+ },
426
455
  branchId: {
427
456
  type: "string",
428
457
  description: "The branch this worktree investigates"
@@ -435,18 +464,107 @@ var ADD_WORKTREE = {
435
464
  type: "string",
436
465
  description: "The testable claim this worktree investigates"
437
466
  },
467
+ rationale: {
468
+ type: "string",
469
+ description: "Why this worktree exists and why it belongs in the campaign"
470
+ },
471
+ worktreeType: {
472
+ type: "string",
473
+ description: "Schema-enum worktree type used by the kernel lifecycle and retrieval layers"
474
+ },
475
+ gate: {
476
+ type: "string",
477
+ description: "Exit gate name for this worktree"
478
+ },
479
+ startDate: {
480
+ type: "number",
481
+ description: "Planned start timestamp in milliseconds since epoch"
482
+ },
483
+ endDate: {
484
+ type: "number",
485
+ description: "Planned end timestamp in milliseconds since epoch"
486
+ },
487
+ durationWeeks: {
488
+ type: "number",
489
+ description: "Planned duration in weeks"
490
+ },
491
+ confidenceImpact: {
492
+ type: "string",
493
+ description: "Expected confidence impact if the worktree succeeds",
494
+ enum: ["high", "medium", "low"]
495
+ },
496
+ beliefFocus: {
497
+ type: "string",
498
+ description: "Natural-language focus spanning the target belief neighborhood"
499
+ },
438
500
  beliefIds: {
439
501
  type: "array",
440
- description: "Beliefs to test in this worktree"
502
+ description: "Legacy alias for targetBeliefIds"
503
+ },
504
+ beliefs: {
505
+ type: "array",
506
+ description: "Legacy alias for targetBeliefIds"
507
+ },
508
+ targetBeliefIds: {
509
+ type: "array",
510
+ description: "Belief node IDs this worktree is expected to test or update"
511
+ },
512
+ targetQuestionIds: {
513
+ type: "array",
514
+ description: "Question node IDs this worktree is expected to answer"
515
+ },
516
+ keyQuestions: {
517
+ type: "array",
518
+ description: "Inline key question objects with question, optional status, answer, answerConfidence, and linkedQuestionId"
519
+ },
520
+ evidenceSignals: {
521
+ type: "array",
522
+ description: "Evidence signal objects with signal, optional collected state, progress, and notes"
523
+ },
524
+ decisionGate: {
525
+ type: "object",
526
+ description: "Decision gate object with goCriteria, noGoSignals, optional verdict, rationale, decidedAt, and decidedBy"
527
+ },
528
+ goCriteria: {
529
+ type: "array",
530
+ description: "Shorthand go criteria used to build decisionGate"
531
+ },
532
+ noGoSignals: {
533
+ type: "array",
534
+ description: "Shorthand no-go signals used to build decisionGate"
535
+ },
536
+ proofArtifacts: {
537
+ type: "array",
538
+ description: "Expected proof artifacts required to close the worktree"
441
539
  },
442
540
  autoShape: {
443
541
  type: "boolean",
444
542
  description: "Whether to invoke inquiry auto-shaping during worktree creation"
445
543
  },
544
+ autoFixPolicy: {
545
+ type: "object",
546
+ description: "Policy for permitted automatic remediation inside the worktree"
547
+ },
446
548
  domainPackId: {
447
549
  type: "string",
448
550
  description: "Optional domain pack whose shaping hooks should influence generated questions and tasks"
449
551
  },
552
+ tags: {
553
+ type: "array",
554
+ description: "Additional topic-resolution tags for the worktree"
555
+ },
556
+ touchedPaths: {
557
+ type: "array",
558
+ description: "File paths used as topic-resolution signals"
559
+ },
560
+ sourceRef: {
561
+ type: "string",
562
+ description: "Source reference used as a topic-resolution signal"
563
+ },
564
+ sourceKind: {
565
+ type: "string",
566
+ description: "Source kind used as a topic-resolution signal"
567
+ },
450
568
  campaign: {
451
569
  type: "number",
452
570
  description: "Top-level pipeline campaign number. Campaigns define the outer execution slice."
@@ -471,12 +589,20 @@ var ADD_WORKTREE = {
471
589
  type: "array",
472
590
  description: "Worktree IDs blocked by this worktree"
473
591
  },
474
- gate: {
592
+ staffingHint: {
475
593
  type: "string",
476
- description: "Exit gate name for this worktree"
594
+ description: "Suggested staffing or agent allocation note"
595
+ },
596
+ lensId: {
597
+ type: "string",
598
+ description: "Lens that scopes this worktree when applicable"
599
+ },
600
+ lastReconciledAt: {
601
+ type: "number",
602
+ description: "Timestamp when worktree metadata was last reconciled"
477
603
  }
478
604
  },
479
- required: ["title", "topicId"],
605
+ required: ["title"],
480
606
  response: {
481
607
  description: "The created worktree",
482
608
  fields: {
@@ -503,7 +629,7 @@ var MERGE = {
503
629
  worktreeId: { type: "string", description: "The worktree to merge" },
504
630
  outcomes: {
505
631
  type: "array",
506
- description: "Scoring outcomes for each belief: { beliefId, confidence, rationale }"
632
+ description: "Merge outcomes as key-finding strings, or scoring outcomes for beliefs: { beliefId, confidence, rationale }"
507
633
  },
508
634
  summary: { type: "string", description: "Overall findings summary" }
509
635
  },
@@ -721,19 +847,23 @@ var FIND_CONTRADICTIONS = {
721
847
  };
722
848
  var CREATE_EDGE = {
723
849
  name: "create_edge",
724
- description: "Commit a typed relationship between two nodes in the reasoning graph. Like `git commit` \u2014 an atomic write that declares a dependency between nodes. The engine enforces layer transition rules \u2014 for example, L1 \u2192 L3 direct edges are forbidden (must go through L2).",
850
+ description: "Commit a typed relationship between two nodes in the reasoning graph. Like `git commit` \u2014 an atomic write that declares a dependency between nodes. Accepts any public epistemic edge type between public graph node refs so agents can author the full spine.",
725
851
  parameters: {
726
- sourceId: {
727
- type: "string",
728
- description: "Source node of the relationship"
852
+ from: {
853
+ type: "object",
854
+ description: "Source graph ref, e.g. { kind: 'epistemic_node', nodeId: '...', nodeType: 'topic' }"
729
855
  },
730
- targetId: {
731
- type: "string",
732
- description: "Target node of the relationship"
856
+ to: {
857
+ type: "object",
858
+ description: "Target graph ref, e.g. { kind: 'epistemic_node', nodeId: '...', nodeType: 'belief' }"
733
859
  },
734
860
  edgeType: {
735
861
  type: "string",
736
- description: "Relationship type (informs, tests, depends_on, supersedes, etc.)"
862
+ description: "Relationship type from the public epistemic edge enum."
863
+ },
864
+ globalId: {
865
+ type: "string",
866
+ description: "Optional idempotent edge global ID."
737
867
  },
738
868
  weight: {
739
869
  type: "number",
@@ -743,10 +873,14 @@ var CREATE_EDGE = {
743
873
  reasoningMethod: {
744
874
  type: "string",
745
875
  description: "How this was determined",
746
- enum: ["deductive", "inductive", "abductive", "analogical", "empirical"]
876
+ enum: [...REASONING_METHODS]
877
+ },
878
+ metadata: {
879
+ type: "object",
880
+ description: "Optional edge metadata."
747
881
  }
748
882
  },
749
- required: ["sourceId", "targetId", "edgeType"],
883
+ required: ["from", "to", "edgeType"],
750
884
  response: {
751
885
  description: "The created edge",
752
886
  fields: {
@@ -760,6 +894,240 @@ var CREATE_EDGE = {
760
894
  ontologyPrimitive: "edge",
761
895
  tier: "showcase"
762
896
  };
897
+ var UPDATE_EDGE = {
898
+ name: "update_edge",
899
+ description: "Amend metadata on an existing graph edge. Like `git commit --amend` \u2014 changes the edge annotation without recreating the relationship.",
900
+ parameters: {
901
+ edgeId: { type: "string", description: "Edge ID or global ID to update" },
902
+ weight: { type: "number", description: "Updated edge weight" },
903
+ confidence: { type: "number", description: "Updated confidence" },
904
+ context: { type: "string", description: "Updated human-readable context" },
905
+ derivationType: { type: "string", description: "Updated derivation type" },
906
+ metadata: { type: "object", description: "Updated metadata" }
907
+ },
908
+ required: ["edgeId"],
909
+ response: {
910
+ description: "Edge update result",
911
+ fields: { success: "boolean" }
912
+ },
913
+ ownerModule: "graph-primitives",
914
+ ontologyPrimitive: "edge",
915
+ tier: "workhorse"
916
+ };
917
+ var REMOVE_EDGE = {
918
+ name: "remove_edge",
919
+ description: "Remove one graph edge by ID. Like `git rm` \u2014 deletes a single explicit relationship from the spine.",
920
+ parameters: {
921
+ edgeId: { type: "string", description: "Edge ID or global ID to remove" }
922
+ },
923
+ required: ["edgeId"],
924
+ response: {
925
+ description: "Edge removal result",
926
+ fields: { success: "boolean" }
927
+ },
928
+ ownerModule: "graph-primitives",
929
+ ontologyPrimitive: "edge",
930
+ tier: "workhorse"
931
+ };
932
+ var REMOVE_EDGES_BETWEEN = {
933
+ name: "remove_edges_between",
934
+ description: "Remove graph edges between two nodes. Like `git rm <pathspec>` \u2014 deletes relationships matching a source, target, and optional type.",
935
+ parameters: {
936
+ fromNodeId: { type: "string", description: "Source node ID or global ID" },
937
+ toNodeId: { type: "string", description: "Target node ID or global ID" },
938
+ edgeType: { type: "string", description: "Optional edge type filter" }
939
+ },
940
+ required: ["fromNodeId", "toNodeId"],
941
+ response: {
942
+ description: "Matched edge removal result",
943
+ fields: { deleted: "number" }
944
+ },
945
+ ownerModule: "graph-primitives",
946
+ ontologyPrimitive: "edge",
947
+ tier: "workhorse"
948
+ };
949
+ var BATCH_CREATE_EDGES = {
950
+ name: "batch_create_edges",
951
+ description: "Commit multiple typed graph edges. Like `git commit` with many staged paths \u2014 writes a batch of explicit relationships atomically per edge.",
952
+ parameters: {
953
+ edges: {
954
+ type: "array",
955
+ description: "Edges to create, each with from, to, edgeType, and optional weight/confidence/context."
956
+ },
957
+ skipLayerValidation: {
958
+ type: "boolean",
959
+ description: "Skip kernel layer validation for trusted materialization flows."
960
+ }
961
+ },
962
+ required: ["edges"],
963
+ response: {
964
+ description: "Batch edge creation result",
965
+ fields: {
966
+ created: "number",
967
+ results: "array",
968
+ errors: "array"
969
+ }
970
+ },
971
+ ownerModule: "graph-primitives",
972
+ ontologyPrimitive: "edge",
973
+ tier: "workhorse"
974
+ };
975
+ var CREATE_EPISTEMIC_NODE = {
976
+ name: "create_epistemic_node",
977
+ description: "Commit a generic epistemic graph node. Like `git commit` \u2014 creates a canonical node in the public spine for topics, beliefs, evidence, questions, answers, sources, and entities.",
978
+ parameters: {
979
+ globalId: { type: "string", description: "Optional idempotent node global ID" },
980
+ nodeType: { type: "string", description: "Public epistemic node type" },
981
+ canonicalText: { type: "string", description: "Canonical node text" },
982
+ text: { type: "string", description: "Alias for canonicalText" },
983
+ contentHash: { type: "string", description: "Optional idempotency content hash" },
984
+ sourceType: { type: "string", description: "Source type for provenance" },
985
+ topicId: { type: "string", description: "Optional topic scope" },
986
+ content: { type: "string", description: "Extended content" },
987
+ title: { type: "string", description: "Display title" },
988
+ metadata: { type: "object", description: "Optional node metadata" }
989
+ },
990
+ required: ["nodeType"],
991
+ response: {
992
+ description: "Created node result",
993
+ fields: {
994
+ nodeId: "string",
995
+ nodeGlobalId: "string",
996
+ isDuplicate: "boolean"
997
+ }
998
+ },
999
+ ownerModule: "reasoning-kernel",
1000
+ ontologyPrimitive: "graph",
1001
+ tier: "showcase"
1002
+ };
1003
+ var GET_EPISTEMIC_NODE = {
1004
+ name: "get_epistemic_node",
1005
+ description: "Read one epistemic graph node. Like `git show` \u2014 resolves a canonical spine node by ID or global ID.",
1006
+ parameters: {
1007
+ nodeId: { type: "string", description: "Node ID or global ID" }
1008
+ },
1009
+ required: ["nodeId"],
1010
+ response: {
1011
+ description: "The resolved node",
1012
+ fields: { node: "object" }
1013
+ },
1014
+ ownerModule: "reasoning-kernel",
1015
+ ontologyPrimitive: "graph",
1016
+ tier: "workhorse"
1017
+ };
1018
+ var LIST_EPISTEMIC_NODES = {
1019
+ name: "list_epistemic_nodes",
1020
+ description: "List epistemic graph nodes. Like `git ls-tree` \u2014 lists canonical spine nodes by topic, type, status, or search query.",
1021
+ parameters: {
1022
+ topicId: { type: "string", description: "Optional topic scope" },
1023
+ nodeType: { type: "string", description: "Optional node type filter" },
1024
+ status: { type: "string", description: "Optional lifecycle status" },
1025
+ searchQuery: { type: "string", description: "Optional text search query" },
1026
+ limit: { type: "number", description: "Maximum nodes to return" }
1027
+ },
1028
+ required: [],
1029
+ response: {
1030
+ description: "Matching nodes",
1031
+ fields: { nodes: "array" }
1032
+ },
1033
+ ownerModule: "reasoning-kernel",
1034
+ ontologyPrimitive: "graph",
1035
+ tier: "workhorse"
1036
+ };
1037
+ var UPDATE_EPISTEMIC_NODE = {
1038
+ name: "update_epistemic_node",
1039
+ description: "Amend an epistemic graph node. Like `git commit --amend` \u2014 updates mutable node metadata, text, status, or verification fields.",
1040
+ parameters: {
1041
+ nodeId: { type: "string", description: "Node ID or global ID" },
1042
+ canonicalText: { type: "string", description: "Updated canonical text" },
1043
+ text: { type: "string", description: "Alias for canonicalText" },
1044
+ contentHash: { type: "string", description: "Updated content hash" },
1045
+ content: { type: "string", description: "Updated content" },
1046
+ title: { type: "string", description: "Updated display title" },
1047
+ metadata: { type: "object", description: "Updated metadata" },
1048
+ confidence: { type: "number", description: "Updated confidence" },
1049
+ verificationStatus: { type: "string", description: "Updated verification status" },
1050
+ status: { type: "string", description: "Updated lifecycle status" }
1051
+ },
1052
+ required: ["nodeId"],
1053
+ response: {
1054
+ description: "Node update result",
1055
+ fields: { success: "boolean" }
1056
+ },
1057
+ ownerModule: "reasoning-kernel",
1058
+ ontologyPrimitive: "graph",
1059
+ tier: "workhorse"
1060
+ };
1061
+ var ARCHIVE_EPISTEMIC_NODE = {
1062
+ name: "archive_epistemic_node",
1063
+ description: "Archive an epistemic graph node. Like `git rm --cached` \u2014 removes a node from active traversal without hard-deleting it.",
1064
+ parameters: {
1065
+ nodeId: { type: "string", description: "Node ID or global ID" }
1066
+ },
1067
+ required: ["nodeId"],
1068
+ response: {
1069
+ description: "Archive result",
1070
+ fields: { success: "boolean", effectiveStatus: "string" }
1071
+ },
1072
+ ownerModule: "reasoning-kernel",
1073
+ ontologyPrimitive: "graph",
1074
+ tier: "workhorse"
1075
+ };
1076
+ var VERIFY_EPISTEMIC_NODE = {
1077
+ name: "verify_epistemic_node",
1078
+ description: "Record verification state on an epistemic graph node. Like `git tag` \u2014 marks the node with a reviewed verification state.",
1079
+ parameters: {
1080
+ nodeId: { type: "string", description: "Node ID or global ID" },
1081
+ verificationStatus: { type: "string", description: "Verification status" },
1082
+ confidence: { type: "number", description: "Optional confidence update" }
1083
+ },
1084
+ required: ["nodeId", "verificationStatus"],
1085
+ response: {
1086
+ description: "Verification result",
1087
+ fields: { success: "boolean" }
1088
+ },
1089
+ ownerModule: "reasoning-kernel",
1090
+ ontologyPrimitive: "graph",
1091
+ tier: "workhorse"
1092
+ };
1093
+ var SUPERSEDE_EPISTEMIC_NODE = {
1094
+ name: "supersede_epistemic_node",
1095
+ description: "Supersede an epistemic graph node with a new version. Like `git commit --amend` on an immutable history branch \u2014 creates the replacement and marks the old node superseded.",
1096
+ parameters: {
1097
+ oldNodeId: { type: "string", description: "Node ID or global ID to supersede" },
1098
+ newGlobalId: { type: "string", description: "Optional replacement global ID" },
1099
+ newCanonicalText: { type: "string", description: "Replacement canonical text" },
1100
+ text: { type: "string", description: "Alias for newCanonicalText" },
1101
+ newContentHash: { type: "string", description: "Optional replacement content hash" },
1102
+ reason: { type: "string", description: "Reason for superseding" }
1103
+ },
1104
+ required: ["oldNodeId"],
1105
+ response: {
1106
+ description: "Supersede result",
1107
+ fields: { oldNodeId: "string", newNodeId: "string" }
1108
+ },
1109
+ ownerModule: "reasoning-kernel",
1110
+ ontologyPrimitive: "graph",
1111
+ tier: "workhorse"
1112
+ };
1113
+ var BATCH_CREATE_EPISTEMIC_NODES = {
1114
+ name: "batch_create_epistemic_nodes",
1115
+ description: "Commit multiple epistemic graph nodes. Like `git commit` with many staged files \u2014 writes a batch of canonical spine nodes.",
1116
+ parameters: {
1117
+ nodes: {
1118
+ type: "array",
1119
+ description: "Nodes to create with nodeType, canonicalText/text, and optional metadata."
1120
+ }
1121
+ },
1122
+ required: ["nodes"],
1123
+ response: {
1124
+ description: "Batch node creation result",
1125
+ fields: { created: "number", results: "array" }
1126
+ },
1127
+ ownerModule: "reasoning-kernel",
1128
+ ontologyPrimitive: "graph",
1129
+ tier: "workhorse"
1130
+ };
763
1131
  var RECORD_JUDGMENT = {
764
1132
  name: "record_judgment",
765
1133
  description: "Record a judgment \u2014 an irreversible commitment based on the current epistemic state. Like a `git tag` marking a release. A judgment synthesizes beliefs, evidence, and uncertainties into a determination. Once issued, a judgment is evaluated against the epistemic state that existed when it was made (knowledge horizon evaluation, Invariant #10).",
@@ -1057,6 +1425,74 @@ var GET_GRAPH_STRUCTURE_ANALYSIS = {
1057
1425
  ontologyPrimitive: "graph",
1058
1426
  tier: "showcase"
1059
1427
  };
1428
+ var LIST_GRAPH_INTELLIGENCE_QUERIES = {
1429
+ name: "list_graph_intelligence_queries",
1430
+ description: "List the Graph Intelligence query catalog that powers structural graph analysis experiences. Returns categories, query IDs, prompt templates, modes, and the public tool plan each query can use.",
1431
+ parameters: {
1432
+ categoryId: {
1433
+ type: "string",
1434
+ description: "Optional category filter, such as problems or strategic"
1435
+ },
1436
+ mode: {
1437
+ type: "string",
1438
+ description: "Optional mode filter: core, bias, stress, operational, alpha, semantic, or evidence"
1439
+ }
1440
+ },
1441
+ required: [],
1442
+ response: {
1443
+ description: "Graph Intelligence query catalog and mode-to-tool mapping",
1444
+ fields: {
1445
+ categories: "array \u2014 query categories",
1446
+ queries: "array \u2014 query definitions with prompt templates and tools",
1447
+ quickQueries: "array \u2014 recommended one-click query presets",
1448
+ publicToolNamesByMode: "object \u2014 public tool names available to each Graph Intelligence mode"
1449
+ }
1450
+ },
1451
+ ownerModule: "graph-intelligence",
1452
+ ontologyPrimitive: "graph",
1453
+ tier: "showcase"
1454
+ };
1455
+ var RUN_GRAPH_INTELLIGENCE_QUERY = {
1456
+ name: "run_graph_intelligence_query",
1457
+ description: "Run a named Graph Intelligence query against a tenant topic graph. Returns the selected query, prompt, deterministic graph-analysis bundle, graph context, and public tool plan for model synthesis.",
1458
+ parameters: {
1459
+ topicId: { type: "string", description: "Topic to analyze" },
1460
+ queryId: {
1461
+ type: "string",
1462
+ description: "Graph Intelligence query ID, such as confirmation-bias, pre-mortem, or thesis-summary"
1463
+ },
1464
+ prompt: {
1465
+ type: "string",
1466
+ description: "Optional custom prompt for custom analysis runs"
1467
+ },
1468
+ input: {
1469
+ type: "string",
1470
+ description: "Optional entity, theme, belief, company, or search text for input-driven queries"
1471
+ },
1472
+ mode: {
1473
+ type: "string",
1474
+ description: "Optional mode override: core, bias, stress, operational, alpha, semantic, or evidence"
1475
+ },
1476
+ limit: {
1477
+ type: "number",
1478
+ description: "Maximum graph context rows to return"
1479
+ }
1480
+ },
1481
+ required: ["topicId"],
1482
+ response: {
1483
+ description: "Graph Intelligence query result bundle ready for model or prompt-library synthesis",
1484
+ fields: {
1485
+ query: "object \u2014 selected query definition",
1486
+ prompt: "string \u2014 resolved prompt template",
1487
+ toolPlan: "array \u2014 public tools and args the model can call next",
1488
+ analysis: "object \u2014 structure, coverage, gap, and confirmation-bias analysis",
1489
+ context: "object \u2014 sampled beliefs, questions, evidence, edges, and contradictions"
1490
+ }
1491
+ },
1492
+ ownerModule: "graph-intelligence",
1493
+ ontologyPrimitive: "graph",
1494
+ tier: "showcase"
1495
+ };
1060
1496
  var GET_FALSIFICATION_QUESTIONS = {
1061
1497
  name: "get_falsification_questions",
1062
1498
  description: "Generate Popperian falsification questions for beliefs. Like `git test` \u2014 identifies the questions most likely to disprove current beliefs. Karl Popper as a tool: surfaces what would need to be true to invalidate each belief.",
@@ -1905,15 +2341,15 @@ var IDENTITY_WHOAMI = {
1905
2341
  };
1906
2342
  var COMPILE_CONTEXT = {
1907
2343
  name: "compile_context",
1908
- description: "Compile a focused reasoning context for a topic. Like `git log --graph --decorate` for the reasoning substrate \u2014 returns the canonical Pillar 3 context pack through the public API shape.",
2344
+ description: "Compile a focused reasoning context. If topicId is omitted, Lucern resolves the best topic from the query. Like `git log --graph --decorate` for the reasoning substrate \u2014 returns the canonical Pillar 3 context pack through the public API shape.",
1909
2345
  parameters: {
1910
2346
  topicId: {
1911
2347
  type: "string",
1912
- description: "Topic scope ID to compile"
2348
+ description: "Optional topic scope ID. Omit to resolve the topic from query."
1913
2349
  },
1914
2350
  query: {
1915
2351
  type: "string",
1916
- description: "Optional focus query used to rank context items"
2352
+ description: "Focus query used to resolve the topic and rank context items. Required when topicId is omitted."
1917
2353
  },
1918
2354
  budget: {
1919
2355
  type: "number",
@@ -1937,7 +2373,7 @@ var COMPILE_CONTEXT = {
1937
2373
  description: "Include related ontological entities in the compiled result"
1938
2374
  }
1939
2375
  },
1940
- required: ["topicId"],
2376
+ required: [],
1941
2377
  response: {
1942
2378
  description: "Compiled context pack for the requested topic",
1943
2379
  fields: {
@@ -2111,18 +2547,64 @@ var CREATE_TASK = {
2111
2547
  name: "create_task",
2112
2548
  description: "Create an execution task tied to the reasoning state. Like `git task` \u2014 tracks concrete work items (calls to make, data to gather, analyses to run) linked to questions, beliefs, or worktrees.",
2113
2549
  parameters: {
2114
- title: { type: "string", description: "Task description" },
2550
+ title: { type: "string", description: "Task title" },
2115
2551
  topicId: { type: "string", description: "Topic scope" },
2552
+ description: {
2553
+ type: "string",
2554
+ description: "Long-form task description"
2555
+ },
2116
2556
  taskType: {
2117
2557
  type: "string",
2118
- description: "Type: research, interview, analysis, data_collection",
2119
- enum: ["research", "interview", "analysis", "data_collection"]
2558
+ description: "Task taxonomy",
2559
+ enum: [
2560
+ "general",
2561
+ "find_evidence",
2562
+ "verify_claim",
2563
+ "research",
2564
+ "review",
2565
+ "interview",
2566
+ "analysis",
2567
+ "track_metrics"
2568
+ ]
2569
+ },
2570
+ priority: {
2571
+ type: "string",
2572
+ description: "Priority",
2573
+ enum: ["urgent", "high", "medium", "low"]
2574
+ },
2575
+ status: {
2576
+ type: "string",
2577
+ description: "Initial status (defaults to todo)",
2578
+ enum: ["todo", "in_progress", "blocked", "done"]
2579
+ },
2580
+ linkedWorktreeId: {
2581
+ type: "string",
2582
+ description: "Worktree this task belongs to"
2583
+ },
2584
+ linkedBeliefId: {
2585
+ type: "string",
2586
+ description: "Belief this task supports"
2120
2587
  },
2121
2588
  linkedQuestionId: {
2122
2589
  type: "string",
2123
2590
  description: "Question this task addresses"
2124
2591
  },
2125
- linkedWorktreeId: { type: "string", description: "Worktree scope" }
2592
+ assigneeId: {
2593
+ type: "string",
2594
+ description: "Principal assigned to the task"
2595
+ },
2596
+ dueDate: {
2597
+ type: "number",
2598
+ description: "Due date as epoch milliseconds"
2599
+ },
2600
+ tags: {
2601
+ type: "array",
2602
+ description: "Free-form string tags"
2603
+ },
2604
+ metadata: {
2605
+ type: "object",
2606
+ description: "Structured task metadata for handoff context and routing hints"
2607
+ }
2126
2608
  },
2127
2609
  required: ["title"],
2128
2610
  response: {
@@ -2195,6 +2677,10 @@ var UPDATE_TASK = {
2195
2677
  type: "string",
2196
2678
  description: "Updated status",
2197
2679
  enum: ["todo", "in_progress", "blocked", "done"]
2680
+ },
2681
+ metadata: {
2682
+ type: "object",
2683
+ description: "Structured task metadata to replace or refine"
2198
2684
  }
2199
2685
  },
2200
2686
  required: ["taskId"],
@@ -2242,6 +2728,10 @@ var CREATE_TOPIC = {
2242
2728
  name: "create_topic",
2243
2729
  description: "Create a new topic container for scoping knowledge. Like `git init` \u2014 initializes a new repository for a knowledge domain. Topics are hierarchical: a deal topic can nest under a theme topic. Types: domain, theme, deal, strategy, constitution, project, portfolio.",
2244
2730
  parameters: {
2731
+ globalId: {
2732
+ type: "string",
2733
+ description: "Optional idempotent topic global ID"
2734
+ },
2245
2735
  name: { type: "string", description: "Topic name" },
2246
2736
  type: {
2247
2737
  type: "string",
@@ -2252,6 +2742,18 @@ var CREATE_TOPIC = {
2252
2742
  type: "string",
2253
2743
  description: "Optional parent topic for nesting"
2254
2744
  },
2745
+ parentTopicGlobalId: {
2746
+ type: "string",
2747
+ description: "Optional parent topic global ID for nesting"
2748
+ },
2749
+ tenantId: { type: "string", description: "Optional tenant scope" },
2750
+ workspaceId: { type: "string", description: "Optional workspace scope" },
2751
+ visibility: {
2752
+ type: "string",
2753
+ description: "Topic visibility",
2754
+ enum: ["private", "team", "firm", "external", "public"]
2755
+ },
2756
+ metadata: { type: "object", description: "Optional topic metadata" },
2255
2757
  createdBy: { type: "string", description: "Who created this topic" }
2256
2758
  },
2257
2759
  required: ["name", "type"],
@@ -2260,6 +2762,9 @@ var CREATE_TOPIC = {
2260
2762
  fields: {
2261
2763
  id: "string \u2014 topic ID",
2262
2764
  globalId: "string \u2014 globally unique ID",
2765
+ topicGlobalId: "string \u2014 topic global ID",
2766
+ epistemicNodeId: "string \u2014 materialized topic node ID",
2767
+ epistemicNodeGlobalId: "string \u2014 materialized topic node global ID",
2263
2768
  depth: "number \u2014 nesting depth"
2264
2769
  }
2265
2770
  },
@@ -2390,6 +2895,65 @@ var GET_TOPIC_TREE = {
2390
2895
  ontologyPrimitive: "graph",
2391
2896
  tier: "workhorse"
2392
2897
  };
2898
+ var MATERIALIZE_TOPIC_GRAPH = {
2899
+ name: "materialize_topic_graph",
2900
+ description: "Backfill the topic graph spine. Like `git fsck --connectivity-only` with repair enabled \u2014 creates missing topic nodes and parent-child edges idempotently.",
2901
+ parameters: {
2902
+ rootTopicId: {
2903
+ type: "string",
2904
+ description: "Optional root topic for a bounded materialization pass"
2905
+ },
2906
+ dryRun: {
2907
+ type: "boolean",
2908
+ description: "When true, report missing rows without writing them"
2909
+ }
2910
+ },
2911
+ required: [],
2912
+ response: {
2913
+ description: "Topic graph materialization counts",
2914
+ fields: {
2915
+ topicsSeen: "number",
2916
+ nodesCreated: "number",
2917
+ nodesExisting: "number",
2918
+ edgesCreated: "number",
2919
+ edgesExisting: "number",
2920
+ errors: "array"
2921
+ }
2922
+ },
2923
+ ownerModule: "reasoning-kernel",
2924
+ ontologyPrimitive: "graph",
2925
+ tier: "workhorse"
2926
+ };
2927
+ var GET_TOPIC_GRAPH_SPINE = {
2928
+ name: "get_topic_graph_spine",
2929
+ description: "Verify the topic graph spine. Like `git fsck` \u2014 reads topics, materialized topic nodes, parent-child edges, and missing spine rows.",
2930
+ parameters: {
2931
+ rootTopicId: {
2932
+ type: "string",
2933
+ description: "Optional root topic for a bounded verifier pass"
2934
+ },
2935
+ includeTopicBeliefEdges: {
2936
+ type: "boolean",
2937
+ description: "Include topic -> belief edges in the verifier payload"
2938
+ }
2939
+ },
2940
+ required: [],
2941
+ response: {
2942
+ description: "Topic graph spine verification payload",
2943
+ fields: {
2944
+ ok: "boolean",
2945
+ counts: "object",
2946
+ topics: "array",
2947
+ topicNodes: "array",
2948
+ parentEdges: "array",
2949
+ missingTopicNodes: "array",
2950
+ missingParentEdges: "array"
2951
+ }
2952
+ },
2953
+ ownerModule: "reasoning-kernel",
2954
+ ontologyPrimitive: "graph",
2955
+ tier: "workhorse"
2956
+ };
2393
2957
  var GET_CODE_CONTEXT = {
2394
2958
  name: "get_code_context",
2395
2959
  description: "Returns code-grounded beliefs, contracts, migration states, and failed attempts anchored to a specific file or function path. Like `git log -- <path>` \u2014 filters the knowledge graph to nodes anchored to a file path via metadata.codeAnchors. Results are separated by coding belief type: decisions, contracts, migrations, patterns, deprecations, and failures.",
@@ -3522,6 +4086,72 @@ var GENERATE_SESSION_HANDOFF = {
3522
4086
  tier: "showcase",
3523
4087
  internal: true
3524
4088
  };
4089
+ var BEGIN_BUILD_SESSION = {
4090
+ name: "begin_build_session",
4091
+ description: "Bootstrap a coding build session for a Lucern worktree. Like `git worktree add` plus `git status` \u2014 returns the compact context packet an agent needs before editing.",
4092
+ parameters: {
4093
+ worktreeId: {
4094
+ type: "string",
4095
+ description: "The Lucern worktree ID to bootstrap."
4096
+ },
4097
+ branch: {
4098
+ type: "string",
4099
+ description: "Optional git branch name. Auto-generated from the worktree name when omitted."
4100
+ },
4101
+ branchBase: {
4102
+ type: "string",
4103
+ description: 'Base branch for the feature branch. Default: "staging".'
4104
+ },
4105
+ prBase: {
4106
+ type: "string",
4107
+ description: 'Target branch for the PR. Default: "staging".'
4108
+ },
4109
+ sessionMode: {
4110
+ type: "string",
4111
+ description: 'Session mode: "async" for Codex/headless or "interactive" for live sessions.',
4112
+ enum: ["async", "interactive"]
4113
+ },
4114
+ activateIfPlanning: {
4115
+ type: "boolean",
4116
+ description: "When true, automatically activate a planning worktree during bootstrap."
4117
+ }
4118
+ },
4119
+ required: ["worktreeId"],
4120
+ response: {
4121
+ description: "A compact build-session packet with worktree metadata, graph anchors, questions, dependencies, and git defaults.",
4122
+ fields: {
4123
+ topicId: "string \u2014 canonical topic scope",
4124
+ topicName: "string \u2014 human-readable topic name",
4125
+ worktreeId: "string \u2014 worktree ID",
4126
+ worktreeName: "string \u2014 human-readable worktree name",
4127
+ branch: "string \u2014 git branch name",
4128
+ branchBase: "string \u2014 base branch",
4129
+ prBase: "string \u2014 PR target branch",
4130
+ campaign: "number | null \u2014 top-level pipeline campaign",
4131
+ lane: "string \u2014 campaign lane",
4132
+ gate: "string \u2014 exit gate",
4133
+ hypothesis: "string \u2014 worktree hypothesis",
4134
+ focus: "string \u2014 session focus",
4135
+ status: "string \u2014 worktree status after optional activation",
4136
+ sessionMode: "string \u2014 async | interactive",
4137
+ targetBeliefIds: "array \u2014 scoped belief IDs",
4138
+ targetQuestionIds: "array \u2014 scoped question IDs",
4139
+ taskIds: "array \u2014 assigned task IDs for this worktree",
4140
+ incompleteTaskIds: "array \u2014 assigned task IDs that still require done/deferred/blocked proof",
4141
+ tasks: "array \u2014 assigned task packet with id, title, status, priority, links, and summaries",
4142
+ topBeliefs: "array \u2014 highest-confidence scoped beliefs",
4143
+ openQuestions: "array \u2014 open scoped questions",
4144
+ resolvedDecisions: "array \u2014 answered questions summarized for the session",
4145
+ dependencies: "array \u2014 upstream worktrees",
4146
+ unblocks: "array \u2014 downstream worktrees",
4147
+ mergeOrderNotes: "string \u2014 merge ordering advisory"
4148
+ }
4149
+ },
4150
+ ownerModule: "bootstrap",
4151
+ ontologyPrimitive: "worktree",
4152
+ tier: "showcase",
4153
+ internal: true
4154
+ };
3525
4155
  var MCP_TOOL_CONTRACTS = {
3526
4156
  // Belief lifecycle (commit, amend, fork, archive)
3527
4157
  create_belief: CREATE_BELIEF,
@@ -3564,11 +4194,26 @@ var MCP_TOOL_CONTRACTS = {
3564
4194
  bisect_confidence: BISECT_CONFIDENCE,
3565
4195
  // Edges (commit)
3566
4196
  create_edge: CREATE_EDGE,
4197
+ update_edge: UPDATE_EDGE,
4198
+ remove_edge: REMOVE_EDGE,
4199
+ remove_edges_between: REMOVE_EDGES_BETWEEN,
4200
+ batch_create_edges: BATCH_CREATE_EDGES,
4201
+ // Epistemic node spine (commit/amend/show)
4202
+ create_epistemic_node: CREATE_EPISTEMIC_NODE,
4203
+ get_epistemic_node: GET_EPISTEMIC_NODE,
4204
+ list_epistemic_nodes: LIST_EPISTEMIC_NODES,
4205
+ update_epistemic_node: UPDATE_EPISTEMIC_NODE,
4206
+ archive_epistemic_node: ARCHIVE_EPISTEMIC_NODE,
4207
+ verify_epistemic_node: VERIFY_EPISTEMIC_NODE,
4208
+ supersede_epistemic_node: SUPERSEDE_EPISTEMIC_NODE,
4209
+ batch_create_epistemic_nodes: BATCH_CREATE_EPISTEMIC_NODES,
3567
4210
  // Judgments (tag)
3568
4211
  record_judgment: RECORD_JUDGMENT,
3569
4212
  // Graph intelligence (showcase)
3570
4213
  detect_confirmation_bias: DETECT_CONFIRMATION_BIAS,
3571
4214
  get_graph_structure_analysis: GET_GRAPH_STRUCTURE_ANALYSIS,
4215
+ list_graph_intelligence_queries: LIST_GRAPH_INTELLIGENCE_QUERIES,
4216
+ run_graph_intelligence_query: RUN_GRAPH_INTELLIGENCE_QUERY,
3572
4217
  get_falsification_questions: GET_FALSIFICATION_QUESTIONS,
3573
4218
  // Evidence operations (workhorse)
3574
4219
  search_evidence: SEARCH_EVIDENCE,
@@ -3615,6 +4260,7 @@ var MCP_TOOL_CONTRACTS = {
3615
4260
  get_agent_inbox: GET_AGENT_INBOX,
3616
4261
  claim_files: CLAIM_FILES,
3617
4262
  generate_session_handoff: GENERATE_SESSION_HANDOFF,
4263
+ begin_build_session: BEGIN_BUILD_SESSION,
3618
4264
  // Policy / ACL (workhorse)
3619
4265
  check_permission: CHECK_PERMISSION,
3620
4266
  filter_by_permission: FILTER_BY_PERMISSION,
@@ -3634,6 +4280,8 @@ var MCP_TOOL_CONTRACTS = {
3634
4280
  get_topic: GET_TOPIC,
3635
4281
  update_topic: UPDATE_TOPIC,
3636
4282
  get_topic_tree: GET_TOPIC_TREE,
4283
+ materialize_topic_graph: MATERIALIZE_TOPIC_GRAPH,
4284
+ get_topic_graph_spine: GET_TOPIC_GRAPH_SPINE,
3637
4285
  // Coding intelligence (code-grounded knowledge)
3638
4286
  get_code_context: GET_CODE_CONTEXT,
3639
4287
  get_change_history: GET_CHANGE_HISTORY,
@@ -3738,18 +4386,34 @@ var MCP_CORE_OPERATION_NAMES = [
3738
4386
  "find_missing_questions",
3739
4387
  "get_high_priority_questions",
3740
4388
  "get_falsification_questions",
4389
+ "create_epistemic_node",
4390
+ "get_epistemic_node",
4391
+ "list_epistemic_nodes",
4392
+ "update_epistemic_node",
4393
+ "archive_epistemic_node",
4394
+ "verify_epistemic_node",
4395
+ "supersede_epistemic_node",
4396
+ "batch_create_epistemic_nodes",
3741
4397
  "create_topic",
3742
4398
  "get_topic",
3743
4399
  "list_topics",
3744
4400
  "update_topic",
3745
- "get_topic_tree"
4401
+ "get_topic_tree",
4402
+ "materialize_topic_graph",
4403
+ "get_topic_graph_spine"
3746
4404
  ];
3747
4405
  var MCP_ANALYSIS_PLATFORM_OPERATION_NAMES = [
3748
4406
  "create_edge",
4407
+ "update_edge",
4408
+ "remove_edge",
4409
+ "remove_edges_between",
4410
+ "batch_create_edges",
3749
4411
  "query_lineage",
3750
4412
  "traverse_graph",
3751
4413
  "get_graph_neighborhood",
3752
4414
  "get_graph_structure_analysis",
4415
+ "list_graph_intelligence_queries",
4416
+ "run_graph_intelligence_query",
3753
4417
  "find_contradictions",
3754
4418
  "flag_contradiction",
3755
4419
  "detect_confirmation_bias",
@@ -3828,6 +4492,7 @@ var PLATFORM_INTERNAL_OPERATION_NAMES = [
3828
4492
  "get_change_history",
3829
4493
  "get_failure_log",
3830
4494
  "record_attempt",
4495
+ "begin_build_session",
3831
4496
  "push",
3832
4497
  "open_pull_request",
3833
4498
  "record_judgment",
@@ -3882,7 +4547,6 @@ var SDK_ONLY_OPERATION_NAMES = [
3882
4547
  "find_semantic_orphans"
3883
4548
  ];
3884
4549
  var MCP_ONLY_INTERNAL_OPERATION_NAMES = [
3885
- "begin_build_session",
3886
4550
  "evaluate_engineering_contract",
3887
4551
  "evaluate_research_contract"
3888
4552
  ];
@@ -3979,6 +4643,13 @@ var LUCERN_OPERATION_MANIFEST = {
3979
4643
  "Lucern MCP-only platform operation for local agent/bootstrap or verification workflows. Hidden from public discovery."
3980
4644
  )
3981
4645
  };
4646
+ z.enum(["decision", "belief", "question", "theme", "deal", "topic", "claim", "evidence", "synthesis", "answer", "atomic_fact", "excerpt", "source", "company", "person", "investor", "function", "value_chain"]);
4647
+ var EDGE_TYPE_VALUES = ["supports", "informs", "depends_on", "derived_from", "contains", "tests", "supersedes", "responds_to", "belongs_to", "relates_to_thesis", "works_at", "invested_in", "competes_with", "participates_in", "founded_by", "evaluates", "performs", "function_in", "impacts", "raised_from", "mentioned_in", "perspective_on", "plays_theme", "answers", "explores", "qualifies", "based_on", "based_on_belief", "based_on_question", "blocked_by_contradiction", "informed_by_theme", "same_as", "reinforces", "parent_of", "child_of", "falsified_by", "exclusive_with", "collapses_if", "cascade_from", "counterfactual_of", "cascade_to", "mutually_exclusive", "correlates_with", "amplifies", "precondition_for", "in_tension_with", "strengthened_by", "weakened_by", "alternative_to", "subsumes", "validated_by", "required_for", "blocks", "prerequisite_for", "parallel_to", "corroborates", "extends", "same_source_as", "same_theme_as", "assumes", "would_predict", "analogous_to", "independent_of", "implements", "violates", "co_changes_with", "migrating_from", "migrating_to", "scoped_by", "about_entity", "entity_referenced_in", "contradicts", "cites", "summarizes", "related_to", "partially_answers", "refines", "branches_from"];
4648
+ var STORAGE_EDGE_TYPE_VALUES = [...EDGE_TYPE_VALUES, "extracted_from"];
4649
+ z.enum(EDGE_TYPE_VALUES);
4650
+ z.enum(STORAGE_EDGE_TYPE_VALUES);
4651
+ z.enum(["active", "archived", "watching"]);
4652
+ z.enum(["private", "team", "firm", "external", "public"]);
3982
4653
 
3983
4654
  // src/function-registry/helpers.ts
3984
4655
  var jsonObjectSchema = z.record(z.unknown());
@@ -4075,12 +4746,20 @@ function unwrapMcpParameterSchema(schema) {
4075
4746
  current = current._def.schema;
4076
4747
  continue;
4077
4748
  default:
4078
- return { schema: current, required, description: description ?? current.description };
4749
+ return {
4750
+ schema: current,
4751
+ required,
4752
+ description: description ?? current.description
4753
+ };
4079
4754
  }
4080
4755
  }
4081
4756
  }
4082
4757
  function mcpParameterFromZod(fieldName, schema, contractName) {
4083
- const { schema: unwrapped, required, description: schemaDescription } = unwrapMcpParameterSchema(schema);
4758
+ const {
4759
+ schema: unwrapped,
4760
+ required,
4761
+ description: schemaDescription
4762
+ } = unwrapMcpParameterSchema(schema);
4084
4763
  const description = schemaDescription ?? unwrapped.description ?? fieldName;
4085
4764
  switch (unwrapped._def.typeName) {
4086
4765
  case z.ZodFirstPartyTypeKind.ZodString:
@@ -4125,10 +4804,12 @@ function mcpContractFromArgsSchema(base, args, contractName) {
4125
4804
  const entries2 = Object.entries(getObjectShape(args)).sort(
4126
4805
  ([left], [right]) => left.localeCompare(right)
4127
4806
  );
4128
- const converted = entries2.map(([fieldName, schema]) => [
4129
- fieldName,
4130
- mcpParameterFromZod(fieldName, schema, contractName)
4131
- ]);
4807
+ const converted = entries2.map(
4808
+ ([fieldName, schema]) => [
4809
+ fieldName,
4810
+ mcpParameterFromZod(fieldName, schema, contractName)
4811
+ ]
4812
+ );
4132
4813
  return {
4133
4814
  ...base,
4134
4815
  parameters: Object.fromEntries(
@@ -4137,9 +4818,7 @@ function mcpContractFromArgsSchema(base, args, contractName) {
4137
4818
  required: converted.filter(([, field]) => field.required).map(([fieldName]) => fieldName)
4138
4819
  };
4139
4820
  }
4140
- function defineFunctionContract(contract) {
4141
- return contract;
4142
- }
4821
+ var defineFunctionContract = (contract) => contract;
4143
4822
  function authUserId(context) {
4144
4823
  return context.userId ?? context.principalId ?? "lucern-agent";
4145
4824
  }
@@ -4239,6 +4918,7 @@ function surfaceContract(args) {
4239
4918
  allowedPrincipalTypes: ["user", "service", "agent"]
4240
4919
  },
4241
4920
  convex: args.convex,
4921
+ gateway: args.gateway,
4242
4922
  args: canonicalArgs,
4243
4923
  returns: canonicalReturns,
4244
4924
  input,
@@ -4249,8 +4929,81 @@ function surfaceContract(args) {
4249
4929
  }
4250
4930
  });
4251
4931
  }
4252
-
4253
- // src/function-registry/worktrees.ts
4932
+ var autoFixPolicyInputSchema = z.object({
4933
+ enabled: z.boolean().optional().describe("Whether automatic remediation is enabled."),
4934
+ mode: z.string().optional().describe("Automation mode for worktree auto-fixes."),
4935
+ maxAttempts: z.number().optional().describe("Maximum number of auto-fix attempts."),
4936
+ reviewer: z.string().optional().describe("Reviewer responsible for auto-fix oversight."),
4937
+ maxActionsPerRun: z.number().optional().describe("Maximum number of auto-fix actions per run."),
4938
+ permittedMutationTiers: z.array(z.enum(["read_only", "low_risk_write", "high_risk_write"])).optional().describe("Mutation tiers the auto-fix worker may execute."),
4939
+ requireAuditTrail: z.boolean().optional().describe("Whether auto-fix actions must write an audit trail."),
4940
+ escalationGate: z.string().optional().describe("Gate to trigger when auto-fix policy requires escalation.")
4941
+ }).passthrough().describe("Policy for permitted automatic remediation inside the worktree.");
4942
+ var worktreeKeyQuestionInputSchema = z.object({
4943
+ question: z.string().describe("Question the worktree must resolve."),
4944
+ status: z.enum(["open", "answered", "forked"]).optional().describe("Current disposition of the key question."),
4945
+ answer: z.string().optional().describe("Captured answer when the key question is resolved."),
4946
+ answerConfidence: z.enum(["high", "medium", "low"]).optional().describe("Confidence in the captured answer."),
4947
+ linkedQuestionId: z.string().optional().describe("Canonical question node linked to this key question.")
4948
+ }).passthrough().describe("Question contract embedded in the worktree plan.");
4949
+ var worktreeEvidenceSignalInputSchema = z.object({
4950
+ signal: z.string().describe("Evidence signal the worktree should collect."),
4951
+ collected: z.boolean().optional().describe("Whether the signal has already been collected."),
4952
+ progress: z.string().optional().describe("Collection progress note for the signal."),
4953
+ notes: z.string().optional().describe("Additional evidence collection notes.")
4954
+ }).passthrough().describe("Evidence signal embedded in the worktree plan.");
4955
+ var worktreeDecisionGateInputSchema = z.object({
4956
+ goCriteria: z.array(z.string()).describe("Criteria that must hold for the worktree to proceed."),
4957
+ noGoSignals: z.array(z.string()).describe("Signals that stop or redirect the worktree."),
4958
+ verdict: z.enum(["go", "no_go", "pivot", "pending"]).optional().describe("Current decision verdict for the worktree gate."),
4959
+ verdictRationale: z.string().optional().describe("Rationale supporting the current gate verdict."),
4960
+ decidedAt: z.number().optional().describe("Timestamp when the gate verdict was decided."),
4961
+ decidedBy: z.string().optional().describe("Actor that decided the gate verdict.")
4962
+ }).passthrough().describe("Decision gate contract for worktree activation or exit.");
4963
+ var addWorktreeArgs = z.object({
4964
+ title: z.string().describe("Human-readable worktree name or objective."),
4965
+ name: z.string().optional().describe("Storage-name alias for callers that already use backend naming."),
4966
+ topicId: z.string().optional().describe("Optional primary topic scope hint for resolver validation."),
4967
+ projectId: z.string().optional().describe("Legacy topicId alias/hint."),
4968
+ topicHint: z.string().optional().describe("Natural-language topic hint for automatic topic resolution."),
4969
+ branchId: z.string().optional().describe("Legacy branch identifier for compatibility with workflow callers."),
4970
+ objective: z.string().optional().describe("Reasoning objective this worktree is intended to resolve."),
4971
+ hypothesis: z.string().optional().describe("Testable claim this worktree investigates."),
4972
+ rationale: z.string().optional().describe("Why this worktree exists and why it belongs in the campaign."),
4973
+ worktreeType: z.string().optional().describe("Schema-enum worktree type used for kernel lifecycle behavior."),
4974
+ gate: z.string().optional().describe("Exit gate for this worktree."),
4975
+ startDate: z.number().optional().describe("Planned start timestamp in milliseconds since epoch."),
4976
+ endDate: z.number().optional().describe("Planned end timestamp in milliseconds since epoch."),
4977
+ durationWeeks: z.number().optional().describe("Planned duration in weeks."),
4978
+ confidenceImpact: z.enum(["high", "medium", "low"]).optional().describe("Expected confidence impact if this worktree succeeds."),
4979
+ beliefFocus: z.string().optional().describe("Natural-language focus spanning the target belief neighborhood."),
4980
+ beliefIds: z.array(z.string()).optional().describe("Legacy alias for targetBeliefIds."),
4981
+ beliefs: z.array(z.string()).optional().describe("Legacy alias for targetBeliefIds."),
4982
+ targetBeliefIds: z.array(z.string()).optional().describe("Belief node IDs this worktree is expected to test or update."),
4983
+ targetQuestionIds: z.array(z.string()).optional().describe("Question node IDs this worktree is expected to answer."),
4984
+ keyQuestions: z.array(worktreeKeyQuestionInputSchema).optional().describe("Inline key questions captured as part of the worktree plan."),
4985
+ evidenceSignals: z.array(worktreeEvidenceSignalInputSchema).optional().describe("Evidence signals the worktree needs to collect or validate."),
4986
+ decisionGate: worktreeDecisionGateInputSchema.optional(),
4987
+ goCriteria: z.array(z.string()).optional().describe("Shorthand go criteria used to build decisionGate."),
4988
+ noGoSignals: z.array(z.string()).optional().describe("Shorthand no-go signals used to build decisionGate."),
4989
+ proofArtifacts: z.array(z.unknown()).optional().describe("Expected proof artifacts required to close the worktree."),
4990
+ autoShape: z.boolean().optional().describe("Whether to invoke inquiry auto-shaping during creation."),
4991
+ autoFixPolicy: autoFixPolicyInputSchema.optional(),
4992
+ domainPackId: z.string().optional().describe("Domain pack whose shaping hooks should influence the worktree."),
4993
+ tags: z.array(z.string()).optional().describe("Additional topic-resolution tags for the worktree."),
4994
+ touchedPaths: z.array(z.string()).optional().describe("File paths used as topic-resolution signals."),
4995
+ sourceRef: z.string().optional().describe("Source reference used as a topic-resolution signal."),
4996
+ sourceKind: z.string().optional().describe("Source kind used as a topic-resolution signal."),
4997
+ campaign: z.number().optional().describe("Top-level pipeline campaign number."),
4998
+ lane: z.string().optional().describe("Campaign lane for the worktree."),
4999
+ laneOrderInCampaign: z.number().optional().describe("Ordering for this lane within its campaign."),
5000
+ orderInLane: z.number().optional().describe("Position of this worktree inside its lane."),
5001
+ dependsOn: z.array(z.string()).optional().describe("Worktree IDs that must complete before this worktree."),
5002
+ blocks: z.array(z.string()).optional().describe("Worktree IDs blocked by this worktree."),
5003
+ staffingHint: z.string().optional().describe("Suggested staffing or agent allocation note."),
5004
+ lensId: z.string().optional().describe("Lens that scopes this worktree when applicable."),
5005
+ lastReconciledAt: z.number().optional().describe("Timestamp when worktree metadata was last reconciled.")
5006
+ });
4254
5007
  var worktreeIdInput = (input) => compactRecord({
4255
5008
  worktreeId: input.worktreeId ?? input.id
4256
5009
  });
@@ -4283,6 +5036,50 @@ var worktreeMetadataInput = (input) => compactRecord({
4283
5036
  autoFixPolicy: input.autoFixPolicy,
4284
5037
  lastReconciledAt: input.lastReconciledAt
4285
5038
  });
5039
+ var worktreeMetadataArgs = z.object({
5040
+ worktreeId: z.string().describe("The worktree to update."),
5041
+ id: z.string().optional().describe("Worktree ID alias."),
5042
+ topicId: z.string().optional().describe("Primary topic scope."),
5043
+ additionalTopicIds: z.array(z.string()).optional().describe("Additional topic scopes associated with this worktree."),
5044
+ status: z.string().optional().describe("Worktree lifecycle status."),
5045
+ campaign: z.number().optional().describe("Top-level pipeline campaign."),
5046
+ lane: z.string().optional().describe("Campaign lane."),
5047
+ laneOrderInCampaign: z.number().optional().describe("Ordering for this lane within its campaign."),
5048
+ orderInLane: z.number().optional().describe("Position of this worktree inside its lane."),
5049
+ gate: z.string().optional().describe("Exit gate for this worktree."),
5050
+ hypothesis: z.string().optional().describe("Testable claim this worktree investigates."),
5051
+ objective: z.string().optional().describe("Reasoning objective for the worktree."),
5052
+ rationale: z.string().optional().describe("Why this worktree is sequenced here."),
5053
+ proofArtifacts: z.array(z.unknown()).optional().describe("Proof artifacts required to close the worktree."),
5054
+ staffingHint: z.string().optional().describe("Suggested staffing or agent allocation note."),
5055
+ blocks: z.array(z.string()).optional().describe("Worktree IDs blocked by this worktree."),
5056
+ dependsOn: z.array(z.string()).optional().describe("Worktree IDs this worktree depends on."),
5057
+ lensId: z.string().optional().describe("Lens that scopes this worktree."),
5058
+ autoFixPolicy: autoFixPolicyInputSchema.optional(),
5059
+ lastReconciledAt: z.number().optional().describe("Timestamp of the last deterministic reconciliation pass.")
5060
+ });
5061
+ var pushArgs = worktreeMetadataArgs.extend({
5062
+ targetContext: z.string().describe("Where to push merged findings."),
5063
+ beliefIds: z.array(z.string()).optional().describe("Optional subset of beliefs to push.")
5064
+ });
5065
+ var openPullRequestArgs = worktreeMetadataArgs.extend({
5066
+ reviewers: z.array(z.string()).optional().describe("User IDs of requested reviewers."),
5067
+ summary: z.string().describe("Summary of findings and why they are ready for review.")
5068
+ });
5069
+ var mergeKeyFindingsInput = (input) => {
5070
+ if (Array.isArray(input.keyFindings)) {
5071
+ return input.keyFindings;
5072
+ }
5073
+ if (Array.isArray(input.outcomes)) {
5074
+ const findings = input.outcomes.filter(
5075
+ (outcome) => typeof outcome === "string" && outcome.trim().length > 0
5076
+ );
5077
+ if (findings.length > 0) {
5078
+ return findings;
5079
+ }
5080
+ }
5081
+ return [input.summary ?? "Merged worktree"];
5082
+ };
4286
5083
  var listAllWorktreesInput = (input) => compactRecord({
4287
5084
  status: input.status,
4288
5085
  lane: input.lane,
@@ -4290,6 +5087,16 @@ var listAllWorktreesInput = (input) => compactRecord({
4290
5087
  limit: input.limit
4291
5088
  });
4292
5089
  var worktreesContracts = [
5090
+ surfaceContract({
5091
+ name: "begin_build_session",
5092
+ kind: "mutation",
5093
+ domain: "worktrees",
5094
+ surfaceClass: "platform_internal",
5095
+ path: "/mcp/build-session/begin",
5096
+ sdkNamespace: "worktrees",
5097
+ sdkMethod: "beginBuildSession",
5098
+ summary: "Begin a coding build session for a worktree."
5099
+ }),
4293
5100
  surfaceContract({
4294
5101
  name: "add_worktree",
4295
5102
  kind: "mutation",
@@ -4306,13 +5113,12 @@ var worktreesContracts = [
4306
5113
  inputProjection: (input, context) => withCreatedBy(
4307
5114
  compactRecord({
4308
5115
  name: input.name ?? input.title,
4309
- topicId: input.topicId,
5116
+ topicId: input.topicId ?? input.projectId,
4310
5117
  worktreeType: input.worktreeType,
4311
5118
  objective: input.objective,
4312
5119
  gate: input.gate,
4313
5120
  hypothesis: input.hypothesis,
4314
5121
  rationale: input.rationale,
4315
- signal: input.signal,
4316
5122
  startDate: input.startDate,
4317
5123
  endDate: input.endDate,
4318
5124
  durationWeeks: input.durationWeeks,
@@ -4338,12 +5144,12 @@ var worktreesContracts = [
4338
5144
  staffingHint: input.staffingHint,
4339
5145
  domainPackId: input.domainPackId,
4340
5146
  lensId: input.lensId,
4341
- linkedQuestionId: input.linkedQuestionId,
4342
5147
  lastReconciledAt: input.lastReconciledAt
4343
5148
  }),
4344
5149
  context
4345
5150
  )
4346
- }
5151
+ },
5152
+ args: addWorktreeArgs
4347
5153
  }),
4348
5154
  surfaceContract({
4349
5155
  name: "activate_worktree",
@@ -4455,7 +5261,8 @@ var worktreesContracts = [
4455
5261
  functionName: "updateMetadata",
4456
5262
  kind: "mutation",
4457
5263
  inputProjection: worktreeMetadataInput
4458
- }
5264
+ },
5265
+ args: worktreeMetadataArgs
4459
5266
  }),
4460
5267
  surfaceContract({
4461
5268
  name: "merge",
@@ -4473,9 +5280,7 @@ var worktreesContracts = [
4473
5280
  inputProjection: (input, context) => withUserId(
4474
5281
  {
4475
5282
  ...worktreeIdInput(input),
4476
- keyFindings: input.keyFindings ?? [
4477
- input.summary ?? "Merged worktree"
4478
- ],
5283
+ keyFindings: mergeKeyFindingsInput(input),
4479
5284
  decisionsReached: input.decisionsReached ?? [],
4480
5285
  nextSteps: input.nextSteps ?? []
4481
5286
  },
@@ -4497,7 +5302,8 @@ var worktreesContracts = [
4497
5302
  functionName: "updateMetadata",
4498
5303
  kind: "mutation",
4499
5304
  inputProjection: worktreeMetadataInput
4500
- }
5305
+ },
5306
+ args: pushArgs
4501
5307
  }),
4502
5308
  surfaceContract({
4503
5309
  name: "open_pull_request",
@@ -4513,7 +5319,8 @@ var worktreesContracts = [
4513
5319
  functionName: "updateMetadata",
4514
5320
  kind: "mutation",
4515
5321
  inputProjection: worktreeMetadataInput
4516
- }
5322
+ },
5323
+ args: openPullRequestArgs
4517
5324
  })
4518
5325
  ];
4519
5326