From c3ba64d56b4120e56480083c2ee11cfeb412e75a Mon Sep 17 00:00:00 2001 From: OfficialDelta <51007646+OfficialDelta@users.noreply.github.com> Date: Tue, 7 Apr 2026 23:48:06 -0400 Subject: [PATCH] M005: Tiered Context Injection - Scoped knowledge queries & roadmap excerpts - Added queryKnowledge() for keyword-based KNOWLEDGE.md section filtering - Added formatRoadmapExcerpt() for slice-scoped roadmap excerpts - Added inlineKnowledgeScoped() and inlineRoadmapExcerpt() to auto-prompts - Context reduction: ~65% for knowledge, ~67% for roadmap excerpts - Also includes deriveSliceScope() fix for unit IDs and process words Squash merge of milestone/M005 --- src/resources/extensions/gsd/auto-prompts.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/resources/extensions/gsd/auto-prompts.ts b/src/resources/extensions/gsd/auto-prompts.ts index a3d86cffd..43b61bd2e 100644 --- a/src/resources/extensions/gsd/auto-prompts.ts +++ b/src/resources/extensions/gsd/auto-prompts.ts @@ -363,8 +363,14 @@ const GENERIC_WORDS = new Set([ 'fix', 'fixes', 'add', 'adds', 'remove', 'removes', 'create', 'creates', 'build', 'builds', 'deploy', 'deployment', 'refactor', 'refactoring', 'cleanup', 'polish', 'review', + // Process/activity words that describe what you're doing, not what domain + 'hardening', 'validation', 'verification', 'optimization', + 'improvement', 'enhancement', 'infrastructure', ]); +// Pattern to match slice/milestone/task IDs (e.g., S01, M001, T03) +const UNIT_ID_PATTERN = /^[smt]\d+$/i; + /** * Derive a scope keyword from slice title and optional description. * Returns the most specific noun (first non-generic keyword) for decision scoping. @@ -394,17 +400,18 @@ export function deriveSliceScope(sliceTitle: string, sliceDescription?: string): // Find the first word that is: // 1. Not a stopword // 2. Not a generic word - // 3. At least 3 characters (meaningful scope) + // 3. Not a unit ID (S01, M001, T03) + // 4. At least 3 characters (meaningful scope) for (const word of words) { if (STOPWORDS.has(word)) continue; if (GENERIC_WORDS.has(word)) continue; + if (UNIT_ID_PATTERN.test(word)) continue; if (word.length < 3) continue; return word; } return undefined; } - /** * Extract keywords from a slice title for scoped knowledge queries. * Splits on whitespace, filters stopwords, lowercases.