Answer "what is Varaverk" with Varaverk's own README

The PURPOSE intent cannot tell the project from a script inside it, so asking
about the whole promoted every component's summary at once.
This commit is contained in:
Gmer4Lfe
2026-08-12 19:23:44 -04:00
parent faa4a06c42
commit ec3084db12
+21 -3
View File
@@ -98,9 +98,27 @@ async function search(opts) {
const rows = db.prepare(sql).all(...args);
if (!rows.length) { db.close(); return { results: [], intents: [], scanned: 0 }; }
const qv = await embedQuery(url, embedModel, query);
const intents = section ? [] : detectIntent(query);
const wantDoc = /\b(how do i|steps|procedure|setup|install|troubleshoot|guide)\b/i.test(query);
const qv = await embedQuery(url, embedModel, query);
let intents = section ? [] : detectIntent(query);
// "What is Varaverk" and "what is arr_sync.sh" are not the same question, and the PURPOSE
// intent cannot tell them apart — it fires on both and boosts every PURPOSE block in the
// repository at once. There are a couple of hundred, each genuinely describing the purpose of
// something, and each a short sentence containing the word Varaverk. The project's own README
// then loses to a script that migrates storage modes, because a paragraph is more diluted
// than a one-line summary.
//
// A question that names the project and no component inside it is asking about the whole, so
// PURPOSE is precisely the wrong section to promote. Dropping only that intent, rather than
// all of them, leaves "why was Varaverk built this way" still routed to DESIGN PRINCIPLES.
const namesProject = /\bvaraverk\b/i.test(query);
const namesComponent = /\b[\w.-]+\.(sh|php|js)\b|\b[A-Z][A-Z0-9]*(_[A-Z0-9]+)+\b/.test(query);
const projectLevel = namesProject && !namesComponent;
if (projectLevel) intents = intents.filter(s => s !== 'PURPOSE');
// The same question wants the top-level prose, which is what the doc kinds are.
const wantDoc = projectLevel
|| /\b(how do i|steps|procedure|setup|install|troubleshoot|guide)\b/i.test(query);
const scored = rows.map(r => {
let s = dot(qv, blobToVec(r.vector));