MCPcopy
hub / github.com/aiming-lab/MetaClaw / list_active

Method list_active

metaclaw/memory/store.py:464–478  ·  view source on GitHub ↗
(self, scope_id: str, limit: int = 100)

Source from the content-addressed store, hash-verified

462 return count
463
464 def list_active(self, scope_id: str, limit: int = 100) -> list[MemoryUnit]:
465 with self._lock:
466 rows = self.conn.execute(
467 """
468 SELECT * FROM memories
469 WHERE scope_id = ? AND status = ?
470 ORDER BY updated_at DESC
471 LIMIT ?
472 """,
473 (scope_id, MemoryStatus.ACTIVE.value, limit),
474 ).fetchall()
475 units = [self._row_to_unit(row) for row in rows]
476 # Filter out expired memories.
477 now_iso = _utc_now_iso()
478 return [u for u in units if not u.expires_at or u.expires_at > now_iso]
479
480 def expire_stale(self, scope_id: str) -> int:
481 """Archive memories that have passed their expires_at timestamp.

Calls 2

_row_to_unitMethod · 0.95
_utc_now_isoFunction · 0.70