Skip to content

armgit / ruflo

Public Imported from GitHub
0

🌊 The original agent harness. Deploy intelligent multi-player swarms, coordinate autonomous workflows, and build conversational AI systems. Features adaptive memory, self-learning intelligence, federation, vector RAG integration, and native Claude Code / Codex / Hermes and many more Integrated

Merge PR #3442: fix(memory): scope bridge failures to canonical database paths

ruv35728975b45a
diff --cc v3/@claude-flow/cli/src/memory/memory-bridge.ts
index 5d22c5063d,bbab76a207..1c3794c187
--- a/v3/@claude-flow/cli/src/memory/memory-bridge.ts
+++ b/v3/@claude-flow/cli/src/memory/memory-bridge.ts
@@@ -3367,56 -3355,8 +3442,57 @@@ export async function bridgeBatchOperat
* Synthesize context from memories.
* ContextSynthesizer.synthesize is a static method that takes MemoryPattern[] (not a string).
*/
+type ContextEpisode = {
+ task: string;
+ reward: number;
+ success: boolean;
+ critique?: string;
+ input?: string;
+ output?: string;
+};
+
+function contextEpisodeFrom(value: unknown): ContextEpisode | null {
+ if (typeof value === 'string') {
+ try { value = JSON.parse(value); }
+ catch { return null; }
+ }
+ if (!value || typeof value !== 'object' || Array.isArray(value)) return null;
+
+ const record = value as Record<string, unknown>;
+ const owns = (key: string) => Object.prototype.hasOwnProperty.call(record, key);
+ if (!owns('task') || !owns('reward') || !owns('success')
+ || typeof record.task !== 'string' || !record.task.trim()
+ || typeof record.reward !== 'number' || !Number.isFinite(record.reward)
+ || typeof record.success !== 'boolean') return null;
+
+ const episode: ContextEpisode = {
+ task: record.task.trim(),
+ reward: record.reward,
+ success: record.success,
+ };
+ for (const field of ['critique', 'input', 'output'] as const) {
+ if (owns(field)) {
+ if (typeof record[field] !== 'string') return null;
+ episode[field] = record[field];
+ }
+ }
+ return episode;
+}
+
+function contextEpisodeFromRecall(row: unknown): ContextEpisode | null {
+ if (!row || typeof row !== 'object' || Array.isArray(row)) return null;
+ const record = row as Record<string, unknown>;
+ for (const field of [null, 'metadata', 'value', 'content'] as const) {
+ const candidate = field === null ? record
+ : Object.prototype.hasOwnProperty.call(record, field) ? record[field] : undefined;
+ const episode = contextEpisodeFrom(candidate);
+ if (episode) return episode;
+ }
+ return null;
+}
+
export async function bridgeContextSynthesize(params: { query: string; maxEntries?: number }): Promise<any> {
+ if (!operationContext.getStore()?.active) return withBridgeOperation(() => bridgeContextSynthesize(params));
const registry = await getRegistry();
if (!registry) return null;
try {