MCPcopy Create free account
hub / github.com/Doorman11991/smallcode / formatForPrompt

Method formatForPrompt

src/knowledge/loader.js:239–247  ·  view source on GitHub ↗

* Format selected entries as a system-prompt block. Returns '' if nothing * matches.

(query, opts = {})

Source from the content-addressed store, hash-verified

237 * matches.
238 */
239 formatForPrompt(query, opts = {}) {
240 const entries = this.selectForQuery(query, opts);
241 if (entries.length === 0) return '';
242 let out = '\n\nRelevant reference notes:\n';
243 for (const e of entries) {
244 out += `\n--- ${e.relPath} ---\n${e.content}\n`;
245 }
246 return out;
247 }
248
249 /**
250 * Drop the cached index — next call rebuilds. Useful in tests or after

Callers

nothing calls this directly

Calls 1

selectForQueryMethod · 0.95

Tested by

no test coverage detected