@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
@@ -1,4 +1,5 @@
1
1
  import { z } from 'zod';
2
+ import { v } from 'convex/values';
2
3
 
3
4
  // src/function-registry/helpers.ts
4
5
 
@@ -14,7 +15,7 @@ var LENS_PERSPECTIVE_TYPES = [
14
15
  // src/tool-contracts.ts
15
16
  var CREATE_BELIEF = {
16
17
  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.",
18
+ 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
19
  parameters: {
19
20
  canonicalText: {
20
21
  type: "string",
@@ -26,7 +27,7 @@ var CREATE_BELIEF = {
26
27
  },
27
28
  baseRate: {
28
29
  type: "number",
29
- description: "Required prior probability used to seed the vacuous opinion `(0, 0, 1, a)` at creation time."
30
+ description: "Prior probability used to seed the vacuous opinion `(0, 0, 1, a)` at creation time. Defaults to 0.5 when omitted."
30
31
  },
31
32
  beliefType: {
32
33
  type: "string",
@@ -37,7 +38,7 @@ var CREATE_BELIEF = {
37
38
  description: "Optional extra metadata merged into the node (e.g., { codeAnchors: ['path/to/file.ts'] } for coding intelligence)"
38
39
  }
39
40
  },
40
- required: ["canonicalText", "baseRate"],
41
+ required: ["canonicalText"],
41
42
  response: {
42
43
  description: "The created canonical belief record",
43
44
  fields: {
@@ -100,7 +101,7 @@ var REFINE_BELIEF = {
100
101
  };
101
102
  var MODULATE_CONFIDENCE = {
102
103
  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.",
104
+ 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
105
  parameters: {
105
106
  nodeId: { type: "string", description: "The belief to score" },
106
107
  belief: {
@@ -119,9 +120,9 @@ var MODULATE_CONFIDENCE = {
119
120
  type: "number",
120
121
  description: "Subjective-logic base rate `a` in [0, 1]. Required for tuple payloads."
121
122
  },
122
- confidence: {
123
- type: "number",
124
- description: "Deprecated scalar confidence value in [0, 1]. Scalar-only payloads are rejected as AMBIGUOUS_SCALAR."
123
+ worktreeId: {
124
+ type: "string",
125
+ description: "Completed worktree that tested this belief when confidence policy requires merge-backed scoring."
125
126
  },
126
127
  trigger: {
127
128
  type: "string",
@@ -136,17 +137,43 @@ var MODULATE_CONFIDENCE = {
136
137
  "worktree_completed",
137
138
  "fusion",
138
139
  "discount",
139
- "deduction",
140
- "manual",
141
- "decay"
140
+ "deduction"
142
141
  ]
143
142
  },
143
+ triggeringEvidenceId: {
144
+ type: "string",
145
+ description: "Evidence node that caused an evidence-triggered modulation"
146
+ },
147
+ triggeringQuestionId: {
148
+ type: "string",
149
+ description: "Answered question whose resolution supports this modulation"
150
+ },
151
+ triggeringAnswerId: {
152
+ type: "string",
153
+ description: "Answer node whose content supports this modulation"
154
+ },
155
+ triggeringContradictionId: {
156
+ type: "string",
157
+ description: "Contradiction record that caused a contradiction-triggered modulation"
158
+ },
159
+ triggeringWorktreeId: {
160
+ type: "string",
161
+ description: "Completed worktree whose outcome caused a worktree-triggered modulation"
162
+ },
144
163
  rationale: {
145
164
  type: "string",
146
165
  description: "Human-readable explanation of why confidence changed"
147
166
  }
148
167
  },
149
- required: ["nodeId", "trigger", "rationale"],
168
+ required: [
169
+ "nodeId",
170
+ "belief",
171
+ "disbelief",
172
+ "uncertainty",
173
+ "baseRate",
174
+ "trigger",
175
+ "rationale"
176
+ ],
150
177
  response: {
151
178
  description: "Confidence modulation result",
152
179
  fields: {
@@ -340,7 +367,7 @@ var ADD_EVIDENCE = {
340
367
  description: "Optional extra metadata merged into the node (e.g., { codeAnchors: ['path/to/file.ts'], failedApproach: true } for coding intelligence)"
341
368
  }
342
369
  },
343
- required: ["canonicalText", "targetNodeId"],
370
+ required: ["canonicalText", "targetNodeId", "reasoning"],
344
371
  response: {
345
372
  description: "The created evidence node and its edge",
346
373
  fields: {
@@ -396,7 +423,22 @@ var ADD_WORKTREE = {
396
423
  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
424
  parameters: {
398
425
  title: { type: "string", description: "Worktree name/objective" },
399
- topicId: { type: "string", description: "Optional topic scope hint" },
426
+ name: {
427
+ type: "string",
428
+ description: "Optional storage-name alias for callers that already use backend naming"
429
+ },
430
+ projectId: {
431
+ type: "string",
432
+ description: "Legacy topicId alias or resolver hint"
433
+ },
434
+ topicId: {
435
+ type: "string",
436
+ description: "Optional topic scope hint for resolver validation"
437
+ },
438
+ topicHint: {
439
+ type: "string",
440
+ description: "Natural-language topic hint for automatic topic resolution"
441
+ },
400
442
  branchId: {
401
443
  type: "string",
402
444
  description: "The branch this worktree investigates"
@@ -409,21 +451,122 @@ var ADD_WORKTREE = {
409
451
  type: "string",
410
452
  description: "The testable claim this worktree investigates"
411
453
  },
454
+ rationale: {
455
+ type: "string",
456
+ description: "Why this worktree exists and why it belongs in the campaign"
457
+ },
458
+ worktreeType: {
459
+ type: "string",
460
+ description: "Schema-enum worktree type used by the kernel lifecycle and retrieval layers"
461
+ },
462
+ gate: {
463
+ type: "string",
464
+ description: "Exit gate name for this worktree"
465
+ },
466
+ startDate: {
467
+ type: "number",
468
+ description: "Planned start timestamp in milliseconds since epoch"
469
+ },
470
+ endDate: {
471
+ type: "number",
472
+ description: "Planned end timestamp in milliseconds since epoch"
473
+ },
474
+ durationWeeks: {
475
+ type: "number",
476
+ description: "Planned duration in weeks"
477
+ },
478
+ confidenceImpact: {
479
+ type: "string",
480
+ description: "Expected confidence impact if the worktree succeeds",
481
+ enum: ["high", "medium", "low"]
482
+ },
483
+ beliefFocus: {
484
+ type: "string",
485
+ description: "Natural-language focus spanning the target belief neighborhood"
486
+ },
412
487
  beliefIds: {
413
488
  type: "array",
414
- description: "Beliefs to test in this worktree"
489
+ description: "Legacy alias for targetBeliefIds"
490
+ },
491
+ beliefs: {
492
+ type: "array",
493
+ description: "Legacy alias for targetBeliefIds"
494
+ },
495
+ targetBeliefIds: {
496
+ type: "array",
497
+ description: "Belief node IDs this worktree is expected to test or update"
498
+ },
499
+ targetQuestionIds: {
500
+ type: "array",
501
+ description: "Question node IDs this worktree is expected to answer"
502
+ },
503
+ keyQuestions: {
504
+ type: "array",
505
+ description: "Inline key question objects with question, optional status, answer, answerConfidence, and linkedQuestionId"
506
+ },
507
+ evidenceSignals: {
508
+ type: "array",
509
+ description: "Evidence signal objects with signal, optional collected state, progress, and notes"
510
+ },
511
+ decisionGate: {
512
+ type: "object",
513
+ description: "Decision gate object with goCriteria, noGoSignals, optional verdict, rationale, decidedAt, and decidedBy"
514
+ },
515
+ goCriteria: {
516
+ type: "array",
517
+ description: "Shorthand go criteria used to build decisionGate"
518
+ },
519
+ noGoSignals: {
520
+ type: "array",
521
+ description: "Shorthand no-go signals used to build decisionGate"
522
+ },
523
+ proofArtifacts: {
524
+ type: "array",
525
+ description: "Expected proof artifacts required to close the worktree"
415
526
  },
416
527
  autoShape: {
417
528
  type: "boolean",
418
529
  description: "Whether to invoke inquiry auto-shaping during worktree creation"
419
530
  },
531
+ autoFixPolicy: {
532
+ type: "object",
533
+ description: "Policy for permitted automatic remediation inside the worktree"
534
+ },
420
535
  domainPackId: {
421
536
  type: "string",
422
537
  description: "Optional domain pack whose shaping hooks should influence generated questions and tasks"
423
538
  },
424
- executionOrder: {
539
+ tags: {
540
+ type: "array",
541
+ description: "Additional topic-resolution tags for the worktree"
542
+ },
543
+ touchedPaths: {
544
+ type: "array",
545
+ description: "File paths used as topic-resolution signals"
546
+ },
547
+ sourceRef: {
548
+ type: "string",
549
+ description: "Source reference used as a topic-resolution signal"
550
+ },
551
+ sourceKind: {
552
+ type: "string",
553
+ description: "Source kind used as a topic-resolution signal"
554
+ },
555
+ campaign: {
425
556
  type: "number",
426
- description: "Global execution order for this worktree"
557
+ description: "Top-level pipeline campaign number. Campaigns define the outer execution slice."
558
+ },
559
+ lane: {
560
+ type: "string",
561
+ description: "GitButler-aligned workstream lane name inside the campaign."
562
+ },
563
+ laneOrderInCampaign: {
564
+ type: "number",
565
+ description: "Ordering for this lane within its campaign."
566
+ },
567
+ orderInLane: {
568
+ type: "number",
569
+ description: "Position of this worktree inside its lane."
427
570
  },
428
571
  dependsOn: {
429
572
  type: "array",
@@ -433,12 +576,20 @@ var ADD_WORKTREE = {
433
576
  type: "array",
434
577
  description: "Worktree IDs blocked by this worktree"
435
578
  },
436
- gate: {
579
+ staffingHint: {
437
580
  type: "string",
438
- description: "Exit gate name for this worktree"
581
+ description: "Suggested staffing or agent allocation note"
582
+ },
583
+ lensId: {
584
+ type: "string",
585
+ description: "Lens that scopes this worktree when applicable"
586
+ },
587
+ lastReconciledAt: {
588
+ type: "number",
589
+ description: "Timestamp when worktree metadata was last reconciled"
439
590
  }
440
591
  },
441
- required: ["title", "topicId"],
592
+ required: ["title"],
442
593
  response: {
443
594
  description: "The created worktree",
444
595
  fields: {
@@ -465,7 +616,7 @@ var MERGE = {
465
616
  worktreeId: { type: "string", description: "The worktree to merge" },
466
617
  outcomes: {
467
618
  type: "array",
468
- description: "Scoring outcomes for each belief: { beliefId, confidence, rationale }"
619
+ description: "Merge outcomes as key-finding strings, or scoring outcomes for beliefs: { beliefId, confidence, rationale }"
469
620
  },
470
621
  summary: { type: "string", description: "Overall findings summary" }
471
622
  },
@@ -683,19 +834,23 @@ var FIND_CONTRADICTIONS = {
683
834
  };
684
835
  var CREATE_EDGE = {
685
836
  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).",
837
+ 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
838
  parameters: {
688
- sourceId: {
689
- type: "string",
690
- description: "Source node of the relationship"
839
+ from: {
840
+ type: "object",
841
+ description: "Source graph ref, e.g. { kind: 'epistemic_node', nodeId: '...', nodeType: 'topic' }"
691
842
  },
692
- targetId: {
693
- type: "string",
694
- description: "Target node of the relationship"
843
+ to: {
844
+ type: "object",
845
+ description: "Target graph ref, e.g. { kind: 'epistemic_node', nodeId: '...', nodeType: 'belief' }"
695
846
  },
696
847
  edgeType: {
697
848
  type: "string",
698
- description: "Relationship type (informs, tests, depends_on, supersedes, etc.)"
849
+ description: "Relationship type from the public epistemic edge enum."
850
+ },
851
+ globalId: {
852
+ type: "string",
853
+ description: "Optional idempotent edge global ID."
699
854
  },
700
855
  weight: {
701
856
  type: "number",
@@ -706,9 +861,13 @@ var CREATE_EDGE = {
706
861
  type: "string",
707
862
  description: "How this was determined",
708
863
  enum: ["deductive", "inductive", "abductive", "analogical", "empirical"]
864
+ },
865
+ metadata: {
866
+ type: "object",
867
+ description: "Optional edge metadata."
709
868
  }
710
869
  },
711
- required: ["sourceId", "targetId", "edgeType"],
870
+ required: ["from", "to", "edgeType"],
712
871
  response: {
713
872
  description: "The created edge",
714
873
  fields: {
@@ -722,6 +881,240 @@ var CREATE_EDGE = {
722
881
  ontologyPrimitive: "edge",
723
882
  tier: "showcase"
724
883
  };
884
+ var UPDATE_EDGE = {
885
+ name: "update_edge",
886
+ description: "Amend metadata on an existing graph edge. Like `git commit --amend` \u2014 changes the edge annotation without recreating the relationship.",
887
+ parameters: {
888
+ edgeId: { type: "string", description: "Edge ID or global ID to update" },
889
+ weight: { type: "number", description: "Updated edge weight" },
890
+ confidence: { type: "number", description: "Updated confidence" },
891
+ context: { type: "string", description: "Updated human-readable context" },
892
+ derivationType: { type: "string", description: "Updated derivation type" },
893
+ metadata: { type: "object", description: "Updated metadata" }
894
+ },
895
+ required: ["edgeId"],
896
+ response: {
897
+ description: "Edge update result",
898
+ fields: { success: "boolean" }
899
+ },
900
+ ownerModule: "graph-primitives",
901
+ ontologyPrimitive: "edge",
902
+ tier: "workhorse"
903
+ };
904
+ var REMOVE_EDGE = {
905
+ name: "remove_edge",
906
+ description: "Remove one graph edge by ID. Like `git rm` \u2014 deletes a single explicit relationship from the spine.",
907
+ parameters: {
908
+ edgeId: { type: "string", description: "Edge ID or global ID to remove" }
909
+ },
910
+ required: ["edgeId"],
911
+ response: {
912
+ description: "Edge removal result",
913
+ fields: { success: "boolean" }
914
+ },
915
+ ownerModule: "graph-primitives",
916
+ ontologyPrimitive: "edge",
917
+ tier: "workhorse"
918
+ };
919
+ var REMOVE_EDGES_BETWEEN = {
920
+ name: "remove_edges_between",
921
+ description: "Remove graph edges between two nodes. Like `git rm <pathspec>` \u2014 deletes relationships matching a source, target, and optional type.",
922
+ parameters: {
923
+ fromNodeId: { type: "string", description: "Source node ID or global ID" },
924
+ toNodeId: { type: "string", description: "Target node ID or global ID" },
925
+ edgeType: { type: "string", description: "Optional edge type filter" }
926
+ },
927
+ required: ["fromNodeId", "toNodeId"],
928
+ response: {
929
+ description: "Matched edge removal result",
930
+ fields: { deleted: "number" }
931
+ },
932
+ ownerModule: "graph-primitives",
933
+ ontologyPrimitive: "edge",
934
+ tier: "workhorse"
935
+ };
936
+ var BATCH_CREATE_EDGES = {
937
+ name: "batch_create_edges",
938
+ description: "Commit multiple typed graph edges. Like `git commit` with many staged paths \u2014 writes a batch of explicit relationships atomically per edge.",
939
+ parameters: {
940
+ edges: {
941
+ type: "array",
942
+ description: "Edges to create, each with from, to, edgeType, and optional weight/confidence/context."
943
+ },
944
+ skipLayerValidation: {
945
+ type: "boolean",
946
+ description: "Skip kernel layer validation for trusted materialization flows."
947
+ }
948
+ },
949
+ required: ["edges"],
950
+ response: {
951
+ description: "Batch edge creation result",
952
+ fields: {
953
+ created: "number",
954
+ results: "array",
955
+ errors: "array"
956
+ }
957
+ },
958
+ ownerModule: "graph-primitives",
959
+ ontologyPrimitive: "edge",
960
+ tier: "workhorse"
961
+ };
962
+ var CREATE_EPISTEMIC_NODE = {
963
+ name: "create_epistemic_node",
964
+ 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.",
965
+ parameters: {
966
+ globalId: { type: "string", description: "Optional idempotent node global ID" },
967
+ nodeType: { type: "string", description: "Public epistemic node type" },
968
+ canonicalText: { type: "string", description: "Canonical node text" },
969
+ text: { type: "string", description: "Alias for canonicalText" },
970
+ contentHash: { type: "string", description: "Optional idempotency content hash" },
971
+ sourceType: { type: "string", description: "Source type for provenance" },
972
+ topicId: { type: "string", description: "Optional topic scope" },
973
+ content: { type: "string", description: "Extended content" },
974
+ title: { type: "string", description: "Display title" },
975
+ metadata: { type: "object", description: "Optional node metadata" }
976
+ },
977
+ required: ["nodeType"],
978
+ response: {
979
+ description: "Created node result",
980
+ fields: {
981
+ nodeId: "string",
982
+ nodeGlobalId: "string",
983
+ isDuplicate: "boolean"
984
+ }
985
+ },
986
+ ownerModule: "reasoning-kernel",
987
+ ontologyPrimitive: "graph",
988
+ tier: "showcase"
989
+ };
990
+ var GET_EPISTEMIC_NODE = {
991
+ name: "get_epistemic_node",
992
+ description: "Read one epistemic graph node. Like `git show` \u2014 resolves a canonical spine node by ID or global ID.",
993
+ parameters: {
994
+ nodeId: { type: "string", description: "Node ID or global ID" }
995
+ },
996
+ required: ["nodeId"],
997
+ response: {
998
+ description: "The resolved node",
999
+ fields: { node: "object" }
1000
+ },
1001
+ ownerModule: "reasoning-kernel",
1002
+ ontologyPrimitive: "graph",
1003
+ tier: "workhorse"
1004
+ };
1005
+ var LIST_EPISTEMIC_NODES = {
1006
+ name: "list_epistemic_nodes",
1007
+ description: "List epistemic graph nodes. Like `git ls-tree` \u2014 lists canonical spine nodes by topic, type, status, or search query.",
1008
+ parameters: {
1009
+ topicId: { type: "string", description: "Optional topic scope" },
1010
+ nodeType: { type: "string", description: "Optional node type filter" },
1011
+ status: { type: "string", description: "Optional lifecycle status" },
1012
+ searchQuery: { type: "string", description: "Optional text search query" },
1013
+ limit: { type: "number", description: "Maximum nodes to return" }
1014
+ },
1015
+ required: [],
1016
+ response: {
1017
+ description: "Matching nodes",
1018
+ fields: { nodes: "array" }
1019
+ },
1020
+ ownerModule: "reasoning-kernel",
1021
+ ontologyPrimitive: "graph",
1022
+ tier: "workhorse"
1023
+ };
1024
+ var UPDATE_EPISTEMIC_NODE = {
1025
+ name: "update_epistemic_node",
1026
+ description: "Amend an epistemic graph node. Like `git commit --amend` \u2014 updates mutable node metadata, text, status, or verification fields.",
1027
+ parameters: {
1028
+ nodeId: { type: "string", description: "Node ID or global ID" },
1029
+ canonicalText: { type: "string", description: "Updated canonical text" },
1030
+ text: { type: "string", description: "Alias for canonicalText" },
1031
+ contentHash: { type: "string", description: "Updated content hash" },
1032
+ content: { type: "string", description: "Updated content" },
1033
+ title: { type: "string", description: "Updated display title" },
1034
+ metadata: { type: "object", description: "Updated metadata" },
1035
+ confidence: { type: "number", description: "Updated confidence" },
1036
+ verificationStatus: { type: "string", description: "Updated verification status" },
1037
+ status: { type: "string", description: "Updated lifecycle status" }
1038
+ },
1039
+ required: ["nodeId"],
1040
+ response: {
1041
+ description: "Node update result",
1042
+ fields: { success: "boolean" }
1043
+ },
1044
+ ownerModule: "reasoning-kernel",
1045
+ ontologyPrimitive: "graph",
1046
+ tier: "workhorse"
1047
+ };
1048
+ var ARCHIVE_EPISTEMIC_NODE = {
1049
+ name: "archive_epistemic_node",
1050
+ description: "Archive an epistemic graph node. Like `git rm --cached` \u2014 removes a node from active traversal without hard-deleting it.",
1051
+ parameters: {
1052
+ nodeId: { type: "string", description: "Node ID or global ID" }
1053
+ },
1054
+ required: ["nodeId"],
1055
+ response: {
1056
+ description: "Archive result",
1057
+ fields: { success: "boolean", effectiveStatus: "string" }
1058
+ },
1059
+ ownerModule: "reasoning-kernel",
1060
+ ontologyPrimitive: "graph",
1061
+ tier: "workhorse"
1062
+ };
1063
+ var VERIFY_EPISTEMIC_NODE = {
1064
+ name: "verify_epistemic_node",
1065
+ description: "Record verification state on an epistemic graph node. Like `git tag` \u2014 marks the node with a reviewed verification state.",
1066
+ parameters: {
1067
+ nodeId: { type: "string", description: "Node ID or global ID" },
1068
+ verificationStatus: { type: "string", description: "Verification status" },
1069
+ confidence: { type: "number", description: "Optional confidence update" }
1070
+ },
1071
+ required: ["nodeId", "verificationStatus"],
1072
+ response: {
1073
+ description: "Verification result",
1074
+ fields: { success: "boolean" }
1075
+ },
1076
+ ownerModule: "reasoning-kernel",
1077
+ ontologyPrimitive: "graph",
1078
+ tier: "workhorse"
1079
+ };
1080
+ var SUPERSEDE_EPISTEMIC_NODE = {
1081
+ name: "supersede_epistemic_node",
1082
+ 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.",
1083
+ parameters: {
1084
+ oldNodeId: { type: "string", description: "Node ID or global ID to supersede" },
1085
+ newGlobalId: { type: "string", description: "Optional replacement global ID" },
1086
+ newCanonicalText: { type: "string", description: "Replacement canonical text" },
1087
+ text: { type: "string", description: "Alias for newCanonicalText" },
1088
+ newContentHash: { type: "string", description: "Optional replacement content hash" },
1089
+ reason: { type: "string", description: "Reason for superseding" }
1090
+ },
1091
+ required: ["oldNodeId"],
1092
+ response: {
1093
+ description: "Supersede result",
1094
+ fields: { oldNodeId: "string", newNodeId: "string" }
1095
+ },
1096
+ ownerModule: "reasoning-kernel",
1097
+ ontologyPrimitive: "graph",
1098
+ tier: "workhorse"
1099
+ };
1100
+ var BATCH_CREATE_EPISTEMIC_NODES = {
1101
+ name: "batch_create_epistemic_nodes",
1102
+ description: "Commit multiple epistemic graph nodes. Like `git commit` with many staged files \u2014 writes a batch of canonical spine nodes.",
1103
+ parameters: {
1104
+ nodes: {
1105
+ type: "array",
1106
+ description: "Nodes to create with nodeType, canonicalText/text, and optional metadata."
1107
+ }
1108
+ },
1109
+ required: ["nodes"],
1110
+ response: {
1111
+ description: "Batch node creation result",
1112
+ fields: { created: "number", results: "array" }
1113
+ },
1114
+ ownerModule: "reasoning-kernel",
1115
+ ontologyPrimitive: "graph",
1116
+ tier: "workhorse"
1117
+ };
725
1118
  var RECORD_JUDGMENT = {
726
1119
  name: "record_judgment",
727
1120
  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 +1412,74 @@ var GET_GRAPH_STRUCTURE_ANALYSIS = {
1019
1412
  ontologyPrimitive: "graph",
1020
1413
  tier: "showcase"
1021
1414
  };
1415
+ var LIST_GRAPH_INTELLIGENCE_QUERIES = {
1416
+ name: "list_graph_intelligence_queries",
1417
+ 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.",
1418
+ parameters: {
1419
+ categoryId: {
1420
+ type: "string",
1421
+ description: "Optional category filter, such as problems or strategic"
1422
+ },
1423
+ mode: {
1424
+ type: "string",
1425
+ description: "Optional mode filter: core, bias, stress, operational, alpha, semantic, or evidence"
1426
+ }
1427
+ },
1428
+ required: [],
1429
+ response: {
1430
+ description: "Graph Intelligence query catalog and mode-to-tool mapping",
1431
+ fields: {
1432
+ categories: "array \u2014 query categories",
1433
+ queries: "array \u2014 query definitions with prompt templates and tools",
1434
+ quickQueries: "array \u2014 recommended one-click query presets",
1435
+ publicToolNamesByMode: "object \u2014 public tool names available to each Graph Intelligence mode"
1436
+ }
1437
+ },
1438
+ ownerModule: "graph-intelligence",
1439
+ ontologyPrimitive: "graph",
1440
+ tier: "showcase"
1441
+ };
1442
+ var RUN_GRAPH_INTELLIGENCE_QUERY = {
1443
+ name: "run_graph_intelligence_query",
1444
+ 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.",
1445
+ parameters: {
1446
+ topicId: { type: "string", description: "Topic to analyze" },
1447
+ queryId: {
1448
+ type: "string",
1449
+ description: "Graph Intelligence query ID, such as confirmation-bias, pre-mortem, or thesis-summary"
1450
+ },
1451
+ prompt: {
1452
+ type: "string",
1453
+ description: "Optional custom prompt for custom analysis runs"
1454
+ },
1455
+ input: {
1456
+ type: "string",
1457
+ description: "Optional entity, theme, belief, company, or search text for input-driven queries"
1458
+ },
1459
+ mode: {
1460
+ type: "string",
1461
+ description: "Optional mode override: core, bias, stress, operational, alpha, semantic, or evidence"
1462
+ },
1463
+ limit: {
1464
+ type: "number",
1465
+ description: "Maximum graph context rows to return"
1466
+ }
1467
+ },
1468
+ required: ["topicId"],
1469
+ response: {
1470
+ description: "Graph Intelligence query result bundle ready for model or prompt-library synthesis",
1471
+ fields: {
1472
+ query: "object \u2014 selected query definition",
1473
+ prompt: "string \u2014 resolved prompt template",
1474
+ toolPlan: "array \u2014 public tools and args the model can call next",
1475
+ analysis: "object \u2014 structure, coverage, gap, and confirmation-bias analysis",
1476
+ context: "object \u2014 sampled beliefs, questions, evidence, edges, and contradictions"
1477
+ }
1478
+ },
1479
+ ownerModule: "graph-intelligence",
1480
+ ontologyPrimitive: "graph",
1481
+ tier: "showcase"
1482
+ };
1022
1483
  var GET_FALSIFICATION_QUESTIONS = {
1023
1484
  name: "get_falsification_questions",
1024
1485
  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 +1542,10 @@ var CREATE_EVIDENCE = {
1081
1542
  type: "object",
1082
1543
  description: "Optional metadata merged into the canonical evidence node"
1083
1544
  },
1545
+ rationale: {
1546
+ type: "string",
1547
+ description: "Why this evidence should enter the reasoning graph"
1548
+ },
1084
1549
  title: { type: "string", description: "Optional short title" },
1085
1550
  content: { type: "string", description: "Optional long-form content" },
1086
1551
  contentType: {
@@ -1089,7 +1554,7 @@ var CREATE_EVIDENCE = {
1089
1554
  },
1090
1555
  kind: { type: "string", description: "Optional evidence kind" }
1091
1556
  },
1092
- required: ["text"],
1557
+ required: ["text", "rationale"],
1093
1558
  response: {
1094
1559
  description: "The created canonical evidence record",
1095
1560
  fields: {
@@ -1137,7 +1602,7 @@ var LIST_EVIDENCE = {
1137
1602
  limit: { type: "number", description: "Max results" },
1138
1603
  cursor: { type: "string", description: "Pagination cursor" }
1139
1604
  },
1140
- required: [],
1605
+ required: ["topicId"],
1141
1606
  response: {
1142
1607
  description: "Canonical evidence page",
1143
1608
  fields: {
@@ -1322,6 +1787,7 @@ var ANSWER_QUESTION = {
1322
1787
  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
1788
  parameters: {
1324
1789
  id: { type: "string", description: "Canonical question ID" },
1790
+ topicId: { type: "string", description: "Topic scope for the answer" },
1325
1791
  text: { type: "string", description: "Answer text" },
1326
1792
  confidence: {
1327
1793
  type: "string",
@@ -1334,7 +1800,7 @@ var ANSWER_QUESTION = {
1334
1800
  },
1335
1801
  rationale: { type: "string", description: "Why this answer is credible" }
1336
1802
  },
1337
- required: ["id", "text"],
1803
+ required: ["id", "topicId", "text"],
1338
1804
  response: {
1339
1805
  description: "Answer result",
1340
1806
  fields: {
@@ -1553,6 +2019,10 @@ var LIST_BELIEFS = {
1553
2019
  minConfidence: {
1554
2020
  type: "number",
1555
2021
  description: "Minimum confidence threshold"
2022
+ },
2023
+ limit: {
2024
+ type: "number",
2025
+ description: "Maximum results"
1556
2026
  }
1557
2027
  },
1558
2028
  required: ["topicId"],
@@ -1569,20 +2039,37 @@ var LIST_BELIEFS = {
1569
2039
  };
1570
2040
  var LIST_WORKTREES = {
1571
2041
  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.",
2042
+ 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
2043
  parameters: {
1574
2044
  topicId: { type: "string", description: "Topic scope" },
1575
2045
  status: {
1576
2046
  type: "string",
1577
2047
  description: "Filter: active, merged, abandoned",
1578
2048
  enum: ["active", "merged", "abandoned"]
2049
+ },
2050
+ groupBy: {
2051
+ type: "string",
2052
+ description: "Optional grouping mode for the response.",
2053
+ enum: ["campaign", "lane", "flat"]
2054
+ },
2055
+ lane: {
2056
+ type: "string",
2057
+ description: "Filter by GitButler-aligned lane name."
2058
+ },
2059
+ campaign: {
2060
+ type: "number",
2061
+ description: "Filter by top-level pipeline campaign number."
2062
+ },
2063
+ limit: {
2064
+ type: "number",
2065
+ description: "Maximum results to return."
1579
2066
  }
1580
2067
  },
1581
2068
  required: ["topicId"],
1582
2069
  response: {
1583
- description: "Worktrees with phase, status, belief count, and creation time",
2070
+ description: "Worktrees with lifecycle phase, campaign, lane, status, belief count, and creation time",
1584
2071
  fields: {
1585
- worktrees: "array \u2014 { worktreeId, title, phase, status, beliefCount, createdAt }"
2072
+ worktrees: "array \u2014 { worktreeId, title, phase, campaign, lane, laneOrderInCampaign, orderInLane, status, beliefCount, createdAt }"
1586
2073
  }
1587
2074
  },
1588
2075
  ownerModule: "workflow-engine",
@@ -1591,7 +2078,7 @@ var LIST_WORKTREES = {
1591
2078
  };
1592
2079
  var LIST_ALL_WORKTREES = {
1593
2080
  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.",
2081
+ 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
2082
  parameters: {
1596
2083
  status: {
1597
2084
  type: "string",
@@ -1609,13 +2096,18 @@ var LIST_ALL_WORKTREES = {
1609
2096
  "dismissed"
1610
2097
  ]
1611
2098
  },
1612
- track: {
2099
+ lane: {
1613
2100
  type: "string",
1614
- description: "Filter by track name (e.g., 'ontology', 'tc-scope', 'control-plane', 'dev-portal', 'mcp-sdk-parity')"
2101
+ description: "Filter by lane name (e.g., 'ontology', 'tc-scope', 'control-plane', 'dev-portal', 'mcp-sdk-parity')"
1615
2102
  },
1616
- executionBand: {
2103
+ campaign: {
1617
2104
  type: "number",
1618
- description: "Filter by execution band number (e.g., 1, 2, 3). Returns only worktrees in that parallel execution group."
2105
+ description: "Filter by campaign number (e.g., 1, 2, 3). Returns only worktrees in that campaign."
2106
+ },
2107
+ groupBy: {
2108
+ type: "string",
2109
+ description: "Optional grouping mode for the response.",
2110
+ enum: ["campaign", "lane", "flat"]
1619
2111
  },
1620
2112
  limit: {
1621
2113
  type: "number",
@@ -1626,10 +2118,39 @@ var LIST_ALL_WORKTREES = {
1626
2118
  response: {
1627
2119
  description: "All worktrees across all topics with full pipeline metadata",
1628
2120
  fields: {
1629
- worktrees: "array \u2014 { worktreeId, title, topicId, topicName, phase, status, hypothesis, track, trackPosition, executionBand, executionOrder, dependsOn, blocks, gate, createdAt }",
2121
+ worktrees: "array \u2014 { worktreeId, title, topicId, topicName, phase, status, hypothesis, campaign, lane, laneOrderInCampaign, orderInLane, dependsOn, blocks, gate, createdAt }",
1630
2122
  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"
2123
+ lanes: "object \u2014 { laneName: count } summary of worktrees per lane",
2124
+ campaigns: "object \u2014 { campaignNumber: count } summary of worktrees per campaign"
2125
+ }
2126
+ },
2127
+ ownerModule: "workflow-engine",
2128
+ ontologyPrimitive: "worktree",
2129
+ tier: "showcase"
2130
+ };
2131
+ var LIST_CAMPAIGNS = {
2132
+ name: "list_campaigns",
2133
+ 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.",
2134
+ parameters: {
2135
+ topicId: {
2136
+ type: "string",
2137
+ description: "Optional topic scope."
2138
+ },
2139
+ status: {
2140
+ type: "string",
2141
+ description: "Optional worktree status filter before grouping campaigns and lanes."
2142
+ },
2143
+ limit: {
2144
+ type: "number",
2145
+ description: "Maximum worktrees to scan before grouping."
2146
+ }
2147
+ },
2148
+ required: [],
2149
+ response: {
2150
+ description: "Pipeline campaigns with nested lane summaries.",
2151
+ fields: {
2152
+ campaigns: "array \u2014 { campaign, lanes: [{ lane, laneOrderInCampaign, worktreeCount, activeCount, readyCount, blockedCount, completedCount, nextWorktree }] }",
2153
+ totalWorktrees: "number \u2014 total worktrees scanned after filtering"
1633
2154
  }
1634
2155
  },
1635
2156
  ownerModule: "workflow-engine",
@@ -1692,16 +2213,28 @@ var UPDATE_WORKTREE_TARGETS = {
1692
2213
  };
1693
2214
  var UPDATE_WORKTREE_METADATA = {
1694
2215
  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.",
2216
+ 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
2217
  parameters: {
1697
2218
  worktreeId: { type: "string", description: "The worktree to update" },
1698
2219
  hypothesis: {
1699
2220
  type: "string",
1700
2221
  description: "Testable claim this worktree investigates"
1701
2222
  },
1702
- executionOrder: {
2223
+ campaign: {
2224
+ type: "number",
2225
+ description: "Top-level pipeline campaign number."
2226
+ },
2227
+ lane: {
2228
+ type: "string",
2229
+ description: "GitButler-aligned workstream lane name inside the campaign."
2230
+ },
2231
+ laneOrderInCampaign: {
2232
+ type: "number",
2233
+ description: "Ordering for this lane within the campaign."
2234
+ },
2235
+ orderInLane: {
1703
2236
  type: "number",
1704
- description: "Global execution order (1 = first, higher = later)"
2237
+ description: "Position of this worktree inside its lane."
1705
2238
  },
1706
2239
  dependsOn: {
1707
2240
  type: "array",
@@ -1739,18 +2272,6 @@ var UPDATE_WORKTREE_METADATA = {
1739
2272
  type: "object",
1740
2273
  description: "Calibrated auto-fix policy controlling dry-run vs safe execution, per-run action caps, and permitted mutation tiers."
1741
2274
  },
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
2275
  status: {
1755
2276
  type: "string",
1756
2277
  description: "Override the worktree status. Use for lifecycle transitions like marking a worktree superseded, long-term, or as a raw idea.",
@@ -1807,15 +2328,15 @@ var IDENTITY_WHOAMI = {
1807
2328
  };
1808
2329
  var COMPILE_CONTEXT = {
1809
2330
  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.",
2331
+ 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
2332
  parameters: {
1812
2333
  topicId: {
1813
2334
  type: "string",
1814
- description: "Topic scope ID to compile"
2335
+ description: "Optional topic scope ID. Omit to resolve the topic from query."
1815
2336
  },
1816
2337
  query: {
1817
2338
  type: "string",
1818
- description: "Optional focus query used to rank context items"
2339
+ description: "Focus query used to resolve the topic and rank context items. Required when topicId is omitted."
1819
2340
  },
1820
2341
  budget: {
1821
2342
  type: "number",
@@ -1839,7 +2360,7 @@ var COMPILE_CONTEXT = {
1839
2360
  description: "Include related ontological entities in the compiled result"
1840
2361
  }
1841
2362
  },
1842
- required: ["topicId"],
2363
+ required: [],
1843
2364
  response: {
1844
2365
  description: "Compiled context pack for the requested topic",
1845
2366
  fields: {
@@ -2013,18 +2534,60 @@ var CREATE_TASK = {
2013
2534
  name: "create_task",
2014
2535
  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
2536
  parameters: {
2016
- title: { type: "string", description: "Task description" },
2537
+ title: { type: "string", description: "Task title" },
2017
2538
  topicId: { type: "string", description: "Topic scope" },
2539
+ description: {
2540
+ type: "string",
2541
+ description: "Long-form task description"
2542
+ },
2018
2543
  taskType: {
2019
2544
  type: "string",
2020
- description: "Type: research, interview, analysis, data_collection",
2021
- enum: ["research", "interview", "analysis", "data_collection"]
2545
+ description: "Task taxonomy",
2546
+ enum: [
2547
+ "general",
2548
+ "find_evidence",
2549
+ "verify_claim",
2550
+ "research",
2551
+ "review",
2552
+ "interview",
2553
+ "analysis",
2554
+ "track_metrics"
2555
+ ]
2556
+ },
2557
+ priority: {
2558
+ type: "string",
2559
+ description: "Priority",
2560
+ enum: ["urgent", "high", "medium", "low"]
2561
+ },
2562
+ status: {
2563
+ type: "string",
2564
+ description: "Initial status (defaults to todo)",
2565
+ enum: ["todo", "in_progress", "blocked", "done"]
2566
+ },
2567
+ linkedWorktreeId: {
2568
+ type: "string",
2569
+ description: "Worktree this task belongs to"
2570
+ },
2571
+ linkedBeliefId: {
2572
+ type: "string",
2573
+ description: "Belief this task supports"
2022
2574
  },
2023
2575
  linkedQuestionId: {
2024
2576
  type: "string",
2025
2577
  description: "Question this task addresses"
2026
2578
  },
2027
- linkedWorktreeId: { type: "string", description: "Worktree scope" }
2579
+ assigneeId: {
2580
+ type: "string",
2581
+ description: "Principal assigned to the task"
2582
+ },
2583
+ dueDate: {
2584
+ type: "number",
2585
+ description: "Due date as epoch milliseconds"
2586
+ },
2587
+ tags: {
2588
+ type: "array",
2589
+ description: "Free-form string tags"
2590
+ }
2028
2591
  },
2029
2592
  required: ["title"],
2030
2593
  response: {
@@ -2120,6 +2683,10 @@ var LIST_TASKS = {
2120
2683
  type: "string",
2121
2684
  description: "Filter to tasks linked to this worktree"
2122
2685
  },
2686
+ worktreeId: {
2687
+ type: "string",
2688
+ description: "Alias for linkedWorktreeId"
2689
+ },
2123
2690
  status: {
2124
2691
  type: "string",
2125
2692
  description: "Filter by status: todo, in_progress, blocked, done",
@@ -2140,6 +2707,10 @@ var CREATE_TOPIC = {
2140
2707
  name: "create_topic",
2141
2708
  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
2709
  parameters: {
2710
+ globalId: {
2711
+ type: "string",
2712
+ description: "Optional idempotent topic global ID"
2713
+ },
2143
2714
  name: { type: "string", description: "Topic name" },
2144
2715
  type: {
2145
2716
  type: "string",
@@ -2150,6 +2721,18 @@ var CREATE_TOPIC = {
2150
2721
  type: "string",
2151
2722
  description: "Optional parent topic for nesting"
2152
2723
  },
2724
+ parentTopicGlobalId: {
2725
+ type: "string",
2726
+ description: "Optional parent topic global ID for nesting"
2727
+ },
2728
+ tenantId: { type: "string", description: "Optional tenant scope" },
2729
+ workspaceId: { type: "string", description: "Optional workspace scope" },
2730
+ visibility: {
2731
+ type: "string",
2732
+ description: "Topic visibility",
2733
+ enum: ["private", "team", "firm", "external", "public"]
2734
+ },
2735
+ metadata: { type: "object", description: "Optional topic metadata" },
2153
2736
  createdBy: { type: "string", description: "Who created this topic" }
2154
2737
  },
2155
2738
  required: ["name", "type"],
@@ -2158,6 +2741,9 @@ var CREATE_TOPIC = {
2158
2741
  fields: {
2159
2742
  id: "string \u2014 topic ID",
2160
2743
  globalId: "string \u2014 globally unique ID",
2744
+ topicGlobalId: "string \u2014 topic global ID",
2745
+ epistemicNodeId: "string \u2014 materialized topic node ID",
2746
+ epistemicNodeGlobalId: "string \u2014 materialized topic node global ID",
2161
2747
  depth: "number \u2014 nesting depth"
2162
2748
  }
2163
2749
  },
@@ -2207,7 +2793,7 @@ var GET_TOPIC = {
2207
2793
  description: "Legacy alias for topicId"
2208
2794
  }
2209
2795
  },
2210
- required: [],
2796
+ required: ["topicId"],
2211
2797
  response: {
2212
2798
  description: "Single topic record",
2213
2799
  fields: {
@@ -2288,6 +2874,65 @@ var GET_TOPIC_TREE = {
2288
2874
  ontologyPrimitive: "graph",
2289
2875
  tier: "workhorse"
2290
2876
  };
2877
+ var MATERIALIZE_TOPIC_GRAPH = {
2878
+ name: "materialize_topic_graph",
2879
+ description: "Backfill the topic graph spine. Like `git fsck --connectivity-only` with repair enabled \u2014 creates missing topic nodes and parent-child edges idempotently.",
2880
+ parameters: {
2881
+ rootTopicId: {
2882
+ type: "string",
2883
+ description: "Optional root topic for a bounded materialization pass"
2884
+ },
2885
+ dryRun: {
2886
+ type: "boolean",
2887
+ description: "When true, report missing rows without writing them"
2888
+ }
2889
+ },
2890
+ required: [],
2891
+ response: {
2892
+ description: "Topic graph materialization counts",
2893
+ fields: {
2894
+ topicsSeen: "number",
2895
+ nodesCreated: "number",
2896
+ nodesExisting: "number",
2897
+ edgesCreated: "number",
2898
+ edgesExisting: "number",
2899
+ errors: "array"
2900
+ }
2901
+ },
2902
+ ownerModule: "reasoning-kernel",
2903
+ ontologyPrimitive: "graph",
2904
+ tier: "workhorse"
2905
+ };
2906
+ var GET_TOPIC_GRAPH_SPINE = {
2907
+ name: "get_topic_graph_spine",
2908
+ description: "Verify the topic graph spine. Like `git fsck` \u2014 reads topics, materialized topic nodes, parent-child edges, and missing spine rows.",
2909
+ parameters: {
2910
+ rootTopicId: {
2911
+ type: "string",
2912
+ description: "Optional root topic for a bounded verifier pass"
2913
+ },
2914
+ includeTopicBeliefEdges: {
2915
+ type: "boolean",
2916
+ description: "Include topic -> belief edges in the verifier payload"
2917
+ }
2918
+ },
2919
+ required: [],
2920
+ response: {
2921
+ description: "Topic graph spine verification payload",
2922
+ fields: {
2923
+ ok: "boolean",
2924
+ counts: "object",
2925
+ topics: "array",
2926
+ topicNodes: "array",
2927
+ parentEdges: "array",
2928
+ missingTopicNodes: "array",
2929
+ missingParentEdges: "array"
2930
+ }
2931
+ },
2932
+ ownerModule: "reasoning-kernel",
2933
+ ontologyPrimitive: "graph",
2934
+ tier: "workhorse"
2935
+ };
2291
2936
  var GET_CODE_CONTEXT = {
2292
2937
  name: "get_code_context",
2293
2938
  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 +3207,7 @@ var GET_ONTOLOGY = {
2562
3207
  description: "Tenant scope for key lookup. Omit for platform-level."
2563
3208
  }
2564
3209
  },
2565
- required: [],
3210
+ required: ["id"],
2566
3211
  response: {
2567
3212
  description: "Ontology definition with latest published version",
2568
3213
  fields: {
@@ -2629,7 +3274,7 @@ var MATCH_ENTITY_TYPE = {
2629
3274
  description: "Optional maximum number of ranked matches to return"
2630
3275
  }
2631
3276
  },
2632
- required: ["text"],
3277
+ required: ["text", "ontologyId"],
2633
3278
  response: {
2634
3279
  description: "Ranked ontology entity type matches",
2635
3280
  fields: {
@@ -2883,7 +3528,7 @@ var RECORD_SCOPE_LEARNING = {
2883
3528
  };
2884
3529
  var PIPELINE_SNAPSHOT = {
2885
3530
  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.",
3531
+ 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
3532
  parameters: {
2888
3533
  topicId: { type: "string", description: "Topic scope ID" }
2889
3534
  },
@@ -2893,14 +3538,14 @@ var PIPELINE_SNAPSHOT = {
2893
3538
  fields: {
2894
3539
  topicId: "string",
2895
3540
  topicName: "string",
2896
- currentBand: "number | null",
2897
- nextBand: "number | null",
3541
+ currentCampaign: "number | null",
3542
+ nextCampaign: "number | null",
2898
3543
  activeWorktrees: "array \u2014 current hinge worktree(s)",
2899
- nextWave: "array \u2014 worktrees in the next planned band",
3544
+ nextWave: "array \u2014 worktrees in the next planned campaign",
2900
3545
  readyNow: "array \u2014 planning worktrees with dependencies completed",
2901
3546
  blockedBy: "array \u2014 grouped blockers",
2902
3547
  criticalPath: "array \u2014 ordered incomplete worktree chain",
2903
- bands: "array \u2014 incomplete worktrees grouped by executionBand",
3548
+ campaigns: "array \u2014 incomplete worktrees grouped by campaign",
2904
3549
  superseded: "array \u2014 worktrees marked superseded or not for activation",
2905
3550
  graphHygiene: "object \u2014 untargeted and taskless worktree debt",
2906
3551
  riskQuestions: "array \u2014 critical/high open questions",
@@ -3420,6 +4065,69 @@ var GENERATE_SESSION_HANDOFF = {
3420
4065
  tier: "showcase",
3421
4066
  internal: true
3422
4067
  };
4068
+ var BEGIN_BUILD_SESSION = {
4069
+ name: "begin_build_session",
4070
+ 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.",
4071
+ parameters: {
4072
+ worktreeId: {
4073
+ type: "string",
4074
+ description: "The Lucern worktree ID to bootstrap."
4075
+ },
4076
+ branch: {
4077
+ type: "string",
4078
+ description: "Optional git branch name. Auto-generated from the worktree name when omitted."
4079
+ },
4080
+ branchBase: {
4081
+ type: "string",
4082
+ description: 'Base branch for the feature branch. Default: "staging".'
4083
+ },
4084
+ prBase: {
4085
+ type: "string",
4086
+ description: 'Target branch for the PR. Default: "staging".'
4087
+ },
4088
+ sessionMode: {
4089
+ type: "string",
4090
+ description: 'Session mode: "async" for Codex/headless or "interactive" for live sessions.',
4091
+ enum: ["async", "interactive"]
4092
+ },
4093
+ activateIfPlanning: {
4094
+ type: "boolean",
4095
+ description: "When true, automatically activate a planning worktree during bootstrap."
4096
+ }
4097
+ },
4098
+ required: ["worktreeId"],
4099
+ response: {
4100
+ description: "A compact build-session packet with worktree metadata, graph anchors, questions, dependencies, and git defaults.",
4101
+ fields: {
4102
+ topicId: "string \u2014 canonical topic scope",
4103
+ topicName: "string \u2014 human-readable topic name",
4104
+ worktreeId: "string \u2014 worktree ID",
4105
+ worktreeName: "string \u2014 human-readable worktree name",
4106
+ branch: "string \u2014 git branch name",
4107
+ branchBase: "string \u2014 base branch",
4108
+ prBase: "string \u2014 PR target branch",
4109
+ campaign: "number | null \u2014 top-level pipeline campaign",
4110
+ lane: "string \u2014 campaign lane",
4111
+ gate: "string \u2014 exit gate",
4112
+ hypothesis: "string \u2014 worktree hypothesis",
4113
+ focus: "string \u2014 session focus",
4114
+ status: "string \u2014 worktree status after optional activation",
4115
+ sessionMode: "string \u2014 async | interactive",
4116
+ targetBeliefIds: "array \u2014 scoped belief IDs",
4117
+ targetQuestionIds: "array \u2014 scoped question IDs",
4118
+ topBeliefs: "array \u2014 highest-confidence scoped beliefs",
4119
+ openQuestions: "array \u2014 open scoped questions",
4120
+ resolvedDecisions: "array \u2014 answered questions summarized for the session",
4121
+ dependencies: "array \u2014 upstream worktrees",
4122
+ unblocks: "array \u2014 downstream worktrees",
4123
+ mergeOrderNotes: "string \u2014 merge ordering advisory"
4124
+ }
4125
+ },
4126
+ ownerModule: "bootstrap",
4127
+ ontologyPrimitive: "worktree",
4128
+ tier: "showcase",
4129
+ internal: true
4130
+ };
3423
4131
  var MCP_TOOL_CONTRACTS = {
3424
4132
  // Belief lifecycle (commit, amend, fork, archive)
3425
4133
  create_belief: CREATE_BELIEF,
@@ -3462,11 +4170,26 @@ var MCP_TOOL_CONTRACTS = {
3462
4170
  bisect_confidence: BISECT_CONFIDENCE,
3463
4171
  // Edges (commit)
3464
4172
  create_edge: CREATE_EDGE,
4173
+ update_edge: UPDATE_EDGE,
4174
+ remove_edge: REMOVE_EDGE,
4175
+ remove_edges_between: REMOVE_EDGES_BETWEEN,
4176
+ batch_create_edges: BATCH_CREATE_EDGES,
4177
+ // Epistemic node spine (commit/amend/show)
4178
+ create_epistemic_node: CREATE_EPISTEMIC_NODE,
4179
+ get_epistemic_node: GET_EPISTEMIC_NODE,
4180
+ list_epistemic_nodes: LIST_EPISTEMIC_NODES,
4181
+ update_epistemic_node: UPDATE_EPISTEMIC_NODE,
4182
+ archive_epistemic_node: ARCHIVE_EPISTEMIC_NODE,
4183
+ verify_epistemic_node: VERIFY_EPISTEMIC_NODE,
4184
+ supersede_epistemic_node: SUPERSEDE_EPISTEMIC_NODE,
4185
+ batch_create_epistemic_nodes: BATCH_CREATE_EPISTEMIC_NODES,
3465
4186
  // Judgments (tag)
3466
4187
  record_judgment: RECORD_JUDGMENT,
3467
4188
  // Graph intelligence (showcase)
3468
4189
  detect_confirmation_bias: DETECT_CONFIRMATION_BIAS,
3469
4190
  get_graph_structure_analysis: GET_GRAPH_STRUCTURE_ANALYSIS,
4191
+ list_graph_intelligence_queries: LIST_GRAPH_INTELLIGENCE_QUERIES,
4192
+ run_graph_intelligence_query: RUN_GRAPH_INTELLIGENCE_QUERY,
3470
4193
  get_falsification_questions: GET_FALSIFICATION_QUESTIONS,
3471
4194
  // Evidence operations (workhorse)
3472
4195
  search_evidence: SEARCH_EVIDENCE,
@@ -3489,6 +4212,7 @@ var MCP_TOOL_CONTRACTS = {
3489
4212
  list_beliefs: LIST_BELIEFS,
3490
4213
  list_worktrees: LIST_WORKTREES,
3491
4214
  list_all_worktrees: LIST_ALL_WORKTREES,
4215
+ list_campaigns: LIST_CAMPAIGNS,
3492
4216
  activate_worktree: ACTIVATE_WORKTREE,
3493
4217
  update_worktree_targets: UPDATE_WORKTREE_TARGETS,
3494
4218
  update_worktree_metadata: UPDATE_WORKTREE_METADATA,
@@ -3512,6 +4236,7 @@ var MCP_TOOL_CONTRACTS = {
3512
4236
  get_agent_inbox: GET_AGENT_INBOX,
3513
4237
  claim_files: CLAIM_FILES,
3514
4238
  generate_session_handoff: GENERATE_SESSION_HANDOFF,
4239
+ begin_build_session: BEGIN_BUILD_SESSION,
3515
4240
  // Policy / ACL (workhorse)
3516
4241
  check_permission: CHECK_PERMISSION,
3517
4242
  filter_by_permission: FILTER_BY_PERMISSION,
@@ -3531,6 +4256,8 @@ var MCP_TOOL_CONTRACTS = {
3531
4256
  get_topic: GET_TOPIC,
3532
4257
  update_topic: UPDATE_TOPIC,
3533
4258
  get_topic_tree: GET_TOPIC_TREE,
4259
+ materialize_topic_graph: MATERIALIZE_TOPIC_GRAPH,
4260
+ get_topic_graph_spine: GET_TOPIC_GRAPH_SPINE,
3534
4261
  // Coding intelligence (code-grounded knowledge)
3535
4262
  get_code_context: GET_CODE_CONTEXT,
3536
4263
  get_change_history: GET_CHANGE_HISTORY,
@@ -3635,18 +4362,34 @@ var MCP_CORE_OPERATION_NAMES = [
3635
4362
  "find_missing_questions",
3636
4363
  "get_high_priority_questions",
3637
4364
  "get_falsification_questions",
4365
+ "create_epistemic_node",
4366
+ "get_epistemic_node",
4367
+ "list_epistemic_nodes",
4368
+ "update_epistemic_node",
4369
+ "archive_epistemic_node",
4370
+ "verify_epistemic_node",
4371
+ "supersede_epistemic_node",
4372
+ "batch_create_epistemic_nodes",
3638
4373
  "create_topic",
3639
4374
  "get_topic",
3640
4375
  "list_topics",
3641
4376
  "update_topic",
3642
- "get_topic_tree"
4377
+ "get_topic_tree",
4378
+ "materialize_topic_graph",
4379
+ "get_topic_graph_spine"
3643
4380
  ];
3644
4381
  var MCP_ANALYSIS_PLATFORM_OPERATION_NAMES = [
3645
4382
  "create_edge",
4383
+ "update_edge",
4384
+ "remove_edge",
4385
+ "remove_edges_between",
4386
+ "batch_create_edges",
3646
4387
  "query_lineage",
3647
4388
  "traverse_graph",
3648
4389
  "get_graph_neighborhood",
3649
4390
  "get_graph_structure_analysis",
4391
+ "list_graph_intelligence_queries",
4392
+ "run_graph_intelligence_query",
3650
4393
  "find_contradictions",
3651
4394
  "flag_contradiction",
3652
4395
  "detect_confirmation_bias",
@@ -3671,6 +4414,7 @@ var MCP_WORKFLOW_PLATFORM_OPERATION_NAMES = [
3671
4414
  "activate_worktree",
3672
4415
  "list_worktrees",
3673
4416
  "list_all_worktrees",
4417
+ "list_campaigns",
3674
4418
  "update_worktree_targets",
3675
4419
  "update_worktree_metadata",
3676
4420
  "create_task",
@@ -3724,6 +4468,7 @@ var PLATFORM_INTERNAL_OPERATION_NAMES = [
3724
4468
  "get_change_history",
3725
4469
  "get_failure_log",
3726
4470
  "record_attempt",
4471
+ "begin_build_session",
3727
4472
  "push",
3728
4473
  "open_pull_request",
3729
4474
  "record_judgment",
@@ -3778,7 +4523,6 @@ var SDK_ONLY_OPERATION_NAMES = [
3778
4523
  "find_semantic_orphans"
3779
4524
  ];
3780
4525
  var MCP_ONLY_INTERNAL_OPERATION_NAMES = [
3781
- "begin_build_session",
3782
4526
  "evaluate_engineering_contract",
3783
4527
  "evaluate_research_contract"
3784
4528
  ];
@@ -3878,6 +4622,7 @@ var LUCERN_OPERATION_MANIFEST = {
3878
4622
 
3879
4623
  // src/function-registry/helpers.ts
3880
4624
  var jsonObjectSchema = z.record(z.unknown());
4625
+ var sdkSessionIdSchema = z.string().optional();
3881
4626
  function mcpContractShape(contract) {
3882
4627
  const required = new Set(contract.required);
3883
4628
  return Object.fromEntries(
@@ -3912,10 +4657,40 @@ function argsSchemaFromMcpContract(contract) {
3912
4657
  return z.object(mcpContractShape(contract));
3913
4658
  }
3914
4659
  function inputSchemaFromMcpContract(contract) {
3915
- return argsSchemaFromMcpContract(contract).passthrough();
4660
+ return withInternalSurfaceFields(argsSchemaFromMcpContract(contract));
4661
+ }
4662
+ function withInternalSurfaceFields(schema) {
4663
+ return schema.extend({ __sdkSessionId: sdkSessionIdSchema }).strict();
4664
+ }
4665
+ function normalizeInputSchema(schema) {
4666
+ if (schema instanceof z.ZodObject) {
4667
+ return withInternalSurfaceFields(schema);
4668
+ }
4669
+ return schema;
4670
+ }
4671
+ function unwrapObjectSchema(schema) {
4672
+ let current = schema;
4673
+ while (true) {
4674
+ switch (current._def.typeName) {
4675
+ case z.ZodFirstPartyTypeKind.ZodEffects:
4676
+ current = current._def.schema;
4677
+ continue;
4678
+ case z.ZodFirstPartyTypeKind.ZodBranded:
4679
+ current = current._def.type;
4680
+ continue;
4681
+ default:
4682
+ return current instanceof z.ZodObject ? current : void 0;
4683
+ }
4684
+ }
3916
4685
  }
3917
4686
  function getObjectShape(schema) {
3918
- const shape = typeof schema._def.shape === "function" ? schema._def.shape() : schema._def.shape;
4687
+ const objectSchema = unwrapObjectSchema(schema);
4688
+ if (!objectSchema) {
4689
+ throw new Error(
4690
+ `Expected a Zod object schema, received ${schema._def.typeName}.`
4691
+ );
4692
+ }
4693
+ const shape = typeof objectSchema._def.shape === "function" ? objectSchema._def.shape() : objectSchema._def.shape;
3919
4694
  return shape;
3920
4695
  }
3921
4696
  function unwrapMcpParameterSchema(schema) {
@@ -3936,6 +4711,9 @@ function unwrapMcpParameterSchema(schema) {
3936
4711
  case z.ZodFirstPartyTypeKind.ZodBranded:
3937
4712
  current = current._def.type;
3938
4713
  continue;
4714
+ case z.ZodFirstPartyTypeKind.ZodEffects:
4715
+ current = current._def.schema;
4716
+ continue;
3939
4717
  default:
3940
4718
  return { schema: current, required, description: description ?? current.description };
3941
4719
  }
@@ -3955,6 +4733,7 @@ function mcpParameterFromZod(fieldName, schema, contractName) {
3955
4733
  return { parameter: { type: "array", description }, required };
3956
4734
  case z.ZodFirstPartyTypeKind.ZodObject:
3957
4735
  case z.ZodFirstPartyTypeKind.ZodRecord:
4736
+ case z.ZodFirstPartyTypeKind.ZodDiscriminatedUnion:
3958
4737
  return { parameter: { type: "object", description }, required };
3959
4738
  case z.ZodFirstPartyTypeKind.ZodEnum:
3960
4739
  return {
@@ -3998,8 +4777,11 @@ function mcpContractFromArgsSchema(base, args, contractName) {
3998
4777
  required: converted.filter(([, field]) => field.required).map(([fieldName]) => fieldName)
3999
4778
  };
4000
4779
  }
4001
- function defineFunctionContract(contract) {
4002
- return contract;
4780
+ var defineFunctionContract = (contract) => contract;
4781
+ function compactRecord(input) {
4782
+ return Object.fromEntries(
4783
+ Object.entries(input).filter(([, value]) => value !== void 0)
4784
+ );
4003
4785
  }
4004
4786
  function surfaceMcpContract(name) {
4005
4787
  const contract = MCP_TOOL_CONTRACTS[name];
@@ -4045,7 +4827,9 @@ function surfaceContract(args) {
4045
4827
  const canonicalArgs = args.args ?? argsSchemaFromMcpContract(baseMcp);
4046
4828
  const mcp = args.args ? mcpContractFromArgsSchema(baseMcp, canonicalArgs, args.name) : baseMcp;
4047
4829
  const canonicalReturns = args.returns ?? jsonObjectSchema;
4048
- const input = args.input ?? inputSchemaFromMcpContract(mcp);
4830
+ const input = normalizeInputSchema(
4831
+ args.input ?? inputSchemaFromMcpContract(mcp)
4832
+ );
4049
4833
  const output = args.output ?? canonicalReturns;
4050
4834
  return defineFunctionContract({
4051
4835
  name: args.name,
@@ -4089,11 +4873,109 @@ function surfaceContract(args) {
4089
4873
  });
4090
4874
  }
4091
4875
 
4876
+ // src/projections/projection-dsl.ts
4877
+ function defineProjection(def) {
4878
+ return def;
4879
+ }
4880
+
4881
+ // src/projections/list-tasks.projection.ts
4882
+ var taskStatusSchema = z.enum(["todo", "in_progress", "blocked", "done"]).optional().describe("Filter by task status");
4883
+ var listTasksInputSchema = z.object({
4884
+ topicId: z.string().describe("Topic scope"),
4885
+ worktreeId: z.string().optional().describe("Alias for linkedWorktreeId"),
4886
+ linkedWorktreeId: z.string().optional().describe("Filter to tasks linked to this worktree"),
4887
+ status: taskStatusSchema,
4888
+ limit: z.number().optional().describe("Maximum results")
4889
+ });
4890
+ function compactRecord2(input) {
4891
+ return Object.fromEntries(
4892
+ Object.entries(input).filter(([, value]) => value !== void 0)
4893
+ );
4894
+ }
4895
+ var listTasksProjection = defineProjection({
4896
+ contractName: "list_tasks",
4897
+ inputSchema: listTasksInputSchema,
4898
+ project: (input) => compactRecord2({
4899
+ topicId: input.topicId,
4900
+ status: input.status,
4901
+ userId: void 0,
4902
+ limit: input.limit,
4903
+ linkedWorktreeId: input.linkedWorktreeId ?? input.worktreeId
4904
+ }),
4905
+ convexArgsValidator: v.object({
4906
+ topicId: v.string(),
4907
+ status: v.optional(
4908
+ v.union(
4909
+ v.literal("todo"),
4910
+ v.literal("in_progress"),
4911
+ v.literal("blocked"),
4912
+ v.literal("done")
4913
+ )
4914
+ ),
4915
+ limit: v.optional(v.number()),
4916
+ linkedWorktreeId: v.optional(v.string())
4917
+ })
4918
+ });
4919
+
4092
4920
  // src/function-registry/tasks.ts
4093
- var taskInput = (input) => ({
4921
+ var taskPrioritySchema = z.enum(["urgent", "high", "medium", "low"]);
4922
+ var taskStatusSchema2 = z.enum(["todo", "in_progress", "blocked", "done"]);
4923
+ var taskTypeSchema = z.enum([
4924
+ "general",
4925
+ "find_evidence",
4926
+ "verify_claim",
4927
+ "research",
4928
+ "review",
4929
+ "interview",
4930
+ "analysis",
4931
+ "track_metrics"
4932
+ ]);
4933
+ var createTaskArgs = z.object({
4934
+ title: z.string().describe("Task title."),
4935
+ topicId: z.string().optional().describe("Topic scope."),
4936
+ description: z.string().optional().describe("Long-form task description."),
4937
+ taskType: taskTypeSchema.optional().describe("Task taxonomy."),
4938
+ priority: taskPrioritySchema.optional().describe("Priority. Defaults to medium when omitted by the server."),
4939
+ status: taskStatusSchema2.optional().describe("Initial status. Defaults to todo."),
4940
+ linkedWorktreeId: z.string().optional().describe("Worktree this task belongs to."),
4941
+ linkedBeliefId: z.string().optional().describe("Belief this task supports."),
4942
+ linkedQuestionId: z.string().optional().describe("Question this task addresses."),
4943
+ assigneeId: z.string().optional().describe("Principal assigned to the task."),
4944
+ dueDate: z.number().optional().describe("Due date as epoch milliseconds."),
4945
+ tags: z.array(z.string()).optional().describe("Free-form tags.")
4946
+ });
4947
+ var createTaskInput = (input) => compactRecord({
4948
+ title: input.title,
4949
+ topicId: input.topicId,
4950
+ description: input.description,
4951
+ taskType: input.taskType,
4952
+ priority: input.priority ?? "medium",
4953
+ status: input.status ?? "todo",
4954
+ linkedWorktreeId: input.linkedWorktreeId,
4955
+ linkedBeliefId: input.linkedBeliefId,
4956
+ linkedQuestionId: input.linkedQuestionId,
4957
+ assigneeId: input.assigneeId,
4958
+ dueDate: input.dueDate,
4959
+ tags: input.tags
4960
+ });
4961
+ var taskInput = (input) => compactRecord({
4094
4962
  ...input,
4095
4963
  taskId: input.taskId ?? input.id
4096
4964
  });
4965
+ var taskTopicInput = (input) => {
4966
+ const parsed = listTasksProjection.inputSchema.safeParse(input);
4967
+ if (!parsed.success) {
4968
+ throw new Error(
4969
+ `list_tasks projection input rejected: ${parsed.error.message}`
4970
+ );
4971
+ }
4972
+ return compactRecord(listTasksProjection.project(parsed.data));
4973
+ };
4974
+ var completeTaskInput = (input) => compactRecord({
4975
+ taskId: input.taskId ?? input.id,
4976
+ outputSummary: input.outputSummary ?? input.summary,
4977
+ userId: input.userId
4978
+ });
4097
4979
  var tasksContracts = [
4098
4980
  surfaceContract({
4099
4981
  name: "create_task",
@@ -4107,8 +4989,10 @@ var tasksContracts = [
4107
4989
  convex: {
4108
4990
  module: "tasks",
4109
4991
  functionName: "create",
4110
- kind: "mutation"
4111
- }
4992
+ kind: "mutation",
4993
+ inputProjection: createTaskInput
4994
+ },
4995
+ args: createTaskArgs
4112
4996
  }),
4113
4997
  surfaceContract({
4114
4998
  name: "list_tasks",
@@ -4123,8 +5007,10 @@ var tasksContracts = [
4123
5007
  convex: {
4124
5008
  module: "tasks",
4125
5009
  functionName: "getByTopic",
4126
- kind: "query"
4127
- }
5010
+ kind: "query",
5011
+ inputProjection: taskTopicInput
5012
+ },
5013
+ args: listTasksInputSchema
4128
5014
  }),
4129
5015
  surfaceContract({
4130
5016
  name: "update_task",
@@ -4156,7 +5042,7 @@ var tasksContracts = [
4156
5042
  module: "tasks",
4157
5043
  functionName: "complete",
4158
5044
  kind: "mutation",
4159
- inputProjection: taskInput
5045
+ inputProjection: completeTaskInput
4160
5046
  }
4161
5047
  })
4162
5048
  ];