🌊 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
TypeScript agentic-aiagentic-frameworkagentic-workflowagentsai-agentsai-assistantai-skillsautonomous-agentsclaudecodexdsh-pluginharnessmcp-servermulti-agentmulti-agent-systemsnpmskillsswarmswarm-intelligencetypescript
fix(memory): #2073 — export returns real value + --value-only pipe-friendly retrieve
ruv0c31cbad48ab
diff --git a/v3/@claude-flow/cli/src/commands/memory.ts b/v3/@claude-flow/cli/src/commands/memory.tsindex 8a5db27d8f..66cce73ac3 100644--- a/v3/@claude-flow/cli/src/commands/memory.ts+++ b/v3/@claude-flow/cli/src/commands/memory.ts@@ -178,6 +178,19 @@ const retrieveCommand: Command = {description: 'Memory namespace',type: 'string',default: 'default'+ },+ // #2073: --format is the GLOBAL option (parser.ts:78) with choices+ // ['text', 'json', 'table'] and default 'text'. The retrieve handler+ // discriminates: 'json' emits parseable JSON, anything else (text/box/...)+ // emits the human-readable box. No per-command override needed; we just+ // document the behavior in the help text via examples.+ {+ // #2073: --value-only emits ONLY the value string (no wrapper).+ // Designed for piping into JSON.parse without any cleanup.+ name: 'value-only',+ description: 'Print only the stored value to stdout (no wrapper)',+ type: 'boolean',+ default: false}],action: async (ctx: CommandContext): Promise<CommandResult> => {@@ -206,6 +219,17 @@ const retrieveCommand: Command = {const entry = result.entry;+ // #2073: --value-only emits just the raw value (no decoration) for+ // piping into JSON.parse / jq / other downstream parsers without+ // any cleanup.+ if (ctx.flags['value-only'] || ctx.flags.valueOnly) {+ // Use process.stdout.write directly to bypass any printer-side+ // transformation of quotes/structural characters.+ process.stdout.write(entry.content);+ if (process.stdout.isTTY) process.stdout.write('\n');+ return { success: true, data: entry };+ }+if (ctx.flags.format === 'json') {output.printJson(entry);return { success: true, data: entry };diff --git a/v3/@claude-flow/cli/src/mcp-tools/memory-tools.ts b/v3/@claude-flow/cli/src/mcp-tools/memory-tools.tsindex 27226646aa..9d22a2eced 100644--- a/v3/@claude-flow/cli/src/mcp-tools/memory-tools.ts+++ b/v3/@claude-flow/cli/src/mcp-tools/memory-tools.ts@@ -1197,14 +1197,23 @@ export const memoryTools: MCPTool[] = [if (!outputPath) return { error: 'outputPath is required' };const namespace = input.namespace ? String(input.namespace) : undefined;if (namespace) { const v = validateIdentifier(namespace, 'namespace'); if (!v.valid) throw new Error(v.error); }- const all = await listEntries({ limit: 100000, namespace });+ // #2073: pass includeContent so the value field carries the actual+ // entry body. Without this, `value` is always null because listEntries+ // strips content by default (callers pay for the JSON parse only when+ // they need it).+ const all = await listEntries({ limit: 100000, namespace, includeContent: true });const payload = {schema: 'ruflo-memory-export/v1',exportedAt: new Date().toISOString(),namespace: namespace ?? null,count: all.entries.length,entries: all.entries.map(e => ({- key: e.key, namespace: e.namespace, value: (e as { value?: unknown }).value ?? null,+ key: e.key,+ namespace: e.namespace,+ // #2073: `e.content` is the stored value string; `e.value` was a+ // never-populated alias. Fall back to null only if content is+ // missing for backward-compat with the schema.+ value: typeof e.content === 'string' ? e.content : ((e as { value?: unknown }).value ?? null),createdAt: e.createdAt, updatedAt: e.updatedAt, accessCount: e.accessCount, hasEmbedding: e.hasEmbedding, size: e.size,})),};diff --git a/v3/@claude-flow/cli/src/memory/memory-bridge.ts b/v3/@claude-flow/cli/src/memory/memory-bridge.tsindex accaa4f0e6..27c5301cf1 100644--- a/v3/@claude-flow/cli/src/memory/memory-bridge.ts+++ b/v3/@claude-flow/cli/src/memory/memory-bridge.ts@@ -791,6 +791,8 @@ export async function bridgeListEntries(options: {limit?: number;offset?: number;dbPath?: string;+ /** #2073: When true, include the entry's full `content` string in each result. */+ includeContent?: boolean;}): Promise<{success: boolean;entries: {@@ -802,6 +804,8 @@ export async function bridgeListEntries(options: {createdAt: string;updatedAt: string;hasEmbedding: boolean;+ /** #2073: Present when `includeContent: true` was requested. */+ content?: string;}[];total: number;error?: string;@@ -842,8 +846,10 @@ export async function bridgeListEntries(options: {`);const rows = stmt.all(...nsParams, limit, offset);for (const row of rows) {- entries.push({- id: String(row.id).substring(0, 20),+ const entry: Record<string, unknown> = {+ // #2073: don't truncate id when content is requested — callers+ // (notably memory_export) need the full id to round-trip via import.+ id: options.includeContent ? String(row.id) : String(row.id).substring(0, 20),key: row.key || String(row.id).substring(0, 15),namespace: row.namespace || 'default',size: (row.content || '').length,@@ -851,7 +857,11 @@ export async function bridgeListEntries(options: {createdAt: row.created_at || new Date().toISOString(),updatedAt: row.updated_at || new Date().toISOString(),hasEmbedding: !!(row.embedding && String(row.embedding).length > 10),- });+ };+ if (options.includeContent) {+ entry.content = row.content || '';+ }+ entries.push(entry);}} catch {return null;diff --git a/v3/@claude-flow/cli/src/memory/memory-initializer.ts b/v3/@claude-flow/cli/src/memory/memory-initializer.tsindex 5842fcffdb..33238552aa 100644--- a/v3/@claude-flow/cli/src/memory/memory-initializer.ts+++ b/v3/@claude-flow/cli/src/memory/memory-initializer.ts@@ -2490,6 +2490,8 @@ export async function listEntries(options: {limit?: number;offset?: number;dbPath?: string;+ /** #2073: When true, include the entry's full `content` string in each result. */+ includeContent?: boolean;}): Promise<{success: boolean;entries: {@@ -2501,6 +2503,8 @@ export async function listEntries(options: {createdAt: string;updatedAt: string;hasEmbedding: boolean;+ /** #2073: Present when `includeContent: true` was requested. */+ content?: string;}[];total: number;error?: string;@@ -2578,6 +2582,7 @@ export async function listEntries(options: {createdAt: string;updatedAt: string;hasEmbedding: boolean;+ content?: string;}[] = [];if (result[0]?.values) {@@ -2585,8 +2590,20 @@ export async function listEntries(options: {const [id, key, ns, content, embedding, accessCount, createdAt, updatedAt] = row as [string, string, string, string, string | null, number, string, string];- entries.push({- id: String(id).substring(0, 20),+ const entry: {+ id: string;+ key: string;+ namespace: string;+ size: number;+ accessCount: number;+ createdAt: string;+ updatedAt: string;+ hasEmbedding: boolean;+ content?: string;+ } = {+ // #2073: don't truncate id when content is requested — callers+ // (notably memory_export) need the full id to round-trip via import.+ id: options.includeContent ? String(id) : String(id).substring(0, 20),key: key || String(id).substring(0, 15),namespace: ns || 'default',size: (content || '').length,@@ -2594,7 +2611,11 @@ export async function listEntries(options: {createdAt: createdAt || new Date().toISOString(),updatedAt: updatedAt || new Date().toISOString(),hasEmbedding: !!embedding && embedding.length > 10- });+ };+ if (options.includeContent) {+ entry.content = content || '';+ }+ entries.push(entry);}}