惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

WordPress大学
WordPress大学
A
About on SuperTechFans
小众软件
小众软件
Hugging Face - Blog
Hugging Face - Blog
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
博客园 - 叶小钗
博客园 - 聂微东
博客园 - Franky
Apple Machine Learning Research
Apple Machine Learning Research
罗磊的独立博客
量子位
博客园 - 三生石上(FineUI控件)
Recent Announcements
Recent Announcements
The GitHub Blog
The GitHub Blog
B
Blog RSS Feed
T
The Blog of Author Tim Ferriss
GbyAI
GbyAI
云风的 BLOG
云风的 BLOG
Last Week in AI
Last Week in AI
宝玉的分享
宝玉的分享
B
Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Stack Overflow Blog
Stack Overflow Blog
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC

Recent Commits to openclaw:main

test: merge chat side-result checks · openclaw/openclaw@ddd2c2a test: merge cron history checks · openclaw/openclaw@f7eb746 test: merge responsive navigation shell checks · openclaw/openclaw@c2e4b47 docs(changelog): add codex oauth fixes · openclaw/openclaw@628e6cd test: merge navigation routing cases · openclaw/openclaw@5d8cecb Tests: mock channel registry bundled fallback · openclaw/openclaw@2b08233 Secrets: avoid broad web search discovery for single plugin config · openclaw/openclaw@a464f59 test: merge config view browser checks · openclaw/openclaw@20cf511 fix(status): align oauth health with runtime · openclaw/openclaw@eed7116 feat: add macOS screen snapshots for monitor preview (#67954) thanks … · openclaw/openclaw@f377db1 fix: report shared auth scopes in hello-ok (#67810) thanks @BunsDev · openclaw/openclaw@0b6c39b Auto-reply: avoid eager bundled route fallback · openclaw/openclaw@3ea1bf4 Tests: narrow session binding contract setup · openclaw/openclaw@54e4e16 fix(macOS): enable undo/redo in webchat composer text input (#34962) · openclaw/openclaw@00951dc Tests: speed up channel setup promotion · openclaw/openclaw@82b529a Docs: refresh agent instructions · openclaw/openclaw@5775fe2 fix(auth): serialize OAuth refresh across agents to fix #26322 (#67876) · openclaw/openclaw@8e79080 test: allow ollama public surface boundary test · openclaw/openclaw@7d4f1a6 Docs: add test performance guardrails · openclaw/openclaw@89706d3 Tests: restore context-engine usage proof · openclaw/openclaw@e4c4f95 Tests: slim context engine runtime coverage · openclaw/openclaw@74c198f ci: retry failed custom checkouts · openclaw/openclaw@0ee5baf test: trim duplicate provider auth onboarding cases · openclaw/openclaw@1ffc02e matrix: fix sessions_spawn --thread subagent session spawning (#67643) · openclaw/openclaw@1ce2596 test: reduce auth choice fixture churn · openclaw/openclaw@857b9cd test: mock health status config boundaries · openclaw/openclaw@9d5ab4a test: mock onboard config io boundary · openclaw/openclaw@299694d test: mock legacy state plugin boundaries · openclaw/openclaw@2713089 test: mock channel install boundaries · openclaw/openclaw@b945248 test: mock doctor preview channel boundaries · openclaw/openclaw@b1a3ad4
fix(memory-lancedb): get memory records through ltm list ...
zhangyue1992 · 2026-04-30 · via Recent Commits to openclaw:main

@@ -48,6 +48,12 @@ type MemoryEntry = {

4848

createdAt: number;

4949

};

505051+

type MemoryListEntry = Omit<MemoryEntry, "vector">;

52+53+

type MemoryListOptions = {

54+

orderByCreatedAt?: boolean;

55+

};

56+5157

type MemorySearchResult = {

5258

entry: MemoryEntry;

5359

score: number;

@@ -151,6 +157,17 @@ function resolveAutoCaptureStartIndex(

151157

const TABLE_NAME = "memories";

152158

const DEFAULT_AUTO_RECALL_TIMEOUT_MS = 15_000;

153159160+

function parsePositiveIntegerOption(value: string | undefined, flag: string): number | undefined {

161+

if (value === undefined) {

162+

return undefined;

163+

}

164+

const parsed = Number(value);

165+

if (!Number.isInteger(parsed) || parsed < 1) {

166+

throw new Error(`${flag} must be a positive integer`);

167+

}

168+

return parsed;

169+

}

170+154171

class MemoryDB {

155172

private db: LanceDB.Connection | null = null;

156173

private table: LanceDB.Table | null = null;

@@ -241,6 +258,31 @@ class MemoryDB {

241258

return mapped.filter((r) => r.score >= minScore);

242259

}

243260261+

async list(limit?: number, options: MemoryListOptions = {}): Promise<MemoryListEntry[]> {

262+

await this.ensureInitialized();

263+264+

let query = this.table!.query().select(["id", "text", "importance", "category", "createdAt"]);

265+

// Push limit to LanceDB only when we don't need to sort in-memory.

266+

if (!options.orderByCreatedAt && limit !== undefined) {

267+

query = query.limit(limit);

268+

}

269+270+

const rows = await query.toArray();

271+272+

const entries = rows.map((row) => ({

273+

id: row.id as string,

274+

text: row.text as string,

275+

importance: row.importance as number,

276+

category: row.category as MemoryEntry["category"],

277+

createdAt: row.createdAt as number,

278+

}));

279+

if (options.orderByCreatedAt) {

280+

entries.sort((a, b) => b.createdAt - a.createdAt);

281+

}

282+283+

return limit === undefined ? entries : entries.slice(0, limit);

284+

}

285+244286

async delete(id: string): Promise<boolean> {

245287

await this.ensureInitialized();

246288

// Validate UUID format to prevent injection

@@ -797,9 +839,14 @@ export default definePluginEntry({

797839

memory

798840

.command("list")

799841

.description("List memories")

800-

.action(async () => {

801-

const count = await db.count();

802-

console.log(`Total memories: ${count}`);

842+

.option("--limit <n>", "Max results")

843+

.option("--order-by-created-at", "Order memories by createdAt descending", false)

844+

.action(async (opts) => {

845+

const limit = parsePositiveIntegerOption(opts.limit, "--limit");

846+

const entries = await db.list(limit, {

847+

orderByCreatedAt: Boolean(opts.orderByCreatedAt),

848+

});

849+

console.log(JSON.stringify(entries, null, 2));

803850

});

804851805852

memory