diff --git a/src/gateway/chat/tool-scope.ts b/src/gateway/chat/tool-scope.ts index f97d70d..18ec47d 100644 --- a/src/gateway/chat/tool-scope.ts +++ b/src/gateway/chat/tool-scope.ts @@ -401,8 +401,13 @@ export function buildSkillToolFilter(input: ToolScopeInput): (toolName: string) // 제거가 아니라 게이팅인 이유: 사용자가 "기억해둬"라고 명시하는 턴에는 반드시 있어야 한다. // 평상시 장기기억은 일별 로그 + Chroma 자동 추출이 담당하지만([[project_vector_memory_chroma]]), // 그건 하루 뒤에 반영되는 배치라 "지금 이걸 기억해"의 대체재가 아니다. - // memory_stats는 벡터 스토어를 보므로 게이트 대상이 아니다(실제로 13회 호출됨). + // memory_stats는 원래 게이트 밖이었으나(13회 호출) 10-25 재집계: 18회 중 16회가 벤치·테스트 세션의 "몇 개나 + // 기억해?" — 실사용 2회. 매 턴 374자를 내던 것을 기억·메모리·벡터 어휘에서만 연다. if (manualMemoryToolNames.has(name) && !hasMemoryIntentKeyword) return false; + if (name === 'memory_stats' && !/기억|메모리|벡터|memory|vector|chroma/i.test(topicText)) return false; + // search_images(Pexels·Unsplash 스톡 사진)도 매 턴 열려 있었다. 실사용은 전부 "사진/이미지 찾아줘"였고, 그 밖의 + // 두 번은 오용 — 10-25 "몬타나"(지도 요청)에 대마초 사진 포함 스톡 3장, "카메라 사진 보여줘"(CCTV)에 스톡 검색. + if (name === 'search_images' && !/사진|이미지|그림|생겼|모습|photo|image|picture|pic\b/i.test(topicText)) return false; if (name === 'sqlite_query' && !hasSqliteKeyword) return false; if (name === 'image_edit' && !hasImageEditKeyword) return false; if (name === 'image_read' && !hasImageAttachment) return false; diff --git a/tests/exchange-rate.test.ts b/tests/exchange-rate.test.ts index 7aa30b4..490f439 100644 --- a/tests/exchange-rate.test.ts +++ b/tests/exchange-rate.test.ts @@ -52,3 +52,17 @@ describe('exchange_rate 게이트', () => { assert.equal(filter('한달에 300 만원 정도란 거지?'), false); }); }); + +describe('기본 노출 다이어트(10-25)', () => { + const on = (message: string, tool: string) => buildSkillToolFilter({ + message, recentUserText: message, lastAssistantMsg: '', sessionId: 'abc', userWorkspace: null, isSkillEnabledForUser: () => true, + } as any)(tool); + test('search_images는 사진 요청에만', () => { + assert.equal(on('눈향나무 사진 찾아줘', 'search_images'), true); + assert.equal(on('몬타나', 'search_images'), false); + }); + test('memory_stats는 기억 질문에만', () => { + assert.equal(on('너 나에 대해 기억하는 게 몇 개나 돼?', 'memory_stats'), true); + assert.equal(on('몬태나 살기 좋은 곳', 'memory_stats'), false); + }); +});