agent-working-memory 0.5.0 → 0.5.2

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.
@@ -197,9 +197,15 @@ export class EngramStore {
197
197
  checkpoint_at TEXT,
198
198
  last_consolidation_at TEXT,
199
199
  last_mini_consolidation_at TEXT,
200
+ consolidation_cycle_count INTEGER NOT NULL DEFAULT 0,
200
201
  updated_at TEXT NOT NULL DEFAULT (datetime('now'))
201
202
  )
202
203
  `);
204
+
205
+ // Migration: add consolidation_cycle_count if missing (existing DBs)
206
+ try {
207
+ this.db.exec(`ALTER TABLE conscious_state ADD COLUMN consolidation_cycle_count INTEGER NOT NULL DEFAULT 0`);
208
+ } catch { /* column already exists */ }
203
209
  }
204
210
 
205
211
  // --- Engram CRUD ---
@@ -926,6 +932,7 @@ export class EngramStore {
926
932
  last_mini_consolidation_at = ?,
927
933
  write_count_since_consolidation = 0,
928
934
  recall_count_since_consolidation = 0,
935
+ consolidation_cycle_count = consolidation_cycle_count + 1,
929
936
  updated_at = ?
930
937
  WHERE agent_id = ?
931
938
  `).run(now, now, now, agentId);
@@ -943,6 +950,13 @@ export class EngramStore {
943
950
  }));
944
951
  }
945
952
 
953
+ getConsolidationCycleCount(agentId: string): number {
954
+ const row = this.db.prepare(
955
+ 'SELECT consolidation_cycle_count FROM conscious_state WHERE agent_id = ?',
956
+ ).get(agentId) as { consolidation_cycle_count: number } | undefined;
957
+ return row?.consolidation_cycle_count ?? 0;
958
+ }
959
+
946
960
  close(): void {
947
961
  this.db.close();
948
962
  }