@askexenow/exe-os 0.9.63 → 0.9.64

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.
@@ -6934,15 +6934,15 @@ var init_task_scope = __esm({
6934
6934
 
6935
6935
  // src/lib/keychain.ts
6936
6936
  import { readFile as readFile4, writeFile as writeFile5, unlink, mkdir as mkdir4, chmod as chmod2 } from "fs/promises";
6937
- import { existsSync as existsSync18 } from "fs";
6937
+ import { existsSync as existsSync17 } from "fs";
6938
6938
  import { execSync as execSync8 } from "child_process";
6939
- import path22 from "path";
6939
+ import path21 from "path";
6940
6940
  import os13 from "os";
6941
6941
  function getKeyDir() {
6942
- return process.env.EXE_OS_DIR ?? process.env.EXE_MEM_DIR ?? path22.join(os13.homedir(), ".exe-os");
6942
+ return process.env.EXE_OS_DIR ?? process.env.EXE_MEM_DIR ?? path21.join(os13.homedir(), ".exe-os");
6943
6943
  }
6944
6944
  function getKeyPath() {
6945
- return path22.join(getKeyDir(), "master.key");
6945
+ return path21.join(getKeyDir(), "master.key");
6946
6946
  }
6947
6947
  function macKeychainGet() {
6948
6948
  if (process.platform !== "darwin") return null;
@@ -7090,7 +7090,7 @@ async function getMasterKey() {
7090
7090
  }
7091
7091
  }
7092
7092
  const keyPath = getKeyPath();
7093
- if (!existsSync18(keyPath)) {
7093
+ if (!existsSync17(keyPath)) {
7094
7094
  process.stderr.write(
7095
7095
  `[keychain] Key not found at ${keyPath} (HOME=${os13.homedir()}, EXE_OS_DIR=${process.env.EXE_OS_DIR ?? "unset"})
7096
7096
  `
@@ -7364,12 +7364,12 @@ __export(shard_manager_exports, {
7364
7364
  listShards: () => listShards,
7365
7365
  shardExists: () => shardExists
7366
7366
  });
7367
- import path23 from "path";
7368
- import { existsSync as existsSync19, mkdirSync as mkdirSync10, readdirSync as readdirSync5, renameSync as renameSync5, statSync as statSync3 } from "fs";
7367
+ import path22 from "path";
7368
+ import { existsSync as existsSync18, mkdirSync as mkdirSync10, readdirSync as readdirSync5, renameSync as renameSync4, statSync as statSync2 } from "fs";
7369
7369
  import { createClient as createClient2 } from "@libsql/client";
7370
7370
  function initShardManager(encryptionKey) {
7371
7371
  _encryptionKey = encryptionKey;
7372
- if (!existsSync19(SHARDS_DIR)) {
7372
+ if (!existsSync18(SHARDS_DIR)) {
7373
7373
  mkdirSync10(SHARDS_DIR, { recursive: true });
7374
7374
  }
7375
7375
  _shardingEnabled = true;
@@ -7399,7 +7399,7 @@ function getShardClient(projectName) {
7399
7399
  while (_shards.size >= MAX_OPEN_SHARDS) {
7400
7400
  evictLRU();
7401
7401
  }
7402
- const dbPath = path23.join(SHARDS_DIR, `${safeName}.db`);
7402
+ const dbPath = path22.join(SHARDS_DIR, `${safeName}.db`);
7403
7403
  const client = createClient2({
7404
7404
  url: `file:${dbPath}`,
7405
7405
  encryptionKey: _encryptionKey
@@ -7410,13 +7410,13 @@ function getShardClient(projectName) {
7410
7410
  }
7411
7411
  function shardExists(projectName) {
7412
7412
  const safeName = safeShardName(projectName);
7413
- return existsSync19(path23.join(SHARDS_DIR, `${safeName}.db`));
7413
+ return existsSync18(path22.join(SHARDS_DIR, `${safeName}.db`));
7414
7414
  }
7415
7415
  function safeShardName(projectName) {
7416
7416
  return projectName.replace(/[^a-zA-Z0-9_-]/g, "_");
7417
7417
  }
7418
7418
  function listShards() {
7419
- if (!existsSync19(SHARDS_DIR)) return [];
7419
+ if (!existsSync18(SHARDS_DIR)) return [];
7420
7420
  return readdirSync5(SHARDS_DIR).filter((f) => f.endsWith(".db")).map((f) => f.replace(".db", ""));
7421
7421
  }
7422
7422
  async function auditShardHealth(options = {}) {
@@ -7428,8 +7428,8 @@ async function auditShardHealth(options = {}) {
7428
7428
  const names = listShards();
7429
7429
  const shards = [];
7430
7430
  for (const name of names) {
7431
- const dbPath = path23.join(SHARDS_DIR, `${name}.db`);
7432
- const stat = statSync3(dbPath);
7431
+ const dbPath = path22.join(SHARDS_DIR, `${name}.db`);
7432
+ const stat = statSync2(dbPath);
7433
7433
  const item = {
7434
7434
  name,
7435
7435
  path: dbPath,
@@ -7463,8 +7463,8 @@ async function auditShardHealth(options = {}) {
7463
7463
  _shards.delete(name);
7464
7464
  _shardLastAccess.delete(name);
7465
7465
  const stamp = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
7466
- const archivedPath = path23.join(SHARDS_DIR, `${name}.db.broken-${stamp}`);
7467
- renameSync5(dbPath, archivedPath);
7466
+ const archivedPath = path22.join(SHARDS_DIR, `${name}.db.broken-${stamp}`);
7467
+ renameSync4(dbPath, archivedPath);
7468
7468
  item.archivedPath = archivedPath;
7469
7469
  }
7470
7470
  } finally {
@@ -7680,12 +7680,12 @@ async function getReadyShardClient(projectName) {
7680
7680
  client.close();
7681
7681
  _shards.delete(safeName);
7682
7682
  _shardLastAccess.delete(safeName);
7683
- const dbPath = path23.join(SHARDS_DIR, `${safeName}.db`);
7684
- if (existsSync19(dbPath)) {
7685
- const stat = statSync3(dbPath);
7683
+ const dbPath = path22.join(SHARDS_DIR, `${safeName}.db`);
7684
+ if (existsSync18(dbPath)) {
7685
+ const stat = statSync2(dbPath);
7686
7686
  const stamp = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
7687
- const archivedPath = path23.join(SHARDS_DIR, `${safeName}.db.broken-${stamp}`);
7688
- renameSync5(dbPath, archivedPath);
7687
+ const archivedPath = path22.join(SHARDS_DIR, `${safeName}.db.broken-${stamp}`);
7688
+ renameSync4(dbPath, archivedPath);
7689
7689
  process.stderr.write(
7690
7690
  `[shard-manager] Archived unreadable shard ${safeName}: ${archivedPath} (${stat.size} bytes, mtime ${stat.mtime.toISOString()})
7691
7691
  `
@@ -7752,7 +7752,7 @@ var init_shard_manager = __esm({
7752
7752
  "src/lib/shard-manager.ts"() {
7753
7753
  "use strict";
7754
7754
  init_config();
7755
- SHARDS_DIR = path23.join(EXE_AI_DIR, "shards");
7755
+ SHARDS_DIR = path22.join(EXE_AI_DIR, "shards");
7756
7756
  SHARD_IDLE_MS = 5 * 60 * 1e3;
7757
7757
  MAX_OPEN_SHARDS = 10;
7758
7758
  EVICTION_INTERVAL_MS = 60 * 1e3;
@@ -8867,6 +8867,78 @@ var init_fast_db_init = __esm({
8867
8867
  }
8868
8868
  });
8869
8869
 
8870
+ // src/lib/memory-queue.ts
8871
+ import { appendFileSync as appendFileSync2, readFileSync as readFileSync15, renameSync as renameSync5, unlinkSync as unlinkSync9, existsSync as existsSync19, statSync as statSync3 } from "fs";
8872
+ import path23 from "path";
8873
+ function enqueueMemory(entry) {
8874
+ appendFileSync2(QUEUE_PATH2, JSON.stringify(entry) + "\n");
8875
+ }
8876
+ var QUEUE_PATH2, PROCESSING_PATH, TTL_MS2;
8877
+ var init_memory_queue = __esm({
8878
+ "src/lib/memory-queue.ts"() {
8879
+ "use strict";
8880
+ init_config();
8881
+ QUEUE_PATH2 = path23.join(EXE_AI_DIR, "memory-queue.jsonl");
8882
+ PROCESSING_PATH = QUEUE_PATH2 + ".processing";
8883
+ TTL_MS2 = 24 * 60 * 60 * 1e3;
8884
+ }
8885
+ });
8886
+
8887
+ // src/lib/memory-queue-client.ts
8888
+ var memory_queue_client_exports = {};
8889
+ __export(memory_queue_client_exports, {
8890
+ batchWriteMemoryViaDaemon: () => batchWriteMemoryViaDaemon,
8891
+ writeMemoryViaDaemon: () => writeMemoryViaDaemon
8892
+ });
8893
+ async function writeMemoryViaDaemon(entry) {
8894
+ if (process.env.EXE_IS_DAEMON === "1") {
8895
+ enqueueMemory(entry);
8896
+ return false;
8897
+ }
8898
+ if (!isClientConnected()) {
8899
+ enqueueMemory(entry);
8900
+ return false;
8901
+ }
8902
+ try {
8903
+ const response = await sendDaemonRequest({
8904
+ type: "write-memory",
8905
+ entry
8906
+ });
8907
+ if (response.ok) return true;
8908
+ enqueueMemory(entry);
8909
+ return false;
8910
+ } catch {
8911
+ enqueueMemory(entry);
8912
+ return false;
8913
+ }
8914
+ }
8915
+ async function batchWriteMemoryViaDaemon(entries) {
8916
+ if (entries.length === 0) return 0;
8917
+ if (process.env.EXE_IS_DAEMON === "1" || !isClientConnected()) {
8918
+ for (const entry of entries) enqueueMemory(entry);
8919
+ return 0;
8920
+ }
8921
+ try {
8922
+ const response = await sendDaemonRequest({
8923
+ type: "batch-write-memory",
8924
+ entries
8925
+ });
8926
+ if (response.ok) return response.count ?? entries.length;
8927
+ for (const entry of entries) enqueueMemory(entry);
8928
+ return 0;
8929
+ } catch {
8930
+ for (const entry of entries) enqueueMemory(entry);
8931
+ return 0;
8932
+ }
8933
+ }
8934
+ var init_memory_queue_client = __esm({
8935
+ "src/lib/memory-queue-client.ts"() {
8936
+ "use strict";
8937
+ init_exe_daemon_client();
8938
+ init_memory_queue();
8939
+ }
8940
+ });
8941
+
8870
8942
  // src/lib/git-staleness.ts
8871
8943
  var git_staleness_exports = {};
8872
8944
  __export(git_staleness_exports, {
@@ -9414,119 +9486,6 @@ function buildAutoCheckpoint(input2) {
9414
9486
  };
9415
9487
  }
9416
9488
 
9417
- // src/lib/memory-queue-client.ts
9418
- init_exe_daemon_client();
9419
-
9420
- // src/lib/memory-queue.ts
9421
- init_config();
9422
- import { appendFileSync as appendFileSync2, readFileSync as readFileSync15, renameSync as renameSync4, unlinkSync as unlinkSync9, existsSync as existsSync17, statSync as statSync2 } from "fs";
9423
- import path21 from "path";
9424
- var QUEUE_PATH2 = path21.join(EXE_AI_DIR, "memory-queue.jsonl");
9425
- var PROCESSING_PATH = QUEUE_PATH2 + ".processing";
9426
- var TTL_MS2 = 24 * 60 * 60 * 1e3;
9427
- function enqueueMemory(entry) {
9428
- appendFileSync2(QUEUE_PATH2, JSON.stringify(entry) + "\n");
9429
- }
9430
-
9431
- // src/lib/memory-queue-client.ts
9432
- async function writeMemoryViaDaemon(entry) {
9433
- if (process.env.EXE_IS_DAEMON === "1") {
9434
- enqueueMemory(entry);
9435
- return false;
9436
- }
9437
- if (!isClientConnected()) {
9438
- enqueueMemory(entry);
9439
- return false;
9440
- }
9441
- try {
9442
- const response = await sendDaemonRequest({
9443
- type: "write-memory",
9444
- entry
9445
- });
9446
- if (response.ok) return true;
9447
- enqueueMemory(entry);
9448
- return false;
9449
- } catch {
9450
- enqueueMemory(entry);
9451
- return false;
9452
- }
9453
- }
9454
-
9455
- // src/lib/checkpoint-orchestrator.ts
9456
- function toolNameForReason(reason) {
9457
- switch (reason) {
9458
- case "periodic":
9459
- return "auto-summary";
9460
- case "session-end":
9461
- return "SessionEnd";
9462
- case "pre-compact":
9463
- return "pre-compact-hook";
9464
- case "capacity-signal":
9465
- return "auto-checkpoint";
9466
- }
9467
- }
9468
- function importanceForReason(reason, override) {
9469
- if (override !== void 0) return override;
9470
- switch (reason) {
9471
- case "periodic":
9472
- return 7;
9473
- case "session-end":
9474
- case "pre-compact":
9475
- case "capacity-signal":
9476
- return 8;
9477
- }
9478
- }
9479
- function buildContinuityCheckpoint(input2) {
9480
- const { checkpointText, decisionTexts } = buildAutoCheckpoint({
9481
- agentId: input2.agentId,
9482
- agentRole: input2.agentRole,
9483
- sessionId: input2.sessionId,
9484
- projectName: input2.projectName,
9485
- reason: input2.reason,
9486
- memories: input2.memories ?? [],
9487
- tasks: input2.tasks ?? [],
9488
- maxSamples: input2.maxSamples
9489
- });
9490
- const extra = input2.extraSections?.filter((section) => section.trim().length > 0) ?? [];
9491
- return {
9492
- checkpointText: extra.length > 0 ? `${checkpointText}
9493
-
9494
- ${extra.join("\n\n")}` : checkpointText,
9495
- decisionTexts
9496
- };
9497
- }
9498
- async function writeContinuityCheckpoint(input2) {
9499
- const result = buildContinuityCheckpoint(input2);
9500
- const now = (/* @__PURE__ */ new Date()).toISOString();
9501
- await writeMemoryViaDaemon({
9502
- raw_text: result.checkpointText,
9503
- agent_id: input2.agentId,
9504
- agent_role: input2.agentRole,
9505
- session_id: input2.sessionId,
9506
- tool_name: toolNameForReason(input2.reason),
9507
- project_name: input2.projectName,
9508
- timestamp: now,
9509
- importance: importanceForReason(input2.reason, input2.importance),
9510
- task_id: input2.taskId,
9511
- memory_type: "checkpoint"
9512
- });
9513
- const decisionLimit = input2.reason === "periodic" ? 3 : 5;
9514
- for (const decisionText of result.decisionTexts.slice(0, decisionLimit)) {
9515
- await writeMemoryViaDaemon({
9516
- raw_text: decisionText,
9517
- agent_id: input2.agentId,
9518
- agent_role: input2.agentRole,
9519
- session_id: input2.sessionId,
9520
- tool_name: "auto-decision",
9521
- project_name: input2.projectName,
9522
- timestamp: (/* @__PURE__ */ new Date()).toISOString(),
9523
- importance: 8,
9524
- memory_type: "decision"
9525
- });
9526
- }
9527
- return result;
9528
- }
9529
-
9530
9489
  // src/adapters/claude/hooks/session-end.ts
9531
9490
  if (!process.env.AGENT_ID) {
9532
9491
  process.env.AGENT_ID = "default";
@@ -9576,7 +9535,7 @@ Orphaned tasks at session end: ${orphanResult.rows.map((r) => `"${String(r.title
9576
9535
  ORDER BY priority ASC, updated_at DESC LIMIT 10`,
9577
9536
  args: [agent.agentId, ...seScope.args]
9578
9537
  });
9579
- await writeContinuityCheckpoint({
9538
+ const { checkpointText, decisionTexts } = buildAutoCheckpoint({
9580
9539
  agentId: agent.agentId,
9581
9540
  agentRole: agent.agentRole,
9582
9541
  sessionId: data.session_id,
@@ -9584,9 +9543,35 @@ Orphaned tasks at session end: ${orphanResult.rows.map((r) => `"${String(r.title
9584
9543
  reason: "session-end",
9585
9544
  memories: recent.rows,
9586
9545
  tasks: taskRows.rows,
9587
- maxSamples: 12,
9588
- extraSections: orphanInfo ? [`## Session-End Warnings${orphanInfo}`] : []
9546
+ maxSamples: 12
9589
9547
  });
9548
+ const { writeMemoryViaDaemon: writeMemoryViaDaemon2 } = await Promise.resolve().then(() => (init_memory_queue_client(), memory_queue_client_exports));
9549
+ await writeMemoryViaDaemon2({
9550
+ raw_text: `${checkpointText}${orphanInfo ? `
9551
+
9552
+ ## Session-End Warnings${orphanInfo}` : ""}`,
9553
+ agent_id: agent.agentId,
9554
+ agent_role: agent.agentRole,
9555
+ session_id: data.session_id,
9556
+ tool_name: "SessionEnd",
9557
+ project_name: projectName,
9558
+ timestamp: (/* @__PURE__ */ new Date()).toISOString(),
9559
+ importance: 8,
9560
+ memory_type: "checkpoint"
9561
+ });
9562
+ for (const decisionText of decisionTexts.slice(0, 5)) {
9563
+ await writeMemoryViaDaemon2({
9564
+ raw_text: decisionText,
9565
+ agent_id: agent.agentId,
9566
+ agent_role: agent.agentRole,
9567
+ session_id: data.session_id,
9568
+ tool_name: "auto-decision",
9569
+ project_name: projectName,
9570
+ timestamp: (/* @__PURE__ */ new Date()).toISOString(),
9571
+ importance: 8,
9572
+ memory_type: "decision"
9573
+ });
9574
+ }
9590
9575
  try {
9591
9576
  const { clearSessionFileReads: clearSessionFileReads2 } = await Promise.resolve().then(() => (init_git_staleness(), git_staleness_exports));
9592
9577
  await clearSessionFileReads2(data.session_id);
@@ -6952,6 +6952,46 @@ function vectorToBlob(vector) {
6952
6952
  // src/adapters/claude/hooks/summary-worker.ts
6953
6953
  init_database();
6954
6954
  init_notifications();
6955
+
6956
+ // src/lib/memory-queue-client.ts
6957
+ init_exe_daemon_client();
6958
+
6959
+ // src/lib/memory-queue.ts
6960
+ init_config();
6961
+ import { appendFileSync as appendFileSync2, readFileSync as readFileSync11, renameSync as renameSync5, unlinkSync as unlinkSync4, existsSync as existsSync15, statSync as statSync3 } from "fs";
6962
+ import path16 from "path";
6963
+ var QUEUE_PATH2 = path16.join(EXE_AI_DIR, "memory-queue.jsonl");
6964
+ var PROCESSING_PATH = QUEUE_PATH2 + ".processing";
6965
+ var TTL_MS2 = 24 * 60 * 60 * 1e3;
6966
+ function enqueueMemory(entry) {
6967
+ appendFileSync2(QUEUE_PATH2, JSON.stringify(entry) + "\n");
6968
+ }
6969
+
6970
+ // src/lib/memory-queue-client.ts
6971
+ async function writeMemoryViaDaemon(entry) {
6972
+ if (process.env.EXE_IS_DAEMON === "1") {
6973
+ enqueueMemory(entry);
6974
+ return false;
6975
+ }
6976
+ if (!isClientConnected()) {
6977
+ enqueueMemory(entry);
6978
+ return false;
6979
+ }
6980
+ try {
6981
+ const response = await sendDaemonRequest({
6982
+ type: "write-memory",
6983
+ entry
6984
+ });
6985
+ if (response.ok) return true;
6986
+ enqueueMemory(entry);
6987
+ return false;
6988
+ } catch {
6989
+ enqueueMemory(entry);
6990
+ return false;
6991
+ }
6992
+ }
6993
+
6994
+ // src/adapters/claude/hooks/summary-worker.ts
6955
6995
  init_task_scope();
6956
6996
  init_employees();
6957
6997
  import { execSync as execSync5 } from "child_process";
@@ -7038,119 +7078,6 @@ function buildAutoCheckpoint(input) {
7038
7078
  };
7039
7079
  }
7040
7080
 
7041
- // src/lib/memory-queue-client.ts
7042
- init_exe_daemon_client();
7043
-
7044
- // src/lib/memory-queue.ts
7045
- init_config();
7046
- import { appendFileSync as appendFileSync2, readFileSync as readFileSync11, renameSync as renameSync5, unlinkSync as unlinkSync4, existsSync as existsSync15, statSync as statSync3 } from "fs";
7047
- import path16 from "path";
7048
- var QUEUE_PATH2 = path16.join(EXE_AI_DIR, "memory-queue.jsonl");
7049
- var PROCESSING_PATH = QUEUE_PATH2 + ".processing";
7050
- var TTL_MS2 = 24 * 60 * 60 * 1e3;
7051
- function enqueueMemory(entry) {
7052
- appendFileSync2(QUEUE_PATH2, JSON.stringify(entry) + "\n");
7053
- }
7054
-
7055
- // src/lib/memory-queue-client.ts
7056
- async function writeMemoryViaDaemon(entry) {
7057
- if (process.env.EXE_IS_DAEMON === "1") {
7058
- enqueueMemory(entry);
7059
- return false;
7060
- }
7061
- if (!isClientConnected()) {
7062
- enqueueMemory(entry);
7063
- return false;
7064
- }
7065
- try {
7066
- const response = await sendDaemonRequest({
7067
- type: "write-memory",
7068
- entry
7069
- });
7070
- if (response.ok) return true;
7071
- enqueueMemory(entry);
7072
- return false;
7073
- } catch {
7074
- enqueueMemory(entry);
7075
- return false;
7076
- }
7077
- }
7078
-
7079
- // src/lib/checkpoint-orchestrator.ts
7080
- function toolNameForReason(reason) {
7081
- switch (reason) {
7082
- case "periodic":
7083
- return "auto-summary";
7084
- case "session-end":
7085
- return "SessionEnd";
7086
- case "pre-compact":
7087
- return "pre-compact-hook";
7088
- case "capacity-signal":
7089
- return "auto-checkpoint";
7090
- }
7091
- }
7092
- function importanceForReason(reason, override) {
7093
- if (override !== void 0) return override;
7094
- switch (reason) {
7095
- case "periodic":
7096
- return 7;
7097
- case "session-end":
7098
- case "pre-compact":
7099
- case "capacity-signal":
7100
- return 8;
7101
- }
7102
- }
7103
- function buildContinuityCheckpoint(input) {
7104
- const { checkpointText, decisionTexts } = buildAutoCheckpoint({
7105
- agentId: input.agentId,
7106
- agentRole: input.agentRole,
7107
- sessionId: input.sessionId,
7108
- projectName: input.projectName,
7109
- reason: input.reason,
7110
- memories: input.memories ?? [],
7111
- tasks: input.tasks ?? [],
7112
- maxSamples: input.maxSamples
7113
- });
7114
- const extra = input.extraSections?.filter((section) => section.trim().length > 0) ?? [];
7115
- return {
7116
- checkpointText: extra.length > 0 ? `${checkpointText}
7117
-
7118
- ${extra.join("\n\n")}` : checkpointText,
7119
- decisionTexts
7120
- };
7121
- }
7122
- async function writeContinuityCheckpoint(input) {
7123
- const result = buildContinuityCheckpoint(input);
7124
- const now = (/* @__PURE__ */ new Date()).toISOString();
7125
- await writeMemoryViaDaemon({
7126
- raw_text: result.checkpointText,
7127
- agent_id: input.agentId,
7128
- agent_role: input.agentRole,
7129
- session_id: input.sessionId,
7130
- tool_name: toolNameForReason(input.reason),
7131
- project_name: input.projectName,
7132
- timestamp: now,
7133
- importance: importanceForReason(input.reason, input.importance),
7134
- task_id: input.taskId,
7135
- memory_type: "checkpoint"
7136
- });
7137
- const decisionLimit = input.reason === "periodic" ? 3 : 5;
7138
- for (const decisionText of result.decisionTexts.slice(0, decisionLimit)) {
7139
- await writeMemoryViaDaemon({
7140
- raw_text: decisionText,
7141
- agent_id: input.agentId,
7142
- agent_role: input.agentRole,
7143
- session_id: input.sessionId,
7144
- tool_name: "auto-decision",
7145
- project_name: input.projectName,
7146
- timestamp: (/* @__PURE__ */ new Date()).toISOString(),
7147
- importance: 8,
7148
- memory_type: "decision"
7149
- });
7150
- }
7151
- return result;
7152
- }
7153
-
7154
7081
  // src/adapters/claude/hooks/summary-worker.ts
7155
7082
  async function main() {
7156
7083
  const agentId = process.env.AGENT_ID ?? "default";
@@ -7209,8 +7136,15 @@ async function main() {
7209
7136
  taskRows = tasks.rows;
7210
7137
  } catch {
7211
7138
  }
7212
- const summarySessionId = `auto-summary-${Date.now()}`;
7213
- let summaryText = "";
7139
+ const { checkpointText: summaryText, decisionTexts } = buildAutoCheckpoint({
7140
+ agentId,
7141
+ agentRole,
7142
+ sessionId: `auto-summary-${Date.now()}`,
7143
+ projectName: primaryProject,
7144
+ reason: "periodic",
7145
+ memories: result.rows,
7146
+ tasks: taskRows
7147
+ });
7214
7148
  let limitReached = false;
7215
7149
  try {
7216
7150
  const { assertMemoryLimit: assertMemoryLimit2 } = await Promise.resolve().then(() => (init_plan_limits(), plan_limits_exports));
@@ -7228,16 +7162,30 @@ async function main() {
7228
7162
  }
7229
7163
  if (limitReached) {
7230
7164
  } else {
7231
- const checkpointResult = await writeContinuityCheckpoint({
7232
- agentId,
7233
- agentRole,
7234
- sessionId: summarySessionId,
7235
- projectName: primaryProject,
7236
- reason: "periodic",
7237
- memories: result.rows,
7238
- tasks: taskRows
7165
+ await writeMemoryViaDaemon({
7166
+ raw_text: summaryText,
7167
+ agent_id: agentId,
7168
+ agent_role: agentRole,
7169
+ session_id: `auto-summary-${Date.now()}`,
7170
+ tool_name: "auto-summary",
7171
+ project_name: primaryProject,
7172
+ timestamp: (/* @__PURE__ */ new Date()).toISOString(),
7173
+ importance: 7,
7174
+ memory_type: "checkpoint"
7239
7175
  });
7240
- summaryText = checkpointResult.checkpointText;
7176
+ for (const decisionText of decisionTexts.slice(0, 3)) {
7177
+ await writeMemoryViaDaemon({
7178
+ raw_text: decisionText,
7179
+ agent_id: agentId,
7180
+ agent_role: agentRole,
7181
+ session_id: `auto-decision-${Date.now()}`,
7182
+ tool_name: "auto-decision",
7183
+ project_name: primaryProject,
7184
+ timestamp: (/* @__PURE__ */ new Date()).toISOString(),
7185
+ importance: 8,
7186
+ memory_type: "decision"
7187
+ });
7188
+ }
7241
7189
  if (!canCoordinate(agentId, agentRole)) {
7242
7190
  let totalErrors = 0;
7243
7191
  for (const [, data] of projects) {