@lucern/contracts 1.0.0 → 1.0.1

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 (213) hide show
  1. package/CHANGELOG.md +4 -1
  2. package/dist/dsl.d.ts +75 -4
  3. package/dist/dsl.values-rhsroqi0.d.ts +21 -0
  4. package/dist/dsl.values.d.ts +5 -0
  5. package/dist/dsl.values.js +675 -0
  6. package/dist/dsl.values.js.map +1 -0
  7. package/dist/function-registry/beliefs.d.ts +1 -17
  8. package/dist/function-registry/beliefs.js +155 -117
  9. package/dist/function-registry/beliefs.js.map +1 -1
  10. package/dist/function-registry/coding.d.ts +1 -17
  11. package/dist/function-registry/coding.js +155 -117
  12. package/dist/function-registry/coding.js.map +1 -1
  13. package/dist/function-registry/context.d.ts +1 -17
  14. package/dist/function-registry/context.js +155 -117
  15. package/dist/function-registry/context.js.map +1 -1
  16. package/dist/function-registry/contracts.d.ts +1 -17
  17. package/dist/function-registry/contracts.js +155 -117
  18. package/dist/function-registry/contracts.js.map +1 -1
  19. package/dist/function-registry/coordination.d.ts +1 -17
  20. package/dist/function-registry/coordination.js +155 -117
  21. package/dist/function-registry/coordination.js.map +1 -1
  22. package/dist/function-registry/edges.d.ts +1 -17
  23. package/dist/function-registry/edges.js +155 -117
  24. package/dist/function-registry/edges.js.map +1 -1
  25. package/dist/function-registry/evidence.d.ts +1 -17
  26. package/dist/function-registry/evidence.js +155 -117
  27. package/dist/function-registry/evidence.js.map +1 -1
  28. package/dist/function-registry/graph.d.ts +1 -17
  29. package/dist/function-registry/graph.js +155 -117
  30. package/dist/function-registry/graph.js.map +1 -1
  31. package/dist/function-registry/helpers.d.ts +1 -1
  32. package/dist/function-registry/helpers.js +155 -117
  33. package/dist/function-registry/helpers.js.map +1 -1
  34. package/dist/function-registry/identity.d.ts +1 -17
  35. package/dist/function-registry/identity.js +155 -117
  36. package/dist/function-registry/identity.js.map +1 -1
  37. package/dist/function-registry/index.d.ts +1 -1
  38. package/dist/function-registry/index.js +158 -118
  39. package/dist/function-registry/index.js.map +1 -1
  40. package/dist/function-registry/judgments.d.ts +1 -17
  41. package/dist/function-registry/judgments.js +155 -117
  42. package/dist/function-registry/judgments.js.map +1 -1
  43. package/dist/function-registry/legacy.d.ts +1 -17
  44. package/dist/function-registry/legacy.js +155 -117
  45. package/dist/function-registry/legacy.js.map +1 -1
  46. package/dist/function-registry/lenses.d.ts +1 -17
  47. package/dist/function-registry/lenses.js +155 -117
  48. package/dist/function-registry/lenses.js.map +1 -1
  49. package/dist/function-registry/manifest.d.ts +3 -3
  50. package/dist/function-registry/manifest.js +1 -0
  51. package/dist/function-registry/manifest.js.map +1 -1
  52. package/dist/function-registry/nodes.d.ts +1 -17
  53. package/dist/function-registry/nodes.js +155 -117
  54. package/dist/function-registry/nodes.js.map +1 -1
  55. package/dist/function-registry/ontologies.d.ts +1 -17
  56. package/dist/function-registry/ontologies.js +155 -117
  57. package/dist/function-registry/ontologies.js.map +1 -1
  58. package/dist/function-registry/pipeline.d.ts +1 -17
  59. package/dist/function-registry/pipeline.js +155 -117
  60. package/dist/function-registry/pipeline.js.map +1 -1
  61. package/dist/function-registry/questions.d.ts +1 -17
  62. package/dist/function-registry/questions.js +155 -117
  63. package/dist/function-registry/questions.js.map +1 -1
  64. package/dist/function-registry/tasks.d.ts +1 -17
  65. package/dist/function-registry/tasks.js +155 -117
  66. package/dist/function-registry/tasks.js.map +1 -1
  67. package/dist/function-registry/topics.d.ts +1 -17
  68. package/dist/function-registry/topics.js +155 -117
  69. package/dist/function-registry/topics.js.map +1 -1
  70. package/dist/function-registry/types.d.ts +2 -2
  71. package/dist/function-registry/worktrees.d.ts +41 -17
  72. package/dist/function-registry/worktrees.js +174 -117
  73. package/dist/function-registry/worktrees.js.map +1 -1
  74. package/dist/generated/lucernWebPublicEnv.js.map +1 -1
  75. package/dist/generated/lucernWebServerEnv.js.map +1 -1
  76. package/dist/{idOf-DR8tkhQS.d.ts → idOf-BmkVDhD8.d.ts} +1 -1
  77. package/dist/index.d.ts +47 -8
  78. package/dist/index.js +45072 -45005
  79. package/dist/index.js.map +1 -1
  80. package/dist/infisical-runtime.base.d.ts +444 -0
  81. package/dist/infisical-runtime.base.js +640 -0
  82. package/dist/infisical-runtime.base.js.map +1 -0
  83. package/dist/infisical-runtime.contract.d.ts +9 -440
  84. package/dist/infisical-runtime.contract.js +14 -1
  85. package/dist/infisical-runtime.contract.js.map +1 -1
  86. package/dist/infisical-runtime.platform-ops-secrets.d.ts +743 -0
  87. package/dist/infisical-runtime.platform-ops-secrets.js +962 -0
  88. package/dist/infisical-runtime.platform-ops-secrets.js.map +1 -0
  89. package/dist/infisical-runtime.platform-secrets.d.ts +598 -0
  90. package/dist/infisical-runtime.platform-secrets.js +726 -0
  91. package/dist/infisical-runtime.platform-secrets.js.map +1 -0
  92. package/dist/infisical-runtime.tenant-secrets.d.ts +486 -0
  93. package/dist/infisical-runtime.tenant-secrets.js +1131 -0
  94. package/dist/infisical-runtime.tenant-secrets.js.map +1 -0
  95. package/dist/manifests/edge-policy-manifest.d.ts +1 -1
  96. package/dist/manifests/infisical-runtime-manifest.d.ts +1 -1
  97. package/dist/manifests/infisical-runtime-manifest.js +14 -1
  98. package/dist/manifests/infisical-runtime-manifest.js.map +1 -1
  99. package/dist/manifests/tenant-client-manifest.d.ts +5 -1
  100. package/dist/manifests/tenant-client-manifest.js +5 -0
  101. package/dist/manifests/tenant-client-manifest.js.map +1 -1
  102. package/dist/proof-attestation.json +1 -1
  103. package/dist/schemas/index.d.ts +1 -1
  104. package/dist/schemas/index.js.map +1 -1
  105. package/dist/schemas/manifest.d.ts +61 -61
  106. package/dist/schemas/manifest.js.map +1 -1
  107. package/dist/schemas/tables/kernel/config.js.map +1 -1
  108. package/dist/schemas/tables/kernel/coordination.js.map +1 -1
  109. package/dist/schemas/tables/kernel/decision.d.ts +1 -1
  110. package/dist/schemas/tables/kernel/decision.js.map +1 -1
  111. package/dist/schemas/tables/kernel/embedding.d.ts +1 -1
  112. package/dist/schemas/tables/kernel/embedding.js.map +1 -1
  113. package/dist/schemas/tables/kernel/epistemic.d.ts +1 -1
  114. package/dist/schemas/tables/kernel/epistemic.js.map +1 -1
  115. package/dist/schemas/tables/kernel/idempotency.js.map +1 -1
  116. package/dist/schemas/tables/kernel/infra.js.map +1 -1
  117. package/dist/schemas/tables/kernel/intelligence.d.ts +1 -1
  118. package/dist/schemas/tables/kernel/intelligence.js.map +1 -1
  119. package/dist/schemas/tables/kernel/lens.d.ts +5 -5
  120. package/dist/schemas/tables/kernel/lens.js.map +1 -1
  121. package/dist/schemas/tables/kernel/ontology.d.ts +1 -1
  122. package/dist/schemas/tables/kernel/ontology.js.map +1 -1
  123. package/dist/schemas/tables/kernel/platform.js.map +1 -1
  124. package/dist/schemas/tables/kernel/spine.d.ts +1 -1
  125. package/dist/schemas/tables/kernel/spine.js.map +1 -1
  126. package/dist/schemas/tables/kernel/task.d.ts +1 -1
  127. package/dist/schemas/tables/kernel/task.js.map +1 -1
  128. package/dist/schemas/tables/kernel/topic.d.ts +1 -1
  129. package/dist/schemas/tables/kernel/topic.js.map +1 -1
  130. package/dist/schemas/tables/kernel/workflow.d.ts +1 -1
  131. package/dist/schemas/tables/kernel/workflow.js.map +1 -1
  132. package/dist/schemas/tables/kernel/worktree.d.ts +1 -1
  133. package/dist/schemas/tables/kernel/worktree.js.map +1 -1
  134. package/dist/schemas/tables/mc/identity.d.ts +1 -1
  135. package/dist/schemas/tables/mc/methodology.d.ts +1 -1
  136. package/dist/schemas/tables/mc/pack.d.ts +9 -9
  137. package/dist/schemas/tables/mc/policy.d.ts +1 -1
  138. package/dist/schemas/tables/mc/registry.d.ts +1 -1
  139. package/dist/schemas/tables/mc/runtime.d.ts +1 -1
  140. package/dist/schemas/tables/mc/tenant.d.ts +1 -1
  141. package/dist/schemas/tables/mc/workspace.d.ts +1 -1
  142. package/dist/schemas.values-5J5oIK7z.d.ts +26 -0
  143. package/dist/schemas.values.d.ts +7 -0
  144. package/dist/schemas.values.js +5324 -0
  145. package/dist/schemas.values.js.map +1 -0
  146. package/dist/sdk-tools.contract.analytics.d.ts +27 -0
  147. package/dist/sdk-tools.contract.analytics.js +616 -0
  148. package/dist/sdk-tools.contract.analytics.js.map +1 -0
  149. package/dist/sdk-tools.contract.d.ts +43 -2
  150. package/dist/sdk-tools.contract.graph.d.ts +11 -0
  151. package/dist/sdk-tools.contract.graph.js +156 -0
  152. package/dist/sdk-tools.contract.graph.js.map +1 -0
  153. package/dist/sdk-tools.contract.js +4107 -4062
  154. package/dist/sdk-tools.contract.js.map +1 -1
  155. package/dist/sdk-tools.contract.registry.d.ts +25 -0
  156. package/dist/sdk-tools.contract.registry.js +5504 -0
  157. package/dist/sdk-tools.contract.registry.js.map +1 -0
  158. package/dist/sdk-tools.contract.types.d.ts +15 -0
  159. package/dist/sdk-tools.contract.types.js +3 -0
  160. package/dist/sdk-tools.contract.types.js.map +1 -0
  161. package/dist/sdk-tools.contract.values-LuBh95zg.d.ts +58 -0
  162. package/dist/sdk-tools.contract.values.d.ts +7 -0
  163. package/dist/sdk-tools.contract.values.js +5581 -0
  164. package/dist/sdk-tools.contract.values.js.map +1 -0
  165. package/dist/sdk-tools.contract.workflow.d.ts +17 -0
  166. package/dist/sdk-tools.contract.workflow.js +287 -0
  167. package/dist/sdk-tools.contract.workflow.js.map +1 -0
  168. package/dist/tenant-client.contract.d.ts +5 -1
  169. package/dist/tenant-client.contract.js +5 -0
  170. package/dist/tenant-client.contract.js.map +1 -1
  171. package/dist/tool-contracts.d.ts +34 -1
  172. package/dist/tool-contracts.graph.d.ts +18 -0
  173. package/dist/tool-contracts.graph.js +378 -0
  174. package/dist/tool-contracts.graph.js.map +1 -0
  175. package/dist/tool-contracts.intelligence-evidence.d.ts +15 -0
  176. package/dist/tool-contracts.intelligence-evidence.js +303 -0
  177. package/dist/tool-contracts.intelligence-evidence.js.map +1 -0
  178. package/dist/tool-contracts.js +155 -118
  179. package/dist/tool-contracts.js.map +1 -1
  180. package/dist/tool-contracts.lifecycle.d.ts +13 -0
  181. package/dist/tool-contracts.lifecycle.js +410 -0
  182. package/dist/tool-contracts.lifecycle.js.map +1 -0
  183. package/dist/tool-contracts.nodes-lenses.d.ts +17 -0
  184. package/dist/tool-contracts.nodes-lenses.js +334 -0
  185. package/dist/tool-contracts.nodes-lenses.js.map +1 -0
  186. package/dist/tool-contracts.ontology.d.ts +16 -0
  187. package/dist/tool-contracts.ontology.js +344 -0
  188. package/dist/tool-contracts.ontology.js.map +1 -0
  189. package/dist/tool-contracts.pipeline-coordination.d.ts +25 -0
  190. package/dist/tool-contracts.pipeline-coordination.js +684 -0
  191. package/dist/tool-contracts.pipeline-coordination.js.map +1 -0
  192. package/dist/tool-contracts.policy-observation-task-topic.d.ts +25 -0
  193. package/dist/tool-contracts.policy-observation-task-topic.js +740 -0
  194. package/dist/tool-contracts.policy-observation-task-topic.js.map +1 -0
  195. package/dist/tool-contracts.questions-listing.d.ts +27 -0
  196. package/dist/tool-contracts.questions-listing.js +782 -0
  197. package/dist/tool-contracts.questions-listing.js.map +1 -0
  198. package/dist/tool-contracts.types.d.ts +34 -0
  199. package/dist/tool-contracts.types.js +3 -0
  200. package/dist/tool-contracts.types.js.map +1 -0
  201. package/dist/tool-contracts.values-DjctSW7S.d.ts +147 -0
  202. package/dist/tool-contracts.values.d.ts +11 -0
  203. package/dist/tool-contracts.values.js +4398 -0
  204. package/dist/tool-contracts.values.js.map +1 -0
  205. package/dist/tool-contracts.worktrees.d.ts +8 -0
  206. package/dist/tool-contracts.worktrees.js +280 -0
  207. package/dist/tool-contracts.worktrees.js.map +1 -0
  208. package/package.json +3 -11
  209. package/dist/dsl-DVPthQGY.d.ts +0 -110
  210. package/dist/index-CM1Pl_vI.d.ts +0 -28
  211. package/dist/sdk-tools.contract-CKmSsrZ2.d.ts +0 -146
  212. package/dist/tool-contracts-C_xvM9q2.d.ts +0 -326
  213. package/dist/{edge-policy-manifest-Dw5IhT1L.d.ts → edge-policy-manifest-4KOSP4nk.d.ts} +2 -2
@@ -0,0 +1,4398 @@
1
+ // src/types/reasoning-method.ts
2
+ var REASONING_METHODS = [
3
+ "deductive",
4
+ "inductive",
5
+ "abductive",
6
+ "analogical",
7
+ "causal",
8
+ "correlational",
9
+ "testimonial",
10
+ "statistical",
11
+ "implicit",
12
+ "pattern_match"
13
+ ];
14
+
15
+ // src/tool-contracts.graph.ts
16
+ var QUERY_LINEAGE = {
17
+ name: "query_lineage",
18
+ description: "Trace a belief's full ancestry \u2014 every fork, score, and confidence modulation. Like `git log --graph`. Returns the complete evolution chain showing how understanding developed over time. Lineage is permanent and can never be erased (Invariant #3).",
19
+ parameters: {
20
+ nodeId: { type: "string", description: "Starting node to trace from" },
21
+ depth: {
22
+ type: "number",
23
+ description: "How many generations to traverse (default: 5)"
24
+ }
25
+ },
26
+ required: ["nodeId"],
27
+ response: {
28
+ description: "Canonical lineage result",
29
+ fields: {
30
+ beliefId: "string \u2014 canonical belief ID",
31
+ lineage: "array \u2014 ancestry entries with beliefId, nodeId, formulation, forkReason, and createdAt"
32
+ }
33
+ },
34
+ ownerModule: "graph-search",
35
+ ontologyPrimitive: "belief",
36
+ tier: "workhorse"
37
+ };
38
+ var GET_CONFIDENCE_HISTORY = {
39
+ name: "get_confidence_history",
40
+ description: "Get the full confidence history for a belief. Each entry records the confidence level, trigger, rationale, and actor. Like `git log` for a single metric \u2014 append-only, never overwritten.",
41
+ parameters: {
42
+ nodeId: { type: "string", description: "The belief to get history for" }
43
+ },
44
+ required: ["nodeId"],
45
+ response: {
46
+ description: "Confidence history entries",
47
+ fields: {
48
+ beliefId: "string \u2014 canonical belief ID",
49
+ entries: "array \u2014 { confidence, trigger, rationale, timestamp, userId }",
50
+ nextCursor: "string | null"
51
+ }
52
+ },
53
+ ownerModule: "graph-primitives",
54
+ ontologyPrimitive: "belief",
55
+ tier: "workhorse"
56
+ };
57
+ var GET_AUDIT_TRAIL = {
58
+ name: "get_audit_trail",
59
+ description: "Get the full audit trail for a node \u2014 every mutation, who made it, when, and why. Like `git blame` for knowledge. All state transitions are explicit, attributable, and permanently queryable. No silent changes are possible (Invariant #14).",
60
+ parameters: {
61
+ nodeId: { type: "string", description: "The node to audit" },
62
+ limit: {
63
+ type: "number",
64
+ description: "Maximum entries to return (default: 50)"
65
+ }
66
+ },
67
+ required: ["nodeId"],
68
+ response: {
69
+ description: "Audit trail entries",
70
+ fields: {
71
+ entries: "array \u2014 { action, actor, timestamp, before, after, rationale }"
72
+ }
73
+ },
74
+ ownerModule: "graph-primitives",
75
+ ontologyPrimitive: "graph",
76
+ tier: "workhorse"
77
+ };
78
+ var TRAVERSE_GRAPH = {
79
+ name: "traverse_graph",
80
+ description: "Walk the reasoning graph from a starting node. Like `git log --graph` \u2014 traverses connected lineage across nodes and edges. Traversal follows epistemic layers: L4 (judgments) \u2192 L3 (beliefs, questions) \u2192 L2 (evidence) \u2192 L1 (sources). Never skips layers. Use direction 'up' to trace what a piece of evidence supports, 'down' to trace what supports a judgment.",
81
+ parameters: {
82
+ startNode: { type: "string", description: "Node to start traversal from" },
83
+ direction: {
84
+ type: "string",
85
+ description: "Traversal direction",
86
+ enum: ["up", "down", "both"]
87
+ },
88
+ maxDepth: {
89
+ type: "number",
90
+ description: "Maximum traversal depth (default: 3)"
91
+ }
92
+ },
93
+ required: ["startNode"],
94
+ response: {
95
+ description: "Subgraph of traversed nodes and edges",
96
+ fields: {
97
+ nodes: "array \u2014 traversed nodes",
98
+ edges: "array \u2014 traversed edges",
99
+ depth: "number"
100
+ }
101
+ },
102
+ ownerModule: "graph-search",
103
+ ontologyPrimitive: "graph",
104
+ tier: "workhorse"
105
+ };
106
+ var GET_GRAPH_NEIGHBORHOOD = {
107
+ name: "get_graph_neighborhood",
108
+ description: "Retrieve the local neighborhood around one or more graph nodes. Like `git log --graph --boundary` for a focused reasoning window. Returns the canonical neighborhood payload shared by HTTP and SDK graph surfaces.",
109
+ parameters: {
110
+ globalId: {
111
+ type: "string",
112
+ description: "Single root node global identifier."
113
+ },
114
+ globalIds: {
115
+ type: "array",
116
+ description: "Optional list of root node global identifiers."
117
+ },
118
+ maxDepth: {
119
+ type: "number",
120
+ description: "Maximum traversal depth (default: 2)."
121
+ }
122
+ },
123
+ required: [],
124
+ response: {
125
+ description: "Canonical graph neighborhood payload",
126
+ fields: {
127
+ nodes: "array \u2014 graph nodes in the returned neighborhood",
128
+ edges: "array \u2014 graph edges in the returned neighborhood",
129
+ depth: "number \u2014 deepest traversed node depth"
130
+ }
131
+ },
132
+ ownerModule: "graph-search",
133
+ ontologyPrimitive: "graph",
134
+ tier: "workhorse"
135
+ };
136
+ var TRACE_ENTITY_IMPACT = {
137
+ name: "trace_entity_impact",
138
+ 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.",
139
+ parameters: {
140
+ nodeId: {
141
+ type: "string",
142
+ description: "Entity node ID to trace impact from"
143
+ }
144
+ },
145
+ required: ["nodeId"],
146
+ response: {
147
+ description: "Entity impact trace: direct beliefs, evidence, and indirect belief reach",
148
+ fields: {
149
+ entityNodeId: "string \u2014 the traced entity",
150
+ entityType: "string \u2014 nodeType of the entity",
151
+ directBeliefConnections: "array \u2014 beliefs directly connected via bridge edges",
152
+ evidenceConnections: "array \u2014 evidence referencing this entity",
153
+ indirectBeliefConnections: "array \u2014 beliefs reached through evidence",
154
+ totalBeliefReach: "number \u2014 total unique beliefs impacted"
155
+ }
156
+ },
157
+ ownerModule: "graph-search",
158
+ ontologyPrimitive: "graph",
159
+ tier: "workhorse"
160
+ };
161
+ var SEARCH_BELIEFS = {
162
+ name: "search_beliefs",
163
+ description: "Search for beliefs in the reasoning graph. Like `git grep` \u2014 finds relevant beliefs across the full history and active state. Supports semantic search, filtering by status (unscored, scored, archived), confidence thresholds, and topic scope. Returns beliefs with their current confidence, lineage depth, and contradiction count.",
164
+ parameters: {
165
+ query: { type: "string", description: "Semantic search query" },
166
+ status: {
167
+ type: "string",
168
+ description: "Filter by belief status",
169
+ enum: ["unscored", "scored", "archived"]
170
+ },
171
+ minConfidence: {
172
+ type: "number",
173
+ description: "Minimum confidence threshold (0-1)"
174
+ },
175
+ topicId: { type: "string", description: "Filter by topic" },
176
+ limit: { type: "number", description: "Maximum results (default: 10)" }
177
+ },
178
+ required: ["query"],
179
+ response: {
180
+ description: "Matching beliefs with metadata",
181
+ fields: {
182
+ results: "array \u2014 { nodeId, canonicalText, confidence, status, contradictionCount }"
183
+ }
184
+ },
185
+ ownerModule: "graph-search",
186
+ ontologyPrimitive: "belief",
187
+ tier: "workhorse"
188
+ };
189
+ var FIND_CONTRADICTIONS = {
190
+ name: "find_contradictions",
191
+ description: "Find contradictions in the reasoning graph \u2014 beliefs that are in tension with each other. Like a merge conflict in `git` \u2014 surfaces incompatible states that require explicit resolution. Contradictions are first-class objects that may remain permanently unresolved. They can block judgments, trigger forks, or collapse confidence. Filter by project, status (unresolved, resolved, accepted), and severity.",
192
+ parameters: {
193
+ topicId: { type: "string", description: "Filter by topic" },
194
+ nodeId: {
195
+ type: "string",
196
+ description: "Find contradictions involving a specific belief"
197
+ },
198
+ status: {
199
+ type: "string",
200
+ description: "Filter by status",
201
+ enum: ["unresolved", "resolved", "accepted"]
202
+ }
203
+ },
204
+ required: [],
205
+ response: {
206
+ description: "Contradiction objects",
207
+ fields: {
208
+ contradictions: "array \u2014 { beliefA, beliefB, description, severity, status, defeatType }"
209
+ }
210
+ },
211
+ ownerModule: "graph-search",
212
+ ontologyPrimitive: "belief",
213
+ tier: "showcase"
214
+ };
215
+ var BISECT_CONFIDENCE = {
216
+ name: "bisect_confidence",
217
+ description: "Find when a belief's confidence diverged from reality. Like `git bisect` \u2014 binary search through the credence history to find the inflection point. Given a belief that is now known to be wrong (or right), traces back through confidence modulations to identify which evidence or event caused the divergence.",
218
+ parameters: {
219
+ nodeId: { type: "string", description: "The belief to bisect" },
220
+ expectedDirection: {
221
+ type: "string",
222
+ description: "Was confidence too high or too low?",
223
+ enum: ["overconfident", "underconfident"]
224
+ },
225
+ timeRange: {
226
+ type: "object",
227
+ description: "Optional time range to search within: { start: number, end: number }"
228
+ }
229
+ },
230
+ required: ["nodeId", "expectedDirection"],
231
+ response: {
232
+ description: "The inflection point in confidence history",
233
+ fields: {
234
+ beliefId: "string \u2014 canonical belief ID",
235
+ expectedDirection: "string \u2014 overconfident | underconfident",
236
+ inflectionEntry: "object \u2014 the confidence modulation where divergence began",
237
+ triggerEvent: "string | null \u2014 what caused the divergence",
238
+ confidenceBefore: "number | null",
239
+ confidenceAfter: "number | null",
240
+ totalEntries: "number",
241
+ inflectionIndex: "number | null"
242
+ }
243
+ },
244
+ ownerModule: "graph-search",
245
+ ontologyPrimitive: "belief",
246
+ tier: "showcase"
247
+ };
248
+ var CREATE_EDGE = {
249
+ name: "create_edge",
250
+ 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.",
251
+ parameters: {
252
+ from: {
253
+ type: "object",
254
+ description: "Source graph ref, e.g. { kind: 'epistemic_node', nodeId: '...', nodeType: 'topic' }"
255
+ },
256
+ to: {
257
+ type: "object",
258
+ description: "Target graph ref, e.g. { kind: 'epistemic_node', nodeId: '...', nodeType: 'belief' }"
259
+ },
260
+ edgeType: {
261
+ type: "string",
262
+ description: "Relationship type from the public epistemic edge enum."
263
+ },
264
+ globalId: {
265
+ type: "string",
266
+ description: "Optional idempotent edge global ID."
267
+ },
268
+ weight: {
269
+ type: "number",
270
+ description: "Edge weight: -1.0 to +1.0 for informs edges, 0-1 for structural"
271
+ },
272
+ reasoning: { type: "string", description: "Why this relationship exists" },
273
+ reasoningMethod: {
274
+ type: "string",
275
+ description: "How this was determined",
276
+ enum: [...REASONING_METHODS]
277
+ },
278
+ metadata: {
279
+ type: "object",
280
+ description: "Optional edge metadata."
281
+ }
282
+ },
283
+ required: ["from", "to", "edgeType"],
284
+ response: {
285
+ description: "The created edge",
286
+ fields: {
287
+ globalId: "string \u2014 edge identifier",
288
+ edgeType: "string",
289
+ fromLayer: "string",
290
+ toLayer: "string"
291
+ }
292
+ },
293
+ ownerModule: "graph-primitives",
294
+ ontologyPrimitive: "edge",
295
+ tier: "showcase"
296
+ };
297
+ var UPDATE_EDGE = {
298
+ name: "update_edge",
299
+ description: "Amend metadata on an existing graph edge. Like `git commit --amend` \u2014 changes the edge annotation without recreating the relationship.",
300
+ parameters: {
301
+ edgeId: { type: "string", description: "Edge ID or global ID to update" },
302
+ weight: { type: "number", description: "Updated edge weight" },
303
+ confidence: { type: "number", description: "Updated confidence" },
304
+ context: { type: "string", description: "Updated human-readable context" },
305
+ derivationType: { type: "string", description: "Updated derivation type" },
306
+ metadata: { type: "object", description: "Updated metadata" }
307
+ },
308
+ required: ["edgeId"],
309
+ response: {
310
+ description: "Edge update result",
311
+ fields: { success: "boolean" }
312
+ },
313
+ ownerModule: "graph-primitives",
314
+ ontologyPrimitive: "edge",
315
+ tier: "workhorse"
316
+ };
317
+ var REMOVE_EDGE = {
318
+ name: "remove_edge",
319
+ description: "Remove one graph edge by ID. Like `git rm` \u2014 deletes a single explicit relationship from the spine.",
320
+ parameters: {
321
+ edgeId: { type: "string", description: "Edge ID or global ID to remove" }
322
+ },
323
+ required: ["edgeId"],
324
+ response: {
325
+ description: "Edge removal result",
326
+ fields: { success: "boolean" }
327
+ },
328
+ ownerModule: "graph-primitives",
329
+ ontologyPrimitive: "edge",
330
+ tier: "workhorse"
331
+ };
332
+ var REMOVE_EDGES_BETWEEN = {
333
+ name: "remove_edges_between",
334
+ description: "Remove graph edges between two nodes. Like `git rm <pathspec>` \u2014 deletes relationships matching a source, target, and optional type.",
335
+ parameters: {
336
+ fromNodeId: { type: "string", description: "Source node ID or global ID" },
337
+ toNodeId: { type: "string", description: "Target node ID or global ID" },
338
+ edgeType: { type: "string", description: "Optional edge type filter" }
339
+ },
340
+ required: ["fromNodeId", "toNodeId"],
341
+ response: {
342
+ description: "Matched edge removal result",
343
+ fields: { deleted: "number" }
344
+ },
345
+ ownerModule: "graph-primitives",
346
+ ontologyPrimitive: "edge",
347
+ tier: "workhorse"
348
+ };
349
+ var BATCH_CREATE_EDGES = {
350
+ name: "batch_create_edges",
351
+ description: "Commit multiple typed graph edges. Like `git commit` with many staged paths \u2014 writes a batch of explicit relationships atomically per edge.",
352
+ parameters: {
353
+ edges: {
354
+ type: "array",
355
+ description: "Edges to create, each with from, to, edgeType, and optional weight/confidence/context."
356
+ },
357
+ skipLayerValidation: {
358
+ type: "boolean",
359
+ description: "Skip kernel layer validation for trusted materialization flows."
360
+ }
361
+ },
362
+ required: ["edges"],
363
+ response: {
364
+ description: "Batch edge creation result",
365
+ fields: {
366
+ created: "number",
367
+ results: "array",
368
+ errors: "array"
369
+ }
370
+ },
371
+ ownerModule: "graph-primitives",
372
+ ontologyPrimitive: "edge",
373
+ tier: "workhorse"
374
+ };
375
+
376
+ // src/tool-contracts.intelligence-evidence.ts
377
+ var DETECT_CONFIRMATION_BIAS = {
378
+ name: "detect_confirmation_bias",
379
+ description: "Detect confirmation bias in the evidence graph. Like `git diff --stat` for reasoning \u2014 analyzes the ratio of supporting vs challenging evidence per belief and flags beliefs where the evidence is suspiciously one-sided. Returns risk classification (critical/high/moderate/healthy).",
380
+ parameters: {
381
+ topicId: { type: "string", description: "Topic to analyze" },
382
+ threshold: {
383
+ type: "number",
384
+ description: "Bias threshold (0-1, default 0.7)"
385
+ }
386
+ },
387
+ required: ["topicId"],
388
+ response: {
389
+ description: "Beliefs with bias scores, risk levels, and evidence counts",
390
+ fields: {
391
+ beliefs: "array \u2014 { nodeId, biasScore, riskLevel, supportingCount, challengingCount }"
392
+ }
393
+ },
394
+ ownerModule: "graph-search",
395
+ ontologyPrimitive: "graph",
396
+ tier: "showcase"
397
+ };
398
+ var GET_GRAPH_STRUCTURE_ANALYSIS = {
399
+ name: "get_graph_structure_analysis",
400
+ description: "Run comprehensive structural analysis on the knowledge graph. Like `git fsck` combined with PageRank \u2014 runs 14 algorithmic detectors including PageRank centrality, Louvain community detection, Tarjan SCC, Fiedler vector spectral analysis, Bayesian surprise, and overconfidence detection.",
401
+ parameters: {
402
+ topicId: { type: "string", description: "Topic to analyze" }
403
+ },
404
+ required: ["topicId"],
405
+ response: {
406
+ description: "Structural analysis with detector results and recommendations",
407
+ fields: {
408
+ topicId: "string \u2014 canonical topic scope",
409
+ metric: "string \u2014 analysis metric identifier",
410
+ payload: "object \u2014 detector results, recommendations, graph metrics"
411
+ }
412
+ },
413
+ ownerModule: "graph-search",
414
+ ontologyPrimitive: "graph",
415
+ tier: "showcase"
416
+ };
417
+ var LIST_GRAPH_INTELLIGENCE_QUERIES = {
418
+ name: "list_graph_intelligence_queries",
419
+ 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.",
420
+ parameters: {
421
+ categoryId: {
422
+ type: "string",
423
+ description: "Optional category filter, such as problems or strategic"
424
+ },
425
+ mode: {
426
+ type: "string",
427
+ description: "Optional mode filter: core, bias, stress, operational, alpha, semantic, or evidence"
428
+ }
429
+ },
430
+ required: [],
431
+ response: {
432
+ description: "Graph Intelligence query catalog and mode-to-tool mapping",
433
+ fields: {
434
+ categories: "array \u2014 query categories",
435
+ queries: "array \u2014 query definitions with prompt templates and tools",
436
+ quickQueries: "array \u2014 recommended one-click query presets",
437
+ publicToolNamesByMode: "object \u2014 public tool names available to each Graph Intelligence mode"
438
+ }
439
+ },
440
+ ownerModule: "graph-intelligence",
441
+ ontologyPrimitive: "graph",
442
+ tier: "showcase"
443
+ };
444
+ var RUN_GRAPH_INTELLIGENCE_QUERY = {
445
+ name: "run_graph_intelligence_query",
446
+ 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.",
447
+ parameters: {
448
+ topicId: { type: "string", description: "Topic to analyze" },
449
+ queryId: {
450
+ type: "string",
451
+ description: "Graph Intelligence query ID, such as confirmation-bias, pre-mortem, or thesis-summary"
452
+ },
453
+ prompt: {
454
+ type: "string",
455
+ description: "Optional custom prompt for custom analysis runs"
456
+ },
457
+ input: {
458
+ type: "string",
459
+ description: "Optional entity, theme, belief, company, or search text for input-driven queries"
460
+ },
461
+ mode: {
462
+ type: "string",
463
+ description: "Optional mode override: core, bias, stress, operational, alpha, semantic, or evidence"
464
+ },
465
+ limit: {
466
+ type: "number",
467
+ description: "Maximum graph context rows to return"
468
+ }
469
+ },
470
+ required: ["topicId"],
471
+ response: {
472
+ description: "Graph Intelligence query result bundle ready for model or prompt-library synthesis",
473
+ fields: {
474
+ query: "object \u2014 selected query definition",
475
+ prompt: "string \u2014 resolved prompt template",
476
+ toolPlan: "array \u2014 public tools and args the model can call next",
477
+ analysis: "object \u2014 structure, coverage, gap, and confirmation-bias analysis",
478
+ context: "object \u2014 sampled beliefs, questions, evidence, edges, and contradictions"
479
+ }
480
+ },
481
+ ownerModule: "graph-intelligence",
482
+ ontologyPrimitive: "graph",
483
+ tier: "showcase"
484
+ };
485
+ var GET_FALSIFICATION_QUESTIONS = {
486
+ name: "get_falsification_questions",
487
+ 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.",
488
+ parameters: {
489
+ topicId: { type: "string", description: "Topic to analyze" },
490
+ beliefIds: { type: "array", description: "Specific beliefs to target" }
491
+ },
492
+ required: ["topicId"],
493
+ response: {
494
+ description: "Questions with falsification potential scores and target beliefs",
495
+ fields: {
496
+ questions: "array \u2014 { questionText, falsificationPotential, targetBeliefId, targetBeliefText }"
497
+ }
498
+ },
499
+ ownerModule: "graph-search",
500
+ ontologyPrimitive: "question",
501
+ tier: "showcase"
502
+ };
503
+ var SEARCH_EVIDENCE = {
504
+ name: "search_evidence",
505
+ description: "Search for evidence across the reasoning graph. Like `git grep` \u2014 returns the evidence records that best match a textual query. Results share the same canonical semantics as the HTTP and SDK evidence search surface.",
506
+ parameters: {
507
+ q: { type: "string", description: "Search text" },
508
+ topicId: { type: "string", description: "Topic scope filter" },
509
+ targetId: {
510
+ type: "string",
511
+ description: "Optional belief or question identifier to scope the search"
512
+ },
513
+ limit: { type: "number", description: "Max results" },
514
+ cursor: { type: "string", description: "Pagination cursor" }
515
+ },
516
+ required: ["q"],
517
+ response: {
518
+ description: "Canonical evidence search results page",
519
+ fields: {
520
+ results: "array \u2014 { evidenceId, nodeId, globalId?, text, source?, kind?, relevanceScore }",
521
+ nextCursor: "string | null"
522
+ }
523
+ },
524
+ ownerModule: "graph-search",
525
+ ontologyPrimitive: "evidence",
526
+ tier: "workhorse"
527
+ };
528
+ var CREATE_EVIDENCE = {
529
+ name: "create_evidence",
530
+ description: "Commit evidence to the reasoning graph. Like `git commit` \u2014 creates a traceable evidence record with canonical public IDs. Optionally links the evidence to a belief or question in the same operation.",
531
+ parameters: {
532
+ topicId: { type: "string", description: "Topic scope" },
533
+ text: { type: "string", description: "Canonical evidence text" },
534
+ source: { type: "string", description: "Source URL or source label" },
535
+ targetId: {
536
+ type: "string",
537
+ description: "Optional belief or question identifier to link immediately"
538
+ },
539
+ weight: {
540
+ type: "number",
541
+ description: "Support weight: -1.0 (contradicts) to +1.0 (supports)"
542
+ },
543
+ metadata: {
544
+ type: "object",
545
+ description: "Optional metadata merged into the canonical evidence node"
546
+ },
547
+ rationale: {
548
+ type: "string",
549
+ description: "Why this evidence should enter the reasoning graph"
550
+ },
551
+ title: { type: "string", description: "Optional short title" },
552
+ content: { type: "string", description: "Optional long-form content" },
553
+ contentType: {
554
+ type: "string",
555
+ description: "Optional content format or MIME hint"
556
+ },
557
+ kind: { type: "string", description: "Optional evidence kind" }
558
+ },
559
+ required: ["text", "rationale"],
560
+ response: {
561
+ description: "The created canonical evidence record",
562
+ fields: {
563
+ id: "string \u2014 canonical evidence ID",
564
+ nodeId: "string \u2014 canonical evidence ID",
565
+ evidenceId: "string \u2014 canonical evidence ID",
566
+ text: "string",
567
+ topicId: "string"
568
+ }
569
+ },
570
+ ownerModule: "graph-primitives",
571
+ ontologyPrimitive: "evidence",
572
+ tier: "workhorse"
573
+ };
574
+ var GET_EVIDENCE = {
575
+ name: "get_evidence",
576
+ description: "Read one evidence record by ID. Like `git show` \u2014 resolves the canonical evidence payload for a single identifier.",
577
+ parameters: {
578
+ id: { type: "string", description: "Canonical evidence ID" }
579
+ },
580
+ required: ["id"],
581
+ response: {
582
+ description: "The canonical evidence record",
583
+ fields: {
584
+ id: "string \u2014 canonical evidence ID",
585
+ nodeId: "string \u2014 canonical evidence ID",
586
+ evidenceId: "string \u2014 canonical evidence ID",
587
+ text: "string",
588
+ topicId: "string"
589
+ }
590
+ },
591
+ ownerModule: "graph-primitives",
592
+ ontologyPrimitive: "evidence",
593
+ tier: "workhorse"
594
+ };
595
+ var LIST_EVIDENCE = {
596
+ name: "list_evidence",
597
+ description: "List evidence records within a topic or linked to a target. Like `git log -- path` \u2014 returns the canonical evidence page for a topic, belief, or question scope.",
598
+ parameters: {
599
+ topicId: { type: "string", description: "Topic scope filter" },
600
+ targetId: {
601
+ type: "string",
602
+ description: "Optional belief or question identifier to scope by linkage"
603
+ },
604
+ limit: { type: "number", description: "Max results" },
605
+ cursor: { type: "string", description: "Pagination cursor" }
606
+ },
607
+ required: ["topicId"],
608
+ response: {
609
+ description: "Canonical evidence page",
610
+ fields: {
611
+ evidence: "array \u2014 canonical evidence records",
612
+ nextCursor: "string | null"
613
+ }
614
+ },
615
+ ownerModule: "graph-primitives",
616
+ ontologyPrimitive: "evidence",
617
+ tier: "workhorse"
618
+ };
619
+ var LINK_EVIDENCE = {
620
+ name: "link_evidence",
621
+ description: "Link evidence to a belief or question. Like `git notes add` \u2014 attaches a supporting or contradicting edge without rewriting the evidence itself.",
622
+ parameters: {
623
+ evidenceId: { type: "string", description: "Canonical evidence ID" },
624
+ targetId: {
625
+ type: "string",
626
+ description: "Canonical belief or question ID"
627
+ },
628
+ weight: {
629
+ type: "number",
630
+ description: "Support weight: -1.0 (contradicts) to +1.0 (supports)"
631
+ },
632
+ rationale: { type: "string", description: "Why this link exists" }
633
+ },
634
+ required: ["evidenceId", "targetId"],
635
+ response: {
636
+ description: "The created canonical evidence edge summary",
637
+ fields: {
638
+ edgeId: "string",
639
+ evidenceId: "string",
640
+ targetId: "string",
641
+ targetType: "string \u2014 belief | question",
642
+ weight: "number"
643
+ }
644
+ },
645
+ ownerModule: "graph-primitives",
646
+ ontologyPrimitive: "edge",
647
+ tier: "workhorse"
648
+ };
649
+ var LINK_EVIDENCE_TO_BELIEF = {
650
+ name: "link_evidence_to_belief",
651
+ description: "Link evidence to a belief with a support weight. Like `git add` \u2014 stages evidence in support of (or against) a belief. The weight ranges from -1.0 (strongly contradicts) to +1.0 (strongly supports).",
652
+ parameters: {
653
+ evidenceId: { type: "string", description: "The evidence node ID" },
654
+ beliefId: { type: "string", description: "The belief node ID" },
655
+ weight: {
656
+ type: "number",
657
+ description: "Support weight: -1.0 (contradicts) to +1.0 (supports)"
658
+ },
659
+ rationale: { type: "string", description: "Why this evidence is relevant" }
660
+ },
661
+ required: ["evidenceId", "beliefId", "weight"],
662
+ response: {
663
+ description: "The created edge linking evidence to belief",
664
+ fields: {
665
+ edgeId: "string",
666
+ evidenceId: "string",
667
+ beliefId: "string",
668
+ weight: "number"
669
+ }
670
+ },
671
+ ownerModule: "graph-primitives",
672
+ ontologyPrimitive: "edge",
673
+ tier: "workhorse"
674
+ };
675
+
676
+ // src/tool-contracts.lifecycle.ts
677
+ var CREATE_BELIEF = {
678
+ name: "create_belief",
679
+ 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.",
680
+ parameters: {
681
+ canonicalText: {
682
+ type: "string",
683
+ description: "The belief statement \u2014 what the agent holds to be true"
684
+ },
685
+ topicId: {
686
+ type: "string",
687
+ description: "Optional topic scope hint for the belief"
688
+ },
689
+ baseRate: {
690
+ type: "number",
691
+ description: "Prior probability used to seed the vacuous opinion `(0, 0, 1, a)` at creation time. Defaults to 0.5 when omitted."
692
+ },
693
+ beliefType: {
694
+ type: "string",
695
+ description: "Belief type (e.g., hypothesis, belief, principle, invariant, tenet, forecast). Validated against schemaEnumConfig."
696
+ },
697
+ metadata: {
698
+ type: "object",
699
+ description: "Optional extra metadata merged into the node (e.g., { codeAnchors: ['path/to/file.ts'] } for coding intelligence)"
700
+ }
701
+ },
702
+ required: ["canonicalText"],
703
+ response: {
704
+ description: "The created canonical belief record",
705
+ fields: {
706
+ id: "string \u2014 canonical belief ID",
707
+ nodeId: "string \u2014 canonical belief ID",
708
+ beliefId: "string \u2014 canonical belief ID",
709
+ text: "string \u2014 canonical belief formulation",
710
+ topicId: "string",
711
+ status: "string \u2014 active | superseded | archived",
712
+ scoringState: "string \u2014 unscored | scored"
713
+ }
714
+ },
715
+ ownerModule: "graph-primitives",
716
+ ontologyPrimitive: "belief",
717
+ tier: "showcase"
718
+ };
719
+ var GET_BELIEF = {
720
+ name: "get_belief",
721
+ description: "Read one belief by ID. Like `git show` \u2014 resolves the canonical belief payload for a single identifier.",
722
+ parameters: {
723
+ id: { type: "string", description: "Canonical belief ID" }
724
+ },
725
+ required: ["id"],
726
+ response: {
727
+ description: "The canonical belief record",
728
+ fields: {
729
+ id: "string \u2014 canonical belief ID",
730
+ nodeId: "string \u2014 canonical belief ID",
731
+ beliefId: "string \u2014 canonical belief ID",
732
+ text: "string \u2014 canonical belief formulation",
733
+ topicId: "string",
734
+ status: "string \u2014 active | superseded | archived",
735
+ scoringState: "string \u2014 unscored | scored"
736
+ }
737
+ },
738
+ ownerModule: "graph-primitives",
739
+ ontologyPrimitive: "belief",
740
+ tier: "workhorse"
741
+ };
742
+ var REFINE_BELIEF = {
743
+ name: "refine_belief",
744
+ description: "Amend a draft belief in-place within an active worktree. Like `git commit --amend` \u2014 rewrites the last commit on a feature branch. Only valid before merge to main. Fails if the belief is already scored.",
745
+ parameters: {
746
+ nodeId: { type: "string", description: "The belief to refine" },
747
+ canonicalText: { type: "string", description: "Updated belief statement" },
748
+ rationale: { type: "string", description: "Why the refinement was made" }
749
+ },
750
+ required: ["nodeId", "canonicalText"],
751
+ response: {
752
+ description: "The updated belief node",
753
+ fields: {
754
+ nodeId: "string",
755
+ canonicalText: "string \u2014 updated text",
756
+ updatedAt: "number \u2014 timestamp"
757
+ }
758
+ },
759
+ ownerModule: "graph-primitives",
760
+ ontologyPrimitive: "belief",
761
+ tier: "showcase"
762
+ };
763
+ var MODULATE_CONFIDENCE = {
764
+ name: "modulate_confidence",
765
+ 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.",
766
+ parameters: {
767
+ nodeId: { type: "string", description: "The belief to score" },
768
+ belief: {
769
+ type: "number",
770
+ description: "Subjective-logic belief mass `b` in [0, 1]"
771
+ },
772
+ disbelief: {
773
+ type: "number",
774
+ description: "Subjective-logic disbelief mass `d` in [0, 1]"
775
+ },
776
+ uncertainty: {
777
+ type: "number",
778
+ description: "Subjective-logic uncertainty mass `u` in [0, 1]"
779
+ },
780
+ baseRate: {
781
+ type: "number",
782
+ description: "Subjective-logic base rate `a` in [0, 1]. Required for tuple payloads."
783
+ },
784
+ worktreeId: {
785
+ type: "string",
786
+ description: "Completed worktree that tested this belief when confidence policy requires merge-backed scoring."
787
+ },
788
+ trigger: {
789
+ type: "string",
790
+ description: "What caused this confidence change",
791
+ enum: [
792
+ "evidence_added",
793
+ "evidence_removed",
794
+ "contradiction_detected",
795
+ "contradiction_resolved",
796
+ "agent_assessment",
797
+ "worktree_outcome",
798
+ "worktree_completed",
799
+ "fusion",
800
+ "discount",
801
+ "deduction"
802
+ ]
803
+ },
804
+ triggeringEvidenceId: {
805
+ type: "string",
806
+ description: "Evidence node that caused an evidence-triggered modulation"
807
+ },
808
+ triggeringQuestionId: {
809
+ type: "string",
810
+ description: "Answered question whose resolution supports this modulation"
811
+ },
812
+ triggeringAnswerId: {
813
+ type: "string",
814
+ description: "Answer node whose content supports this modulation"
815
+ },
816
+ triggeringContradictionId: {
817
+ type: "string",
818
+ description: "Contradiction record that caused a contradiction-triggered modulation"
819
+ },
820
+ triggeringWorktreeId: {
821
+ type: "string",
822
+ description: "Completed worktree whose outcome caused a worktree-triggered modulation"
823
+ },
824
+ rationale: {
825
+ type: "string",
826
+ description: "Human-readable explanation of why confidence changed"
827
+ }
828
+ },
829
+ required: [
830
+ "nodeId",
831
+ "belief",
832
+ "disbelief",
833
+ "uncertainty",
834
+ "baseRate",
835
+ "trigger",
836
+ "rationale"
837
+ ],
838
+ response: {
839
+ description: "Confidence modulation result",
840
+ fields: {
841
+ beliefId: "string \u2014 canonical belief ID",
842
+ nodeId: "string \u2014 canonical belief ID",
843
+ newConfidence: "number",
844
+ previousConfidence: "number",
845
+ trigger: "string",
846
+ requestId: "string \u2014 request identifier for the scheduled cascade",
847
+ propagationSummary: "object \u2014 bounded inline cascade summary with totalCandidateTargets, inlineTargets, and remainingTargetCount"
848
+ }
849
+ },
850
+ ownerModule: "graph-primitives",
851
+ ontologyPrimitive: "belief",
852
+ tier: "showcase"
853
+ };
854
+ var FORK_BELIEF = {
855
+ name: "fork_belief",
856
+ description: "Branch off a scored belief to create a new version with a different formulation. Like `git fork` \u2014 the parent remains immutable with full history. The new belief gets a `supersedes` edge to the parent. Fork reasons: refinement, contradiction_response, scope_change, confidence_collapse, manual.",
857
+ parameters: {
858
+ nodeId: { type: "string", description: "The scored belief to fork from" },
859
+ newFormulation: {
860
+ type: "string",
861
+ description: "The evolved belief statement"
862
+ },
863
+ forkReason: {
864
+ type: "string",
865
+ description: "Why this fork was created",
866
+ enum: [
867
+ "refinement",
868
+ "contradiction_response",
869
+ "scope_change",
870
+ "confidence_collapse",
871
+ "manual"
872
+ ]
873
+ }
874
+ },
875
+ required: ["nodeId", "newFormulation", "forkReason"],
876
+ response: {
877
+ description: "The forked canonical belief record",
878
+ fields: {
879
+ id: "string \u2014 canonical child belief ID",
880
+ nodeId: "string \u2014 canonical child belief ID",
881
+ beliefId: "string \u2014 canonical child belief ID",
882
+ parentBeliefId: "string \u2014 canonical parent belief ID",
883
+ forkReason: "string"
884
+ }
885
+ },
886
+ ownerModule: "graph-primitives",
887
+ ontologyPrimitive: "belief",
888
+ tier: "showcase"
889
+ };
890
+ var ARCHIVE_BELIEF = {
891
+ name: "archive_belief",
892
+ description: "Soft-delete a belief by setting its status to archived. Like `git rm` \u2014 removed from the working tree but preserved in history. Beliefs are never truly deleted. Archived beliefs retain full lineage and confidence history.",
893
+ parameters: {
894
+ nodeId: { type: "string", description: "The belief to archive" },
895
+ rationale: {
896
+ type: "string",
897
+ description: "Why this belief is being archived"
898
+ }
899
+ },
900
+ required: ["nodeId"],
901
+ response: {
902
+ description: "Archived canonical belief record",
903
+ fields: {
904
+ beliefId: "string \u2014 canonical belief ID",
905
+ nodeId: "string \u2014 canonical belief ID",
906
+ previousStatus: "string | undefined",
907
+ newStatus: "string \u2014 'archived'",
908
+ status: "string \u2014 'archived'"
909
+ }
910
+ },
911
+ ownerModule: "graph-primitives",
912
+ ontologyPrimitive: "belief",
913
+ tier: "showcase"
914
+ };
915
+ var CREATE_EPISTEMIC_CONTRACT = {
916
+ name: "create_epistemic_contract",
917
+ description: "Bind a machine-evaluable epistemic contract to a belief. Like `git add` for falsification rules \u2014 records the verification condition, modulation policy, and evaluation schedule that keep a belief accountable to reality.",
918
+ parameters: {
919
+ beliefNodeId: {
920
+ type: "string",
921
+ description: "The belief node to bind this contract to"
922
+ },
923
+ title: {
924
+ type: "string",
925
+ description: "Contract title"
926
+ },
927
+ description: {
928
+ type: "string",
929
+ description: "Optional contract description"
930
+ },
931
+ conditionType: {
932
+ type: "string",
933
+ description: "What kind of contract condition to evaluate",
934
+ enum: ["assertion", "temporal", "evidential", "threshold", "composite"]
935
+ },
936
+ direction: {
937
+ type: "string",
938
+ description: "Whether satisfying the condition confirms or falsifies",
939
+ enum: ["confirms", "falsifies"]
940
+ },
941
+ condition: {
942
+ type: "object",
943
+ description: "Condition payload: { expression, evaluator, evaluatorConfig? }"
944
+ },
945
+ deadline: {
946
+ type: "number",
947
+ description: "Optional Unix timestamp deadline for temporal contracts"
948
+ },
949
+ compositeOf: {
950
+ type: "array",
951
+ description: "Optional array of sub-contract IDs for composite contracts"
952
+ },
953
+ compositeOperator: {
954
+ type: "string",
955
+ description: "How composite sub-contracts should be combined",
956
+ enum: ["all", "any", "majority"]
957
+ },
958
+ modulation: {
959
+ type: "object",
960
+ description: "Asymmetric modulation rules for confirmed, disconfirmed, expired, and partial outcomes"
961
+ },
962
+ evaluationSchedule: {
963
+ type: "string",
964
+ description: "When this contract should be evaluated",
965
+ enum: ["on_demand", "on_evidence", "periodic", "event_driven"]
966
+ },
967
+ periodicIntervalMs: {
968
+ type: "number",
969
+ description: "Optional interval in milliseconds for periodic contracts"
970
+ }
971
+ },
972
+ required: [
973
+ "beliefNodeId",
974
+ "title",
975
+ "conditionType",
976
+ "direction",
977
+ "condition",
978
+ "modulation",
979
+ "evaluationSchedule"
980
+ ],
981
+ response: {
982
+ description: "The created epistemic contract binding",
983
+ fields: {
984
+ id: "string \u2014 storage record ID",
985
+ contractId: "string \u2014 contract identifier",
986
+ beliefId: "string \u2014 canonical belief ID",
987
+ status: "string \u2014 initial contract status",
988
+ title: "string \u2014 contract title"
989
+ }
990
+ },
991
+ ownerModule: "graph-primitives",
992
+ ontologyPrimitive: "belief",
993
+ tier: "workhorse"
994
+ };
995
+ var ADD_EVIDENCE = {
996
+ name: "add_evidence",
997
+ description: "Commit evidence to the reasoning graph and attach it to a belief. Like `git add && git commit` \u2014 an atomic write that creates a traceable evidence object. Weight ranges from -1.0 (contradicts) to +1.0 (strongly supports). Evidence is always context-bound: tied to its source, the time it was captured, and the belief it informs.",
998
+ parameters: {
999
+ canonicalText: { type: "string", description: "The evidence statement" },
1000
+ topicId: { type: "string", description: "Optional topic scope hint" },
1001
+ sourceUrl: { type: "string", description: "URL of the source material" },
1002
+ targetNodeId: {
1003
+ type: "string",
1004
+ description: "The belief this evidence bears on"
1005
+ },
1006
+ weight: {
1007
+ type: "number",
1008
+ description: "Support weight: -1.0 (contradicts) to +1.0 (supports)"
1009
+ },
1010
+ reasoning: {
1011
+ type: "string",
1012
+ description: "Why this evidence is relevant to the target belief"
1013
+ },
1014
+ title: {
1015
+ type: "string",
1016
+ description: "Optional short title for the evidence node"
1017
+ },
1018
+ content: {
1019
+ type: "string",
1020
+ description: "Optional long-form content (separate from canonicalText summary)"
1021
+ },
1022
+ contentType: {
1023
+ type: "string",
1024
+ description: "Content MIME type or format hint (e.g., 'text/markdown', 'code')"
1025
+ },
1026
+ metadata: {
1027
+ type: "object",
1028
+ description: "Optional extra metadata merged into the node (e.g., { codeAnchors: ['path/to/file.ts'], failedApproach: true } for coding intelligence)"
1029
+ }
1030
+ },
1031
+ required: ["canonicalText", "targetNodeId", "reasoning"],
1032
+ response: {
1033
+ description: "The created evidence node and its edge",
1034
+ fields: {
1035
+ nodeId: "string \u2014 evidence node ID",
1036
+ edgeId: "string \u2014 edge to target belief"
1037
+ }
1038
+ },
1039
+ ownerModule: "graph-primitives",
1040
+ ontologyPrimitive: "evidence",
1041
+ tier: "showcase"
1042
+ };
1043
+ var FLAG_CONTRADICTION = {
1044
+ name: "flag_contradiction",
1045
+ description: "Flag a contradiction between two beliefs. Contradictions are first-class objects with their own lifecycle \u2014 they may remain permanently unresolved. Like a merge conflict that is allowed to persist. Contradictions can trigger structural changes: forking, confidence collapse, or decision blocking. Resolution is NEVER automatic \u2014 always surfaces for human review.",
1046
+ parameters: {
1047
+ beliefA: {
1048
+ type: "string",
1049
+ description: "First belief in the contradiction"
1050
+ },
1051
+ beliefB: {
1052
+ type: "string",
1053
+ description: "Second belief in the contradiction"
1054
+ },
1055
+ description: { type: "string", description: "What the tension is about" },
1056
+ severity: {
1057
+ type: "string",
1058
+ description: "How serious the contradiction is",
1059
+ enum: ["low", "medium", "high", "critical"]
1060
+ },
1061
+ topicId: { type: "string", description: "Optional topic scope hint" },
1062
+ defeatType: {
1063
+ type: "string",
1064
+ description: "Pollock defeat classification: rebuts (direct contradiction), undercuts (attacks the inferential link), undermines (attacks a premise)",
1065
+ enum: ["rebuts", "undercuts", "undermines"]
1066
+ }
1067
+ },
1068
+ required: ["beliefA", "beliefB", "description"],
1069
+ response: {
1070
+ description: "The created contradiction object",
1071
+ fields: {
1072
+ contradictionId: "string",
1073
+ status: "string \u2014 'unresolved'",
1074
+ beliefA: "string",
1075
+ beliefB: "string"
1076
+ }
1077
+ },
1078
+ ownerModule: "graph-primitives",
1079
+ ontologyPrimitive: "belief",
1080
+ tier: "showcase"
1081
+ };
1082
+
1083
+ // src/lens-workflow.contract.ts
1084
+ var LENS_PERSPECTIVE_TYPES = [
1085
+ "investigation",
1086
+ "monitoring",
1087
+ "analysis",
1088
+ "comparison",
1089
+ "taxonomy"
1090
+ ];
1091
+
1092
+ // src/tool-contracts.nodes-lenses.ts
1093
+ var CREATE_EPISTEMIC_NODE = {
1094
+ name: "create_epistemic_node",
1095
+ 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.",
1096
+ parameters: {
1097
+ globalId: { type: "string", description: "Optional idempotent node global ID" },
1098
+ nodeType: { type: "string", description: "Public epistemic node type" },
1099
+ canonicalText: { type: "string", description: "Canonical node text" },
1100
+ text: { type: "string", description: "Alias for canonicalText" },
1101
+ contentHash: { type: "string", description: "Optional idempotency content hash" },
1102
+ sourceType: { type: "string", description: "Source type for provenance" },
1103
+ topicId: { type: "string", description: "Optional topic scope" },
1104
+ content: { type: "string", description: "Extended content" },
1105
+ title: { type: "string", description: "Display title" },
1106
+ metadata: { type: "object", description: "Optional node metadata" }
1107
+ },
1108
+ required: ["nodeType"],
1109
+ response: {
1110
+ description: "Created node result",
1111
+ fields: {
1112
+ nodeId: "string",
1113
+ nodeGlobalId: "string",
1114
+ isDuplicate: "boolean"
1115
+ }
1116
+ },
1117
+ ownerModule: "reasoning-kernel",
1118
+ ontologyPrimitive: "graph",
1119
+ tier: "showcase"
1120
+ };
1121
+ var GET_EPISTEMIC_NODE = {
1122
+ name: "get_epistemic_node",
1123
+ description: "Read one epistemic graph node. Like `git show` \u2014 resolves a canonical spine node by ID or global ID.",
1124
+ parameters: {
1125
+ nodeId: { type: "string", description: "Node ID or global ID" }
1126
+ },
1127
+ required: ["nodeId"],
1128
+ response: {
1129
+ description: "The resolved node",
1130
+ fields: { node: "object" }
1131
+ },
1132
+ ownerModule: "reasoning-kernel",
1133
+ ontologyPrimitive: "graph",
1134
+ tier: "workhorse"
1135
+ };
1136
+ var LIST_EPISTEMIC_NODES = {
1137
+ name: "list_epistemic_nodes",
1138
+ description: "List epistemic graph nodes. Like `git ls-tree` \u2014 lists canonical spine nodes by topic, type, status, or search query.",
1139
+ parameters: {
1140
+ topicId: { type: "string", description: "Optional topic scope" },
1141
+ nodeType: { type: "string", description: "Optional node type filter" },
1142
+ status: { type: "string", description: "Optional lifecycle status" },
1143
+ searchQuery: { type: "string", description: "Optional text search query" },
1144
+ limit: { type: "number", description: "Maximum nodes to return" }
1145
+ },
1146
+ required: [],
1147
+ response: {
1148
+ description: "Matching nodes",
1149
+ fields: { nodes: "array" }
1150
+ },
1151
+ ownerModule: "reasoning-kernel",
1152
+ ontologyPrimitive: "graph",
1153
+ tier: "workhorse"
1154
+ };
1155
+ var UPDATE_EPISTEMIC_NODE = {
1156
+ name: "update_epistemic_node",
1157
+ description: "Amend an epistemic graph node. Like `git commit --amend` \u2014 updates mutable node metadata, text, status, or verification fields.",
1158
+ parameters: {
1159
+ nodeId: { type: "string", description: "Node ID or global ID" },
1160
+ canonicalText: { type: "string", description: "Updated canonical text" },
1161
+ text: { type: "string", description: "Alias for canonicalText" },
1162
+ contentHash: { type: "string", description: "Updated content hash" },
1163
+ content: { type: "string", description: "Updated content" },
1164
+ title: { type: "string", description: "Updated display title" },
1165
+ metadata: { type: "object", description: "Updated metadata" },
1166
+ confidence: { type: "number", description: "Updated confidence" },
1167
+ verificationStatus: { type: "string", description: "Updated verification status" },
1168
+ status: { type: "string", description: "Updated lifecycle status" }
1169
+ },
1170
+ required: ["nodeId"],
1171
+ response: {
1172
+ description: "Node update result",
1173
+ fields: { success: "boolean" }
1174
+ },
1175
+ ownerModule: "reasoning-kernel",
1176
+ ontologyPrimitive: "graph",
1177
+ tier: "workhorse"
1178
+ };
1179
+ var ARCHIVE_EPISTEMIC_NODE = {
1180
+ name: "archive_epistemic_node",
1181
+ description: "Archive an epistemic graph node. Like `git rm --cached` \u2014 removes a node from active traversal without hard-deleting it.",
1182
+ parameters: {
1183
+ nodeId: { type: "string", description: "Node ID or global ID" }
1184
+ },
1185
+ required: ["nodeId"],
1186
+ response: {
1187
+ description: "Archive result",
1188
+ fields: { success: "boolean", effectiveStatus: "string" }
1189
+ },
1190
+ ownerModule: "reasoning-kernel",
1191
+ ontologyPrimitive: "graph",
1192
+ tier: "workhorse"
1193
+ };
1194
+ var VERIFY_EPISTEMIC_NODE = {
1195
+ name: "verify_epistemic_node",
1196
+ description: "Record verification state on an epistemic graph node. Like `git tag` \u2014 marks the node with a reviewed verification state.",
1197
+ parameters: {
1198
+ nodeId: { type: "string", description: "Node ID or global ID" },
1199
+ verificationStatus: { type: "string", description: "Verification status" },
1200
+ confidence: { type: "number", description: "Optional confidence update" }
1201
+ },
1202
+ required: ["nodeId", "verificationStatus"],
1203
+ response: {
1204
+ description: "Verification result",
1205
+ fields: { success: "boolean" }
1206
+ },
1207
+ ownerModule: "reasoning-kernel",
1208
+ ontologyPrimitive: "graph",
1209
+ tier: "workhorse"
1210
+ };
1211
+ var SUPERSEDE_EPISTEMIC_NODE = {
1212
+ name: "supersede_epistemic_node",
1213
+ 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.",
1214
+ parameters: {
1215
+ oldNodeId: { type: "string", description: "Node ID or global ID to supersede" },
1216
+ newGlobalId: { type: "string", description: "Optional replacement global ID" },
1217
+ newCanonicalText: { type: "string", description: "Replacement canonical text" },
1218
+ text: { type: "string", description: "Alias for newCanonicalText" },
1219
+ newContentHash: { type: "string", description: "Optional replacement content hash" },
1220
+ reason: { type: "string", description: "Reason for superseding" }
1221
+ },
1222
+ required: ["oldNodeId"],
1223
+ response: {
1224
+ description: "Supersede result",
1225
+ fields: { oldNodeId: "string", newNodeId: "string" }
1226
+ },
1227
+ ownerModule: "reasoning-kernel",
1228
+ ontologyPrimitive: "graph",
1229
+ tier: "workhorse"
1230
+ };
1231
+ var BATCH_CREATE_EPISTEMIC_NODES = {
1232
+ name: "batch_create_epistemic_nodes",
1233
+ description: "Commit multiple epistemic graph nodes. Like `git commit` with many staged files \u2014 writes a batch of canonical spine nodes.",
1234
+ parameters: {
1235
+ nodes: {
1236
+ type: "array",
1237
+ description: "Nodes to create with nodeType, canonicalText/text, and optional metadata."
1238
+ }
1239
+ },
1240
+ required: ["nodes"],
1241
+ response: {
1242
+ description: "Batch node creation result",
1243
+ fields: { created: "number", results: "array" }
1244
+ },
1245
+ ownerModule: "reasoning-kernel",
1246
+ ontologyPrimitive: "graph",
1247
+ tier: "workhorse"
1248
+ };
1249
+ var RECORD_JUDGMENT = {
1250
+ name: "record_judgment",
1251
+ 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).",
1252
+ parameters: {
1253
+ title: { type: "string", description: "Short judgment statement" },
1254
+ rationale: {
1255
+ type: "string",
1256
+ description: "Full reasoning behind the judgment"
1257
+ },
1258
+ topicId: { type: "string", description: "Topic scope" },
1259
+ beliefIds: {
1260
+ type: "array",
1261
+ description: "Beliefs that warrant this judgment"
1262
+ },
1263
+ confidence: {
1264
+ type: "number",
1265
+ description: "Confidence in the judgment (0-1)"
1266
+ }
1267
+ },
1268
+ required: ["title", "rationale"],
1269
+ response: {
1270
+ description: "The recorded judgment",
1271
+ fields: {
1272
+ judgmentId: "string",
1273
+ title: "string",
1274
+ status: "string \u2014 'issued'"
1275
+ }
1276
+ },
1277
+ ownerModule: "decisions",
1278
+ ontologyPrimitive: "judgment",
1279
+ tier: "showcase"
1280
+ };
1281
+ var CREATE_LENS = {
1282
+ name: "create_lens",
1283
+ description: "Create a reusable lens that overlays a workspace topic with a specific analytical perspective. Like `git branch <name>` for operational scaffolding \u2014 a lens persists across worktrees and carries prompts, workflows, and task templates. Multiple topics in the same workspace can reuse the same lens.",
1284
+ parameters: {
1285
+ name: {
1286
+ type: "string",
1287
+ description: "Lens name (e.g., 'market dynamics', 'team quality')"
1288
+ },
1289
+ workspaceId: {
1290
+ type: "string",
1291
+ description: "Workspace scope for the lens. Required unless topicId resolves to a workspace-scoped topic."
1292
+ },
1293
+ topicId: {
1294
+ type: "string",
1295
+ description: "Optional originating topic scope. Lenses remain reusable across topics even when this is set."
1296
+ },
1297
+ description: {
1298
+ type: "string",
1299
+ description: "What this lens is designed to investigate or monitor"
1300
+ },
1301
+ perspectiveType: {
1302
+ type: "string",
1303
+ description: "Perspective type for the lens. Validated against schemaEnumConfig category 'lens_perspective_type'.",
1304
+ enum: [...LENS_PERSPECTIVE_TYPES]
1305
+ },
1306
+ promptTemplates: {
1307
+ type: "array",
1308
+ description: "Langfuse prompt references used when operating through this lens"
1309
+ },
1310
+ workflowTemplates: {
1311
+ type: "array",
1312
+ description: "Guided workflow templates for lens-driven investigations"
1313
+ },
1314
+ taskTemplates: {
1315
+ type: "array",
1316
+ description: "Default task templates instantiated when the lens is applied"
1317
+ },
1318
+ filterCriteria: {
1319
+ type: "object",
1320
+ description: "Belief/evidence filtering rules applied by the lens"
1321
+ }
1322
+ },
1323
+ required: ["name", "perspectiveType"],
1324
+ response: {
1325
+ description: "The created lens",
1326
+ fields: {
1327
+ lensId: "string",
1328
+ name: "string",
1329
+ workspaceId: "string",
1330
+ status: "string \u2014 'active'"
1331
+ }
1332
+ },
1333
+ ownerModule: "reasoning-kernel",
1334
+ ontologyPrimitive: "lens",
1335
+ tier: "showcase"
1336
+ };
1337
+ var LIST_LENSES = {
1338
+ name: "list_lenses",
1339
+ description: "List reusable lenses for a workspace, optionally scored by whether they are active on a topic. Like `git branch --list` \u2014 shows the available named frames you can activate. When topicId is provided, the response can indicate which lenses are already applied there.",
1340
+ parameters: {
1341
+ workspaceId: {
1342
+ type: "string",
1343
+ description: "Workspace scope to list lenses from"
1344
+ },
1345
+ topicId: {
1346
+ type: "string",
1347
+ description: "Optional topic scope used to derive workspace and annotate applied lenses"
1348
+ },
1349
+ status: {
1350
+ type: "string",
1351
+ description: "Filter by lens lifecycle status",
1352
+ enum: ["draft", "active", "archived"]
1353
+ },
1354
+ perspectiveType: {
1355
+ type: "string",
1356
+ description: "Filter by perspective type",
1357
+ enum: [...LENS_PERSPECTIVE_TYPES]
1358
+ }
1359
+ },
1360
+ required: [],
1361
+ response: {
1362
+ description: "Available lenses",
1363
+ fields: {
1364
+ lenses: "array \u2014 each item includes lensId, name, workspaceId, perspectiveType, status, and optional isAppliedToTopic"
1365
+ }
1366
+ },
1367
+ ownerModule: "reasoning-kernel",
1368
+ ontologyPrimitive: "lens",
1369
+ tier: "workhorse"
1370
+ };
1371
+ var APPLY_LENS_TO_TOPIC = {
1372
+ name: "apply_lens_to_topic",
1373
+ description: "Apply a lens to a topic so it becomes an active perspective overlay. Like `git checkout <branch>` for a reusable frame \u2014 the topic keeps its knowledge, but the active lens shapes guidance and retrieval. Multiple active lenses can coexist on the same topic.",
1374
+ parameters: {
1375
+ lensId: { type: "string", description: "Lens to activate on the topic" },
1376
+ topicId: { type: "string", description: "Topic that should receive the lens" }
1377
+ },
1378
+ required: ["lensId", "topicId"],
1379
+ response: {
1380
+ description: "Lens activation result",
1381
+ fields: {
1382
+ bindingId: "string",
1383
+ lensId: "string",
1384
+ topicId: "string",
1385
+ status: "string \u2014 'active'"
1386
+ }
1387
+ },
1388
+ ownerModule: "reasoning-kernel",
1389
+ ontologyPrimitive: "lens",
1390
+ tier: "workhorse"
1391
+ };
1392
+ var REMOVE_LENS_FROM_TOPIC = {
1393
+ name: "remove_lens_from_topic",
1394
+ description: "Remove an active lens overlay from a topic. Like `git switch` away from a frame \u2014 the topic remains, but the lens stops shaping the investigation context. Historical binding state is preserved for auditability.",
1395
+ parameters: {
1396
+ lensId: { type: "string", description: "Lens to remove from the topic" },
1397
+ topicId: { type: "string", description: "Topic that currently has the lens applied" }
1398
+ },
1399
+ required: ["lensId", "topicId"],
1400
+ response: {
1401
+ description: "Lens removal result",
1402
+ fields: {
1403
+ bindingId: "string",
1404
+ lensId: "string",
1405
+ topicId: "string",
1406
+ status: "string \u2014 'removed'"
1407
+ }
1408
+ },
1409
+ ownerModule: "reasoning-kernel",
1410
+ ontologyPrimitive: "lens",
1411
+ tier: "workhorse"
1412
+ };
1413
+
1414
+ // src/tool-contracts.ontology.ts
1415
+ var MANAGE_WRITE_POLICY = {
1416
+ name: "manage_write_policy",
1417
+ description: "Manage write policies for MCP mutation tools. Like `git config` for write permissions \u2014 sets per-topic or global policies that control which roles can mutate the graph.",
1418
+ parameters: {
1419
+ action: {
1420
+ type: "string",
1421
+ description: "Action to perform: 'get' (read policies) or 'set' (upsert a policy)",
1422
+ enum: ["get", "set"]
1423
+ },
1424
+ topicId: {
1425
+ type: "string",
1426
+ description: "Topic scope for the policy. Omit for global policies."
1427
+ },
1428
+ role: {
1429
+ type: "string",
1430
+ description: "Role to set policy for (required for 'set'). E.g. 'agent:internal' or a Permit role key such as 'workspace_admin'."
1431
+ },
1432
+ permission: {
1433
+ type: "string",
1434
+ description: "Permission level (required for 'set').",
1435
+ enum: ["allow", "deny", "read_only"]
1436
+ },
1437
+ maxWritesPerSession: {
1438
+ type: "number",
1439
+ description: "Optional per-session write limit for this role+scope."
1440
+ },
1441
+ rationale: {
1442
+ type: "string",
1443
+ description: "Why this policy is being set (audit trail)."
1444
+ }
1445
+ },
1446
+ required: ["action"],
1447
+ response: {
1448
+ description: "Policy operation result",
1449
+ fields: {
1450
+ action: "string \u2014 get | set",
1451
+ topicId: "string|null \u2014 topic scope or null for global",
1452
+ policies: "array \u2014 (for get) list of matching policies",
1453
+ role: "string \u2014 (for set) role that was updated",
1454
+ permission: "string \u2014 (for set) new permission level",
1455
+ maxWritesPerSession: "number|null \u2014 (for set) session write cap"
1456
+ }
1457
+ },
1458
+ ownerModule: "access-control",
1459
+ ontologyPrimitive: "policy",
1460
+ tier: "workhorse"
1461
+ };
1462
+ var LIST_ONTOLOGIES = {
1463
+ name: "list_ontologies",
1464
+ description: "List ontology definitions with optional filters. Like `git remote -v` for ontologies \u2014 shows all registered ontology definitions with their tier, status, and tenant scope.",
1465
+ parameters: {
1466
+ tenantId: {
1467
+ type: "string",
1468
+ description: "Filter by tenant ID. Omit for platform-level ontologies."
1469
+ },
1470
+ tier: {
1471
+ type: "string",
1472
+ description: "Filter by tier",
1473
+ enum: ["platform", "pack", "tenant"]
1474
+ },
1475
+ status: {
1476
+ type: "string",
1477
+ description: "Filter by status",
1478
+ enum: ["draft", "active", "deprecated", "archived"]
1479
+ }
1480
+ },
1481
+ required: [],
1482
+ response: {
1483
+ description: "Array of ontology definitions",
1484
+ fields: {
1485
+ ontologies: "array \u2014 ontology definitions with id, ontologyKey, name, tier, status"
1486
+ }
1487
+ },
1488
+ ownerModule: "graph-primitives",
1489
+ ontologyPrimitive: "ontology",
1490
+ tier: "showcase"
1491
+ };
1492
+ var GET_ONTOLOGY = {
1493
+ name: "get_ontology",
1494
+ description: "Get a single ontology definition by ID or ontologyKey. Like `git show` for an ontology \u2014 returns the definition metadata plus the latest published version with entity types and edge types.",
1495
+ parameters: {
1496
+ id: {
1497
+ type: "string",
1498
+ description: "Ontology definition ID (Convex document ID)"
1499
+ },
1500
+ ontologyKey: {
1501
+ type: "string",
1502
+ description: "Ontology key (e.g., 'investment-ontology'). Alternative to id."
1503
+ },
1504
+ tenantId: {
1505
+ type: "string",
1506
+ description: "Tenant scope for key lookup. Omit for platform-level."
1507
+ }
1508
+ },
1509
+ required: ["id"],
1510
+ response: {
1511
+ description: "Ontology definition with latest published version",
1512
+ fields: {
1513
+ id: "string \u2014 definition ID",
1514
+ ontologyKey: "string \u2014 unique key",
1515
+ name: "string \u2014 display name",
1516
+ publishedVersion: "object|null \u2014 latest published version with entityTypes and edgeTypes"
1517
+ }
1518
+ },
1519
+ ownerModule: "graph-primitives",
1520
+ ontologyPrimitive: "ontology",
1521
+ tier: "showcase"
1522
+ };
1523
+ var APPLY_ONTOLOGY = {
1524
+ name: "apply_ontology",
1525
+ description: "Bind an ontology definition directly to a topic. Like `git checkout` for a domain vocabulary \u2014 applies an ontology to a topic so the topic and its descendants inherit the configured entity and edge schema.",
1526
+ parameters: {
1527
+ ontologyId: {
1528
+ type: "string",
1529
+ description: "Canonical ontology identifier to bind"
1530
+ },
1531
+ topicId: {
1532
+ type: "string",
1533
+ description: "Canonical topic identifier to receive the binding"
1534
+ }
1535
+ },
1536
+ required: ["ontologyId", "topicId"],
1537
+ response: {
1538
+ description: "Ontology binding summary",
1539
+ fields: {
1540
+ applied: "boolean \u2014 true when the binding was written",
1541
+ source: "string \u2014 always 'direct' for an explicit bind",
1542
+ ontologyId: "string \u2014 canonical ontology ID",
1543
+ ontologyKey: "string \u2014 ontology key",
1544
+ topicId: "string \u2014 canonical topic ID"
1545
+ }
1546
+ },
1547
+ ownerModule: "reasoning-kernel",
1548
+ ontologyPrimitive: "ontology",
1549
+ tier: "showcase"
1550
+ };
1551
+ var MATCH_ENTITY_TYPE = {
1552
+ name: "match_entity_type",
1553
+ description: "Classify free text against the effective ontology vocabulary. Like `git grep` for ontology types \u2014 ranks the most likely entity types for the supplied text using the topic-bound or explicitly selected ontology.",
1554
+ parameters: {
1555
+ text: {
1556
+ type: "string",
1557
+ description: "Free text to classify against ontology entity types"
1558
+ },
1559
+ topicId: {
1560
+ type: "string",
1561
+ description: "Canonical topic ID used to resolve the effective ontology when ontologyId is omitted"
1562
+ },
1563
+ ontologyId: {
1564
+ type: "string",
1565
+ description: "Optional ontology definition ID to match against instead of the topic-bound ontology"
1566
+ },
1567
+ minScore: {
1568
+ type: "number",
1569
+ description: "Optional lower similarity bound for returned matches"
1570
+ },
1571
+ limit: {
1572
+ type: "number",
1573
+ description: "Optional maximum number of ranked matches to return"
1574
+ }
1575
+ },
1576
+ required: ["text", "ontologyId"],
1577
+ response: {
1578
+ description: "Ranked ontology entity type matches",
1579
+ fields: {
1580
+ matches: "array \u2014 ranked entity type matches with score, entityType, label, and optional description",
1581
+ ontologyId: "string|null \u2014 ontology used for matching",
1582
+ topicId: "string|null \u2014 topic scope used for ontology resolution"
1583
+ }
1584
+ },
1585
+ ownerModule: "reasoning-kernel",
1586
+ ontologyPrimitive: "ontology",
1587
+ tier: "showcase"
1588
+ };
1589
+ var CREATE_ONTOLOGY = {
1590
+ name: "create_ontology",
1591
+ description: "Create a new ontology definition. Like `git init` for a domain vocabulary \u2014 creates a named, versioned container for entity types and edge types. Starts in 'draft' status.",
1592
+ parameters: {
1593
+ ontologyKey: {
1594
+ type: "string",
1595
+ description: "Unique key (lowercase, hyphens, e.g., 'investment-ontology')"
1596
+ },
1597
+ name: { type: "string", description: "Human-readable name" },
1598
+ description: { type: "string", description: "What this ontology covers" },
1599
+ tenantId: {
1600
+ type: "string",
1601
+ description: "Tenant scope. Omit for platform-level."
1602
+ },
1603
+ tier: {
1604
+ type: "string",
1605
+ description: "Ontology tier",
1606
+ enum: ["platform", "pack", "tenant"]
1607
+ },
1608
+ parentOntologyId: {
1609
+ type: "string",
1610
+ description: "Parent ontology ID for layered composition"
1611
+ }
1612
+ },
1613
+ required: ["ontologyKey", "name", "tier"],
1614
+ response: {
1615
+ description: "Created ontology definition",
1616
+ fields: {
1617
+ id: "string \u2014 new definition ID",
1618
+ ontologyKey: "string \u2014 normalized key"
1619
+ }
1620
+ },
1621
+ ownerModule: "graph-primitives",
1622
+ ontologyPrimitive: "ontology",
1623
+ tier: "showcase"
1624
+ };
1625
+ var UPDATE_ONTOLOGY = {
1626
+ name: "update_ontology",
1627
+ description: "Update an ontology definition's metadata (name, description, status). Like `git config` for an ontology \u2014 updates mutable fields on the definition. Only allowed while the ontology is in draft or active status.",
1628
+ parameters: {
1629
+ id: { type: "string", description: "Ontology definition ID" },
1630
+ name: { type: "string", description: "New display name" },
1631
+ description: { type: "string", description: "New description" },
1632
+ status: {
1633
+ type: "string",
1634
+ description: "New status",
1635
+ enum: ["draft", "active", "deprecated"]
1636
+ }
1637
+ },
1638
+ required: ["id"],
1639
+ response: {
1640
+ description: "Update confirmation",
1641
+ fields: { success: "boolean" }
1642
+ },
1643
+ ownerModule: "graph-primitives",
1644
+ ontologyPrimitive: "ontology",
1645
+ tier: "workhorse"
1646
+ };
1647
+ var ARCHIVE_ONTOLOGY = {
1648
+ name: "archive_ontology",
1649
+ description: "Archive an ontology definition. Like `git rm` for an ontology \u2014 soft-deletes the definition. Archived ontologies are preserved in history but no longer active.",
1650
+ parameters: {
1651
+ id: { type: "string", description: "Ontology definition ID to archive" }
1652
+ },
1653
+ required: ["id"],
1654
+ response: {
1655
+ description: "Archive confirmation",
1656
+ fields: { success: "boolean" }
1657
+ },
1658
+ ownerModule: "graph-primitives",
1659
+ ontologyPrimitive: "ontology",
1660
+ tier: "workhorse"
1661
+ };
1662
+ var CREATE_ONTOLOGY_VERSION = {
1663
+ name: "create_ontology_version",
1664
+ description: "Create a new version snapshot for an ontology definition. Like `git commit` for ontology content \u2014 captures entity types and edge types in a versioned snapshot. Starts in 'draft' status. Publish to freeze.",
1665
+ parameters: {
1666
+ ontologyId: {
1667
+ type: "string",
1668
+ description: "Parent ontology definition ID"
1669
+ },
1670
+ version: {
1671
+ type: "string",
1672
+ description: "Semantic version string (X.Y.Z format)"
1673
+ },
1674
+ entityTypes: {
1675
+ type: "array",
1676
+ description: "Array of entity type definitions: [{ value, label, description?, schema?, subtypes? }]"
1677
+ },
1678
+ edgeTypes: {
1679
+ type: "array",
1680
+ description: "Array of edge type definitions: [{ value, label, description?, sourceTypes?, targetTypes?, constraintSeverity? }]"
1681
+ },
1682
+ releaseNotes: {
1683
+ type: "string",
1684
+ description: "Optional release notes for this version"
1685
+ }
1686
+ },
1687
+ required: ["ontologyId", "version", "entityTypes", "edgeTypes"],
1688
+ response: {
1689
+ description: "Created version",
1690
+ fields: {
1691
+ id: "string \u2014 new version ID",
1692
+ version: "string \u2014 version string"
1693
+ }
1694
+ },
1695
+ ownerModule: "graph-primitives",
1696
+ ontologyPrimitive: "ontology",
1697
+ tier: "showcase"
1698
+ };
1699
+ var PUBLISH_ONTOLOGY_VERSION = {
1700
+ name: "publish_ontology_version",
1701
+ description: "Publish a draft ontology version \u2014 freezes it permanently. Like `git tag` for an ontology release \u2014 the version becomes immutable after publish. If the parent definition is still in 'draft', promotes it to 'active'.",
1702
+ parameters: {
1703
+ id: { type: "string", description: "Ontology version ID to publish" }
1704
+ },
1705
+ required: ["id"],
1706
+ response: {
1707
+ description: "Publish confirmation",
1708
+ fields: {
1709
+ success: "boolean",
1710
+ publishedAt: "number \u2014 timestamp"
1711
+ }
1712
+ },
1713
+ ownerModule: "graph-primitives",
1714
+ ontologyPrimitive: "ontology",
1715
+ tier: "showcase"
1716
+ };
1717
+ var DEPRECATE_ONTOLOGY_VERSION = {
1718
+ name: "deprecate_ontology_version",
1719
+ description: "Deprecate a published ontology version. Like `git tag -d` for an ontology release \u2014 marks the version as deprecated. Only published versions can be deprecated.",
1720
+ parameters: {
1721
+ id: { type: "string", description: "Ontology version ID to deprecate" }
1722
+ },
1723
+ required: ["id"],
1724
+ response: {
1725
+ description: "Deprecation confirmation",
1726
+ fields: { success: "boolean" }
1727
+ },
1728
+ ownerModule: "graph-primitives",
1729
+ ontologyPrimitive: "ontology",
1730
+ tier: "workhorse"
1731
+ };
1732
+ var RESOLVE_EFFECTIVE_ONTOLOGY = {
1733
+ name: "resolve_effective_ontology",
1734
+ description: "Resolve the effective ontology by composing the parent chain. Like `git merge --squash` for ontology layers \u2014 walks parentOntologyId chain (max depth 3) and merges entity/edge types additively from root (platform) to leaf (tenant).",
1735
+ parameters: {
1736
+ ontologyId: {
1737
+ type: "string",
1738
+ description: "Ontology definition ID to resolve from"
1739
+ }
1740
+ },
1741
+ required: ["ontologyId"],
1742
+ response: {
1743
+ description: "Merged ontology with composed entity and edge types",
1744
+ fields: {
1745
+ entityTypes: "array \u2014 merged entity types from all layers",
1746
+ edgeTypes: "array \u2014 merged edge types from all layers",
1747
+ layers: "array \u2014 ontology keys in composition order"
1748
+ }
1749
+ },
1750
+ ownerModule: "graph-primitives",
1751
+ ontologyPrimitive: "ontology",
1752
+ tier: "workhorse"
1753
+ };
1754
+
1755
+ // src/tool-contracts.pipeline-coordination.ts
1756
+ var RECORD_SCOPE_LEARNING = {
1757
+ name: "record_scope_learning",
1758
+ description: "Write a structured learning entry into the epistemic spine. Like `git commit` for scope learnings \u2014 records evidence, can attach to a belief, and can open a follow-up belief/question in one atomic workflow.",
1759
+ parameters: {
1760
+ topicId: { type: "string", description: "Topic scope ID" },
1761
+ summary: { type: "string", description: "Atomic learning statement" },
1762
+ title: {
1763
+ type: "string",
1764
+ description: "Optional evidence title, such as a commit, doc, or issue."
1765
+ },
1766
+ body: {
1767
+ type: "string",
1768
+ description: "Optional rich evidence body. If omitted, body is synthesized from summary and touched paths."
1769
+ },
1770
+ contentType: {
1771
+ type: "string",
1772
+ description: "Optional evidence body format, such as markdown or text."
1773
+ },
1774
+ sourceKind: {
1775
+ type: "string",
1776
+ description: "Source type for the learning event",
1777
+ enum: ["commit", "merge", "doc", "issue", "manual"]
1778
+ },
1779
+ sourceRef: {
1780
+ type: "string",
1781
+ description: "Optional source reference, such as SHA, PR number, or URL slug."
1782
+ },
1783
+ sourceUrl: { type: "string", description: "Optional canonical source URL" },
1784
+ touchedPaths: {
1785
+ type: "array",
1786
+ description: "Optional touched file paths for retrieval hints"
1787
+ },
1788
+ tags: { type: "array", description: "Optional tags" },
1789
+ linkedBeliefNodeId: {
1790
+ type: "string",
1791
+ description: "Optional belief to attach evidence to"
1792
+ },
1793
+ evidenceRelation: {
1794
+ type: "string",
1795
+ description: "Relation to linked belief",
1796
+ enum: ["supports", "contradicts"]
1797
+ },
1798
+ confidence: { type: "number", description: "Optional confidence in [0,1]" },
1799
+ createQuestionText: {
1800
+ type: "string",
1801
+ description: "Optional follow-up question text"
1802
+ },
1803
+ createBeliefText: {
1804
+ type: "string",
1805
+ description: "Optional new belief text"
1806
+ },
1807
+ beliefType: {
1808
+ type: "string",
1809
+ description: "Optional belief type for createBeliefText"
1810
+ }
1811
+ },
1812
+ required: ["summary"],
1813
+ response: {
1814
+ description: "Created learning artifacts",
1815
+ fields: {
1816
+ topicId: "string \u2014 resolved topic ID",
1817
+ evidenceNodeId: "string",
1818
+ linkedBeliefNodeId: "string | null",
1819
+ createdQuestionId: "string | null",
1820
+ createdBeliefId: "string | null",
1821
+ sourceUrl: "string",
1822
+ createdAt: "number"
1823
+ }
1824
+ },
1825
+ ownerModule: "reasoning-kernel",
1826
+ ontologyPrimitive: "evidence",
1827
+ tier: "workhorse",
1828
+ internal: true
1829
+ };
1830
+ var PIPELINE_SNAPSHOT = {
1831
+ name: "pipeline_snapshot",
1832
+ 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.",
1833
+ parameters: {
1834
+ topicId: { type: "string", description: "Topic scope ID" }
1835
+ },
1836
+ required: ["topicId"],
1837
+ response: {
1838
+ description: "Human-oriented pipeline summary for a single topic scope",
1839
+ fields: {
1840
+ topicId: "string",
1841
+ topicName: "string",
1842
+ currentCampaign: "number | null",
1843
+ nextCampaign: "number | null",
1844
+ activeWorktrees: "array \u2014 current hinge worktree(s)",
1845
+ nextWave: "array \u2014 worktrees in the next planned campaign",
1846
+ readyNow: "array \u2014 planning worktrees with dependencies completed",
1847
+ blockedBy: "array \u2014 grouped blockers",
1848
+ criticalPath: "array \u2014 ordered incomplete worktree chain",
1849
+ campaigns: "array \u2014 incomplete worktrees grouped by campaign",
1850
+ superseded: "array \u2014 worktrees marked superseded or not for activation",
1851
+ graphHygiene: "object \u2014 untargeted and taskless worktree debt",
1852
+ riskQuestions: "array \u2014 critical/high open questions",
1853
+ narrative: "array \u2014 concise natural-language summary lines"
1854
+ }
1855
+ },
1856
+ ownerModule: "reasoning-kernel",
1857
+ ontologyPrimitive: "graph",
1858
+ tier: "workhorse",
1859
+ internal: true
1860
+ };
1861
+ var DISCOVER = {
1862
+ name: "discover",
1863
+ description: "Navigate the topic tree to find where knowledge lives. Like `git log --all --grep` \u2014 searches across the graph using bottom-up content matching plus top-down structural scoring.",
1864
+ parameters: {
1865
+ query: {
1866
+ type: "string",
1867
+ description: "What to look for across the topic tree"
1868
+ },
1869
+ topK: {
1870
+ type: "number",
1871
+ description: "How many matching topics to return (default: 3, max: 10)"
1872
+ },
1873
+ includeNeighborhood: {
1874
+ type: "boolean",
1875
+ description: "Whether to include beliefs/questions/evidence for matched topics"
1876
+ }
1877
+ },
1878
+ required: ["query"],
1879
+ response: {
1880
+ description: "Ranked topic matches with optional neighborhood content",
1881
+ fields: {
1882
+ query: "string \u2014 original query",
1883
+ matchedTopics: "array \u2014 ranked topics with scores and paths",
1884
+ neighborhoods: "array \u2014 beliefs, questions, evidence for each match",
1885
+ totalTopicsScored: "number",
1886
+ topicTreeSize: "number"
1887
+ }
1888
+ },
1889
+ ownerModule: "reasoning-kernel",
1890
+ ontologyPrimitive: "graph",
1891
+ tier: "showcase",
1892
+ deprecated: "Deprecated: use lucern.context.compile() with topicId"
1893
+ };
1894
+ var ANALYZE_TOPIC_DENSITY = {
1895
+ name: "analyze_topic_density",
1896
+ description: "Analyze topic belief density and identify natural conceptual clusters. Like `git diff --stat` for topic organization \u2014 detects when a topic has accumulated too many beliefs and suggests subtopic decomposition.",
1897
+ parameters: {
1898
+ topicId: { type: "string", description: "Topic ID to analyze" },
1899
+ threshold: {
1900
+ type: "number",
1901
+ description: "Belief count threshold for density warning"
1902
+ },
1903
+ minModularity: {
1904
+ type: "number",
1905
+ description: "Minimum modularity score for suggesting decomposition"
1906
+ }
1907
+ },
1908
+ required: ["topicId"],
1909
+ response: {
1910
+ description: "Density analysis with cluster suggestions",
1911
+ fields: {
1912
+ topicId: "string",
1913
+ topicName: "string",
1914
+ beliefCount: "number",
1915
+ edgeCount: "number",
1916
+ threshold: "number",
1917
+ isDense: "boolean",
1918
+ modularity: "number",
1919
+ clusterCount: "number",
1920
+ clusters: "array \u2014 suggested belief clusters",
1921
+ recommendation: "string"
1922
+ }
1923
+ },
1924
+ ownerModule: "reasoning-kernel",
1925
+ ontologyPrimitive: "graph",
1926
+ tier: "showcase"
1927
+ };
1928
+ var APPLY_AUTO_BRANCHING = {
1929
+ name: "apply_auto_branching",
1930
+ description: "Execute topic decomposition by creating subtopics and reassigning beliefs. Like `git subtree split` \u2014 splits a dense topic into focused subtopics while preserving belief identity and edges.",
1931
+ parameters: {
1932
+ topicId: { type: "string", description: "Parent topic ID to decompose" },
1933
+ clusters: {
1934
+ type: "array",
1935
+ description: "Cluster definitions from analyze_topic_density, each with name and beliefIds"
1936
+ },
1937
+ dryRun: {
1938
+ type: "boolean",
1939
+ description: "Preview changes without applying them"
1940
+ }
1941
+ },
1942
+ required: ["topicId", "clusters"],
1943
+ response: {
1944
+ description: "Results of the auto-branching operation",
1945
+ fields: {
1946
+ success: "boolean",
1947
+ parentTopicId: "string",
1948
+ createdSubtopics: "array",
1949
+ totalReassigned: "number",
1950
+ totalSkipped: "number",
1951
+ dryRun: "boolean"
1952
+ }
1953
+ },
1954
+ ownerModule: "reasoning-kernel",
1955
+ ontologyPrimitive: "graph",
1956
+ tier: "showcase"
1957
+ };
1958
+ var SEED_BELIEF_LATTICE = {
1959
+ name: "seed_belief_lattice",
1960
+ description: "Seed belief lattice coverage for a topic based on its resolved ontology. Like `git init` for ontology coverage \u2014 creates or previews seed beliefs for entity types that need a baseline anchor.",
1961
+ parameters: {
1962
+ topicId: {
1963
+ type: "string",
1964
+ description: "Topic scope ID. Lattice seeding must target a child topic."
1965
+ },
1966
+ dryRun: {
1967
+ type: "boolean",
1968
+ description: "Preview seeds without creating them"
1969
+ }
1970
+ },
1971
+ required: [],
1972
+ response: {
1973
+ description: "Lattice seed results with per-entity-type status",
1974
+ fields: {
1975
+ topicId: "string",
1976
+ ontologyResolved: "boolean",
1977
+ ontologyKey: "string | null",
1978
+ ontologyVersion: "string | null",
1979
+ entityTypeCount: "number",
1980
+ seeds: "array \u2014 per-entity-type seed status",
1981
+ summary: "object \u2014 created/existing/scored/total counts",
1982
+ dryRun: "boolean"
1983
+ }
1984
+ },
1985
+ ownerModule: "reasoning-kernel",
1986
+ ontologyPrimitive: "belief",
1987
+ tier: "workhorse",
1988
+ internal: true
1989
+ };
1990
+ var GET_LATTICE_COVERAGE = {
1991
+ name: "get_lattice_coverage",
1992
+ description: "Report belief lattice coverage for a topic. Like `git fsck` for ontology coverage \u2014 identifies anchored, hollow, and missing entity-type belief coverage.",
1993
+ parameters: {
1994
+ topicId: {
1995
+ type: "string",
1996
+ description: "Topic scope ID to check lattice coverage for"
1997
+ }
1998
+ },
1999
+ required: [],
2000
+ response: {
2001
+ description: "Per-entity-type coverage with overall score",
2002
+ fields: {
2003
+ topicId: "string",
2004
+ ontologyKey: "string | null",
2005
+ ontologyVersion: "string | null",
2006
+ entityTypes: "array \u2014 per-entity-type coverage rows",
2007
+ summary: "object \u2014 total/anchored/hollow/missing/coverageScore"
2008
+ }
2009
+ },
2010
+ ownerModule: "reasoning-kernel",
2011
+ ontologyPrimitive: "belief",
2012
+ tier: "workhorse",
2013
+ internal: true
2014
+ };
2015
+ var DISCOVER_ENTITY_CONNECTIONS = {
2016
+ name: "discover_entity_connections",
2017
+ description: "Find existing entities that should be connected to a belief/question/evidence node. Like `git log --diff-filter=M` for missing entity connections \u2014 scans entities in scope and suggests bridge edge types.",
2018
+ parameters: {
2019
+ nodeId: {
2020
+ type: "string",
2021
+ description: "Epistemic node ID to find entity connections for"
2022
+ },
2023
+ topicId: {
2024
+ type: "string",
2025
+ description: "Optional topic scope override"
2026
+ },
2027
+ minScore: {
2028
+ type: "number",
2029
+ description: "Minimum match score threshold"
2030
+ },
2031
+ limit: {
2032
+ type: "number",
2033
+ description: "Maximum candidates to return"
2034
+ }
2035
+ },
2036
+ required: ["nodeId"],
2037
+ response: {
2038
+ description: "Ranked entity connection candidates",
2039
+ fields: {
2040
+ nodeId: "string",
2041
+ candidateCount: "number",
2042
+ candidates: "array \u2014 suggested entity bridge candidates"
2043
+ }
2044
+ },
2045
+ ownerModule: "reasoning-kernel",
2046
+ ontologyPrimitive: "ontology",
2047
+ tier: "workhorse"
2048
+ };
2049
+ var TRIGGER_BELIEF_REVIEW = {
2050
+ name: "trigger_belief_review",
2051
+ description: "Flag beliefs for review after an entity changes. Like `git bisect` for stale beliefs \u2014 traverses bridge edges from the changed entity and creates review questions for stale connected beliefs.",
2052
+ parameters: {
2053
+ entityNodeId: {
2054
+ type: "string",
2055
+ description: "The entity node that changed"
2056
+ },
2057
+ changeDescription: {
2058
+ type: "string",
2059
+ description: "What changed about the entity"
2060
+ },
2061
+ maxQuestions: {
2062
+ type: "number",
2063
+ description: "Maximum review questions to create"
2064
+ }
2065
+ },
2066
+ required: ["entityNodeId"],
2067
+ response: {
2068
+ description: "Affected beliefs and created review questions",
2069
+ fields: {
2070
+ entityNodeId: "string",
2071
+ entityTitle: "string",
2072
+ entityType: "string",
2073
+ changeDescription: "string",
2074
+ affectedBeliefCount: "number",
2075
+ questionsCreated: "number",
2076
+ reviewedBeliefs: "array",
2077
+ questions: "array"
2078
+ }
2079
+ },
2080
+ ownerModule: "reasoning-kernel",
2081
+ ontologyPrimitive: "ontology",
2082
+ tier: "workhorse"
2083
+ };
2084
+ var EVALUATE_CONTRACT = {
2085
+ name: "evaluate_contract",
2086
+ description: "Run a contract evaluation and record the append-only result. Like `git test` for a belief binding \u2014 executes the evaluator, logs the result, and applies any allowed confidence modulation.",
2087
+ parameters: {
2088
+ contractId: { type: "string", description: "Which contract to evaluate" },
2089
+ trigger: {
2090
+ type: "string",
2091
+ description: "What caused this evaluation"
2092
+ }
2093
+ },
2094
+ required: ["contractId"],
2095
+ response: {
2096
+ description: "The most recent contract evaluation result",
2097
+ fields: {
2098
+ evaluationId: "string",
2099
+ result: "string",
2100
+ status: "string",
2101
+ confidenceBefore: "number",
2102
+ confidenceAfter: "number",
2103
+ rationale: "string"
2104
+ }
2105
+ },
2106
+ ownerModule: "graph-primitives",
2107
+ ontologyPrimitive: "belief",
2108
+ tier: "workhorse"
2109
+ };
2110
+ var GET_CONTRACT_STATUS = {
2111
+ name: "get_contract_status",
2112
+ description: "Inspect epistemic contracts and their latest evaluations. Like `git status` for verification bindings \u2014 returns the contract rows plus the freshest recorded evaluation for each one.",
2113
+ parameters: {
2114
+ beliefNodeId: {
2115
+ type: "string",
2116
+ description: "Return all contracts attached to a specific belief"
2117
+ },
2118
+ contractId: {
2119
+ type: "string",
2120
+ description: "Return one specific contract by contractId"
2121
+ },
2122
+ status: {
2123
+ type: "string",
2124
+ description: "Optional status filter applied after lookup",
2125
+ enum: ["active", "satisfied", "violated", "expired", "suspended", "archived"]
2126
+ }
2127
+ },
2128
+ required: [],
2129
+ response: {
2130
+ description: "Matching contract rows with latest evaluation context",
2131
+ fields: {
2132
+ contracts: "array \u2014 matching contracts with latestEvaluation attached",
2133
+ count: "number"
2134
+ }
2135
+ },
2136
+ ownerModule: "graph-primitives",
2137
+ ontologyPrimitive: "belief",
2138
+ tier: "workhorse"
2139
+ };
2140
+ var REGISTER_SESSION = {
2141
+ name: "register_session",
2142
+ description: "Announce this agent session's presence to other parallel sessions. Like `git init` for coordination \u2014 creates a session record so other agents can discover you.",
2143
+ parameters: {
2144
+ sessionName: { type: "string", description: "Human-readable session label" },
2145
+ agentType: { type: "string", description: "Agent type" },
2146
+ topicId: { type: "string", description: "Current Lucern topic scope ID" },
2147
+ worktreeId: { type: "string", description: "Active Lucern worktree ID" },
2148
+ gitBranch: { type: "string", description: "Current git branch name" }
2149
+ },
2150
+ required: [],
2151
+ response: {
2152
+ description: "Session registration result",
2153
+ fields: {
2154
+ sessionId: "string",
2155
+ status: "string \u2014 active",
2156
+ isNew: "boolean"
2157
+ }
2158
+ },
2159
+ ownerModule: "coordination",
2160
+ ontologyPrimitive: "graph",
2161
+ tier: "workhorse",
2162
+ internal: true
2163
+ };
2164
+ var HEARTBEAT_SESSION = {
2165
+ name: "heartbeat_session",
2166
+ description: "Update this session's heartbeat and optional status fields. Like `git status` \u2014 signals liveness and updates what you are working on.",
2167
+ parameters: {
2168
+ topicId: { type: "string", description: "Updated topic scope" },
2169
+ worktreeId: { type: "string", description: "Updated worktree ID" },
2170
+ gitBranch: { type: "string", description: "Updated git branch" },
2171
+ status: {
2172
+ type: "string",
2173
+ description: "Session status update",
2174
+ enum: ["active", "idle"]
2175
+ }
2176
+ },
2177
+ required: [],
2178
+ response: {
2179
+ description: "Heartbeat result",
2180
+ fields: {
2181
+ success: "boolean",
2182
+ message: "string"
2183
+ }
2184
+ },
2185
+ ownerModule: "coordination",
2186
+ ontologyPrimitive: "graph",
2187
+ tier: "workhorse",
2188
+ internal: true
2189
+ };
2190
+ var END_SESSION = {
2191
+ name: "end_session",
2192
+ description: "Gracefully end this agent session. Like `git stash` \u2014 marks the session as ended so other agents know you are gone.",
2193
+ parameters: {},
2194
+ required: [],
2195
+ response: {
2196
+ description: "Session end result",
2197
+ fields: {
2198
+ success: "boolean",
2199
+ message: "string"
2200
+ }
2201
+ },
2202
+ ownerModule: "coordination",
2203
+ ontologyPrimitive: "graph",
2204
+ tier: "workhorse",
2205
+ internal: true
2206
+ };
2207
+ var LIST_ACTIVE_SESSIONS = {
2208
+ name: "list_active_sessions",
2209
+ description: "See who else is online with active agent sessions, scope, branch, and file claims. Like `git branch --list` for live agents \u2014 shows active and idle sessions before editing.",
2210
+ parameters: {
2211
+ includeIdle: {
2212
+ type: "boolean",
2213
+ description: "Include idle sessions"
2214
+ }
2215
+ },
2216
+ required: [],
2217
+ response: {
2218
+ description: "List of active/idle agent sessions",
2219
+ fields: {
2220
+ sessions: "array \u2014 active session records"
2221
+ }
2222
+ },
2223
+ ownerModule: "coordination",
2224
+ ontologyPrimitive: "graph",
2225
+ tier: "workhorse",
2226
+ internal: true
2227
+ };
2228
+ var SEND_AGENT_MESSAGE = {
2229
+ name: "send_agent_message",
2230
+ description: "Send a directed message to a specific agent session. Like `git notes` \u2014 leaves a coordination note for a specific peer.",
2231
+ parameters: {
2232
+ toSessionId: { type: "string", description: "Target session ID" },
2233
+ content: { type: "string", description: "Message text" },
2234
+ messageType: {
2235
+ type: "string",
2236
+ description: "Message intent",
2237
+ enum: ["note", "question", "answer", "alert", "handoff"]
2238
+ },
2239
+ relatedBeliefId: {
2240
+ type: "string",
2241
+ description: "Optional related belief node ID"
2242
+ },
2243
+ relatedWorktreeId: {
2244
+ type: "string",
2245
+ description: "Optional related worktree ID"
2246
+ }
2247
+ },
2248
+ required: ["toSessionId", "content"],
2249
+ response: {
2250
+ description: "Message delivery result",
2251
+ fields: { messageId: "string" }
2252
+ },
2253
+ ownerModule: "coordination",
2254
+ ontologyPrimitive: "graph",
2255
+ tier: "workhorse",
2256
+ internal: true
2257
+ };
2258
+ var BROADCAST_MESSAGE = {
2259
+ name: "broadcast_message",
2260
+ description: "Send a message to all active agent sessions. Like `git tag` \u2014 marks an important event visible to everyone.",
2261
+ parameters: {
2262
+ content: { type: "string", description: "Broadcast message text" },
2263
+ messageType: {
2264
+ type: "string",
2265
+ description: "Message intent",
2266
+ enum: ["note", "alert", "handoff"]
2267
+ },
2268
+ relatedBeliefId: {
2269
+ type: "string",
2270
+ description: "Optional related belief node ID"
2271
+ },
2272
+ relatedWorktreeId: {
2273
+ type: "string",
2274
+ description: "Optional related worktree ID"
2275
+ }
2276
+ },
2277
+ required: ["content"],
2278
+ response: {
2279
+ description: "Broadcast result",
2280
+ fields: { messageId: "string" }
2281
+ },
2282
+ ownerModule: "coordination",
2283
+ ontologyPrimitive: "graph",
2284
+ tier: "workhorse",
2285
+ internal: true
2286
+ };
2287
+ var GET_AGENT_INBOX = {
2288
+ name: "get_agent_inbox",
2289
+ description: "Check unread messages addressed to this session. Like `git log --incoming` \u2014 shows direct and broadcast messages from other agents.",
2290
+ parameters: {
2291
+ limit: { type: "number", description: "Max messages to return" },
2292
+ markAsRead: {
2293
+ type: "boolean",
2294
+ description: "Mark returned messages as read"
2295
+ }
2296
+ },
2297
+ required: [],
2298
+ response: {
2299
+ description: "Inbox messages",
2300
+ fields: {
2301
+ messages: "array \u2014 unread direct and broadcast messages"
2302
+ }
2303
+ },
2304
+ ownerModule: "coordination",
2305
+ ontologyPrimitive: "graph",
2306
+ tier: "workhorse",
2307
+ internal: true
2308
+ };
2309
+ var CLAIM_FILES = {
2310
+ name: "claim_files",
2311
+ description: "Declare which files this session is actively editing. Like `git add` for coordination \u2014 tells other sessions what you are touching and returns advisory conflicts.",
2312
+ parameters: {
2313
+ files: {
2314
+ type: "array",
2315
+ description: "File paths this session is actively editing"
2316
+ }
2317
+ },
2318
+ required: ["files"],
2319
+ response: {
2320
+ description: "File claim result with conflict detection",
2321
+ fields: {
2322
+ success: "boolean",
2323
+ conflicts: "array \u2014 conflicting file claims"
2324
+ }
2325
+ },
2326
+ ownerModule: "coordination",
2327
+ ontologyPrimitive: "graph",
2328
+ tier: "workhorse",
2329
+ internal: true
2330
+ };
2331
+ var GENERATE_SESSION_HANDOFF = {
2332
+ name: "generate_session_handoff",
2333
+ description: "Generate a complete, zero-context handoff message for a new coding session. Like `git format-patch` \u2014 produces a self-contained instruction set that bootstraps a fresh Lucern worktree session.",
2334
+ parameters: {
2335
+ worktreeId: {
2336
+ type: "string",
2337
+ description: "The Lucern worktree ID to generate handoff instructions for"
2338
+ },
2339
+ gitWorktreePath: {
2340
+ type: "string",
2341
+ description: "Optional existing git worktree path"
2342
+ },
2343
+ gitBranchName: {
2344
+ type: "string",
2345
+ description: "Optional branch name for the session"
2346
+ },
2347
+ additionalContext: {
2348
+ type: "string",
2349
+ description: "Optional extra context to include in the handoff"
2350
+ }
2351
+ },
2352
+ required: ["worktreeId"],
2353
+ response: {
2354
+ description: "A complete handoff message ready for a new coding session",
2355
+ fields: {
2356
+ handoffMessage: "string",
2357
+ worktreeId: "string",
2358
+ worktreeName: "string",
2359
+ trackBoundary: "object",
2360
+ needsActivation: "boolean",
2361
+ needsGitSetup: "string \u2014 create | fast-forward | ready"
2362
+ }
2363
+ },
2364
+ ownerModule: "bootstrap",
2365
+ ontologyPrimitive: "worktree",
2366
+ tier: "showcase",
2367
+ internal: true
2368
+ };
2369
+ var BEGIN_BUILD_SESSION = {
2370
+ name: "begin_build_session",
2371
+ 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.",
2372
+ parameters: {
2373
+ worktreeId: {
2374
+ type: "string",
2375
+ description: "The Lucern worktree ID to bootstrap."
2376
+ },
2377
+ branch: {
2378
+ type: "string",
2379
+ description: "Optional git branch name. Auto-generated from the worktree name when omitted."
2380
+ },
2381
+ branchBase: {
2382
+ type: "string",
2383
+ description: 'Base branch for the feature branch. Default: "staging".'
2384
+ },
2385
+ prBase: {
2386
+ type: "string",
2387
+ description: 'Target branch for the PR. Default: "staging".'
2388
+ },
2389
+ sessionMode: {
2390
+ type: "string",
2391
+ description: 'Session mode: "async" for Codex/headless or "interactive" for live sessions.',
2392
+ enum: ["async", "interactive"]
2393
+ },
2394
+ activateIfPlanning: {
2395
+ type: "boolean",
2396
+ description: "When true, automatically activate a planning worktree during bootstrap."
2397
+ }
2398
+ },
2399
+ required: ["worktreeId"],
2400
+ response: {
2401
+ description: "A compact build-session packet with worktree metadata, graph anchors, questions, dependencies, and git defaults.",
2402
+ fields: {
2403
+ topicId: "string \u2014 canonical topic scope",
2404
+ topicName: "string \u2014 human-readable topic name",
2405
+ worktreeId: "string \u2014 worktree ID",
2406
+ worktreeName: "string \u2014 human-readable worktree name",
2407
+ branch: "string \u2014 git branch name",
2408
+ branchBase: "string \u2014 base branch",
2409
+ prBase: "string \u2014 PR target branch",
2410
+ campaign: "number | null \u2014 top-level pipeline campaign",
2411
+ lane: "string \u2014 campaign lane",
2412
+ gate: "string \u2014 exit gate",
2413
+ hypothesis: "string \u2014 worktree hypothesis",
2414
+ focus: "string \u2014 session focus",
2415
+ status: "string \u2014 worktree status after optional activation",
2416
+ sessionMode: "string \u2014 async | interactive",
2417
+ targetBeliefIds: "array \u2014 scoped belief IDs",
2418
+ targetQuestionIds: "array \u2014 scoped question IDs",
2419
+ taskIds: "array \u2014 assigned task IDs for this worktree",
2420
+ incompleteTaskIds: "array \u2014 assigned task IDs that still require done/deferred/blocked proof",
2421
+ tasks: "array \u2014 assigned task packet with id, title, status, priority, links, and summaries",
2422
+ topBeliefs: "array \u2014 highest-confidence scoped beliefs",
2423
+ openQuestions: "array \u2014 open scoped questions",
2424
+ resolvedDecisions: "array \u2014 answered questions summarized for the session",
2425
+ dependencies: "array \u2014 upstream worktrees",
2426
+ unblocks: "array \u2014 downstream worktrees",
2427
+ mergeOrderNotes: "string \u2014 merge ordering advisory"
2428
+ }
2429
+ },
2430
+ ownerModule: "bootstrap",
2431
+ ontologyPrimitive: "worktree",
2432
+ tier: "showcase",
2433
+ internal: true
2434
+ };
2435
+
2436
+ // src/tool-contracts.policy-observation-task-topic.ts
2437
+ var CHECK_PERMISSION = {
2438
+ name: "check_permission",
2439
+ description: "Check whether a principal can read or mutate a topic scope. Like `git check-ref-format` for ACLs \u2014 validates whether the requested operation is allowed before execution.",
2440
+ parameters: {
2441
+ topicId: { type: "string", description: "Topic scope to evaluate" },
2442
+ permission: {
2443
+ type: "string",
2444
+ description: "Permission to evaluate",
2445
+ enum: ["read", "write"]
2446
+ },
2447
+ principal: {
2448
+ type: "string",
2449
+ description: "Optional principal override (defaults to current principal)"
2450
+ },
2451
+ beliefClusterId: {
2452
+ type: "string",
2453
+ description: "Optional neighborhood scope within a topic"
2454
+ }
2455
+ },
2456
+ required: ["topicId", "permission"],
2457
+ response: {
2458
+ description: "Permission evaluation result",
2459
+ fields: {
2460
+ allowed: "boolean",
2461
+ decision: "string \u2014 allow | deny",
2462
+ reasonCode: "string",
2463
+ principalId: "string",
2464
+ topicId: "string",
2465
+ permission: "string \u2014 read | write"
2466
+ }
2467
+ },
2468
+ ownerModule: "access-control",
2469
+ ontologyPrimitive: "policy",
2470
+ tier: "workhorse"
2471
+ };
2472
+ var FILTER_BY_PERMISSION = {
2473
+ name: "filter_by_permission",
2474
+ description: "Filter a topic set down to ACL-authorized topics. Like `git rev-list --ancestry-path` for policy boundaries \u2014 keeps only topics permitted for the requested action.",
2475
+ parameters: {
2476
+ topicIds: { type: "array", description: "Topic IDs to evaluate" },
2477
+ permission: {
2478
+ type: "string",
2479
+ description: "Permission filter",
2480
+ enum: ["read", "write"]
2481
+ },
2482
+ principal: {
2483
+ type: "string",
2484
+ description: "Optional principal override (tenant admin only)"
2485
+ }
2486
+ },
2487
+ required: ["topicIds", "permission"],
2488
+ response: {
2489
+ description: "Allowed/denied split for the requested topic set",
2490
+ fields: {
2491
+ permission: "string \u2014 read | write",
2492
+ allowedTopicIds: "array \u2014 topic IDs allowed by policy",
2493
+ deniedTopics: "array \u2014 { topicId, reasonCode }",
2494
+ count: "number"
2495
+ }
2496
+ },
2497
+ ownerModule: "access-control",
2498
+ ontologyPrimitive: "policy",
2499
+ tier: "workhorse"
2500
+ };
2501
+ var INGEST_OBSERVATION = {
2502
+ name: "ingest_observation",
2503
+ description: "Record an observational delta for a topic context stream. Like `git notes add` \u2014 attaches structured observation metadata without mutating graph state directly. Used by watcher/cowork agents to stage candidate updates before explicit write confirmation.",
2504
+ parameters: {
2505
+ topicId: {
2506
+ type: "string",
2507
+ description: "Optional topic scope hint for the observation"
2508
+ },
2509
+ observationType: {
2510
+ type: "string",
2511
+ description: "Observation class",
2512
+ enum: [
2513
+ "claim",
2514
+ "evidence",
2515
+ "question",
2516
+ "contradiction",
2517
+ "judgment",
2518
+ "note"
2519
+ ]
2520
+ },
2521
+ summary: {
2522
+ type: "string",
2523
+ description: "Human-readable observation summary"
2524
+ },
2525
+ source: {
2526
+ type: "string",
2527
+ description: "Optional source (message ID, tool name, URL, etc.)"
2528
+ },
2529
+ confidence: { type: "number", description: "Optional confidence in [0,1]" },
2530
+ tags: { type: "array", description: "Optional observation tags" },
2531
+ metadata: {
2532
+ type: "object",
2533
+ description: "Optional structured metadata payload"
2534
+ }
2535
+ },
2536
+ required: ["observationType", "summary"],
2537
+ response: {
2538
+ description: "Recorded observation entry",
2539
+ fields: {
2540
+ observationId: "string",
2541
+ topicId: "string",
2542
+ observationType: "string",
2543
+ createdAt: "number",
2544
+ contextResourceUri: "string"
2545
+ }
2546
+ },
2547
+ ownerModule: "agent-frameworks",
2548
+ ontologyPrimitive: "graph",
2549
+ tier: "workhorse"
2550
+ };
2551
+ var GET_OBSERVATION_CONTEXT = {
2552
+ name: "get_observation_context",
2553
+ description: "Retrieve observer-ready context for a topic, including recent deltas and semantic matches. Like `git log --grep` \u2014 shows recent context and filtered matches across observation history. This powers prompt context injection without mutating graph state.",
2554
+ parameters: {
2555
+ topicId: { type: "string", description: "Optional topic scope hint" },
2556
+ query: {
2557
+ type: "string",
2558
+ description: "Optional semantic query over observation history"
2559
+ },
2560
+ limit: {
2561
+ type: "number",
2562
+ description: "Maximum entries in each returned collection"
2563
+ }
2564
+ },
2565
+ required: ["topicId"],
2566
+ response: {
2567
+ description: "Observation context payload",
2568
+ fields: {
2569
+ topicId: "string",
2570
+ totalObservations: "number",
2571
+ latest: "array",
2572
+ semanticMatches: "array",
2573
+ byType: "object",
2574
+ generatedAt: "number"
2575
+ }
2576
+ },
2577
+ ownerModule: "agent-frameworks",
2578
+ ontologyPrimitive: "graph",
2579
+ tier: "workhorse"
2580
+ };
2581
+ var CREATE_TASK = {
2582
+ name: "create_task",
2583
+ 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.",
2584
+ parameters: {
2585
+ title: { type: "string", description: "Task title" },
2586
+ topicId: { type: "string", description: "Topic scope" },
2587
+ description: {
2588
+ type: "string",
2589
+ description: "Long-form task description"
2590
+ },
2591
+ taskType: {
2592
+ type: "string",
2593
+ description: "Task taxonomy",
2594
+ enum: [
2595
+ "general",
2596
+ "find_evidence",
2597
+ "verify_claim",
2598
+ "research",
2599
+ "review",
2600
+ "interview",
2601
+ "analysis",
2602
+ "track_metrics"
2603
+ ]
2604
+ },
2605
+ priority: {
2606
+ type: "string",
2607
+ description: "Priority",
2608
+ enum: ["urgent", "high", "medium", "low"]
2609
+ },
2610
+ status: {
2611
+ type: "string",
2612
+ description: "Initial status (defaults to todo)",
2613
+ enum: ["todo", "in_progress", "blocked", "done"]
2614
+ },
2615
+ linkedWorktreeId: {
2616
+ type: "string",
2617
+ description: "Worktree this task belongs to"
2618
+ },
2619
+ linkedBeliefId: {
2620
+ type: "string",
2621
+ description: "Belief this task supports"
2622
+ },
2623
+ linkedQuestionId: {
2624
+ type: "string",
2625
+ description: "Question this task addresses"
2626
+ },
2627
+ assigneeId: {
2628
+ type: "string",
2629
+ description: "Principal assigned to the task"
2630
+ },
2631
+ dueDate: {
2632
+ type: "number",
2633
+ description: "Due date as epoch milliseconds"
2634
+ },
2635
+ tags: {
2636
+ type: "array",
2637
+ description: "Free-form string tags"
2638
+ },
2639
+ metadata: {
2640
+ type: "object",
2641
+ description: "Structured task metadata for handoff context and routing hints"
2642
+ }
2643
+ },
2644
+ required: ["title"],
2645
+ response: {
2646
+ description: "The created task",
2647
+ fields: {
2648
+ taskId: "string",
2649
+ status: "string \u2014 'pending'",
2650
+ createdAt: "number"
2651
+ }
2652
+ },
2653
+ ownerModule: "workflow-engine",
2654
+ ontologyPrimitive: "task",
2655
+ tier: "workhorse"
2656
+ };
2657
+ var COMPLETE_TASK = {
2658
+ name: "complete_task",
2659
+ description: "Mark a task as complete with an output summary. Like `git tag` for work items \u2014 records the discrete completion event and captures what was learned. Completed tasks feed back into the evidence graph.",
2660
+ parameters: {
2661
+ taskId: { type: "string", description: "The task to complete" },
2662
+ outputSummary: {
2663
+ type: "string",
2664
+ description: "What was accomplished or learned"
2665
+ },
2666
+ evidenceCreated: {
2667
+ type: "boolean",
2668
+ description: "Whether new evidence was created from this task"
2669
+ }
2670
+ },
2671
+ required: ["taskId", "outputSummary"],
2672
+ response: {
2673
+ description: "The completed task",
2674
+ fields: {
2675
+ taskId: "string",
2676
+ completedAt: "number",
2677
+ outputSummary: "string"
2678
+ }
2679
+ },
2680
+ ownerModule: "workflow-engine",
2681
+ ontologyPrimitive: "task",
2682
+ tier: "workhorse"
2683
+ };
2684
+ var UPDATE_TASK = {
2685
+ name: "update_task",
2686
+ description: "Update a task's fields \u2014 relink to a different worktree, belief, or question, change title/priority/status. Like `git task edit` \u2014 mutates an existing task in place instead of requiring recreate-plus-supersede.",
2687
+ parameters: {
2688
+ taskId: { type: "string", description: "The task to update" },
2689
+ linkedWorktreeId: {
2690
+ type: "string",
2691
+ description: "Reassign this task to a different worktree"
2692
+ },
2693
+ linkedBeliefId: {
2694
+ type: "string",
2695
+ description: "Link or relink this task to a belief node"
2696
+ },
2697
+ linkedQuestionId: {
2698
+ type: "string",
2699
+ description: "Link or relink this task to a question node"
2700
+ },
2701
+ title: { type: "string", description: "Updated task title" },
2702
+ description: {
2703
+ type: "string",
2704
+ description: "Updated task description"
2705
+ },
2706
+ priority: {
2707
+ type: "string",
2708
+ description: "Updated priority",
2709
+ enum: ["critical", "high", "medium", "low"]
2710
+ },
2711
+ status: {
2712
+ type: "string",
2713
+ description: "Updated status",
2714
+ enum: ["todo", "in_progress", "blocked", "done"]
2715
+ },
2716
+ metadata: {
2717
+ type: "object",
2718
+ description: "Structured task metadata to replace or refine"
2719
+ }
2720
+ },
2721
+ required: ["taskId"],
2722
+ response: {
2723
+ description: "The updated task",
2724
+ fields: {
2725
+ taskId: "string",
2726
+ updatedAt: "number"
2727
+ }
2728
+ },
2729
+ ownerModule: "workflow-engine",
2730
+ ontologyPrimitive: "task",
2731
+ tier: "workhorse"
2732
+ };
2733
+ var LIST_TASKS = {
2734
+ name: "list_tasks",
2735
+ description: "List tasks for a topic or worktree. Like `git task list` \u2014 returns tasks with status, priority, and linked nodes. Filter by worktree to see tasks for a specific investigation, or by status to find incomplete work.",
2736
+ parameters: {
2737
+ topicId: { type: "string", description: "Topic scope" },
2738
+ linkedWorktreeId: {
2739
+ type: "string",
2740
+ description: "Filter to tasks linked to this worktree"
2741
+ },
2742
+ worktreeId: {
2743
+ type: "string",
2744
+ description: "Alias for linkedWorktreeId"
2745
+ },
2746
+ status: {
2747
+ type: "string",
2748
+ description: "Filter by status: todo, in_progress, blocked, done",
2749
+ enum: ["todo", "in_progress", "blocked", "done"]
2750
+ },
2751
+ limit: { type: "number", description: "Maximum results (default: 100)" }
2752
+ },
2753
+ required: ["topicId"],
2754
+ response: {
2755
+ description: "List of tasks with metadata",
2756
+ fields: { tasks: "array of task objects", count: "number" }
2757
+ },
2758
+ ownerModule: "workflow-engine",
2759
+ ontologyPrimitive: "task",
2760
+ tier: "workhorse"
2761
+ };
2762
+ var CREATE_TOPIC = {
2763
+ name: "create_topic",
2764
+ 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.",
2765
+ parameters: {
2766
+ globalId: {
2767
+ type: "string",
2768
+ description: "Optional idempotent topic global ID"
2769
+ },
2770
+ name: { type: "string", description: "Topic name" },
2771
+ type: {
2772
+ type: "string",
2773
+ description: "Topic type. Validated against schemaEnumConfig category 'topic_type'."
2774
+ },
2775
+ description: { type: "string", description: "What this topic covers" },
2776
+ parentTopicId: {
2777
+ type: "string",
2778
+ description: "Optional parent topic for nesting"
2779
+ },
2780
+ parentTopicGlobalId: {
2781
+ type: "string",
2782
+ description: "Optional parent topic global ID for nesting"
2783
+ },
2784
+ tenantId: { type: "string", description: "Optional tenant scope" },
2785
+ workspaceId: { type: "string", description: "Optional workspace scope" },
2786
+ visibility: {
2787
+ type: "string",
2788
+ description: "Topic visibility",
2789
+ enum: ["private", "team", "firm", "external", "public"]
2790
+ },
2791
+ metadata: { type: "object", description: "Optional topic metadata" },
2792
+ createdBy: { type: "string", description: "Who created this topic" }
2793
+ },
2794
+ required: ["name", "type"],
2795
+ response: {
2796
+ description: "The created topic",
2797
+ fields: {
2798
+ id: "string \u2014 topic ID",
2799
+ globalId: "string \u2014 globally unique ID",
2800
+ topicGlobalId: "string \u2014 topic global ID",
2801
+ epistemicNodeId: "string \u2014 materialized topic node ID",
2802
+ epistemicNodeGlobalId: "string \u2014 materialized topic node global ID",
2803
+ depth: "number \u2014 nesting depth"
2804
+ }
2805
+ },
2806
+ ownerModule: "reasoning-kernel",
2807
+ ontologyPrimitive: "graph",
2808
+ tier: "showcase"
2809
+ };
2810
+ var LIST_TOPICS = {
2811
+ name: "list_topics",
2812
+ description: "List topics, optionally filtered by type or parent. Like `git remote -v` \u2014 shows all knowledge containers with their types and hierarchy.",
2813
+ parameters: {
2814
+ type: {
2815
+ type: "string",
2816
+ description: "Filter by topic type (e.g., 'theme', 'deal')"
2817
+ },
2818
+ parentTopicId: {
2819
+ type: "string",
2820
+ description: "Filter to children of this parent"
2821
+ },
2822
+ status: {
2823
+ type: "string",
2824
+ description: "Filter by status",
2825
+ enum: ["active", "archived", "watching"]
2826
+ }
2827
+ },
2828
+ required: [],
2829
+ response: {
2830
+ description: "List of topics with metadata",
2831
+ fields: {
2832
+ topics: "array \u2014 { id, name, type, depth, status, parentTopicId }"
2833
+ }
2834
+ },
2835
+ ownerModule: "reasoning-kernel",
2836
+ ontologyPrimitive: "graph",
2837
+ tier: "workhorse"
2838
+ };
2839
+ var GET_TOPIC = {
2840
+ name: "get_topic",
2841
+ description: "Get one topic by ID. Like `git remote show origin` \u2014 inspects a single knowledge container in detail.",
2842
+ parameters: {
2843
+ topicId: {
2844
+ type: "string",
2845
+ description: "Canonical topic ID to retrieve"
2846
+ },
2847
+ id: {
2848
+ type: "string",
2849
+ description: "Legacy alias for topicId"
2850
+ }
2851
+ },
2852
+ required: ["topicId"],
2853
+ response: {
2854
+ description: "Single topic record",
2855
+ fields: {
2856
+ topic: "object \u2014 { id, globalId, name, type, depth, status, parentTopicId, description }"
2857
+ }
2858
+ },
2859
+ ownerModule: "reasoning-kernel",
2860
+ ontologyPrimitive: "graph",
2861
+ tier: "workhorse"
2862
+ };
2863
+ var UPDATE_TOPIC = {
2864
+ name: "update_topic",
2865
+ description: "Update an existing topic's metadata. Like `git remote set-url` \u2014 changes the canonical configuration for a knowledge container without recreating it.",
2866
+ parameters: {
2867
+ topicId: {
2868
+ type: "string",
2869
+ description: "Canonical topic ID to update"
2870
+ },
2871
+ id: {
2872
+ type: "string",
2873
+ description: "Legacy alias for topicId"
2874
+ },
2875
+ name: { type: "string", description: "Updated topic name" },
2876
+ description: { type: "string", description: "Updated topic description" },
2877
+ type: {
2878
+ type: "string",
2879
+ description: "Updated topic type. Validated against schemaEnumConfig category 'topic_type'."
2880
+ },
2881
+ ontologyId: {
2882
+ type: "string",
2883
+ description: "Updated ontology binding"
2884
+ },
2885
+ clearOntologyId: {
2886
+ type: "boolean",
2887
+ description: "Clear the current ontology binding"
2888
+ },
2889
+ status: {
2890
+ type: "string",
2891
+ description: "Updated topic status",
2892
+ enum: ["active", "archived", "watching"]
2893
+ },
2894
+ visibility: {
2895
+ type: "string",
2896
+ description: "Updated topic visibility",
2897
+ enum: ["private", "team", "firm", "external", "public"]
2898
+ }
2899
+ },
2900
+ required: [],
2901
+ response: {
2902
+ description: "The updated topic",
2903
+ fields: {
2904
+ id: "string \u2014 topic ID",
2905
+ globalId: "string \u2014 globally unique ID",
2906
+ status: "string \u2014 topic lifecycle status",
2907
+ visibility: "string \u2014 topic visibility"
2908
+ }
2909
+ },
2910
+ ownerModule: "reasoning-kernel",
2911
+ ontologyPrimitive: "graph",
2912
+ tier: "workhorse"
2913
+ };
2914
+ var GET_TOPIC_TREE = {
2915
+ name: "get_topic_tree",
2916
+ description: "Get the full topic hierarchy from a root. Like `git log --graph --all` \u2014 shows the complete tree of nested topics.",
2917
+ parameters: {
2918
+ rootId: { type: "string", description: "Root topic to start from" },
2919
+ maxDepth: {
2920
+ type: "number",
2921
+ description: "Maximum depth to traverse (default: 5)"
2922
+ }
2923
+ },
2924
+ required: ["rootId"],
2925
+ response: {
2926
+ description: "Tree of topics with nesting",
2927
+ fields: { tree: "array \u2014 topics in BFS order with depth and path" }
2928
+ },
2929
+ ownerModule: "reasoning-kernel",
2930
+ ontologyPrimitive: "graph",
2931
+ tier: "workhorse"
2932
+ };
2933
+ var MATERIALIZE_TOPIC_GRAPH = {
2934
+ name: "materialize_topic_graph",
2935
+ description: "Backfill the topic graph spine. Like `git fsck --connectivity-only` with repair enabled \u2014 creates missing topic nodes and parent-child edges idempotently.",
2936
+ parameters: {
2937
+ rootTopicId: {
2938
+ type: "string",
2939
+ description: "Optional root topic for a bounded materialization pass"
2940
+ },
2941
+ dryRun: {
2942
+ type: "boolean",
2943
+ description: "When true, report missing rows without writing them"
2944
+ }
2945
+ },
2946
+ required: [],
2947
+ response: {
2948
+ description: "Topic graph materialization counts",
2949
+ fields: {
2950
+ topicsSeen: "number",
2951
+ nodesCreated: "number",
2952
+ nodesExisting: "number",
2953
+ edgesCreated: "number",
2954
+ edgesExisting: "number",
2955
+ errors: "array"
2956
+ }
2957
+ },
2958
+ ownerModule: "reasoning-kernel",
2959
+ ontologyPrimitive: "graph",
2960
+ tier: "workhorse"
2961
+ };
2962
+ var GET_TOPIC_GRAPH_SPINE = {
2963
+ name: "get_topic_graph_spine",
2964
+ description: "Verify the topic graph spine. Like `git fsck` \u2014 reads topics, materialized topic nodes, parent-child edges, and missing spine rows.",
2965
+ parameters: {
2966
+ rootTopicId: {
2967
+ type: "string",
2968
+ description: "Optional root topic for a bounded verifier pass"
2969
+ },
2970
+ includeTopicBeliefEdges: {
2971
+ type: "boolean",
2972
+ description: "Include topic -> belief edges in the verifier payload"
2973
+ }
2974
+ },
2975
+ required: [],
2976
+ response: {
2977
+ description: "Topic graph spine verification payload",
2978
+ fields: {
2979
+ ok: "boolean",
2980
+ counts: "object",
2981
+ topics: "array",
2982
+ topicNodes: "array",
2983
+ parentEdges: "array",
2984
+ missingTopicNodes: "array",
2985
+ missingParentEdges: "array"
2986
+ }
2987
+ },
2988
+ ownerModule: "reasoning-kernel",
2989
+ ontologyPrimitive: "graph",
2990
+ tier: "workhorse"
2991
+ };
2992
+ var GET_CODE_CONTEXT = {
2993
+ name: "get_code_context",
2994
+ 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.",
2995
+ parameters: {
2996
+ filePath: {
2997
+ type: "string",
2998
+ description: "File path to search for (partial matches supported, e.g. 'epistemicBeliefs.ts' or 'convex/epistemicBeliefs.ts')"
2999
+ },
3000
+ topicId: {
3001
+ type: "string",
3002
+ description: "Topic scope (optional, uses default if not provided)"
3003
+ },
3004
+ includeFailures: {
3005
+ type: "boolean",
3006
+ description: "Whether to include failed attempt evidence (default: true)"
3007
+ }
3008
+ },
3009
+ required: ["filePath"],
3010
+ response: {
3011
+ description: "Code-anchored beliefs and evidence grouped by type",
3012
+ fields: {
3013
+ filePath: "string \u2014 queried path",
3014
+ decisions: "array \u2014 implementation_decision beliefs",
3015
+ contracts: "array \u2014 interface_contract beliefs",
3016
+ migrations: "array \u2014 migration_state beliefs",
3017
+ patterns: "array \u2014 code_pattern beliefs",
3018
+ deprecations: "array \u2014 deprecation_notice beliefs",
3019
+ failures: "array \u2014 failed attempt evidence",
3020
+ totalMatched: "number"
3021
+ }
3022
+ },
3023
+ ownerModule: "coding-intelligence",
3024
+ ontologyPrimitive: "belief",
3025
+ tier: "showcase"
3026
+ };
3027
+ var GET_CHANGE_HISTORY = {
3028
+ name: "get_change_history",
3029
+ description: "Returns recent changes and decisions for a file path \u2014 the 'why' behind recent code changes. Like `git log --follow <path>` \u2014 shows the evolution of understanding anchored to a specific file. Searches beliefs and evidence updated recently, sorted by most recent first.",
3030
+ parameters: {
3031
+ filePath: { type: "string", description: "File path to get history for" },
3032
+ topicId: { type: "string", description: "Topic scope (optional)" },
3033
+ limit: { type: "number", description: "Max results (default: 10)" }
3034
+ },
3035
+ required: ["filePath"],
3036
+ response: {
3037
+ description: "Recent code-anchored changes sorted by recency",
3038
+ fields: {
3039
+ filePath: "string \u2014 queried path",
3040
+ changes: "array \u2014 nodes with coding view (nodeId, beliefType, canonicalText, codeAnchors, timestamps)",
3041
+ totalFound: "number",
3042
+ showing: "number"
3043
+ }
3044
+ },
3045
+ ownerModule: "coding-intelligence",
3046
+ ontologyPrimitive: "belief",
3047
+ tier: "workhorse"
3048
+ };
3049
+ var RECORD_ATTEMPT = {
3050
+ name: "record_attempt",
3051
+ description: "Log a failed approach as evidence linked to a belief. Like `git stash` for failed experiments \u2014 preserves what was tried so the same mistake isn't repeated. Creates evidence with metadata.failedApproach=true and metadata.codeAnchors. The key anti-repetition mechanism: future agents check the failure log before trying new approaches.",
3052
+ parameters: {
3053
+ description: {
3054
+ type: "string",
3055
+ description: "What was attempted and why it failed"
3056
+ },
3057
+ filePaths: {
3058
+ type: "array",
3059
+ description: "File paths involved in the attempt"
3060
+ },
3061
+ errorMessage: {
3062
+ type: "string",
3063
+ description: "Error message or failure reason"
3064
+ },
3065
+ linkedBeliefId: {
3066
+ type: "string",
3067
+ description: "Belief this attempt was targeting (creates -0.5 weight edge)"
3068
+ },
3069
+ topicId: { type: "string", description: "Topic scope (optional)" }
3070
+ },
3071
+ required: ["description"],
3072
+ response: {
3073
+ description: "The recorded failed attempt evidence node",
3074
+ fields: {
3075
+ nodeId: "string \u2014 evidence node ID",
3076
+ edgeId: "string | null \u2014 edge to linked belief",
3077
+ recorded: "boolean \u2014 true",
3078
+ filePaths: "array \u2014 anchored file paths"
3079
+ }
3080
+ },
3081
+ ownerModule: "coding-intelligence",
3082
+ ontologyPrimitive: "evidence",
3083
+ tier: "showcase"
3084
+ };
3085
+ var GET_FAILURE_LOG = {
3086
+ name: "get_failure_log",
3087
+ description: "Search past failed attempts matching a task description. Like `git log --grep='FAILED'` \u2014 finds evidence of what was tried before and didn't work. Before trying a new approach, check this log to avoid repeating the same mistake. Filters to evidence with metadata.failedApproach=true, sorted by recency.",
3088
+ parameters: {
3089
+ query: {
3090
+ type: "string",
3091
+ description: "Description of the task or approach to search for"
3092
+ },
3093
+ filePath: {
3094
+ type: "string",
3095
+ description: "Optional file path to narrow results"
3096
+ },
3097
+ topicId: { type: "string", description: "Topic scope (optional)" },
3098
+ limit: { type: "number", description: "Max results (default: 5)" }
3099
+ },
3100
+ required: ["query"],
3101
+ response: {
3102
+ description: "Failed attempts matching the query",
3103
+ fields: {
3104
+ query: "string \u2014 search query",
3105
+ failures: "array \u2014 failed attempt evidence with coding view",
3106
+ totalFound: "number",
3107
+ showing: "number"
3108
+ }
3109
+ },
3110
+ ownerModule: "coding-intelligence",
3111
+ ontologyPrimitive: "evidence",
3112
+ tier: "showcase"
3113
+ };
3114
+ var GET_TOPIC_COVERAGE = {
3115
+ name: "get_topic_coverage",
3116
+ description: "Returns per-topic belief/question/evidence counts across the topic tree. Like `git diff --stat` for the knowledge graph \u2014 shows coverage density and empty spots across the topic hierarchy. Use to identify which topics need more beliefs, which lack questions, and overall graph health.",
3117
+ parameters: {
3118
+ topicId: {
3119
+ type: "string",
3120
+ description: "Topic scope ID (optional, uses default if not provided)"
3121
+ },
3122
+ includeDescendants: {
3123
+ type: "boolean",
3124
+ description: "Whether to include descendant topics in the coverage report (default: true)"
3125
+ },
3126
+ maxDepth: {
3127
+ type: "number",
3128
+ description: "Maximum descendant topic depth for neighborhood expansion. Defaults to 4 for root/theme scopes, 2 for deeper scopes."
3129
+ }
3130
+ },
3131
+ required: [],
3132
+ response: {
3133
+ description: "Per-topic coverage metrics and aggregate summary",
3134
+ fields: {
3135
+ topics: "array \u2014 per-topic { topicId, name, type, depth, beliefs, questions, evidence, coverage }",
3136
+ summary: "object \u2014 { totalTopics, coveredTopics, emptyTopics, coveragePercent, totalBeliefs, totalQuestions, totalEvidence }",
3137
+ scopeTopicId: "string \u2014 the root topic used for scoping"
3138
+ }
3139
+ },
3140
+ ownerModule: "coverage-intelligence",
3141
+ ontologyPrimitive: "graph",
3142
+ tier: "showcase"
3143
+ };
3144
+ var GET_GRAPH_GAPS = {
3145
+ name: "get_graph_gaps",
3146
+ description: "Identify structural gaps in the knowledge graph \u2014 empty topics, beliefs without questions, beliefs without evidence, and orphan edges. Like `git fsck` for reasoning coverage \u2014 surfaces holes that weaken the epistemic foundation. Returns prioritized gap list.",
3147
+ parameters: {
3148
+ topicId: {
3149
+ type: "string",
3150
+ description: "Topic scope ID (optional, uses default if not provided)"
3151
+ },
3152
+ maxDepth: {
3153
+ type: "number",
3154
+ description: "Maximum descendant topic depth for neighborhood expansion (default: 4)"
3155
+ }
3156
+ },
3157
+ required: ["topicId"],
3158
+ response: {
3159
+ description: "Prioritized list of graph gaps by category",
3160
+ fields: {
3161
+ emptyTopics: "array \u2014 topics with zero beliefs { topicId, name, type, depth }",
3162
+ beliefsWithoutQuestions: "array \u2014 beliefs that have no testing questions { nodeId, canonicalText, topicId }",
3163
+ beliefsWithoutEvidence: "array \u2014 beliefs that have no supporting evidence { nodeId, canonicalText, topicId }",
3164
+ summary: "object \u2014 { totalGaps, emptyTopicCount, untestedBeliefCount, unsupportedBeliefCount }",
3165
+ scopeTopicId: "string \u2014 the root topic used for scoping"
3166
+ }
3167
+ },
3168
+ ownerModule: "coverage-intelligence",
3169
+ ontologyPrimitive: "graph",
3170
+ tier: "showcase"
3171
+ };
3172
+
3173
+ // src/tool-contracts.questions-listing.ts
3174
+ var CREATE_QUESTION = {
3175
+ name: "create_question",
3176
+ description: "Commit an investigation question to the reasoning graph. Like `git issue` \u2014 creates a traceable question that drives research and evidence collection. Questions test beliefs and guide worktree investigation.",
3177
+ parameters: {
3178
+ text: { type: "string", description: "The question text" },
3179
+ topicId: { type: "string", description: "Optional topic scope hint" },
3180
+ priority: {
3181
+ type: "string",
3182
+ description: "Priority: urgent, high, medium, low",
3183
+ enum: ["urgent", "high", "medium", "low"]
3184
+ },
3185
+ linkedBeliefId: {
3186
+ type: "string",
3187
+ description: "Belief this question tests"
3188
+ },
3189
+ metadata: {
3190
+ type: "object",
3191
+ description: "Optional metadata merged into the question record"
3192
+ }
3193
+ },
3194
+ required: ["text"],
3195
+ response: {
3196
+ description: "The created canonical question record",
3197
+ fields: {
3198
+ id: "string \u2014 canonical question ID",
3199
+ nodeId: "string \u2014 canonical question ID",
3200
+ questionId: "string \u2014 canonical question ID",
3201
+ text: "string",
3202
+ status: "string"
3203
+ }
3204
+ },
3205
+ ownerModule: "graph-primitives",
3206
+ ontologyPrimitive: "question",
3207
+ tier: "workhorse"
3208
+ };
3209
+ var GET_QUESTION = {
3210
+ name: "get_question",
3211
+ description: "Read one question by ID. Like `git show` \u2014 resolves the canonical question payload for a single identifier.",
3212
+ parameters: {
3213
+ id: { type: "string", description: "Canonical question ID" }
3214
+ },
3215
+ required: ["id"],
3216
+ response: {
3217
+ description: "The canonical question record",
3218
+ fields: {
3219
+ id: "string \u2014 canonical question ID",
3220
+ nodeId: "string \u2014 canonical question ID",
3221
+ questionId: "string \u2014 canonical question ID",
3222
+ text: "string",
3223
+ status: "string"
3224
+ }
3225
+ },
3226
+ ownerModule: "graph-primitives",
3227
+ ontologyPrimitive: "question",
3228
+ tier: "workhorse"
3229
+ };
3230
+ var REFINE_QUESTION = {
3231
+ name: "refine_question",
3232
+ description: "Refine a question's framing or scope. Like `git commit --amend` for questions \u2014 updates the question text while preserving its identity and linked evidence.",
3233
+ parameters: {
3234
+ id: { type: "string", description: "The question to refine" },
3235
+ text: { type: "string", description: "Updated question text" },
3236
+ rationale: {
3237
+ type: "string",
3238
+ description: "Why the question is being refined"
3239
+ }
3240
+ },
3241
+ required: ["id", "text"],
3242
+ response: {
3243
+ description: "The refined question",
3244
+ fields: {
3245
+ id: "string",
3246
+ questionId: "string",
3247
+ updatedText: "string",
3248
+ previousText: "string"
3249
+ }
3250
+ },
3251
+ ownerModule: "graph-primitives",
3252
+ ontologyPrimitive: "question",
3253
+ tier: "workhorse"
3254
+ };
3255
+ var LIST_QUESTIONS = {
3256
+ name: "list_questions",
3257
+ description: "List questions scoped to a topic or worktree. Like `git issue list` \u2014 returns questions with their status, priority, and linked belief context. Supports filtering by status and priority.",
3258
+ parameters: {
3259
+ topicId: { type: "string", description: "Topic scope" },
3260
+ worktreeId: { type: "string", description: "Filter to worktree scope" },
3261
+ status: {
3262
+ type: "string",
3263
+ description: "Filter by canonical question status",
3264
+ enum: ["open", "researching", "answered", "parked", "closed"]
3265
+ },
3266
+ priority: {
3267
+ type: "string",
3268
+ description: "Filter by canonical question priority",
3269
+ enum: ["urgent", "high", "medium", "low"]
3270
+ },
3271
+ limit: { type: "number", description: "Max results" },
3272
+ cursor: { type: "string", description: "Pagination cursor" }
3273
+ },
3274
+ required: ["topicId"],
3275
+ response: {
3276
+ description: "Canonical question page",
3277
+ fields: {
3278
+ questions: "array \u2014 canonical question records",
3279
+ nextCursor: "string | null"
3280
+ }
3281
+ },
3282
+ ownerModule: "graph-primitives",
3283
+ ontologyPrimitive: "question",
3284
+ tier: "workhorse"
3285
+ };
3286
+ var ANSWER_QUESTION = {
3287
+ name: "answer_question",
3288
+ 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.",
3289
+ parameters: {
3290
+ id: { type: "string", description: "Canonical question ID" },
3291
+ topicId: { type: "string", description: "Topic scope for the answer" },
3292
+ text: { type: "string", description: "Answer text" },
3293
+ confidence: {
3294
+ type: "string",
3295
+ description: "Optional answer confidence",
3296
+ enum: ["weak", "medium", "strong"]
3297
+ },
3298
+ evidenceIds: {
3299
+ type: "array",
3300
+ description: "Optional canonical evidence IDs supporting the answer"
3301
+ },
3302
+ rationale: { type: "string", description: "Why this answer is credible" }
3303
+ },
3304
+ required: ["id", "topicId", "text"],
3305
+ response: {
3306
+ description: "Answer result",
3307
+ fields: {
3308
+ questionId: "string",
3309
+ answerId: "string",
3310
+ status: "string \u2014 answered"
3311
+ }
3312
+ },
3313
+ ownerModule: "graph-primitives",
3314
+ ontologyPrimitive: "question",
3315
+ tier: "workhorse"
3316
+ };
3317
+ var UPDATE_QUESTION_STATUS = {
3318
+ name: "update_question_status",
3319
+ description: "Transition a question's status through its lifecycle. Like `git issue update` \u2014 moves a question through the canonical reasoning lifecycle. Status transitions preserve history and keep linked evidence intact.",
3320
+ parameters: {
3321
+ id: { type: "string", description: "The question to update" },
3322
+ status: {
3323
+ type: "string",
3324
+ description: "New status",
3325
+ enum: ["open", "researching", "answered", "parked", "closed"]
3326
+ },
3327
+ rationale: { type: "string", description: "Why the status is changing" }
3328
+ },
3329
+ required: ["id", "status"],
3330
+ response: {
3331
+ description: "Updated question status",
3332
+ fields: {
3333
+ id: "string",
3334
+ questionId: "string",
3335
+ previousStatus: "string",
3336
+ newStatus: "string"
3337
+ }
3338
+ },
3339
+ ownerModule: "graph-primitives",
3340
+ ontologyPrimitive: "question",
3341
+ tier: "workhorse"
3342
+ };
3343
+ var ARCHIVE_QUESTION = {
3344
+ name: "archive_question",
3345
+ description: "Archive a question no longer relevant to current investigation scope. Like `git issue close` \u2014 removes it from active work while preserving audit history. Archived questions keep their existing links to beliefs and evidence.",
3346
+ parameters: {
3347
+ questionId: { type: "string", description: "The question to archive" },
3348
+ reason: {
3349
+ type: "string",
3350
+ description: "Why the question is being archived"
3351
+ }
3352
+ },
3353
+ required: ["questionId"],
3354
+ response: {
3355
+ description: "Archive confirmation",
3356
+ fields: {
3357
+ questionId: "string",
3358
+ status: "string \u2014 'archived'",
3359
+ archivedAt: "number"
3360
+ }
3361
+ },
3362
+ ownerModule: "graph-primitives",
3363
+ ontologyPrimitive: "question",
3364
+ tier: "workhorse"
3365
+ };
3366
+ var LINK_EVIDENCE_TO_QUESTION = {
3367
+ name: "link_evidence_to_question",
3368
+ description: "Link evidence to the question it helps answer. Like `git notes add` \u2014 attaches supporting detail to an active question. Question-level links improve answer quality and traceability to beliefs.",
3369
+ parameters: {
3370
+ evidenceId: { type: "string", description: "The evidence to link" },
3371
+ questionId: {
3372
+ type: "string",
3373
+ description: "The question this evidence addresses"
3374
+ },
3375
+ relevance: { type: "number", description: "Relevance score in [0,1]" },
3376
+ rationale: {
3377
+ type: "string",
3378
+ description: "How this evidence bears on the question"
3379
+ }
3380
+ },
3381
+ required: ["evidenceId", "questionId"],
3382
+ response: {
3383
+ description: "The created edge",
3384
+ fields: {
3385
+ edgeId: "string",
3386
+ evidenceId: "string",
3387
+ questionId: "string",
3388
+ relevance: "number"
3389
+ }
3390
+ },
3391
+ ownerModule: "graph-primitives",
3392
+ ontologyPrimitive: "edge",
3393
+ tier: "workhorse"
3394
+ };
3395
+ var CREATE_ANSWER = {
3396
+ name: "create_answer",
3397
+ description: "Create an answer node responding to a question. Like `git commit` for resolved questions \u2014 creates an immutable answer snapshot at L2. New answers supersede old ones, preserving full version history. Answers link to supporting evidence via based_on edges.",
3398
+ parameters: {
3399
+ questionNodeId: {
3400
+ type: "string",
3401
+ description: "The question node ID this answers"
3402
+ },
3403
+ answerText: {
3404
+ type: "string",
3405
+ description: "The answer content \u2014 the actual response to the question"
3406
+ },
3407
+ topicId: {
3408
+ type: "string",
3409
+ description: "Topic scope (optional if question already has topicId)"
3410
+ },
3411
+ confidence: {
3412
+ type: "string",
3413
+ description: "Answer confidence: definitive, strong, moderate, weak, speculative"
3414
+ },
3415
+ evidenceNodeIds: {
3416
+ type: "array",
3417
+ description: "Supporting evidence node IDs to link via based_on edges"
3418
+ },
3419
+ answerSource: {
3420
+ type: "string",
3421
+ description: "How the answer was produced: human, ai_generated, deep_research, synthesis"
3422
+ }
3423
+ },
3424
+ required: ["questionNodeId", "answerText"],
3425
+ response: {
3426
+ description: "The created answer node with version metadata",
3427
+ fields: {
3428
+ nodeId: "string \u2014 unique node identifier",
3429
+ globalId: "string \u2014 globally unique ID",
3430
+ versionNumber: "number \u2014 version of this answer (auto-incremented)",
3431
+ questionNodeId: "string \u2014 the question this answers",
3432
+ confidence: "string \u2014 answer confidence level"
3433
+ }
3434
+ },
3435
+ ownerModule: "graph-primitives",
3436
+ ontologyPrimitive: "evidence",
3437
+ tier: "showcase"
3438
+ };
3439
+ var GET_ANSWER = {
3440
+ name: "get_answer",
3441
+ description: "Get the latest answer for a question. Like `git show HEAD` for a question's resolution \u2014 returns the active answer snapshot. Returns null if the question is unanswered.",
3442
+ parameters: {
3443
+ questionNodeId: {
3444
+ type: "string",
3445
+ description: "The question node ID to get the answer for"
3446
+ }
3447
+ },
3448
+ required: ["questionNodeId"],
3449
+ response: {
3450
+ description: "The active answer node or null",
3451
+ fields: {
3452
+ nodeId: "string | null",
3453
+ globalId: "string | null",
3454
+ answerText: "string | null",
3455
+ versionNumber: "number",
3456
+ isLatest: "boolean",
3457
+ evidenceCount: "number",
3458
+ confidence: "string"
3459
+ }
3460
+ },
3461
+ ownerModule: "graph-primitives",
3462
+ ontologyPrimitive: "evidence",
3463
+ tier: "workhorse"
3464
+ };
3465
+ var GET_HIGH_PRIORITY_QUESTIONS = {
3466
+ name: "get_high_priority_questions",
3467
+ description: "Rank open questions by urgency and expected decision impact. Like `git issue list --sort=priority` \u2014 brings the highest-leverage open questions to the top. Ranking accounts for linked belief criticality and evidence gaps.",
3468
+ parameters: {
3469
+ topicId: { type: "string", description: "Topic scope" },
3470
+ limit: { type: "number", description: "Maximum results (default: 20)" },
3471
+ includeAnswered: {
3472
+ type: "boolean",
3473
+ description: "Include answered questions (default: false)"
3474
+ }
3475
+ },
3476
+ required: ["topicId"],
3477
+ response: {
3478
+ description: "Priority-ranked questions",
3479
+ fields: {
3480
+ questions: "array \u2014 { questionId, text, priority, urgencyScore, linkedBeliefCount, evidenceGapCount }"
3481
+ }
3482
+ },
3483
+ ownerModule: "graph-search",
3484
+ ontologyPrimitive: "question",
3485
+ tier: "workhorse"
3486
+ };
3487
+ var FIND_MISSING_QUESTIONS = {
3488
+ name: "find_missing_questions",
3489
+ description: "Identify beliefs missing testing questions. Like `git diff --check` \u2014 surfaces reasoning coverage gaps before merge. Returns candidate beliefs that need explicit question coverage.",
3490
+ parameters: {
3491
+ topicId: { type: "string", description: "Topic scope" },
3492
+ minConfidence: {
3493
+ type: "number",
3494
+ description: "Only check beliefs above this confidence (default: 0)"
3495
+ }
3496
+ },
3497
+ required: ["topicId"],
3498
+ response: {
3499
+ description: "Beliefs missing testing questions",
3500
+ fields: {
3501
+ gaps: "array \u2014 { beliefId, canonicalText, confidence, suggestedQuestions }",
3502
+ totalGaps: "number"
3503
+ }
3504
+ },
3505
+ ownerModule: "graph-search",
3506
+ ontologyPrimitive: "question",
3507
+ tier: "workhorse"
3508
+ };
3509
+ var LIST_BELIEFS = {
3510
+ name: "list_beliefs",
3511
+ description: "List beliefs scoped to a topic or worktree. Like `git log --oneline` \u2014 returns beliefs with their confidence, status, and scoring state. Supports filtering by status and confidence threshold.",
3512
+ parameters: {
3513
+ topicId: { type: "string", description: "Topic scope" },
3514
+ worktreeId: { type: "string", description: "Filter to worktree scope" },
3515
+ status: {
3516
+ type: "string",
3517
+ description: "Filter: unscored, scored, archived",
3518
+ enum: ["unscored", "scored", "archived"]
3519
+ },
3520
+ minConfidence: {
3521
+ type: "number",
3522
+ description: "Minimum confidence threshold"
3523
+ },
3524
+ limit: {
3525
+ type: "number",
3526
+ description: "Maximum results"
3527
+ }
3528
+ },
3529
+ required: ["topicId"],
3530
+ response: {
3531
+ description: "Canonical belief page",
3532
+ fields: {
3533
+ beliefs: "array \u2014 canonical belief records",
3534
+ nextCursor: "string | null"
3535
+ }
3536
+ },
3537
+ ownerModule: "graph-primitives",
3538
+ ontologyPrimitive: "belief",
3539
+ tier: "workhorse"
3540
+ };
3541
+ var LIST_WORKTREES = {
3542
+ name: "list_worktrees",
3543
+ 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.",
3544
+ parameters: {
3545
+ topicId: { type: "string", description: "Topic scope" },
3546
+ status: {
3547
+ type: "string",
3548
+ description: "Filter: active, merged, abandoned",
3549
+ enum: ["active", "merged", "abandoned"]
3550
+ },
3551
+ groupBy: {
3552
+ type: "string",
3553
+ description: "Optional grouping mode for the response.",
3554
+ enum: ["campaign", "lane", "flat"]
3555
+ },
3556
+ lane: {
3557
+ type: "string",
3558
+ description: "Filter by GitButler-aligned lane name."
3559
+ },
3560
+ campaign: {
3561
+ type: "number",
3562
+ description: "Filter by top-level pipeline campaign number."
3563
+ },
3564
+ limit: {
3565
+ type: "number",
3566
+ description: "Maximum results to return."
3567
+ }
3568
+ },
3569
+ required: ["topicId"],
3570
+ response: {
3571
+ description: "Worktrees with lifecycle phase, campaign, lane, status, belief count, and creation time",
3572
+ fields: {
3573
+ worktrees: "array \u2014 { worktreeId, title, phase, campaign, lane, laneOrderInCampaign, orderInLane, status, beliefCount, createdAt }"
3574
+ }
3575
+ },
3576
+ ownerModule: "workflow-engine",
3577
+ ontologyPrimitive: "worktree",
3578
+ tier: "workhorse"
3579
+ };
3580
+ var LIST_ALL_WORKTREES = {
3581
+ name: "list_all_worktrees",
3582
+ 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.",
3583
+ parameters: {
3584
+ status: {
3585
+ type: "string",
3586
+ description: "Filter by status: planning, active, completed, abandoned, superseded, long_term, idea, paused, suggested, dismissed",
3587
+ enum: [
3588
+ "planning",
3589
+ "active",
3590
+ "completed",
3591
+ "abandoned",
3592
+ "superseded",
3593
+ "long_term",
3594
+ "idea",
3595
+ "paused",
3596
+ "suggested",
3597
+ "dismissed"
3598
+ ]
3599
+ },
3600
+ lane: {
3601
+ type: "string",
3602
+ description: "Filter by lane name (e.g., 'ontology', 'tc-scope', 'control-plane', 'dev-portal', 'mcp-sdk-parity')"
3603
+ },
3604
+ campaign: {
3605
+ type: "number",
3606
+ description: "Filter by campaign number (e.g., 1, 2, 3). Returns only worktrees in that campaign."
3607
+ },
3608
+ groupBy: {
3609
+ type: "string",
3610
+ description: "Optional grouping mode for the response.",
3611
+ enum: ["campaign", "lane", "flat"]
3612
+ },
3613
+ limit: {
3614
+ type: "number",
3615
+ description: "Maximum results to return (default: 500, max: 1000)"
3616
+ }
3617
+ },
3618
+ required: [],
3619
+ response: {
3620
+ description: "All worktrees across all topics with full pipeline metadata",
3621
+ fields: {
3622
+ worktrees: "array \u2014 { worktreeId, title, topicId, topicName, phase, status, hypothesis, campaign, lane, laneOrderInCampaign, orderInLane, dependsOn, blocks, gate, createdAt }",
3623
+ total: "number \u2014 total count after filtering",
3624
+ lanes: "object \u2014 { laneName: count } summary of worktrees per lane",
3625
+ campaigns: "object \u2014 { campaignNumber: count } summary of worktrees per campaign"
3626
+ }
3627
+ },
3628
+ ownerModule: "workflow-engine",
3629
+ ontologyPrimitive: "worktree",
3630
+ tier: "showcase"
3631
+ };
3632
+ var GET_WORKTREE = {
3633
+ name: "get_worktree",
3634
+ description: "Get one worktree by ID. Like `git worktree list --porcelain <worktree>` \u2014 inspects one investigation branch without scanning the full pipeline inventory.",
3635
+ parameters: {
3636
+ worktreeId: { type: "string", description: "Canonical worktree ID to retrieve" },
3637
+ id: { type: "string", description: "Legacy alias for worktreeId" }
3638
+ },
3639
+ required: ["worktreeId"],
3640
+ response: {
3641
+ description: "Single worktree record with pipeline metadata",
3642
+ fields: {
3643
+ worktree: "object \u2014 { worktreeId, title, topicId, status, hypothesis, campaign, lane, laneOrderInCampaign, orderInLane, dependsOn, blocks, gate }"
3644
+ }
3645
+ },
3646
+ ownerModule: "workflow-engine",
3647
+ ontologyPrimitive: "worktree",
3648
+ tier: "workhorse"
3649
+ };
3650
+ var LIST_CAMPAIGNS = {
3651
+ name: "list_campaigns",
3652
+ 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.",
3653
+ parameters: {
3654
+ topicId: {
3655
+ type: "string",
3656
+ description: "Optional topic scope."
3657
+ },
3658
+ status: {
3659
+ type: "string",
3660
+ description: "Optional worktree status filter before grouping campaigns and lanes."
3661
+ },
3662
+ limit: {
3663
+ type: "number",
3664
+ description: "Maximum worktrees to scan before grouping."
3665
+ }
3666
+ },
3667
+ required: [],
3668
+ response: {
3669
+ description: "Pipeline campaigns with nested lane summaries.",
3670
+ fields: {
3671
+ campaigns: "array \u2014 { campaign, lanes: [{ lane, laneOrderInCampaign, worktreeCount, activeCount, readyCount, blockedCount, completedCount, nextWorktree }] }",
3672
+ totalWorktrees: "number \u2014 total worktrees scanned after filtering"
3673
+ }
3674
+ },
3675
+ ownerModule: "workflow-engine",
3676
+ ontologyPrimitive: "worktree",
3677
+ tier: "showcase"
3678
+ };
3679
+ var ACTIVATE_WORKTREE = {
3680
+ name: "activate_worktree",
3681
+ description: "Activate a worktree to begin investigation. Like `git checkout <branch>` \u2014 transitions a worktree from planning to active status. Sets the initial phase and enables belief/question editing within the worktree scope.",
3682
+ parameters: {
3683
+ worktreeId: { type: "string", description: "The worktree to activate" }
3684
+ },
3685
+ required: ["worktreeId"],
3686
+ response: {
3687
+ description: "Activation result with initial phase",
3688
+ fields: {
3689
+ worktreeId: "string",
3690
+ status: "string \u2014 'active'",
3691
+ phase: "string"
3692
+ }
3693
+ },
3694
+ ownerModule: "workflow-engine",
3695
+ ontologyPrimitive: "worktree",
3696
+ tier: "workhorse"
3697
+ };
3698
+ var UPDATE_WORKTREE_TARGETS = {
3699
+ name: "update_worktree_targets",
3700
+ description: "Update the target beliefs and questions tracked by a worktree. Like `git add/rm <files>` \u2014 stages or unstages beliefs/questions for investigation within the worktree scope. Supports adding and removing targets atomically.",
3701
+ parameters: {
3702
+ worktreeId: { type: "string", description: "The worktree to update" },
3703
+ addBeliefIds: {
3704
+ type: "array",
3705
+ description: "Belief node IDs to add to the worktree"
3706
+ },
3707
+ addQuestionIds: {
3708
+ type: "array",
3709
+ description: "Question node IDs to add to the worktree"
3710
+ },
3711
+ removeBeliefIds: {
3712
+ type: "array",
3713
+ description: "Belief node IDs to remove from the worktree"
3714
+ },
3715
+ removeQuestionIds: {
3716
+ type: "array",
3717
+ description: "Question node IDs to remove from the worktree"
3718
+ }
3719
+ },
3720
+ required: ["worktreeId"],
3721
+ response: {
3722
+ description: "Updated target counts",
3723
+ fields: {
3724
+ worktreeId: "string",
3725
+ beliefCount: "number",
3726
+ questionCount: "number"
3727
+ }
3728
+ },
3729
+ ownerModule: "workflow-engine",
3730
+ ontologyPrimitive: "worktree",
3731
+ tier: "workhorse"
3732
+ };
3733
+ var UPDATE_WORKTREE_METADATA = {
3734
+ name: "update_worktree_metadata",
3735
+ 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.",
3736
+ parameters: {
3737
+ worktreeId: { type: "string", description: "The worktree to update" },
3738
+ hypothesis: {
3739
+ type: "string",
3740
+ description: "Testable claim this worktree investigates"
3741
+ },
3742
+ campaign: {
3743
+ type: "number",
3744
+ description: "Top-level pipeline campaign number."
3745
+ },
3746
+ lane: {
3747
+ type: "string",
3748
+ description: "GitButler-aligned workstream lane name inside the campaign."
3749
+ },
3750
+ laneOrderInCampaign: {
3751
+ type: "number",
3752
+ description: "Ordering for this lane within the campaign."
3753
+ },
3754
+ orderInLane: {
3755
+ type: "number",
3756
+ description: "Position of this worktree inside its lane."
3757
+ },
3758
+ dependsOn: {
3759
+ type: "array",
3760
+ description: "Worktree IDs that must complete before this one can activate"
3761
+ },
3762
+ blocks: {
3763
+ type: "array",
3764
+ description: "Worktree IDs that are blocked until this one completes"
3765
+ },
3766
+ gate: {
3767
+ type: "string",
3768
+ description: "Exit gate name (e.g., 'gate:ontology-schema-hardened')"
3769
+ },
3770
+ rationale: {
3771
+ type: "string",
3772
+ description: "Why this worktree is sequenced here"
3773
+ },
3774
+ objective: {
3775
+ type: "string",
3776
+ description: "What we're trying to learn/prove"
3777
+ },
3778
+ proofArtifacts: {
3779
+ type: "array",
3780
+ description: "Typed proof artifacts that define what evidence or deliverables this worktree must emit before it can claim success."
3781
+ },
3782
+ staffingHint: {
3783
+ type: "string",
3784
+ description: "Advisory staffing shape for the worktree (for example `backend+tests` or `fullstack`)."
3785
+ },
3786
+ lastReconciledAt: {
3787
+ type: "number",
3788
+ description: "Timestamp of the last deterministic workflow reconciliation pass against this worktree."
3789
+ },
3790
+ autoFixPolicy: {
3791
+ type: "object",
3792
+ description: "Calibrated auto-fix policy controlling dry-run vs safe execution, per-run action caps, and permitted mutation tiers."
3793
+ },
3794
+ status: {
3795
+ type: "string",
3796
+ description: "Override the worktree status. Use for lifecycle transitions like marking a worktree superseded, long-term, or as a raw idea.",
3797
+ enum: [
3798
+ "suggested",
3799
+ "planning",
3800
+ "active",
3801
+ "paused",
3802
+ "completed",
3803
+ "dismissed",
3804
+ "abandoned",
3805
+ "superseded",
3806
+ "long_term",
3807
+ "idea"
3808
+ ]
3809
+ },
3810
+ topicId: {
3811
+ type: "string",
3812
+ description: "Reassign this worktree's primary topic. Validates the target topic exists before updating."
3813
+ },
3814
+ additionalTopicIds: {
3815
+ type: "array",
3816
+ description: "Set additional topic associations for cross-topic worktrees. Each topic ID is validated before updating. Use when a worktree spans multiple knowledge domains."
3817
+ }
3818
+ },
3819
+ required: ["worktreeId"],
3820
+ response: {
3821
+ description: "Update confirmation",
3822
+ fields: { worktreeId: "string", success: "boolean" }
3823
+ },
3824
+ ownerModule: "workflow-engine",
3825
+ ontologyPrimitive: "worktree",
3826
+ tier: "workhorse"
3827
+ };
3828
+ var IDENTITY_WHOAMI = {
3829
+ name: "identity_whoami",
3830
+ description: "Read the authenticated identity summary for the current session. Like `git config --get user.name` \u2014 shows who the current MCP session is acting as.",
3831
+ parameters: {},
3832
+ required: [],
3833
+ response: {
3834
+ description: "Canonical identity summary for the current session",
3835
+ fields: {
3836
+ principalId: "string \u2014 canonical principal identifier; for humans this is the Clerk user_... ID",
3837
+ principalType: "string \u2014 human, service, agent, group, or external_viewer",
3838
+ tenantId: "string | undefined \u2014 resolved tenant scope",
3839
+ workspaceId: "string | undefined \u2014 resolved workspace scope",
3840
+ scopes: "string[] | undefined \u2014 granted scopes for this session",
3841
+ roles: "string[] | undefined \u2014 canonical roles for this session"
3842
+ }
3843
+ },
3844
+ ownerModule: "identity-core",
3845
+ ontologyPrimitive: "identity",
3846
+ tier: "workhorse"
3847
+ };
3848
+ var RESOLVE_INTERACTIVE_PRINCIPAL = {
3849
+ name: "resolve_interactive_principal",
3850
+ description: "Read the Permit-backed Lucern principal context for an authenticated Clerk user. Like `git config --get user.email` plus the repository ACL \u2014 resolves the Clerk subject into tenant/workspace authorization context.",
3851
+ parameters: {
3852
+ clerkId: {
3853
+ type: "string",
3854
+ description: "Authenticated Clerk subject (`sub`). Clerk proves identity only; it is not the authorization record."
3855
+ },
3856
+ tenantId: {
3857
+ type: "string",
3858
+ description: "Optional tenant scope. Omit only when the Clerk alias is globally unambiguous."
3859
+ },
3860
+ workspaceId: {
3861
+ type: "string",
3862
+ description: "Optional workspace scope. Required when the principal has access to multiple workspaces and no default can be inferred."
3863
+ },
3864
+ providerProjectId: {
3865
+ type: "string",
3866
+ description: "Optional Clerk project or provider instance id for tenants with multiple identity providers."
3867
+ }
3868
+ },
3869
+ required: ["clerkId"],
3870
+ response: {
3871
+ description: "Permit-backed Lucern principal context for tenant SDK bootstrap",
3872
+ fields: {
3873
+ principalId: "string \u2014 canonical Clerk user_... ID for human sessions",
3874
+ principalType: "string \u2014 human, service, agent, group, or external_viewer",
3875
+ clerkId: "string \u2014 authenticated Clerk subject alias",
3876
+ tenantId: "string \u2014 resolved tenant scope",
3877
+ workspaceId: "string | null \u2014 resolved workspace scope",
3878
+ roles: "string[] \u2014 effective Permit roles",
3879
+ scopes: "string[] \u2014 effective scopes derived from Permit/control-plane projection",
3880
+ groupIds: "string[] \u2014 active Permit group memberships",
3881
+ principalStatus: "string \u2014 active, invited, suspended, disabled, revoked, or missing",
3882
+ tenantStatus: "string \u2014 projected tenant resource status",
3883
+ workspaceStatus: "string \u2014 projected workspace resource status",
3884
+ permit: "object \u2014 Permit subject, tenant, and optional workspace tuple"
3885
+ }
3886
+ },
3887
+ ownerModule: "control-plane",
3888
+ ontologyPrimitive: "identity",
3889
+ tier: "workhorse"
3890
+ };
3891
+ var COMPILE_CONTEXT = {
3892
+ name: "compile_context",
3893
+ 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.",
3894
+ parameters: {
3895
+ topicId: {
3896
+ type: "string",
3897
+ description: "Optional topic scope ID. Omit to resolve the topic from query."
3898
+ },
3899
+ query: {
3900
+ type: "string",
3901
+ description: "Focus query used to resolve the topic and rank context items. Required when topicId is omitted."
3902
+ },
3903
+ budget: {
3904
+ type: "number",
3905
+ description: "Token budget for prompt injection planning"
3906
+ },
3907
+ ranking: {
3908
+ type: "string",
3909
+ description: "Ranking profile for context ordering",
3910
+ enum: ["baseline_v1", "weighted_v1"]
3911
+ },
3912
+ limit: {
3913
+ type: "number",
3914
+ description: "Optional per-section item limit"
3915
+ },
3916
+ maxDepth: {
3917
+ type: "number",
3918
+ description: "Optional descendant topic depth for neighborhood expansion"
3919
+ },
3920
+ includeEntities: {
3921
+ type: "boolean",
3922
+ description: "Include related ontological entities in the compiled result"
3923
+ }
3924
+ },
3925
+ required: [],
3926
+ response: {
3927
+ description: "Compiled context pack for the requested topic",
3928
+ fields: {
3929
+ schemaVersion: "string",
3930
+ topicId: "string",
3931
+ topicName: "string",
3932
+ scopedTopicIds: "array \u2014 topic IDs included in the compilation neighborhood",
3933
+ generatedAt: "number \u2014 deterministic graph-backed reference timestamp for this compilation",
3934
+ ranking: "string \u2014 baseline_v1 | weighted_v1",
3935
+ summary: "object \u2014 counts and scoped health signals",
3936
+ invariants: "array \u2014 high-confidence invariant beliefs",
3937
+ activeBeliefs: "array \u2014 current high-signal beliefs",
3938
+ openQuestions: "array \u2014 unresolved questions ranked for this query",
3939
+ recentEvidence: "array \u2014 recent evidence ranked for this query",
3940
+ contradictions: "array \u2014 unresolved contradiction records",
3941
+ relatedEntities: "array | undefined \u2014 ranked ontological entities in scope",
3942
+ contextNarrative: "array \u2014 guidance for prompt assembly",
3943
+ injectionPolicy: "object \u2014 token-budgeted section selections",
3944
+ diagnostics: "object \u2014 scoring and utilization telemetry"
3945
+ }
3946
+ },
3947
+ ownerModule: "reasoning-kernel",
3948
+ ontologyPrimitive: "graph",
3949
+ tier: "showcase"
3950
+ };
3951
+
3952
+ // src/tool-contracts.worktrees.ts
3953
+ var ADD_WORKTREE = {
3954
+ name: "add_worktree",
3955
+ 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.",
3956
+ parameters: {
3957
+ title: { type: "string", description: "Worktree name/objective" },
3958
+ name: {
3959
+ type: "string",
3960
+ description: "Optional storage-name alias for callers that already use backend naming"
3961
+ },
3962
+ projectId: {
3963
+ type: "string",
3964
+ description: "Legacy topicId alias or resolver hint"
3965
+ },
3966
+ topicId: {
3967
+ type: "string",
3968
+ description: "Optional topic scope hint for resolver validation"
3969
+ },
3970
+ topicHint: {
3971
+ type: "string",
3972
+ description: "Natural-language topic hint for automatic topic resolution"
3973
+ },
3974
+ branchId: {
3975
+ type: "string",
3976
+ description: "The branch this worktree investigates"
3977
+ },
3978
+ objective: {
3979
+ type: "string",
3980
+ description: "Plain-text reasoning objective to auto-shape into a hypothesis, questions, tasks, and dependencies"
3981
+ },
3982
+ hypothesis: {
3983
+ type: "string",
3984
+ description: "The testable claim this worktree investigates"
3985
+ },
3986
+ rationale: {
3987
+ type: "string",
3988
+ description: "Why this worktree exists and why it belongs in the campaign"
3989
+ },
3990
+ worktreeType: {
3991
+ type: "string",
3992
+ description: "Schema-enum worktree type used by the kernel lifecycle and retrieval layers"
3993
+ },
3994
+ gate: {
3995
+ type: "string",
3996
+ description: "Exit gate name for this worktree"
3997
+ },
3998
+ startDate: {
3999
+ type: "number",
4000
+ description: "Planned start timestamp in milliseconds since epoch"
4001
+ },
4002
+ endDate: {
4003
+ type: "number",
4004
+ description: "Planned end timestamp in milliseconds since epoch"
4005
+ },
4006
+ durationWeeks: {
4007
+ type: "number",
4008
+ description: "Planned duration in weeks"
4009
+ },
4010
+ confidenceImpact: {
4011
+ type: "string",
4012
+ description: "Expected confidence impact if the worktree succeeds",
4013
+ enum: ["high", "medium", "low"]
4014
+ },
4015
+ beliefFocus: {
4016
+ type: "string",
4017
+ description: "Natural-language focus spanning the target belief neighborhood"
4018
+ },
4019
+ beliefIds: {
4020
+ type: "array",
4021
+ description: "Legacy alias for targetBeliefIds"
4022
+ },
4023
+ beliefs: {
4024
+ type: "array",
4025
+ description: "Legacy alias for targetBeliefIds"
4026
+ },
4027
+ targetBeliefIds: {
4028
+ type: "array",
4029
+ description: "Belief node IDs this worktree is expected to test or update"
4030
+ },
4031
+ targetQuestionIds: {
4032
+ type: "array",
4033
+ description: "Question node IDs this worktree is expected to answer"
4034
+ },
4035
+ keyQuestions: {
4036
+ type: "array",
4037
+ description: "Inline key question objects with question, optional status, answer, answerConfidence, and linkedQuestionId"
4038
+ },
4039
+ evidenceSignals: {
4040
+ type: "array",
4041
+ description: "Evidence signal objects with signal, optional collected state, progress, and notes"
4042
+ },
4043
+ decisionGate: {
4044
+ type: "object",
4045
+ description: "Decision gate object with goCriteria, noGoSignals, optional verdict, rationale, decidedAt, and decidedBy"
4046
+ },
4047
+ goCriteria: {
4048
+ type: "array",
4049
+ description: "Shorthand go criteria used to build decisionGate"
4050
+ },
4051
+ noGoSignals: {
4052
+ type: "array",
4053
+ description: "Shorthand no-go signals used to build decisionGate"
4054
+ },
4055
+ proofArtifacts: {
4056
+ type: "array",
4057
+ description: "Expected proof artifacts required to close the worktree"
4058
+ },
4059
+ autoShape: {
4060
+ type: "boolean",
4061
+ description: "Whether to invoke inquiry auto-shaping during worktree creation"
4062
+ },
4063
+ autoFixPolicy: {
4064
+ type: "object",
4065
+ description: "Policy for permitted automatic remediation inside the worktree"
4066
+ },
4067
+ domainPackId: {
4068
+ type: "string",
4069
+ description: "Optional domain pack whose shaping hooks should influence generated questions and tasks"
4070
+ },
4071
+ tags: {
4072
+ type: "array",
4073
+ description: "Additional topic-resolution tags for the worktree"
4074
+ },
4075
+ touchedPaths: {
4076
+ type: "array",
4077
+ description: "File paths used as topic-resolution signals"
4078
+ },
4079
+ sourceRef: {
4080
+ type: "string",
4081
+ description: "Source reference used as a topic-resolution signal"
4082
+ },
4083
+ sourceKind: {
4084
+ type: "string",
4085
+ description: "Source kind used as a topic-resolution signal"
4086
+ },
4087
+ campaign: {
4088
+ type: "number",
4089
+ description: "Top-level pipeline campaign number. Campaigns define the outer execution slice."
4090
+ },
4091
+ lane: {
4092
+ type: "string",
4093
+ description: "GitButler-aligned workstream lane name inside the campaign."
4094
+ },
4095
+ laneOrderInCampaign: {
4096
+ type: "number",
4097
+ description: "Ordering for this lane within its campaign."
4098
+ },
4099
+ orderInLane: {
4100
+ type: "number",
4101
+ description: "Position of this worktree inside its lane."
4102
+ },
4103
+ dependsOn: {
4104
+ type: "array",
4105
+ description: "Worktree IDs that must complete before this one can activate"
4106
+ },
4107
+ blocks: {
4108
+ type: "array",
4109
+ description: "Worktree IDs blocked by this worktree"
4110
+ },
4111
+ staffingHint: {
4112
+ type: "string",
4113
+ description: "Suggested staffing or agent allocation note"
4114
+ },
4115
+ lensId: {
4116
+ type: "string",
4117
+ description: "Lens that scopes this worktree when applicable"
4118
+ },
4119
+ lastReconciledAt: {
4120
+ type: "number",
4121
+ description: "Timestamp when worktree metadata was last reconciled"
4122
+ }
4123
+ },
4124
+ required: ["title"],
4125
+ response: {
4126
+ description: "The created worktree",
4127
+ fields: {
4128
+ worktreeId: "string",
4129
+ branchId: "string | null",
4130
+ status: "string \u2014 usually 'planning' or 'active'",
4131
+ title: "string",
4132
+ hypothesis: "string | null",
4133
+ questionCount: "number",
4134
+ taskCount: "number",
4135
+ autoShapeApplied: "boolean",
4136
+ frameworkSuggestions: "array",
4137
+ dependencySuggestions: "array"
4138
+ }
4139
+ },
4140
+ ownerModule: "workflow-engine",
4141
+ ontologyPrimitive: "worktree",
4142
+ tier: "showcase"
4143
+ };
4144
+ var MERGE = {
4145
+ name: "merge",
4146
+ description: "Merge a worktree's findings into the stable knowledge base (main). Like `git merge` to main \u2014 formulations freeze, confidence is recorded, findings are integrated. Each belief gets a confidence score and rationale. After merge, beliefs can only evolve via fork. Low-confidence beliefs may need forking.",
4147
+ parameters: {
4148
+ worktreeId: { type: "string", description: "The worktree to merge" },
4149
+ outcomes: {
4150
+ type: "array",
4151
+ description: "Merge outcomes as key-finding strings, or scoring outcomes for beliefs: { beliefId, confidence, rationale }"
4152
+ },
4153
+ summary: { type: "string", description: "Overall findings summary" }
4154
+ },
4155
+ required: ["worktreeId", "outcomes"],
4156
+ response: {
4157
+ description: "Merge result",
4158
+ fields: {
4159
+ worktreeId: "string",
4160
+ status: "string \u2014 'merged'",
4161
+ beliefsScored: "number"
4162
+ }
4163
+ },
4164
+ ownerModule: "workflow-engine",
4165
+ ontologyPrimitive: "worktree",
4166
+ tier: "showcase"
4167
+ };
4168
+ var PUSH = {
4169
+ name: "push",
4170
+ description: "Push scored beliefs from a merged worktree to other contexts. Like `git push` \u2014 makes local findings available on the remote. Only merged beliefs can be pushed. Publication makes findings visible to other projects, teams, or external consumers.",
4171
+ parameters: {
4172
+ worktreeId: {
4173
+ type: "string",
4174
+ description: "The merged worktree whose findings to push"
4175
+ },
4176
+ targetContext: {
4177
+ type: "string",
4178
+ description: "Where to push (e.g., 'portfolio', 'ic_review', 'external')"
4179
+ },
4180
+ beliefIds: {
4181
+ type: "array",
4182
+ description: "Optional subset of beliefs to push (default: all scored)"
4183
+ }
4184
+ },
4185
+ required: ["worktreeId", "targetContext"],
4186
+ response: {
4187
+ description: "Push result",
4188
+ fields: {
4189
+ pushedCount: "number",
4190
+ targetContext: "string",
4191
+ pushedAt: "number"
4192
+ }
4193
+ },
4194
+ ownerModule: "workflow-engine",
4195
+ ontologyPrimitive: "worktree",
4196
+ tier: "workhorse"
4197
+ };
4198
+ var OPEN_PULL_REQUEST = {
4199
+ name: "open_pull_request",
4200
+ description: "Open a pull request for peer review before merging a worktree. Like opening a `git pull request` \u2014 the worktree's findings are ready but await approval before merge. Reviewers can approve, request changes, or block the merge. This is the gate between draft work and scored knowledge.",
4201
+ parameters: {
4202
+ worktreeId: {
4203
+ type: "string",
4204
+ description: "The worktree to submit for review"
4205
+ },
4206
+ reviewers: {
4207
+ type: "array",
4208
+ description: "User IDs of requested reviewers"
4209
+ },
4210
+ summary: {
4211
+ type: "string",
4212
+ description: "Summary of findings and why they're ready for merge"
4213
+ }
4214
+ },
4215
+ required: ["worktreeId", "summary"],
4216
+ response: {
4217
+ description: "The pull request",
4218
+ fields: {
4219
+ pullRequestId: "string",
4220
+ worktreeId: "string",
4221
+ status: "string \u2014 'pending_review'"
4222
+ }
4223
+ },
4224
+ ownerModule: "workflow-engine",
4225
+ ontologyPrimitive: "worktree",
4226
+ tier: "showcase"
4227
+ };
4228
+
4229
+ // src/tool-contracts.ts
4230
+ var MCP_TOOL_CONTRACTS = {
4231
+ // Belief lifecycle (commit, amend, fork, archive)
4232
+ create_belief: CREATE_BELIEF,
4233
+ get_belief: GET_BELIEF,
4234
+ refine_belief: REFINE_BELIEF,
4235
+ modulate_confidence: MODULATE_CONFIDENCE,
4236
+ fork_belief: FORK_BELIEF,
4237
+ archive_belief: ARCHIVE_BELIEF,
4238
+ create_epistemic_contract: CREATE_EPISTEMIC_CONTRACT,
4239
+ evaluate_contract: EVALUATE_CONTRACT,
4240
+ get_contract_status: GET_CONTRACT_STATUS,
4241
+ // Evidence (commit)
4242
+ create_evidence: CREATE_EVIDENCE,
4243
+ get_evidence: GET_EVIDENCE,
4244
+ list_evidence: LIST_EVIDENCE,
4245
+ link_evidence: LINK_EVIDENCE,
4246
+ add_evidence: ADD_EVIDENCE,
4247
+ // Contradictions (merge conflict)
4248
+ flag_contradiction: FLAG_CONTRADICTION,
4249
+ // Lens lifecycle (workspace-scoped operational frames)
4250
+ create_lens: CREATE_LENS,
4251
+ list_lenses: LIST_LENSES,
4252
+ apply_lens_to_topic: APPLY_LENS_TO_TOPIC,
4253
+ remove_lens_from_topic: REMOVE_LENS_FROM_TOPIC,
4254
+ // Worktree lifecycle (git worktree add → merge → push → pull request)
4255
+ add_worktree: ADD_WORKTREE,
4256
+ merge: MERGE,
4257
+ push: PUSH,
4258
+ open_pull_request: OPEN_PULL_REQUEST,
4259
+ // Lineage and audit (log, blame)
4260
+ query_lineage: QUERY_LINEAGE,
4261
+ get_confidence_history: GET_CONFIDENCE_HISTORY,
4262
+ get_audit_trail: GET_AUDIT_TRAIL,
4263
+ // Graph queries (traverse, search, bisect, entity impact)
4264
+ traverse_graph: TRAVERSE_GRAPH,
4265
+ get_graph_neighborhood: GET_GRAPH_NEIGHBORHOOD,
4266
+ trace_entity_impact: TRACE_ENTITY_IMPACT,
4267
+ search_beliefs: SEARCH_BELIEFS,
4268
+ find_contradictions: FIND_CONTRADICTIONS,
4269
+ bisect_confidence: BISECT_CONFIDENCE,
4270
+ // Edges (commit)
4271
+ create_edge: CREATE_EDGE,
4272
+ update_edge: UPDATE_EDGE,
4273
+ remove_edge: REMOVE_EDGE,
4274
+ remove_edges_between: REMOVE_EDGES_BETWEEN,
4275
+ batch_create_edges: BATCH_CREATE_EDGES,
4276
+ // Epistemic node spine (commit/amend/show)
4277
+ create_epistemic_node: CREATE_EPISTEMIC_NODE,
4278
+ get_epistemic_node: GET_EPISTEMIC_NODE,
4279
+ list_epistemic_nodes: LIST_EPISTEMIC_NODES,
4280
+ update_epistemic_node: UPDATE_EPISTEMIC_NODE,
4281
+ archive_epistemic_node: ARCHIVE_EPISTEMIC_NODE,
4282
+ verify_epistemic_node: VERIFY_EPISTEMIC_NODE,
4283
+ supersede_epistemic_node: SUPERSEDE_EPISTEMIC_NODE,
4284
+ batch_create_epistemic_nodes: BATCH_CREATE_EPISTEMIC_NODES,
4285
+ // Judgments (tag)
4286
+ record_judgment: RECORD_JUDGMENT,
4287
+ // Graph intelligence (showcase)
4288
+ detect_confirmation_bias: DETECT_CONFIRMATION_BIAS,
4289
+ get_graph_structure_analysis: GET_GRAPH_STRUCTURE_ANALYSIS,
4290
+ list_graph_intelligence_queries: LIST_GRAPH_INTELLIGENCE_QUERIES,
4291
+ run_graph_intelligence_query: RUN_GRAPH_INTELLIGENCE_QUERY,
4292
+ get_falsification_questions: GET_FALSIFICATION_QUESTIONS,
4293
+ // Evidence operations (workhorse)
4294
+ search_evidence: SEARCH_EVIDENCE,
4295
+ link_evidence_to_belief: LINK_EVIDENCE_TO_BELIEF,
4296
+ // Answer lifecycle (L2 question responses)
4297
+ create_answer: CREATE_ANSWER,
4298
+ get_answer: GET_ANSWER,
4299
+ // Question operations (workhorse)
4300
+ create_question: CREATE_QUESTION,
4301
+ get_question: GET_QUESTION,
4302
+ refine_question: REFINE_QUESTION,
4303
+ list_questions: LIST_QUESTIONS,
4304
+ answer_question: ANSWER_QUESTION,
4305
+ update_question_status: UPDATE_QUESTION_STATUS,
4306
+ archive_question: ARCHIVE_QUESTION,
4307
+ link_evidence_to_question: LINK_EVIDENCE_TO_QUESTION,
4308
+ get_high_priority_questions: GET_HIGH_PRIORITY_QUESTIONS,
4309
+ find_missing_questions: FIND_MISSING_QUESTIONS,
4310
+ // Listing & query (workhorse)
4311
+ list_beliefs: LIST_BELIEFS,
4312
+ get_worktree: GET_WORKTREE,
4313
+ list_worktrees: LIST_WORKTREES,
4314
+ list_all_worktrees: LIST_ALL_WORKTREES,
4315
+ list_campaigns: LIST_CAMPAIGNS,
4316
+ activate_worktree: ACTIVATE_WORKTREE,
4317
+ update_worktree_targets: UPDATE_WORKTREE_TARGETS,
4318
+ update_worktree_metadata: UPDATE_WORKTREE_METADATA,
4319
+ identity_whoami: IDENTITY_WHOAMI,
4320
+ resolve_interactive_principal: RESOLVE_INTERACTIVE_PRINCIPAL,
4321
+ compile_context: COMPILE_CONTEXT,
4322
+ record_scope_learning: RECORD_SCOPE_LEARNING,
4323
+ pipeline_snapshot: PIPELINE_SNAPSHOT,
4324
+ discover: DISCOVER,
4325
+ analyze_topic_density: ANALYZE_TOPIC_DENSITY,
4326
+ apply_auto_branching: APPLY_AUTO_BRANCHING,
4327
+ seed_belief_lattice: SEED_BELIEF_LATTICE,
4328
+ get_lattice_coverage: GET_LATTICE_COVERAGE,
4329
+ discover_entity_connections: DISCOVER_ENTITY_CONNECTIONS,
4330
+ trigger_belief_review: TRIGGER_BELIEF_REVIEW,
4331
+ register_session: REGISTER_SESSION,
4332
+ heartbeat_session: HEARTBEAT_SESSION,
4333
+ end_session: END_SESSION,
4334
+ list_active_sessions: LIST_ACTIVE_SESSIONS,
4335
+ send_agent_message: SEND_AGENT_MESSAGE,
4336
+ broadcast_message: BROADCAST_MESSAGE,
4337
+ get_agent_inbox: GET_AGENT_INBOX,
4338
+ claim_files: CLAIM_FILES,
4339
+ generate_session_handoff: GENERATE_SESSION_HANDOFF,
4340
+ begin_build_session: BEGIN_BUILD_SESSION,
4341
+ // Policy / ACL (workhorse)
4342
+ check_permission: CHECK_PERMISSION,
4343
+ filter_by_permission: FILTER_BY_PERMISSION,
4344
+ // Write policy (S2-13K Graph Compounding)
4345
+ manage_write_policy: MANAGE_WRITE_POLICY,
4346
+ // Observation context (workhorse)
4347
+ ingest_observation: INGEST_OBSERVATION,
4348
+ get_observation_context: GET_OBSERVATION_CONTEXT,
4349
+ // Task lifecycle (workhorse)
4350
+ create_task: CREATE_TASK,
4351
+ complete_task: COMPLETE_TASK,
4352
+ update_task: UPDATE_TASK,
4353
+ list_tasks: LIST_TASKS,
4354
+ // Topic lifecycle (init, remote)
4355
+ create_topic: CREATE_TOPIC,
4356
+ list_topics: LIST_TOPICS,
4357
+ get_topic: GET_TOPIC,
4358
+ update_topic: UPDATE_TOPIC,
4359
+ get_topic_tree: GET_TOPIC_TREE,
4360
+ materialize_topic_graph: MATERIALIZE_TOPIC_GRAPH,
4361
+ get_topic_graph_spine: GET_TOPIC_GRAPH_SPINE,
4362
+ // Coding intelligence (code-grounded knowledge)
4363
+ get_code_context: GET_CODE_CONTEXT,
4364
+ get_change_history: GET_CHANGE_HISTORY,
4365
+ record_attempt: RECORD_ATTEMPT,
4366
+ get_failure_log: GET_FAILURE_LOG,
4367
+ // Graph self-intelligence (coverage, gaps)
4368
+ get_topic_coverage: GET_TOPIC_COVERAGE,
4369
+ get_graph_gaps: GET_GRAPH_GAPS,
4370
+ // Ontology lifecycle (definition CRUD, version management)
4371
+ list_ontologies: LIST_ONTOLOGIES,
4372
+ get_ontology: GET_ONTOLOGY,
4373
+ apply_ontology: APPLY_ONTOLOGY,
4374
+ match_entity_type: MATCH_ENTITY_TYPE,
4375
+ create_ontology: CREATE_ONTOLOGY,
4376
+ update_ontology: UPDATE_ONTOLOGY,
4377
+ archive_ontology: ARCHIVE_ONTOLOGY,
4378
+ create_ontology_version: CREATE_ONTOLOGY_VERSION,
4379
+ publish_ontology_version: PUBLISH_ONTOLOGY_VERSION,
4380
+ deprecate_ontology_version: DEPRECATE_ONTOLOGY_VERSION,
4381
+ resolve_effective_ontology: RESOLVE_EFFECTIVE_ONTOLOGY
4382
+ };
4383
+ var GIT_SEMANTIC_REQUIRED_TOOLS = Object.keys(MCP_TOOL_CONTRACTS);
4384
+ function validateGitSemantics(tool) {
4385
+ const desc = tool.description;
4386
+ const hasGitReference = /Like (`git |a `git |a merge conflict|opening a `git)/.test(desc);
4387
+ if (!hasGitReference) {
4388
+ return {
4389
+ valid: false,
4390
+ reason: `Tool "${tool.name}" description missing git-semantic reference`
4391
+ };
4392
+ }
4393
+ return { valid: true };
4394
+ }
4395
+
4396
+ export { ACTIVATE_WORKTREE, ADD_EVIDENCE, ADD_WORKTREE, ANALYZE_TOPIC_DENSITY, ANSWER_QUESTION, APPLY_AUTO_BRANCHING, APPLY_LENS_TO_TOPIC, APPLY_ONTOLOGY, ARCHIVE_BELIEF, ARCHIVE_EPISTEMIC_NODE, ARCHIVE_ONTOLOGY, ARCHIVE_QUESTION, BATCH_CREATE_EDGES, BATCH_CREATE_EPISTEMIC_NODES, BEGIN_BUILD_SESSION, BISECT_CONFIDENCE, BROADCAST_MESSAGE, CHECK_PERMISSION, CLAIM_FILES, COMPILE_CONTEXT, COMPLETE_TASK, CREATE_ANSWER, CREATE_BELIEF, CREATE_EDGE, CREATE_EPISTEMIC_CONTRACT, CREATE_EPISTEMIC_NODE, CREATE_EVIDENCE, CREATE_LENS, CREATE_ONTOLOGY, CREATE_ONTOLOGY_VERSION, CREATE_QUESTION, CREATE_TASK, CREATE_TOPIC, DEPRECATE_ONTOLOGY_VERSION, DETECT_CONFIRMATION_BIAS, DISCOVER, DISCOVER_ENTITY_CONNECTIONS, END_SESSION, EVALUATE_CONTRACT, FILTER_BY_PERMISSION, FIND_CONTRADICTIONS, FIND_MISSING_QUESTIONS, FLAG_CONTRADICTION, FORK_BELIEF, GENERATE_SESSION_HANDOFF, GET_AGENT_INBOX, GET_ANSWER, GET_AUDIT_TRAIL, GET_BELIEF, GET_CHANGE_HISTORY, GET_CODE_CONTEXT, GET_CONFIDENCE_HISTORY, GET_CONTRACT_STATUS, GET_EPISTEMIC_NODE, GET_EVIDENCE, GET_FAILURE_LOG, GET_FALSIFICATION_QUESTIONS, GET_GRAPH_GAPS, GET_GRAPH_NEIGHBORHOOD, GET_GRAPH_STRUCTURE_ANALYSIS, GET_HIGH_PRIORITY_QUESTIONS, GET_LATTICE_COVERAGE, GET_OBSERVATION_CONTEXT, GET_ONTOLOGY, GET_QUESTION, GET_TOPIC, GET_TOPIC_COVERAGE, GET_TOPIC_GRAPH_SPINE, GET_TOPIC_TREE, GET_WORKTREE, GIT_SEMANTIC_REQUIRED_TOOLS, HEARTBEAT_SESSION, IDENTITY_WHOAMI, INGEST_OBSERVATION, LINK_EVIDENCE, LINK_EVIDENCE_TO_BELIEF, LINK_EVIDENCE_TO_QUESTION, LIST_ACTIVE_SESSIONS, LIST_ALL_WORKTREES, LIST_BELIEFS, LIST_CAMPAIGNS, LIST_EPISTEMIC_NODES, LIST_EVIDENCE, LIST_GRAPH_INTELLIGENCE_QUERIES, LIST_LENSES, LIST_ONTOLOGIES, LIST_QUESTIONS, LIST_TASKS, LIST_TOPICS, LIST_WORKTREES, MANAGE_WRITE_POLICY, MATCH_ENTITY_TYPE, MATERIALIZE_TOPIC_GRAPH, MCP_TOOL_CONTRACTS, MERGE, MODULATE_CONFIDENCE, OPEN_PULL_REQUEST, PIPELINE_SNAPSHOT, PUBLISH_ONTOLOGY_VERSION, PUSH, QUERY_LINEAGE, RECORD_ATTEMPT, RECORD_JUDGMENT, RECORD_SCOPE_LEARNING, REFINE_BELIEF, REFINE_QUESTION, REGISTER_SESSION, REMOVE_EDGE, REMOVE_EDGES_BETWEEN, REMOVE_LENS_FROM_TOPIC, RESOLVE_EFFECTIVE_ONTOLOGY, RESOLVE_INTERACTIVE_PRINCIPAL, RUN_GRAPH_INTELLIGENCE_QUERY, SEARCH_BELIEFS, SEARCH_EVIDENCE, SEED_BELIEF_LATTICE, SEND_AGENT_MESSAGE, SUPERSEDE_EPISTEMIC_NODE, TRACE_ENTITY_IMPACT, TRAVERSE_GRAPH, TRIGGER_BELIEF_REVIEW, UPDATE_EDGE, UPDATE_EPISTEMIC_NODE, UPDATE_ONTOLOGY, UPDATE_QUESTION_STATUS, UPDATE_TASK, UPDATE_TOPIC, UPDATE_WORKTREE_METADATA, UPDATE_WORKTREE_TARGETS, VERIFY_EPISTEMIC_NODE, validateGitSemantics };
4397
+ //# sourceMappingURL=tool-contracts.values.js.map
4398
+ //# sourceMappingURL=tool-contracts.values.js.map