Add 7 living memory tools: split, merge, dedupe, prune, reorganize, bulk_tag, stats

This commit is contained in:
2026-02-02 23:29:44 +01:00
parent f273ab3dbd
commit f65653e260
2 changed files with 260 additions and 2 deletions

View File

@@ -57,6 +57,12 @@ export function getConnections(nodeId: string): { incoming: (Edge & { node: Node
};
}
export function getEdgesByNode(nodeId: string): Edge[] {
const db = getDb();
const rows = db.prepare('SELECT * FROM edges WHERE from_id = ? OR to_id = ?').all(nodeId, nodeId) as any[];
return rows.map(rowToEdge);
}
export function buildTree(rootId?: string): TreeNode[] {
const db = getDb();
const edges = db.prepare('SELECT * FROM edges').all() as any[];