From aa5cce3fd014dfc7f63954bddf05135aec05cd34 Mon Sep 17 00:00:00 2001 From: Luca Martial Date: Thu, 25 Jun 2026 17:15:27 -0700 Subject: [PATCH] fix(memory): surface segments in the SL index for re-run gap targeting The SL index shown to the agent on each re-run listed measures and joins but not segments, so repeat passes could not see which existing sources were thin on segments and re-derived blindly. The index now reports segment counts and names alongside measures, and a source is only flagged for enrichment when measures, segments, and joins are all empty. Co-Authored-By: Claude Opus 4.8 --- packages/cli/src/context/memory/memory-agent.service.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/cli/src/context/memory/memory-agent.service.ts b/packages/cli/src/context/memory/memory-agent.service.ts index 491cd159..13f71753 100644 --- a/packages/cli/src/context/memory/memory-agent.service.ts +++ b/packages/cli/src/context/memory/memory-agent.service.ts @@ -615,15 +615,19 @@ export class MemoryAgentService { : sources .map((s) => { const measureCount = s.measures.length; + const segmentCount = s.segments?.length ?? 0; const joinCount = s.joins?.length ?? 0; - const header = `${s.name} [measures=${measureCount}, joins=${joinCount}]`; - if (measureCount === 0 && joinCount === 0) { + const header = `${s.name} [measures=${measureCount}, segments=${segmentCount}, joins=${joinCount}]`; + if (measureCount === 0 && segmentCount === 0 && joinCount === 0) { return `${header} — candidate for enrichment`; } const parts: string[] = [header]; if (measureCount > 0) { parts.push(` measures: ${s.measures.map((m) => `${s.name}.${m.name}`).join(', ')}`); } + if (segmentCount > 0) { + parts.push(` segments: ${(s.segments ?? []).map((seg) => seg.name).join(', ')}`); + } if (joinCount > 0) { parts.push(` joins: ${(s.joins ?? []).map((j) => `→ ${j.to} (${j.relationship})`).join(', ')}`); }