@lucern/contracts 1.0.16 → 1.0.17

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 (116) hide show
  1. package/CHANGELOG.md +3 -0
  2. package/dist/api-enums.contract.d.ts +2 -2
  3. package/dist/api-enums.contract.js +2 -8
  4. package/dist/api-enums.contract.js.map +1 -1
  5. package/dist/context-pack.contract.d.ts +27 -7
  6. package/dist/context-pack.contract.js.map +1 -1
  7. package/dist/function-registry/beliefs.js +109 -115
  8. package/dist/function-registry/beliefs.js.map +1 -1
  9. package/dist/function-registry/coding.js +68 -91
  10. package/dist/function-registry/coding.js.map +1 -1
  11. package/dist/function-registry/context.js +68 -91
  12. package/dist/function-registry/context.js.map +1 -1
  13. package/dist/function-registry/contracts.js +68 -91
  14. package/dist/function-registry/contracts.js.map +1 -1
  15. package/dist/function-registry/coordination.js +68 -91
  16. package/dist/function-registry/coordination.js.map +1 -1
  17. package/dist/function-registry/edges.js +68 -91
  18. package/dist/function-registry/edges.js.map +1 -1
  19. package/dist/function-registry/evidence.js +182 -125
  20. package/dist/function-registry/evidence.js.map +1 -1
  21. package/dist/function-registry/graph.js +68 -91
  22. package/dist/function-registry/graph.js.map +1 -1
  23. package/dist/function-registry/helpers.js +68 -91
  24. package/dist/function-registry/helpers.js.map +1 -1
  25. package/dist/function-registry/identity.js +68 -91
  26. package/dist/function-registry/identity.js.map +1 -1
  27. package/dist/function-registry/index.js +68 -91
  28. package/dist/function-registry/index.js.map +1 -1
  29. package/dist/function-registry/judgments.js +68 -91
  30. package/dist/function-registry/judgments.js.map +1 -1
  31. package/dist/function-registry/legacy.js +68 -91
  32. package/dist/function-registry/legacy.js.map +1 -1
  33. package/dist/function-registry/lenses.js +68 -91
  34. package/dist/function-registry/lenses.js.map +1 -1
  35. package/dist/function-registry/manifest.d.ts +3 -3
  36. package/dist/function-registry/manifest.js +3 -3
  37. package/dist/function-registry/manifest.js.map +1 -1
  38. package/dist/function-registry/nodes.js +68 -91
  39. package/dist/function-registry/nodes.js.map +1 -1
  40. package/dist/function-registry/ontologies.js +68 -91
  41. package/dist/function-registry/ontologies.js.map +1 -1
  42. package/dist/function-registry/pipeline.js +68 -91
  43. package/dist/function-registry/pipeline.js.map +1 -1
  44. package/dist/function-registry/questions.js +68 -91
  45. package/dist/function-registry/questions.js.map +1 -1
  46. package/dist/function-registry/tasks.js +68 -91
  47. package/dist/function-registry/tasks.js.map +1 -1
  48. package/dist/function-registry/topics.js +68 -91
  49. package/dist/function-registry/topics.js.map +1 -1
  50. package/dist/function-registry/worktrees.js +68 -91
  51. package/dist/function-registry/worktrees.js.map +1 -1
  52. package/dist/generated/convexSchemas.js +2 -2
  53. package/dist/generated/convexSchemas.js.map +1 -1
  54. package/dist/index.d.ts +4 -4
  55. package/dist/index.js +162 -130
  56. package/dist/index.js.map +1 -1
  57. package/dist/manifests/invariant-manifest.d.ts +1 -1
  58. package/dist/manifests/invariants/index.d.ts +1 -1
  59. package/dist/manifests/invariants/index.js +1 -1
  60. package/dist/manifests/invariants/index.js.map +1 -1
  61. package/dist/manifests/invariants/inv-1-beliefs-append-only.d.ts +1 -1
  62. package/dist/manifests/invariants/inv-14-no-silent-transitions.d.ts +1 -1
  63. package/dist/manifests/invariants/manifest-1-projections-declare-audit.d.ts +1 -1
  64. package/dist/manifests/invariants/manifest-1-projections-declare-audit.js +1 -1
  65. package/dist/manifests/invariants/manifest-1-projections-declare-audit.js.map +1 -1
  66. package/dist/projections/{modulate-confidence.projection.d.ts → append-sl-scoring.projection.d.ts} +69 -69
  67. package/dist/projections/{modulate-confidence.projection.js → append-sl-scoring.projection.js} +14 -14
  68. package/dist/projections/append-sl-scoring.projection.js.map +1 -0
  69. package/dist/projections/check-convex-args-shape.js +88 -29
  70. package/dist/projections/check-convex-args-shape.js.map +1 -1
  71. package/dist/projections/create-evidence.projection.js +76 -17
  72. package/dist/projections/create-evidence.projection.js.map +1 -1
  73. package/dist/projections/index.d.ts +47 -47
  74. package/dist/projections/index.js +88 -29
  75. package/dist/projections/index.js.map +1 -1
  76. package/dist/proof-attestation.json +3 -3
  77. package/dist/schemas/index.js +6 -4
  78. package/dist/schemas/index.js.map +1 -1
  79. package/dist/schemas/manifest.d.ts +110 -60
  80. package/dist/schemas/manifest.js +6 -4
  81. package/dist/schemas/manifest.js.map +1 -1
  82. package/dist/schemas/tables/kernel/intelligence.d.ts +20 -10
  83. package/dist/schemas/tables/kernel/intelligence.js +4 -2
  84. package/dist/schemas/tables/kernel/intelligence.js.map +1 -1
  85. package/dist/schemas/tables/kernel/spine.d.ts +2 -2
  86. package/dist/schemas/tables/kernel/spine.js +2 -2
  87. package/dist/schemas/tables/kernel/spine.js.map +1 -1
  88. package/dist/schemas.values.js +6 -4
  89. package/dist/schemas.values.js.map +1 -1
  90. package/dist/sdk-methods.contract.d.ts +6 -16
  91. package/dist/sdk-tools.contract.js +65 -88
  92. package/dist/sdk-tools.contract.js.map +1 -1
  93. package/dist/sdk-tools.contract.registry.js +65 -88
  94. package/dist/sdk-tools.contract.registry.js.map +1 -1
  95. package/dist/sdk-tools.contract.values.js +65 -88
  96. package/dist/sdk-tools.contract.values.js.map +1 -1
  97. package/dist/tool-contracts.d.ts +1 -1
  98. package/dist/tool-contracts.graph.js +3 -3
  99. package/dist/tool-contracts.graph.js.map +1 -1
  100. package/dist/tool-contracts.intelligence-evidence.js +7 -7
  101. package/dist/tool-contracts.intelligence-evidence.js.map +1 -1
  102. package/dist/tool-contracts.js +66 -89
  103. package/dist/tool-contracts.js.map +1 -1
  104. package/dist/tool-contracts.lifecycle.d.ts +2 -2
  105. package/dist/tool-contracts.lifecycle.js +49 -68
  106. package/dist/tool-contracts.lifecycle.js.map +1 -1
  107. package/dist/tool-contracts.pipeline-coordination.js +1 -1
  108. package/dist/tool-contracts.pipeline-coordination.js.map +1 -1
  109. package/dist/tool-contracts.questions-listing.js +5 -9
  110. package/dist/tool-contracts.questions-listing.js.map +1 -1
  111. package/dist/{tool-contracts.values-BhxfrXS5.d.ts → tool-contracts.values-CCoI3qQY.d.ts} +3 -3
  112. package/dist/tool-contracts.values.d.ts +1 -1
  113. package/dist/tool-contracts.values.js +66 -89
  114. package/dist/tool-contracts.values.js.map +1 -1
  115. package/package.json +1 -1
  116. package/dist/projections/modulate-confidence.projection.js.map +0 -1
@@ -6,15 +6,23 @@ import { v } from 'convex/values';
6
6
  // src/tool-contracts.lifecycle.ts
7
7
  var CREATE_BELIEF = {
8
8
  name: "create_belief",
9
- 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)`; attach supporting or contradicting evidence with create_evidence or link_evidence_to_belief to record evidential updates.",
9
+ 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 requires a topic epistemic-node anchor and writes a `scoped_by` edge directly from belief node to topic node; orphan beliefs are invalid. Creation stores the vacuous opinion `(0, 0, 1, a)`; attach supporting or contradicting evidence with create_evidence or link_evidence_to_belief to record evidential updates.",
10
10
  parameters: {
11
11
  canonicalText: {
12
12
  type: "string",
13
13
  description: "The belief statement \u2014 what the agent holds to be true"
14
14
  },
15
+ topicGlobalId: {
16
+ type: "string",
17
+ description: "Required globalId (UUID) of the topic node in epistemicNodes that anchors the belief"
18
+ },
19
+ topicNodeId: {
20
+ type: "string",
21
+ description: "Optional internal epistemicNodes _id for the topic anchor. Prefer topicGlobalId for public callers."
22
+ },
15
23
  topicId: {
16
24
  type: "string",
17
- description: "Optional topic scope hint for the belief"
25
+ description: "Deprecated compatibility alias for topicGlobalId. Must identify a topic epistemicNode, not a legacy topics-table row."
18
26
  },
19
27
  baseRate: {
20
28
  type: "number",
@@ -29,7 +37,7 @@ var CREATE_BELIEF = {
29
37
  description: "Optional extra metadata merged into the node (e.g., { codeAnchors: ['path/to/file.ts'] } for coding intelligence)"
30
38
  }
31
39
  },
32
- required: ["canonicalText"],
40
+ required: ["canonicalText", "topicGlobalId"],
33
41
  response: {
34
42
  description: "The created canonical belief record",
35
43
  fields: {
@@ -38,7 +46,7 @@ var CREATE_BELIEF = {
38
46
  beliefId: "string \u2014 canonical belief ID",
39
47
  text: "string \u2014 canonical belief formulation",
40
48
  topicId: "string",
41
- status: "string \u2014 active | superseded | archived",
49
+ beliefStatus: "string \u2014 assumption | hypothesis | active | superseded | resolved_true | resolved_false",
42
50
  scoringState: "string \u2014 unscored | scored"
43
51
  }
44
52
  },
@@ -61,7 +69,7 @@ var GET_BELIEF = {
61
69
  beliefId: "string \u2014 canonical belief ID",
62
70
  text: "string \u2014 canonical belief formulation",
63
71
  topicId: "string",
64
- status: "string \u2014 active | superseded | archived",
72
+ beliefStatus: "string \u2014 assumption | hypothesis | active | superseded | resolved_true | resolved_false",
65
73
  scoringState: "string \u2014 unscored | scored"
66
74
  }
67
75
  },
@@ -90,34 +98,24 @@ var REFINE_BELIEF = {
90
98
  ontologyPrimitive: "belief",
91
99
  tier: "showcase"
92
100
  };
93
- var MODULATE_CONFIDENCE = {
94
- name: "modulate_confidence",
95
- description: "Internal-only subjective-logic ledger append. Like `git commit` to the credence log for the scoring engine \u2014 never an operator-facing way to assert confidence. Agents, SDK callers, CLI users, and MCP clients must instead create or link evidence with `evidenceRelation: supports|contradicts`; the kernel derives the next opinion from that evidence. This compatibility primitive is reserved for governed system scoring paths that already hold a full subjective-logic tuple and truth-bearing provenance.",
101
+ var APPEND_SL_SCORING = {
102
+ name: "append_sl_scoring",
103
+ description: "Internal evidence-backed Subjective Logic scoring append. This is not a public MCP tool: callers should attach supporting or contradicting evidence, and governed system paths append the derived SL tuple.",
96
104
  parameters: {
97
- nodeId: { type: "string", description: "The belief to score" },
98
- belief: {
99
- type: "number",
100
- description: "Subjective-logic belief mass `b` in [0, 1]"
101
- },
105
+ nodeId: { type: "string", description: "The belief receiving the SL score" },
106
+ belief: { type: "number", description: "Subjective Logic belief mass b" },
102
107
  disbelief: {
103
108
  type: "number",
104
- description: "Subjective-logic disbelief mass `d` in [0, 1]"
109
+ description: "Subjective Logic disbelief mass d"
105
110
  },
106
111
  uncertainty: {
107
112
  type: "number",
108
- description: "Subjective-logic uncertainty mass `u` in [0, 1]"
109
- },
110
- baseRate: {
111
- type: "number",
112
- description: "Subjective-logic base rate `a` in [0, 1]. Required for tuple payloads."
113
- },
114
- worktreeId: {
115
- type: "string",
116
- description: "Completed worktree that tested this belief when confidence policy requires merge-backed scoring."
113
+ description: "Subjective Logic uncertainty mass u"
117
114
  },
115
+ baseRate: { type: "number", description: "Subjective Logic base rate a" },
118
116
  trigger: {
119
117
  type: "string",
120
- description: "What caused this confidence change",
118
+ description: "Evidence-bearing cause of the scoring event",
121
119
  enum: [
122
120
  "evidence_added",
123
121
  "evidence_removed",
@@ -128,64 +126,39 @@ var MODULATE_CONFIDENCE = {
128
126
  "worktree_completed",
129
127
  "fusion",
130
128
  "discount",
131
- "deduction"
129
+ "deduction",
130
+ "backfill_synthetic"
132
131
  ]
133
132
  },
134
- triggeringEvidenceId: {
135
- type: "string",
136
- description: "Evidence node that caused an evidence-triggered modulation"
137
- },
138
- triggeringQuestionId: {
139
- type: "string",
140
- description: "Answered question whose resolution supports this modulation"
141
- },
142
- triggeringAnswerId: {
143
- type: "string",
144
- description: "Answer node whose content supports this modulation"
145
- },
146
- triggeringContradictionId: {
147
- type: "string",
148
- description: "Contradiction record that caused a contradiction-triggered modulation"
149
- },
150
- triggeringWorktreeId: {
151
- type: "string",
152
- description: "Completed worktree whose outcome caused a worktree-triggered modulation"
133
+ provenance: {
134
+ type: "object",
135
+ description: "At least one of evidence, question, answer, contradiction, or worktree."
153
136
  },
154
137
  rationale: {
155
138
  type: "string",
156
- description: "Human-readable explanation of why confidence changed"
139
+ description: "Why this evidence-bearing event moved the SL tuple"
157
140
  }
158
141
  },
159
- required: [
160
- "nodeId",
161
- "belief",
162
- "disbelief",
163
- "uncertainty",
164
- "baseRate",
165
- "trigger",
166
- "rationale"
167
- ],
142
+ required: ["nodeId", "belief", "disbelief", "uncertainty", "baseRate", "trigger", "rationale"],
168
143
  response: {
169
- description: "Confidence modulation result",
144
+ description: "Internal SL scoring append receipt",
170
145
  fields: {
171
- beliefId: "string \u2014 canonical belief ID",
172
- nodeId: "string \u2014 canonical belief ID",
173
- newConfidence: "number",
146
+ nodeId: "string",
174
147
  previousConfidence: "number",
175
- trigger: "string",
176
- requestId: "string \u2014 request identifier for the scheduled cascade",
177
- propagationSummary: "object \u2014 bounded inline cascade summary with totalCandidateTargets, inlineTargets, and remainingTargetCount"
148
+ newConfidence: "number",
149
+ beliefConfidenceId: "string"
178
150
  }
179
151
  },
180
152
  ownerModule: "graph-primitives",
181
153
  ontologyPrimitive: "belief",
182
- tier: "showcase"
154
+ tier: "workhorse",
155
+ internal: true
183
156
  };
184
157
  var FORK_BELIEF = {
185
158
  name: "fork_belief",
186
- 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.",
159
+ description: "Branch off an evidence-bearing belief to create a new formulation. Like `git fork` \u2014 the parent remains immutable with full history, and every fork must cite evidence already attached to the parent through SL scoring. `forkMode=supersede` marks the parent superseded and requires contradicting evidence; `forkMode=branch` preserves the parent and creates a derived child.",
187
160
  parameters: {
188
- nodeId: { type: "string", description: "The scored belief to fork from" },
161
+ nodeId: { type: "string", description: "The belief to fork from" },
189
162
  newFormulation: {
190
163
  type: "string",
191
164
  description: "The evolved belief statement"
@@ -197,12 +170,20 @@ var FORK_BELIEF = {
197
170
  "refinement",
198
171
  "contradiction_response",
199
172
  "scope_change",
200
- "confidence_collapse",
201
- "manual"
173
+ "confidence_collapse"
202
174
  ]
175
+ },
176
+ forkMode: {
177
+ type: "string",
178
+ description: "supersede replaces the parent; branch creates a child while preserving the parent.",
179
+ enum: ["supersede", "branch"]
180
+ },
181
+ triggeringEvidenceId: {
182
+ type: "string",
183
+ description: "Evidence already attached to the parent belief that caused the fork."
203
184
  }
204
185
  },
205
- required: ["nodeId", "newFormulation", "forkReason"],
186
+ required: ["nodeId", "newFormulation", "forkReason", "triggeringEvidenceId"],
206
187
  response: {
207
188
  description: "The forked canonical belief record",
208
189
  fields: {
@@ -704,7 +685,7 @@ var REASONING_METHODS = [
704
685
  // src/tool-contracts.graph.ts
705
686
  var QUERY_LINEAGE = {
706
687
  name: "query_lineage",
707
- 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).",
688
+ description: "Trace a belief's full ancestry \u2014 every fork, score, and SL scoring event. 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).",
708
689
  parameters: {
709
690
  nodeId: { type: "string", description: "Starting node to trace from" },
710
691
  depth: {
@@ -903,7 +884,7 @@ var FIND_CONTRADICTIONS = {
903
884
  };
904
885
  var BISECT_CONFIDENCE = {
905
886
  name: "bisect_confidence",
906
- 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.",
887
+ 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 SL scoring events to identify which evidence or event caused the divergence.",
907
888
  parameters: {
908
889
  nodeId: { type: "string", description: "The belief to bisect" },
909
890
  expectedDirection: {
@@ -922,7 +903,7 @@ var BISECT_CONFIDENCE = {
922
903
  fields: {
923
904
  beliefId: "string \u2014 canonical belief ID",
924
905
  expectedDirection: "string \u2014 overconfident | underconfident",
925
- inflectionEntry: "object \u2014 the confidence modulation where divergence began",
906
+ inflectionEntry: "object \u2014 the scoring event where divergence began",
926
907
  triggerEvent: "string | null \u2014 what caused the divergence",
927
908
  confidenceBefore: "number | null",
928
909
  confidenceAfter: "number | null",
@@ -1867,18 +1848,18 @@ var SEARCH_EVIDENCE = {
1867
1848
  };
1868
1849
  var CREATE_EVIDENCE = {
1869
1850
  name: "create_evidence",
1870
- 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. When evidence bears on beliefs, state whether it supports or contradicts; SL confidence is derived from these evidence relations.",
1851
+ description: "Commit evidence to the reasoning graph. Like `git commit` \u2014 creates a traceable evidence record with canonical public IDs. Evidence creation must link to at least one belief and must include a signed impact score. Positive scores support the belief; negative scores contradict it. SL confidence is derived from these weighted evidence relations.",
1871
1852
  parameters: {
1872
1853
  topicId: { type: "string", description: "Topic scope" },
1873
1854
  text: { type: "string", description: "Canonical evidence text" },
1874
1855
  source: { type: "string", description: "Source URL or source label" },
1875
1856
  targetId: {
1876
1857
  type: "string",
1877
- description: "Optional belief or question identifier to link immediately"
1858
+ description: "Belief identifier to link immediately"
1878
1859
  },
1879
1860
  weight: {
1880
1861
  type: "number",
1881
- description: "Optional support weight: -1.0 (contradicts) to +1.0 (supports). If omitted, evidenceRelation + confidence determine the weight."
1862
+ description: "Required nonzero signed impact score: -1.0 (contradicts) to +1.0 (supports)."
1882
1863
  },
1883
1864
  evidenceRelation: {
1884
1865
  type: "string",
@@ -1887,7 +1868,7 @@ var CREATE_EVIDENCE = {
1887
1868
  },
1888
1869
  confidence: {
1889
1870
  type: "number",
1890
- description: "Confidence in the evidence relation, 0.0 to 1.0"
1871
+ description: "Deprecated hint. Runtime confidence is derived from the signed impact score."
1891
1872
  },
1892
1873
  beliefRelations: {
1893
1874
  type: "array",
@@ -1909,7 +1890,7 @@ var CREATE_EVIDENCE = {
1909
1890
  },
1910
1891
  kind: { type: "string", description: "Optional evidence kind" }
1911
1892
  },
1912
- required: ["text", "rationale"],
1893
+ required: ["text", "rationale", "weight"],
1913
1894
  response: {
1914
1895
  description: "The created canonical evidence record",
1915
1896
  fields: {
@@ -1984,7 +1965,7 @@ var LINK_EVIDENCE = {
1984
1965
  },
1985
1966
  rationale: { type: "string", description: "Why this link exists" }
1986
1967
  },
1987
- required: ["evidenceId", "targetId"],
1968
+ required: ["evidenceId", "targetId", "weight"],
1988
1969
  response: {
1989
1970
  description: "The created canonical evidence edge summary",
1990
1971
  fields: {
@@ -2020,7 +2001,7 @@ var LINK_EVIDENCE_TO_BELIEF = {
2020
2001
  },
2021
2002
  rationale: { type: "string", description: "Why this evidence is relevant" }
2022
2003
  },
2023
- required: ["evidenceId", "beliefId"],
2004
+ required: ["evidenceId", "beliefId", "weight"],
2024
2005
  response: {
2025
2006
  description: "The created edge linking evidence to belief",
2026
2007
  fields: {
@@ -2839,6 +2820,11 @@ var COMPILE_CONTEXT = {
2839
2820
  response: {
2840
2821
  description: "Compiled context pack for the requested topic",
2841
2822
  fields: {
2823
+ contextNarrative: "array \u2014 first field; ordered synthesis blocks with kind/text, starting with executive_summary and canonical narrative blocks before raw objects",
2824
+ narrativeCoverage: "object \u2014 recordsSynthesized, recordsNamed, recordsOmitted, topicsSynthesized, topicsEnriched, topicContentOmitted, enrichmentMode, and blocksEmitted for the narrative",
2825
+ synthesisLints: "array \u2014 inline quality warnings for degenerate synthesis blocks or weak narrative coverage",
2826
+ retrievalReceipt: "object \u2014 candidateCounts, coverageWarning, narrativeCoverage, synthesisLints, and suggestedNextActions",
2827
+ supportingObjects: "object \u2014 raw graph records grouped behind the synthesis: invariants, activeBeliefs, openQuestions, recentEvidence, worktrees, lanes, entities, and contradictions",
2842
2828
  schemaVersion: "string",
2843
2829
  topicId: "string",
2844
2830
  topicName: "string",
@@ -2846,15 +2832,6 @@ var COMPILE_CONTEXT = {
2846
2832
  generatedAt: "number \u2014 deterministic graph-backed reference timestamp for this compilation",
2847
2833
  ranking: "string \u2014 baseline_v1 | weighted_v1",
2848
2834
  summary: "object \u2014 counts and scoped health signals",
2849
- invariants: "array \u2014 high-confidence invariant beliefs",
2850
- activeBeliefs: "array \u2014 current high-signal beliefs",
2851
- openQuestions: "array \u2014 unresolved questions ranked for this query",
2852
- recentEvidence: "array \u2014 recent evidence ranked for this query",
2853
- contradictions: "array \u2014 unresolved contradiction records",
2854
- relatedEntities: "array | undefined \u2014 ranked ontological entities in scope",
2855
- contextNarrative: "array \u2014 ordered synthesis blocks with kind/text, starting with executive_summary and canonical narrative blocks before raw objects",
2856
- retrievalReceipt: "object \u2014 candidateCounts, coverageWarning, narrativeCoverage, synthesisLints, and suggestedNextActions",
2857
- narrativeCoverage: "object \u2014 recordsSynthesized, recordsNamed, recordsOmitted, topicsSynthesized, topicsEnriched, topicContentOmitted, enrichmentMode, and blocksEmitted for the narrative",
2858
2835
  injectionPolicy: "object \u2014 token-budgeted section selections",
2859
2836
  diagnostics: "object \u2014 scoring and utilization telemetry"
2860
2837
  }
@@ -4273,7 +4250,7 @@ var TRIGGER_BELIEF_REVIEW = {
4273
4250
  };
4274
4251
  var EVALUATE_CONTRACT = {
4275
4252
  name: "evaluate_contract",
4276
- 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.",
4253
+ 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 SL scoring action.",
4277
4254
  parameters: {
4278
4255
  contractId: { type: "string", description: "Which contract to evaluate" },
4279
4256
  trigger: {
@@ -4629,7 +4606,7 @@ var MCP_TOOL_CONTRACTS = {
4629
4606
  create_belief: CREATE_BELIEF,
4630
4607
  get_belief: GET_BELIEF,
4631
4608
  refine_belief: REFINE_BELIEF,
4632
- modulate_confidence: MODULATE_CONFIDENCE,
4609
+ append_sl_scoring: APPEND_SL_SCORING,
4633
4610
  fork_belief: FORK_BELIEF,
4634
4611
  archive_belief: ARCHIVE_BELIEF,
4635
4612
  create_epistemic_contract: CREATE_EPISTEMIC_CONTRACT,
@@ -5124,12 +5101,12 @@ var LUCERN_OPERATION_MANIFEST = {
5124
5101
  internalSystem,
5125
5102
  "Lucern system/background operation. Available to platform code paths, hidden from public MCP discovery."
5126
5103
  ),
5127
- modulate_confidence: {
5128
- name: "modulate_confidence",
5104
+ append_sl_scoring: {
5105
+ name: "append_sl_scoring",
5129
5106
  surfaceClass: "platform_internal",
5130
5107
  surfaceIntent: "system",
5131
5108
  surfaces: internalSdkRestOnly,
5132
- rationale: "Internal SL ledger append primitive. Public callers attach evidence or contradiction relations; confidence is derived algorithmically."
5109
+ rationale: "Internal SL scoring append primitive. Public callers attach evidence or contradiction relations; confidence is derived algorithmically."
5133
5110
  },
5134
5111
  ...entries(
5135
5112
  LEGACY_COMPAT_OPERATION_NAMES,
@@ -5512,7 +5489,7 @@ var slOpinionProjectionSchema = z.object({
5512
5489
  uncertainty: z.number(),
5513
5490
  baseRate: z.number()
5514
5491
  });
5515
- var modulateConfidenceInputObjectSchema = z.object({
5492
+ var appendSlScoringInputObjectSchema = z.object({
5516
5493
  nodeId: z.string().optional(),
5517
5494
  beliefNodeId: z.string().optional(),
5518
5495
  worktreeId: z.string().optional(),
@@ -5531,23 +5508,23 @@ var modulateConfidenceInputObjectSchema = z.object({
5531
5508
  rationale: z.string(),
5532
5509
  trustedBypassAccessCheck: z.boolean().optional()
5533
5510
  });
5534
- var modulateConfidenceInputSchema = modulateConfidenceInputObjectSchema.superRefine((input, ctx) => {
5511
+ var appendSlScoringInputSchema = appendSlScoringInputObjectSchema.superRefine((input, ctx) => {
5535
5512
  if (hasProvenance(input)) {
5536
5513
  return;
5537
5514
  }
5538
5515
  ctx.addIssue({
5539
5516
  code: z.ZodIssueCode.custom,
5540
- message: "modulate_confidence requires evidence, question, answer, contradiction, or worktree provenance",
5517
+ message: "append_sl_scoring requires evidence, question, answer, contradiction, or worktree provenance",
5541
5518
  path: ["provenance"]
5542
5519
  });
5543
5520
  });
5544
- var modulateConfidenceProjection = defineProjection({
5545
- contractName: "modulate_confidence",
5546
- inputSchema: modulateConfidenceInputSchema,
5521
+ var appendSlScoringProjection = defineProjection({
5522
+ contractName: "append_sl_scoring",
5523
+ inputSchema: appendSlScoringInputSchema,
5547
5524
  project: (input) => {
5548
5525
  const nodeId = input.beliefNodeId ?? input.nodeId;
5549
5526
  if (!nodeId) {
5550
- throw new Error("modulate_confidence requires beliefNodeId or nodeId");
5527
+ throw new Error("append_sl_scoring requires beliefNodeId or nodeId");
5551
5528
  }
5552
5529
  const opinion = input.opinion ?? {
5553
5530
  belief: requireNumber(input.belief, "belief"),
@@ -5604,14 +5581,14 @@ var modulateConfidenceProjection = defineProjection({
5604
5581
  });
5605
5582
  function requireNumber(value, field) {
5606
5583
  if (value === void 0) {
5607
- throw new Error(`modulate_confidence requires ${field}`);
5584
+ throw new Error(`append_sl_scoring requires ${field}`);
5608
5585
  }
5609
5586
  return value;
5610
5587
  }
5611
5588
  function assertProvenance(input) {
5612
5589
  if (!hasProvenance(input)) {
5613
5590
  throw new Error(
5614
- "modulate_confidence requires evidence, question, answer, contradiction, or worktree provenance"
5591
+ "append_sl_scoring requires evidence, question, answer, contradiction, or worktree provenance"
5615
5592
  );
5616
5593
  }
5617
5594
  }
@@ -5635,7 +5612,15 @@ var predictionMetaSchema = z.object({
5635
5612
  });
5636
5613
  var createBeliefArgs = z.object({
5637
5614
  canonicalText: z.string().describe("The belief statement the agent holds to be true."),
5638
- topicId: z.string().optional().describe("Topic scope hint for the belief."),
5615
+ topicGlobalId: z.string().describe(
5616
+ "Required globalId of the topic epistemicNode that anchors this belief. Belief creation creates a scoped_by edge directly to that topic node."
5617
+ ),
5618
+ topicNodeId: z.string().optional().describe(
5619
+ "Optional internal epistemicNodes _id for the topic anchor. Prefer topicGlobalId for public callers."
5620
+ ),
5621
+ topicId: z.string().optional().describe(
5622
+ "Deprecated compatibility alias for topicGlobalId. Must identify a topic epistemicNode, not a legacy topics-table row."
5623
+ ),
5639
5624
  baseRate: z.number().optional().describe("Prior base rate used to seed the vacuous opinion."),
5640
5625
  beliefType: z.string().optional().describe("Schema belief type."),
5641
5626
  metadata: jsonRecordSchema.optional().describe("Extra metadata merged into the belief node."),
@@ -5654,9 +5639,14 @@ var forkBeliefArgs = z.object({
5654
5639
  "refinement",
5655
5640
  "contradiction_response",
5656
5641
  "scope_change",
5657
- "confidence_collapse",
5658
- "manual"
5642
+ "confidence_collapse"
5659
5643
  ]).describe("Why this fork was created."),
5644
+ forkMode: z.enum(["supersede", "branch"]).optional().describe(
5645
+ "supersede marks the parent belief superseded; branch preserves the parent and creates a derived child."
5646
+ ),
5647
+ triggeringEvidenceId: z.string().describe(
5648
+ "Evidence already attached to the parent belief through SL scoring; required for every fork."
5649
+ ),
5660
5650
  rationale: z.string().optional().describe("Why the fork is warranted.")
5661
5651
  });
5662
5652
  var beliefLookupInput = (input) => compactRecord({
@@ -5670,7 +5660,9 @@ var createBeliefInput = (input, context) => {
5670
5660
  return withUserId(
5671
5661
  compactRecord({
5672
5662
  projectId: input.projectId,
5673
- topicId: input.topicId,
5663
+ topicId: input.topicGlobalId ?? input.topicNodeId ?? input.topicId,
5664
+ topicGlobalId: input.topicGlobalId,
5665
+ topicNodeId: input.topicNodeId,
5674
5666
  formulation: input.formulation ?? input.canonicalText,
5675
5667
  beliefType: input.beliefType,
5676
5668
  rationale: input.rationale,
@@ -5692,20 +5684,22 @@ var forkBeliefInput = (input, context) => withUserId(
5692
5684
  parentNodeId: input.parentNodeId ?? input.nodeId ?? input.id,
5693
5685
  newFormulation: input.newFormulation,
5694
5686
  forkReason: input.forkReason,
5687
+ forkMode: input.forkMode,
5688
+ triggeringEvidenceId: input.triggeringEvidenceId,
5695
5689
  rationale: input.rationale,
5696
5690
  trustedBypassAccessCheck: input.trustedBypassAccessCheck ?? true
5697
5691
  }),
5698
5692
  context
5699
5693
  );
5700
- var confidenceInput = (input, context) => {
5701
- const parsed = modulateConfidenceProjection.inputSchema.safeParse(input);
5694
+ var appendSlScoringInput = (input, context) => {
5695
+ const parsed = appendSlScoringProjection.inputSchema.safeParse(input);
5702
5696
  if (!parsed.success) {
5703
5697
  throw new Error(
5704
- `modulate_confidence projection input rejected: ${parsed.error.message}`
5698
+ `append_sl_scoring projection input rejected: ${parsed.error.message}`
5705
5699
  );
5706
5700
  }
5707
5701
  return withUserId(
5708
- compactRecord(modulateConfidenceProjection.project(parsed.data)),
5702
+ compactRecord(appendSlScoringProjection.project(parsed.data)),
5709
5703
  context
5710
5704
  );
5711
5705
  };
@@ -5783,21 +5777,21 @@ var beliefsContracts = [
5783
5777
  }
5784
5778
  }),
5785
5779
  surfaceContract({
5786
- name: "modulate_confidence",
5780
+ name: "append_sl_scoring",
5787
5781
  kind: "mutation",
5788
5782
  domain: "beliefs",
5789
5783
  surfaceClass: "platform_internal",
5790
- path: "/beliefs/confidence",
5784
+ path: "/beliefs/sl-scoring",
5791
5785
  sdkNamespace: "beliefs",
5792
- sdkMethod: "modulateConfidence",
5793
- summary: "Internal SL ledger append. Public callers should attach evidence or contradiction relations instead.",
5786
+ sdkMethod: "appendSlScoring",
5787
+ summary: "Internal SL scoring append. Public callers attach evidence or contradiction relations instead.",
5794
5788
  convex: {
5795
5789
  module: "beliefs",
5796
- functionName: "modulateConfidence",
5790
+ functionName: "appendSlScoring",
5797
5791
  kind: "mutation",
5798
- inputProjection: confidenceInput
5792
+ inputProjection: appendSlScoringInput
5799
5793
  },
5800
- args: modulateConfidenceInputSchema
5794
+ args: appendSlScoringInputSchema
5801
5795
  }),
5802
5796
  surfaceContract({
5803
5797
  name: "fork_belief",