MCPcopy Create free account
hub / github.com/QodeXcli/QodeX / formatApproaches

Function formatApproaches

src/context/approach-recall.ts:118–128  ·  view source on GitHub ↗
(query: string, matches: ApproachMatch[])

Source from the content-addressed store, hash-verified

116
117/** Render matches into a concise, agent-readable block. PURE. Empty when none. */
118export function formatApproaches(query: string, matches: ApproachMatch[]): string {
119 if (matches.length === 0) return `No past work on this project resembles "${query}".`;
120 const lines = [`How you approached similar work before — "${query}":`, ''];
121 for (const m of matches) {
122 const tag = m.kind === 'episode' ? '🎯 task' : m.kind === 'fact' ? '🧠 fact' : m.kind === 'receipt' ? '🧾 receipt' : `📝 ${m.detail ?? 'worklog'}`;
123 const head = m.text.replace(/\s+/g, ' ').trim().slice(0, 140);
124 const files = m.files?.length ? ` (touched: ${m.files.slice(0, 4).join(', ')})` : '';
125 lines.push(`- [${tag} · ${m.when}] ${head}${files}`);
126 }
127 return lines.join('\n');
128}

Callers 1

Calls 1

pushMethod · 0.45

Tested by

no test coverage detected