kongbrain 0.1.0 → 0.1.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kongbrain",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Graph-backed persistent memory engine for OpenClaw. Replaces the default context window with SurrealDB + vector embeddings that learn across sessions.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -53,7 +53,7 @@ export class KongBrainContextEngine implements ContextEngine {
53
53
  readonly info: ContextEngineInfo = {
54
54
  id: "kongbrain",
55
55
  name: "KongBrain",
56
- version: "0.1.0",
56
+ version: "0.1.1",
57
57
  ownsCompaction: true,
58
58
  };
59
59
 
@@ -227,10 +227,9 @@ export class KongBrainContextEngine implements ContextEngine {
227
227
 
228
228
  try {
229
229
  const role = (msg as any).role as string;
230
- console.log(`[kongbrain:ingest] role=${role} sessionId=${params.sessionId}`);
231
230
  if (role === "user" || role === "assistant") {
232
231
  const text = extractMessageText(msg);
233
- if (!text) { console.log("[kongbrain:ingest] empty text, skipping"); return { ingested: false }; }
232
+ if (!text) return { ingested: false };
234
233
 
235
234
  const worthEmbedding = hasSemantic(text);
236
235
  let embedding: number[] | null = null;
@@ -248,7 +247,6 @@ export class KongBrainContextEngine implements ContextEngine {
248
247
  embedding,
249
248
  });
250
249
 
251
- console.log(`[kongbrain:ingest] turnId=${turnId} role=${role} textLen=${text.length}`);
252
250
  if (turnId) {
253
251
  await store.relate(turnId, "part_of", session.sessionId)
254
252
  .catch(e => swallow.warn("ingest:relate", e));
package/src/index.ts CHANGED
@@ -291,6 +291,11 @@ export default definePluginEntry({
291
291
  logger.warn(`Embeddings init failed — running in degraded mode: ${e}`);
292
292
  }
293
293
 
294
+ // Seed identity chunks (idempotent, requires embeddings ready)
295
+ seedIdentity(store, embeddings)
296
+ .then(n => { if (n > 0) logger.info(`Seeded ${n} identity chunks`); })
297
+ .catch(e => swallow.warn("factory:seedIdentity", e));
298
+
294
299
  return new KongBrainContextEngine(globalState!);
295
300
  });
296
301
 
@@ -338,10 +343,6 @@ export default definePluginEntry({
338
343
  swallow.warn("index:startDaemon", e);
339
344
  }
340
345
 
341
- // Seed identity chunks (idempotent — skips if already seeded)
342
- seedIdentity(store, embeddings)
343
- .catch(e => swallow.warn("index:seedIdentity", e));
344
-
345
346
  // Check for workspace .md files from the default context engine
346
347
  if (globalState!.workspaceDir) {
347
348
  hasMigratableFiles(globalState!.workspaceDir)
@@ -362,26 +363,18 @@ export default definePluginEntry({
362
363
 
363
364
  // Synthesize wakeup briefing (background, non-blocking)
364
365
  // The briefing is stored and later injected via assemble()'s systemPromptAddition
365
- console.log("[kongbrain:wakeup] starting synthesis...");
366
366
  synthesizeWakeup(store, globalState!.complete, session.sessionId)
367
367
  .then(briefing => {
368
- console.log(`[kongbrain:wakeup] result: ${briefing ? briefing.length + " chars" : "null (no prior state)"}`);
369
- if (briefing) {
370
- (session as any)._wakeupBriefing = briefing;
371
- }
368
+ if (briefing) (session as any)._wakeupBriefing = briefing;
372
369
  })
373
- .catch(e => { console.error("[kongbrain:wakeup] FAILED:", e); swallow.warn("index:wakeup", e); });
370
+ .catch(e => swallow.warn("index:wakeup", e));
374
371
 
375
372
  // Startup cognition (background)
376
- console.log("[kongbrain:cognition] starting synthesis...");
377
373
  synthesizeStartupCognition(store, globalState!.complete)
378
374
  .then(cognition => {
379
- console.log(`[kongbrain:cognition] result: ${cognition ? JSON.stringify(cognition).slice(0, 200) : "null"}`);
380
- if (cognition) {
381
- (session as any)._startupCognition = cognition;
382
- }
375
+ if (cognition) (session as any)._startupCognition = cognition;
383
376
  })
384
- .catch(e => { console.error("[kongbrain:cognition] FAILED:", e); swallow.warn("index:startupCognition", e); });
377
+ .catch(e => swallow.warn("index:startupCognition", e));
385
378
  });
386
379
 
387
380
  api.on("session_end", async (event) => {