/** * Format memory hits for prompt injection. No Bare imports. */ function formatInject(hits, max) { const list = (hits || []).slice(0, max || 5); if (!list.length) return ''; return ( '[memory]\n' + list .map((h) => { const snip = String(h.snippet || '') .replace(/\s+/g, ' ') .trim() .slice(0, 220); return '- ' + (h.name || 'note') + (snip ? ': ' + snip : ''); }) .join('\n') ); } module.exports = { formatInject };