# Development Log: Query Intent Search Tuning ## Purpose Improve Second Brain search relevance and answer framing for questions about customer evaluation, approval likelihood, UX, business value, and requirement fit. ## User Feedback The answer became safer, but Second Brain still retrieved architecture documents for a question that was really about customer experience, approval risk, and business direction. Approval likelihood should also be labeled as inference, not fact. ## Implementation Summary - Added `queryIntent` classification to Second Brain Trace: - `technical` - `ux-business` - `governance` - `general` - Expanded retrieval query terms based on intent. - For `ux-business`, boosted UX, customer journey, product discovery, virtual store, stakeholder approval, requirement fit, business value, acceptance criteria, and conversion-flow documents. - For `ux-business`, penalized API Gateway, microservice, monolithic, backend, database, routing, and generic architecture-principles paths. - Added Trace context guidance that approval likelihood is inference unless explicit approval criteria are provided. - Added base and Guard prompt guidance to prefer UX/business framing over technical architecture for these questions. - Added tests to verify UX/business docs outrank API Gateway docs for approval/customer-experience questions. ## Changed Files - `src/features/secondBrainTrace.ts` - `src/features/projectChronicle/guardPrompt.ts` - `src/utils.ts` - `tests/secondBrainTrace.test.ts` - `tests/projectChronicleGuardPrompt.test.ts` ## Verification - `./node_modules/.bin/tsc --noEmit` - `npm run compile` - `./node_modules/.bin/jest --runInBand` ## Result Second Brain Trace should now better match the user's question intent. Customer approval and UX/business-fit questions should retrieve customer journey and business-value notes before generic technical architecture notes.