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

Function buildEpisodeBlock

src/context/episodic-memory.ts:145–154  ·  view source on GitHub ↗
(matches: EpisodeMatch[])

Source from the content-addressed store, hash-verified

143
144/** Build the concise system-prompt block from matches. Empty when none. */
145export function buildEpisodeBlock(matches: EpisodeMatch[]): string {
146 if (matches.length === 0) return '';
147 const lines = ['# Similar past work (your own, on this project)', '',
148 'You have done comparable tasks here before. Reuse what worked — don\'t rediscover it:', ''];
149 for (const m of matches) {
150 const files = m.filesChanged.slice(0, 4).join(', ');
151 lines.push(`- **"${m.prompt.replace(/\s+/g, ' ').trim().slice(0, 80)}"** → ${m.summary.replace(/\s+/g, ' ').trim().slice(0, 160)}${files ? ` (touched: ${files})` : ''}`);
152 }
153 return lines.join('\n');
154}
155
156/** Convenience: read → rank → build the injectable block for a query. Used by the loop.
157 * Builds a one-shot file-existence Set (each touched file checked once) so the pure ranker

Callers 2

loadEpisodeBlockFunction · 0.85

Calls 1

pushMethod · 0.45

Tested by

no test coverage detected