@lucern/contracts 0.3.0-alpha.0 → 0.3.0-alpha.10

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 (237) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/dist/component-boundary.contract.d.ts +14 -0
  3. package/dist/component-boundary.contract.js +155 -0
  4. package/dist/component-boundary.contract.js.map +1 -0
  5. package/dist/component-host-boundary.contract.d.ts +41 -0
  6. package/dist/component-host-boundary.contract.js +54 -0
  7. package/dist/component-host-boundary.contract.js.map +1 -0
  8. package/dist/context-pack.contract.d.ts +5 -3
  9. package/dist/context-pack.contract.js.map +1 -1
  10. package/dist/{dsl-BgpoVOVQ.d.ts → dsl-djCRfuWC.d.ts} +1 -1
  11. package/dist/dsl.d.ts +1 -1
  12. package/dist/dsl.js +4 -4
  13. package/dist/dsl.js.map +1 -1
  14. package/dist/edge-policy-manifest-Dw5IhT1L.d.ts +133 -0
  15. package/dist/function-registry/beliefs.d.ts +42 -82
  16. package/dist/function-registry/beliefs.js +1154 -125
  17. package/dist/function-registry/beliefs.js.map +1 -1
  18. package/dist/function-registry/coding.d.ts +7 -31
  19. package/dist/function-registry/coding.js +958 -112
  20. package/dist/function-registry/coding.js.map +1 -1
  21. package/dist/function-registry/context.d.ts +14 -26
  22. package/dist/function-registry/context.js +923 -97
  23. package/dist/function-registry/context.js.map +1 -1
  24. package/dist/function-registry/contracts.d.ts +4 -16
  25. package/dist/function-registry/contracts.js +860 -82
  26. package/dist/function-registry/contracts.js.map +1 -1
  27. package/dist/function-registry/coordination.d.ts +10 -46
  28. package/dist/function-registry/coordination.js +872 -84
  29. package/dist/function-registry/coordination.js.map +1 -1
  30. package/dist/function-registry/edges.d.ts +166 -18
  31. package/dist/function-registry/edges.js +1188 -97
  32. package/dist/function-registry/edges.js.map +1 -1
  33. package/dist/function-registry/evidence.d.ts +42 -74
  34. package/dist/function-registry/evidence.js +1106 -130
  35. package/dist/function-registry/evidence.js.map +1 -1
  36. package/dist/function-registry/graph.d.ts +132 -106
  37. package/dist/function-registry/graph.js +1006 -100
  38. package/dist/function-registry/graph.js.map +1 -1
  39. package/dist/function-registry/helpers.d.ts +8 -10
  40. package/dist/function-registry/helpers.js +869 -83
  41. package/dist/function-registry/helpers.js.map +1 -1
  42. package/dist/function-registry/identity.d.ts +4 -16
  43. package/dist/function-registry/identity.js +860 -82
  44. package/dist/function-registry/identity.js.map +1 -1
  45. package/dist/function-registry/index.d.ts +322 -8
  46. package/dist/function-registry/index.js +1249 -87
  47. package/dist/function-registry/index.js.map +1 -1
  48. package/dist/function-registry/judgments.d.ts +12 -20
  49. package/dist/function-registry/judgments.js +891 -94
  50. package/dist/function-registry/judgments.js.map +1 -1
  51. package/dist/function-registry/legacy.d.ts +2 -6
  52. package/dist/function-registry/legacy.js +860 -82
  53. package/dist/function-registry/legacy.js.map +1 -1
  54. package/dist/function-registry/lenses.d.ts +18 -34
  55. package/dist/function-registry/lenses.js +928 -88
  56. package/dist/function-registry/lenses.js.map +1 -1
  57. package/dist/function-registry/manifest.d.ts +7 -7
  58. package/dist/function-registry/manifest.js +19 -2
  59. package/dist/function-registry/manifest.js.map +1 -1
  60. package/dist/function-registry/ontologies.d.ts +46 -90
  61. package/dist/function-registry/ontologies.js +908 -109
  62. package/dist/function-registry/ontologies.js.map +1 -1
  63. package/dist/function-registry/pipeline.d.ts +14 -26
  64. package/dist/function-registry/pipeline.js +880 -85
  65. package/dist/function-registry/pipeline.js.map +1 -1
  66. package/dist/function-registry/questions.d.ts +50 -98
  67. package/dist/function-registry/questions.js +1043 -118
  68. package/dist/function-registry/questions.js.map +1 -1
  69. package/dist/function-registry/tasks.d.ts +18 -34
  70. package/dist/function-registry/tasks.js +973 -87
  71. package/dist/function-registry/tasks.js.map +1 -1
  72. package/dist/function-registry/topics.d.ts +100 -42
  73. package/dist/function-registry/topics.js +961 -89
  74. package/dist/function-registry/topics.js.map +1 -1
  75. package/dist/function-registry/types.d.ts +2 -2
  76. package/dist/function-registry/worktrees.d.ts +116 -74
  77. package/dist/function-registry/worktrees.js +1124 -115
  78. package/dist/function-registry/worktrees.js.map +1 -1
  79. package/dist/function-registry-input-audit.d.ts +13 -0
  80. package/dist/function-registry-input-audit.js +166 -0
  81. package/dist/function-registry-input-audit.js.map +1 -0
  82. package/dist/gateway.contract.d.ts +2 -0
  83. package/dist/gateway.contract.js.map +1 -1
  84. package/dist/generated/convexSchemas.js +8 -6
  85. package/dist/generated/convexSchemas.js.map +1 -1
  86. package/dist/generated/schema-manifest.json +103 -5
  87. package/dist/generated/tableOwnership.d.ts +4 -2
  88. package/dist/generated/tableOwnership.js +4 -0
  89. package/dist/generated/tableOwnership.js.map +1 -1
  90. package/dist/generated/tier-expectations.json +9 -4
  91. package/dist/graph-intelligence.contract.d.ts +506 -0
  92. package/dist/graph-intelligence.contract.js +595 -0
  93. package/dist/graph-intelligence.contract.js.map +1 -0
  94. package/dist/graph-types/index.d.ts +5 -1
  95. package/dist/graph-types/index.js +15 -4
  96. package/dist/graph-types/index.js.map +1 -1
  97. package/dist/index-O09U2xHk.d.ts +28 -0
  98. package/dist/index.d.ts +25 -4
  99. package/dist/index.js +3989 -236
  100. package/dist/index.js.map +1 -1
  101. package/dist/infisical-runtime.contract.d.ts +174 -0
  102. package/dist/infisical-runtime.contract.js +317 -0
  103. package/dist/infisical-runtime.contract.js.map +1 -0
  104. package/dist/lens-filter.contract.js +4 -3
  105. package/dist/lens-filter.contract.js.map +1 -1
  106. package/dist/lens-workflow.contract.js +4 -3
  107. package/dist/lens-workflow.contract.js.map +1 -1
  108. package/dist/manifests/edge-policy-manifest.d.ts +2 -0
  109. package/dist/manifests/edge-policy-manifest.data.d.ts +13 -0
  110. package/dist/manifests/edge-policy-manifest.data.js +26 -0
  111. package/dist/manifests/edge-policy-manifest.data.js.map +1 -0
  112. package/dist/manifests/edge-policy-manifest.js +92 -0
  113. package/dist/manifests/edge-policy-manifest.js.map +1 -0
  114. package/dist/manifests/infisical-runtime-manifest.d.ts +151 -0
  115. package/dist/manifests/infisical-runtime-manifest.js +316 -0
  116. package/dist/manifests/infisical-runtime-manifest.js.map +1 -0
  117. package/dist/manifests/invariant-manifest.d.ts +65 -0
  118. package/dist/manifests/invariant-manifest.js +18 -0
  119. package/dist/manifests/invariant-manifest.js.map +1 -0
  120. package/dist/manifests/invariants/ast-utils.d.ts +14 -0
  121. package/dist/manifests/invariants/ast-utils.js +54 -0
  122. package/dist/manifests/invariants/ast-utils.js.map +1 -0
  123. package/dist/manifests/invariants/index.d.ts +15 -0
  124. package/dist/manifests/invariants/index.js +183 -0
  125. package/dist/manifests/invariants/index.js.map +1 -0
  126. package/dist/manifests/invariants/inv-1-beliefs-append-only.d.ts +12 -0
  127. package/dist/manifests/invariants/inv-1-beliefs-append-only.js +94 -0
  128. package/dist/manifests/invariants/inv-1-beliefs-append-only.js.map +1 -0
  129. package/dist/manifests/invariants/inv-14-no-silent-transitions.d.ts +12 -0
  130. package/dist/manifests/invariants/inv-14-no-silent-transitions.js +99 -0
  131. package/dist/manifests/invariants/inv-14-no-silent-transitions.js.map +1 -0
  132. package/dist/manifests/invariants/manifest-1-projections-declare-audit.d.ts +12 -0
  133. package/dist/manifests/invariants/manifest-1-projections-declare-audit.js +42 -0
  134. package/dist/manifests/invariants/manifest-1-projections-declare-audit.js.map +1 -0
  135. package/dist/manifests/tenant-client-manifest.d.ts +322 -0
  136. package/dist/manifests/tenant-client-manifest.js +432 -0
  137. package/dist/manifests/tenant-client-manifest.js.map +1 -0
  138. package/dist/mcp-gateway-boundary.contract.d.ts +181 -0
  139. package/dist/mcp-gateway-boundary.contract.js +43 -0
  140. package/dist/mcp-gateway-boundary.contract.js.map +1 -0
  141. package/dist/projections/check-convex-args-shape.d.ts +3 -0
  142. package/dist/projections/check-convex-args-shape.js +399 -0
  143. package/dist/projections/check-convex-args-shape.js.map +1 -0
  144. package/dist/projections/create-evidence.projection.d.ts +176 -0
  145. package/dist/projections/create-evidence.projection.js +131 -0
  146. package/dist/projections/create-evidence.projection.js.map +1 -0
  147. package/dist/projections/index.d.ts +102 -0
  148. package/dist/projections/index.js +348 -0
  149. package/dist/projections/index.js.map +1 -0
  150. package/dist/projections/list-beliefs.projection.d.ts +36 -0
  151. package/dist/projections/list-beliefs.projection.js +54 -0
  152. package/dist/projections/list-beliefs.projection.js.map +1 -0
  153. package/dist/projections/list-tasks.projection.d.ts +32 -0
  154. package/dist/projections/list-tasks.projection.js +52 -0
  155. package/dist/projections/list-tasks.projection.js.map +1 -0
  156. package/dist/projections/modulate-confidence.projection.d.ts +219 -0
  157. package/dist/projections/modulate-confidence.projection.js +148 -0
  158. package/dist/projections/modulate-confidence.projection.js.map +1 -0
  159. package/dist/projections/projection-dsl.d.ts +11 -0
  160. package/dist/projections/projection-dsl.js +8 -0
  161. package/dist/projections/projection-dsl.js.map +1 -0
  162. package/dist/schema-helpers/enumValidation.js +2 -5
  163. package/dist/schema-helpers/enumValidation.js.map +1 -1
  164. package/dist/schema-helpers/spine/nodes/decision.js +2 -1
  165. package/dist/schema-helpers/spine/nodes/decision.js.map +1 -1
  166. package/dist/schema-helpers/spine/tables/epistemicNodes.js +27 -27
  167. package/dist/schema-helpers/spine/tables/epistemicNodes.js.map +1 -1
  168. package/dist/schema-helpers/validators.d.ts +1 -1
  169. package/dist/schema-helpers/validators.js +1 -1
  170. package/dist/schema-helpers/validators.js.map +1 -1
  171. package/dist/schemas/component-table-manifest.d.ts +74 -0
  172. package/dist/schemas/component-table-manifest.js +26 -0
  173. package/dist/schemas/component-table-manifest.js.map +1 -0
  174. package/dist/schemas/enums.d.ts +5 -2
  175. package/dist/schemas/enums.js +5 -2
  176. package/dist/schemas/enums.js.map +1 -1
  177. package/dist/schemas/index.d.ts +3 -1
  178. package/dist/schemas/index.js +112 -13
  179. package/dist/schemas/index.js.map +1 -1
  180. package/dist/schemas/manifest.d.ts +1154 -949
  181. package/dist/schemas/manifest.js +80 -12
  182. package/dist/schemas/manifest.js.map +1 -1
  183. package/dist/schemas/sl-opinion.d.ts +31 -0
  184. package/dist/schemas/sl-opinion.js +19 -0
  185. package/dist/schemas/sl-opinion.js.map +1 -0
  186. package/dist/schemas/tables/identity/platform.d.ts +10 -10
  187. package/dist/schemas/tables/kernel/epistemic.d.ts +12 -10
  188. package/dist/schemas/tables/kernel/epistemic.js +6 -4
  189. package/dist/schemas/tables/kernel/epistemic.js.map +1 -1
  190. package/dist/schemas/tables/kernel/infra.d.ts +17 -5
  191. package/dist/schemas/tables/kernel/infra.js +23 -1
  192. package/dist/schemas/tables/kernel/infra.js.map +1 -1
  193. package/dist/schemas/tables/kernel/intelligence.d.ts +10 -10
  194. package/dist/schemas/tables/kernel/lens.d.ts +4 -4
  195. package/dist/schemas/tables/kernel/platform.d.ts +12 -12
  196. package/dist/schemas/tables/kernel/spine.d.ts +3 -3
  197. package/dist/schemas/tables/kernel/spine.js +5 -2
  198. package/dist/schemas/tables/kernel/spine.js.map +1 -1
  199. package/dist/schemas/tables/kernel/task.d.ts +42 -42
  200. package/dist/schemas/tables/kernel/topic.js +5 -1
  201. package/dist/schemas/tables/kernel/topic.js.map +1 -1
  202. package/dist/schemas/tables/kernel/worktree.d.ts +62 -62
  203. package/dist/schemas/tables/kernel/worktree.js +6 -4
  204. package/dist/schemas/tables/kernel/worktree.js.map +1 -1
  205. package/dist/schemas/tables/mc/identity.d.ts +26 -3
  206. package/dist/schemas/tables/mc/identity.js +35 -1
  207. package/dist/schemas/tables/mc/identity.js.map +1 -1
  208. package/dist/schemas/tables/mc/pack.d.ts +20 -20
  209. package/dist/schemas/tables/mc/registry.d.ts +4 -4
  210. package/dist/schemas/tables/mc/runtime.d.ts +1 -1
  211. package/dist/schemas/tables/mc/runtime.js +1 -1
  212. package/dist/schemas/tables/mc/runtime.js.map +1 -1
  213. package/dist/schemas/tables/mc/workspace.d.ts +9 -3
  214. package/dist/schemas/tables/mc/workspace.js +3 -1
  215. package/dist/schemas/tables/mc/workspace.js.map +1 -1
  216. package/dist/sdk-methods.contract.d.ts +7 -4
  217. package/dist/{sdk-tools.contract-C2kQN_Xk.d.ts → sdk-tools.contract-BNklQDfB.d.ts} +2 -2
  218. package/dist/sdk-tools.contract.d.ts +2 -2
  219. package/dist/sdk-tools.contract.js +800 -74
  220. package/dist/sdk-tools.contract.js.map +1 -1
  221. package/dist/tenant-bootstrap-seed.contract.d.ts +1101 -0
  222. package/dist/tenant-bootstrap-seed.contract.js +653 -0
  223. package/dist/tenant-bootstrap-seed.contract.js.map +1 -0
  224. package/dist/tenant-bootstrap-seed.defaults.d.ts +16 -0
  225. package/dist/tenant-bootstrap-seed.defaults.js +303 -0
  226. package/dist/tenant-bootstrap-seed.defaults.js.map +1 -0
  227. package/dist/tenant-client.contract.d.ts +349 -0
  228. package/dist/tenant-client.contract.js +488 -0
  229. package/dist/tenant-client.contract.js.map +1 -0
  230. package/dist/{tool-contracts-WCnuE9DW.d.ts → tool-contracts-BevD9Ho2.d.ts} +39 -3
  231. package/dist/tool-contracts.d.ts +1 -1
  232. package/dist/tool-contracts.js +801 -75
  233. package/dist/tool-contracts.js.map +1 -1
  234. package/dist/workflow-runtime.contract.js +1 -1
  235. package/dist/workflow-runtime.contract.js.map +1 -1
  236. package/package.json +27 -1
  237. package/dist/index-DoDXl8KS.d.ts +0 -19
@@ -14,7 +14,7 @@ var LENS_PERSPECTIVE_TYPES = [
14
14
  // src/tool-contracts.ts
15
15
  var CREATE_BELIEF = {
16
16
  name: "create_belief",
17
- description: "Commit a new belief (knowledge unit) to the reasoning graph. Like `git commit` \u2014 creates an atomic, traceable knowledge object with a mandatory prior. Creation stores the vacuous opinion `(0, 0, 1, a)`; use modulate_confidence to record the first evidential update.",
17
+ description: "Commit a new belief (knowledge unit) to the reasoning graph. Like `git commit` \u2014 creates an atomic, traceable knowledge object with a prior. Creation stores the vacuous opinion `(0, 0, 1, a)`; use modulate_confidence to record the first evidential update.",
18
18
  parameters: {
19
19
  canonicalText: {
20
20
  type: "string",
@@ -26,7 +26,7 @@ var CREATE_BELIEF = {
26
26
  },
27
27
  baseRate: {
28
28
  type: "number",
29
- description: "Required prior probability used to seed the vacuous opinion `(0, 0, 1, a)` at creation time."
29
+ description: "Prior probability used to seed the vacuous opinion `(0, 0, 1, a)` at creation time. Defaults to 0.5 when omitted."
30
30
  },
31
31
  beliefType: {
32
32
  type: "string",
@@ -37,7 +37,7 @@ var CREATE_BELIEF = {
37
37
  description: "Optional extra metadata merged into the node (e.g., { codeAnchors: ['path/to/file.ts'] } for coding intelligence)"
38
38
  }
39
39
  },
40
- required: ["canonicalText", "baseRate"],
40
+ required: ["canonicalText"],
41
41
  response: {
42
42
  description: "The created canonical belief record",
43
43
  fields: {
@@ -100,7 +100,7 @@ var REFINE_BELIEF = {
100
100
  };
101
101
  var MODULATE_CONFIDENCE = {
102
102
  name: "modulate_confidence",
103
- description: "Record a confidence change for a belief. Like `git commit` to the credence log \u2014 an atomic, append-only write. Each modulation is a new entry in the history, not an overwrite. Scoring happens via merge; this tool records the individual data points. Pass the full subjective-logic tuple (`belief`, `disbelief`, `uncertainty`, `baseRate`) directly. If a caller only has a scalar probability, use `@lucern/sdk` helpers `opinionFromBaseRate`, `opinionFromDogmatic`, or `opinionFromProjected` to name the intended interpretation before calling this tool. Triggers: evidence_added, evidence_removed, contradiction_detected, contradiction_resolved, agent_assessment, worktree_outcome, worktree_completed, fusion, discount, deduction, manual, decay.",
103
+ description: "Record a confidence change for a belief. Like `git commit` to the credence log \u2014 an atomic, append-only write. Each modulation is a new entry in the history, not an overwrite. Scoring happens via merge; this tool records the individual data points. Pass the full subjective-logic tuple (`belief`, `disbelief`, `uncertainty`, `baseRate`) directly. If a caller only has a scalar probability, use `@lucern/sdk` helpers `opinionFromBaseRate`, `opinionFromDogmatic`, or `opinionFromProjected` to name the intended interpretation before calling this tool. Every modulation must cite a truth-bearing artifact: triggeringEvidenceId, triggeringQuestionId, triggeringAnswerId, triggeringContradictionId, or triggeringWorktreeId. Triggers: evidence_added, evidence_removed, contradiction_detected, contradiction_resolved, agent_assessment, worktree_outcome, worktree_completed, fusion, discount, deduction.",
104
104
  parameters: {
105
105
  nodeId: { type: "string", description: "The belief to score" },
106
106
  belief: {
@@ -119,9 +119,9 @@ var MODULATE_CONFIDENCE = {
119
119
  type: "number",
120
120
  description: "Subjective-logic base rate `a` in [0, 1]. Required for tuple payloads."
121
121
  },
122
- confidence: {
123
- type: "number",
124
- description: "Deprecated scalar confidence value in [0, 1]. Scalar-only payloads are rejected as AMBIGUOUS_SCALAR."
122
+ worktreeId: {
123
+ type: "string",
124
+ description: "Completed worktree that tested this belief when confidence policy requires merge-backed scoring."
125
125
  },
126
126
  trigger: {
127
127
  type: "string",
@@ -136,17 +136,43 @@ var MODULATE_CONFIDENCE = {
136
136
  "worktree_completed",
137
137
  "fusion",
138
138
  "discount",
139
- "deduction",
140
- "manual",
141
- "decay"
139
+ "deduction"
142
140
  ]
143
141
  },
142
+ triggeringEvidenceId: {
143
+ type: "string",
144
+ description: "Evidence node that caused an evidence-triggered modulation"
145
+ },
146
+ triggeringQuestionId: {
147
+ type: "string",
148
+ description: "Answered question whose resolution supports this modulation"
149
+ },
150
+ triggeringAnswerId: {
151
+ type: "string",
152
+ description: "Answer node whose content supports this modulation"
153
+ },
154
+ triggeringContradictionId: {
155
+ type: "string",
156
+ description: "Contradiction record that caused a contradiction-triggered modulation"
157
+ },
158
+ triggeringWorktreeId: {
159
+ type: "string",
160
+ description: "Completed worktree whose outcome caused a worktree-triggered modulation"
161
+ },
144
162
  rationale: {
145
163
  type: "string",
146
164
  description: "Human-readable explanation of why confidence changed"
147
165
  }
148
166
  },
149
- required: ["nodeId", "trigger", "rationale"],
167
+ required: [
168
+ "nodeId",
169
+ "belief",
170
+ "disbelief",
171
+ "uncertainty",
172
+ "baseRate",
173
+ "trigger",
174
+ "rationale"
175
+ ],
150
176
  response: {
151
177
  description: "Confidence modulation result",
152
178
  fields: {
@@ -340,7 +366,7 @@ var ADD_EVIDENCE = {
340
366
  description: "Optional extra metadata merged into the node (e.g., { codeAnchors: ['path/to/file.ts'], failedApproach: true } for coding intelligence)"
341
367
  }
342
368
  },
343
- required: ["canonicalText", "targetNodeId"],
369
+ required: ["canonicalText", "targetNodeId", "reasoning"],
344
370
  response: {
345
371
  description: "The created evidence node and its edge",
346
372
  fields: {
@@ -396,7 +422,22 @@ var ADD_WORKTREE = {
396
422
  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.",
397
423
  parameters: {
398
424
  title: { type: "string", description: "Worktree name/objective" },
399
- topicId: { type: "string", description: "Optional topic scope hint" },
425
+ name: {
426
+ type: "string",
427
+ description: "Optional storage-name alias for callers that already use backend naming"
428
+ },
429
+ projectId: {
430
+ type: "string",
431
+ description: "Legacy topicId alias or resolver hint"
432
+ },
433
+ topicId: {
434
+ type: "string",
435
+ description: "Optional topic scope hint for resolver validation"
436
+ },
437
+ topicHint: {
438
+ type: "string",
439
+ description: "Natural-language topic hint for automatic topic resolution"
440
+ },
400
441
  branchId: {
401
442
  type: "string",
402
443
  description: "The branch this worktree investigates"
@@ -409,21 +450,122 @@ var ADD_WORKTREE = {
409
450
  type: "string",
410
451
  description: "The testable claim this worktree investigates"
411
452
  },
453
+ rationale: {
454
+ type: "string",
455
+ description: "Why this worktree exists and why it belongs in the campaign"
456
+ },
457
+ worktreeType: {
458
+ type: "string",
459
+ description: "Schema-enum worktree type used by the kernel lifecycle and retrieval layers"
460
+ },
461
+ gate: {
462
+ type: "string",
463
+ description: "Exit gate name for this worktree"
464
+ },
465
+ startDate: {
466
+ type: "number",
467
+ description: "Planned start timestamp in milliseconds since epoch"
468
+ },
469
+ endDate: {
470
+ type: "number",
471
+ description: "Planned end timestamp in milliseconds since epoch"
472
+ },
473
+ durationWeeks: {
474
+ type: "number",
475
+ description: "Planned duration in weeks"
476
+ },
477
+ confidenceImpact: {
478
+ type: "string",
479
+ description: "Expected confidence impact if the worktree succeeds",
480
+ enum: ["high", "medium", "low"]
481
+ },
482
+ beliefFocus: {
483
+ type: "string",
484
+ description: "Natural-language focus spanning the target belief neighborhood"
485
+ },
412
486
  beliefIds: {
413
487
  type: "array",
414
- description: "Beliefs to test in this worktree"
488
+ description: "Legacy alias for targetBeliefIds"
489
+ },
490
+ beliefs: {
491
+ type: "array",
492
+ description: "Legacy alias for targetBeliefIds"
493
+ },
494
+ targetBeliefIds: {
495
+ type: "array",
496
+ description: "Belief node IDs this worktree is expected to test or update"
497
+ },
498
+ targetQuestionIds: {
499
+ type: "array",
500
+ description: "Question node IDs this worktree is expected to answer"
501
+ },
502
+ keyQuestions: {
503
+ type: "array",
504
+ description: "Inline key question objects with question, optional status, answer, answerConfidence, and linkedQuestionId"
505
+ },
506
+ evidenceSignals: {
507
+ type: "array",
508
+ description: "Evidence signal objects with signal, optional collected state, progress, and notes"
509
+ },
510
+ decisionGate: {
511
+ type: "object",
512
+ description: "Decision gate object with goCriteria, noGoSignals, optional verdict, rationale, decidedAt, and decidedBy"
513
+ },
514
+ goCriteria: {
515
+ type: "array",
516
+ description: "Shorthand go criteria used to build decisionGate"
517
+ },
518
+ noGoSignals: {
519
+ type: "array",
520
+ description: "Shorthand no-go signals used to build decisionGate"
521
+ },
522
+ proofArtifacts: {
523
+ type: "array",
524
+ description: "Expected proof artifacts required to close the worktree"
415
525
  },
416
526
  autoShape: {
417
527
  type: "boolean",
418
528
  description: "Whether to invoke inquiry auto-shaping during worktree creation"
419
529
  },
530
+ autoFixPolicy: {
531
+ type: "object",
532
+ description: "Policy for permitted automatic remediation inside the worktree"
533
+ },
420
534
  domainPackId: {
421
535
  type: "string",
422
536
  description: "Optional domain pack whose shaping hooks should influence generated questions and tasks"
423
537
  },
424
- executionOrder: {
538
+ tags: {
539
+ type: "array",
540
+ description: "Additional topic-resolution tags for the worktree"
541
+ },
542
+ touchedPaths: {
543
+ type: "array",
544
+ description: "File paths used as topic-resolution signals"
545
+ },
546
+ sourceRef: {
547
+ type: "string",
548
+ description: "Source reference used as a topic-resolution signal"
549
+ },
550
+ sourceKind: {
551
+ type: "string",
552
+ description: "Source kind used as a topic-resolution signal"
553
+ },
554
+ campaign: {
555
+ type: "number",
556
+ description: "Top-level pipeline campaign number. Campaigns define the outer execution slice."
557
+ },
558
+ lane: {
559
+ type: "string",
560
+ description: "GitButler-aligned workstream lane name inside the campaign."
561
+ },
562
+ laneOrderInCampaign: {
425
563
  type: "number",
426
- description: "Global execution order for this worktree"
564
+ description: "Ordering for this lane within its campaign."
565
+ },
566
+ orderInLane: {
567
+ type: "number",
568
+ description: "Position of this worktree inside its lane."
427
569
  },
428
570
  dependsOn: {
429
571
  type: "array",
@@ -433,12 +575,20 @@ var ADD_WORKTREE = {
433
575
  type: "array",
434
576
  description: "Worktree IDs blocked by this worktree"
435
577
  },
436
- gate: {
578
+ staffingHint: {
437
579
  type: "string",
438
- description: "Exit gate name for this worktree"
580
+ description: "Suggested staffing or agent allocation note"
581
+ },
582
+ lensId: {
583
+ type: "string",
584
+ description: "Lens that scopes this worktree when applicable"
585
+ },
586
+ lastReconciledAt: {
587
+ type: "number",
588
+ description: "Timestamp when worktree metadata was last reconciled"
439
589
  }
440
590
  },
441
- required: ["title", "topicId"],
591
+ required: ["title"],
442
592
  response: {
443
593
  description: "The created worktree",
444
594
  fields: {
@@ -465,7 +615,7 @@ var MERGE = {
465
615
  worktreeId: { type: "string", description: "The worktree to merge" },
466
616
  outcomes: {
467
617
  type: "array",
468
- description: "Scoring outcomes for each belief: { beliefId, confidence, rationale }"
618
+ description: "Merge outcomes as key-finding strings, or scoring outcomes for beliefs: { beliefId, confidence, rationale }"
469
619
  },
470
620
  summary: { type: "string", description: "Overall findings summary" }
471
621
  },
@@ -683,19 +833,23 @@ var FIND_CONTRADICTIONS = {
683
833
  };
684
834
  var CREATE_EDGE = {
685
835
  name: "create_edge",
686
- 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).",
836
+ 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.",
687
837
  parameters: {
688
- sourceId: {
689
- type: "string",
690
- description: "Source node of the relationship"
838
+ from: {
839
+ type: "object",
840
+ description: "Source graph ref, e.g. { kind: 'epistemic_node', nodeId: '...', nodeType: 'topic' }"
691
841
  },
692
- targetId: {
693
- type: "string",
694
- description: "Target node of the relationship"
842
+ to: {
843
+ type: "object",
844
+ description: "Target graph ref, e.g. { kind: 'epistemic_node', nodeId: '...', nodeType: 'belief' }"
695
845
  },
696
846
  edgeType: {
697
847
  type: "string",
698
- description: "Relationship type (informs, tests, depends_on, supersedes, etc.)"
848
+ description: "Relationship type from the public epistemic edge enum."
849
+ },
850
+ globalId: {
851
+ type: "string",
852
+ description: "Optional idempotent edge global ID."
699
853
  },
700
854
  weight: {
701
855
  type: "number",
@@ -706,9 +860,13 @@ var CREATE_EDGE = {
706
860
  type: "string",
707
861
  description: "How this was determined",
708
862
  enum: ["deductive", "inductive", "abductive", "analogical", "empirical"]
863
+ },
864
+ metadata: {
865
+ type: "object",
866
+ description: "Optional edge metadata."
709
867
  }
710
868
  },
711
- required: ["sourceId", "targetId", "edgeType"],
869
+ required: ["from", "to", "edgeType"],
712
870
  response: {
713
871
  description: "The created edge",
714
872
  fields: {
@@ -722,6 +880,240 @@ var CREATE_EDGE = {
722
880
  ontologyPrimitive: "edge",
723
881
  tier: "showcase"
724
882
  };
883
+ var UPDATE_EDGE = {
884
+ name: "update_edge",
885
+ description: "Amend metadata on an existing graph edge. Like `git commit --amend` \u2014 changes the edge annotation without recreating the relationship.",
886
+ parameters: {
887
+ edgeId: { type: "string", description: "Edge ID or global ID to update" },
888
+ weight: { type: "number", description: "Updated edge weight" },
889
+ confidence: { type: "number", description: "Updated confidence" },
890
+ context: { type: "string", description: "Updated human-readable context" },
891
+ derivationType: { type: "string", description: "Updated derivation type" },
892
+ metadata: { type: "object", description: "Updated metadata" }
893
+ },
894
+ required: ["edgeId"],
895
+ response: {
896
+ description: "Edge update result",
897
+ fields: { success: "boolean" }
898
+ },
899
+ ownerModule: "graph-primitives",
900
+ ontologyPrimitive: "edge",
901
+ tier: "workhorse"
902
+ };
903
+ var REMOVE_EDGE = {
904
+ name: "remove_edge",
905
+ description: "Remove one graph edge by ID. Like `git rm` \u2014 deletes a single explicit relationship from the spine.",
906
+ parameters: {
907
+ edgeId: { type: "string", description: "Edge ID or global ID to remove" }
908
+ },
909
+ required: ["edgeId"],
910
+ response: {
911
+ description: "Edge removal result",
912
+ fields: { success: "boolean" }
913
+ },
914
+ ownerModule: "graph-primitives",
915
+ ontologyPrimitive: "edge",
916
+ tier: "workhorse"
917
+ };
918
+ var REMOVE_EDGES_BETWEEN = {
919
+ name: "remove_edges_between",
920
+ description: "Remove graph edges between two nodes. Like `git rm <pathspec>` \u2014 deletes relationships matching a source, target, and optional type.",
921
+ parameters: {
922
+ fromNodeId: { type: "string", description: "Source node ID or global ID" },
923
+ toNodeId: { type: "string", description: "Target node ID or global ID" },
924
+ edgeType: { type: "string", description: "Optional edge type filter" }
925
+ },
926
+ required: ["fromNodeId", "toNodeId"],
927
+ response: {
928
+ description: "Matched edge removal result",
929
+ fields: { deleted: "number" }
930
+ },
931
+ ownerModule: "graph-primitives",
932
+ ontologyPrimitive: "edge",
933
+ tier: "workhorse"
934
+ };
935
+ var BATCH_CREATE_EDGES = {
936
+ name: "batch_create_edges",
937
+ description: "Commit multiple typed graph edges. Like `git commit` with many staged paths \u2014 writes a batch of explicit relationships atomically per edge.",
938
+ parameters: {
939
+ edges: {
940
+ type: "array",
941
+ description: "Edges to create, each with from, to, edgeType, and optional weight/confidence/context."
942
+ },
943
+ skipLayerValidation: {
944
+ type: "boolean",
945
+ description: "Skip kernel layer validation for trusted materialization flows."
946
+ }
947
+ },
948
+ required: ["edges"],
949
+ response: {
950
+ description: "Batch edge creation result",
951
+ fields: {
952
+ created: "number",
953
+ results: "array",
954
+ errors: "array"
955
+ }
956
+ },
957
+ ownerModule: "graph-primitives",
958
+ ontologyPrimitive: "edge",
959
+ tier: "workhorse"
960
+ };
961
+ var CREATE_EPISTEMIC_NODE = {
962
+ name: "create_epistemic_node",
963
+ 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.",
964
+ parameters: {
965
+ globalId: { type: "string", description: "Optional idempotent node global ID" },
966
+ nodeType: { type: "string", description: "Public epistemic node type" },
967
+ canonicalText: { type: "string", description: "Canonical node text" },
968
+ text: { type: "string", description: "Alias for canonicalText" },
969
+ contentHash: { type: "string", description: "Optional idempotency content hash" },
970
+ sourceType: { type: "string", description: "Source type for provenance" },
971
+ topicId: { type: "string", description: "Optional topic scope" },
972
+ content: { type: "string", description: "Extended content" },
973
+ title: { type: "string", description: "Display title" },
974
+ metadata: { type: "object", description: "Optional node metadata" }
975
+ },
976
+ required: ["nodeType"],
977
+ response: {
978
+ description: "Created node result",
979
+ fields: {
980
+ nodeId: "string",
981
+ nodeGlobalId: "string",
982
+ isDuplicate: "boolean"
983
+ }
984
+ },
985
+ ownerModule: "reasoning-kernel",
986
+ ontologyPrimitive: "graph",
987
+ tier: "showcase"
988
+ };
989
+ var GET_EPISTEMIC_NODE = {
990
+ name: "get_epistemic_node",
991
+ description: "Read one epistemic graph node. Like `git show` \u2014 resolves a canonical spine node by ID or global ID.",
992
+ parameters: {
993
+ nodeId: { type: "string", description: "Node ID or global ID" }
994
+ },
995
+ required: ["nodeId"],
996
+ response: {
997
+ description: "The resolved node",
998
+ fields: { node: "object" }
999
+ },
1000
+ ownerModule: "reasoning-kernel",
1001
+ ontologyPrimitive: "graph",
1002
+ tier: "workhorse"
1003
+ };
1004
+ var LIST_EPISTEMIC_NODES = {
1005
+ name: "list_epistemic_nodes",
1006
+ description: "List epistemic graph nodes. Like `git ls-tree` \u2014 lists canonical spine nodes by topic, type, status, or search query.",
1007
+ parameters: {
1008
+ topicId: { type: "string", description: "Optional topic scope" },
1009
+ nodeType: { type: "string", description: "Optional node type filter" },
1010
+ status: { type: "string", description: "Optional lifecycle status" },
1011
+ searchQuery: { type: "string", description: "Optional text search query" },
1012
+ limit: { type: "number", description: "Maximum nodes to return" }
1013
+ },
1014
+ required: [],
1015
+ response: {
1016
+ description: "Matching nodes",
1017
+ fields: { nodes: "array" }
1018
+ },
1019
+ ownerModule: "reasoning-kernel",
1020
+ ontologyPrimitive: "graph",
1021
+ tier: "workhorse"
1022
+ };
1023
+ var UPDATE_EPISTEMIC_NODE = {
1024
+ name: "update_epistemic_node",
1025
+ description: "Amend an epistemic graph node. Like `git commit --amend` \u2014 updates mutable node metadata, text, status, or verification fields.",
1026
+ parameters: {
1027
+ nodeId: { type: "string", description: "Node ID or global ID" },
1028
+ canonicalText: { type: "string", description: "Updated canonical text" },
1029
+ text: { type: "string", description: "Alias for canonicalText" },
1030
+ contentHash: { type: "string", description: "Updated content hash" },
1031
+ content: { type: "string", description: "Updated content" },
1032
+ title: { type: "string", description: "Updated display title" },
1033
+ metadata: { type: "object", description: "Updated metadata" },
1034
+ confidence: { type: "number", description: "Updated confidence" },
1035
+ verificationStatus: { type: "string", description: "Updated verification status" },
1036
+ status: { type: "string", description: "Updated lifecycle status" }
1037
+ },
1038
+ required: ["nodeId"],
1039
+ response: {
1040
+ description: "Node update result",
1041
+ fields: { success: "boolean" }
1042
+ },
1043
+ ownerModule: "reasoning-kernel",
1044
+ ontologyPrimitive: "graph",
1045
+ tier: "workhorse"
1046
+ };
1047
+ var ARCHIVE_EPISTEMIC_NODE = {
1048
+ name: "archive_epistemic_node",
1049
+ description: "Archive an epistemic graph node. Like `git rm --cached` \u2014 removes a node from active traversal without hard-deleting it.",
1050
+ parameters: {
1051
+ nodeId: { type: "string", description: "Node ID or global ID" }
1052
+ },
1053
+ required: ["nodeId"],
1054
+ response: {
1055
+ description: "Archive result",
1056
+ fields: { success: "boolean", effectiveStatus: "string" }
1057
+ },
1058
+ ownerModule: "reasoning-kernel",
1059
+ ontologyPrimitive: "graph",
1060
+ tier: "workhorse"
1061
+ };
1062
+ var VERIFY_EPISTEMIC_NODE = {
1063
+ name: "verify_epistemic_node",
1064
+ description: "Record verification state on an epistemic graph node. Like `git tag` \u2014 marks the node with a reviewed verification state.",
1065
+ parameters: {
1066
+ nodeId: { type: "string", description: "Node ID or global ID" },
1067
+ verificationStatus: { type: "string", description: "Verification status" },
1068
+ confidence: { type: "number", description: "Optional confidence update" }
1069
+ },
1070
+ required: ["nodeId", "verificationStatus"],
1071
+ response: {
1072
+ description: "Verification result",
1073
+ fields: { success: "boolean" }
1074
+ },
1075
+ ownerModule: "reasoning-kernel",
1076
+ ontologyPrimitive: "graph",
1077
+ tier: "workhorse"
1078
+ };
1079
+ var SUPERSEDE_EPISTEMIC_NODE = {
1080
+ name: "supersede_epistemic_node",
1081
+ 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.",
1082
+ parameters: {
1083
+ oldNodeId: { type: "string", description: "Node ID or global ID to supersede" },
1084
+ newGlobalId: { type: "string", description: "Optional replacement global ID" },
1085
+ newCanonicalText: { type: "string", description: "Replacement canonical text" },
1086
+ text: { type: "string", description: "Alias for newCanonicalText" },
1087
+ newContentHash: { type: "string", description: "Optional replacement content hash" },
1088
+ reason: { type: "string", description: "Reason for superseding" }
1089
+ },
1090
+ required: ["oldNodeId"],
1091
+ response: {
1092
+ description: "Supersede result",
1093
+ fields: { oldNodeId: "string", newNodeId: "string" }
1094
+ },
1095
+ ownerModule: "reasoning-kernel",
1096
+ ontologyPrimitive: "graph",
1097
+ tier: "workhorse"
1098
+ };
1099
+ var BATCH_CREATE_EPISTEMIC_NODES = {
1100
+ name: "batch_create_epistemic_nodes",
1101
+ description: "Commit multiple epistemic graph nodes. Like `git commit` with many staged files \u2014 writes a batch of canonical spine nodes.",
1102
+ parameters: {
1103
+ nodes: {
1104
+ type: "array",
1105
+ description: "Nodes to create with nodeType, canonicalText/text, and optional metadata."
1106
+ }
1107
+ },
1108
+ required: ["nodes"],
1109
+ response: {
1110
+ description: "Batch node creation result",
1111
+ fields: { created: "number", results: "array" }
1112
+ },
1113
+ ownerModule: "reasoning-kernel",
1114
+ ontologyPrimitive: "graph",
1115
+ tier: "workhorse"
1116
+ };
725
1117
  var RECORD_JUDGMENT = {
726
1118
  name: "record_judgment",
727
1119
  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).",
@@ -1019,6 +1411,74 @@ var GET_GRAPH_STRUCTURE_ANALYSIS = {
1019
1411
  ontologyPrimitive: "graph",
1020
1412
  tier: "showcase"
1021
1413
  };
1414
+ var LIST_GRAPH_INTELLIGENCE_QUERIES = {
1415
+ name: "list_graph_intelligence_queries",
1416
+ 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.",
1417
+ parameters: {
1418
+ categoryId: {
1419
+ type: "string",
1420
+ description: "Optional category filter, such as problems or strategic"
1421
+ },
1422
+ mode: {
1423
+ type: "string",
1424
+ description: "Optional mode filter: core, bias, stress, operational, alpha, semantic, or evidence"
1425
+ }
1426
+ },
1427
+ required: [],
1428
+ response: {
1429
+ description: "Graph Intelligence query catalog and mode-to-tool mapping",
1430
+ fields: {
1431
+ categories: "array \u2014 query categories",
1432
+ queries: "array \u2014 query definitions with prompt templates and tools",
1433
+ quickQueries: "array \u2014 recommended one-click query presets",
1434
+ publicToolNamesByMode: "object \u2014 public tool names available to each Graph Intelligence mode"
1435
+ }
1436
+ },
1437
+ ownerModule: "graph-intelligence",
1438
+ ontologyPrimitive: "graph",
1439
+ tier: "showcase"
1440
+ };
1441
+ var RUN_GRAPH_INTELLIGENCE_QUERY = {
1442
+ name: "run_graph_intelligence_query",
1443
+ 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.",
1444
+ parameters: {
1445
+ topicId: { type: "string", description: "Topic to analyze" },
1446
+ queryId: {
1447
+ type: "string",
1448
+ description: "Graph Intelligence query ID, such as confirmation-bias, pre-mortem, or thesis-summary"
1449
+ },
1450
+ prompt: {
1451
+ type: "string",
1452
+ description: "Optional custom prompt for custom analysis runs"
1453
+ },
1454
+ input: {
1455
+ type: "string",
1456
+ description: "Optional entity, theme, belief, company, or search text for input-driven queries"
1457
+ },
1458
+ mode: {
1459
+ type: "string",
1460
+ description: "Optional mode override: core, bias, stress, operational, alpha, semantic, or evidence"
1461
+ },
1462
+ limit: {
1463
+ type: "number",
1464
+ description: "Maximum graph context rows to return"
1465
+ }
1466
+ },
1467
+ required: ["topicId"],
1468
+ response: {
1469
+ description: "Graph Intelligence query result bundle ready for model or prompt-library synthesis",
1470
+ fields: {
1471
+ query: "object \u2014 selected query definition",
1472
+ prompt: "string \u2014 resolved prompt template",
1473
+ toolPlan: "array \u2014 public tools and args the model can call next",
1474
+ analysis: "object \u2014 structure, coverage, gap, and confirmation-bias analysis",
1475
+ context: "object \u2014 sampled beliefs, questions, evidence, edges, and contradictions"
1476
+ }
1477
+ },
1478
+ ownerModule: "graph-intelligence",
1479
+ ontologyPrimitive: "graph",
1480
+ tier: "showcase"
1481
+ };
1022
1482
  var GET_FALSIFICATION_QUESTIONS = {
1023
1483
  name: "get_falsification_questions",
1024
1484
  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.",
@@ -1081,6 +1541,10 @@ var CREATE_EVIDENCE = {
1081
1541
  type: "object",
1082
1542
  description: "Optional metadata merged into the canonical evidence node"
1083
1543
  },
1544
+ rationale: {
1545
+ type: "string",
1546
+ description: "Why this evidence should enter the reasoning graph"
1547
+ },
1084
1548
  title: { type: "string", description: "Optional short title" },
1085
1549
  content: { type: "string", description: "Optional long-form content" },
1086
1550
  contentType: {
@@ -1089,7 +1553,7 @@ var CREATE_EVIDENCE = {
1089
1553
  },
1090
1554
  kind: { type: "string", description: "Optional evidence kind" }
1091
1555
  },
1092
- required: ["text"],
1556
+ required: ["text", "rationale"],
1093
1557
  response: {
1094
1558
  description: "The created canonical evidence record",
1095
1559
  fields: {
@@ -1137,7 +1601,7 @@ var LIST_EVIDENCE = {
1137
1601
  limit: { type: "number", description: "Max results" },
1138
1602
  cursor: { type: "string", description: "Pagination cursor" }
1139
1603
  },
1140
- required: [],
1604
+ required: ["topicId"],
1141
1605
  response: {
1142
1606
  description: "Canonical evidence page",
1143
1607
  fields: {
@@ -1322,6 +1786,7 @@ var ANSWER_QUESTION = {
1322
1786
  description: "Answer a question with optional evidence links. Like `git commit` on the question thread \u2014 records the answer and closes the loop with a canonical answered state.",
1323
1787
  parameters: {
1324
1788
  id: { type: "string", description: "Canonical question ID" },
1789
+ topicId: { type: "string", description: "Topic scope for the answer" },
1325
1790
  text: { type: "string", description: "Answer text" },
1326
1791
  confidence: {
1327
1792
  type: "string",
@@ -1334,7 +1799,7 @@ var ANSWER_QUESTION = {
1334
1799
  },
1335
1800
  rationale: { type: "string", description: "Why this answer is credible" }
1336
1801
  },
1337
- required: ["id", "text"],
1802
+ required: ["id", "topicId", "text"],
1338
1803
  response: {
1339
1804
  description: "Answer result",
1340
1805
  fields: {
@@ -1553,6 +2018,10 @@ var LIST_BELIEFS = {
1553
2018
  minConfidence: {
1554
2019
  type: "number",
1555
2020
  description: "Minimum confidence threshold"
2021
+ },
2022
+ limit: {
2023
+ type: "number",
2024
+ description: "Maximum results"
1556
2025
  }
1557
2026
  },
1558
2027
  required: ["topicId"],
@@ -1569,20 +2038,37 @@ var LIST_BELIEFS = {
1569
2038
  };
1570
2039
  var LIST_WORKTREES = {
1571
2040
  name: "list_worktrees",
1572
- description: "List all worktrees for a topic. Like `git worktree list` \u2014 shows active and completed investigation branches with their phase, status, and belief counts.",
2041
+ description: "List all worktrees for a topic. Like `git worktree list` \u2014 shows active and completed investigation branches with lifecycle phase, pipeline campaign/lane, status, and belief counts.",
1573
2042
  parameters: {
1574
2043
  topicId: { type: "string", description: "Topic scope" },
1575
2044
  status: {
1576
2045
  type: "string",
1577
2046
  description: "Filter: active, merged, abandoned",
1578
2047
  enum: ["active", "merged", "abandoned"]
2048
+ },
2049
+ groupBy: {
2050
+ type: "string",
2051
+ description: "Optional grouping mode for the response.",
2052
+ enum: ["campaign", "lane", "flat"]
2053
+ },
2054
+ lane: {
2055
+ type: "string",
2056
+ description: "Filter by GitButler-aligned lane name."
2057
+ },
2058
+ campaign: {
2059
+ type: "number",
2060
+ description: "Filter by top-level pipeline campaign number."
2061
+ },
2062
+ limit: {
2063
+ type: "number",
2064
+ description: "Maximum results to return."
1579
2065
  }
1580
2066
  },
1581
2067
  required: ["topicId"],
1582
2068
  response: {
1583
- description: "Worktrees with phase, status, belief count, and creation time",
2069
+ description: "Worktrees with lifecycle phase, campaign, lane, status, belief count, and creation time",
1584
2070
  fields: {
1585
- worktrees: "array \u2014 { worktreeId, title, phase, status, beliefCount, createdAt }"
2071
+ worktrees: "array \u2014 { worktreeId, title, phase, campaign, lane, laneOrderInCampaign, orderInLane, status, beliefCount, createdAt }"
1586
2072
  }
1587
2073
  },
1588
2074
  ownerModule: "workflow-engine",
@@ -1591,7 +2077,7 @@ var LIST_WORKTREES = {
1591
2077
  };
1592
2078
  var LIST_ALL_WORKTREES = {
1593
2079
  name: "list_all_worktrees",
1594
- description: "List ALL worktrees across ALL topics in one query. No topic scope required. Like `git worktree list --all` \u2014 returns the complete pipeline inventory with track, trackPosition, executionBand, dependencies, and status. Supports filtering by status, track, and executionBand. This is the PM's primary pipeline query \u2014 one call, full picture.",
2080
+ description: "List ALL worktrees across ALL topics in one query. No topic scope required. Like `git worktree list --all` \u2014 returns the complete pipeline inventory with campaign, lane, lane order, dependencies, and status. Supports filtering by status, lane, and campaign. This is the PM's primary pipeline query \u2014 one call, full picture.",
1595
2081
  parameters: {
1596
2082
  status: {
1597
2083
  type: "string",
@@ -1609,13 +2095,18 @@ var LIST_ALL_WORKTREES = {
1609
2095
  "dismissed"
1610
2096
  ]
1611
2097
  },
1612
- track: {
2098
+ lane: {
1613
2099
  type: "string",
1614
- description: "Filter by track name (e.g., 'ontology', 'tc-scope', 'control-plane', 'dev-portal', 'mcp-sdk-parity')"
2100
+ description: "Filter by lane name (e.g., 'ontology', 'tc-scope', 'control-plane', 'dev-portal', 'mcp-sdk-parity')"
1615
2101
  },
1616
- executionBand: {
2102
+ campaign: {
1617
2103
  type: "number",
1618
- description: "Filter by execution band number (e.g., 1, 2, 3). Returns only worktrees in that parallel execution group."
2104
+ description: "Filter by campaign number (e.g., 1, 2, 3). Returns only worktrees in that campaign."
2105
+ },
2106
+ groupBy: {
2107
+ type: "string",
2108
+ description: "Optional grouping mode for the response.",
2109
+ enum: ["campaign", "lane", "flat"]
1619
2110
  },
1620
2111
  limit: {
1621
2112
  type: "number",
@@ -1626,10 +2117,39 @@ var LIST_ALL_WORKTREES = {
1626
2117
  response: {
1627
2118
  description: "All worktrees across all topics with full pipeline metadata",
1628
2119
  fields: {
1629
- worktrees: "array \u2014 { worktreeId, title, topicId, topicName, phase, status, hypothesis, track, trackPosition, executionBand, executionOrder, dependsOn, blocks, gate, createdAt }",
2120
+ worktrees: "array \u2014 { worktreeId, title, topicId, topicName, phase, status, hypothesis, campaign, lane, laneOrderInCampaign, orderInLane, dependsOn, blocks, gate, createdAt }",
1630
2121
  total: "number \u2014 total count after filtering",
1631
- tracks: "object \u2014 { trackName: count } summary of worktrees per track",
1632
- bands: "object \u2014 { bandNumber: count } summary of worktrees per execution band"
2122
+ lanes: "object \u2014 { laneName: count } summary of worktrees per lane",
2123
+ campaigns: "object \u2014 { campaignNumber: count } summary of worktrees per campaign"
2124
+ }
2125
+ },
2126
+ ownerModule: "workflow-engine",
2127
+ ontologyPrimitive: "worktree",
2128
+ tier: "showcase"
2129
+ };
2130
+ var LIST_CAMPAIGNS = {
2131
+ name: "list_campaigns",
2132
+ description: "List compact pipeline campaigns with their nested lanes. Use this to see the top-level campaign > lane > worktree shape without pulling the full worktree inventory.",
2133
+ parameters: {
2134
+ topicId: {
2135
+ type: "string",
2136
+ description: "Optional topic scope."
2137
+ },
2138
+ status: {
2139
+ type: "string",
2140
+ description: "Optional worktree status filter before grouping campaigns and lanes."
2141
+ },
2142
+ limit: {
2143
+ type: "number",
2144
+ description: "Maximum worktrees to scan before grouping."
2145
+ }
2146
+ },
2147
+ required: [],
2148
+ response: {
2149
+ description: "Pipeline campaigns with nested lane summaries.",
2150
+ fields: {
2151
+ campaigns: "array \u2014 { campaign, lanes: [{ lane, laneOrderInCampaign, worktreeCount, activeCount, readyCount, blockedCount, completedCount, nextWorktree }] }",
2152
+ totalWorktrees: "number \u2014 total worktrees scanned after filtering"
1633
2153
  }
1634
2154
  },
1635
2155
  ownerModule: "workflow-engine",
@@ -1692,16 +2212,28 @@ var UPDATE_WORKTREE_TARGETS = {
1692
2212
  };
1693
2213
  var UPDATE_WORKTREE_METADATA = {
1694
2214
  name: "update_worktree_metadata",
1695
- description: "Update worktree sequencing metadata \u2014 execution order, dependencies, blocking relations, and gates. Like `git config` for a worktree \u2014 sets the scheduling and dependency metadata that determines when this worktree can activate relative to others. Use to backfill or correct sequencing data.",
2215
+ description: "Update worktree sequencing metadata \u2014 campaign, lane, dependencies, blocking relations, and gates. Like `git config` for a worktree \u2014 sets the scheduling and dependency metadata that determines when this worktree can activate relative to others. Use to backfill or correct sequencing data.",
1696
2216
  parameters: {
1697
2217
  worktreeId: { type: "string", description: "The worktree to update" },
1698
2218
  hypothesis: {
1699
2219
  type: "string",
1700
2220
  description: "Testable claim this worktree investigates"
1701
2221
  },
1702
- executionOrder: {
2222
+ campaign: {
1703
2223
  type: "number",
1704
- description: "Global execution order (1 = first, higher = later)"
2224
+ description: "Top-level pipeline campaign number."
2225
+ },
2226
+ lane: {
2227
+ type: "string",
2228
+ description: "GitButler-aligned workstream lane name inside the campaign."
2229
+ },
2230
+ laneOrderInCampaign: {
2231
+ type: "number",
2232
+ description: "Ordering for this lane within the campaign."
2233
+ },
2234
+ orderInLane: {
2235
+ type: "number",
2236
+ description: "Position of this worktree inside its lane."
1705
2237
  },
1706
2238
  dependsOn: {
1707
2239
  type: "array",
@@ -1739,18 +2271,6 @@ var UPDATE_WORKTREE_METADATA = {
1739
2271
  type: "object",
1740
2272
  description: "Calibrated auto-fix policy controlling dry-run vs safe execution, per-run action caps, and permitted mutation tiers."
1741
2273
  },
1742
- track: {
1743
- type: "string",
1744
- description: "Parallel workstream name (e.g., 'ontology', 'tc-scope', 'control-plane', 'dev-portal', 'mcp-sdk-parity', 'execution-program'). Groups worktrees into named lanes for pipeline visualization and PM analysis."
1745
- },
1746
- trackPosition: {
1747
- type: "number",
1748
- description: "Position within the track (1-indexed). E.g., TC-A=1, TC-B=2, TC-C=3 within the 'tc-scope' track."
1749
- },
1750
- executionBand: {
1751
- type: "number",
1752
- description: "Parallel execution band number. All worktrees in the same band can run simultaneously. Band 2 = OE-B + TC-A, Band 3 = TC-B + 11D-R + S2-13A, etc."
1753
- },
1754
2274
  status: {
1755
2275
  type: "string",
1756
2276
  description: "Override the worktree status. Use for lifecycle transitions like marking a worktree superseded, long-term, or as a raw idea.",
@@ -1807,15 +2327,15 @@ var IDENTITY_WHOAMI = {
1807
2327
  };
1808
2328
  var COMPILE_CONTEXT = {
1809
2329
  name: "compile_context",
1810
- 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.",
2330
+ 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.",
1811
2331
  parameters: {
1812
2332
  topicId: {
1813
2333
  type: "string",
1814
- description: "Topic scope ID to compile"
2334
+ description: "Optional topic scope ID. Omit to resolve the topic from query."
1815
2335
  },
1816
2336
  query: {
1817
2337
  type: "string",
1818
- description: "Optional focus query used to rank context items"
2338
+ description: "Focus query used to resolve the topic and rank context items. Required when topicId is omitted."
1819
2339
  },
1820
2340
  budget: {
1821
2341
  type: "number",
@@ -1839,7 +2359,7 @@ var COMPILE_CONTEXT = {
1839
2359
  description: "Include related ontological entities in the compiled result"
1840
2360
  }
1841
2361
  },
1842
- required: ["topicId"],
2362
+ required: [],
1843
2363
  response: {
1844
2364
  description: "Compiled context pack for the requested topic",
1845
2365
  fields: {
@@ -2013,18 +2533,60 @@ var CREATE_TASK = {
2013
2533
  name: "create_task",
2014
2534
  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.",
2015
2535
  parameters: {
2016
- title: { type: "string", description: "Task description" },
2536
+ title: { type: "string", description: "Task title" },
2017
2537
  topicId: { type: "string", description: "Topic scope" },
2538
+ description: {
2539
+ type: "string",
2540
+ description: "Long-form task description"
2541
+ },
2018
2542
  taskType: {
2019
2543
  type: "string",
2020
- description: "Type: research, interview, analysis, data_collection",
2021
- enum: ["research", "interview", "analysis", "data_collection"]
2544
+ description: "Task taxonomy",
2545
+ enum: [
2546
+ "general",
2547
+ "find_evidence",
2548
+ "verify_claim",
2549
+ "research",
2550
+ "review",
2551
+ "interview",
2552
+ "analysis",
2553
+ "track_metrics"
2554
+ ]
2555
+ },
2556
+ priority: {
2557
+ type: "string",
2558
+ description: "Priority",
2559
+ enum: ["urgent", "high", "medium", "low"]
2560
+ },
2561
+ status: {
2562
+ type: "string",
2563
+ description: "Initial status (defaults to todo)",
2564
+ enum: ["todo", "in_progress", "blocked", "done"]
2565
+ },
2566
+ linkedWorktreeId: {
2567
+ type: "string",
2568
+ description: "Worktree this task belongs to"
2569
+ },
2570
+ linkedBeliefId: {
2571
+ type: "string",
2572
+ description: "Belief this task supports"
2022
2573
  },
2023
2574
  linkedQuestionId: {
2024
2575
  type: "string",
2025
2576
  description: "Question this task addresses"
2026
2577
  },
2027
- linkedWorktreeId: { type: "string", description: "Worktree scope" }
2578
+ assigneeId: {
2579
+ type: "string",
2580
+ description: "Principal assigned to the task"
2581
+ },
2582
+ dueDate: {
2583
+ type: "number",
2584
+ description: "Due date as epoch milliseconds"
2585
+ },
2586
+ tags: {
2587
+ type: "array",
2588
+ description: "Free-form string tags"
2589
+ }
2028
2590
  },
2029
2591
  required: ["title"],
2030
2592
  response: {
@@ -2120,6 +2682,10 @@ var LIST_TASKS = {
2120
2682
  type: "string",
2121
2683
  description: "Filter to tasks linked to this worktree"
2122
2684
  },
2685
+ worktreeId: {
2686
+ type: "string",
2687
+ description: "Alias for linkedWorktreeId"
2688
+ },
2123
2689
  status: {
2124
2690
  type: "string",
2125
2691
  description: "Filter by status: todo, in_progress, blocked, done",
@@ -2140,6 +2706,10 @@ var CREATE_TOPIC = {
2140
2706
  name: "create_topic",
2141
2707
  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.",
2142
2708
  parameters: {
2709
+ globalId: {
2710
+ type: "string",
2711
+ description: "Optional idempotent topic global ID"
2712
+ },
2143
2713
  name: { type: "string", description: "Topic name" },
2144
2714
  type: {
2145
2715
  type: "string",
@@ -2150,6 +2720,18 @@ var CREATE_TOPIC = {
2150
2720
  type: "string",
2151
2721
  description: "Optional parent topic for nesting"
2152
2722
  },
2723
+ parentTopicGlobalId: {
2724
+ type: "string",
2725
+ description: "Optional parent topic global ID for nesting"
2726
+ },
2727
+ tenantId: { type: "string", description: "Optional tenant scope" },
2728
+ workspaceId: { type: "string", description: "Optional workspace scope" },
2729
+ visibility: {
2730
+ type: "string",
2731
+ description: "Topic visibility",
2732
+ enum: ["private", "team", "firm", "external", "public"]
2733
+ },
2734
+ metadata: { type: "object", description: "Optional topic metadata" },
2153
2735
  createdBy: { type: "string", description: "Who created this topic" }
2154
2736
  },
2155
2737
  required: ["name", "type"],
@@ -2158,6 +2740,9 @@ var CREATE_TOPIC = {
2158
2740
  fields: {
2159
2741
  id: "string \u2014 topic ID",
2160
2742
  globalId: "string \u2014 globally unique ID",
2743
+ topicGlobalId: "string \u2014 topic global ID",
2744
+ epistemicNodeId: "string \u2014 materialized topic node ID",
2745
+ epistemicNodeGlobalId: "string \u2014 materialized topic node global ID",
2161
2746
  depth: "number \u2014 nesting depth"
2162
2747
  }
2163
2748
  },
@@ -2207,7 +2792,7 @@ var GET_TOPIC = {
2207
2792
  description: "Legacy alias for topicId"
2208
2793
  }
2209
2794
  },
2210
- required: [],
2795
+ required: ["topicId"],
2211
2796
  response: {
2212
2797
  description: "Single topic record",
2213
2798
  fields: {
@@ -2288,6 +2873,65 @@ var GET_TOPIC_TREE = {
2288
2873
  ontologyPrimitive: "graph",
2289
2874
  tier: "workhorse"
2290
2875
  };
2876
+ var MATERIALIZE_TOPIC_GRAPH = {
2877
+ name: "materialize_topic_graph",
2878
+ description: "Backfill the topic graph spine. Like `git fsck --connectivity-only` with repair enabled \u2014 creates missing topic nodes and parent-child edges idempotently.",
2879
+ parameters: {
2880
+ rootTopicId: {
2881
+ type: "string",
2882
+ description: "Optional root topic for a bounded materialization pass"
2883
+ },
2884
+ dryRun: {
2885
+ type: "boolean",
2886
+ description: "When true, report missing rows without writing them"
2887
+ }
2888
+ },
2889
+ required: [],
2890
+ response: {
2891
+ description: "Topic graph materialization counts",
2892
+ fields: {
2893
+ topicsSeen: "number",
2894
+ nodesCreated: "number",
2895
+ nodesExisting: "number",
2896
+ edgesCreated: "number",
2897
+ edgesExisting: "number",
2898
+ errors: "array"
2899
+ }
2900
+ },
2901
+ ownerModule: "reasoning-kernel",
2902
+ ontologyPrimitive: "graph",
2903
+ tier: "workhorse"
2904
+ };
2905
+ var GET_TOPIC_GRAPH_SPINE = {
2906
+ name: "get_topic_graph_spine",
2907
+ description: "Verify the topic graph spine. Like `git fsck` \u2014 reads topics, materialized topic nodes, parent-child edges, and missing spine rows.",
2908
+ parameters: {
2909
+ rootTopicId: {
2910
+ type: "string",
2911
+ description: "Optional root topic for a bounded verifier pass"
2912
+ },
2913
+ includeTopicBeliefEdges: {
2914
+ type: "boolean",
2915
+ description: "Include topic -> belief edges in the verifier payload"
2916
+ }
2917
+ },
2918
+ required: [],
2919
+ response: {
2920
+ description: "Topic graph spine verification payload",
2921
+ fields: {
2922
+ ok: "boolean",
2923
+ counts: "object",
2924
+ topics: "array",
2925
+ topicNodes: "array",
2926
+ parentEdges: "array",
2927
+ missingTopicNodes: "array",
2928
+ missingParentEdges: "array"
2929
+ }
2930
+ },
2931
+ ownerModule: "reasoning-kernel",
2932
+ ontologyPrimitive: "graph",
2933
+ tier: "workhorse"
2934
+ };
2291
2935
  var GET_CODE_CONTEXT = {
2292
2936
  name: "get_code_context",
2293
2937
  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.",
@@ -2562,7 +3206,7 @@ var GET_ONTOLOGY = {
2562
3206
  description: "Tenant scope for key lookup. Omit for platform-level."
2563
3207
  }
2564
3208
  },
2565
- required: [],
3209
+ required: ["id"],
2566
3210
  response: {
2567
3211
  description: "Ontology definition with latest published version",
2568
3212
  fields: {
@@ -2629,7 +3273,7 @@ var MATCH_ENTITY_TYPE = {
2629
3273
  description: "Optional maximum number of ranked matches to return"
2630
3274
  }
2631
3275
  },
2632
- required: ["text"],
3276
+ required: ["text", "ontologyId"],
2633
3277
  response: {
2634
3278
  description: "Ranked ontology entity type matches",
2635
3279
  fields: {
@@ -2883,7 +3527,7 @@ var RECORD_SCOPE_LEARNING = {
2883
3527
  };
2884
3528
  var PIPELINE_SNAPSHOT = {
2885
3529
  name: "pipeline_snapshot",
2886
- description: "Summarize a topic's worktree pipeline in band-and-lane form. Like `git status --short` for Lucern execution \u2014 returns the hinge worktree, next planned wave, blockers, critical path, superseded work, and graph hygiene debt.",
3530
+ description: "Summarize a topic's worktree pipeline in campaign-and-lane form. Like `git status --short` for Lucern execution \u2014 returns the hinge worktree, next planned wave, blockers, critical path, superseded work, and graph hygiene debt.",
2887
3531
  parameters: {
2888
3532
  topicId: { type: "string", description: "Topic scope ID" }
2889
3533
  },
@@ -2893,14 +3537,14 @@ var PIPELINE_SNAPSHOT = {
2893
3537
  fields: {
2894
3538
  topicId: "string",
2895
3539
  topicName: "string",
2896
- currentBand: "number | null",
2897
- nextBand: "number | null",
3540
+ currentCampaign: "number | null",
3541
+ nextCampaign: "number | null",
2898
3542
  activeWorktrees: "array \u2014 current hinge worktree(s)",
2899
- nextWave: "array \u2014 worktrees in the next planned band",
3543
+ nextWave: "array \u2014 worktrees in the next planned campaign",
2900
3544
  readyNow: "array \u2014 planning worktrees with dependencies completed",
2901
3545
  blockedBy: "array \u2014 grouped blockers",
2902
3546
  criticalPath: "array \u2014 ordered incomplete worktree chain",
2903
- bands: "array \u2014 incomplete worktrees grouped by executionBand",
3547
+ campaigns: "array \u2014 incomplete worktrees grouped by campaign",
2904
3548
  superseded: "array \u2014 worktrees marked superseded or not for activation",
2905
3549
  graphHygiene: "object \u2014 untargeted and taskless worktree debt",
2906
3550
  riskQuestions: "array \u2014 critical/high open questions",
@@ -3420,6 +4064,69 @@ var GENERATE_SESSION_HANDOFF = {
3420
4064
  tier: "showcase",
3421
4065
  internal: true
3422
4066
  };
4067
+ var BEGIN_BUILD_SESSION = {
4068
+ name: "begin_build_session",
4069
+ 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.",
4070
+ parameters: {
4071
+ worktreeId: {
4072
+ type: "string",
4073
+ description: "The Lucern worktree ID to bootstrap."
4074
+ },
4075
+ branch: {
4076
+ type: "string",
4077
+ description: "Optional git branch name. Auto-generated from the worktree name when omitted."
4078
+ },
4079
+ branchBase: {
4080
+ type: "string",
4081
+ description: 'Base branch for the feature branch. Default: "staging".'
4082
+ },
4083
+ prBase: {
4084
+ type: "string",
4085
+ description: 'Target branch for the PR. Default: "staging".'
4086
+ },
4087
+ sessionMode: {
4088
+ type: "string",
4089
+ description: 'Session mode: "async" for Codex/headless or "interactive" for live sessions.',
4090
+ enum: ["async", "interactive"]
4091
+ },
4092
+ activateIfPlanning: {
4093
+ type: "boolean",
4094
+ description: "When true, automatically activate a planning worktree during bootstrap."
4095
+ }
4096
+ },
4097
+ required: ["worktreeId"],
4098
+ response: {
4099
+ description: "A compact build-session packet with worktree metadata, graph anchors, questions, dependencies, and git defaults.",
4100
+ fields: {
4101
+ topicId: "string \u2014 canonical topic scope",
4102
+ topicName: "string \u2014 human-readable topic name",
4103
+ worktreeId: "string \u2014 worktree ID",
4104
+ worktreeName: "string \u2014 human-readable worktree name",
4105
+ branch: "string \u2014 git branch name",
4106
+ branchBase: "string \u2014 base branch",
4107
+ prBase: "string \u2014 PR target branch",
4108
+ campaign: "number | null \u2014 top-level pipeline campaign",
4109
+ lane: "string \u2014 campaign lane",
4110
+ gate: "string \u2014 exit gate",
4111
+ hypothesis: "string \u2014 worktree hypothesis",
4112
+ focus: "string \u2014 session focus",
4113
+ status: "string \u2014 worktree status after optional activation",
4114
+ sessionMode: "string \u2014 async | interactive",
4115
+ targetBeliefIds: "array \u2014 scoped belief IDs",
4116
+ targetQuestionIds: "array \u2014 scoped question IDs",
4117
+ topBeliefs: "array \u2014 highest-confidence scoped beliefs",
4118
+ openQuestions: "array \u2014 open scoped questions",
4119
+ resolvedDecisions: "array \u2014 answered questions summarized for the session",
4120
+ dependencies: "array \u2014 upstream worktrees",
4121
+ unblocks: "array \u2014 downstream worktrees",
4122
+ mergeOrderNotes: "string \u2014 merge ordering advisory"
4123
+ }
4124
+ },
4125
+ ownerModule: "bootstrap",
4126
+ ontologyPrimitive: "worktree",
4127
+ tier: "showcase",
4128
+ internal: true
4129
+ };
3423
4130
  var MCP_TOOL_CONTRACTS = {
3424
4131
  // Belief lifecycle (commit, amend, fork, archive)
3425
4132
  create_belief: CREATE_BELIEF,
@@ -3462,11 +4169,26 @@ var MCP_TOOL_CONTRACTS = {
3462
4169
  bisect_confidence: BISECT_CONFIDENCE,
3463
4170
  // Edges (commit)
3464
4171
  create_edge: CREATE_EDGE,
4172
+ update_edge: UPDATE_EDGE,
4173
+ remove_edge: REMOVE_EDGE,
4174
+ remove_edges_between: REMOVE_EDGES_BETWEEN,
4175
+ batch_create_edges: BATCH_CREATE_EDGES,
4176
+ // Epistemic node spine (commit/amend/show)
4177
+ create_epistemic_node: CREATE_EPISTEMIC_NODE,
4178
+ get_epistemic_node: GET_EPISTEMIC_NODE,
4179
+ list_epistemic_nodes: LIST_EPISTEMIC_NODES,
4180
+ update_epistemic_node: UPDATE_EPISTEMIC_NODE,
4181
+ archive_epistemic_node: ARCHIVE_EPISTEMIC_NODE,
4182
+ verify_epistemic_node: VERIFY_EPISTEMIC_NODE,
4183
+ supersede_epistemic_node: SUPERSEDE_EPISTEMIC_NODE,
4184
+ batch_create_epistemic_nodes: BATCH_CREATE_EPISTEMIC_NODES,
3465
4185
  // Judgments (tag)
3466
4186
  record_judgment: RECORD_JUDGMENT,
3467
4187
  // Graph intelligence (showcase)
3468
4188
  detect_confirmation_bias: DETECT_CONFIRMATION_BIAS,
3469
4189
  get_graph_structure_analysis: GET_GRAPH_STRUCTURE_ANALYSIS,
4190
+ list_graph_intelligence_queries: LIST_GRAPH_INTELLIGENCE_QUERIES,
4191
+ run_graph_intelligence_query: RUN_GRAPH_INTELLIGENCE_QUERY,
3470
4192
  get_falsification_questions: GET_FALSIFICATION_QUESTIONS,
3471
4193
  // Evidence operations (workhorse)
3472
4194
  search_evidence: SEARCH_EVIDENCE,
@@ -3489,6 +4211,7 @@ var MCP_TOOL_CONTRACTS = {
3489
4211
  list_beliefs: LIST_BELIEFS,
3490
4212
  list_worktrees: LIST_WORKTREES,
3491
4213
  list_all_worktrees: LIST_ALL_WORKTREES,
4214
+ list_campaigns: LIST_CAMPAIGNS,
3492
4215
  activate_worktree: ACTIVATE_WORKTREE,
3493
4216
  update_worktree_targets: UPDATE_WORKTREE_TARGETS,
3494
4217
  update_worktree_metadata: UPDATE_WORKTREE_METADATA,
@@ -3512,6 +4235,7 @@ var MCP_TOOL_CONTRACTS = {
3512
4235
  get_agent_inbox: GET_AGENT_INBOX,
3513
4236
  claim_files: CLAIM_FILES,
3514
4237
  generate_session_handoff: GENERATE_SESSION_HANDOFF,
4238
+ begin_build_session: BEGIN_BUILD_SESSION,
3515
4239
  // Policy / ACL (workhorse)
3516
4240
  check_permission: CHECK_PERMISSION,
3517
4241
  filter_by_permission: FILTER_BY_PERMISSION,
@@ -3531,6 +4255,8 @@ var MCP_TOOL_CONTRACTS = {
3531
4255
  get_topic: GET_TOPIC,
3532
4256
  update_topic: UPDATE_TOPIC,
3533
4257
  get_topic_tree: GET_TOPIC_TREE,
4258
+ materialize_topic_graph: MATERIALIZE_TOPIC_GRAPH,
4259
+ get_topic_graph_spine: GET_TOPIC_GRAPH_SPINE,
3534
4260
  // Coding intelligence (code-grounded knowledge)
3535
4261
  get_code_context: GET_CODE_CONTEXT,
3536
4262
  get_change_history: GET_CHANGE_HISTORY,
@@ -3635,18 +4361,34 @@ var MCP_CORE_OPERATION_NAMES = [
3635
4361
  "find_missing_questions",
3636
4362
  "get_high_priority_questions",
3637
4363
  "get_falsification_questions",
4364
+ "create_epistemic_node",
4365
+ "get_epistemic_node",
4366
+ "list_epistemic_nodes",
4367
+ "update_epistemic_node",
4368
+ "archive_epistemic_node",
4369
+ "verify_epistemic_node",
4370
+ "supersede_epistemic_node",
4371
+ "batch_create_epistemic_nodes",
3638
4372
  "create_topic",
3639
4373
  "get_topic",
3640
4374
  "list_topics",
3641
4375
  "update_topic",
3642
- "get_topic_tree"
4376
+ "get_topic_tree",
4377
+ "materialize_topic_graph",
4378
+ "get_topic_graph_spine"
3643
4379
  ];
3644
4380
  var MCP_ANALYSIS_PLATFORM_OPERATION_NAMES = [
3645
4381
  "create_edge",
4382
+ "update_edge",
4383
+ "remove_edge",
4384
+ "remove_edges_between",
4385
+ "batch_create_edges",
3646
4386
  "query_lineage",
3647
4387
  "traverse_graph",
3648
4388
  "get_graph_neighborhood",
3649
4389
  "get_graph_structure_analysis",
4390
+ "list_graph_intelligence_queries",
4391
+ "run_graph_intelligence_query",
3650
4392
  "find_contradictions",
3651
4393
  "flag_contradiction",
3652
4394
  "detect_confirmation_bias",
@@ -3671,6 +4413,7 @@ var MCP_WORKFLOW_PLATFORM_OPERATION_NAMES = [
3671
4413
  "activate_worktree",
3672
4414
  "list_worktrees",
3673
4415
  "list_all_worktrees",
4416
+ "list_campaigns",
3674
4417
  "update_worktree_targets",
3675
4418
  "update_worktree_metadata",
3676
4419
  "create_task",
@@ -3724,6 +4467,7 @@ var PLATFORM_INTERNAL_OPERATION_NAMES = [
3724
4467
  "get_change_history",
3725
4468
  "get_failure_log",
3726
4469
  "record_attempt",
4470
+ "begin_build_session",
3727
4471
  "push",
3728
4472
  "open_pull_request",
3729
4473
  "record_judgment",
@@ -3778,7 +4522,6 @@ var SDK_ONLY_OPERATION_NAMES = [
3778
4522
  "find_semantic_orphans"
3779
4523
  ];
3780
4524
  var MCP_ONLY_INTERNAL_OPERATION_NAMES = [
3781
- "begin_build_session",
3782
4525
  "evaluate_engineering_contract",
3783
4526
  "evaluate_research_contract"
3784
4527
  ];
@@ -3878,6 +4621,7 @@ var LUCERN_OPERATION_MANIFEST = {
3878
4621
 
3879
4622
  // src/function-registry/helpers.ts
3880
4623
  var jsonObjectSchema = z.record(z.unknown());
4624
+ var sdkSessionIdSchema = z.string().optional();
3881
4625
  function mcpContractShape(contract) {
3882
4626
  const required = new Set(contract.required);
3883
4627
  return Object.fromEntries(
@@ -3912,10 +4656,40 @@ function argsSchemaFromMcpContract(contract) {
3912
4656
  return z.object(mcpContractShape(contract));
3913
4657
  }
3914
4658
  function inputSchemaFromMcpContract(contract) {
3915
- return argsSchemaFromMcpContract(contract).passthrough();
4659
+ return withInternalSurfaceFields(argsSchemaFromMcpContract(contract));
4660
+ }
4661
+ function withInternalSurfaceFields(schema) {
4662
+ return schema.extend({ __sdkSessionId: sdkSessionIdSchema }).strict();
4663
+ }
4664
+ function normalizeInputSchema(schema) {
4665
+ if (schema instanceof z.ZodObject) {
4666
+ return withInternalSurfaceFields(schema);
4667
+ }
4668
+ return schema;
4669
+ }
4670
+ function unwrapObjectSchema(schema) {
4671
+ let current = schema;
4672
+ while (true) {
4673
+ switch (current._def.typeName) {
4674
+ case z.ZodFirstPartyTypeKind.ZodEffects:
4675
+ current = current._def.schema;
4676
+ continue;
4677
+ case z.ZodFirstPartyTypeKind.ZodBranded:
4678
+ current = current._def.type;
4679
+ continue;
4680
+ default:
4681
+ return current instanceof z.ZodObject ? current : void 0;
4682
+ }
4683
+ }
3916
4684
  }
3917
4685
  function getObjectShape(schema) {
3918
- const shape = typeof schema._def.shape === "function" ? schema._def.shape() : schema._def.shape;
4686
+ const objectSchema = unwrapObjectSchema(schema);
4687
+ if (!objectSchema) {
4688
+ throw new Error(
4689
+ `Expected a Zod object schema, received ${schema._def.typeName}.`
4690
+ );
4691
+ }
4692
+ const shape = typeof objectSchema._def.shape === "function" ? objectSchema._def.shape() : objectSchema._def.shape;
3919
4693
  return shape;
3920
4694
  }
3921
4695
  function unwrapMcpParameterSchema(schema) {
@@ -3936,6 +4710,9 @@ function unwrapMcpParameterSchema(schema) {
3936
4710
  case z.ZodFirstPartyTypeKind.ZodBranded:
3937
4711
  current = current._def.type;
3938
4712
  continue;
4713
+ case z.ZodFirstPartyTypeKind.ZodEffects:
4714
+ current = current._def.schema;
4715
+ continue;
3939
4716
  default:
3940
4717
  return { schema: current, required, description: description ?? current.description };
3941
4718
  }
@@ -3955,6 +4732,7 @@ function mcpParameterFromZod(fieldName, schema, contractName) {
3955
4732
  return { parameter: { type: "array", description }, required };
3956
4733
  case z.ZodFirstPartyTypeKind.ZodObject:
3957
4734
  case z.ZodFirstPartyTypeKind.ZodRecord:
4735
+ case z.ZodFirstPartyTypeKind.ZodDiscriminatedUnion:
3958
4736
  return { parameter: { type: "object", description }, required };
3959
4737
  case z.ZodFirstPartyTypeKind.ZodEnum:
3960
4738
  return {
@@ -3998,18 +4776,27 @@ function mcpContractFromArgsSchema(base, args, contractName) {
3998
4776
  required: converted.filter(([, field]) => field.required).map(([fieldName]) => fieldName)
3999
4777
  };
4000
4778
  }
4001
- function defineFunctionContract(contract) {
4002
- return contract;
4003
- }
4779
+ var defineFunctionContract = (contract) => contract;
4004
4780
  function authUserId(context) {
4005
4781
  return context.userId ?? context.principalId ?? "lucern-agent";
4006
4782
  }
4783
+ function withUserId(input, context) {
4784
+ return {
4785
+ ...input,
4786
+ userId: typeof input.userId === "string" ? input.userId : authUserId(context)
4787
+ };
4788
+ }
4007
4789
  function withCreatedBy(input, context) {
4008
4790
  return {
4009
4791
  ...input,
4010
4792
  createdBy: typeof input.createdBy === "string" ? input.createdBy : authUserId(context)
4011
4793
  };
4012
4794
  }
4795
+ function compactRecord(input) {
4796
+ return Object.fromEntries(
4797
+ Object.entries(input).filter(([, value]) => value !== void 0)
4798
+ );
4799
+ }
4013
4800
  function surfaceMcpContract(name) {
4014
4801
  const contract = MCP_TOOL_CONTRACTS[name];
4015
4802
  if (!contract) {
@@ -4054,7 +4841,9 @@ function surfaceContract(args) {
4054
4841
  const canonicalArgs = args.args ?? argsSchemaFromMcpContract(baseMcp);
4055
4842
  const mcp = args.args ? mcpContractFromArgsSchema(baseMcp, canonicalArgs, args.name) : baseMcp;
4056
4843
  const canonicalReturns = args.returns ?? jsonObjectSchema;
4057
- const input = args.input ?? inputSchemaFromMcpContract(mcp);
4844
+ const input = normalizeInputSchema(
4845
+ args.input ?? inputSchemaFromMcpContract(mcp)
4846
+ );
4058
4847
  const output = args.output ?? canonicalReturns;
4059
4848
  return defineFunctionContract({
4060
4849
  name: args.name,
@@ -4097,13 +4886,174 @@ function surfaceContract(args) {
4097
4886
  }
4098
4887
  });
4099
4888
  }
4100
-
4101
- // src/function-registry/worktrees.ts
4102
- var worktreeInput = (input) => ({
4103
- ...input,
4889
+ var autoFixPolicyInputSchema = z.object({
4890
+ enabled: z.boolean().optional().describe("Whether automatic remediation is enabled."),
4891
+ mode: z.string().optional().describe("Automation mode for worktree auto-fixes."),
4892
+ maxAttempts: z.number().optional().describe("Maximum number of auto-fix attempts."),
4893
+ reviewer: z.string().optional().describe("Reviewer responsible for auto-fix oversight."),
4894
+ maxActionsPerRun: z.number().optional().describe("Maximum number of auto-fix actions per run."),
4895
+ permittedMutationTiers: z.array(z.enum(["read_only", "low_risk_write", "high_risk_write"])).optional().describe("Mutation tiers the auto-fix worker may execute."),
4896
+ requireAuditTrail: z.boolean().optional().describe("Whether auto-fix actions must write an audit trail."),
4897
+ escalationGate: z.string().optional().describe("Gate to trigger when auto-fix policy requires escalation.")
4898
+ }).passthrough().describe("Policy for permitted automatic remediation inside the worktree.");
4899
+ var worktreeKeyQuestionInputSchema = z.object({
4900
+ question: z.string().describe("Question the worktree must resolve."),
4901
+ status: z.enum(["open", "answered", "forked"]).optional().describe("Current disposition of the key question."),
4902
+ answer: z.string().optional().describe("Captured answer when the key question is resolved."),
4903
+ answerConfidence: z.enum(["high", "medium", "low"]).optional().describe("Confidence in the captured answer."),
4904
+ linkedQuestionId: z.string().optional().describe("Canonical question node linked to this key question.")
4905
+ }).passthrough().describe("Question contract embedded in the worktree plan.");
4906
+ var worktreeEvidenceSignalInputSchema = z.object({
4907
+ signal: z.string().describe("Evidence signal the worktree should collect."),
4908
+ collected: z.boolean().optional().describe("Whether the signal has already been collected."),
4909
+ progress: z.string().optional().describe("Collection progress note for the signal."),
4910
+ notes: z.string().optional().describe("Additional evidence collection notes.")
4911
+ }).passthrough().describe("Evidence signal embedded in the worktree plan.");
4912
+ var worktreeDecisionGateInputSchema = z.object({
4913
+ goCriteria: z.array(z.string()).describe("Criteria that must hold for the worktree to proceed."),
4914
+ noGoSignals: z.array(z.string()).describe("Signals that stop or redirect the worktree."),
4915
+ verdict: z.enum(["go", "no_go", "pivot", "pending"]).optional().describe("Current decision verdict for the worktree gate."),
4916
+ verdictRationale: z.string().optional().describe("Rationale supporting the current gate verdict."),
4917
+ decidedAt: z.number().optional().describe("Timestamp when the gate verdict was decided."),
4918
+ decidedBy: z.string().optional().describe("Actor that decided the gate verdict.")
4919
+ }).passthrough().describe("Decision gate contract for worktree activation or exit.");
4920
+ var addWorktreeArgs = z.object({
4921
+ title: z.string().describe("Human-readable worktree name or objective."),
4922
+ name: z.string().optional().describe("Storage-name alias for callers that already use backend naming."),
4923
+ topicId: z.string().optional().describe("Optional primary topic scope hint for resolver validation."),
4924
+ projectId: z.string().optional().describe("Legacy topicId alias/hint."),
4925
+ topicHint: z.string().optional().describe("Natural-language topic hint for automatic topic resolution."),
4926
+ branchId: z.string().optional().describe("Legacy branch identifier for compatibility with workflow callers."),
4927
+ objective: z.string().optional().describe("Reasoning objective this worktree is intended to resolve."),
4928
+ hypothesis: z.string().optional().describe("Testable claim this worktree investigates."),
4929
+ rationale: z.string().optional().describe("Why this worktree exists and why it belongs in the campaign."),
4930
+ worktreeType: z.string().optional().describe("Schema-enum worktree type used for kernel lifecycle behavior."),
4931
+ gate: z.string().optional().describe("Exit gate for this worktree."),
4932
+ startDate: z.number().optional().describe("Planned start timestamp in milliseconds since epoch."),
4933
+ endDate: z.number().optional().describe("Planned end timestamp in milliseconds since epoch."),
4934
+ durationWeeks: z.number().optional().describe("Planned duration in weeks."),
4935
+ confidenceImpact: z.enum(["high", "medium", "low"]).optional().describe("Expected confidence impact if this worktree succeeds."),
4936
+ beliefFocus: z.string().optional().describe("Natural-language focus spanning the target belief neighborhood."),
4937
+ beliefIds: z.array(z.string()).optional().describe("Legacy alias for targetBeliefIds."),
4938
+ beliefs: z.array(z.string()).optional().describe("Legacy alias for targetBeliefIds."),
4939
+ targetBeliefIds: z.array(z.string()).optional().describe("Belief node IDs this worktree is expected to test or update."),
4940
+ targetQuestionIds: z.array(z.string()).optional().describe("Question node IDs this worktree is expected to answer."),
4941
+ keyQuestions: z.array(worktreeKeyQuestionInputSchema).optional().describe("Inline key questions captured as part of the worktree plan."),
4942
+ evidenceSignals: z.array(worktreeEvidenceSignalInputSchema).optional().describe("Evidence signals the worktree needs to collect or validate."),
4943
+ decisionGate: worktreeDecisionGateInputSchema.optional(),
4944
+ goCriteria: z.array(z.string()).optional().describe("Shorthand go criteria used to build decisionGate."),
4945
+ noGoSignals: z.array(z.string()).optional().describe("Shorthand no-go signals used to build decisionGate."),
4946
+ proofArtifacts: z.array(z.unknown()).optional().describe("Expected proof artifacts required to close the worktree."),
4947
+ autoShape: z.boolean().optional().describe("Whether to invoke inquiry auto-shaping during creation."),
4948
+ autoFixPolicy: autoFixPolicyInputSchema.optional(),
4949
+ domainPackId: z.string().optional().describe("Domain pack whose shaping hooks should influence the worktree."),
4950
+ tags: z.array(z.string()).optional().describe("Additional topic-resolution tags for the worktree."),
4951
+ touchedPaths: z.array(z.string()).optional().describe("File paths used as topic-resolution signals."),
4952
+ sourceRef: z.string().optional().describe("Source reference used as a topic-resolution signal."),
4953
+ sourceKind: z.string().optional().describe("Source kind used as a topic-resolution signal."),
4954
+ campaign: z.number().optional().describe("Top-level pipeline campaign number."),
4955
+ lane: z.string().optional().describe("Campaign lane for the worktree."),
4956
+ laneOrderInCampaign: z.number().optional().describe("Ordering for this lane within its campaign."),
4957
+ orderInLane: z.number().optional().describe("Position of this worktree inside its lane."),
4958
+ dependsOn: z.array(z.string()).optional().describe("Worktree IDs that must complete before this worktree."),
4959
+ blocks: z.array(z.string()).optional().describe("Worktree IDs blocked by this worktree."),
4960
+ staffingHint: z.string().optional().describe("Suggested staffing or agent allocation note."),
4961
+ lensId: z.string().optional().describe("Lens that scopes this worktree when applicable."),
4962
+ lastReconciledAt: z.number().optional().describe("Timestamp when worktree metadata was last reconciled.")
4963
+ });
4964
+ var worktreeIdInput = (input) => compactRecord({
4104
4965
  worktreeId: input.worktreeId ?? input.id
4105
4966
  });
4967
+ var activateWorktreeInput = (input, context) => withUserId(worktreeIdInput(input), context);
4968
+ var worktreeTargetsInput = (input) => compactRecord({
4969
+ worktreeId: input.worktreeId ?? input.id,
4970
+ addBeliefIds: input.addBeliefIds,
4971
+ removeBeliefIds: input.removeBeliefIds,
4972
+ addQuestionIds: input.addQuestionIds,
4973
+ removeQuestionIds: input.removeQuestionIds
4974
+ });
4975
+ var worktreeMetadataInput = (input) => compactRecord({
4976
+ worktreeId: input.worktreeId ?? input.id,
4977
+ topicId: input.topicId,
4978
+ additionalTopicIds: input.additionalTopicIds,
4979
+ status: input.status,
4980
+ campaign: input.campaign,
4981
+ lane: input.lane,
4982
+ laneOrderInCampaign: input.laneOrderInCampaign,
4983
+ orderInLane: input.orderInLane,
4984
+ gate: input.gate,
4985
+ hypothesis: input.hypothesis,
4986
+ objective: input.objective,
4987
+ rationale: input.rationale,
4988
+ proofArtifacts: input.proofArtifacts,
4989
+ staffingHint: input.staffingHint,
4990
+ blocks: input.blocks,
4991
+ dependsOn: input.dependsOn,
4992
+ lensId: input.lensId,
4993
+ autoFixPolicy: input.autoFixPolicy,
4994
+ lastReconciledAt: input.lastReconciledAt
4995
+ });
4996
+ var worktreeMetadataArgs = z.object({
4997
+ worktreeId: z.string().describe("The worktree to update."),
4998
+ id: z.string().optional().describe("Worktree ID alias."),
4999
+ topicId: z.string().optional().describe("Primary topic scope."),
5000
+ additionalTopicIds: z.array(z.string()).optional().describe("Additional topic scopes associated with this worktree."),
5001
+ status: z.string().optional().describe("Worktree lifecycle status."),
5002
+ campaign: z.number().optional().describe("Top-level pipeline campaign."),
5003
+ lane: z.string().optional().describe("Campaign lane."),
5004
+ laneOrderInCampaign: z.number().optional().describe("Ordering for this lane within its campaign."),
5005
+ orderInLane: z.number().optional().describe("Position of this worktree inside its lane."),
5006
+ gate: z.string().optional().describe("Exit gate for this worktree."),
5007
+ hypothesis: z.string().optional().describe("Testable claim this worktree investigates."),
5008
+ objective: z.string().optional().describe("Reasoning objective for the worktree."),
5009
+ rationale: z.string().optional().describe("Why this worktree is sequenced here."),
5010
+ proofArtifacts: z.array(z.unknown()).optional().describe("Proof artifacts required to close the worktree."),
5011
+ staffingHint: z.string().optional().describe("Suggested staffing or agent allocation note."),
5012
+ blocks: z.array(z.string()).optional().describe("Worktree IDs blocked by this worktree."),
5013
+ dependsOn: z.array(z.string()).optional().describe("Worktree IDs this worktree depends on."),
5014
+ lensId: z.string().optional().describe("Lens that scopes this worktree."),
5015
+ autoFixPolicy: autoFixPolicyInputSchema.optional(),
5016
+ lastReconciledAt: z.number().optional().describe("Timestamp of the last deterministic reconciliation pass.")
5017
+ });
5018
+ var pushArgs = worktreeMetadataArgs.extend({
5019
+ targetContext: z.string().describe("Where to push merged findings."),
5020
+ beliefIds: z.array(z.string()).optional().describe("Optional subset of beliefs to push.")
5021
+ });
5022
+ var openPullRequestArgs = worktreeMetadataArgs.extend({
5023
+ reviewers: z.array(z.string()).optional().describe("User IDs of requested reviewers."),
5024
+ summary: z.string().describe("Summary of findings and why they are ready for review.")
5025
+ });
5026
+ var mergeKeyFindingsInput = (input) => {
5027
+ if (Array.isArray(input.keyFindings)) {
5028
+ return input.keyFindings;
5029
+ }
5030
+ if (Array.isArray(input.outcomes)) {
5031
+ const findings = input.outcomes.filter(
5032
+ (outcome) => typeof outcome === "string" && outcome.trim().length > 0
5033
+ );
5034
+ if (findings.length > 0) {
5035
+ return findings;
5036
+ }
5037
+ }
5038
+ return [input.summary ?? "Merged worktree"];
5039
+ };
5040
+ var listAllWorktreesInput = (input) => compactRecord({
5041
+ status: input.status,
5042
+ lane: input.lane,
5043
+ campaign: input.campaign,
5044
+ limit: input.limit
5045
+ });
4106
5046
  var worktreesContracts = [
5047
+ surfaceContract({
5048
+ name: "begin_build_session",
5049
+ kind: "mutation",
5050
+ domain: "worktrees",
5051
+ surfaceClass: "platform_internal",
5052
+ path: "/mcp/build-session/begin",
5053
+ sdkNamespace: "worktrees",
5054
+ sdkMethod: "beginBuildSession",
5055
+ summary: "Begin a coding build session for a worktree."
5056
+ }),
4107
5057
  surfaceContract({
4108
5058
  name: "add_worktree",
4109
5059
  kind: "mutation",
@@ -4118,14 +5068,45 @@ var worktreesContracts = [
4118
5068
  functionName: "create",
4119
5069
  kind: "mutation",
4120
5070
  inputProjection: (input, context) => withCreatedBy(
4121
- {
4122
- ...input,
5071
+ compactRecord({
4123
5072
  name: input.name ?? input.title,
4124
- targetBeliefIds: input.targetBeliefIds ?? input.beliefIds
4125
- },
5073
+ topicId: input.topicId ?? input.projectId,
5074
+ worktreeType: input.worktreeType,
5075
+ objective: input.objective,
5076
+ gate: input.gate,
5077
+ hypothesis: input.hypothesis,
5078
+ rationale: input.rationale,
5079
+ startDate: input.startDate,
5080
+ endDate: input.endDate,
5081
+ durationWeeks: input.durationWeeks,
5082
+ confidenceImpact: input.confidenceImpact,
5083
+ autoShape: input.autoShape,
5084
+ autoFixPolicy: input.autoFixPolicy,
5085
+ beliefFocus: input.beliefFocus,
5086
+ targetQuestionIds: input.targetQuestionIds,
5087
+ targetBeliefIds: input.targetBeliefIds ?? input.beliefIds,
5088
+ keyQuestions: input.keyQuestions,
5089
+ proofArtifacts: input.proofArtifacts,
5090
+ decisionGate: input.decisionGate ?? (input.goCriteria || input.noGoSignals ? compactRecord({
5091
+ goCriteria: input.goCriteria,
5092
+ noGoSignals: input.noGoSignals
5093
+ }) : void 0),
5094
+ evidenceSignals: input.evidenceSignals,
5095
+ dependsOn: input.dependsOn,
5096
+ blocks: input.blocks,
5097
+ campaign: input.campaign,
5098
+ lane: input.lane,
5099
+ laneOrderInCampaign: input.laneOrderInCampaign,
5100
+ orderInLane: input.orderInLane,
5101
+ staffingHint: input.staffingHint,
5102
+ domainPackId: input.domainPackId,
5103
+ lensId: input.lensId,
5104
+ lastReconciledAt: input.lastReconciledAt
5105
+ }),
4126
5106
  context
4127
5107
  )
4128
- }
5108
+ },
5109
+ args: addWorktreeArgs
4129
5110
  }),
4130
5111
  surfaceContract({
4131
5112
  name: "activate_worktree",
@@ -4140,7 +5121,7 @@ var worktreesContracts = [
4140
5121
  module: "worktrees",
4141
5122
  functionName: "activate",
4142
5123
  kind: "mutation",
4143
- inputProjection: worktreeInput
5124
+ inputProjection: activateWorktreeInput
4144
5125
  }
4145
5126
  }),
4146
5127
  surfaceContract({
@@ -4156,7 +5137,36 @@ var worktreesContracts = [
4156
5137
  convex: {
4157
5138
  module: "worktrees",
4158
5139
  functionName: "list",
4159
- kind: "query"
5140
+ kind: "query",
5141
+ inputProjection: (input) => compactRecord({
5142
+ topicId: input.topicId,
5143
+ status: input.status,
5144
+ groupBy: input.groupBy,
5145
+ lane: input.lane,
5146
+ campaign: input.campaign,
5147
+ limit: input.limit
5148
+ })
5149
+ }
5150
+ }),
5151
+ surfaceContract({
5152
+ name: "list_campaigns",
5153
+ kind: "query",
5154
+ domain: "worktrees",
5155
+ surfaceClass: "platform_public",
5156
+ method: "GET",
5157
+ path: "/worktrees/campaigns",
5158
+ sdkNamespace: "worktrees",
5159
+ sdkMethod: "listCampaigns",
5160
+ summary: "List compact pipeline campaigns with nested lanes.",
5161
+ convex: {
5162
+ module: "worktrees",
5163
+ functionName: "listCampaigns",
5164
+ kind: "query",
5165
+ inputProjection: (input) => compactRecord({
5166
+ topicId: input.topicId,
5167
+ status: input.status,
5168
+ limit: input.limit
5169
+ })
4160
5170
  }
4161
5171
  }),
4162
5172
  surfaceContract({
@@ -4172,7 +5182,8 @@ var worktreesContracts = [
4172
5182
  convex: {
4173
5183
  module: "worktrees",
4174
5184
  functionName: "listAll",
4175
- kind: "query"
5185
+ kind: "query",
5186
+ inputProjection: listAllWorktreesInput
4176
5187
  }
4177
5188
  }),
4178
5189
  surfaceContract({
@@ -4189,7 +5200,7 @@ var worktreesContracts = [
4189
5200
  module: "worktrees",
4190
5201
  functionName: "updateTargets",
4191
5202
  kind: "mutation",
4192
- inputProjection: worktreeInput
5203
+ inputProjection: worktreeTargetsInput
4193
5204
  }
4194
5205
  }),
4195
5206
  surfaceContract({
@@ -4206,8 +5217,9 @@ var worktreesContracts = [
4206
5217
  module: "worktrees",
4207
5218
  functionName: "updateMetadata",
4208
5219
  kind: "mutation",
4209
- inputProjection: worktreeInput
4210
- }
5220
+ inputProjection: worktreeMetadataInput
5221
+ },
5222
+ args: worktreeMetadataArgs
4211
5223
  }),
4212
5224
  surfaceContract({
4213
5225
  name: "merge",
@@ -4222,12 +5234,15 @@ var worktreesContracts = [
4222
5234
  module: "worktrees",
4223
5235
  functionName: "complete",
4224
5236
  kind: "mutation",
4225
- inputProjection: (input) => ({
4226
- ...worktreeInput(input),
4227
- keyFindings: input.keyFindings ?? [input.summary ?? "Merged worktree"],
4228
- decisionsReached: input.decisionsReached ?? [],
4229
- nextSteps: input.nextSteps ?? []
4230
- })
5237
+ inputProjection: (input, context) => withUserId(
5238
+ {
5239
+ ...worktreeIdInput(input),
5240
+ keyFindings: mergeKeyFindingsInput(input),
5241
+ decisionsReached: input.decisionsReached ?? [],
5242
+ nextSteps: input.nextSteps ?? []
5243
+ },
5244
+ context
5245
+ )
4231
5246
  }
4232
5247
  }),
4233
5248
  surfaceContract({
@@ -4243,12 +5258,9 @@ var worktreesContracts = [
4243
5258
  module: "worktrees",
4244
5259
  functionName: "updateMetadata",
4245
5260
  kind: "mutation",
4246
- inputProjection: (input) => ({
4247
- ...worktreeInput(input),
4248
- lastPushTargetContext: input.targetContext,
4249
- lastPushBeliefIds: input.beliefIds
4250
- })
4251
- }
5261
+ inputProjection: worktreeMetadataInput
5262
+ },
5263
+ args: pushArgs
4252
5264
  }),
4253
5265
  surfaceContract({
4254
5266
  name: "open_pull_request",
@@ -4263,12 +5275,9 @@ var worktreesContracts = [
4263
5275
  module: "worktrees",
4264
5276
  functionName: "updateMetadata",
4265
5277
  kind: "mutation",
4266
- inputProjection: (input) => ({
4267
- ...worktreeInput(input),
4268
- lastPullRequestSummary: input.summary,
4269
- lastPullRequestReviewers: input.reviewers
4270
- })
4271
- }
5278
+ inputProjection: worktreeMetadataInput
5279
+ },
5280
+ args: openPullRequestArgs
4272
5281
  })
4273
5282
  ];
4274
5283