@soleri/core 8.0.0 → 9.0.0

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 (239) hide show
  1. package/dist/brain/brain.d.ts +1 -8
  2. package/dist/brain/brain.d.ts.map +1 -1
  3. package/dist/brain/brain.js +5 -134
  4. package/dist/brain/brain.js.map +1 -1
  5. package/dist/brain/knowledge-synthesizer.d.ts.map +1 -1
  6. package/dist/brain/knowledge-synthesizer.js +0 -2
  7. package/dist/brain/knowledge-synthesizer.js.map +1 -1
  8. package/dist/cognee/client.d.ts +5 -0
  9. package/dist/cognee/client.d.ts.map +1 -1
  10. package/dist/cognee/client.js +83 -16
  11. package/dist/cognee/client.js.map +1 -1
  12. package/dist/cognee/sync-manager.d.ts +67 -8
  13. package/dist/cognee/sync-manager.d.ts.map +1 -1
  14. package/dist/cognee/sync-manager.js +129 -32
  15. package/dist/cognee/sync-manager.js.map +1 -1
  16. package/dist/cognee/types.d.ts +16 -0
  17. package/dist/cognee/types.d.ts.map +1 -1
  18. package/dist/context/context-engine.d.ts +2 -5
  19. package/dist/context/context-engine.d.ts.map +1 -1
  20. package/dist/context/context-engine.js +4 -31
  21. package/dist/context/context-engine.js.map +1 -1
  22. package/dist/curator/classifier.d.ts.map +1 -1
  23. package/dist/curator/classifier.js +0 -2
  24. package/dist/curator/classifier.js.map +1 -1
  25. package/dist/curator/curator.d.ts +2 -5
  26. package/dist/curator/curator.d.ts.map +1 -1
  27. package/dist/curator/curator.js +4 -23
  28. package/dist/curator/curator.js.map +1 -1
  29. package/dist/curator/quality-gate.d.ts.map +1 -1
  30. package/dist/curator/quality-gate.js +0 -2
  31. package/dist/curator/quality-gate.js.map +1 -1
  32. package/dist/domain-packs/index.d.ts +0 -3
  33. package/dist/domain-packs/index.d.ts.map +1 -1
  34. package/dist/domain-packs/index.js +0 -3
  35. package/dist/domain-packs/index.js.map +1 -1
  36. package/dist/domain-packs/loader.d.ts.map +1 -1
  37. package/dist/domain-packs/loader.js +20 -4
  38. package/dist/domain-packs/loader.js.map +1 -1
  39. package/dist/domain-packs/pack-runtime.d.ts +5 -5
  40. package/dist/domain-packs/pack-runtime.d.ts.map +1 -1
  41. package/dist/domain-packs/pack-runtime.js +2 -2
  42. package/dist/domain-packs/pack-runtime.js.map +1 -1
  43. package/dist/domain-packs/types.d.ts +8 -2
  44. package/dist/domain-packs/types.d.ts.map +1 -1
  45. package/dist/domain-packs/types.js.map +1 -1
  46. package/dist/engine/bin/soleri-engine.js +18 -7
  47. package/dist/engine/bin/soleri-engine.js.map +1 -1
  48. package/dist/engine/core-ops.d.ts.map +1 -1
  49. package/dist/engine/core-ops.js +11 -6
  50. package/dist/engine/core-ops.js.map +1 -1
  51. package/dist/engine/index.d.ts +2 -0
  52. package/dist/engine/index.d.ts.map +1 -1
  53. package/dist/engine/index.js +1 -0
  54. package/dist/engine/index.js.map +1 -1
  55. package/dist/engine/module-manifest.d.ts +28 -0
  56. package/dist/engine/module-manifest.d.ts.map +1 -0
  57. package/dist/engine/module-manifest.js +85 -0
  58. package/dist/engine/module-manifest.js.map +1 -0
  59. package/dist/engine/register-engine.d.ts +19 -0
  60. package/dist/engine/register-engine.d.ts.map +1 -1
  61. package/dist/engine/register-engine.js +15 -9
  62. package/dist/engine/register-engine.js.map +1 -1
  63. package/dist/index.d.ts +5 -6
  64. package/dist/index.d.ts.map +1 -1
  65. package/dist/index.js +3 -5
  66. package/dist/index.js.map +1 -1
  67. package/dist/intake/content-classifier.d.ts.map +1 -1
  68. package/dist/intake/content-classifier.js +0 -2
  69. package/dist/intake/content-classifier.js.map +1 -1
  70. package/dist/intelligence/types.d.ts +7 -0
  71. package/dist/intelligence/types.d.ts.map +1 -1
  72. package/dist/llm/llm-client.d.ts.map +1 -1
  73. package/dist/llm/llm-client.js +8 -4
  74. package/dist/llm/llm-client.js.map +1 -1
  75. package/dist/llm/oauth-discovery.d.ts +0 -8
  76. package/dist/llm/oauth-discovery.d.ts.map +1 -1
  77. package/dist/llm/oauth-discovery.js +0 -19
  78. package/dist/llm/oauth-discovery.js.map +1 -1
  79. package/dist/llm/types.d.ts +4 -2
  80. package/dist/llm/types.d.ts.map +1 -1
  81. package/dist/packs/pack-installer.d.ts +2 -1
  82. package/dist/packs/pack-installer.d.ts.map +1 -1
  83. package/dist/packs/pack-installer.js +10 -1
  84. package/dist/packs/pack-installer.js.map +1 -1
  85. package/dist/persistence/index.d.ts +0 -1
  86. package/dist/persistence/index.d.ts.map +1 -1
  87. package/dist/persistence/index.js +0 -1
  88. package/dist/persistence/index.js.map +1 -1
  89. package/dist/persistence/types.d.ts +2 -6
  90. package/dist/persistence/types.d.ts.map +1 -1
  91. package/dist/persona/defaults.d.ts +16 -0
  92. package/dist/persona/defaults.d.ts.map +1 -0
  93. package/dist/persona/defaults.js +78 -0
  94. package/dist/persona/defaults.js.map +1 -0
  95. package/dist/persona/index.d.ts +5 -0
  96. package/dist/persona/index.d.ts.map +1 -0
  97. package/dist/persona/index.js +4 -0
  98. package/dist/persona/index.js.map +1 -0
  99. package/dist/persona/loader.d.ts +11 -0
  100. package/dist/persona/loader.d.ts.map +1 -0
  101. package/dist/persona/loader.js +45 -0
  102. package/dist/persona/loader.js.map +1 -0
  103. package/dist/persona/prompt-generator.d.ts +13 -0
  104. package/dist/persona/prompt-generator.d.ts.map +1 -0
  105. package/dist/persona/prompt-generator.js +89 -0
  106. package/dist/persona/prompt-generator.js.map +1 -0
  107. package/dist/persona/types.d.ts +56 -0
  108. package/dist/persona/types.d.ts.map +1 -0
  109. package/dist/persona/types.js +9 -0
  110. package/dist/persona/types.js.map +1 -0
  111. package/dist/plugins/index.d.ts +4 -0
  112. package/dist/plugins/index.d.ts.map +1 -1
  113. package/dist/plugins/index.js +4 -0
  114. package/dist/plugins/index.js.map +1 -1
  115. package/dist/plugins/plugin-registry.d.ts +4 -0
  116. package/dist/plugins/plugin-registry.d.ts.map +1 -1
  117. package/dist/plugins/plugin-registry.js +4 -0
  118. package/dist/plugins/plugin-registry.js.map +1 -1
  119. package/dist/plugins/types.d.ts +36 -31
  120. package/dist/plugins/types.d.ts.map +1 -1
  121. package/dist/plugins/types.js +6 -3
  122. package/dist/plugins/types.js.map +1 -1
  123. package/dist/runtime/admin-extra-ops.d.ts.map +1 -1
  124. package/dist/runtime/admin-extra-ops.js +5 -27
  125. package/dist/runtime/admin-extra-ops.js.map +1 -1
  126. package/dist/runtime/admin-ops.d.ts.map +1 -1
  127. package/dist/runtime/admin-ops.js +5 -37
  128. package/dist/runtime/admin-ops.js.map +1 -1
  129. package/dist/runtime/capture-ops.d.ts.map +1 -1
  130. package/dist/runtime/capture-ops.js +32 -16
  131. package/dist/runtime/capture-ops.js.map +1 -1
  132. package/dist/runtime/claude-md-helpers.d.ts +0 -9
  133. package/dist/runtime/claude-md-helpers.d.ts.map +1 -1
  134. package/dist/runtime/claude-md-helpers.js +1 -14
  135. package/dist/runtime/claude-md-helpers.js.map +1 -1
  136. package/dist/runtime/cognee-sync-ops.d.ts +2 -2
  137. package/dist/runtime/cognee-sync-ops.d.ts.map +1 -1
  138. package/dist/runtime/cognee-sync-ops.js +45 -7
  139. package/dist/runtime/cognee-sync-ops.js.map +1 -1
  140. package/dist/runtime/facades/admin-facade.d.ts.map +1 -1
  141. package/dist/runtime/facades/admin-facade.js +1 -2
  142. package/dist/runtime/facades/admin-facade.js.map +1 -1
  143. package/dist/runtime/facades/index.d.ts +1 -1
  144. package/dist/runtime/facades/index.d.ts.map +1 -1
  145. package/dist/runtime/facades/index.js +1 -10
  146. package/dist/runtime/facades/index.js.map +1 -1
  147. package/dist/runtime/pack-ops.d.ts +3 -0
  148. package/dist/runtime/pack-ops.d.ts.map +1 -1
  149. package/dist/runtime/pack-ops.js +18 -1
  150. package/dist/runtime/pack-ops.js.map +1 -1
  151. package/dist/runtime/plugin-ops.d.ts.map +1 -1
  152. package/dist/runtime/plugin-ops.js +3 -0
  153. package/dist/runtime/plugin-ops.js.map +1 -1
  154. package/dist/runtime/runtime.d.ts.map +1 -1
  155. package/dist/runtime/runtime.js +14 -53
  156. package/dist/runtime/runtime.js.map +1 -1
  157. package/dist/runtime/session-briefing.d.ts.map +1 -1
  158. package/dist/runtime/session-briefing.js +14 -0
  159. package/dist/runtime/session-briefing.js.map +1 -1
  160. package/dist/runtime/types.d.ts +6 -8
  161. package/dist/runtime/types.d.ts.map +1 -1
  162. package/dist/runtime/vault-linking-ops.d.ts.map +1 -1
  163. package/dist/runtime/vault-linking-ops.js +42 -4
  164. package/dist/runtime/vault-linking-ops.js.map +1 -1
  165. package/dist/runtime/vault-sharing-ops.d.ts.map +1 -1
  166. package/dist/runtime/vault-sharing-ops.js +53 -3
  167. package/dist/runtime/vault-sharing-ops.js.map +1 -1
  168. package/dist/vault/linking.d.ts +37 -0
  169. package/dist/vault/linking.d.ts.map +1 -1
  170. package/dist/vault/linking.js +73 -0
  171. package/dist/vault/linking.js.map +1 -1
  172. package/dist/vault/vault.d.ts +9 -2
  173. package/dist/vault/vault.d.ts.map +1 -1
  174. package/dist/vault/vault.js +21 -12
  175. package/dist/vault/vault.js.map +1 -1
  176. package/package.json +6 -4
  177. package/src/__tests__/curator-pipeline-e2e.test.ts +187 -0
  178. package/src/__tests__/module-manifest-drift.test.ts +59 -0
  179. package/src/brain/brain.ts +4 -157
  180. package/src/brain/knowledge-synthesizer.ts +0 -2
  181. package/src/context/context-engine.ts +3 -31
  182. package/src/curator/classifier.ts +0 -2
  183. package/src/curator/curator.ts +5 -28
  184. package/src/curator/quality-gate.ts +0 -2
  185. package/src/domain-packs/index.ts +0 -6
  186. package/src/domain-packs/loader.ts +25 -5
  187. package/src/domain-packs/pack-runtime.ts +6 -6
  188. package/src/domain-packs/types.ts +8 -2
  189. package/src/engine/bin/soleri-engine.ts +23 -7
  190. package/src/engine/core-ops.ts +11 -6
  191. package/src/engine/index.ts +2 -0
  192. package/src/engine/module-manifest.ts +99 -0
  193. package/src/engine/register-engine.ts +21 -9
  194. package/src/index.ts +20 -17
  195. package/src/intake/content-classifier.ts +0 -2
  196. package/src/intelligence/types.ts +8 -0
  197. package/src/llm/llm-client.ts +12 -6
  198. package/src/llm/oauth-discovery.ts +0 -18
  199. package/src/llm/types.ts +4 -2
  200. package/src/packs/pack-installer.ts +16 -1
  201. package/src/persistence/index.ts +0 -1
  202. package/src/persistence/types.ts +2 -6
  203. package/src/persona/defaults.ts +96 -0
  204. package/src/persona/index.ts +9 -0
  205. package/src/persona/loader.ts +50 -0
  206. package/src/persona/prompt-generator.ts +109 -0
  207. package/src/persona/types.ts +72 -0
  208. package/src/plugins/index.ts +4 -0
  209. package/src/plugins/plugin-registry.ts +6 -1
  210. package/src/plugins/types.ts +10 -5
  211. package/src/runtime/admin-extra-ops.ts +5 -28
  212. package/src/runtime/admin-ops.ts +5 -38
  213. package/src/runtime/capture-ops.ts +33 -14
  214. package/src/runtime/claude-md-helpers.ts +1 -19
  215. package/src/runtime/facades/admin-facade.ts +1 -2
  216. package/src/runtime/facades/index.ts +1 -11
  217. package/src/runtime/pack-ops.ts +26 -1
  218. package/src/runtime/plugin-ops.ts +3 -0
  219. package/src/runtime/runtime.ts +14 -54
  220. package/src/runtime/session-briefing.ts +14 -0
  221. package/src/runtime/types.ts +6 -8
  222. package/src/runtime/vault-linking-ops.ts +43 -4
  223. package/src/runtime/vault-sharing-ops.ts +63 -4
  224. package/src/vault/linking.ts +94 -0
  225. package/src/vault/vault.ts +24 -12
  226. package/src/__tests__/cognee-client-gaps.test.ts +0 -474
  227. package/src/__tests__/cognee-client.test.ts +0 -524
  228. package/src/__tests__/cognee-hybrid-search.test.ts +0 -492
  229. package/src/__tests__/cognee-integration.test.ts +0 -80
  230. package/src/__tests__/cognee-sync-manager-deep.test.ts +0 -654
  231. package/src/__tests__/cognee-sync-manager.test.ts +0 -104
  232. package/src/__tests__/postgres-provider.test.ts +0 -116
  233. package/src/cognee/client.ts +0 -370
  234. package/src/cognee/sync-manager.ts +0 -389
  235. package/src/cognee/types.ts +0 -62
  236. package/src/health/doctor-checks.ts +0 -115
  237. package/src/persistence/postgres-provider.ts +0 -310
  238. package/src/runtime/cognee-sync-ops.ts +0 -63
  239. package/src/runtime/facades/cognee-facade.ts +0 -164
@@ -228,34 +228,52 @@ export function createCaptureOps(runtime: AgentRuntime): OpDefinition[] {
228
228
  }
229
229
  }
230
230
 
231
- // Auto-suggest links for captured entries (Zettelkasten enrichment)
232
- let suggestedLinks: Array<{
231
+ // Auto-link captured entries (Zettelkasten enrichment)
232
+ // Creates links for suggestions above threshold; returns remaining as suggestions
233
+ const AUTO_LINK_THRESHOLD = 0.7;
234
+ const AUTO_LINK_MAX = 3;
235
+ let autoLinkedCount = 0;
236
+ const suggestedLinks: Array<{
233
237
  entryId: string;
234
238
  title: string;
235
239
  suggestedType: string;
236
240
  score: number;
241
+ autoLinked: boolean;
237
242
  }> = [];
238
243
  try {
239
244
  if (captured > 0) {
240
- const firstCaptured = results.find((r) => r.action === 'capture');
241
- if (firstCaptured) {
242
- const { LinkManager } = await import('../vault/linking.js');
243
- const lm = new LinkManager(vault.getProvider());
244
- const suggestions = lm.suggestLinks(firstCaptured.id, 3);
245
- suggestedLinks = suggestions
246
- .filter(
247
- (s) => s.entryId !== firstCaptured.id && !s.entryId.endsWith(firstCaptured.id),
248
- )
249
- .map((s) => ({
245
+ const { LinkManager } = await import('../vault/linking.js');
246
+ const lm = new LinkManager(vault.getProvider());
247
+
248
+ // Process ALL captured entries, not just the first
249
+ const capturedEntries = results.filter((r) => r.action === 'capture');
250
+ for (const capturedEntry of capturedEntries) {
251
+ const suggestions = lm.suggestLinks(capturedEntry.id, AUTO_LINK_MAX + 2);
252
+ const filtered = suggestions.filter(
253
+ (s) => s.entryId !== capturedEntry.id && !s.entryId.endsWith(capturedEntry.id),
254
+ );
255
+
256
+ let linkedForThisEntry = 0;
257
+ for (const s of filtered) {
258
+ const aboveThreshold = s.score >= AUTO_LINK_THRESHOLD;
259
+ const canAutoLink = aboveThreshold && linkedForThisEntry < AUTO_LINK_MAX;
260
+ if (canAutoLink) {
261
+ lm.addLink(capturedEntry.id, s.entryId, s.suggestedType);
262
+ linkedForThisEntry++;
263
+ autoLinkedCount++;
264
+ }
265
+ suggestedLinks.push({
250
266
  entryId: s.entryId,
251
267
  title: s.title,
252
268
  suggestedType: s.suggestedType,
253
269
  score: s.score,
254
- }));
270
+ autoLinked: canAutoLink,
271
+ });
272
+ }
255
273
  }
256
274
  }
257
275
  } catch {
258
- /* never break capture for suggestions */
276
+ /* never break capture for linking failures */
259
277
  }
260
278
 
261
279
  return {
@@ -263,6 +281,7 @@ export function createCaptureOps(runtime: AgentRuntime): OpDefinition[] {
263
281
  proposed,
264
282
  rejected,
265
283
  duplicated,
284
+ autoLinkedCount,
266
285
  results,
267
286
  ...(suggestedLinks.length > 0 ? { suggestedLinks } : {}),
268
287
  };
@@ -9,7 +9,6 @@
9
9
  */
10
10
 
11
11
  import type { AgentRuntimeConfig } from './types.js';
12
- import type { OpDefinition } from '../facades/types.js';
13
12
 
14
13
  // ─── Types ────────────────────────────────────────────────────────────
15
14
 
@@ -198,7 +197,7 @@ const ENGINE_RULES_END = '<!-- /soleri:engine-rules -->';
198
197
  /**
199
198
  * Check if engine rules are present in content.
200
199
  */
201
- export function hasEngineRules(content: string): boolean {
200
+ function hasEngineRules(content: string): boolean {
202
201
  return content.includes(ENGINE_RULES_START) && content.includes(ENGINE_RULES_END);
203
202
  }
204
203
 
@@ -217,20 +216,3 @@ export function injectEngineRulesBlock(content: string, engineRulesContent: stri
217
216
  // Append
218
217
  return content.trimEnd() + '\n\n' + engineRulesContent + '\n';
219
218
  }
220
-
221
- /**
222
- * Extract facade summaries from an ops array (for tools table generation).
223
- */
224
- export function extractFacadeSummaries(
225
- agentId: string,
226
- opsMap: Map<string, OpDefinition[]>,
227
- ): FacadeSummary[] {
228
- const summaries: FacadeSummary[] = [];
229
- for (const [suffix, ops] of opsMap) {
230
- summaries.push({
231
- name: `${agentId}_${suffix}`,
232
- ops: ops.map((o) => o.name),
233
- });
234
- }
235
- return summaries;
236
- }
@@ -58,8 +58,7 @@ export function createAdminFacadeOps(runtime: AgentRuntime): OpDefinition[] {
58
58
  }),
59
59
  handler: async (params) => {
60
60
  return llmClient.complete({
61
- provider: 'openai',
62
- model: (params.model as string) ?? '',
61
+ model: (params.model as string) || undefined,
63
62
  systemPrompt: params.systemPrompt as string,
64
63
  userPrompt: params.userPrompt as string,
65
64
  temperature: params.temperature as number | undefined,
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Semantic facade assembler — creates 10 domain-specific facades
2
+ * Semantic facade assembler — creates domain-specific facades
3
3
  * matching Salvador's engine-level architecture.
4
4
  *
5
5
  * Each facade becomes its own MCP tool with op dispatch.
@@ -16,7 +16,6 @@ import { createCuratorFacadeOps } from './curator-facade.js';
16
16
  import { createLoopFacadeOps } from './loop-facade.js';
17
17
  import { createOrchestrateFacadeOps } from './orchestrate-facade.js';
18
18
  import { createControlFacadeOps } from './control-facade.js';
19
- import { createCogneeFacadeOps } from './cognee-facade.js';
20
19
  import { createContextFacadeOps } from './context-facade.js';
21
20
  import { createAgencyFacadeOps } from './agency-facade.js';
22
21
  import { createChatFacadeOps } from './chat-facade.js';
@@ -88,14 +87,5 @@ export function createSemanticFacades(runtime: AgentRuntime, agentId: string): F
88
87
  },
89
88
  ];
90
89
 
91
- // Cognee facade — only registered when Cognee integration is enabled
92
- if (runtime.cognee) {
93
- facades.push({
94
- name: `${agentId}_cognee`,
95
- description: 'Knowledge graph — Cognee search, sync, export, graph stats.',
96
- ops: createCogneeFacadeOps(runtime),
97
- });
98
- }
99
-
100
90
  return facades;
101
91
  }
@@ -8,6 +8,16 @@ import { z } from 'zod';
8
8
  import type { OpDefinition } from '../facades/types.js';
9
9
  import type { AgentRuntime } from './types.js';
10
10
 
11
+ export type HotRegisterTool = (toolName: string, description: string, ops: OpDefinition[]) => void;
12
+
13
+ /** Mutable slot — set after engine registration to enable hot reload. */
14
+ let _hotRegister: HotRegisterTool | null = null;
15
+
16
+ /** Set the hot-register callback after registerEngine() completes. */
17
+ export function setHotRegister(fn: HotRegisterTool): void {
18
+ _hotRegister = fn;
19
+ }
20
+
11
21
  export function createPackOps(runtime: AgentRuntime): OpDefinition[] {
12
22
  const { packInstaller } = runtime;
13
23
 
@@ -36,7 +46,22 @@ export function createPackOps(runtime: AgentRuntime): OpDefinition[] {
36
46
  packDir: z.string().describe('Path to the knowledge pack directory.'),
37
47
  }),
38
48
  handler: async (params) => {
39
- return packInstaller.install(params.packDir as string, runtime);
49
+ const result = await packInstaller.install(params.packDir as string, runtime);
50
+ // Hot register facades as MCP tools if callback available
51
+ if (_hotRegister && result.installed && result.facades > 0) {
52
+ const plugin = runtime.pluginRegistry.get(result.id);
53
+ if (plugin?.facades) {
54
+ for (const facade of plugin.facades) {
55
+ _hotRegister(
56
+ `${runtime.config.agentId}_${facade.name}`,
57
+ facade.description,
58
+ facade.ops,
59
+ );
60
+ }
61
+ }
62
+ (result as unknown as Record<string, unknown>).hotReloaded = true;
63
+ }
64
+ return result;
40
65
  },
41
66
  },
42
67
 
@@ -8,6 +8,7 @@ import { z } from 'zod';
8
8
  import type { OpDefinition } from '../facades/types.js';
9
9
  import type { AgentRuntime } from './types.js';
10
10
  import { loadPlugins, validateDependencies, sortByDependencies } from '../plugins/index.js';
11
+ import { createPackRuntime } from '../domain-packs/pack-runtime.js';
11
12
 
12
13
  export function createPluginOps(runtime: AgentRuntime, opSink?: OpDefinition[]): OpDefinition[] {
13
14
  const { pluginRegistry, config } = runtime;
@@ -157,6 +158,7 @@ export function createPluginOps(runtime: AgentRuntime, opSink?: OpDefinition[]):
157
158
  if (!plugin) return { error: `Plugin not found: ${pluginId}` };
158
159
 
159
160
  const result = await pluginRegistry.activate(pluginId, {
161
+ packRuntime: createPackRuntime(runtime),
160
162
  runtime,
161
163
  manifest: plugin.manifest,
162
164
  directory: plugin.directory,
@@ -179,6 +181,7 @@ export function createPluginOps(runtime: AgentRuntime, opSink?: OpDefinition[]):
179
181
  const results = await Promise.all(
180
182
  pending.map(async (plugin) => {
181
183
  const activated = await pluginRegistry.activate(plugin.id, {
184
+ packRuntime: createPackRuntime(runtime),
182
185
  runtime,
183
186
  manifest: plugin.manifest,
184
187
  directory: plugin.directory,
@@ -14,7 +14,6 @@ import { BrainIntelligence } from '../brain/intelligence.js';
14
14
  import { Planner } from '../planning/planner.js';
15
15
  import { Curator } from '../curator/curator.js';
16
16
  import { Governance } from '../governance/governance.js';
17
- import { CogneeClient } from '../cognee/client.js';
18
17
  import { LoopManager } from '../loop/loop-manager.js';
19
18
  import { IdentityManager } from '../control/identity-manager.js';
20
19
  import { IntentRouter } from '../control/intent-router.js';
@@ -22,7 +21,6 @@ import { KeyPool, loadKeyPoolConfig } from '../llm/key-pool.js';
22
21
  import { discoverAnthropicToken } from '../llm/oauth-discovery.js';
23
22
  import { loadIntelligenceData } from '../intelligence/loader.js';
24
23
  import { LLMClient } from '../llm/llm-client.js';
25
- import { CogneeSyncManager } from '../cognee/sync-manager.js';
26
24
  import { IntakePipeline } from '../intake/intake-pipeline.js';
27
25
  import { TextIngester } from '../intake/text-ingester.js';
28
26
  import { Telemetry } from '../telemetry/telemetry.js';
@@ -50,6 +48,8 @@ import { PipelineRunner } from '../queue/pipeline-runner.js';
50
48
  import { evaluateQuality } from '../curator/quality-gate.js';
51
49
  import { classifyEntry } from '../curator/classifier.js';
52
50
  import type { AgentRuntimeConfig, AgentRuntime } from './types.js';
51
+ import { loadPersona } from '../persona/loader.js';
52
+ import { generatePersonaInstructions } from '../persona/prompt-generator.js';
53
53
 
54
54
  /**
55
55
  * Create a fully initialized agent runtime.
@@ -95,25 +95,15 @@ export function createAgentRuntime(config: AgentRuntimeConfig): AgentRuntime {
95
95
  // Planner — multi-step task tracking
96
96
  const planner = new Planner(plansPath);
97
97
 
98
- // Cognee — vector search client (opt-in, graceful degradation if Cognee is down)
99
- let cognee: CogneeClient | null = null;
100
- if (config.cognee) {
101
- const cogneePartial: Partial<import('../cognee/types.js').CogneeConfig> = { dataset: agentId };
102
- if (process.env.COGNEE_BASE_URL) cogneePartial.baseUrl = process.env.COGNEE_BASE_URL;
103
- if (process.env.COGNEE_API_TOKEN) cogneePartial.apiToken = process.env.COGNEE_API_TOKEN;
104
- if (process.env.COGNEE_DATASET) cogneePartial.dataset = process.env.COGNEE_DATASET;
105
- cognee = new CogneeClient(cogneePartial);
106
- }
107
-
108
98
  // Brain — intelligence layer (TF-IDF scoring, auto-tagging, dedup)
109
99
  // Pass vaultManager so intelligentSearch queries all connected sources (not just agent tier)
110
- const brain = new Brain(vault, cognee ?? undefined, vaultManager);
100
+ const brain = new Brain(vault, vaultManager);
111
101
 
112
102
  // Brain Intelligence — pattern strengths, session knowledge, intelligence pipeline
113
103
  const brainIntelligence = new BrainIntelligence(vault, brain);
114
104
 
115
105
  // Curator — vault self-maintenance (dedup, contradictions, grooming, health)
116
- const curator = new Curator(vault, cognee ?? undefined);
106
+ const curator = new Curator(vault);
117
107
 
118
108
  // Governance — policy engine + proposal tracker for gated knowledge capture
119
109
  const governance = new Governance(vault);
@@ -152,17 +142,6 @@ export function createAgentRuntime(config: AgentRuntimeConfig): AgentRuntime {
152
142
  const anthropicKeyPool = new KeyPool(anthropicConfig);
153
143
  const llmClient = new LLMClient(openaiKeyPool, anthropicKeyPool, agentId);
154
144
 
155
- // Cognee Sync Manager — queue-based dirty tracking with offline resilience (only when Cognee enabled)
156
- let syncManager: CogneeSyncManager | null = null;
157
- if (cognee) {
158
- syncManager = new CogneeSyncManager(
159
- vault.getProvider(),
160
- cognee,
161
- process.env.COGNEE_DATASET ?? agentId,
162
- );
163
- vault.setSyncManager(syncManager);
164
- }
165
-
166
145
  // Link Manager — Zettelkasten auto-linking on vault ingestion
167
146
  const linkManager = new LinkManager(vault.getProvider());
168
147
  vault.setLinkManager(linkManager, { enabled: true, maxLinks: 3 });
@@ -184,7 +163,7 @@ export function createAgentRuntime(config: AgentRuntimeConfig): AgentRuntime {
184
163
  const vaultBranching = new VaultBranching(vault);
185
164
 
186
165
  // Context Engine — entity extraction, knowledge retrieval, confidence scoring
187
- const contextEngine = new ContextEngine(vault, brain, brainIntelligence, cognee);
166
+ const contextEngine = new ContextEngine(vault, brain, brainIntelligence);
188
167
 
189
168
  // Agency Manager — proactive file watching, pattern surfacing (disabled by default)
190
169
  const agencyManager = new AgencyManager(vault);
@@ -196,10 +175,6 @@ export function createAgentRuntime(config: AgentRuntimeConfig): AgentRuntime {
196
175
  const health = new HealthRegistry();
197
176
  health.register('vault', 'healthy');
198
177
  health.register('brain', 'healthy');
199
- health.register(
200
- 'cognee',
201
- cognee ? (cognee.getStatus()?.available ? 'healthy' : 'degraded') : 'down',
202
- );
203
178
  health.register(
204
179
  'llm',
205
180
  llmClient.isAvailable().openai || llmClient.isAvailable().anthropic ? 'healthy' : 'degraded',
@@ -228,7 +203,6 @@ export function createAgentRuntime(config: AgentRuntimeConfig): AgentRuntime {
228
203
  planner,
229
204
  curator,
230
205
  governance,
231
- cognee,
232
206
  loop,
233
207
  identityManager,
234
208
  intentRouter,
@@ -237,7 +211,6 @@ export function createAgentRuntime(config: AgentRuntimeConfig): AgentRuntime {
237
211
  telemetry,
238
212
  projectRegistry,
239
213
  templateManager,
240
- syncManager,
241
214
  intakePipeline,
242
215
  textIngester,
243
216
  authPolicy: { mode: 'permissive', callerLevel: 'admin' },
@@ -335,26 +308,6 @@ export function createAgentRuntime(config: AgentRuntimeConfig): AgentRuntime {
335
308
  const result = curator.consolidate({ dryRun: false, staleDaysThreshold: 90 });
336
309
  return { archived: result.staleEntries.length, result };
337
310
  });
338
- pr.registerHandler('cognee-ingest', async (job) => {
339
- if (!cognee) return { skipped: true, reason: 'cognee not available' };
340
- const entry = vault.get(job.entryId ?? '');
341
- if (!entry) return { skipped: true, reason: 'entry not found' };
342
- try {
343
- const result = await cognee.addEntries([entry]);
344
- return { ingested: result.added };
345
- } catch {
346
- return { skipped: true, reason: 'cognee ingestion failed' };
347
- }
348
- });
349
- pr.registerHandler('cognee-cognify', async (_job) => {
350
- if (!cognee) return { skipped: true, reason: 'cognee not available' };
351
- try {
352
- const result = await cognee.cognify();
353
- return result;
354
- } catch {
355
- return { skipped: true, reason: 'cognee cognify failed' };
356
- }
357
- });
358
311
  pr.registerHandler('verify-searchable', async (job) => {
359
312
  const entry = vault.get(job.entryId ?? '');
360
313
  if (!entry) return { skipped: true, reason: 'entry not found' };
@@ -364,10 +317,17 @@ export function createAgentRuntime(config: AgentRuntimeConfig): AgentRuntime {
364
317
  });
365
318
  return pr;
366
319
  })(),
320
+ persona: (() => {
321
+ const p = loadPersona(agentId, config.persona ?? undefined);
322
+ logger.info(`[Persona] Loaded: ${p.name} (${p.template})`);
323
+ return p;
324
+ })(),
325
+ personaInstructions: (() => {
326
+ const p = loadPersona(agentId, config.persona ?? undefined);
327
+ return generatePersonaInstructions(p);
328
+ })(),
367
329
  createdAt: Date.now(),
368
330
  close: () => {
369
- syncManager?.close();
370
- cognee?.resetPendingCognify();
371
331
  vaultManager.close();
372
332
  },
373
333
  };
@@ -42,6 +42,20 @@ export function createSessionBriefingOps(runtime: AgentRuntime): OpDefinition[]
42
42
  const sections: BriefingSection[] = [];
43
43
  let dataPoints = 0;
44
44
 
45
+ // 0. Day-one welcome (vault has few non-playbook entries)
46
+ try {
47
+ const stats = vault.stats();
48
+ const nonPlaybook = stats.totalEntries - (stats.byType?.playbook ?? 0);
49
+ if (nonPlaybook < 10) {
50
+ sections.push({
51
+ label: 'Welcome',
52
+ content: `Vault has ${nonPlaybook} knowledge entries. Capture patterns as you work — the brain learns from every session. Use op:capture_knowledge to persist insights.`,
53
+ });
54
+ }
55
+ } catch {
56
+ // Vault stats unavailable — skip
57
+ }
58
+
45
59
  // 1. Last session
46
60
  try {
47
61
  const sessions = brainIntelligence.listSessions({ limit: 1, active: false });
@@ -4,7 +4,6 @@ import type { BrainIntelligence } from '../brain/intelligence.js';
4
4
  import type { Planner } from '../planning/planner.js';
5
5
  import type { Curator } from '../curator/curator.js';
6
6
  import type { Governance } from '../governance/governance.js';
7
- import type { CogneeClient } from '../cognee/client.js';
8
7
  import type { KeyPool } from '../llm/key-pool.js';
9
8
  import type { LLMClient } from '../llm/llm-client.js';
10
9
  import type { IdentityManager } from '../control/identity-manager.js';
@@ -13,7 +12,6 @@ import type { LoopManager } from '../loop/loop-manager.js';
13
12
  import type { Telemetry } from '../telemetry/telemetry.js';
14
13
  import type { ProjectRegistry } from '../project/project-registry.js';
15
14
  import type { TemplateManager } from '../prompts/template-manager.js';
16
- import type { CogneeSyncManager } from '../cognee/sync-manager.js';
17
15
  import type { IntakePipeline } from '../intake/intake-pipeline.js';
18
16
  import type { Logger } from '../logging/logger.js';
19
17
  import type { LogLevel } from '../logging/types.js';
@@ -55,10 +53,10 @@ export interface AgentRuntimeConfig {
55
53
  logLevel?: LogLevel;
56
54
  /** Path to shared global vault. Default: ~/.soleri/vault.db */
57
55
  sharedVaultPath?: string;
58
- /** Enable Cognee vector search integration. Default: false (opt-in). */
59
- cognee?: boolean;
60
56
  /** Path to the agent's root directory (containing agent.yaml, instructions/, etc.). Optional — set by engine binary. */
61
57
  agentDir?: string;
58
+ /** Persona configuration from agent.yaml. If omitted, Italian Craftsperson default is used. */
59
+ persona?: Partial<import('../persona/types.js').PersonaConfig>;
62
60
  }
63
61
 
64
62
  /**
@@ -74,8 +72,6 @@ export interface AgentRuntime {
74
72
  planner: Planner;
75
73
  curator: Curator;
76
74
  governance: Governance;
77
- /** Cognee vector search client. Null when Cognee integration is disabled. */
78
- cognee: CogneeClient | null;
79
75
  loop: LoopManager;
80
76
  identityManager: IdentityManager;
81
77
  intentRouter: IntentRouter;
@@ -84,8 +80,6 @@ export interface AgentRuntime {
84
80
  telemetry: Telemetry;
85
81
  projectRegistry: ProjectRegistry;
86
82
  templateManager: TemplateManager;
87
- /** Cognee sync manager. Null when Cognee integration is disabled. */
88
- syncManager: CogneeSyncManager | null;
89
83
  intakePipeline: IntakePipeline;
90
84
  /** Mutable auth policy — controls facade dispatch enforcement. */
91
85
  authPolicy: AuthPolicy;
@@ -123,6 +117,10 @@ export interface AgentRuntime {
123
117
  jobQueue: JobQueue;
124
118
  /** Pipeline runner — background polling loop for job execution. */
125
119
  pipelineRunner: PipelineRunner;
120
+ /** Agent persona — defines character, voice, and cultural texture. */
121
+ persona: import('../persona/types.js').PersonaConfig;
122
+ /** Generated persona system instructions for LLM context. */
123
+ personaInstructions: import('../persona/types.js').PersonaSystemInstructions;
126
124
  /** Timestamp (ms since epoch) when this runtime was created. */
127
125
  createdAt: number;
128
126
  /** Close the vault database connection. Call on shutdown. */
@@ -328,13 +328,11 @@ export function createVaultLinkingOps(runtime: AgentRuntime): OpDefinition[] {
328
328
 
329
329
  try {
330
330
  const result = await llmClient.complete({
331
- provider: llmClient.isAvailable().anthropic ? 'anthropic' : 'openai',
332
- model: llmClient.isAvailable().anthropic ? 'claude-sonnet-4-20250514' : 'gpt-4o-mini',
333
331
  systemPrompt: EVAL_SYSTEM_PROMPT,
334
332
  userPrompt: pairsText,
335
333
  maxTokens: 2000,
336
- caller: 'relink_vault',
337
- task: 'link-evaluation',
334
+ caller: 'vault-linking',
335
+ task: 'evaluate-links',
338
336
  });
339
337
  llmCalls++;
340
338
 
@@ -402,6 +400,47 @@ export function createVaultLinkingOps(runtime: AgentRuntime): OpDefinition[] {
402
400
  };
403
401
  },
404
402
  },
403
+ {
404
+ name: 'backfill_links',
405
+ description:
406
+ 'Generate Zettelkasten links for orphan entries using FTS5 suggestions. One-time backfill for vaults with entries but no links.',
407
+ auth: 'write',
408
+ schema: z.object({
409
+ threshold: z.coerce
410
+ .number()
411
+ .min(0)
412
+ .max(1)
413
+ .default(0.7)
414
+ .describe('Min suggestion score to create link (default: 0.7)'),
415
+ maxLinks: z.coerce
416
+ .number()
417
+ .int()
418
+ .min(1)
419
+ .max(10)
420
+ .default(3)
421
+ .describe('Max links per entry (default: 3)'),
422
+ dryRun: z.boolean().optional().default(false).describe('Preview without creating links'),
423
+ batchSize: z.coerce
424
+ .number()
425
+ .int()
426
+ .min(1)
427
+ .max(200)
428
+ .default(50)
429
+ .describe('Entries per batch (default: 50)'),
430
+ }),
431
+ handler: async (params) => {
432
+ const result = linkManager.backfillLinks({
433
+ threshold: params.threshold as number,
434
+ maxLinks: params.maxLinks as number,
435
+ dryRun: params.dryRun as boolean,
436
+ batchSize: params.batchSize as number,
437
+ });
438
+ return {
439
+ ...result,
440
+ ...(result.preview ? { previewSample: result.preview.slice(0, 20) } : {}),
441
+ };
442
+ },
443
+ },
405
444
  {
406
445
  name: 'link_stats',
407
446
  description:
@@ -13,7 +13,12 @@ import type { OpDefinition } from '../facades/types.js';
13
13
  import type { AgentRuntime } from './types.js';
14
14
  import { detectScope, type ScopeInput } from '../vault/scope-detector.js';
15
15
  import { GitVaultSync, type GitVaultSyncConfig } from '../vault/git-vault-sync.js';
16
- import type { IntelligenceEntry, IntelligenceBundle } from '../intelligence/types.js';
16
+ import type {
17
+ IntelligenceEntry,
18
+ IntelligenceBundle,
19
+ IntelligenceBundleLink,
20
+ } from '../intelligence/types.js';
21
+ import { LinkManager } from '../vault/linking.js';
17
22
 
18
23
  export function createVaultSharingOps(runtime: AgentRuntime): OpDefinition[] {
19
24
  const { vault, knowledgeReview } = runtime;
@@ -147,10 +152,38 @@ export function createVaultSharingOps(runtime: AgentRuntime): OpDefinition[] {
147
152
  byDomain.get(d)!.push(entry);
148
153
  }
149
154
 
155
+ // Collect links for exported entries (Zettelkasten edge export)
156
+ const entryIds = new Set(entries.map((e) => e.id));
157
+ const linkManager = new LinkManager(vault.getProvider());
158
+ const allLinks = linkManager.getAllLinksForEntries([...entryIds]);
159
+ // Only include links where BOTH endpoints are in the export set
160
+ const exportLinks = allLinks.filter(
161
+ (l) => entryIds.has(l.sourceId) && entryIds.has(l.targetId),
162
+ );
163
+
164
+ // Build a domain→links map (group by source entry's domain)
165
+ const entryDomainMap = new Map(entries.map((e) => [e.id, e.domain]));
166
+ const linksByDomain = new Map<string, IntelligenceBundleLink[]>();
167
+ for (const link of exportLinks) {
168
+ const linkDomain = entryDomainMap.get(link.sourceId) ?? 'unknown';
169
+ if (!linksByDomain.has(linkDomain)) linksByDomain.set(linkDomain, []);
170
+ linksByDomain.get(linkDomain)!.push({
171
+ sourceId: link.sourceId,
172
+ targetId: link.targetId,
173
+ linkType: link.linkType,
174
+ note: link.note,
175
+ });
176
+ }
177
+
150
178
  const version = (params.version as string) ?? '1.0.0';
151
179
  const bundles: IntelligenceBundle[] = [];
152
180
  for (const [d, domainEntries] of byDomain) {
153
- bundles.push({ domain: d, version, entries: domainEntries });
181
+ bundles.push({
182
+ domain: d,
183
+ version,
184
+ entries: domainEntries,
185
+ links: linksByDomain.get(d) ?? [],
186
+ });
154
187
  }
155
188
 
156
189
  return {
@@ -158,6 +191,7 @@ export function createVaultSharingOps(runtime: AgentRuntime): OpDefinition[] {
158
191
  version,
159
192
  bundles,
160
193
  totalEntries: entries.length,
194
+ totalLinks: exportLinks.length,
161
195
  domains: [...byDomain.keys()],
162
196
  };
163
197
  },
@@ -187,10 +221,17 @@ export function createVaultSharingOps(runtime: AgentRuntime): OpDefinition[] {
187
221
  domain: string;
188
222
  version: string;
189
223
  entries: IntelligenceEntry[];
224
+ links?: IntelligenceBundleLink[];
190
225
  }>;
191
226
  const forceTier = params.tier as 'agent' | 'project' | 'team' | undefined;
192
227
  let imported = 0;
193
228
  let duplicates = 0;
229
+ let linksCreated = 0;
230
+ let linksSkipped = 0;
231
+
232
+ // Track ID remapping: bundle entry ID → actual vault entry ID
233
+ const idRemap = new Map<string, string>();
234
+ const linkManager = new LinkManager(vault.getProvider());
194
235
 
195
236
  for (const bundle of bundles) {
196
237
  const entries = bundle.entries.map((e) => ({
@@ -198,13 +239,31 @@ export function createVaultSharingOps(runtime: AgentRuntime): OpDefinition[] {
198
239
  tier: forceTier ?? e.tier ?? 'project',
199
240
  }));
200
241
  const results = vault.seedDedup(entries);
201
- for (const r of results) {
242
+ for (let i = 0; i < results.length; i++) {
243
+ const r = results[i];
244
+ const originalId = bundle.entries[i].id;
245
+ // For duplicates, map to the existing vault entry; for inserts, keep original ID
246
+ idRemap.set(originalId, r.existingId ?? r.id);
202
247
  if (r.action === 'inserted') imported++;
203
248
  else duplicates++;
204
249
  }
250
+
251
+ // Import links if present
252
+ if (bundle.links && bundle.links.length > 0) {
253
+ for (const link of bundle.links) {
254
+ const sourceId = idRemap.get(link.sourceId);
255
+ const targetId = idRemap.get(link.targetId);
256
+ if (sourceId && targetId) {
257
+ linkManager.addLink(sourceId, targetId, link.linkType, link.note);
258
+ linksCreated++;
259
+ } else {
260
+ linksSkipped++;
261
+ }
262
+ }
263
+ }
205
264
  }
206
265
 
207
- return { imported, duplicates, total: imported + duplicates };
266
+ return { imported, duplicates, linksCreated, linksSkipped, total: imported + duplicates };
208
267
  },
209
268
  },
210
269